@tiangong-lca/cli 0.0.28 → 0.0.30

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 (38) hide show
  1. package/README.md +90 -2
  2. package/dist/src/cli.js +553 -4
  3. package/dist/src/cli.js.map +1 -1
  4. package/dist/src/lib/dataset-command.js +11 -0
  5. package/dist/src/lib/dataset-command.js.map +1 -1
  6. package/dist/src/lib/dataset-maintenance-contract.js.map +1 -1
  7. package/dist/src/lib/dataset-maintenance-flow-identity-approval-claim.js +175 -0
  8. package/dist/src/lib/dataset-maintenance-flow-identity-approval-claim.js.map +1 -0
  9. package/dist/src/lib/dataset-maintenance-flow-identity-capture.js +511 -0
  10. package/dist/src/lib/dataset-maintenance-flow-identity-capture.js.map +1 -0
  11. package/dist/src/lib/dataset-maintenance-flow-identity-command.js +26 -0
  12. package/dist/src/lib/dataset-maintenance-flow-identity-command.js.map +1 -0
  13. package/dist/src/lib/dataset-maintenance-flow-identity-contract.js +784 -0
  14. package/dist/src/lib/dataset-maintenance-flow-identity-contract.js.map +1 -0
  15. package/dist/src/lib/dataset-maintenance-flow-identity-execution-contract.js +1317 -0
  16. package/dist/src/lib/dataset-maintenance-flow-identity-execution-contract.js.map +1 -0
  17. package/dist/src/lib/dataset-maintenance-flow-identity-freeze.js +342 -0
  18. package/dist/src/lib/dataset-maintenance-flow-identity-freeze.js.map +1 -0
  19. package/dist/src/lib/dataset-maintenance-flow-identity-plan.js +900 -0
  20. package/dist/src/lib/dataset-maintenance-flow-identity-plan.js.map +1 -0
  21. package/dist/src/lib/dataset-maintenance-flow-identity-recovery.js +688 -0
  22. package/dist/src/lib/dataset-maintenance-flow-identity-recovery.js.map +1 -0
  23. package/dist/src/lib/dataset-maintenance-flow-identity-run.js +1369 -0
  24. package/dist/src/lib/dataset-maintenance-flow-identity-run.js.map +1 -0
  25. package/dist/src/lib/dataset-maintenance-flow-identity-seal.js +144 -0
  26. package/dist/src/lib/dataset-maintenance-flow-identity-seal.js.map +1 -0
  27. package/dist/src/lib/dataset-maintenance-flow-identity-verify.js +377 -0
  28. package/dist/src/lib/dataset-maintenance-flow-identity-verify.js.map +1 -0
  29. package/dist/src/lib/dataset-maintenance-flow-identity-wire.js +178 -0
  30. package/dist/src/lib/dataset-maintenance-flow-identity-wire.js.map +1 -0
  31. package/dist/src/lib/dataset-maintenance-remote.js +156 -10
  32. package/dist/src/lib/dataset-maintenance-remote.js.map +1 -1
  33. package/dist/src/lib/dataset-save-draft-run.js +667 -0
  34. package/dist/src/lib/dataset-save-draft-run.js.map +1 -1
  35. package/dist/src/lib/http.js.map +1 -1
  36. package/dist/src/lib/lca-release.js +683 -0
  37. package/dist/src/lib/lca-release.js.map +1 -0
  38. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataset-maintenance-flow-identity-execution-contract.js","sourceRoot":"","sources":["../../../src/lib/dataset-maintenance-flow-identity-execution-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,qBAAqB,GAGtB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,YAAY,EACZ,UAAU,EACV,UAAU,GAEX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,YAAY,GAAG,iBAAiB,CAAC;AACvC,MAAM,YAAY,GAAG,4EAA4E,CAAC;AAkXlG,SAAS,IAAI,CAAC,OAAe,EAAE,IAAI,GAAG,kDAAkD;IACtF,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,KAAK,CAAC,KAAc,EAAE,KAAa;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,IAAI,CAAC,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I,GAAG,qBAAqB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,uBAAuB,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC7D,MAAM,QAAQ,GAAG,yBAAyB,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3E,MAAM,QAAQ,GAAG,kCAAkC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAChF,OAAO;QACL,IAAI;QACJ,MAAM;QACN,QAAQ;QACR,QAAQ;QACR,gBAAgB,EAAE,sCAAsC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;KAC7E,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,2BAA2B;IAC3B,IAAI;IACJ,OAAO;IACP,OAAO;IACP,iBAAiB;IACjB,yBAAyB;IACzB,KAAK;IACL,IAAI;CACL,CAAC","sourcesContent":["import {\n assertCurrentFlowIdentityAuthority,\n parseFlowIdentityPlan,\n type FlowIdentityPlan,\n type FlowIdentityProcessManifest,\n} from './dataset-maintenance-flow-identity-contract.js';\nimport {\n isJsonObject,\n sha256Json,\n sha256Text,\n type JsonObject,\n} from './dataset-maintenance-contract.js';\nimport { flowIdentityRestrictedSha256 } from './dataset-maintenance-flow-identity-wire.js';\nimport { CliError } from './errors.js';\n\nconst HASH_PATTERN = /^[a-f0-9]{64}$/u;\nconst UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u;\n\nexport type FlowIdentityFreeze = {\n schema_version: 'dataset-flow-identity-freeze.v2';\n generated_at_utc: string;\n environment: 'production';\n project_ref: string;\n actor: { user_id: string; email: string };\n plan_sha256: string;\n operation_id: string;\n capture_artifact_sha256: string;\n receipt_id: string;\n receipt_proof_sha256: string;\n capture_request_sha256: string;\n source_guard_set_sha256: string;\n support_guard_set_sha256: string;\n target_guard_set_sha256: string;\n mapping_guard_set_sha256: string;\n process_intent_set_sha256: string;\n receipt_protected_closure_sha256: string;\n capture_whole_scope_proof_sha256: string;\n source_universe_artifact_sha256: string;\n support_snapshot_artifact_sha256: string;\n mapping_artifact_sha256: string;\n process_manifest_artifact_sha256: string;\n protected_closure_artifact_sha256: string;\n policy_approval_text_sha256: string;\n toolchain_evidence_sha256: string;\n freeze_sha256: string;\n};\n\nexport type FlowIdentityApproval = {\n schema_version: 'dataset-flow-identity-execution-approval.v2';\n approved_at_utc: string;\n actor: { user_id: string; email: string };\n plan_sha256: string;\n freeze_sha256: string;\n toolchain_evidence_sha256: string;\n policy_approval_text_sha256: string;\n execution_approval_request_sha256: string;\n execution_approval_text_sha256: string;\n execution_approval_identity_sha256: string;\n};\n\nexport type FlowIdentityExecutionIdentity = {\n request_id: string;\n identity_sha256: string;\n environment: 'production';\n project_ref: string;\n actor: { user_id: string; email: string };\n target_visibility: 'owner_draft';\n operation_id: string;\n plan_sha256: string;\n freeze_sha256: string;\n receipt_id: string;\n receipt_proof_sha256: string;\n policy_approval_text_sha256: string;\n execution_approval_request_sha256: string;\n execution_approval_text_sha256: string;\n execution_approval_identity_sha256: string;\n toolchain_evidence_sha256: string;\n};\n\n/**\n * A database-minted bearer capability for exactly one live CLI wrapper.\n *\n * The token is deliberately absent from every durable artifact type in this\n * module. Callers must keep this value in memory, rotate it after each\n * successful write response, and discard it when the wrapper exits.\n */\nexport type FlowIdentityExecutionPermit = {\n schema_version: 'dataset-flow-identity-execution-permit.v1';\n invocation_id: string;\n generation: number;\n token: string;\n};\n\nexport type FlowIdentityPermitResponse<T> = {\n proof: T;\n executionPermit: FlowIdentityExecutionPermit | null;\n};\n\nexport type FlowIdentityScopePreflightProof = {\n ok: true;\n command: 'cmd_dataset_flow_identity_scope_preflight_guarded';\n schema_version: 'dataset-flow-identity-scope-preflight-result.v2';\n receipt_id: string;\n receipt_proof_sha256: string;\n scope_id: string;\n operation_id: string;\n plan_sha256: string;\n scope_proof_sha256: string;\n status: 'sealed' | 'running' | 'primary_complete' | 'derivatives_pending' | 'completed';\n process_count: number;\n mapping_count: number;\n mapping_guard_set_sha256: string;\n process_intent_set_sha256: string;\n support_snapshot_count: number;\n source_universe_count: 305;\n rewrite_count: number;\n next_ordinal: number;\n audit_id: string;\n replay: boolean;\n};\n\nexport type FlowIdentityScopeLookupProof = {\n ok: true;\n command: 'cmd_dataset_flow_identity_scope_lookup';\n schema_version: 'dataset-flow-identity-scope-lookup-result.v1';\n read_only: true;\n scope_id: string;\n receipt_id: string;\n receipt_proof_sha256: string;\n mapping_guard_set_sha256: string;\n process_intent_set_sha256: string;\n operation_id: string;\n plan_sha256: string;\n scope_proof_sha256: string;\n status: 'sealed' | 'running' | 'primary_complete' | 'derivatives_pending' | 'completed';\n process_count: number;\n mapping_count: number;\n support_snapshot_count: number;\n source_universe_count: 305;\n rewrite_count: number;\n next_ordinal: number;\n audit_id: string;\n whole_scope_proof_sha256: string;\n execution_permit: null;\n};\n\nexport type FlowIdentityScopeProof = FlowIdentityScopePreflightProof | FlowIdentityScopeLookupProof;\n\nexport type FlowIdentityProcessProof = {\n ok: true;\n command: 'cmd_dataset_flow_identity_process_rewrite_guarded';\n schema_version: 'dataset-flow-identity-process-rewrite-result.v2';\n scope_id: string;\n receipt_id: string;\n receipt_proof_sha256: string;\n mapping_guard_set_sha256: string;\n process_intent_set_sha256: string;\n invocation_id: string;\n permit_generation_before: number;\n ordinal: number;\n process_id: string;\n process_version: string;\n process_request_sha256: string;\n process_intent_proof_sha256: string;\n desired_payload_sha256: string;\n desired_exchange_set_sha256: string;\n completed_process_count: number;\n next_ordinal: number | null;\n primary_complete: boolean;\n before_payload_sha256: string;\n before_exchange_set_sha256: string;\n after_payload_sha256: string;\n after_exchange_set_sha256: string;\n rewrite_count: number;\n audit_id: string;\n derivative_batch_id: string;\n status: 'completed';\n replay: boolean;\n};\n\nexport type FlowIdentityScopeProcessStatus = {\n ordinal: number;\n id: string;\n version: string;\n status: 'pending' | 'completed' | 'failed';\n process_request_sha256: string | null;\n process_intent_proof_sha256: string;\n desired_payload_sha256: string;\n desired_exchange_set_sha256: string;\n rewrite_count: number;\n audit_id: string | null;\n before_payload_sha256: string;\n before_exchange_set_sha256: string;\n after_payload_sha256: string | null;\n after_exchange_set_sha256: string | null;\n derivative_batch_id: string | null;\n derivative_request_id: string | null;\n derivative_status: string | null;\n causal_terminal_proof: unknown;\n completed_at: string | null;\n last_error: unknown;\n};\n\nexport type FlowIdentityDerivativeResidue = {\n http_requests: number;\n embedding_jobs: number;\n pending_jobs: number;\n failure_rows: number;\n other_active_fences: number;\n};\n\nexport type FlowIdentityDerivativeTargetProof = {\n ordinal: number;\n id: string;\n version: string;\n original_batch_id: string;\n effective_reference_id: string | null;\n effective_reference_kind: 'protected_batch' | 'separate_compensation';\n status: 'completed' | 'pending' | 'failed';\n request_status:\n | 'queued'\n | 'dispatching'\n | 'markdown_pending'\n | 'embedding_pending'\n | 'completed'\n | 'stale'\n | 'failed'\n | 'missing';\n phase: string;\n lineage_ok: boolean;\n proposals_committed: boolean;\n terminal_audit_present: boolean;\n residue: FlowIdentityDerivativeResidue;\n current_snapshot_sha256: string;\n current_json_ordered_sha256: string;\n causal_terminal_proof: boolean;\n};\n\nexport type FlowIdentityDerivativeSetProof = {\n ok: boolean;\n schema_version: 'dataset-flow-identity-derivative-set-proof.v1';\n scope_id: string;\n status: 'failed' | 'compensation_required' | 'pending' | 'completed';\n target_count: number;\n completed_count: number;\n pending_count: number;\n failed_count: number;\n causal_terminal_proof: boolean;\n targets: FlowIdentityDerivativeTargetProof[];\n compensation_targets: FlowIdentityCompensationTarget[];\n proof_sha256: string;\n};\n\nexport type FlowIdentityCompensationTarget = {\n ordinal: number;\n table: 'processes';\n id: string;\n version: string;\n original_batch_id: string;\n original_request_id?: string | null;\n original_status: 'failed' | 'stale' | 'missing';\n original_error?: unknown;\n original_code?: string;\n desired_payload_sha256: string;\n current_json_ordered_sha256: string;\n current_snapshot_sha256: string;\n current_modified_at: string;\n components: ['extracted_md', 'embedding_ft'];\n reason_code: string;\n operation_id_prefix: string;\n latest_compensation_request_id: string | null;\n latest_compensation_status: string | null;\n latest_compensation_plan_sha256: string | null;\n requires_new_plan_freeze_approval: true;\n automatic_retry: false;\n};\n\nexport type FlowIdentityWholeScopeProof = {\n schema_version: 'dataset-flow-identity-whole-scope-proof.v2';\n scope_id: string;\n receipt_id: string;\n primary_current: boolean;\n audit_current: boolean;\n source_guards_current: boolean;\n support_guards_current: boolean;\n target_guards_current: boolean;\n approved_reference_residue_count: number;\n protected_closure_current: boolean;\n occurrence_closure_current: boolean;\n derivatives_current: boolean;\n primary_closure_sha256: string;\n source_guard_set_sha256: string;\n support_guard_set_sha256: string;\n target_guard_set_sha256: string;\n protected_closure_sha256: string;\n derivative_proof_set_sha256: string;\n causal_terminal_proof: boolean;\n proof_sha256: string;\n};\n\nexport type FlowIdentityScopeStatus = {\n ok: boolean;\n command: 'cmd_dataset_flow_identity_scope_read';\n schema_version: 'dataset-flow-identity-scope-status.v2';\n scope_id: string;\n receipt_id: string;\n receipt_proof_sha256: string;\n mapping_guard_set_sha256: string;\n process_intent_set_sha256: string;\n operation_id: string;\n plan_sha256: string;\n scope_proof_sha256: string;\n status:\n | 'sealed'\n | 'running'\n | 'primary_complete'\n | 'derivatives_pending'\n | 'completed'\n | 'live_drift'\n | 'failed';\n process_count: number;\n rewrite_count: number;\n completed_process_count: number;\n pending_process_count: number;\n failed_process_count: number;\n completed_rewrite_count: number;\n next_ordinal: number;\n primary_complete: boolean;\n primary_current: boolean;\n live_guard_current: boolean;\n derivatives_current: boolean;\n derivative_pending_count: number;\n derivative_failed_count: number;\n derivative_set_proof: FlowIdentityDerivativeSetProof;\n derivative_proof_set_sha256: string;\n protected_closure_current: boolean;\n protected_closure_proof: JsonObject;\n processes: FlowIdentityScopeProcessStatus[];\n terminal_proof_sha256: string | null;\n completed_at: string | null;\n cancellable: boolean;\n strict_continuation_required: boolean;\n whole_scope_proof: FlowIdentityWholeScopeProof;\n whole_scope_proof_sha256: string;\n code?: string;\n compensation_required?: boolean;\n automatic_retry?: false;\n compensation_targets?: FlowIdentityCompensationTarget[];\n};\n\nexport type FlowIdentityFinalizeProof = {\n ok: boolean;\n command: 'cmd_dataset_flow_identity_scope_finalize_guarded';\n schema_version: 'dataset-flow-identity-scope-finalize-result.v2';\n scope_id: string;\n receipt_id: string;\n receipt_proof_sha256: string;\n mapping_guard_set_sha256: string;\n process_intent_set_sha256: string;\n operation_id: string;\n plan_sha256: string;\n scope_proof_sha256: string;\n invocation_id: string;\n permit_generation_before: number;\n status: 'derivatives_pending' | 'completed' | 'live_drift' | 'failed';\n process_count: number;\n rewrite_count: number;\n completed_process_count: number;\n primary_closure_sha256: string;\n protected_closure_sha256: string;\n derivative_target_set_sha256: string;\n derivative_proof_set_sha256: string;\n primary_current: boolean;\n live_guard_current: boolean;\n derivatives_current: boolean;\n terminal_proof_sha256: string | null;\n whole_scope_proof: FlowIdentityWholeScopeProof;\n whole_scope_proof_sha256: string;\n audit_id: string | null;\n replay: boolean;\n code?: string;\n compensation_required?: boolean;\n automatic_retry?: false;\n compensation_targets?: FlowIdentityCompensationTarget[];\n};\n\nfunction fail(message: string, code = 'DATASET_FLOW_IDENTITY_EXECUTION_CONTRACT_INVALID'): never {\n throw new CliError(message, { code, exitCode: 2 });\n}\n\nfunction token(value: unknown, label: string): string {\n if (typeof value !== 'string' || !value.trim()) fail(`${label} must be a non-empty string.`);\n return value.trim();\n}\n\nfunction hash(value: unknown, label: string): string {\n const normalized = token(value, label);\n if (!HASH_PATTERN.test(normalized)) fail(`${label} must be a lowercase SHA-256.`);\n return normalized;\n}\n\nfunction uuid(value: unknown, label: string): string {\n const normalized = token(value, label);\n if (!UUID_PATTERN.test(normalized)) fail(`${label} must be a canonical lowercase UUID.`);\n return normalized;\n}\n\nfunction instant(value: unknown, label: string): string {\n const normalized = token(value, label);\n if (!Number.isFinite(Date.parse(normalized))) fail(`${label} must be an RFC3339 timestamp.`);\n return normalized;\n}\n\nfunction integer(value: unknown, label: string, minimum = 0): number {\n if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < minimum) {\n fail(`${label} must be an integer >= ${minimum}.`);\n }\n return value;\n}\n\nfunction boolean(value: unknown, label: string): boolean {\n if (typeof value !== 'boolean') fail(`${label} must be boolean.`);\n return value;\n}\n\nfunction deterministicUuidFromSha256(digest: string): string {\n const chars = digest.slice(0, 32).split('');\n chars[12] = '5';\n chars[16] = ((Number.parseInt(chars[16]!, 16) & 0x3) | 0x8).toString(16);\n const hex = chars.join('');\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n\nexport function computeFlowIdentityFreezeSha256(freeze: FlowIdentityFreeze): string {\n return sha256Json({ ...freeze, freeze_sha256: '' });\n}\n\nexport function computeFlowIdentityApprovalIdentitySha256(approval: FlowIdentityApproval): string {\n return sha256Json({ ...approval, execution_approval_identity_sha256: '' });\n}\n\nexport function parseFlowIdentityFreeze(\n value: unknown,\n plan: FlowIdentityPlan,\n): FlowIdentityFreeze {\n if (!isJsonObject(value) || !isJsonObject(value.actor)) fail('Flow identity freeze is invalid.');\n const freeze = value as FlowIdentityFreeze;\n if (\n freeze.schema_version !== 'dataset-flow-identity-freeze.v2' ||\n freeze.environment !== 'production' ||\n plan.environment !== 'production' ||\n freeze.project_ref !== plan.project_ref ||\n freeze.actor.user_id !== plan.account.user_id ||\n freeze.actor.email !== plan.account.email ||\n freeze.plan_sha256 !== plan.plan_sha256 ||\n freeze.operation_id !== plan.operation_id ||\n freeze.capture_artifact_sha256 !== plan.capture_artifact_sha256 ||\n freeze.receipt_id !== plan.receipt_id ||\n freeze.receipt_proof_sha256 !== plan.receipt_proof_sha256 ||\n freeze.capture_request_sha256 !== plan.capture_request_sha256 ||\n freeze.source_guard_set_sha256 !== plan.source_guard_set_sha256 ||\n freeze.support_guard_set_sha256 !== plan.support_guard_set_sha256 ||\n freeze.target_guard_set_sha256 !== plan.target_guard_set_sha256 ||\n freeze.mapping_guard_set_sha256 !== plan.mapping_guard_set_sha256 ||\n freeze.process_intent_set_sha256 !== plan.process_intent_set_sha256 ||\n freeze.receipt_protected_closure_sha256 !== plan.receipt_protected_closure_sha256 ||\n freeze.capture_whole_scope_proof_sha256 !== plan.capture_whole_scope_proof_sha256 ||\n freeze.source_universe_artifact_sha256 !== plan.source_universe_artifact_sha256 ||\n freeze.support_snapshot_artifact_sha256 !== plan.support_snapshot_artifact_sha256 ||\n freeze.mapping_artifact_sha256 !== plan.mapping_artifact_sha256 ||\n freeze.process_manifest_artifact_sha256 !== plan.process_manifest_artifact_sha256 ||\n freeze.protected_closure_artifact_sha256 !== plan.protected_closure_artifact_sha256 ||\n freeze.policy_approval_text_sha256 !== plan.compatibility_policy.approval_text_sha256 ||\n !UUID_PATTERN.test(freeze.receipt_id) ||\n ![\n freeze.receipt_proof_sha256,\n freeze.capture_request_sha256,\n freeze.source_guard_set_sha256,\n freeze.support_guard_set_sha256,\n freeze.target_guard_set_sha256,\n freeze.mapping_guard_set_sha256,\n freeze.process_intent_set_sha256,\n freeze.receipt_protected_closure_sha256,\n freeze.capture_whole_scope_proof_sha256,\n ].every((digest) => HASH_PATTERN.test(digest)) ||\n !HASH_PATTERN.test(freeze.toolchain_evidence_sha256) ||\n !Number.isFinite(Date.parse(freeze.generated_at_utc)) ||\n freeze.freeze_sha256 !== computeFlowIdentityFreezeSha256(freeze)\n ) {\n fail('Flow identity freeze does not exactly bind the immutable production plan.');\n }\n return freeze;\n}\n\nexport function parseFlowIdentityApproval(\n value: unknown,\n plan: FlowIdentityPlan,\n freeze: FlowIdentityFreeze,\n): FlowIdentityApproval {\n if (!isJsonObject(value) || !isJsonObject(value.actor))\n fail('Flow identity approval is invalid.');\n const approval = value as FlowIdentityApproval;\n assertCurrentFlowIdentityAuthority({ oracleSha256: approval.policy_approval_text_sha256 });\n if (\n approval.schema_version !== 'dataset-flow-identity-execution-approval.v2' ||\n approval.actor.user_id !== plan.account.user_id ||\n approval.actor.email !== plan.account.email ||\n approval.plan_sha256 !== plan.plan_sha256 ||\n approval.freeze_sha256 !== freeze.freeze_sha256 ||\n approval.toolchain_evidence_sha256 !== freeze.toolchain_evidence_sha256 ||\n approval.policy_approval_text_sha256 !== plan.compatibility_policy.approval_text_sha256 ||\n !HASH_PATTERN.test(approval.policy_approval_text_sha256) ||\n !HASH_PATTERN.test(approval.execution_approval_request_sha256) ||\n !HASH_PATTERN.test(approval.execution_approval_text_sha256) ||\n new Set([\n approval.policy_approval_text_sha256,\n approval.execution_approval_request_sha256,\n approval.execution_approval_text_sha256,\n approval.execution_approval_identity_sha256,\n ]).size !== 4 ||\n !Number.isFinite(Date.parse(approval.approved_at_utc)) ||\n Date.parse(approval.approved_at_utc) < Date.parse(freeze.generated_at_utc) ||\n approval.execution_approval_identity_sha256 !==\n computeFlowIdentityApprovalIdentitySha256(approval)\n ) {\n fail('Flow identity approval does not exactly bind the plan/freeze/account/toolchain.');\n }\n return approval;\n}\n\nexport function buildFlowIdentityExecutionIdentity(options: {\n plan: FlowIdentityPlan;\n freeze: FlowIdentityFreeze;\n approval: FlowIdentityApproval;\n}): FlowIdentityExecutionIdentity {\n const body = {\n environment: 'production' as const,\n project_ref: options.plan.project_ref,\n actor: options.plan.account,\n target_visibility: 'owner_draft' as const,\n operation_id: options.plan.operation_id,\n plan_sha256: options.plan.plan_sha256,\n freeze_sha256: options.freeze.freeze_sha256,\n receipt_id: options.plan.receipt_id,\n receipt_proof_sha256: options.plan.receipt_proof_sha256,\n policy_approval_text_sha256: options.approval.policy_approval_text_sha256,\n execution_approval_request_sha256: options.approval.execution_approval_request_sha256,\n execution_approval_text_sha256: options.approval.execution_approval_text_sha256,\n execution_approval_identity_sha256: options.approval.execution_approval_identity_sha256,\n toolchain_evidence_sha256: options.freeze.toolchain_evidence_sha256,\n };\n const identitySha256 = flowIdentityRestrictedSha256(body);\n return {\n request_id: deterministicUuidFromSha256(\n sha256Text(`dataset-flow-identity-scope.v2\\u0000${identitySha256}`),\n ),\n identity_sha256: identitySha256,\n ...body,\n };\n}\n\nexport function buildFlowIdentityScopePreflightRequest(options: {\n plan: FlowIdentityPlan;\n identity: FlowIdentityExecutionIdentity;\n}): JsonObject {\n const request = {\n schema_version: 'dataset-flow-identity-scope-preflight.v2',\n request_id: options.identity.request_id,\n receipt_id: options.identity.receipt_id,\n receipt_proof_sha256: options.identity.receipt_proof_sha256,\n environment: options.identity.environment,\n project_ref: options.identity.project_ref,\n actor: options.identity.actor,\n target_visibility: options.identity.target_visibility,\n operation_id: options.identity.operation_id,\n plan_sha256: options.identity.plan_sha256,\n freeze_sha256: options.identity.freeze_sha256,\n policy_approval_text_sha256: options.identity.policy_approval_text_sha256,\n execution_approval_request_sha256: options.identity.execution_approval_request_sha256,\n execution_approval_text_sha256: options.identity.execution_approval_text_sha256,\n execution_approval_identity_sha256: options.identity.execution_approval_identity_sha256,\n toolchain_evidence_sha256: options.identity.toolchain_evidence_sha256,\n user_state_claim: 'authenticated_actor_state_100_plus_own_state_0',\n approval_reusable: false,\n maximum_wrapper_invocations: 1,\n maximum_cli_apply_spawns: 1,\n maximum_process_posts: options.plan.processes.length,\n maximum_finalize_posts: 1,\n automatic_retry: false,\n };\n return request;\n}\n\nexport function buildFlowIdentityScopeLookupRequest(options: {\n identity: FlowIdentityExecutionIdentity;\n}): JsonObject {\n return {\n schema_version: 'dataset-flow-identity-scope-lookup.v1',\n request_id: options.identity.request_id,\n receipt_id: options.identity.receipt_id,\n receipt_proof_sha256: options.identity.receipt_proof_sha256,\n environment: options.identity.environment,\n project_ref: options.identity.project_ref,\n actor: options.identity.actor,\n target_visibility: options.identity.target_visibility,\n user_state_claim: 'authenticated_actor_state_100_plus_own_state_0',\n operation_id: options.identity.operation_id,\n plan_sha256: options.identity.plan_sha256,\n freeze_sha256: options.identity.freeze_sha256,\n policy_approval_text_sha256: options.identity.policy_approval_text_sha256,\n execution_approval_request_sha256: options.identity.execution_approval_request_sha256,\n execution_approval_text_sha256: options.identity.execution_approval_text_sha256,\n execution_approval_identity_sha256: options.identity.execution_approval_identity_sha256,\n toolchain_evidence_sha256: options.identity.toolchain_evidence_sha256,\n };\n}\n\nfunction parseFlowIdentityExecutionPermit(\n value: unknown,\n options: {\n expectedGeneration: number;\n expectedInvocationId?: string;\n label: string;\n },\n): FlowIdentityExecutionPermit {\n if (!isJsonObject(value)) fail(`${options.label} execution permit is invalid.`);\n assertExactKeys(\n value,\n ['schema_version', 'invocation_id', 'generation', 'token'],\n `${options.label} execution permit`,\n );\n if (\n value.schema_version !== 'dataset-flow-identity-execution-permit.v1' ||\n integer(value.generation, 'execution permit generation') !== options.expectedGeneration ||\n (options.expectedInvocationId !== undefined &&\n value.invocation_id !== options.expectedInvocationId)\n ) {\n fail(`${options.label} execution permit does not bind the expected live wrapper generation.`);\n }\n uuid(value.invocation_id, 'execution permit invocation_id');\n hash(value.token, 'execution permit token');\n return value as FlowIdentityExecutionPermit;\n}\n\n/**\n * Removes the memory-only permit before a response enters a proof parser or\n * durable artifact writer. Exact proof parsers therefore cannot accidentally\n * accept or persist the bearer token.\n */\nexport function splitFlowIdentityPermitResponse(options: {\n value: unknown;\n expectedGeneration: number;\n expectedInvocationId?: string;\n permitRequired: boolean;\n permitForbidden?: boolean;\n label: string;\n}): FlowIdentityPermitResponse<JsonObject> {\n if (!isJsonObject(options.value)) fail(`${options.label} response is invalid.`);\n if (!Object.hasOwn(options.value, 'execution_permit')) {\n fail(`${options.label} response omitted the execution permit envelope.`);\n }\n const proof = { ...options.value };\n const rawPermit = proof.execution_permit;\n delete proof.execution_permit;\n if (rawPermit === null) {\n if (options.permitRequired) {\n fail(`${options.label} response did not provide a fresh write-capable permit.`);\n }\n return { proof, executionPermit: null };\n }\n if (options.permitForbidden === true) {\n fail(`${options.label} replay unexpectedly contained a write-capable execution permit.`);\n }\n return {\n proof,\n executionPermit: parseFlowIdentityExecutionPermit(rawPermit, {\n expectedGeneration: options.expectedGeneration,\n expectedInvocationId: options.expectedInvocationId,\n label: options.label,\n }),\n };\n}\n\nexport function computeFlowIdentityProcessRequestSha256(request: JsonObject): string {\n const body = { ...request };\n delete body.process_request_sha256;\n return flowIdentityRestrictedSha256(body);\n}\n\nexport function buildFlowIdentityProcessRequest(options: {\n scopeProofSha256: string;\n ordinal: number;\n processIntentProofSha256: string;\n}): JsonObject {\n const body: JsonObject = {\n schema_version: 'dataset-flow-identity-process-rewrite.v2',\n request_id: deterministicUuidFromSha256(\n sha256Text(\n `dataset-flow-identity-process.v2\\u0000${options.scopeProofSha256}\\u0000${options.ordinal}\\u0000${options.processIntentProofSha256}`,\n ),\n ),\n scope_proof_sha256: hash(options.scopeProofSha256, 'scope_proof_sha256'),\n ordinal: integer(options.ordinal, 'ordinal', 1),\n process_intent_proof_sha256: hash(\n options.processIntentProofSha256,\n 'process_intent_proof_sha256',\n ),\n process_request_sha256: '',\n };\n body.process_request_sha256 = computeFlowIdentityProcessRequestSha256(body);\n return body;\n}\n\nexport function buildFlowIdentityFinalizeRequest(options: {\n scopeProofSha256: string;\n plan: FlowIdentityPlan;\n status: FlowIdentityScopeStatus;\n}): JsonObject {\n const completed = options.status.processes.filter((process) => process.status === 'completed');\n if (\n completed.length !== options.plan.processes.length ||\n completed.some((process) => !process.audit_id)\n ) {\n fail('Cannot finalize without an exact completed database process ledger.');\n }\n const expected = {\n process_count: options.plan.processes.length,\n rewrite_count: options.plan.summary.rewrites,\n completed_process_count: completed.length,\n };\n return {\n schema_version: 'dataset-flow-identity-scope-finalize.v2',\n request_id: deterministicUuidFromSha256(\n sha256Text(\n `dataset-flow-identity-finalize.v2\\u0000${options.scopeProofSha256}\\u0000${options.status.whole_scope_proof_sha256}`,\n ),\n ),\n scope_proof_sha256: hash(options.scopeProofSha256, 'scope_proof_sha256'),\n expected,\n };\n}\n\nfunction requireScopeCounts(value: JsonObject, plan: FlowIdentityPlan): void {\n if (\n integer(value.process_count, 'process_count') !== plan.processes.length ||\n integer(value.mapping_count, 'mapping_count') !== plan.mappings.length ||\n integer(value.rewrite_count, 'rewrite_count') !== plan.summary.rewrites\n ) {\n fail('Flow identity scope proof counts do not match the plan.');\n }\n}\n\nexport function parseFlowIdentityScopePreflightProof(\n value: unknown,\n plan: FlowIdentityPlan,\n): FlowIdentityScopePreflightProof {\n if (!isJsonObject(value)) fail('Flow identity scope preflight proof is invalid.');\n assertExactKeys(\n value,\n [\n 'ok',\n 'command',\n 'schema_version',\n 'receipt_id',\n 'receipt_proof_sha256',\n 'scope_id',\n 'operation_id',\n 'plan_sha256',\n 'scope_proof_sha256',\n 'status',\n 'process_count',\n 'mapping_count',\n 'mapping_guard_set_sha256',\n 'process_intent_set_sha256',\n 'support_snapshot_count',\n 'source_universe_count',\n 'rewrite_count',\n 'next_ordinal',\n 'audit_id',\n 'replay',\n ],\n 'scope preflight result',\n );\n requireScopeCounts(value, plan);\n if (\n value.ok !== true ||\n value.command !== 'cmd_dataset_flow_identity_scope_preflight_guarded' ||\n value.schema_version !== 'dataset-flow-identity-scope-preflight-result.v2' ||\n value.receipt_id !== plan.receipt_id ||\n value.receipt_proof_sha256 !== plan.receipt_proof_sha256 ||\n value.operation_id !== plan.operation_id ||\n value.plan_sha256 !== plan.plan_sha256 ||\n value.mapping_guard_set_sha256 !== plan.mapping_guard_set_sha256 ||\n value.process_intent_set_sha256 !== plan.process_intent_set_sha256 ||\n !['sealed', 'running', 'primary_complete', 'derivatives_pending', 'completed'].includes(\n String(value.status),\n ) ||\n typeof value.replay !== 'boolean'\n ) {\n fail('Flow identity scope preflight proof does not bind the plan.');\n }\n uuid(value.scope_id, 'scope_id');\n hash(value.scope_proof_sha256, 'scope_proof_sha256');\n integer(value.support_snapshot_count, 'support_snapshot_count');\n if (\n value.support_snapshot_count !== plan.support_snapshots.length ||\n value.source_universe_count !== 305\n ) {\n fail('Flow identity scope support/source counts do not match the plan receipt.');\n }\n integer(value.next_ordinal, 'next_ordinal', 1);\n token(value.audit_id, 'audit_id');\n return value as FlowIdentityScopePreflightProof;\n}\n\nexport function parseFlowIdentityScopeLookupProof(\n value: unknown,\n plan: FlowIdentityPlan,\n identity: FlowIdentityExecutionIdentity,\n): FlowIdentityScopeLookupProof {\n if (!isJsonObject(value)) fail('Flow identity scope lookup proof is invalid.');\n assertExactKeys(\n value,\n [\n 'ok',\n 'command',\n 'schema_version',\n 'read_only',\n 'scope_id',\n 'receipt_id',\n 'receipt_proof_sha256',\n 'mapping_guard_set_sha256',\n 'process_intent_set_sha256',\n 'operation_id',\n 'plan_sha256',\n 'scope_proof_sha256',\n 'status',\n 'process_count',\n 'mapping_count',\n 'support_snapshot_count',\n 'source_universe_count',\n 'rewrite_count',\n 'next_ordinal',\n 'audit_id',\n 'whole_scope_proof_sha256',\n 'execution_permit',\n ],\n 'scope lookup result',\n );\n requireScopeCounts(value, plan);\n if (\n value.ok !== true ||\n value.command !== 'cmd_dataset_flow_identity_scope_lookup' ||\n value.schema_version !== 'dataset-flow-identity-scope-lookup-result.v1' ||\n value.read_only !== true ||\n value.execution_permit !== null ||\n value.receipt_id !== identity.receipt_id ||\n value.receipt_proof_sha256 !== identity.receipt_proof_sha256 ||\n value.mapping_guard_set_sha256 !== plan.mapping_guard_set_sha256 ||\n value.process_intent_set_sha256 !== plan.process_intent_set_sha256 ||\n value.operation_id !== identity.operation_id ||\n value.plan_sha256 !== identity.plan_sha256 ||\n !['sealed', 'running', 'primary_complete', 'derivatives_pending', 'completed'].includes(\n String(value.status),\n ) ||\n value.support_snapshot_count !== plan.support_snapshots.length ||\n value.source_universe_count !== 305\n ) {\n fail('Flow identity scope lookup proof does not bind the immutable execution.');\n }\n uuid(value.scope_id, 'lookup scope_id');\n hash(value.scope_proof_sha256, 'lookup scope_proof_sha256');\n integer(value.next_ordinal, 'lookup next_ordinal', 1);\n token(value.audit_id, 'lookup audit_id');\n hash(value.whole_scope_proof_sha256, 'lookup whole_scope_proof_sha256');\n return value as FlowIdentityScopeLookupProof;\n}\n\nexport function parseFlowIdentityProcessProof(options: {\n value: unknown;\n scopeId: string;\n process: FlowIdentityProcessManifest;\n requestSha256: string;\n receiptId: string;\n receiptProofSha256: string;\n mappingGuardSetSha256: string;\n processIntentSetSha256: string;\n processIntentProofSha256: string;\n processCount: number;\n expectedInvocationId?: string;\n expectedPermitGenerationBefore?: number;\n}): FlowIdentityProcessProof {\n if (!isJsonObject(options.value)) fail('Flow identity process proof is invalid.');\n if (\n !Number.isSafeInteger(options.processCount) ||\n options.processCount < options.process.ordinal\n ) {\n fail('Flow identity process count cannot bind the sealed ordinal.');\n }\n const value = options.value;\n const completedProcessCount = value.completed_process_count;\n assertExactKeys(\n value,\n [\n 'ok',\n 'command',\n 'schema_version',\n 'scope_id',\n 'receipt_id',\n 'receipt_proof_sha256',\n 'mapping_guard_set_sha256',\n 'process_intent_set_sha256',\n 'invocation_id',\n 'permit_generation_before',\n 'ordinal',\n 'process_id',\n 'process_version',\n 'process_request_sha256',\n 'process_intent_proof_sha256',\n 'desired_payload_sha256',\n 'desired_exchange_set_sha256',\n 'completed_process_count',\n 'next_ordinal',\n 'primary_complete',\n 'before_payload_sha256',\n 'before_exchange_set_sha256',\n 'after_payload_sha256',\n 'after_exchange_set_sha256',\n 'rewrite_count',\n 'audit_id',\n 'derivative_batch_id',\n 'status',\n 'replay',\n ],\n 'process rewrite result',\n );\n if (\n value.ok !== true ||\n value.command !== 'cmd_dataset_flow_identity_process_rewrite_guarded' ||\n value.schema_version !== 'dataset-flow-identity-process-rewrite-result.v2' ||\n value.scope_id !== options.scopeId ||\n value.receipt_id !== options.receiptId ||\n value.receipt_proof_sha256 !== options.receiptProofSha256 ||\n value.mapping_guard_set_sha256 !== options.mappingGuardSetSha256 ||\n value.process_intent_set_sha256 !== options.processIntentSetSha256 ||\n !UUID_PATTERN.test(String(value.invocation_id)) ||\n !Number.isSafeInteger(value.permit_generation_before) ||\n Number(value.permit_generation_before) < 0 ||\n (options.expectedInvocationId !== undefined &&\n value.invocation_id !== options.expectedInvocationId) ||\n (options.expectedPermitGenerationBefore !== undefined &&\n value.permit_generation_before !== options.expectedPermitGenerationBefore) ||\n value.ordinal !== options.process.ordinal ||\n value.process_id !== options.process.id ||\n value.process_version !== options.process.version ||\n value.process_request_sha256 !== options.requestSha256 ||\n value.process_intent_proof_sha256 !== options.processIntentProofSha256 ||\n value.desired_payload_sha256 !== options.process.desired_payload_sha256 ||\n value.desired_exchange_set_sha256 !== options.process.desired_exchange_set_sha256 ||\n !Number.isSafeInteger(completedProcessCount) ||\n Number(completedProcessCount) < options.process.ordinal ||\n Number(completedProcessCount) > options.processCount ||\n (value.replay === false && completedProcessCount !== options.process.ordinal) ||\n typeof value.primary_complete !== 'boolean' ||\n (value.primary_complete\n ? completedProcessCount !== options.processCount || value.next_ordinal !== null\n : value.next_ordinal !== Number(completedProcessCount) + 1 ||\n Number(value.next_ordinal) > options.processCount) ||\n !HASH_PATTERN.test(String(value.before_payload_sha256)) ||\n !HASH_PATTERN.test(String(value.before_exchange_set_sha256)) ||\n !HASH_PATTERN.test(String(value.after_payload_sha256)) ||\n !HASH_PATTERN.test(String(value.after_exchange_set_sha256)) ||\n value.after_payload_sha256 !== value.desired_payload_sha256 ||\n value.after_exchange_set_sha256 !== value.desired_exchange_set_sha256 ||\n value.rewrite_count !== options.process.rewrite_count ||\n value.status !== 'completed' ||\n !UUID_PATTERN.test(String(value.derivative_batch_id)) ||\n typeof value.replay !== 'boolean'\n ) {\n fail('Flow identity process proof does not bind the sealed process template.');\n }\n token(value.audit_id, 'audit_id');\n return value as FlowIdentityProcessProof;\n}\n\nfunction parseScopeProcess(\n value: unknown,\n expected: FlowIdentityProcessManifest,\n): FlowIdentityScopeProcessStatus {\n if (!isJsonObject(value)) fail('Flow identity scope process ledger entry is invalid.');\n assertExactKeys(\n value,\n [\n 'ordinal',\n 'id',\n 'version',\n 'status',\n 'process_request_sha256',\n 'process_intent_proof_sha256',\n 'desired_payload_sha256',\n 'desired_exchange_set_sha256',\n 'rewrite_count',\n 'audit_id',\n 'before_payload_sha256',\n 'before_exchange_set_sha256',\n 'after_payload_sha256',\n 'after_exchange_set_sha256',\n 'derivative_batch_id',\n 'derivative_request_id',\n 'derivative_status',\n 'causal_terminal_proof',\n 'completed_at',\n 'last_error',\n ],\n 'scope process ledger entry',\n );\n if (\n value.ordinal !== expected.ordinal ||\n value.id !== expected.id ||\n value.version !== expected.version ||\n value.rewrite_count !== expected.rewrite_count ||\n value.desired_payload_sha256 !== expected.desired_payload_sha256 ||\n value.desired_exchange_set_sha256 !== expected.desired_exchange_set_sha256 ||\n !HASH_PATTERN.test(String(value.before_payload_sha256)) ||\n !HASH_PATTERN.test(String(value.before_exchange_set_sha256)) ||\n !HASH_PATTERN.test(String(value.process_intent_proof_sha256)) ||\n !['pending', 'completed', 'failed'].includes(String(value.status))\n ) {\n fail('Flow identity scope process ledger does not match the sealed manifest.');\n }\n const completed = value.status === 'completed';\n const pending = value.status === 'pending';\n const missingOriginalDerivative =\n value.derivative_request_id === null && value.derivative_status === 'missing';\n const presentOriginalDerivative =\n UUID_PATTERN.test(String(value.derivative_request_id)) &&\n typeof value.derivative_status === 'string' &&\n Boolean(value.derivative_status.trim()) &&\n value.derivative_status !== 'missing';\n if (\n completed &&\n (!HASH_PATTERN.test(String(value.process_request_sha256)) ||\n !token(value.audit_id, 'audit_id') ||\n !HASH_PATTERN.test(String(value.after_payload_sha256)) ||\n !HASH_PATTERN.test(String(value.after_exchange_set_sha256)) ||\n value.after_payload_sha256 !== expected.desired_payload_sha256 ||\n value.after_exchange_set_sha256 !== expected.desired_exchange_set_sha256 ||\n !UUID_PATTERN.test(String(value.derivative_batch_id)) ||\n (!missingOriginalDerivative && !presentOriginalDerivative) ||\n !value.completed_at ||\n !Number.isFinite(Date.parse(String(value.completed_at))))\n ) {\n fail('Completed flow identity process ledger proof is incomplete.');\n }\n if (\n pending &&\n (value.process_request_sha256 !== null ||\n value.audit_id !== null ||\n value.after_payload_sha256 !== null ||\n value.after_exchange_set_sha256 !== null ||\n value.derivative_batch_id !== null ||\n value.derivative_request_id !== null ||\n value.derivative_status !== null ||\n value.completed_at !== null)\n ) {\n fail('Pending flow identity process ledger unexpectedly contains completion proof.');\n }\n if (value.causal_terminal_proof !== false) {\n fail('Scope status must not substitute a child status bit for terminal causal proof.');\n }\n return value as FlowIdentityScopeProcessStatus;\n}\n\nfunction parseCompensationTarget(\n entry: unknown,\n plan: FlowIdentityPlan,\n scopeId: string,\n source: 'scope_read' | 'finalize' | 'derivative_set',\n): FlowIdentityCompensationTarget {\n if (!isJsonObject(entry)) fail('Derivative compensation target is invalid.');\n const ordinal = integer(entry.ordinal, 'compensation ordinal', 1);\n const process = plan.processes[ordinal - 1];\n const reason = `FLOW_IDENTITY_SCOPE_COMPENSATION:${scopeId}:${ordinal}`;\n if (\n !process ||\n entry.table !== 'processes' ||\n entry.id !== process.id ||\n entry.version !== process.version ||\n !UUID_PATTERN.test(String(entry.original_batch_id)) ||\n !['failed', 'stale', 'missing'].includes(String(entry.original_status)) ||\n typeof entry.original_code !== 'string' ||\n !entry.original_code.trim() ||\n !HASH_PATTERN.test(String(entry.desired_payload_sha256)) ||\n !HASH_PATTERN.test(String(entry.current_json_ordered_sha256)) ||\n !HASH_PATTERN.test(String(entry.current_snapshot_sha256)) ||\n !Number.isFinite(Date.parse(String(entry.current_modified_at))) ||\n !Array.isArray(entry.components) ||\n entry.components.length !== 2 ||\n entry.components[0] !== 'extracted_md' ||\n entry.components[1] !== 'embedding_ft' ||\n entry.reason_code !== reason ||\n entry.operation_id_prefix !== `${reason}:` ||\n entry.requires_new_plan_freeze_approval !== true ||\n entry.automatic_retry !== false ||\n (entry.latest_compensation_request_id !== null &&\n !UUID_PATTERN.test(String(entry.latest_compensation_request_id))) ||\n (entry.latest_compensation_status !== null &&\n (typeof entry.latest_compensation_status !== 'string' ||\n !entry.latest_compensation_status.trim())) ||\n (entry.latest_compensation_plan_sha256 !== null &&\n !HASH_PATTERN.test(String(entry.latest_compensation_plan_sha256)))\n ) {\n fail('Derivative compensation target does not bind the sealed process/current snapshot.');\n }\n const missingOriginalRequest =\n entry.original_status === 'missing' &&\n entry.original_code === 'DERIVATIVE_BATCH_CHILD_MISSING' &&\n entry.original_request_id === null;\n const hasOriginalRequestId = Object.prototype.hasOwnProperty.call(entry, 'original_request_id');\n const hasOriginalError = Object.prototype.hasOwnProperty.call(entry, 'original_error');\n if (\n (source === 'scope_read' &&\n (!hasOriginalRequestId ||\n !hasOriginalError ||\n (!missingOriginalRequest &&\n (!['failed', 'stale'].includes(String(entry.original_status)) ||\n !UUID_PATTERN.test(String(entry.original_request_id)))))) ||\n (source !== 'scope_read' && (hasOriginalRequestId || hasOriginalError)) ||\n (entry.original_status === 'missing' &&\n entry.original_code !== 'DERIVATIVE_BATCH_CHILD_MISSING') ||\n (entry.original_status !== 'missing' && entry.original_request_id === null)\n ) {\n fail('Derivative compensation target provenance does not match its RPC response.');\n }\n return entry as FlowIdentityCompensationTarget;\n}\n\nfunction parseCompensationEnvelope(\n value: JsonObject,\n plan: FlowIdentityPlan,\n scopeId: string,\n source: 'scope_read' | 'finalize',\n): FlowIdentityCompensationTarget[] {\n if (value.compensation_required === undefined) return [];\n if (typeof value.compensation_required !== 'boolean') {\n fail('Flow identity compensation_required must be boolean.');\n }\n if (value.compensation_required === false) {\n if (\n value.automatic_retry !== false ||\n (value.compensation_targets !== undefined &&\n (!Array.isArray(value.compensation_targets) || value.compensation_targets.length !== 0))\n ) {\n fail('Non-required compensation envelope is malformed.');\n }\n return [];\n }\n if (\n (source === 'scope_read'\n ? !['derivatives_pending', 'completed'].includes(String(value.status))\n : value.status !== 'derivatives_pending') ||\n value.code !== 'FLOW_IDENTITY_DERIVATIVE_COMPENSATION_REQUIRED' ||\n value.automatic_retry !== false ||\n !Array.isArray(value.compensation_targets) ||\n value.compensation_targets.length === 0\n ) {\n fail('Required derivative compensation envelope is malformed.');\n }\n return value.compensation_targets.map((entry) =>\n parseCompensationTarget(entry, plan, scopeId, source),\n );\n}\n\nfunction assertExactKeys(value: JsonObject, expected: readonly string[], label: string): void {\n const actual = Object.keys(value).sort();\n const wanted = [...expected].sort();\n if (actual.length !== wanted.length || actual.some((key, index) => key !== wanted[index])) {\n fail(`${label} keys do not match the database contract.`);\n }\n}\n\nfunction parseDerivativeResidue(value: unknown, label: string): FlowIdentityDerivativeResidue {\n if (!isJsonObject(value)) fail(`${label} must be an object.`);\n assertExactKeys(\n value,\n ['http_requests', 'embedding_jobs', 'pending_jobs', 'failure_rows', 'other_active_fences'],\n label,\n );\n return {\n http_requests: integer(value.http_requests, `${label}.http_requests`),\n embedding_jobs: integer(value.embedding_jobs, `${label}.embedding_jobs`),\n pending_jobs: integer(value.pending_jobs, `${label}.pending_jobs`),\n failure_rows: integer(value.failure_rows, `${label}.failure_rows`),\n other_active_fences: integer(value.other_active_fences, `${label}.other_active_fences`),\n };\n}\n\nfunction parseDerivativeTarget(options: {\n value: unknown;\n index: number;\n plan: FlowIdentityPlan;\n process: FlowIdentityScopeProcessStatus;\n}): FlowIdentityDerivativeTargetProof {\n const label = `derivative_set_proof.targets[${options.index}]`;\n if (!isJsonObject(options.value)) fail(`${label} must be an object.`);\n const value = options.value;\n assertExactKeys(\n value,\n [\n 'ordinal',\n 'id',\n 'version',\n 'original_batch_id',\n 'effective_reference_id',\n 'effective_reference_kind',\n 'status',\n 'request_status',\n 'phase',\n 'lineage_ok',\n 'proposals_committed',\n 'terminal_audit_present',\n 'residue',\n 'current_snapshot_sha256',\n 'current_json_ordered_sha256',\n 'causal_terminal_proof',\n ],\n label,\n );\n const ordinal = integer(value.ordinal, `${label}.ordinal`, 1);\n const expected = options.plan.processes[ordinal - 1];\n const requestStatus = token(value.request_status, `${label}.request_status`);\n const requestIsTerminal = ['completed', 'stale', 'failed', 'missing'].includes(requestStatus);\n const causalTerminalProof = boolean(\n value.causal_terminal_proof,\n `${label}.causal_terminal_proof`,\n );\n const expectedStatus = causalTerminalProof\n ? 'completed'\n : requestIsTerminal\n ? 'failed'\n : 'pending';\n const effectiveReferenceKind = token(\n value.effective_reference_kind,\n `${label}.effective_reference_kind`,\n );\n const phase = token(value.phase, `${label}.phase`);\n const missingOriginalDerivative =\n options.process.derivative_request_id === null &&\n options.process.derivative_status === 'missing' &&\n value.effective_reference_id === null &&\n effectiveReferenceKind === 'protected_batch' &&\n requestStatus === 'missing' &&\n phase === 'missing' &&\n value.status === 'failed' &&\n value.lineage_ok === false &&\n value.proposals_committed === false &&\n value.terminal_audit_present === false &&\n causalTerminalProof === false;\n if (\n ordinal !== options.index + 1 ||\n !expected ||\n options.process.ordinal !== ordinal ||\n options.process.status !== 'completed' ||\n value.id !== expected.id ||\n value.version !== expected.version ||\n value.original_batch_id !== options.process.derivative_batch_id ||\n !UUID_PATTERN.test(String(value.original_batch_id)) ||\n (!missingOriginalDerivative && !UUID_PATTERN.test(String(value.effective_reference_id))) ||\n !['protected_batch', 'separate_compensation'].includes(effectiveReferenceKind) ||\n ![\n 'queued',\n 'dispatching',\n 'markdown_pending',\n 'embedding_pending',\n 'completed',\n 'stale',\n 'failed',\n 'missing',\n ].includes(requestStatus) ||\n ((requestStatus === 'missing' ||\n phase === 'missing' ||\n value.effective_reference_id === null) &&\n !missingOriginalDerivative) ||\n value.status !== expectedStatus ||\n (causalTerminalProof && requestStatus !== 'completed') ||\n (effectiveReferenceKind === 'protected_batch' &&\n value.effective_reference_id !== options.process.derivative_request_id) ||\n (effectiveReferenceKind === 'separate_compensation' &&\n value.effective_reference_id === options.process.derivative_request_id) ||\n !HASH_PATTERN.test(String(value.current_json_ordered_sha256)) ||\n !HASH_PATTERN.test(String(value.current_snapshot_sha256))\n ) {\n fail(`${label} does not bind the ordered process/derivative ledger.`);\n }\n return {\n ordinal,\n id: expected.id,\n version: expected.version,\n original_batch_id: String(value.original_batch_id),\n effective_reference_id:\n value.effective_reference_id === null ? null : String(value.effective_reference_id),\n effective_reference_kind: effectiveReferenceKind as 'protected_batch' | 'separate_compensation',\n status: expectedStatus,\n request_status: requestStatus as FlowIdentityDerivativeTargetProof['request_status'],\n phase,\n lineage_ok: boolean(value.lineage_ok, `${label}.lineage_ok`),\n proposals_committed: boolean(value.proposals_committed, `${label}.proposals_committed`),\n terminal_audit_present: boolean(\n value.terminal_audit_present,\n `${label}.terminal_audit_present`,\n ),\n residue: parseDerivativeResidue(value.residue, `${label}.residue`),\n current_snapshot_sha256: String(value.current_snapshot_sha256),\n current_json_ordered_sha256: String(value.current_json_ordered_sha256),\n causal_terminal_proof: causalTerminalProof,\n };\n}\n\nexport function parseFlowIdentityDerivativeSetProof(options: {\n value: unknown;\n plan: FlowIdentityPlan;\n scopeId: string;\n processes: FlowIdentityScopeProcessStatus[];\n}): FlowIdentityDerivativeSetProof {\n if (!isJsonObject(options.value)) fail('Flow identity derivative set proof is invalid.');\n const value = options.value;\n assertExactKeys(\n value,\n [\n 'ok',\n 'schema_version',\n 'scope_id',\n 'status',\n 'target_count',\n 'completed_count',\n 'pending_count',\n 'failed_count',\n 'causal_terminal_proof',\n 'targets',\n 'compensation_targets',\n 'proof_sha256',\n ],\n 'derivative_set_proof',\n );\n if (!Array.isArray(value.targets) || !Array.isArray(value.compensation_targets)) {\n fail('Flow identity derivative set proof arrays are invalid.');\n }\n const completedProcesses = options.processes.filter((entry) => entry.status === 'completed');\n const targets = value.targets.map((entry, index) => {\n const process = completedProcesses[index];\n if (!process) fail('Derivative set proof contains a foreign target.');\n return parseDerivativeTarget({ value: entry, index, plan: options.plan, process });\n });\n const targetCount = integer(value.target_count, 'derivative_set_proof.target_count');\n const completedCount = integer(value.completed_count, 'derivative_set_proof.completed_count');\n const pendingCount = integer(value.pending_count, 'derivative_set_proof.pending_count');\n const failedCount = integer(value.failed_count, 'derivative_set_proof.failed_count');\n const causalTerminalProof = boolean(\n value.causal_terminal_proof,\n 'derivative_set_proof.causal_terminal_proof',\n );\n const expectedStatus =\n targetCount === 0\n ? 'failed'\n : failedCount > 0\n ? 'compensation_required'\n : pendingCount > 0\n ? 'pending'\n : 'completed';\n const compensationTargets = value.compensation_targets.map((entry) =>\n parseCompensationTarget(entry, options.plan, options.scopeId, 'derivative_set'),\n );\n const failedOrdinals = targets\n .filter((entry) => entry.status === 'failed')\n .map((entry) => entry.ordinal);\n if (\n value.schema_version !== 'dataset-flow-identity-derivative-set-proof.v1' ||\n value.scope_id !== options.scopeId ||\n targetCount !== targets.length ||\n targetCount !== completedProcesses.length ||\n completedCount !== targets.filter((entry) => entry.status === 'completed').length ||\n pendingCount !== targets.filter((entry) => entry.status === 'pending').length ||\n failedCount !== failedOrdinals.length ||\n completedCount + pendingCount + failedCount !== targetCount ||\n compensationTargets.length !== failedCount ||\n compensationTargets.some((entry, index) => entry.ordinal !== failedOrdinals[index]) ||\n compensationTargets.some((entry) => {\n const process = options.processes[entry.ordinal - 1];\n const target = targets[entry.ordinal - 1];\n const processMissingOriginal =\n process?.derivative_request_id === null && process.derivative_status === 'missing';\n return (\n (entry.original_status === 'missing') !== processMissingOriginal ||\n (target?.request_status === 'missing' && entry.original_status !== 'missing')\n );\n }) ||\n value.status !== expectedStatus ||\n value.ok !== (targetCount > 0 && failedCount === 0) ||\n causalTerminalProof !== (targetCount > 0 && completedCount === targetCount) ||\n !HASH_PATTERN.test(String(value.proof_sha256))\n ) {\n fail('Flow identity derivative set proof counts/status do not bind its ordered targets.');\n }\n return {\n ok: Boolean(value.ok),\n schema_version: 'dataset-flow-identity-derivative-set-proof.v1',\n scope_id: options.scopeId,\n status: expectedStatus,\n target_count: targetCount,\n completed_count: completedCount,\n pending_count: pendingCount,\n failed_count: failedCount,\n causal_terminal_proof: causalTerminalProof,\n targets,\n compensation_targets: compensationTargets,\n proof_sha256: String(value.proof_sha256),\n };\n}\n\nexport function parseFlowIdentityWholeScopeProof(options: {\n value: unknown;\n scopeId: string;\n receiptId: string;\n}): FlowIdentityWholeScopeProof {\n if (!isJsonObject(options.value)) fail('Flow identity whole-scope proof is invalid.');\n const value = options.value;\n assertExactKeys(\n value,\n [\n 'schema_version',\n 'scope_id',\n 'receipt_id',\n 'primary_current',\n 'audit_current',\n 'source_guards_current',\n 'support_guards_current',\n 'target_guards_current',\n 'approved_reference_residue_count',\n 'protected_closure_current',\n 'occurrence_closure_current',\n 'derivatives_current',\n 'primary_closure_sha256',\n 'source_guard_set_sha256',\n 'support_guard_set_sha256',\n 'target_guard_set_sha256',\n 'protected_closure_sha256',\n 'derivative_proof_set_sha256',\n 'causal_terminal_proof',\n 'proof_sha256',\n ],\n 'whole_scope_proof',\n );\n const proof: FlowIdentityWholeScopeProof = {\n schema_version: 'dataset-flow-identity-whole-scope-proof.v2',\n scope_id: uuid(value.scope_id, 'whole_scope_proof.scope_id'),\n receipt_id: uuid(value.receipt_id, 'whole_scope_proof.receipt_id'),\n primary_current: boolean(value.primary_current, 'whole_scope_proof.primary_current'),\n audit_current: boolean(value.audit_current, 'whole_scope_proof.audit_current'),\n source_guards_current: boolean(\n value.source_guards_current,\n 'whole_scope_proof.source_guards_current',\n ),\n support_guards_current: boolean(\n value.support_guards_current,\n 'whole_scope_proof.support_guards_current',\n ),\n target_guards_current: boolean(\n value.target_guards_current,\n 'whole_scope_proof.target_guards_current',\n ),\n approved_reference_residue_count: integer(\n value.approved_reference_residue_count,\n 'whole_scope_proof.approved_reference_residue_count',\n ),\n protected_closure_current: boolean(\n value.protected_closure_current,\n 'whole_scope_proof.protected_closure_current',\n ),\n occurrence_closure_current: boolean(\n value.occurrence_closure_current,\n 'whole_scope_proof.occurrence_closure_current',\n ),\n derivatives_current: boolean(\n value.derivatives_current,\n 'whole_scope_proof.derivatives_current',\n ),\n primary_closure_sha256: hash(\n value.primary_closure_sha256,\n 'whole_scope_proof.primary_closure_sha256',\n ),\n source_guard_set_sha256: hash(\n value.source_guard_set_sha256,\n 'whole_scope_proof.source_guard_set_sha256',\n ),\n support_guard_set_sha256: hash(\n value.support_guard_set_sha256,\n 'whole_scope_proof.support_guard_set_sha256',\n ),\n target_guard_set_sha256: hash(\n value.target_guard_set_sha256,\n 'whole_scope_proof.target_guard_set_sha256',\n ),\n protected_closure_sha256: hash(\n value.protected_closure_sha256,\n 'whole_scope_proof.protected_closure_sha256',\n ),\n derivative_proof_set_sha256: hash(\n value.derivative_proof_set_sha256,\n 'whole_scope_proof.derivative_proof_set_sha256',\n ),\n causal_terminal_proof: boolean(\n value.causal_terminal_proof,\n 'whole_scope_proof.causal_terminal_proof',\n ),\n proof_sha256: hash(value.proof_sha256, 'whole_scope_proof.proof_sha256'),\n };\n if (\n value.schema_version !== proof.schema_version ||\n proof.scope_id !== options.scopeId ||\n proof.receipt_id !== options.receiptId\n ) {\n fail('Flow identity whole-scope proof does not bind the actor scope receipt.');\n }\n return proof;\n}\n\nexport function parseFlowIdentityScopeStatus(\n value: unknown,\n plan: FlowIdentityPlan,\n scopeId: string,\n scopeProofSha256: string,\n): FlowIdentityScopeStatus {\n if (!isJsonObject(value) || !Array.isArray(value.processes)) {\n fail('Flow identity scope status is invalid.');\n }\n const scopeStatusKeys = [\n 'ok',\n 'command',\n 'schema_version',\n 'scope_id',\n 'receipt_id',\n 'receipt_proof_sha256',\n 'mapping_guard_set_sha256',\n 'process_intent_set_sha256',\n 'operation_id',\n 'plan_sha256',\n 'scope_proof_sha256',\n 'status',\n 'process_count',\n 'completed_process_count',\n 'pending_process_count',\n 'failed_process_count',\n 'next_ordinal',\n 'rewrite_count',\n 'completed_rewrite_count',\n 'primary_complete',\n 'cancellable',\n 'strict_continuation_required',\n 'primary_current',\n 'live_guard_current',\n 'derivatives_current',\n 'derivative_pending_count',\n 'derivative_failed_count',\n 'derivative_set_proof',\n 'derivative_proof_set_sha256',\n 'compensation_required',\n 'automatic_retry',\n 'compensation_targets',\n 'protected_closure_current',\n 'protected_closure_proof',\n 'processes',\n 'terminal_proof_sha256',\n 'completed_at',\n 'whole_scope_proof',\n 'whole_scope_proof_sha256',\n ...(value.code === undefined ? [] : ['code']),\n ];\n assertExactKeys(value, scopeStatusKeys, 'scope status result');\n const processes = value.processes.map((entry, index) => {\n const expected = plan.processes[index];\n if (!expected) fail('Scope status contains a foreign process ledger entry.');\n return parseScopeProcess(entry, expected);\n });\n const derivativeSetProof = parseFlowIdentityDerivativeSetProof({\n value: value.derivative_set_proof,\n plan,\n scopeId,\n processes,\n });\n const wholeScopeProof = parseFlowIdentityWholeScopeProof({\n value: value.whole_scope_proof,\n scopeId,\n receiptId: plan.receipt_id,\n });\n const status = String(value.status);\n const liveDrift = status === 'live_drift';\n if (\n integer(value.process_count, 'process_count') !== plan.processes.length ||\n integer(value.rewrite_count, 'rewrite_count') !== plan.summary.rewrites ||\n integer(value.pending_process_count, 'pending_process_count') !==\n processes.filter((entry) => entry.status === 'pending').length ||\n integer(value.failed_process_count, 'failed_process_count') !==\n processes.filter((entry) => entry.status === 'failed').length ||\n integer(value.completed_rewrite_count, 'completed_rewrite_count') !==\n processes\n .filter((entry) => entry.status === 'completed')\n .reduce((sum, entry) => sum + entry.rewrite_count, 0)\n ) {\n fail('Flow identity scope status counts do not match the plan.');\n }\n if (\n value.ok !==\n (!['failed', 'live_drift'].includes(status) && value.compensation_required !== true) ||\n value.command !== 'cmd_dataset_flow_identity_scope_read' ||\n value.schema_version !== 'dataset-flow-identity-scope-status.v2' ||\n value.scope_id !== scopeId ||\n value.receipt_id !== plan.receipt_id ||\n value.receipt_proof_sha256 !== plan.receipt_proof_sha256 ||\n value.mapping_guard_set_sha256 !== plan.mapping_guard_set_sha256 ||\n value.process_intent_set_sha256 !== plan.process_intent_set_sha256 ||\n value.operation_id !== plan.operation_id ||\n value.plan_sha256 !== plan.plan_sha256 ||\n value.scope_proof_sha256 !== scopeProofSha256 ||\n ![\n 'sealed',\n 'running',\n 'primary_complete',\n 'derivatives_pending',\n 'completed',\n 'live_drift',\n 'failed',\n ].includes(String(value.status)) ||\n processes.length !== plan.processes.length ||\n integer(value.completed_process_count, 'completed_process_count') !==\n processes.filter((entry) => entry.status === 'completed').length ||\n integer(value.next_ordinal, 'next_ordinal', 1) !==\n Math.min(\n processes.find((entry) => entry.status === 'pending')?.ordinal ?? processes.length + 1,\n processes.length + 1,\n ) ||\n typeof value.primary_complete !== 'boolean' ||\n value.primary_complete !== processes.every((entry) => entry.status === 'completed') ||\n typeof value.cancellable !== 'boolean' ||\n value.cancellable !==\n (processes.every((entry) => entry.status === 'pending') &&\n !['completed', 'failed', 'live_drift'].includes(status)) ||\n typeof value.strict_continuation_required !== 'boolean' ||\n value.strict_continuation_required !==\n (processes.some((entry) => entry.status === 'completed') &&\n processes.some((entry) => entry.status === 'pending')) ||\n typeof value.primary_current !== 'boolean' ||\n value.primary_current !== wholeScopeProof.primary_current ||\n typeof value.live_guard_current !== 'boolean' ||\n value.live_guard_current !==\n (wholeScopeProof.audit_current &&\n wholeScopeProof.source_guards_current &&\n wholeScopeProof.support_guards_current &&\n wholeScopeProof.target_guards_current &&\n wholeScopeProof.protected_closure_current &&\n wholeScopeProof.occurrence_closure_current) ||\n typeof value.derivatives_current !== 'boolean' ||\n (!liveDrift && value.derivatives_current !== derivativeSetProof.causal_terminal_proof) ||\n value.derivatives_current !== wholeScopeProof.derivatives_current ||\n integer(value.derivative_pending_count, 'derivative_pending_count') !==\n derivativeSetProof.pending_count ||\n integer(value.derivative_failed_count, 'derivative_failed_count') !==\n derivativeSetProof.failed_count ||\n value.derivative_proof_set_sha256 !== derivativeSetProof.proof_sha256 ||\n wholeScopeProof.derivative_proof_set_sha256 !== derivativeSetProof.proof_sha256 ||\n typeof value.protected_closure_current !== 'boolean' ||\n value.protected_closure_current !== wholeScopeProof.protected_closure_current ||\n !isJsonObject(value.protected_closure_proof) ||\n value.whole_scope_proof_sha256 !== wholeScopeProof.proof_sha256 ||\n value.automatic_retry !== false ||\n typeof value.compensation_required !== 'boolean' ||\n (!liveDrift && value.compensation_required !== derivativeSetProof.failed_count > 0) ||\n !Array.isArray(value.compensation_targets)\n ) {\n fail('Flow identity scope status does not match the sealed plan/progress ledger.');\n }\n if (\n (status === 'completed' &&\n (!wholeScopeProof.primary_current ||\n !wholeScopeProof.audit_current ||\n !wholeScopeProof.source_guards_current ||\n !wholeScopeProof.support_guards_current ||\n !wholeScopeProof.target_guards_current ||\n wholeScopeProof.approved_reference_residue_count !== 0 ||\n !wholeScopeProof.protected_closure_current ||\n !wholeScopeProof.occurrence_closure_current ||\n !wholeScopeProof.derivatives_current ||\n !wholeScopeProof.causal_terminal_proof)) ||\n (liveDrift &&\n (value.ok !== false ||\n !['FLOW_IDENTITY_PRIMARY_OR_GUARD_DRIFT', 'FLOW_IDENTITY_SCOPE_TERMINAL_CONFLICT'].includes(\n String(value.code),\n ) ||\n (value.primary_current === true && value.live_guard_current === true) ||\n value.derivatives_current !== false ||\n value.compensation_required !== false ||\n !Array.isArray(value.compensation_targets) ||\n value.compensation_targets.length !== 0))\n ) {\n fail('Flow identity completed/live-drift status contradicts the dynamic whole-scope proof.');\n }\n if (\n value.status === 'completed'\n ? !HASH_PATTERN.test(String(value.terminal_proof_sha256))\n : value.terminal_proof_sha256 !== null\n ) {\n fail('Flow identity scope terminal proof does not match its status.');\n }\n if (\n status === 'completed'\n ? !Number.isFinite(Date.parse(String(value.completed_at)))\n : value.completed_at !== null\n ) {\n fail('Flow identity scope completion timestamp does not match its status.');\n }\n const compensationTargets = liveDrift\n ? []\n : parseCompensationEnvelope(value, plan, scopeId, 'scope_read');\n if (\n !liveDrift &&\n (compensationTargets.length !== derivativeSetProof.compensation_targets.length ||\n compensationTargets.some((entry, index) => {\n const derivativeEntry = derivativeSetProof.compensation_targets[index];\n return (\n !derivativeEntry ||\n entry.ordinal !== derivativeEntry.ordinal ||\n entry.id !== derivativeEntry.id ||\n entry.version !== derivativeEntry.version ||\n entry.original_batch_id !== derivativeEntry.original_batch_id ||\n entry.original_status !== derivativeEntry.original_status ||\n entry.original_code !== derivativeEntry.original_code ||\n entry.desired_payload_sha256 !== derivativeEntry.desired_payload_sha256 ||\n entry.current_json_ordered_sha256 !== derivativeEntry.current_json_ordered_sha256 ||\n entry.current_snapshot_sha256 !== derivativeEntry.current_snapshot_sha256 ||\n entry.latest_compensation_request_id !== derivativeEntry.latest_compensation_request_id ||\n entry.latest_compensation_status !== derivativeEntry.latest_compensation_status ||\n entry.latest_compensation_plan_sha256 !== derivativeEntry.latest_compensation_plan_sha256\n );\n }))\n ) {\n fail('Scope compensation convenience fields do not match the dynamic derivative proof.');\n }\n return {\n ...(value as FlowIdentityScopeStatus),\n processes,\n derivative_set_proof: derivativeSetProof,\n whole_scope_proof: wholeScopeProof,\n compensation_targets: compensationTargets,\n };\n}\n\nexport function flowIdentityScopeHasCurrentDerivativeClosure(\n status: FlowIdentityScopeStatus,\n): boolean {\n return Boolean(\n status.status === 'completed' &&\n typeof status.terminal_proof_sha256 === 'string' &&\n HASH_PATTERN.test(status.terminal_proof_sha256) &&\n flowIdentityScopeIsReadyToFinalize(status),\n );\n}\n\nexport function flowIdentityScopeIsReadyToFinalize(status: FlowIdentityScopeStatus): boolean {\n const proof = status.derivative_set_proof;\n const whole = status.whole_scope_proof;\n return Boolean(\n ['primary_complete', 'completed'].includes(status.status) &&\n status.primary_complete &&\n status.primary_current &&\n status.live_guard_current &&\n status.derivatives_current &&\n status.protected_closure_current &&\n status.derivative_pending_count === 0 &&\n status.derivative_failed_count === 0 &&\n status.compensation_required === false &&\n status.compensation_targets?.length === 0 &&\n proof.ok &&\n proof.status === 'completed' &&\n proof.target_count === status.process_count &&\n proof.completed_count === status.process_count &&\n proof.pending_count === 0 &&\n proof.failed_count === 0 &&\n proof.causal_terminal_proof &&\n proof.targets.length === status.process_count &&\n proof.compensation_targets.length === 0 &&\n HASH_PATTERN.test(proof.proof_sha256) &&\n whole.primary_current &&\n whole.audit_current &&\n whole.source_guards_current &&\n whole.support_guards_current &&\n whole.target_guards_current &&\n whole.approved_reference_residue_count === 0 &&\n whole.protected_closure_current &&\n whole.occurrence_closure_current &&\n whole.derivatives_current &&\n whole.causal_terminal_proof &&\n whole.proof_sha256 === status.whole_scope_proof_sha256 &&\n proof.targets.every((target, index) => {\n const process = status.processes[index];\n return (\n process?.status === 'completed' &&\n target.ordinal === index + 1 &&\n target.current_json_ordered_sha256 === process.desired_payload_sha256 &&\n target.status === 'completed' &&\n target.request_status === 'completed' &&\n target.phase === 'completed' &&\n target.lineage_ok &&\n target.proposals_committed &&\n target.terminal_audit_present &&\n HASH_PATTERN.test(target.current_snapshot_sha256) &&\n Object.values(target.residue).every((count) => count === 0) &&\n target.causal_terminal_proof\n );\n }),\n );\n}\n\nexport function parseFlowIdentityFinalizeProof(options: {\n value: unknown;\n plan: FlowIdentityPlan;\n scopeId: string;\n scopeProofSha256: string;\n request: JsonObject;\n expectedInvocationId?: string;\n expectedPermitGenerationBefore?: number;\n}): FlowIdentityFinalizeProof {\n if (!isJsonObject(options.value) || !isJsonObject(options.request.expected)) {\n fail('Flow identity finalize proof is invalid.');\n }\n const value = options.value;\n const expected = options.request.expected;\n const completed = value.status === 'completed';\n const failed = value.status === 'failed';\n const liveDrift = value.status === 'live_drift';\n const compensationRequired = value.compensation_required === true;\n const derivativesPending = value.status === 'derivatives_pending';\n const wholeScopeProof = parseFlowIdentityWholeScopeProof({\n value: value.whole_scope_proof,\n scopeId: options.scopeId,\n receiptId: options.plan.receipt_id,\n });\n const finalizeKeys = [\n 'ok',\n 'command',\n 'schema_version',\n 'scope_id',\n 'receipt_id',\n 'receipt_proof_sha256',\n 'mapping_guard_set_sha256',\n 'process_intent_set_sha256',\n 'operation_id',\n 'plan_sha256',\n 'scope_proof_sha256',\n 'invocation_id',\n 'permit_generation_before',\n 'status',\n 'process_count',\n 'completed_process_count',\n 'rewrite_count',\n 'primary_closure_sha256',\n 'protected_closure_sha256',\n 'derivative_target_set_sha256',\n 'derivative_proof_set_sha256',\n 'primary_current',\n 'live_guard_current',\n 'derivatives_current',\n 'terminal_proof_sha256',\n 'whole_scope_proof',\n 'whole_scope_proof_sha256',\n 'audit_id',\n 'replay',\n ...(completed\n ? []\n : ['code', 'compensation_required', 'automatic_retry', 'compensation_targets']),\n ];\n assertExactKeys(value, finalizeKeys, `${String(value.status)} finalize result`);\n if (\n value.ok !== (!failed && !liveDrift && !compensationRequired) ||\n value.command !== 'cmd_dataset_flow_identity_scope_finalize_guarded' ||\n value.schema_version !== 'dataset-flow-identity-scope-finalize-result.v2' ||\n value.scope_id !== options.scopeId ||\n value.receipt_id !== options.plan.receipt_id ||\n value.receipt_proof_sha256 !== options.plan.receipt_proof_sha256 ||\n value.mapping_guard_set_sha256 !== options.plan.mapping_guard_set_sha256 ||\n value.process_intent_set_sha256 !== options.plan.process_intent_set_sha256 ||\n value.operation_id !== options.plan.operation_id ||\n value.plan_sha256 !== options.plan.plan_sha256 ||\n value.scope_proof_sha256 !== options.scopeProofSha256 ||\n !UUID_PATTERN.test(String(value.invocation_id)) ||\n !Number.isSafeInteger(value.permit_generation_before) ||\n Number(value.permit_generation_before) < 0 ||\n (options.expectedInvocationId !== undefined &&\n value.invocation_id !== options.expectedInvocationId) ||\n (options.expectedPermitGenerationBefore !== undefined &&\n value.permit_generation_before !== options.expectedPermitGenerationBefore) ||\n !['derivatives_pending', 'completed', 'live_drift', 'failed'].includes(String(value.status)) ||\n value.process_count !== expected.process_count ||\n value.rewrite_count !== expected.rewrite_count ||\n value.completed_process_count !== expected.completed_process_count ||\n !HASH_PATTERN.test(String(value.primary_closure_sha256)) ||\n !HASH_PATTERN.test(String(value.protected_closure_sha256)) ||\n !HASH_PATTERN.test(String(value.derivative_target_set_sha256)) ||\n !HASH_PATTERN.test(String(value.derivative_proof_set_sha256)) ||\n value.primary_closure_sha256 !== wholeScopeProof.primary_closure_sha256 ||\n value.protected_closure_sha256 !== wholeScopeProof.protected_closure_sha256 ||\n value.derivative_proof_set_sha256 !== wholeScopeProof.derivative_proof_set_sha256 ||\n typeof value.primary_current !== 'boolean' ||\n value.primary_current !== wholeScopeProof.primary_current ||\n typeof value.live_guard_current !== 'boolean' ||\n value.live_guard_current !==\n (wholeScopeProof.audit_current &&\n wholeScopeProof.source_guards_current &&\n wholeScopeProof.support_guards_current &&\n wholeScopeProof.target_guards_current &&\n wholeScopeProof.protected_closure_current &&\n wholeScopeProof.occurrence_closure_current) ||\n typeof value.derivatives_current !== 'boolean' ||\n value.derivatives_current !== wholeScopeProof.derivatives_current ||\n value.whole_scope_proof_sha256 !== wholeScopeProof.proof_sha256 ||\n (derivativesPending &&\n (typeof value.compensation_required !== 'boolean' ||\n !Array.isArray(value.compensation_targets) ||\n value.automatic_retry !== false ||\n ![\n 'FLOW_IDENTITY_DERIVATIVES_PENDING',\n 'FLOW_IDENTITY_DERIVATIVE_COMPENSATION_REQUIRED',\n ].includes(String(value.code)))) ||\n (completed\n ? !HASH_PATTERN.test(String(value.terminal_proof_sha256))\n : value.terminal_proof_sha256 !== null) ||\n (completed\n ? typeof value.audit_id !== 'string' || !value.audit_id.trim()\n : value.audit_id !== null &&\n (typeof value.audit_id !== 'string' || !value.audit_id.trim())) ||\n typeof value.replay !== 'boolean'\n ) {\n fail('Flow identity finalize proof does not match the exact expected closure.');\n }\n if (\n completed &&\n (!value.primary_current ||\n !value.live_guard_current ||\n !value.derivatives_current ||\n !wholeScopeProof.audit_current ||\n wholeScopeProof.approved_reference_residue_count !== 0 ||\n !wholeScopeProof.causal_terminal_proof)\n ) {\n fail('Completed finalize replay is not dynamically current across the whole scope.');\n }\n if (\n liveDrift &&\n (value.ok !== false ||\n value.code !== 'FLOW_IDENTITY_PRIMARY_OR_GUARD_DRIFT' ||\n (value.primary_current === true && value.live_guard_current === true) ||\n value.derivatives_current !== false ||\n value.compensation_required !== false ||\n !Array.isArray(value.compensation_targets) ||\n value.compensation_targets.length !== 0)\n ) {\n fail('Live-drift finalize response must be a non-compensable dynamic downgrade.');\n }\n if (\n failed &&\n (value.code !== 'FLOW_IDENTITY_FINALIZE_FAILED' ||\n value.compensation_required !== false ||\n value.automatic_retry !== false ||\n !Array.isArray(value.compensation_targets) ||\n value.compensation_targets.length !== 0)\n ) {\n fail('Failed finalize response must be the exact non-compensable v2 envelope.');\n }\n parseCompensationEnvelope(value, options.plan, options.scopeId, 'finalize');\n return {\n ...(value as FlowIdentityFinalizeProof),\n whole_scope_proof: wholeScopeProof,\n };\n}\n\nexport function prepareFlowIdentityExecution(options: {\n plan: unknown;\n freeze: unknown;\n approval: unknown;\n}): {\n plan: FlowIdentityPlan;\n freeze: FlowIdentityFreeze;\n approval: FlowIdentityApproval;\n identity: FlowIdentityExecutionIdentity;\n preflightRequest: JsonObject;\n} {\n const plan = parseFlowIdentityPlan(options.plan);\n const freeze = parseFlowIdentityFreeze(options.freeze, plan);\n const approval = parseFlowIdentityApproval(options.approval, plan, freeze);\n const identity = buildFlowIdentityExecutionIdentity({ plan, freeze, approval });\n return {\n plan,\n freeze,\n approval,\n identity,\n preflightRequest: buildFlowIdentityScopePreflightRequest({ plan, identity }),\n };\n}\n\nexport const __testInternals = {\n deterministicUuidFromSha256,\n hash,\n instant,\n integer,\n parseScopeProcess,\n parseCompensationEnvelope,\n token,\n uuid,\n};\n"]}