@agent-teams/engineering-foundation 0.14.0 → 0.16.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -8
- package/dist/capability-runtime.d.ts +2 -1
- package/dist/capability-runtime.d.ts.map +1 -1
- package/dist/capability-runtime.js +1 -1
- package/dist/capability-runtime.js.map +1 -1
- package/dist/check-contract.d.ts +2 -1
- package/dist/check-contract.d.ts.map +1 -1
- package/dist/check-runner.d.ts.map +1 -1
- package/dist/check-runner.js +6 -2
- package/dist/check-runner.js.map +1 -1
- package/dist/cli-arguments.d.ts +6 -0
- package/dist/cli-arguments.d.ts.map +1 -1
- package/dist/cli-arguments.js +179 -49
- package/dist/cli-arguments.js.map +1 -1
- package/dist/cli.js +16 -10
- package/dist/cli.js.map +1 -1
- package/dist/command-error.d.ts +14 -0
- package/dist/command-error.d.ts.map +1 -0
- package/dist/command-error.js +98 -0
- package/dist/command-error.js.map +1 -0
- package/dist/document-authoring/adapters/inbound/cli/document-command-failure.d.ts +5 -0
- package/dist/document-authoring/adapters/inbound/cli/document-command-failure.d.ts.map +1 -0
- package/dist/document-authoring/adapters/inbound/cli/document-command-failure.js +36 -0
- package/dist/document-authoring/adapters/inbound/cli/document-command-failure.js.map +1 -0
- package/dist/document-authoring/adapters/inbound/cli/document-command-renderer.d.ts +6 -0
- package/dist/document-authoring/adapters/inbound/cli/document-command-renderer.d.ts.map +1 -0
- package/dist/document-authoring/adapters/inbound/cli/document-command-renderer.js +127 -0
- package/dist/document-authoring/adapters/inbound/cli/document-command-renderer.js.map +1 -0
- package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile.d.ts +33 -0
- package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile.js +47 -0
- package/dist/document-authoring/adapters/node/load-validated-document-authoring-profile.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader.d.ts.map +1 -1
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader.js +14 -39
- package/dist/document-authoring/adapters/node/node-authoring-profile-reader.js.map +1 -1
- package/dist/document-authoring/adapters/node/node-document-contract-validator.d.ts +7 -0
- package/dist/document-authoring/adapters/node/node-document-contract-validator.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-contract-validator.js +306 -0
- package/dist/document-authoring/adapters/node/node-document-contract-validator.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-environment-inspector.d.ts +17 -0
- package/dist/document-authoring/adapters/node/node-document-environment-inspector.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-environment-inspector.js +49 -0
- package/dist/document-authoring/adapters/node/node-document-environment-inspector.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-file-state.d.ts +21 -0
- package/dist/document-authoring/adapters/node/node-document-file-state.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-file-state.js +183 -0
- package/dist/document-authoring/adapters/node/node-document-file-state.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-journal-slot.d.ts +2 -0
- package/dist/document-authoring/adapters/node/node-document-journal-slot.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-journal-slot.js +18 -0
- package/dist/document-authoring/adapters/node/node-document-journal-slot.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-journal-store-faults.d.ts +36 -0
- package/dist/document-authoring/adapters/node/node-document-journal-store-faults.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-journal-store-faults.js +2 -0
- package/dist/document-authoring/adapters/node/node-document-journal-store-faults.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-journal-store-private.d.ts +2 -0
- package/dist/document-authoring/adapters/node/node-document-journal-store-private.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-journal-store-private.js +2 -0
- package/dist/document-authoring/adapters/node/node-document-journal-store-private.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-journal-store.d.ts +22 -0
- package/dist/document-authoring/adapters/node/node-document-journal-store.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-journal-store.js +339 -0
- package/dist/document-authoring/adapters/node/node-document-journal-store.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.d.ts +10 -0
- package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.js +75 -0
- package/dist/document-authoring/adapters/node/node-document-planning-profile-reader.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-planning-state-reader.d.ts +10 -0
- package/dist/document-authoring/adapters/node/node-document-planning-state-reader.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-planning-state-reader.js +164 -0
- package/dist/document-authoring/adapters/node/node-document-planning-state-reader.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-publisher-private.d.ts +2 -0
- package/dist/document-authoring/adapters/node/node-document-publisher-private.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-publisher-private.js +2 -0
- package/dist/document-authoring/adapters/node/node-document-publisher-private.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-publisher.d.ts +54 -0
- package/dist/document-authoring/adapters/node/node-document-publisher.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-publisher.js +252 -0
- package/dist/document-authoring/adapters/node/node-document-publisher.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-reachability-projector.d.ts +17 -0
- package/dist/document-authoring/adapters/node/node-document-reachability-projector.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-reachability-projector.js +43 -0
- package/dist/document-authoring/adapters/node/node-document-reachability-projector.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-structure-verifier.d.ts +21 -0
- package/dist/document-authoring/adapters/node/node-document-structure-verifier.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-structure-verifier.js +80 -0
- package/dist/document-authoring/adapters/node/node-document-structure-verifier.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-template-reader.d.ts +10 -0
- package/dist/document-authoring/adapters/node/node-document-template-reader.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-template-reader.js +32 -0
- package/dist/document-authoring/adapters/node/node-document-template-reader.js.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-transaction-coordinator.d.ts +21 -0
- package/dist/document-authoring/adapters/node/node-document-transaction-coordinator.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/node-document-transaction-coordinator.js +89 -0
- package/dist/document-authoring/adapters/node/node-document-transaction-coordinator.js.map +1 -0
- package/dist/document-authoring/adapters/node/recapture-document-publication-paths.d.ts +16 -0
- package/dist/document-authoring/adapters/node/recapture-document-publication-paths.d.ts.map +1 -0
- package/dist/document-authoring/adapters/node/recapture-document-publication-paths.js +89 -0
- package/dist/document-authoring/adapters/node/recapture-document-publication-paths.js.map +1 -0
- package/dist/document-authoring/application/model/document-command.d.ts +69 -0
- package/dist/document-authoring/application/model/document-command.d.ts.map +1 -0
- package/dist/document-authoring/application/model/document-command.js +2 -0
- package/dist/document-authoring/application/model/document-command.js.map +1 -0
- package/dist/document-authoring/application/model/document-physical-identity.d.ts +10 -0
- package/dist/document-authoring/application/model/document-physical-identity.d.ts.map +1 -0
- package/dist/document-authoring/application/model/document-physical-identity.js +29 -0
- package/dist/document-authoring/application/model/document-physical-identity.js.map +1 -0
- package/dist/document-authoring/application/model/document-planning.d.ts +182 -0
- package/dist/document-authoring/application/model/document-planning.d.ts.map +1 -0
- package/dist/document-authoring/application/model/document-planning.js +2 -0
- package/dist/document-authoring/application/model/document-planning.js.map +1 -0
- package/dist/document-authoring/application/model/document-receipt.d.ts +74 -0
- package/dist/document-authoring/application/model/document-receipt.d.ts.map +1 -0
- package/dist/document-authoring/application/model/document-receipt.js +2 -0
- package/dist/document-authoring/application/model/document-receipt.js.map +1 -0
- package/dist/document-authoring/application/model/document-transaction-inspection.d.ts +43 -0
- package/dist/document-authoring/application/model/document-transaction-inspection.d.ts.map +1 -0
- package/dist/document-authoring/application/model/document-transaction-inspection.js +2 -0
- package/dist/document-authoring/application/model/document-transaction-inspection.js.map +1 -0
- package/dist/document-authoring/application/model/document-transaction.d.ts +81 -0
- package/dist/document-authoring/application/model/document-transaction.d.ts.map +1 -0
- package/dist/document-authoring/application/model/document-transaction.js +2 -0
- package/dist/document-authoring/application/model/document-transaction.js.map +1 -0
- package/dist/document-authoring/application/policies/authoring-profile-semantics.d.ts +5 -1
- package/dist/document-authoring/application/policies/authoring-profile-semantics.d.ts.map +1 -1
- package/dist/document-authoring/application/policies/authoring-profile-semantics.js +7 -0
- package/dist/document-authoring/application/policies/authoring-profile-semantics.js.map +1 -1
- package/dist/document-authoring/application/policies/classify-document-recovery.d.ts +81 -0
- package/dist/document-authoring/application/policies/classify-document-recovery.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/classify-document-recovery.js +138 -0
- package/dist/document-authoring/application/policies/classify-document-recovery.js.map +1 -0
- package/dist/document-authoring/application/policies/document-command-consumer-root.d.ts +2 -0
- package/dist/document-authoring/application/policies/document-command-consumer-root.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-command-consumer-root.js +15 -0
- package/dist/document-authoring/application/policies/document-command-consumer-root.js.map +1 -0
- package/dist/document-authoring/application/policies/document-command-projection.d.ts +20 -0
- package/dist/document-authoring/application/policies/document-command-projection.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-command-projection.js +90 -0
- package/dist/document-authoring/application/policies/document-command-projection.js.map +1 -0
- package/dist/document-authoring/application/policies/document-logical-preimage.d.ts +14 -0
- package/dist/document-authoring/application/policies/document-logical-preimage.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-logical-preimage.js +61 -0
- package/dist/document-authoring/application/policies/document-logical-preimage.js.map +1 -0
- package/dist/document-authoring/application/policies/document-planning-policy-error.d.ts +6 -0
- package/dist/document-authoring/application/policies/document-planning-policy-error.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-planning-policy-error.js +9 -0
- package/dist/document-authoring/application/policies/document-planning-policy-error.js.map +1 -0
- package/dist/document-authoring/application/policies/document-receipt-policy.d.ts +5 -0
- package/dist/document-authoring/application/policies/document-receipt-policy.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-receipt-policy.js +53 -0
- package/dist/document-authoring/application/policies/document-receipt-policy.js.map +1 -0
- package/dist/document-authoring/application/policies/document-transaction-digests.d.ts +5 -0
- package/dist/document-authoring/application/policies/document-transaction-digests.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-transaction-digests.js +12 -0
- package/dist/document-authoring/application/policies/document-transaction-digests.js.map +1 -0
- package/dist/document-authoring/application/policies/document-transaction-envelope-policy.d.ts +4 -0
- package/dist/document-authoring/application/policies/document-transaction-envelope-policy.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/document-transaction-envelope-policy.js +118 -0
- package/dist/document-authoring/application/policies/document-transaction-envelope-policy.js.map +1 -0
- package/dist/document-authoring/application/policies/normalize-document-intent.d.ts +3 -0
- package/dist/document-authoring/application/policies/normalize-document-intent.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/normalize-document-intent.js +104 -0
- package/dist/document-authoring/application/policies/normalize-document-intent.js.map +1 -0
- package/dist/document-authoring/application/policies/project-document-reachability.d.ts +14 -0
- package/dist/document-authoring/application/policies/project-document-reachability.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/project-document-reachability.js +57 -0
- package/dist/document-authoring/application/policies/project-document-reachability.js.map +1 -0
- package/dist/document-authoring/application/policies/project-similar-document-advice.d.ts +4 -0
- package/dist/document-authoring/application/policies/project-similar-document-advice.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/project-similar-document-advice.js +17 -0
- package/dist/document-authoring/application/policies/project-similar-document-advice.js.map +1 -0
- package/dist/document-authoring/application/policies/resolve-document-authoring.d.ts +13 -0
- package/dist/document-authoring/application/policies/resolve-document-authoring.d.ts.map +1 -0
- package/dist/document-authoring/application/policies/resolve-document-authoring.js +154 -0
- package/dist/document-authoring/application/policies/resolve-document-authoring.js.map +1 -0
- package/dist/document-authoring/application/ports/document-authority-recompiler.d.ts +19 -0
- package/dist/document-authoring/application/ports/document-authority-recompiler.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-authority-recompiler.js +2 -0
- package/dist/document-authoring/application/ports/document-authority-recompiler.js.map +1 -0
- package/dist/document-authoring/application/ports/document-contract-validator.d.ts +6 -0
- package/dist/document-authoring/application/ports/document-contract-validator.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-contract-validator.js +2 -0
- package/dist/document-authoring/application/ports/document-contract-validator.js.map +1 -0
- package/dist/document-authoring/application/ports/document-environment-inspector.d.ts +12 -0
- package/dist/document-authoring/application/ports/document-environment-inspector.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-environment-inspector.js +2 -0
- package/dist/document-authoring/application/ports/document-environment-inspector.js.map +1 -0
- package/dist/document-authoring/application/ports/document-file-state.d.ts +55 -0
- package/dist/document-authoring/application/ports/document-file-state.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-file-state.js +2 -0
- package/dist/document-authoring/application/ports/document-file-state.js.map +1 -0
- package/dist/document-authoring/application/ports/document-journal-store.d.ts +31 -0
- package/dist/document-authoring/application/ports/document-journal-store.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-journal-store.js +2 -0
- package/dist/document-authoring/application/ports/document-journal-store.js.map +1 -0
- package/dist/document-authoring/application/ports/document-planning-profile-reader.d.ts +9 -0
- package/dist/document-authoring/application/ports/document-planning-profile-reader.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-planning-profile-reader.js +2 -0
- package/dist/document-authoring/application/ports/document-planning-profile-reader.js.map +1 -0
- package/dist/document-authoring/application/ports/document-planning-state-reader.d.ts +9 -0
- package/dist/document-authoring/application/ports/document-planning-state-reader.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-planning-state-reader.js +2 -0
- package/dist/document-authoring/application/ports/document-planning-state-reader.js.map +1 -0
- package/dist/document-authoring/application/ports/document-publisher.d.ts +38 -0
- package/dist/document-authoring/application/ports/document-publisher.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-publisher.js +2 -0
- package/dist/document-authoring/application/ports/document-publisher.js.map +1 -0
- package/dist/document-authoring/application/ports/document-reachability-projector.d.ts +13 -0
- package/dist/document-authoring/application/ports/document-reachability-projector.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-reachability-projector.js +2 -0
- package/dist/document-authoring/application/ports/document-reachability-projector.js.map +1 -0
- package/dist/document-authoring/application/ports/document-structure-verifier.d.ts +17 -0
- package/dist/document-authoring/application/ports/document-structure-verifier.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-structure-verifier.js +2 -0
- package/dist/document-authoring/application/ports/document-structure-verifier.js.map +1 -0
- package/dist/document-authoring/application/ports/document-template-reader.d.ts +9 -0
- package/dist/document-authoring/application/ports/document-template-reader.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-template-reader.js +2 -0
- package/dist/document-authoring/application/ports/document-template-reader.js.map +1 -0
- package/dist/document-authoring/application/ports/document-transaction-coordinator.d.ts +21 -0
- package/dist/document-authoring/application/ports/document-transaction-coordinator.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/document-transaction-coordinator.js +2 -0
- package/dist/document-authoring/application/ports/document-transaction-coordinator.js.map +1 -0
- package/dist/document-authoring/application/ports/documentation-catalog-reader.d.ts +11 -0
- package/dist/document-authoring/application/ports/documentation-catalog-reader.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/documentation-catalog-reader.js +2 -0
- package/dist/document-authoring/application/ports/documentation-catalog-reader.js.map +1 -0
- package/dist/document-authoring/application/ports/similar-document-advisor.d.ts +17 -0
- package/dist/document-authoring/application/ports/similar-document-advisor.d.ts.map +1 -0
- package/dist/document-authoring/application/ports/similar-document-advisor.js +2 -0
- package/dist/document-authoring/application/ports/similar-document-advisor.js.map +1 -0
- package/dist/document-authoring/application/use-cases/apply-document-plan.d.ts +16 -0
- package/dist/document-authoring/application/use-cases/apply-document-plan.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/apply-document-plan.js +215 -0
- package/dist/document-authoring/application/use-cases/apply-document-plan.js.map +1 -0
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.d.ts +2 -1
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.d.ts.map +1 -1
- package/dist/document-authoring/application/use-cases/build-documentation-catalog.js.map +1 -1
- package/dist/document-authoring/application/use-cases/compile-document-plan.d.ts +6 -0
- package/dist/document-authoring/application/use-cases/compile-document-plan.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/compile-document-plan.js +156 -0
- package/dist/document-authoring/application/use-cases/compile-document-plan.js.map +1 -0
- package/dist/document-authoring/application/use-cases/document-journal-reconciliation.d.ts +18 -0
- package/dist/document-authoring/application/use-cases/document-journal-reconciliation.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/document-journal-reconciliation.js +90 -0
- package/dist/document-authoring/application/use-cases/document-journal-reconciliation.js.map +1 -0
- package/dist/document-authoring/application/use-cases/document-transaction-continuation.d.ts +59 -0
- package/dist/document-authoring/application/use-cases/document-transaction-continuation.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/document-transaction-continuation.js +360 -0
- package/dist/document-authoring/application/use-cases/document-transaction-continuation.js.map +1 -0
- package/dist/document-authoring/application/use-cases/document-transaction-error.d.ts +5 -0
- package/dist/document-authoring/application/use-cases/document-transaction-error.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/document-transaction-error.js +9 -0
- package/dist/document-authoring/application/use-cases/document-transaction-error.js.map +1 -0
- package/dist/document-authoring/application/use-cases/document-transaction-execution.d.ts +9 -0
- package/dist/document-authoring/application/use-cases/document-transaction-execution.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/document-transaction-execution.js +40 -0
- package/dist/document-authoring/application/use-cases/document-transaction-execution.js.map +1 -0
- package/dist/document-authoring/application/use-cases/plan-documentation-document.d.ts +66 -0
- package/dist/document-authoring/application/use-cases/plan-documentation-document.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/plan-documentation-document.js +276 -0
- package/dist/document-authoring/application/use-cases/plan-documentation-document.js.map +1 -0
- package/dist/document-authoring/application/use-cases/recover-document-transaction.d.ts +10 -0
- package/dist/document-authoring/application/use-cases/recover-document-transaction.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/recover-document-transaction.js +233 -0
- package/dist/document-authoring/application/use-cases/recover-document-transaction.js.map +1 -0
- package/dist/document-authoring/application/use-cases/run-document-doctor.d.ts +18 -0
- package/dist/document-authoring/application/use-cases/run-document-doctor.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/run-document-doctor.js +171 -0
- package/dist/document-authoring/application/use-cases/run-document-doctor.js.map +1 -0
- package/dist/document-authoring/application/use-cases/run-document-new.d.ts +30 -0
- package/dist/document-authoring/application/use-cases/run-document-new.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/run-document-new.js +221 -0
- package/dist/document-authoring/application/use-cases/run-document-new.js.map +1 -0
- package/dist/document-authoring/application/use-cases/run-document-recover.d.ts +21 -0
- package/dist/document-authoring/application/use-cases/run-document-recover.d.ts.map +1 -0
- package/dist/document-authoring/application/use-cases/run-document-recover.js +126 -0
- package/dist/document-authoring/application/use-cases/run-document-recover.js.map +1 -0
- package/dist/document-authoring/composition/document-command-cli.d.ts +7 -0
- package/dist/document-authoring/composition/document-command-cli.d.ts.map +1 -0
- package/dist/document-authoring/composition/document-command-cli.js +32 -0
- package/dist/document-authoring/composition/document-command-cli.js.map +1 -0
- package/dist/document-authoring/composition/inspect-document-transaction.d.ts +8 -0
- package/dist/document-authoring/composition/inspect-document-transaction.d.ts.map +1 -0
- package/dist/document-authoring/composition/inspect-document-transaction.js +177 -0
- package/dist/document-authoring/composition/inspect-document-transaction.js.map +1 -0
- package/dist/document-authoring/composition/node-document-authority-recompiler.d.ts +11 -0
- package/dist/document-authoring/composition/node-document-authority-recompiler.d.ts.map +1 -0
- package/dist/document-authoring/composition/node-document-authority-recompiler.js +62 -0
- package/dist/document-authoring/composition/node-document-authority-recompiler.js.map +1 -0
- package/dist/document-authoring/composition/node-document-commands.d.ts +10 -0
- package/dist/document-authoring/composition/node-document-commands.d.ts.map +1 -0
- package/dist/document-authoring/composition/node-document-commands.js +68 -0
- package/dist/document-authoring/composition/node-document-commands.js.map +1 -0
- package/dist/document-authoring/composition/node-document-planning.d.ts +7 -0
- package/dist/document-authoring/composition/node-document-planning.d.ts.map +1 -0
- package/dist/document-authoring/composition/node-document-planning.js +77 -0
- package/dist/document-authoring/composition/node-document-planning.js.map +1 -0
- package/dist/document-authoring/composition/node-document-writing-private.d.ts +15 -0
- package/dist/document-authoring/composition/node-document-writing-private.d.ts.map +1 -0
- package/dist/document-authoring/composition/node-document-writing-private.js +52 -0
- package/dist/document-authoring/composition/node-document-writing-private.js.map +1 -0
- package/dist/document-authoring/composition/node-document-writing.d.ts +8 -0
- package/dist/document-authoring/composition/node-document-writing.d.ts.map +1 -0
- package/dist/document-authoring/composition/node-document-writing.js +10 -0
- package/dist/document-authoring/composition/node-document-writing.js.map +1 -0
- package/dist/document-authoring/document-planning-error.d.ts +6 -0
- package/dist/document-authoring/document-planning-error.d.ts.map +1 -0
- package/dist/document-authoring/document-planning-error.js +9 -0
- package/dist/document-authoring/document-planning-error.js.map +1 -0
- package/dist/document-authoring/index.d.ts +22 -0
- package/dist/document-authoring/index.d.ts.map +1 -1
- package/dist/document-authoring/index.js +19 -0
- package/dist/document-authoring/index.js.map +1 -1
- package/dist/document-command.d.ts +9 -0
- package/dist/document-command.d.ts.map +1 -1
- package/dist/document-command.js +64 -3
- package/dist/document-command.js.map +1 -1
- package/dist/foundation-state-contract.d.ts +1 -0
- package/dist/foundation-state-contract.d.ts.map +1 -1
- package/dist/foundation-state-contract.js +1 -0
- package/dist/foundation-state-contract.js.map +1 -1
- package/dist/local-mode/inspection.d.ts.map +1 -1
- package/dist/local-mode/inspection.js +51 -3
- package/dist/local-mode/inspection.js.map +1 -1
- package/dist/package-self-check.d.ts +2 -1
- package/dist/package-self-check.d.ts.map +1 -1
- package/dist/package-self-check.js +30 -7
- package/dist/package-self-check.js.map +1 -1
- package/dist/report-renderer.d.ts.map +1 -1
- package/dist/report-renderer.js +1 -0
- package/dist/report-renderer.js.map +1 -1
- package/dist/repository-mutation/adapters/node/node-absent-file-publication-private.d.ts +19 -0
- package/dist/repository-mutation/adapters/node/node-absent-file-publication-private.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-absent-file-publication-private.js +74 -0
- package/dist/repository-mutation/adapters/node/node-absent-file-publication-private.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-absent-file-publication.d.ts +2 -0
- package/dist/repository-mutation/adapters/node/node-absent-file-publication.d.ts.map +1 -1
- package/dist/repository-mutation/adapters/node/node-absent-file-publication.js +56 -154
- package/dist/repository-mutation/adapters/node/node-absent-file-publication.js.map +1 -1
- package/dist/repository-mutation/adapters/node/node-cleanup-owned-temporary.d.ts +26 -0
- package/dist/repository-mutation/adapters/node/node-cleanup-owned-temporary.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-cleanup-owned-temporary.js +151 -0
- package/dist/repository-mutation/adapters/node/node-cleanup-owned-temporary.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-directory-durability.d.ts +6 -0
- package/dist/repository-mutation/adapters/node/node-directory-durability.d.ts.map +1 -1
- package/dist/repository-mutation/adapters/node/node-directory-durability.js +15 -0
- package/dist/repository-mutation/adapters/node/node-directory-durability.js.map +1 -1
- package/dist/repository-mutation/adapters/node/node-prepare-exact-sibling-temporary.d.ts +14 -0
- package/dist/repository-mutation/adapters/node/node-prepare-exact-sibling-temporary.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-prepare-exact-sibling-temporary.js +26 -0
- package/dist/repository-mutation/adapters/node/node-prepare-exact-sibling-temporary.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-publish-prepared-absent-file.d.ts +28 -0
- package/dist/repository-mutation/adapters/node/node-publish-prepared-absent-file.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-publish-prepared-absent-file.js +47 -0
- package/dist/repository-mutation/adapters/node/node-publish-prepared-absent-file.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-terminal-evidence-directory.d.ts +22 -0
- package/dist/repository-mutation/adapters/node/node-terminal-evidence-directory.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-terminal-evidence-directory.js +59 -0
- package/dist/repository-mutation/adapters/node/node-terminal-evidence-directory.js.map +1 -0
- package/dist/repository-mutation/application/ports/owned-temporary-cleanup-transition.d.ts +7 -0
- package/dist/repository-mutation/application/ports/owned-temporary-cleanup-transition.d.ts.map +1 -0
- package/dist/repository-mutation/application/ports/owned-temporary-cleanup-transition.js +2 -0
- package/dist/repository-mutation/application/ports/owned-temporary-cleanup-transition.js.map +1 -0
- package/dist/scaffolding/adapters/node/filesystem-authority-workspace.d.ts +1 -1
- package/dist/scaffolding/adapters/node/filesystem-authority-workspace.d.ts.map +1 -1
- package/dist/scaffolding/adapters/node/filesystem-authority-workspace.js +74 -53
- package/dist/scaffolding/adapters/node/filesystem-authority-workspace.js.map +1 -1
- package/dist/scaffolding/adapters/node/filesystem-finalization.d.ts +9 -1
- package/dist/scaffolding/adapters/node/filesystem-finalization.d.ts.map +1 -1
- package/dist/scaffolding/adapters/node/filesystem-finalization.js +34 -6
- package/dist/scaffolding/adapters/node/filesystem-finalization.js.map +1 -1
- package/dist/scaffolding/adapters/node/filesystem-journal-state.d.ts.map +1 -1
- package/dist/scaffolding/adapters/node/filesystem-journal-state.js +2 -1
- package/dist/scaffolding/adapters/node/filesystem-journal-state.js.map +1 -1
- package/dist/scaffolding/adapters/node/filesystem-journal.d.ts +13 -5
- package/dist/scaffolding/adapters/node/filesystem-journal.d.ts.map +1 -1
- package/dist/scaffolding/adapters/node/filesystem-journal.js +112 -74
- package/dist/scaffolding/adapters/node/filesystem-journal.js.map +1 -1
- package/dist/scaffolding/adapters/node/filesystem-operation-state.d.ts +10 -1
- package/dist/scaffolding/adapters/node/filesystem-operation-state.d.ts.map +1 -1
- package/dist/scaffolding/adapters/node/filesystem-operation-state.js +40 -2
- package/dist/scaffolding/adapters/node/filesystem-operation-state.js.map +1 -1
- package/dist/scaffolding/adapters/node/node-scaffold-journal-evidence.d.ts +35 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-evidence.d.ts.map +1 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-evidence.js +137 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-evidence.js.map +1 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-gateway.d.ts +11 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-gateway.d.ts.map +1 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-gateway.js +95 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-gateway.js.map +1 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-reconciliation.d.ts +15 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-reconciliation.d.ts.map +1 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-reconciliation.js +29 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-reconciliation.js.map +1 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-store-faults.d.ts +46 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-store-faults.d.ts.map +1 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-store-faults.js +2 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-store-faults.js.map +1 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-store.d.ts +19 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-store.d.ts.map +1 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-store.js +288 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-store.js.map +1 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-transaction-evidence.d.ts +2 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-transaction-evidence.d.ts.map +1 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-transaction-evidence.js +34 -0
- package/dist/scaffolding/adapters/node/node-scaffold-journal-transaction-evidence.js.map +1 -0
- package/dist/schema-catalog.d.ts.map +1 -1
- package/dist/schema-catalog.js +4 -0
- package/dist/schema-catalog.js.map +1 -1
- package/dist/schema-ids.d.ts +1 -1
- package/dist/schema-ids.d.ts.map +1 -1
- package/dist/schema-ids.js +3 -0
- package/dist/schema-ids.js.map +1 -1
- package/dist/source-inventory/adapters/outbound/filesystem/filesystem-source-tree-reader.d.ts.map +1 -1
- package/dist/source-inventory/adapters/outbound/filesystem/filesystem-source-tree-reader.js +17 -10
- package/dist/source-inventory/adapters/outbound/filesystem/filesystem-source-tree-reader.js.map +1 -1
- package/dist/transaction-coordination/adapters/node/document-envelope-bindings.d.ts +22 -0
- package/dist/transaction-coordination/adapters/node/document-envelope-bindings.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/document-envelope-bindings.js +123 -0
- package/dist/transaction-coordination/adapters/node/document-envelope-bindings.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/document-temporary-identity.d.ts +2 -2
- package/dist/transaction-coordination/adapters/node/document-temporary-identity.d.ts.map +1 -1
- package/dist/transaction-coordination/adapters/node/document-temporary-identity.js +4 -4
- package/dist/transaction-coordination/adapters/node/document-temporary-identity.js.map +1 -1
- package/dist/transaction-coordination/adapters/node/foundation-transition-evidence.d.ts +4 -0
- package/dist/transaction-coordination/adapters/node/foundation-transition-evidence.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/foundation-transition-evidence.js +58 -0
- package/dist/transaction-coordination/adapters/node/foundation-transition-evidence.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-foundation-cleanup-transition.d.ts +17 -0
- package/dist/transaction-coordination/adapters/node/node-foundation-cleanup-transition.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-foundation-cleanup-transition.js +79 -0
- package/dist/transaction-coordination/adapters/node/node-foundation-cleanup-transition.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-foundation-operation-lock.d.ts +9 -1
- package/dist/transaction-coordination/adapters/node/node-foundation-operation-lock.d.ts.map +1 -1
- package/dist/transaction-coordination/adapters/node/node-foundation-operation-lock.js +34 -11
- package/dist/transaction-coordination/adapters/node/node-foundation-operation-lock.js.map +1 -1
- package/dist/transaction-coordination/adapters/node/node-foundation-state-directory.d.ts +7 -0
- package/dist/transaction-coordination/adapters/node/node-foundation-state-directory.d.ts.map +1 -1
- package/dist/transaction-coordination/adapters/node/node-foundation-state-directory.js +15 -0
- package/dist/transaction-coordination/adapters/node/node-foundation-state-directory.js.map +1 -1
- package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.d.ts +2 -2
- package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.d.ts.map +1 -1
- package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.js +123 -140
- package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.js.map +1 -1
- package/dist/transaction-coordination/application/foundation-transaction-coordinator.d.ts +5 -4
- package/dist/transaction-coordination/application/foundation-transaction-coordinator.d.ts.map +1 -1
- package/dist/transaction-coordination/application/foundation-transaction-coordinator.js +14 -1
- package/dist/transaction-coordination/application/foundation-transaction-coordinator.js.map +1 -1
- package/dist/transaction-coordination/application/foundation-transaction-error.d.ts +4 -3
- package/dist/transaction-coordination/application/foundation-transaction-error.d.ts.map +1 -1
- package/dist/transaction-coordination/application/foundation-transaction-error.js.map +1 -1
- package/dist/transaction-coordination/application/model/internal-transaction-status.d.ts +26 -0
- package/dist/transaction-coordination/application/model/internal-transaction-status.d.ts.map +1 -0
- package/dist/transaction-coordination/application/model/internal-transaction-status.js +2 -0
- package/dist/transaction-coordination/application/model/internal-transaction-status.js.map +1 -0
- package/dist/transaction-coordination/application/ports/foundation-transaction-slot.d.ts +2 -2
- package/dist/transaction-coordination/application/ports/foundation-transaction-slot.d.ts.map +1 -1
- package/dist/workspace-inventory/adapters/outbound/pnpm/pnpm-workspace-inventory-reader.d.ts.map +1 -1
- package/dist/workspace-inventory/adapters/outbound/pnpm/pnpm-workspace-inventory-reader.js +13 -9
- package/dist/workspace-inventory/adapters/outbound/pnpm/pnpm-workspace-inventory-reader.js.map +1 -1
- package/package.json +12 -3
- package/schemas/document-authoring-profile/v1.schema.json +31 -1
- package/schemas/document-command-envelope/v2.schema.json +205 -0
- package/schemas/foundation-check-report/v1.schema.json +1 -1
- package/schemas/foundation-command-error/v1.schema.json +24 -0
- package/schemas/foundation-transaction-envelope/v3.schema.json +169 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-authoring-profile-reader.js","sourceRoot":"","sources":["../../../../src/document-authoring/adapters/node/node-authoring-profile-reader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node-authoring-profile-reader.js","sourceRoot":"","sources":["../../../../src/document-authoring/adapters/node/node-authoring-profile-reader.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EACL,oCAAoC,EACpC,qCAAqC,EACtC,MAAM,gDAAgD,CAAC;AAExD,SAAS,gBAAgB,CAAC,UAA6B;IACrD,OAAO,UAAU,CAAC,IAAI,KAAK,eAAe;QACxC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,UAAU,EAAE,CAAC;QAClC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,OAAO,0BAA0B;IACrC,KAAK,CAAC,IAAI,CAAC,OAIV;QACC,IAAI,CAAC;YACH,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,qCAAqC,CAAC,OAAO,CAAC,CAAC;YACnF,OAAO,MAAM,CAAC,MAAM,CAAC;gBACnB,WAAW,EAAE,MAAM,CAAC,MAAM,CACxB,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAClD;gBACD,QAAQ;gBACR,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC;oBAC9B,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC;iBAC5C,CAAC;gBACF,kBAAkB,EAAE,OAAO,CAAC,OAAO,CAAC,kBAAkB;gBACtD,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;gBAChE,SAAS,EAAE,OAAO,CAAC,SAAS;aAC7B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,oCAAoC,EAAE,CAAC;gBAC1D,MAAM,IAAI,oBAAoB,CAC5B,gCAAgC,EAChC,0CAA0C,KAAK,CAAC,OAAO,EAAE,EACzD,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;YACJ,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DocumentIntent, DocumentPlan } from "../../application/model/document-planning.js";
|
|
2
|
+
import type { DocumentContractValidator } from "../../application/ports/document-contract-validator.js";
|
|
3
|
+
export declare class NodeDocumentContractValidator implements DocumentContractValidator {
|
|
4
|
+
validateIntent(input: unknown): Promise<DocumentIntent>;
|
|
5
|
+
validatePlan(input: unknown): Promise<DocumentPlan>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=node-document-contract-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-document-contract-validator.d.ts","sourceRoot":"","sources":["../../../../src/document-authoring/adapters/node/node-document-contract-validator.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACb,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wDAAwD,CAAC;AA6VxG,qBAAa,6BAA8B,YAAW,yBAAyB;IACvE,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CAkB5D;IAEK,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAmBxD;CACF"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { isProxy } from "node:util/types";
|
|
2
|
+
import { CapabilityInputError } from "../../../capability-runtime.js";
|
|
3
|
+
import { assertSchema } from "../../../schema-catalog.js";
|
|
4
|
+
import { DocumentPlanningError } from "../../document-planning-error.js";
|
|
5
|
+
import { assertDocumentPlanDigests } from "../../application/policies/document-contract-digests.js";
|
|
6
|
+
function invalidContract(kind, error) {
|
|
7
|
+
throw new DocumentPlanningError(kind === "Intent"
|
|
8
|
+
? "DOCUMENT_PLANNING_INPUT_INVALID"
|
|
9
|
+
: "DOCUMENT_PLANNING_OUTPUT_INVALID", `Document ${kind} does not match its v1 contract: ${error.message.slice(0, 1000)}`, { cause: error });
|
|
10
|
+
}
|
|
11
|
+
const MAXIMUM_INTENT_DEPTH = 8;
|
|
12
|
+
const MAXIMUM_INTENT_CONTAINER_ITEMS = 128;
|
|
13
|
+
const MAXIMUM_DOCUMENT_OUTPUT_BYTES = 1024 * 1024;
|
|
14
|
+
const MAXIMUM_PLAN_DEPTH = 12;
|
|
15
|
+
const MAXIMUM_PLAN_JSON_BYTES = 4 * MAXIMUM_DOCUMENT_OUTPUT_BYTES;
|
|
16
|
+
const MAXIMUM_PLAN_VALUES = MAXIMUM_DOCUMENT_OUTPUT_BYTES;
|
|
17
|
+
const OUTPUT_INTENT_KEYS = new Set([
|
|
18
|
+
"additionalMetadata",
|
|
19
|
+
"id",
|
|
20
|
+
"owner",
|
|
21
|
+
"related",
|
|
22
|
+
"summary",
|
|
23
|
+
"title",
|
|
24
|
+
"type"
|
|
25
|
+
]);
|
|
26
|
+
const INTENT_ROOT_KEYS = new Set([
|
|
27
|
+
...OUTPUT_INTENT_KEYS,
|
|
28
|
+
"destination",
|
|
29
|
+
"schemaVersion",
|
|
30
|
+
"slug"
|
|
31
|
+
]);
|
|
32
|
+
const STRING_INTENT_ROOT_KEYS = new Set([
|
|
33
|
+
"destination",
|
|
34
|
+
"id",
|
|
35
|
+
"owner",
|
|
36
|
+
"slug",
|
|
37
|
+
"summary",
|
|
38
|
+
"title",
|
|
39
|
+
"type"
|
|
40
|
+
]);
|
|
41
|
+
function addOutputLowerBound(budget, bytes) {
|
|
42
|
+
budget.outputLowerBoundBytes += bytes;
|
|
43
|
+
if (budget.outputLowerBoundBytes > MAXIMUM_DOCUMENT_OUTPUT_BYTES) {
|
|
44
|
+
throw new TypeError("Document Intent logically expands beyond the public document output byte limit.");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function isJsonScalar(value, contributesToOutput, budget) {
|
|
48
|
+
if (value === null || typeof value === "boolean" || typeof value === "string") {
|
|
49
|
+
if (contributesToOutput) {
|
|
50
|
+
addOutputLowerBound(budget, 1 + (typeof value === "string"
|
|
51
|
+
? Buffer.byteLength(value.normalize("NFC"), "utf8")
|
|
52
|
+
: 1));
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
if (typeof value === "number") {
|
|
57
|
+
if (!Number.isSafeInteger(value) || Object.is(value, -0)) {
|
|
58
|
+
throw new TypeError("Document Intent numbers must be safe integers other than negative zero.");
|
|
59
|
+
}
|
|
60
|
+
if (contributesToOutput) {
|
|
61
|
+
addOutputLowerBound(budget, 1);
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
function inertContainerKeys(value) {
|
|
68
|
+
const keys = Reflect.ownKeys(value);
|
|
69
|
+
if (keys.some((key) => typeof key !== "string")) {
|
|
70
|
+
throw new TypeError("Document Intent must not contain symbol keys.");
|
|
71
|
+
}
|
|
72
|
+
const itemCount = Array.isArray(value) ? keys.length - 1 : keys.length;
|
|
73
|
+
if (itemCount > MAXIMUM_INTENT_CONTAINER_ITEMS) {
|
|
74
|
+
throw new TypeError("Document Intent container exceeds the item budget.");
|
|
75
|
+
}
|
|
76
|
+
if (Array.isArray(value) && keys.length !== value.length + 1) {
|
|
77
|
+
throw new TypeError("Document Intent arrays must be dense and contain no extra properties.");
|
|
78
|
+
}
|
|
79
|
+
return keys;
|
|
80
|
+
}
|
|
81
|
+
function assertIntrinsicJsonContainer(value) {
|
|
82
|
+
const prototype = Object.getPrototypeOf(value);
|
|
83
|
+
if ((Array.isArray(value) && prototype !== Array.prototype) ||
|
|
84
|
+
(!Array.isArray(value) && prototype !== Object.prototype && prototype !== null)) {
|
|
85
|
+
throw new TypeError("Document Intent containers must use intrinsic JSON prototypes.");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function assertIntentRootField(key, value) {
|
|
89
|
+
if (!INTENT_ROOT_KEYS.has(key)) {
|
|
90
|
+
throw new TypeError("Document Intent contains an unknown root field.");
|
|
91
|
+
}
|
|
92
|
+
if (STRING_INTENT_ROOT_KEYS.has(key) && typeof value !== "string") {
|
|
93
|
+
throw new TypeError(`Document Intent root field ${key} must be a string.`);
|
|
94
|
+
}
|
|
95
|
+
if (key === "schemaVersion" && value !== 1) {
|
|
96
|
+
throw new TypeError("Document Intent schemaVersion must equal 1.");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function assertInertJson(input) {
|
|
100
|
+
const pending = [
|
|
101
|
+
{ action: "enter", contributesToOutput: false, depth: 0, value: input }
|
|
102
|
+
];
|
|
103
|
+
const ancestors = new WeakSet();
|
|
104
|
+
const budget = { outputLowerBoundBytes: 0 };
|
|
105
|
+
while (pending.length > 0) {
|
|
106
|
+
const current = pending.pop();
|
|
107
|
+
if (current.action === "leave") {
|
|
108
|
+
ancestors.delete(current.value);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (isJsonScalar(current.value, current.contributesToOutput, budget)) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (current.value === null || typeof current.value !== "object") {
|
|
115
|
+
throw new TypeError("Document Intent must use the closed JSON data model.");
|
|
116
|
+
}
|
|
117
|
+
if (isProxy(current.value)) {
|
|
118
|
+
throw new TypeError("Document Intent must not contain Proxy objects.");
|
|
119
|
+
}
|
|
120
|
+
if (current.depth > MAXIMUM_INTENT_DEPTH || ancestors.has(current.value)) {
|
|
121
|
+
throw new TypeError("Document Intent must be a bounded acyclic JSON tree.");
|
|
122
|
+
}
|
|
123
|
+
assertIntrinsicJsonContainer(current.value);
|
|
124
|
+
if (current.contributesToOutput) {
|
|
125
|
+
addOutputLowerBound(budget, 1);
|
|
126
|
+
}
|
|
127
|
+
ancestors.add(current.value);
|
|
128
|
+
pending.push({ action: "leave", value: current.value });
|
|
129
|
+
for (const key of inertContainerKeys(current.value)) {
|
|
130
|
+
if (key === "length" && Array.isArray(current.value)) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const descriptor = Object.getOwnPropertyDescriptor(current.value, key);
|
|
134
|
+
if (descriptor === undefined ||
|
|
135
|
+
!("value" in descriptor) ||
|
|
136
|
+
descriptor.enumerable !== true) {
|
|
137
|
+
throw new TypeError("Document Intent must contain only enumerable own data properties.");
|
|
138
|
+
}
|
|
139
|
+
if (current.depth === 0) {
|
|
140
|
+
assertIntentRootField(key, descriptor.value);
|
|
141
|
+
}
|
|
142
|
+
pending.push({
|
|
143
|
+
action: "enter",
|
|
144
|
+
contributesToOutput: current.depth === 0
|
|
145
|
+
? OUTPUT_INTENT_KEYS.has(key)
|
|
146
|
+
: current.contributesToOutput,
|
|
147
|
+
depth: current.depth + 1,
|
|
148
|
+
value: descriptor.value
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function planContractTypeError(message) {
|
|
154
|
+
return new TypeError(`Document Plan ${message}`);
|
|
155
|
+
}
|
|
156
|
+
function defineSnapshotValue(target, key, value) {
|
|
157
|
+
Object.defineProperty(target, key, {
|
|
158
|
+
configurable: true,
|
|
159
|
+
enumerable: true,
|
|
160
|
+
value,
|
|
161
|
+
writable: true
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function inspectPlanContainer(source) {
|
|
165
|
+
if (isProxy(source)) {
|
|
166
|
+
throw planContractTypeError("must not contain Proxy objects.");
|
|
167
|
+
}
|
|
168
|
+
const isArray = Array.isArray(source);
|
|
169
|
+
const prototype = Object.getPrototypeOf(source);
|
|
170
|
+
if ((isArray && prototype !== Array.prototype) ||
|
|
171
|
+
(!isArray && prototype !== Object.prototype && prototype !== null)) {
|
|
172
|
+
throw planContractTypeError("containers must use intrinsic JSON prototypes.");
|
|
173
|
+
}
|
|
174
|
+
const keys = Reflect.ownKeys(source);
|
|
175
|
+
if (keys.some((key) => typeof key !== "string")) {
|
|
176
|
+
throw planContractTypeError("must not contain symbol keys.");
|
|
177
|
+
}
|
|
178
|
+
if (isArray && keys.length !== source.length + 1) {
|
|
179
|
+
throw planContractTypeError("arrays must be dense and contain no extra properties.");
|
|
180
|
+
}
|
|
181
|
+
if (isArray &&
|
|
182
|
+
keys.some((key) => key !== "length" &&
|
|
183
|
+
(!/^(?:0|[1-9]\d*)$/u.test(String(key)) ||
|
|
184
|
+
Number(key) >= source.length ||
|
|
185
|
+
String(Number(key)) !== key))) {
|
|
186
|
+
throw planContractTypeError("arrays must be dense and contain no extra properties.");
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
isArray,
|
|
190
|
+
keys: keys
|
|
191
|
+
.filter((key) => !(isArray && key === "length"))
|
|
192
|
+
.toSorted()
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function planDataValue(source, key) {
|
|
196
|
+
const descriptor = Object.getOwnPropertyDescriptor(source, key);
|
|
197
|
+
if (descriptor === undefined ||
|
|
198
|
+
!("value" in descriptor) ||
|
|
199
|
+
descriptor.enumerable !== true) {
|
|
200
|
+
throw planContractTypeError("must contain only enumerable own data properties.");
|
|
201
|
+
}
|
|
202
|
+
return descriptor.value;
|
|
203
|
+
}
|
|
204
|
+
function accountPlanValue(budget, key, value) {
|
|
205
|
+
budget.values += 1;
|
|
206
|
+
budget.bytes += Buffer.byteLength(key, "utf8") + 1;
|
|
207
|
+
if (typeof value === "string") {
|
|
208
|
+
budget.bytes += Buffer.byteLength(value, "utf8") + 1;
|
|
209
|
+
}
|
|
210
|
+
else if (value === null || ["boolean", "number"].includes(typeof value)) {
|
|
211
|
+
budget.bytes += 1;
|
|
212
|
+
}
|
|
213
|
+
if (budget.values > MAXIMUM_PLAN_VALUES || budget.bytes > MAXIMUM_PLAN_JSON_BYTES) {
|
|
214
|
+
throw planContractTypeError("exceeds the bounded v1 contract input budget.");
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function assertPlanScalar(value) {
|
|
218
|
+
if (value === null || typeof value === "boolean" || typeof value === "string") {
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
if (typeof value !== "number") {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
if (!Number.isSafeInteger(value) || Object.is(value, -0)) {
|
|
225
|
+
throw planContractTypeError("numbers must be safe integers other than negative zero.");
|
|
226
|
+
}
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
function snapshotInertPlan(input) {
|
|
230
|
+
if (input === null || typeof input !== "object") {
|
|
231
|
+
throw planContractTypeError("must be a JSON object.");
|
|
232
|
+
}
|
|
233
|
+
if (isProxy(input) || Array.isArray(input)) {
|
|
234
|
+
throw planContractTypeError("must be an intrinsic, non-Proxy JSON object.");
|
|
235
|
+
}
|
|
236
|
+
const root = {};
|
|
237
|
+
const pending = [{ depth: 0, source: input, target: root }];
|
|
238
|
+
const observed = new WeakSet();
|
|
239
|
+
const budget = { bytes: 0, values: 0 };
|
|
240
|
+
while (pending.length > 0) {
|
|
241
|
+
const current = pending.pop();
|
|
242
|
+
if (observed.has(current.source)) {
|
|
243
|
+
throw planContractTypeError("must be an acyclic JSON tree without shared containers.");
|
|
244
|
+
}
|
|
245
|
+
observed.add(current.source);
|
|
246
|
+
if (current.depth > MAXIMUM_PLAN_DEPTH) {
|
|
247
|
+
throw planContractTypeError("exceeds the supported JSON depth.");
|
|
248
|
+
}
|
|
249
|
+
const { keys } = inspectPlanContainer(current.source);
|
|
250
|
+
for (const key of keys) {
|
|
251
|
+
const value = planDataValue(current.source, key);
|
|
252
|
+
accountPlanValue(budget, key, value);
|
|
253
|
+
if (assertPlanScalar(value)) {
|
|
254
|
+
defineSnapshotValue(current.target, key, value);
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
if (value === null || typeof value !== "object") {
|
|
258
|
+
throw planContractTypeError("must use the closed JSON data model.");
|
|
259
|
+
}
|
|
260
|
+
if (isProxy(value)) {
|
|
261
|
+
throw planContractTypeError("must not contain Proxy objects.");
|
|
262
|
+
}
|
|
263
|
+
const child = Array.isArray(value) ? [] : {};
|
|
264
|
+
defineSnapshotValue(current.target, key, child);
|
|
265
|
+
pending.push({ depth: current.depth + 1, source: value, target: child });
|
|
266
|
+
}
|
|
267
|
+
Object.freeze(current.target);
|
|
268
|
+
}
|
|
269
|
+
return root;
|
|
270
|
+
}
|
|
271
|
+
export class NodeDocumentContractValidator {
|
|
272
|
+
async validateIntent(input) {
|
|
273
|
+
try {
|
|
274
|
+
assertInertJson(input);
|
|
275
|
+
await assertSchema("document-intent/v1", input, "document-intent");
|
|
276
|
+
return input;
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
if (error instanceof CapabilityInputError) {
|
|
280
|
+
invalidContract("Intent", error);
|
|
281
|
+
}
|
|
282
|
+
if (error instanceof TypeError) {
|
|
283
|
+
throw new DocumentPlanningError("DOCUMENT_PLANNING_INPUT_INVALID", `Document Intent must use inert canonical JSON data: ${error.message}`, { cause: error });
|
|
284
|
+
}
|
|
285
|
+
throw error;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
async validatePlan(input) {
|
|
289
|
+
try {
|
|
290
|
+
const snapshot = snapshotInertPlan(input);
|
|
291
|
+
await assertSchema("document-plan/v1", snapshot, "document-plan");
|
|
292
|
+
assertDocumentPlanDigests(snapshot);
|
|
293
|
+
return snapshot;
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
if (error instanceof CapabilityInputError) {
|
|
297
|
+
invalidContract("Plan", error);
|
|
298
|
+
}
|
|
299
|
+
if (error instanceof Error) {
|
|
300
|
+
throw new DocumentPlanningError("DOCUMENT_PLANNING_OUTPUT_INVALID", `Document Plan must use inert canonical JSON data and valid content bindings: ${error.message.slice(0, 1000)}`, { cause: error });
|
|
301
|
+
}
|
|
302
|
+
throw error;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=node-document-contract-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-document-contract-validator.js","sourceRoot":"","sources":["../../../../src/document-authoring/adapters/node/node-document-contract-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yDAAyD,CAAC;AAEpG,SAAS,eAAe,CAAC,IAAuB,EAAE,KAA2B;IAC3E,MAAM,IAAI,qBAAqB,CAC7B,IAAI,KAAK,QAAQ;QACf,CAAC,CAAC,iCAAiC;QACnC,CAAC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CAAC;YACjC,CAAC;YACD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,MAAM,IAAI,qBAAqB,CAC7B,kCAAkC,EAClC,gFAAgF,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAC9G,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;YACJ,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { lstat, realpath } from "node:fs/promises";
|
|
2
|
+
import type { DocumentEnvironmentInspection, DocumentEnvironmentInspector } from "../../application/ports/document-environment-inspector.js";
|
|
3
|
+
interface Dependencies {
|
|
4
|
+
readonly buildIdentity: () => Promise<string>;
|
|
5
|
+
readonly lstat: typeof lstat;
|
|
6
|
+
readonly platform: NodeJS.Platform;
|
|
7
|
+
readonly realpath: typeof realpath;
|
|
8
|
+
readonly version: () => Promise<string>;
|
|
9
|
+
}
|
|
10
|
+
type EnvironmentIdentityProviders = Pick<Dependencies, "buildIdentity" | "version">;
|
|
11
|
+
export declare class NodeDocumentEnvironmentInspector implements DocumentEnvironmentInspector {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(identity: EnvironmentIdentityProviders, filesystem?: Partial<Omit<Dependencies, "buildIdentity" | "version">>);
|
|
14
|
+
inspect(consumerRoot: string, signal?: AbortSignal): Promise<DocumentEnvironmentInspection>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=node-document-environment-inspector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-document-environment-inspector.d.ts","sourceRoot":"","sources":["../../../../src/document-authoring/adapters/node/node-document-environment-inspector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,EAC7B,MAAM,2DAA2D,CAAC;AAEnE,UAAU,YAAY;IACpB,QAAQ,CAAC,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,OAAO,QAAQ,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CACzC;AAED,KAAK,4BAA4B,GAAG,IAAI,CAAC,YAAY,EAAE,eAAe,GAAG,SAAS,CAAC,CAAC;AAQpF,qBAAa,gCAAiC,YAAW,4BAA4B;;IAGnF,YACE,QAAQ,EAAE,4BAA4B,EACtC,UAAU,GAAE,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,GAAG,SAAS,CAAC,CAAM,EAO1E;IAEK,OAAO,CACX,YAAY,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,6BAA6B,CAAC,CAwCxC;CACF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { lstat, realpath } from "node:fs/promises";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
const nodeFilesystemDependencies = {
|
|
4
|
+
lstat,
|
|
5
|
+
platform: process.platform,
|
|
6
|
+
realpath
|
|
7
|
+
};
|
|
8
|
+
export class NodeDocumentEnvironmentInspector {
|
|
9
|
+
#dependencies;
|
|
10
|
+
constructor(identity, filesystem = {}) {
|
|
11
|
+
this.#dependencies = {
|
|
12
|
+
...nodeFilesystemDependencies,
|
|
13
|
+
...filesystem,
|
|
14
|
+
...identity
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
async inspect(consumerRoot, signal) {
|
|
18
|
+
signal?.throwIfAborted();
|
|
19
|
+
const requestedRoot = resolve(consumerRoot);
|
|
20
|
+
const [metadata, canonicalRoot, installedVersion, installedBuildIdentity] = await Promise.all([
|
|
21
|
+
this.#dependencies.lstat(requestedRoot),
|
|
22
|
+
this.#dependencies.realpath(requestedRoot),
|
|
23
|
+
this.#dependencies.version(),
|
|
24
|
+
this.#dependencies.buildIdentity()
|
|
25
|
+
]);
|
|
26
|
+
signal?.throwIfAborted();
|
|
27
|
+
if (metadata.isSymbolicLink() ||
|
|
28
|
+
!metadata.isDirectory()) {
|
|
29
|
+
throw new Error("Document doctor consumer root must be a canonical real directory.");
|
|
30
|
+
}
|
|
31
|
+
const canonicalMetadata = await this.#dependencies.lstat(canonicalRoot);
|
|
32
|
+
if (canonicalMetadata.isSymbolicLink() ||
|
|
33
|
+
!canonicalMetadata.isDirectory()) {
|
|
34
|
+
throw new Error("Document doctor consumer root must resolve to a real directory.");
|
|
35
|
+
}
|
|
36
|
+
signal?.throwIfAborted();
|
|
37
|
+
return Object.freeze({
|
|
38
|
+
installedFoundationVersion: installedVersion,
|
|
39
|
+
installedFoundationBuildIdentity: installedBuildIdentity,
|
|
40
|
+
filesystem: Object.freeze({
|
|
41
|
+
basis: "platform-contract",
|
|
42
|
+
strictDirectoryDurability: this.#dependencies.platform === "win32"
|
|
43
|
+
? "platform-unsupported"
|
|
44
|
+
: "platform-supported"
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=node-document-environment-inspector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-document-environment-inspector.js","sourceRoot":"","sources":["../../../../src/document-authoring/adapters/node/node-document-environment-inspector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiBpC,MAAM,0BAA0B,GAAoD;IAClF,KAAK;IACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;IAC1B,QAAQ;CACT,CAA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M,CAAC,MAAM,CAAC;gBACxB,KAAK,EAAE,mBAA4B;gBACnC,yBAAyB,EACvB,IAAI,CAAC,aAAa,CAAC,QAAQ,KAAK,OAAO;oBACrC,CAAC,CAAC,sBAA+B;oBACjC,CAAC,CAAC,oBAA6B;aACpC,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DocumentOwnedTemporary } from "../../application/model/document-transaction.js";
|
|
2
|
+
import type { DocumentPlan } from "../../application/model/document-planning.js";
|
|
3
|
+
import type { DocumentDerivedTemporaryState, DocumentDestinationState, DocumentFileState, DocumentTemporaryState } from "../../application/ports/document-file-state.js";
|
|
4
|
+
export declare class NodeDocumentFileState implements DocumentFileState {
|
|
5
|
+
classifyDerivedTemporary(request: {
|
|
6
|
+
readonly consumerRoot: string;
|
|
7
|
+
readonly plan: DocumentPlan;
|
|
8
|
+
readonly signal?: AbortSignal;
|
|
9
|
+
}): Promise<DocumentDerivedTemporaryState>;
|
|
10
|
+
classifyDestination(request: {
|
|
11
|
+
readonly consumerRoot: string;
|
|
12
|
+
readonly plan: DocumentPlan;
|
|
13
|
+
readonly signal?: AbortSignal;
|
|
14
|
+
}): Promise<DocumentDestinationState>;
|
|
15
|
+
classifyTemporary(request: {
|
|
16
|
+
readonly consumerRoot: string;
|
|
17
|
+
readonly signal?: AbortSignal;
|
|
18
|
+
readonly temporary: DocumentOwnedTemporary;
|
|
19
|
+
}): Promise<DocumentTemporaryState>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=node-document-file-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-document-file-state.d.ts","sourceRoot":"","sources":["../../../../src/document-authoring/adapters/node/node-document-file-state.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AAC9F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AACjF,OAAO,KAAK,EACV,6BAA6B,EAC7B,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,gDAAgD,CAAC;AA2ExD,qBAAa,qBAAsB,YAAW,iBAAiB;IACvD,wBAAwB,CAAC,OAAO,EAAE;QACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;QAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;KAC/B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAyCzC;IAEK,mBAAmB,CAAC,OAAO,EAAE;QACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;QAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;KAC/B,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAoCpC;IAEK,iBAAiB,CAAC,OAAO,EAAE;QAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;QAC9B,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;KAC5C,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAuClC;CACF"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readBoundedRegularFile } from "../../../repository-mutation/adapters/node/node-bounded-regular-file.js";
|
|
3
|
+
import { assertNonzeroDocumentPhysicalIdentity } from "../../application/model/document-physical-identity.js";
|
|
4
|
+
import { isDocumentRepositoryPath } from "../../application/policies/document-repository-path.js";
|
|
5
|
+
import { documentTemporaryPath } from "../../application/policies/document-temporary-path.js";
|
|
6
|
+
import { recaptureDocumentPublicationPaths, sameDocumentPhysicalIdentity } from "./recapture-document-publication-paths.js";
|
|
7
|
+
const MAXIMUM_DOCUMENT_BYTES = 1_048_576;
|
|
8
|
+
function digest(bytes) {
|
|
9
|
+
return `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
|
|
10
|
+
}
|
|
11
|
+
function identity(temporary) {
|
|
12
|
+
const value = temporary.identity;
|
|
13
|
+
try {
|
|
14
|
+
assertNonzeroDocumentPhysicalIdentity(value);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const result = {
|
|
20
|
+
dev: BigInt(value.dev),
|
|
21
|
+
ino: BigInt(value.ino),
|
|
22
|
+
birthtimeNs: BigInt(value.birthtimeNs)
|
|
23
|
+
};
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
function wireIdentity(identityValue) {
|
|
27
|
+
const result = {
|
|
28
|
+
adapter: "node-filesystem",
|
|
29
|
+
version: 1,
|
|
30
|
+
dev: identityValue.dev.toString(10),
|
|
31
|
+
ino: identityValue.ino.toString(10),
|
|
32
|
+
birthtimeNs: identityValue.birthtimeNs.toString(10)
|
|
33
|
+
};
|
|
34
|
+
assertNonzeroDocumentPhysicalIdentity(result);
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
function planPostimage(plan) {
|
|
38
|
+
return {
|
|
39
|
+
bytes: Buffer.from(plan.output.contentBase64, "base64"),
|
|
40
|
+
digest: plan.output.digest,
|
|
41
|
+
mode: 0o644,
|
|
42
|
+
size: plan.output.size
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function conflict(error) {
|
|
46
|
+
return {
|
|
47
|
+
state: "conflict",
|
|
48
|
+
reason: typeof error === "string"
|
|
49
|
+
? error
|
|
50
|
+
: error instanceof Error
|
|
51
|
+
? error.message
|
|
52
|
+
: "Filesystem state is unverifiable."
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function unverifiable(error) {
|
|
56
|
+
return {
|
|
57
|
+
state: "unverifiable",
|
|
58
|
+
reason: typeof error === "string"
|
|
59
|
+
? error
|
|
60
|
+
: error instanceof Error
|
|
61
|
+
? error.message
|
|
62
|
+
: "Filesystem state is unverifiable."
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export class NodeDocumentFileState {
|
|
66
|
+
async classifyDerivedTemporary(request) {
|
|
67
|
+
request.signal?.throwIfAborted();
|
|
68
|
+
const path = documentTemporaryPath(request.plan.destination, request.plan.planDigest);
|
|
69
|
+
try {
|
|
70
|
+
const paths = await recaptureDocumentPublicationPaths({
|
|
71
|
+
consumerRoot: request.consumerRoot,
|
|
72
|
+
destination: path
|
|
73
|
+
});
|
|
74
|
+
request.signal?.throwIfAborted();
|
|
75
|
+
let observed;
|
|
76
|
+
try {
|
|
77
|
+
observed = await readBoundedRegularFile(paths.destinationPath, MAXIMUM_DOCUMENT_BYTES);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if (error instanceof Error && "code" in error &&
|
|
81
|
+
error.code === "ENOENT") {
|
|
82
|
+
return { state: "absent" };
|
|
83
|
+
}
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
request.signal?.throwIfAborted();
|
|
87
|
+
if (observed.outcome !== "read") {
|
|
88
|
+
return unverifiable("Derived document temporary is not a stable regular file.");
|
|
89
|
+
}
|
|
90
|
+
const identityValue = wireIdentity(observed.identity);
|
|
91
|
+
return {
|
|
92
|
+
state: "present",
|
|
93
|
+
path,
|
|
94
|
+
identity: identityValue
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
if (request.signal?.aborted === true) {
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
return unverifiable(error);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async classifyDestination(request) {
|
|
105
|
+
try {
|
|
106
|
+
request.signal?.throwIfAborted();
|
|
107
|
+
const paths = await recaptureDocumentPublicationPaths({
|
|
108
|
+
consumerRoot: request.consumerRoot,
|
|
109
|
+
destination: request.plan.destination
|
|
110
|
+
});
|
|
111
|
+
request.signal?.throwIfAborted();
|
|
112
|
+
let observed;
|
|
113
|
+
try {
|
|
114
|
+
observed = await readBoundedRegularFile(paths.destinationPath, request.plan.output.size);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
if (error instanceof Error && "code" in error &&
|
|
118
|
+
error.code === "ENOENT") {
|
|
119
|
+
return { state: "absent" };
|
|
120
|
+
}
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
request.signal?.throwIfAborted();
|
|
124
|
+
const expected = planPostimage(request.plan);
|
|
125
|
+
if (observed.outcome !== "read" ||
|
|
126
|
+
observed.bytes.byteLength !== expected.size ||
|
|
127
|
+
digest(observed.bytes) !== expected.digest ||
|
|
128
|
+
(process.platform !== "win32" && (observed.mode & 0o777) !== expected.mode)) {
|
|
129
|
+
return conflict("Document destination is not the exact Plan output.");
|
|
130
|
+
}
|
|
131
|
+
return { state: "exact", identity: wireIdentity(observed.identity) };
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
if (request.signal?.aborted === true) {
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
return unverifiable(error);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async classifyTemporary(request) {
|
|
141
|
+
request.signal?.throwIfAborted();
|
|
142
|
+
const expected = identity(request.temporary);
|
|
143
|
+
if (expected === undefined) {
|
|
144
|
+
return unverifiable("Document temporary has invalid or zero physical identity.");
|
|
145
|
+
}
|
|
146
|
+
if (!isDocumentRepositoryPath(request.temporary.path)) {
|
|
147
|
+
return unverifiable("Document temporary path is not portable.");
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
const paths = await recaptureDocumentPublicationPaths({
|
|
151
|
+
consumerRoot: request.consumerRoot,
|
|
152
|
+
destination: request.temporary.path
|
|
153
|
+
});
|
|
154
|
+
let observed;
|
|
155
|
+
try {
|
|
156
|
+
request.signal?.throwIfAborted();
|
|
157
|
+
observed = await readBoundedRegularFile(paths.destinationPath, MAXIMUM_DOCUMENT_BYTES);
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
if (error instanceof Error && "code" in error &&
|
|
161
|
+
error.code === "ENOENT") {
|
|
162
|
+
return { state: "absent" };
|
|
163
|
+
}
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
request.signal?.throwIfAborted();
|
|
167
|
+
if (observed.outcome !== "read" ||
|
|
168
|
+
!sameDocumentPhysicalIdentity(observed.identity, expected) ||
|
|
169
|
+
digest(observed.bytes) !== request.temporary.digest ||
|
|
170
|
+
(process.platform !== "win32" && (observed.mode & 0o777) !== 0o644)) {
|
|
171
|
+
return conflict("Document temporary does not match its exact owned evidence.");
|
|
172
|
+
}
|
|
173
|
+
return { state: "owned-exact", temporary: request.temporary };
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
if (request.signal?.aborted === true) {
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
return unverifiable(error);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=node-document-file-state.js.map
|