@agent-teams/document-authoring 0.0.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/CHANGELOG.md +5 -0
- package/LICENSE +201 -0
- package/README.md +11 -0
- package/dist/adapters/canonical-markdown.d.ts +14 -0
- package/dist/adapters/canonical-markdown.d.ts.map +1 -0
- package/dist/adapters/canonical-markdown.js +354 -0
- package/dist/adapters/canonical-markdown.js.map +1 -0
- package/dist/adapters/inbound/cli/document-command-renderer.d.ts +6 -0
- package/dist/adapters/inbound/cli/document-command-renderer.d.ts.map +1 -0
- package/dist/adapters/inbound/cli/document-command-renderer.js +123 -0
- package/dist/adapters/inbound/cli/document-command-renderer.js.map +1 -0
- package/dist/adapters/node/load-validated-document-authoring-profile-v2.d.ts +52 -0
- package/dist/adapters/node/load-validated-document-authoring-profile-v2.d.ts.map +1 -0
- package/dist/adapters/node/load-validated-document-authoring-profile-v2.js +103 -0
- package/dist/adapters/node/load-validated-document-authoring-profile-v2.js.map +1 -0
- package/dist/adapters/node/load-validated-document-authoring-profile.d.ts +33 -0
- package/dist/adapters/node/load-validated-document-authoring-profile.d.ts.map +1 -0
- package/dist/adapters/node/load-validated-document-authoring-profile.js +47 -0
- package/dist/adapters/node/load-validated-document-authoring-profile.js.map +1 -0
- package/dist/adapters/node/node-authoring-profile-reader-v2.d.ts +9 -0
- package/dist/adapters/node/node-authoring-profile-reader-v2.d.ts.map +1 -0
- package/dist/adapters/node/node-authoring-profile-reader-v2.js +42 -0
- package/dist/adapters/node/node-authoring-profile-reader-v2.js.map +1 -0
- package/dist/adapters/node/node-authoring-profile-reader.d.ts +9 -0
- package/dist/adapters/node/node-authoring-profile-reader.d.ts.map +1 -0
- package/dist/adapters/node/node-authoring-profile-reader.js +31 -0
- package/dist/adapters/node/node-authoring-profile-reader.js.map +1 -0
- package/dist/adapters/node/node-document-contract-validator.d.ts +7 -0
- package/dist/adapters/node/node-document-contract-validator.d.ts.map +1 -0
- package/dist/adapters/node/node-document-contract-validator.js +306 -0
- package/dist/adapters/node/node-document-contract-validator.js.map +1 -0
- package/dist/adapters/node/node-document-environment-inspector.d.ts +17 -0
- package/dist/adapters/node/node-document-environment-inspector.d.ts.map +1 -0
- package/dist/adapters/node/node-document-environment-inspector.js +49 -0
- package/dist/adapters/node/node-document-environment-inspector.js.map +1 -0
- package/dist/adapters/node/node-document-file-state.d.ts +21 -0
- package/dist/adapters/node/node-document-file-state.d.ts.map +1 -0
- package/dist/adapters/node/node-document-file-state.js +199 -0
- package/dist/adapters/node/node-document-file-state.js.map +1 -0
- package/dist/adapters/node/node-document-journal-store-faults.d.ts +36 -0
- package/dist/adapters/node/node-document-journal-store-faults.d.ts.map +1 -0
- package/dist/adapters/node/node-document-journal-store-faults.js +2 -0
- package/dist/adapters/node/node-document-journal-store-faults.js.map +1 -0
- package/dist/adapters/node/node-document-journal-store-private.d.ts +2 -0
- package/dist/adapters/node/node-document-journal-store-private.d.ts.map +1 -0
- package/dist/adapters/node/node-document-journal-store-private.js +2 -0
- package/dist/adapters/node/node-document-journal-store-private.js.map +1 -0
- package/dist/adapters/node/node-document-journal-store.d.ts +22 -0
- package/dist/adapters/node/node-document-journal-store.d.ts.map +1 -0
- package/dist/adapters/node/node-document-journal-store.js +235 -0
- package/dist/adapters/node/node-document-journal-store.js.map +1 -0
- package/dist/adapters/node/node-document-metadata-sidecar-reader.d.ts +9 -0
- package/dist/adapters/node/node-document-metadata-sidecar-reader.d.ts.map +1 -0
- package/dist/adapters/node/node-document-metadata-sidecar-reader.js +87 -0
- package/dist/adapters/node/node-document-metadata-sidecar-reader.js.map +1 -0
- package/dist/adapters/node/node-document-parent-materializer.d.ts +39 -0
- package/dist/adapters/node/node-document-parent-materializer.d.ts.map +1 -0
- package/dist/adapters/node/node-document-parent-materializer.js +269 -0
- package/dist/adapters/node/node-document-parent-materializer.js.map +1 -0
- package/dist/adapters/node/node-document-planning-profile-reader.d.ts +10 -0
- package/dist/adapters/node/node-document-planning-profile-reader.d.ts.map +1 -0
- package/dist/adapters/node/node-document-planning-profile-reader.js +85 -0
- package/dist/adapters/node/node-document-planning-profile-reader.js.map +1 -0
- package/dist/adapters/node/node-document-planning-state-reader.d.ts +11 -0
- package/dist/adapters/node/node-document-planning-state-reader.d.ts.map +1 -0
- package/dist/adapters/node/node-document-planning-state-reader.js +181 -0
- package/dist/adapters/node/node-document-planning-state-reader.js.map +1 -0
- package/dist/adapters/node/node-document-publisher-private.d.ts +2 -0
- package/dist/adapters/node/node-document-publisher-private.d.ts.map +1 -0
- package/dist/adapters/node/node-document-publisher-private.js +2 -0
- package/dist/adapters/node/node-document-publisher-private.js.map +1 -0
- package/dist/adapters/node/node-document-publisher.d.ts +54 -0
- package/dist/adapters/node/node-document-publisher.d.ts.map +1 -0
- package/dist/adapters/node/node-document-publisher.js +336 -0
- package/dist/adapters/node/node-document-publisher.js.map +1 -0
- package/dist/adapters/node/node-document-reachability-projector.d.ts +17 -0
- package/dist/adapters/node/node-document-reachability-projector.d.ts.map +1 -0
- package/dist/adapters/node/node-document-reachability-projector.js +43 -0
- package/dist/adapters/node/node-document-reachability-projector.js.map +1 -0
- package/dist/adapters/node/node-document-structure-verifier.d.ts +21 -0
- package/dist/adapters/node/node-document-structure-verifier.d.ts.map +1 -0
- package/dist/adapters/node/node-document-structure-verifier.js +80 -0
- package/dist/adapters/node/node-document-structure-verifier.js.map +1 -0
- package/dist/adapters/node/node-document-template-reader.d.ts +10 -0
- package/dist/adapters/node/node-document-template-reader.d.ts.map +1 -0
- package/dist/adapters/node/node-document-template-reader.js +32 -0
- package/dist/adapters/node/node-document-template-reader.js.map +1 -0
- package/dist/adapters/node/node-document-transaction-coordinator.d.ts +11 -0
- package/dist/adapters/node/node-document-transaction-coordinator.d.ts.map +1 -0
- package/dist/adapters/node/node-document-transaction-coordinator.js +60 -0
- package/dist/adapters/node/node-document-transaction-coordinator.js.map +1 -0
- package/dist/adapters/node/node-metadata-instance-validator.d.ts +9 -0
- package/dist/adapters/node/node-metadata-instance-validator.d.ts.map +1 -0
- package/dist/adapters/node/node-metadata-instance-validator.js +90 -0
- package/dist/adapters/node/node-metadata-instance-validator.js.map +1 -0
- package/dist/adapters/node/node-owner-membership-reader.d.ts +10 -0
- package/dist/adapters/node/node-owner-membership-reader.d.ts.map +1 -0
- package/dist/adapters/node/node-owner-membership-reader.js +62 -0
- package/dist/adapters/node/node-owner-membership-reader.js.map +1 -0
- package/dist/adapters/node/node-path-authority.d.ts +53 -0
- package/dist/adapters/node/node-path-authority.d.ts.map +1 -0
- package/dist/adapters/node/node-path-authority.js +186 -0
- package/dist/adapters/node/node-path-authority.js.map +1 -0
- package/dist/adapters/node/read-document-authority-file.d.ts +12 -0
- package/dist/adapters/node/read-document-authority-file.d.ts.map +1 -0
- package/dist/adapters/node/read-document-authority-file.js +78 -0
- package/dist/adapters/node/read-document-authority-file.js.map +1 -0
- package/dist/adapters/node/recapture-document-publication-paths.d.ts +17 -0
- package/dist/adapters/node/recapture-document-publication-paths.d.ts.map +1 -0
- package/dist/adapters/node/recapture-document-publication-paths.js +33 -0
- package/dist/adapters/node/recapture-document-publication-paths.js.map +1 -0
- package/dist/application/model/document-authoring-profile-description.d.ts +57 -0
- package/dist/application/model/document-authoring-profile-description.d.ts.map +1 -0
- package/dist/application/model/document-authoring-profile-description.js +2 -0
- package/dist/application/model/document-authoring-profile-description.js.map +1 -0
- package/dist/application/model/document-catalog.d.ts +88 -0
- package/dist/application/model/document-catalog.d.ts.map +1 -0
- package/dist/application/model/document-catalog.js +2 -0
- package/dist/application/model/document-catalog.js.map +1 -0
- package/dist/application/model/document-command.d.ts +69 -0
- package/dist/application/model/document-command.d.ts.map +1 -0
- package/dist/application/model/document-command.js +2 -0
- package/dist/application/model/document-command.js.map +1 -0
- package/dist/application/model/document-find.d.ts +22 -0
- package/dist/application/model/document-find.d.ts.map +1 -0
- package/dist/application/model/document-find.js +2 -0
- package/dist/application/model/document-find.js.map +1 -0
- package/dist/application/model/document-parent-materialization.d.ts +26 -0
- package/dist/application/model/document-parent-materialization.d.ts.map +1 -0
- package/dist/application/model/document-parent-materialization.js +2 -0
- package/dist/application/model/document-parent-materialization.js.map +1 -0
- package/dist/application/model/document-physical-identity.d.ts +10 -0
- package/dist/application/model/document-physical-identity.d.ts.map +1 -0
- package/dist/application/model/document-physical-identity.js +29 -0
- package/dist/application/model/document-physical-identity.js.map +1 -0
- package/dist/application/model/document-planning.d.ts +209 -0
- package/dist/application/model/document-planning.d.ts.map +1 -0
- package/dist/application/model/document-planning.js +2 -0
- package/dist/application/model/document-planning.js.map +1 -0
- package/dist/application/model/document-receipt.d.ts +101 -0
- package/dist/application/model/document-receipt.d.ts.map +1 -0
- package/dist/application/model/document-receipt.js +2 -0
- package/dist/application/model/document-receipt.js.map +1 -0
- package/dist/application/model/document-transaction-inspection.d.ts +66 -0
- package/dist/application/model/document-transaction-inspection.d.ts.map +1 -0
- package/dist/application/model/document-transaction-inspection.js +2 -0
- package/dist/application/model/document-transaction-inspection.js.map +1 -0
- package/dist/application/model/document-transaction.d.ts +169 -0
- package/dist/application/model/document-transaction.d.ts.map +1 -0
- package/dist/application/model/document-transaction.js +2 -0
- package/dist/application/model/document-transaction.js.map +1 -0
- package/dist/application/policies/assert-artifact-owner-allowed.d.ts +3 -0
- package/dist/application/policies/assert-artifact-owner-allowed.d.ts.map +1 -0
- package/dist/application/policies/assert-artifact-owner-allowed.js +8 -0
- package/dist/application/policies/assert-artifact-owner-allowed.js.map +1 -0
- package/dist/application/policies/assert-v2-planning-profile.d.ts +3 -0
- package/dist/application/policies/assert-v2-planning-profile.d.ts.map +1 -0
- package/dist/application/policies/assert-v2-planning-profile.js +7 -0
- package/dist/application/policies/assert-v2-planning-profile.js.map +1 -0
- package/dist/application/policies/authoring-profile-semantics.d.ts +42 -0
- package/dist/application/policies/authoring-profile-semantics.d.ts.map +1 -0
- package/dist/application/policies/authoring-profile-semantics.js +129 -0
- package/dist/application/policies/authoring-profile-semantics.js.map +1 -0
- package/dist/application/policies/classify-document-recovery.d.ts +81 -0
- package/dist/application/policies/classify-document-recovery.d.ts.map +1 -0
- package/dist/application/policies/classify-document-recovery.js +138 -0
- package/dist/application/policies/classify-document-recovery.js.map +1 -0
- package/dist/application/policies/document-authoring-semantic-digests.d.ts +31 -0
- package/dist/application/policies/document-authoring-semantic-digests.d.ts.map +1 -0
- package/dist/application/policies/document-authoring-semantic-digests.js +163 -0
- package/dist/application/policies/document-authoring-semantic-digests.js.map +1 -0
- package/dist/application/policies/document-catalog-authority-stability.d.ts +12 -0
- package/dist/application/policies/document-catalog-authority-stability.d.ts.map +1 -0
- package/dist/application/policies/document-catalog-authority-stability.js +16 -0
- package/dist/application/policies/document-catalog-authority-stability.js.map +1 -0
- package/dist/application/policies/document-catalog-diagnostics.d.ts +8 -0
- package/dist/application/policies/document-catalog-diagnostics.d.ts.map +1 -0
- package/dist/application/policies/document-catalog-diagnostics.js +44 -0
- package/dist/application/policies/document-catalog-diagnostics.js.map +1 -0
- package/dist/application/policies/document-catalog-fields.d.ts +18 -0
- package/dist/application/policies/document-catalog-fields.d.ts.map +1 -0
- package/dist/application/policies/document-catalog-fields.js +62 -0
- package/dist/application/policies/document-catalog-fields.js.map +1 -0
- package/dist/application/policies/document-catalog-sidecar.d.ts +10 -0
- package/dist/application/policies/document-catalog-sidecar.d.ts.map +1 -0
- package/dist/application/policies/document-catalog-sidecar.js +66 -0
- package/dist/application/policies/document-catalog-sidecar.js.map +1 -0
- package/dist/application/policies/document-command-consumer-root.d.ts +2 -0
- package/dist/application/policies/document-command-consumer-root.d.ts.map +1 -0
- package/dist/application/policies/document-command-consumer-root.js +15 -0
- package/dist/application/policies/document-command-consumer-root.js.map +1 -0
- package/dist/application/policies/document-command-projection.d.ts +20 -0
- package/dist/application/policies/document-command-projection.d.ts.map +1 -0
- package/dist/application/policies/document-command-projection.js +90 -0
- package/dist/application/policies/document-command-projection.js.map +1 -0
- package/dist/application/policies/document-contract-digests.d.ts +20 -0
- package/dist/application/policies/document-contract-digests.d.ts.map +1 -0
- package/dist/application/policies/document-contract-digests.js +329 -0
- package/dist/application/policies/document-contract-digests.js.map +1 -0
- package/dist/application/policies/document-logical-preimage.d.ts +14 -0
- package/dist/application/policies/document-logical-preimage.d.ts.map +1 -0
- package/dist/application/policies/document-logical-preimage.js +61 -0
- package/dist/application/policies/document-logical-preimage.js.map +1 -0
- package/dist/application/policies/document-planning-policy-error.d.ts +6 -0
- package/dist/application/policies/document-planning-policy-error.d.ts.map +1 -0
- package/dist/application/policies/document-planning-policy-error.js +9 -0
- package/dist/application/policies/document-planning-policy-error.js.map +1 -0
- package/dist/application/policies/document-receipt-policy.d.ts +5 -0
- package/dist/application/policies/document-receipt-policy.d.ts.map +1 -0
- package/dist/application/policies/document-receipt-policy.js +92 -0
- package/dist/application/policies/document-receipt-policy.js.map +1 -0
- package/dist/application/policies/document-repository-path.d.ts +3 -0
- package/dist/application/policies/document-repository-path.d.ts.map +1 -0
- package/dist/application/policies/document-repository-path.js +24 -0
- package/dist/application/policies/document-repository-path.js.map +1 -0
- package/dist/application/policies/document-temporary-path.d.ts +7 -0
- package/dist/application/policies/document-temporary-path.d.ts.map +1 -0
- package/dist/application/policies/document-temporary-path.js +34 -0
- package/dist/application/policies/document-temporary-path.js.map +1 -0
- package/dist/application/policies/document-transaction-digests.d.ts +5 -0
- package/dist/application/policies/document-transaction-digests.d.ts.map +1 -0
- package/dist/application/policies/document-transaction-digests.js +12 -0
- package/dist/application/policies/document-transaction-digests.js.map +1 -0
- package/dist/application/policies/document-transaction-envelope-body.d.ts +28 -0
- package/dist/application/policies/document-transaction-envelope-body.d.ts.map +1 -0
- package/dist/application/policies/document-transaction-envelope-body.js +140 -0
- package/dist/application/policies/document-transaction-envelope-body.js.map +1 -0
- package/dist/application/policies/document-transaction-envelope-policy.d.ts +4 -0
- package/dist/application/policies/document-transaction-envelope-policy.d.ts.map +1 -0
- package/dist/application/policies/document-transaction-envelope-policy.js +159 -0
- package/dist/application/policies/document-transaction-envelope-policy.js.map +1 -0
- package/dist/application/policies/inspect-catalog-document.d.ts +18 -0
- package/dist/application/policies/inspect-catalog-document.d.ts.map +1 -0
- package/dist/application/policies/inspect-catalog-document.js +126 -0
- package/dist/application/policies/inspect-catalog-document.js.map +1 -0
- package/dist/application/policies/normalize-document-intent.d.ts +3 -0
- package/dist/application/policies/normalize-document-intent.d.ts.map +1 -0
- package/dist/application/policies/normalize-document-intent.js +104 -0
- package/dist/application/policies/normalize-document-intent.js.map +1 -0
- package/dist/application/policies/project-catalog-metadata.d.ts +7 -0
- package/dist/application/policies/project-catalog-metadata.d.ts.map +1 -0
- package/dist/application/policies/project-catalog-metadata.js +165 -0
- package/dist/application/policies/project-catalog-metadata.js.map +1 -0
- package/dist/application/policies/project-document-reachability.d.ts +14 -0
- package/dist/application/policies/project-document-reachability.d.ts.map +1 -0
- package/dist/application/policies/project-document-reachability.js +57 -0
- package/dist/application/policies/project-document-reachability.js.map +1 -0
- package/dist/application/policies/project-similar-document-advice.d.ts +4 -0
- package/dist/application/policies/project-similar-document-advice.d.ts.map +1 -0
- package/dist/application/policies/project-similar-document-advice.js +17 -0
- package/dist/application/policies/project-similar-document-advice.js.map +1 -0
- package/dist/application/policies/resolve-document-authoring.d.ts +13 -0
- package/dist/application/policies/resolve-document-authoring.d.ts.map +1 -0
- package/dist/application/policies/resolve-document-authoring.js +154 -0
- package/dist/application/policies/resolve-document-authoring.js.map +1 -0
- package/dist/application/policies/same-document-catalog-snapshot.d.ts +3 -0
- package/dist/application/policies/same-document-catalog-snapshot.d.ts.map +1 -0
- package/dist/application/policies/same-document-catalog-snapshot.js +24 -0
- package/dist/application/policies/same-document-catalog-snapshot.js.map +1 -0
- package/dist/application/ports/authoring-profile-reader.d.ts +37 -0
- package/dist/application/ports/authoring-profile-reader.d.ts.map +1 -0
- package/dist/application/ports/authoring-profile-reader.js +2 -0
- package/dist/application/ports/authoring-profile-reader.js.map +1 -0
- package/dist/application/ports/canonical-document-renderer.d.ts +29 -0
- package/dist/application/ports/canonical-document-renderer.d.ts.map +1 -0
- package/dist/application/ports/canonical-document-renderer.js +2 -0
- package/dist/application/ports/canonical-document-renderer.js.map +1 -0
- package/dist/application/ports/document-authority-recompiler.d.ts +19 -0
- package/dist/application/ports/document-authority-recompiler.d.ts.map +1 -0
- package/dist/application/ports/document-authority-recompiler.js +2 -0
- package/dist/application/ports/document-authority-recompiler.js.map +1 -0
- package/dist/application/ports/document-contract-validator.d.ts +6 -0
- package/dist/application/ports/document-contract-validator.d.ts.map +1 -0
- package/dist/application/ports/document-contract-validator.js +2 -0
- package/dist/application/ports/document-contract-validator.js.map +1 -0
- package/dist/application/ports/document-environment-inspector.d.ts +12 -0
- package/dist/application/ports/document-environment-inspector.d.ts.map +1 -0
- package/dist/application/ports/document-environment-inspector.js +2 -0
- package/dist/application/ports/document-environment-inspector.js.map +1 -0
- package/dist/application/ports/document-file-state.d.ts +55 -0
- package/dist/application/ports/document-file-state.d.ts.map +1 -0
- package/dist/application/ports/document-file-state.js +2 -0
- package/dist/application/ports/document-file-state.js.map +1 -0
- package/dist/application/ports/document-journal-store.d.ts +31 -0
- package/dist/application/ports/document-journal-store.d.ts.map +1 -0
- package/dist/application/ports/document-journal-store.js +2 -0
- package/dist/application/ports/document-journal-store.js.map +1 -0
- package/dist/application/ports/document-metadata-sidecar-reader.d.ts +13 -0
- package/dist/application/ports/document-metadata-sidecar-reader.d.ts.map +1 -0
- package/dist/application/ports/document-metadata-sidecar-reader.js +2 -0
- package/dist/application/ports/document-metadata-sidecar-reader.js.map +1 -0
- package/dist/application/ports/document-parent-materializer.d.ts +24 -0
- package/dist/application/ports/document-parent-materializer.d.ts.map +1 -0
- package/dist/application/ports/document-parent-materializer.js +2 -0
- package/dist/application/ports/document-parent-materializer.js.map +1 -0
- package/dist/application/ports/document-planning-profile-reader.d.ts +9 -0
- package/dist/application/ports/document-planning-profile-reader.d.ts.map +1 -0
- package/dist/application/ports/document-planning-profile-reader.js +2 -0
- package/dist/application/ports/document-planning-profile-reader.js.map +1 -0
- package/dist/application/ports/document-planning-state-reader.d.ts +10 -0
- package/dist/application/ports/document-planning-state-reader.d.ts.map +1 -0
- package/dist/application/ports/document-planning-state-reader.js +2 -0
- package/dist/application/ports/document-planning-state-reader.js.map +1 -0
- package/dist/application/ports/document-publisher.d.ts +38 -0
- package/dist/application/ports/document-publisher.d.ts.map +1 -0
- package/dist/application/ports/document-publisher.js +2 -0
- package/dist/application/ports/document-publisher.js.map +1 -0
- package/dist/application/ports/document-reachability-projector.d.ts +13 -0
- package/dist/application/ports/document-reachability-projector.d.ts.map +1 -0
- package/dist/application/ports/document-reachability-projector.js +2 -0
- package/dist/application/ports/document-reachability-projector.js.map +1 -0
- package/dist/application/ports/document-structure-verifier.d.ts +17 -0
- package/dist/application/ports/document-structure-verifier.d.ts.map +1 -0
- package/dist/application/ports/document-structure-verifier.js +2 -0
- package/dist/application/ports/document-structure-verifier.js.map +1 -0
- package/dist/application/ports/document-template-reader.d.ts +9 -0
- package/dist/application/ports/document-template-reader.d.ts.map +1 -0
- package/dist/application/ports/document-template-reader.js +2 -0
- package/dist/application/ports/document-template-reader.js.map +1 -0
- package/dist/application/ports/document-transaction-coordinator.d.ts +21 -0
- package/dist/application/ports/document-transaction-coordinator.d.ts.map +1 -0
- package/dist/application/ports/document-transaction-coordinator.js +2 -0
- package/dist/application/ports/document-transaction-coordinator.js.map +1 -0
- package/dist/application/ports/documentation-catalog-reader-v2.d.ts +11 -0
- package/dist/application/ports/documentation-catalog-reader-v2.d.ts.map +1 -0
- package/dist/application/ports/documentation-catalog-reader-v2.js +2 -0
- package/dist/application/ports/documentation-catalog-reader-v2.js.map +1 -0
- package/dist/application/ports/documentation-catalog-reader.d.ts +11 -0
- package/dist/application/ports/documentation-catalog-reader.d.ts.map +1 -0
- package/dist/application/ports/documentation-catalog-reader.js +2 -0
- package/dist/application/ports/documentation-catalog-reader.js.map +1 -0
- package/dist/application/ports/documentation-search-catalog-reader-v2.d.ts +9 -0
- package/dist/application/ports/documentation-search-catalog-reader-v2.d.ts.map +1 -0
- package/dist/application/ports/documentation-search-catalog-reader-v2.js +2 -0
- package/dist/application/ports/documentation-search-catalog-reader-v2.js.map +1 -0
- package/dist/application/ports/documentation-search-catalog-reader.d.ts +10 -0
- package/dist/application/ports/documentation-search-catalog-reader.d.ts.map +1 -0
- package/dist/application/ports/documentation-search-catalog-reader.js +2 -0
- package/dist/application/ports/documentation-search-catalog-reader.js.map +1 -0
- package/dist/application/ports/metadata-instance-validator.d.ts +18 -0
- package/dist/application/ports/metadata-instance-validator.d.ts.map +1 -0
- package/dist/application/ports/metadata-instance-validator.js +2 -0
- package/dist/application/ports/metadata-instance-validator.js.map +1 -0
- package/dist/application/ports/owner-membership-reader.d.ts +14 -0
- package/dist/application/ports/owner-membership-reader.d.ts.map +1 -0
- package/dist/application/ports/owner-membership-reader.js +2 -0
- package/dist/application/ports/owner-membership-reader.js.map +1 -0
- package/dist/application/ports/similar-document-advisor.d.ts +17 -0
- package/dist/application/ports/similar-document-advisor.d.ts.map +1 -0
- package/dist/application/ports/similar-document-advisor.js +2 -0
- package/dist/application/ports/similar-document-advisor.js.map +1 -0
- package/dist/application/projections/document-catalog-projections.d.ts +3 -0
- package/dist/application/projections/document-catalog-projections.d.ts.map +1 -0
- package/dist/application/projections/document-catalog-projections.js +24 -0
- package/dist/application/projections/document-catalog-projections.js.map +1 -0
- package/dist/application/use-cases/apply-document-plan.d.ts +16 -0
- package/dist/application/use-cases/apply-document-plan.d.ts.map +1 -0
- package/dist/application/use-cases/apply-document-plan.js +311 -0
- package/dist/application/use-cases/apply-document-plan.js.map +1 -0
- package/dist/application/use-cases/apply-document-recovery-receipt.d.ts +14 -0
- package/dist/application/use-cases/apply-document-recovery-receipt.d.ts.map +1 -0
- package/dist/application/use-cases/apply-document-recovery-receipt.js +17 -0
- package/dist/application/use-cases/apply-document-recovery-receipt.js.map +1 -0
- package/dist/application/use-cases/build-documentation-catalog.d.ts +41 -0
- package/dist/application/use-cases/build-documentation-catalog.d.ts.map +1 -0
- package/dist/application/use-cases/build-documentation-catalog.js +259 -0
- package/dist/application/use-cases/build-documentation-catalog.js.map +1 -0
- package/dist/application/use-cases/compile-document-plan.d.ts +6 -0
- package/dist/application/use-cases/compile-document-plan.d.ts.map +1 -0
- package/dist/application/use-cases/compile-document-plan.js +200 -0
- package/dist/application/use-cases/compile-document-plan.js.map +1 -0
- package/dist/application/use-cases/document-journal-reconciliation.d.ts +18 -0
- package/dist/application/use-cases/document-journal-reconciliation.d.ts.map +1 -0
- package/dist/application/use-cases/document-journal-reconciliation.js +90 -0
- package/dist/application/use-cases/document-journal-reconciliation.js.map +1 -0
- package/dist/application/use-cases/document-parent-materialization-continuation.d.ts +3 -0
- package/dist/application/use-cases/document-parent-materialization-continuation.d.ts.map +1 -0
- package/dist/application/use-cases/document-parent-materialization-continuation.js +79 -0
- package/dist/application/use-cases/document-parent-materialization-continuation.js.map +1 -0
- package/dist/application/use-cases/document-transaction-continuation.d.ts +64 -0
- package/dist/application/use-cases/document-transaction-continuation.d.ts.map +1 -0
- package/dist/application/use-cases/document-transaction-continuation.js +283 -0
- package/dist/application/use-cases/document-transaction-continuation.js.map +1 -0
- package/dist/application/use-cases/document-transaction-error.d.ts +5 -0
- package/dist/application/use-cases/document-transaction-error.d.ts.map +1 -0
- package/dist/application/use-cases/document-transaction-error.js +9 -0
- package/dist/application/use-cases/document-transaction-error.js.map +1 -0
- package/dist/application/use-cases/document-transaction-execution.d.ts +9 -0
- package/dist/application/use-cases/document-transaction-execution.d.ts.map +1 -0
- package/dist/application/use-cases/document-transaction-execution.js +40 -0
- package/dist/application/use-cases/document-transaction-execution.js.map +1 -0
- package/dist/application/use-cases/document-transaction-receipts.d.ts +21 -0
- package/dist/application/use-cases/document-transaction-receipts.d.ts.map +1 -0
- package/dist/application/use-cases/document-transaction-receipts.js +180 -0
- package/dist/application/use-cases/document-transaction-receipts.js.map +1 -0
- package/dist/application/use-cases/find-documents.d.ts +20 -0
- package/dist/application/use-cases/find-documents.d.ts.map +1 -0
- package/dist/application/use-cases/find-documents.js +114 -0
- package/dist/application/use-cases/find-documents.js.map +1 -0
- package/dist/application/use-cases/load-v2-profile-description.d.ts +20 -0
- package/dist/application/use-cases/load-v2-profile-description.d.ts.map +1 -0
- package/dist/application/use-cases/load-v2-profile-description.js +14 -0
- package/dist/application/use-cases/load-v2-profile-description.js.map +1 -0
- package/dist/application/use-cases/plan-documentation-document.d.ts +74 -0
- package/dist/application/use-cases/plan-documentation-document.d.ts.map +1 -0
- package/dist/application/use-cases/plan-documentation-document.js +273 -0
- package/dist/application/use-cases/plan-documentation-document.js.map +1 -0
- package/dist/application/use-cases/recapture-directory-receipt-evidence.d.ts +8 -0
- package/dist/application/use-cases/recapture-directory-receipt-evidence.d.ts.map +1 -0
- package/dist/application/use-cases/recapture-directory-receipt-evidence.js +32 -0
- package/dist/application/use-cases/recapture-directory-receipt-evidence.js.map +1 -0
- package/dist/application/use-cases/recover-document-transaction.d.ts +10 -0
- package/dist/application/use-cases/recover-document-transaction.d.ts.map +1 -0
- package/dist/application/use-cases/recover-document-transaction.js +361 -0
- package/dist/application/use-cases/recover-document-transaction.js.map +1 -0
- package/dist/application/use-cases/run-document-doctor.d.ts +18 -0
- package/dist/application/use-cases/run-document-doctor.d.ts.map +1 -0
- package/dist/application/use-cases/run-document-doctor.js +171 -0
- package/dist/application/use-cases/run-document-doctor.js.map +1 -0
- package/dist/application/use-cases/run-document-new.d.ts +30 -0
- package/dist/application/use-cases/run-document-new.d.ts.map +1 -0
- package/dist/application/use-cases/run-document-new.js +221 -0
- package/dist/application/use-cases/run-document-new.js.map +1 -0
- package/dist/application/use-cases/run-document-recover.d.ts +21 -0
- package/dist/application/use-cases/run-document-recover.d.ts.map +1 -0
- package/dist/application/use-cases/run-document-recover.js +126 -0
- package/dist/application/use-cases/run-document-recover.js.map +1 -0
- package/dist/binary-string-comparator.d.ts +3 -0
- package/dist/binary-string-comparator.d.ts.map +1 -0
- package/dist/binary-string-comparator.js +12 -0
- package/dist/binary-string-comparator.js.map +1 -0
- package/dist/cancellation.d.ts +2 -0
- package/dist/cancellation.d.ts.map +1 -0
- package/dist/cancellation.js +12 -0
- package/dist/cancellation.js.map +1 -0
- package/dist/canonical-json.d.ts +3 -0
- package/dist/canonical-json.d.ts.map +1 -0
- package/dist/canonical-json.js +2 -0
- package/dist/canonical-json.js.map +1 -0
- package/dist/capability-runtime.d.ts +12 -0
- package/dist/capability-runtime.d.ts.map +1 -0
- package/dist/capability-runtime.js +10 -0
- package/dist/capability-runtime.js.map +1 -0
- package/dist/composition/describe-document-authoring-profile-v2.d.ts +14 -0
- package/dist/composition/describe-document-authoring-profile-v2.d.ts.map +1 -0
- package/dist/composition/describe-document-authoring-profile-v2.js +220 -0
- package/dist/composition/describe-document-authoring-profile-v2.js.map +1 -0
- package/dist/composition/inspect-document-authoring-environment-v1.d.ts +7 -0
- package/dist/composition/inspect-document-authoring-environment-v1.d.ts.map +1 -0
- package/dist/composition/inspect-document-authoring-environment-v1.js +10 -0
- package/dist/composition/inspect-document-authoring-environment-v1.js.map +1 -0
- package/dist/composition/inspect-document-transaction.d.ts +4 -0
- package/dist/composition/inspect-document-transaction.d.ts.map +1 -0
- package/dist/composition/inspect-document-transaction.js +179 -0
- package/dist/composition/inspect-document-transaction.js.map +1 -0
- package/dist/composition/node-document-authority-recompiler.d.ts +11 -0
- package/dist/composition/node-document-authority-recompiler.d.ts.map +1 -0
- package/dist/composition/node-document-authority-recompiler.js +81 -0
- package/dist/composition/node-document-authority-recompiler.js.map +1 -0
- package/dist/composition/node-document-planning.d.ts +7 -0
- package/dist/composition/node-document-planning.d.ts.map +1 -0
- package/dist/composition/node-document-planning.js +99 -0
- package/dist/composition/node-document-planning.js.map +1 -0
- package/dist/composition/node-document-writing-private.d.ts +15 -0
- package/dist/composition/node-document-writing-private.d.ts.map +1 -0
- package/dist/composition/node-document-writing-private.js +54 -0
- package/dist/composition/node-document-writing-private.js.map +1 -0
- package/dist/composition/node-document-writing.d.ts +8 -0
- package/dist/composition/node-document-writing.d.ts.map +1 -0
- package/dist/composition/node-document-writing.js +10 -0
- package/dist/composition/node-document-writing.js.map +1 -0
- package/dist/document-catalog-error.d.ts +6 -0
- package/dist/document-catalog-error.d.ts.map +1 -0
- package/dist/document-catalog-error.js +9 -0
- package/dist/document-catalog-error.js.map +1 -0
- package/dist/document-planning-error.d.ts +6 -0
- package/dist/document-planning-error.d.ts.map +1 -0
- package/dist/document-planning-error.js +9 -0
- package/dist/document-planning-error.js.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-document-reader.d.ts +14 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-document-reader.d.ts.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-document-reader.js +108 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-document-reader.js.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-filesystem.d.ts +14 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-filesystem.d.ts.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-filesystem.js +61 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-filesystem.js.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-paths.d.ts +8 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-paths.d.ts.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-paths.js +44 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-paths.js.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-reference-resolver.d.ts +6 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-reference-resolver.d.ts.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-reference-resolver.js +160 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-reference-resolver.js.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-repository.d.ts +8 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-repository.d.ts.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-repository.js +13 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-repository.js.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-tree-observer.d.ts +6 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-tree-observer.d.ts.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-tree-observer.js +260 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/filesystem-markdown-tree-observer.js.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/markdown-document-parser.d.ts +3 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/markdown-document-parser.d.ts.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/markdown-document-parser.js +260 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/markdown-document-parser.js.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/markdown-reference-target.d.ts +15 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/markdown-reference-target.d.ts.map +1 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/markdown-reference-target.js +59 -0
- package/dist/documentation-observation/adapters/outbound/filesystem/markdown-reference-target.js.map +1 -0
- package/dist/documentation-observation/application/model/markdown-document.d.ts +69 -0
- package/dist/documentation-observation/application/model/markdown-document.d.ts.map +1 -0
- package/dist/documentation-observation/application/model/markdown-document.js +10 -0
- package/dist/documentation-observation/application/model/markdown-document.js.map +1 -0
- package/dist/documentation-observation/application/ports/markdown-repository.d.ts +18 -0
- package/dist/documentation-observation/application/ports/markdown-repository.d.ts.map +1 -0
- package/dist/documentation-observation/application/ports/markdown-repository.js +2 -0
- package/dist/documentation-observation/application/ports/markdown-repository.js.map +1 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +9 -0
- package/dist/errors.js.map +1 -0
- package/dist/filesystem-path-safety.d.ts +11 -0
- package/dist/filesystem-path-safety.d.ts.map +1 -0
- package/dist/filesystem-path-safety.js +122 -0
- package/dist/filesystem-path-safety.js.map +1 -0
- package/dist/find-command.d.ts +28 -0
- package/dist/find-command.d.ts.map +1 -0
- package/dist/find-command.js +146 -0
- package/dist/find-command.js.map +1 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/installed-artifact-identity.d.ts +2 -0
- package/dist/installed-artifact-identity.d.ts.map +1 -0
- package/dist/installed-artifact-identity.js +13 -0
- package/dist/installed-artifact-identity.js.map +1 -0
- package/dist/observation.d.ts +4 -0
- package/dist/observation.d.ts.map +1 -0
- package/dist/observation.js +3 -0
- package/dist/observation.js.map +1 -0
- package/dist/package-version.d.ts +2 -0
- package/dist/package-version.d.ts.map +1 -0
- package/dist/package-version.js +10 -0
- package/dist/package-version.js.map +1 -0
- package/dist/qualification/index.d.ts +27 -0
- package/dist/qualification/index.d.ts.map +1 -0
- package/dist/qualification/index.js +144 -0
- package/dist/qualification/index.js.map +1 -0
- package/dist/schema-catalog.d.ts +4 -0
- package/dist/schema-catalog.d.ts.map +1 -0
- package/dist/schema-catalog.js +70 -0
- package/dist/schema-catalog.js.map +1 -0
- package/dist/state-contract.d.ts +3 -0
- package/dist/state-contract.d.ts.map +1 -0
- package/dist/state-contract.js +4 -0
- package/dist/state-contract.js.map +1 -0
- package/dist/strict-json.d.ts +2 -0
- package/dist/strict-json.d.ts.map +1 -0
- package/dist/strict-json.js +2 -0
- package/dist/strict-json.js.map +1 -0
- package/dist/strict-yaml.d.ts +3 -0
- package/dist/strict-yaml.d.ts.map +1 -0
- package/dist/strict-yaml.js +37 -0
- package/dist/strict-yaml.js.map +1 -0
- package/package.json +66 -0
- package/schemas/document-authoring-profile/v1.schema.json +265 -0
- package/schemas/document-authoring-profile/v2.schema.json +168 -0
- package/schemas/document-authoring-profile/v3.schema.json +200 -0
- package/schemas/document-command-envelope/v1.schema.json +161 -0
- package/schemas/document-command-envelope/v2.schema.json +205 -0
- package/schemas/document-intent/v1.schema.json +102 -0
- package/schemas/document-parent-materialization/v2.schema.json +65 -0
- package/schemas/document-plan/v1.schema.json +162 -0
- package/schemas/document-plan/v2.schema.json +85 -0
- package/schemas/document-receipt/v1.schema.json +141 -0
- package/schemas/document-receipt/v2.schema.json +108 -0
- package/schemas/foundation-transaction-envelope/v3.schema.json +169 -0
- package/schemas/foundation-transaction-envelope/v4.schema.json +164 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DocumentPlanningError } from "../../document-planning-error.js";
|
|
2
|
+
export function assertV2PlanningProfile(profile, requestedPolicy) {
|
|
3
|
+
if ((requestedPolicy !== undefined) !== (profile.schemaVersion === 2 || profile.schemaVersion === 3)) {
|
|
4
|
+
throw new DocumentPlanningError("DOCUMENT_PLANNING_INPUT_INVALID", "Profile v2/v3 and create-missing-real-directories must select Document Plan v2 together.");
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=assert-v2-planning-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert-v2-planning-profile.js","sourceRoot":"","sources":["../../../src/application/policies/assert-v2-planning-profile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,MAAM,UAAU,uBAAuB,CACrC,OAAwC,EACxC,eAA8D;IAE9D,IAAI,CAAC,eAAe,KAAK,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,KAAK,CAAC,IAAI,OAAO,CAAC,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;QACrG,MAAM,IAAI,qBAAqB,CAC7B,iCAAiC,EACjC,0FAA0F,CAC3F,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
interface PlacementSemantics {
|
|
2
|
+
readonly allowedRoots?: readonly string[];
|
|
3
|
+
readonly kind: string;
|
|
4
|
+
readonly filename?: string;
|
|
5
|
+
readonly minimumSegmentsAfterRequired?: number;
|
|
6
|
+
readonly minimumSegmentsBeforeRequired?: number;
|
|
7
|
+
readonly requiredBasename?: string;
|
|
8
|
+
readonly requiredSegmentsInOrder?: readonly string[];
|
|
9
|
+
readonly root?: string;
|
|
10
|
+
}
|
|
11
|
+
interface ArtifactTypeSemantics {
|
|
12
|
+
readonly identity?: {
|
|
13
|
+
readonly format?: string;
|
|
14
|
+
readonly grammar?: {
|
|
15
|
+
readonly maxSuffixSegments: number;
|
|
16
|
+
readonly minSuffixSegments: number;
|
|
17
|
+
readonly prefixSegments: readonly string[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
readonly placement: PlacementSemantics;
|
|
21
|
+
readonly reachability?: {
|
|
22
|
+
readonly indexPath?: string;
|
|
23
|
+
readonly kind: string;
|
|
24
|
+
};
|
|
25
|
+
readonly type: string;
|
|
26
|
+
}
|
|
27
|
+
export interface AuthoringProfileSemantics {
|
|
28
|
+
readonly authoring: {
|
|
29
|
+
readonly artifactTypes: readonly ArtifactTypeSemantics[];
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export type AuthoringProfileSemanticProblem = "duplicate-artifact-type" | "incompatible-identity-placement" | "invalid-qualified-grammar-range" | "incompatible-reachability-placement" | "overlapping-placement-roots" | "portable-root-collision";
|
|
33
|
+
export declare class AuthoringProfileSemanticError extends Error {
|
|
34
|
+
readonly problem: AuthoringProfileSemanticProblem;
|
|
35
|
+
constructor(problem: AuthoringProfileSemanticProblem);
|
|
36
|
+
}
|
|
37
|
+
export declare function assertAuthoringProfileSemantics(profile: AuthoringProfileSemantics): void;
|
|
38
|
+
export declare function matchingPlacementRoot(repositoryPath: string, allowedRoots: readonly string[]): string | undefined;
|
|
39
|
+
export declare function hasContiguousRequiredSegments(repositoryPath: string, requiredSegments: readonly string[], matchedRoot?: string): boolean;
|
|
40
|
+
export declare function isRepositoryPathAllowedByPlacement(repositoryPath: string, placement: PlacementSemantics): boolean;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=authoring-profile-semantics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring-profile-semantics.d.ts","sourceRoot":"","sources":["../../../src/application/policies/authoring-profile-semantics.ts"],"names":[],"mappings":"AAEA,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IAC/C,QAAQ,CAAC,6BAA6B,CAAC,EAAE,MAAM,CAAC;IAChD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAClB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,OAAO,CAAC,EAAE;YACjB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;YACnC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;YACnC,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;SAC5C,CAAC;KACH,CAAC;IACF,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,YAAY,CAAC,EAAE;QACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,SAAS,EAAE;QAClB,QAAQ,CAAC,aAAa,EAAE,SAAS,qBAAqB,EAAE,CAAC;KAC1D,CAAC;CACH;AAED,MAAM,MAAM,+BAA+B,GACvC,yBAAyB,GACzB,iCAAiC,GACjC,iCAAiC,GACjC,qCAAqC,GACrC,6BAA6B,GAC7B,yBAAyB,CAAC;AAE9B,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,QAAQ,CAAC,OAAO,EAAE,+BAA+B,CAAC;IAElD,YAAY,OAAO,EAAE,+BAA+B,EAInD;CACF;AAkCD,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAgDxF;AAED,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,SAAS,MAAM,EAAE,GAC9B,MAAM,GAAG,SAAS,CAKpB;AAED,wBAAgB,6BAA6B,CAC3C,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,SAAS,MAAM,EAAE,EACnC,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAkBT;AAED,wBAAgB,kCAAkC,CAChD,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,kBAAkB,GAC5B,OAAO,CAsCT"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { isDocumentRepositoryPath } from "./document-repository-path.js";
|
|
2
|
+
export class AuthoringProfileSemanticError extends Error {
|
|
3
|
+
problem;
|
|
4
|
+
constructor(problem) {
|
|
5
|
+
super(`Document authoring profile has invalid semantics: ${problem}.`);
|
|
6
|
+
this.name = "AuthoringProfileSemanticError";
|
|
7
|
+
this.problem = problem;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function portableAsciiIdentity(value) {
|
|
11
|
+
return value.replace(/[A-Z]/gu, (character) => character.toLowerCase());
|
|
12
|
+
}
|
|
13
|
+
function isSegmentBoundaryPrefix(prefix, candidate) {
|
|
14
|
+
return candidate === prefix || candidate.startsWith(`${prefix}/`);
|
|
15
|
+
}
|
|
16
|
+
function hasCompatibleIdentityPlacement(artifactType) {
|
|
17
|
+
const placement = artifactType.placement;
|
|
18
|
+
if (placement.kind === "qualified-leaf-index") {
|
|
19
|
+
return artifactType.identity?.format === "qualified";
|
|
20
|
+
}
|
|
21
|
+
if (placement.kind === "collection" && placement.filename === "numeric-id-slug") {
|
|
22
|
+
return artifactType.identity?.format === "adr-four-digits";
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
function assertCompatibleReachabilityPlacement(artifactType) {
|
|
27
|
+
if (artifactType.reachability?.kind === "manual-colocated-index" &&
|
|
28
|
+
artifactType.placement.kind !== "explicit") {
|
|
29
|
+
throw new AuthoringProfileSemanticError("incompatible-reachability-placement");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function assertAuthoringProfileSemantics(profile) {
|
|
33
|
+
const types = new Set();
|
|
34
|
+
for (const artifactType of profile.authoring.artifactTypes) {
|
|
35
|
+
const typeIdentity = portableAsciiIdentity(artifactType.type);
|
|
36
|
+
if (types.has(typeIdentity)) {
|
|
37
|
+
throw new AuthoringProfileSemanticError("duplicate-artifact-type");
|
|
38
|
+
}
|
|
39
|
+
types.add(typeIdentity);
|
|
40
|
+
const grammar = artifactType.identity?.grammar;
|
|
41
|
+
if (grammar !== undefined &&
|
|
42
|
+
grammar.minSuffixSegments > grammar.maxSuffixSegments) {
|
|
43
|
+
throw new AuthoringProfileSemanticError("invalid-qualified-grammar-range");
|
|
44
|
+
}
|
|
45
|
+
const placement = artifactType.placement;
|
|
46
|
+
if (!hasCompatibleIdentityPlacement(artifactType)) {
|
|
47
|
+
throw new AuthoringProfileSemanticError("incompatible-identity-placement");
|
|
48
|
+
}
|
|
49
|
+
assertCompatibleReachabilityPlacement(artifactType);
|
|
50
|
+
const roots = placement.kind === "qualified-leaf-index"
|
|
51
|
+
? (placement.root === undefined ? [] : [placement.root])
|
|
52
|
+
: [...(placement.allowedRoots ?? [])];
|
|
53
|
+
const identities = roots.map(portableAsciiIdentity);
|
|
54
|
+
for (const [index, root] of roots.entries()) {
|
|
55
|
+
if (!isDocumentRepositoryPath(root)) {
|
|
56
|
+
throw new AuthoringProfileSemanticError("portable-root-collision");
|
|
57
|
+
}
|
|
58
|
+
for (let other = 0; other < index; other += 1) {
|
|
59
|
+
const previous = identities[other];
|
|
60
|
+
const current = identities[index];
|
|
61
|
+
if (previous === undefined || current === undefined) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (previous === current) {
|
|
65
|
+
throw new AuthoringProfileSemanticError("portable-root-collision");
|
|
66
|
+
}
|
|
67
|
+
if (isSegmentBoundaryPrefix(previous, current) ||
|
|
68
|
+
isSegmentBoundaryPrefix(current, previous)) {
|
|
69
|
+
throw new AuthoringProfileSemanticError("overlapping-placement-roots");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export function matchingPlacementRoot(repositoryPath, allowedRoots) {
|
|
76
|
+
const matches = allowedRoots.filter((root) => isSegmentBoundaryPrefix(root, repositoryPath));
|
|
77
|
+
return matches.length === 1 ? matches[0] : undefined;
|
|
78
|
+
}
|
|
79
|
+
export function hasContiguousRequiredSegments(repositoryPath, requiredSegments, matchedRoot) {
|
|
80
|
+
if (requiredSegments.length === 0) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
const rootIdentity = matchedRoot;
|
|
84
|
+
if (rootIdentity !== undefined &&
|
|
85
|
+
!isSegmentBoundaryPrefix(rootIdentity, repositoryPath)) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
const suffix = rootIdentity === undefined
|
|
89
|
+
? repositoryPath
|
|
90
|
+
: repositoryPath.slice(rootIdentity.length).replace(/^\//u, "");
|
|
91
|
+
const segments = suffix.split("/");
|
|
92
|
+
return segments.some((_segment, start) => requiredSegments.every((segment, offset) => segments[start + offset] === segment));
|
|
93
|
+
}
|
|
94
|
+
export function isRepositoryPathAllowedByPlacement(repositoryPath, placement) {
|
|
95
|
+
if (!isDocumentRepositoryPath(repositoryPath)) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
const segments = repositoryPath.split("/");
|
|
99
|
+
const basename = segments.at(-1);
|
|
100
|
+
if (basename !== placement.requiredBasename) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (placement.kind === "qualified-leaf-index") {
|
|
104
|
+
if (placement.root === undefined) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
const rootSegments = placement.root.split("/");
|
|
108
|
+
return isSegmentBoundaryPrefix(placement.root, repositoryPath) &&
|
|
109
|
+
segments.length > rootSegments.length + 1;
|
|
110
|
+
}
|
|
111
|
+
if (placement.kind !== "explicit") {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
const root = matchingPlacementRoot(repositoryPath, placement.allowedRoots ?? []);
|
|
115
|
+
const required = placement.requiredSegmentsInOrder ?? [];
|
|
116
|
+
if (root === undefined ||
|
|
117
|
+
required.length === 0 ||
|
|
118
|
+
placement.minimumSegmentsBeforeRequired === undefined ||
|
|
119
|
+
placement.minimumSegmentsAfterRequired === undefined) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
const suffix = repositoryPath.slice(root.length + 1).split("/");
|
|
123
|
+
const directories = suffix.slice(0, -1);
|
|
124
|
+
return directories.some((_segment, start) => start >= placement.minimumSegmentsBeforeRequired &&
|
|
125
|
+
directories.length - start - required.length >=
|
|
126
|
+
placement.minimumSegmentsAfterRequired &&
|
|
127
|
+
required.every((segment, offset) => directories[start + offset] === segment));
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=authoring-profile-semantics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring-profile-semantics.js","sourceRoot":"","sources":["../../../src/application/policies/authoring-profile-semantics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AA4CzE,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAC7C,OAAO,CAAkC;IAElD,YAAY,OAAwC;QAClD,KAAK,CAAC,qDAAqD,OAAO,GAAG,CAAC,CAAC;QACvE,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED,SAAS,qBAAqB,CAAC,KAAa;IAC1C,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,uBAAuB,CAAC,MAAc,EAAE,SAAiB;IAChE,OAAO,SAAS,KAAK,MAAM,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,8BAA8B,CAAC,YAAmC;IACzE,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC;IACzC,IAAI,SAAS,CAAC,IAAI,KAAK,sBAAsB,EAAE,CAAC;QAC9C,OAAO,YAAY,CAAC,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC;IACvD,CAAC;IACD,IAAI,SAAS,CAAC,IAAI,KAAK,YAAY,IAAI,SAAS,CAAC,QAAQ,KAAK,iBAAiB,EAAE,CAAC;QAChF,OAAO,YAAY,CAAC,QAAQ,EAAE,MAAM,KAAK,iBAAiB,CAAC;IAC7D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,qCAAqC,CAC5C,YAAmC;IAEnC,IACE,YAAY,CAAC,YAAY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MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,OAAO,CAAC,CAC7E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A closed, side-effect-free recovery decision for the document writer.
|
|
3
|
+
*
|
|
4
|
+
* `exact` describes byte equality. Identity relationships are separate so that
|
|
5
|
+
* byte equality can never accidentally grant ownership or recovery authority.
|
|
6
|
+
*/
|
|
7
|
+
export type DocumentRecoveryTemporaryObservation = {
|
|
8
|
+
readonly state: "absent";
|
|
9
|
+
} | {
|
|
10
|
+
readonly state: "exact";
|
|
11
|
+
readonly identity: "nonzero";
|
|
12
|
+
} | {
|
|
13
|
+
readonly state: "replaced";
|
|
14
|
+
readonly identity: "nonzero";
|
|
15
|
+
} | {
|
|
16
|
+
readonly state: "zero-identity";
|
|
17
|
+
} | {
|
|
18
|
+
readonly state: "unverifiable";
|
|
19
|
+
};
|
|
20
|
+
export type DocumentRecoveryDestinationObservation = {
|
|
21
|
+
readonly state: "absent";
|
|
22
|
+
} | {
|
|
23
|
+
readonly state: "conflict";
|
|
24
|
+
} | {
|
|
25
|
+
readonly state: "exact";
|
|
26
|
+
readonly identity: "unbound" | "bound-temporary" | "bound-publication" | "different" | "zero-identity";
|
|
27
|
+
} | {
|
|
28
|
+
readonly state: "unverifiable";
|
|
29
|
+
};
|
|
30
|
+
type DocumentRecoveryJournalObservation = {
|
|
31
|
+
readonly version: "none";
|
|
32
|
+
readonly fileIdentity: "none";
|
|
33
|
+
} | {
|
|
34
|
+
/** Released v1 evidence is read-only and never grants recovery authority. */
|
|
35
|
+
readonly version: "v1-legacy";
|
|
36
|
+
readonly fileIdentity: "nonzero" | "zero-identity" | "unverifiable";
|
|
37
|
+
} | {
|
|
38
|
+
readonly version: "v2";
|
|
39
|
+
readonly fileIdentity: "nonzero" | "zero-identity" | "unverifiable";
|
|
40
|
+
readonly lifecycle: "PREPARED";
|
|
41
|
+
readonly preparedState: "pending" | "preexisting";
|
|
42
|
+
readonly boundIdentity: "none";
|
|
43
|
+
} | {
|
|
44
|
+
readonly version: "v2";
|
|
45
|
+
readonly fileIdentity: "nonzero" | "zero-identity" | "unverifiable";
|
|
46
|
+
readonly lifecycle: "PUBLISHING";
|
|
47
|
+
readonly boundIdentity: "temporary" | "zero-identity" | "unverifiable";
|
|
48
|
+
} | {
|
|
49
|
+
readonly version: "v2";
|
|
50
|
+
readonly fileIdentity: "nonzero" | "zero-identity" | "unverifiable";
|
|
51
|
+
readonly lifecycle: "PUBLISHED";
|
|
52
|
+
readonly boundIdentity: "publication" | "zero-identity" | "unverifiable";
|
|
53
|
+
};
|
|
54
|
+
export interface DocumentRecoveryObservation {
|
|
55
|
+
readonly journal: DocumentRecoveryJournalObservation;
|
|
56
|
+
readonly temporary: DocumentRecoveryTemporaryObservation;
|
|
57
|
+
readonly destination: DocumentRecoveryDestinationObservation;
|
|
58
|
+
}
|
|
59
|
+
type DocumentRecoveryManualReason = "destination-conflict" | "identity-drift" | "inconsistent-lifecycle" | "legacy-journal" | "orphan-temporary" | "publication-missing" | "temporary-missing" | "unverifiable-identity" | "zero-identity";
|
|
60
|
+
export type DocumentRecoveryDecision = {
|
|
61
|
+
readonly action: "resume-prepare";
|
|
62
|
+
} | {
|
|
63
|
+
readonly action: "resume-publish";
|
|
64
|
+
} | {
|
|
65
|
+
readonly action: "complete-publication";
|
|
66
|
+
} | {
|
|
67
|
+
readonly action: "finalize-checks";
|
|
68
|
+
} | {
|
|
69
|
+
readonly action: "already-applied";
|
|
70
|
+
readonly cleanup: "none" | "owned-temporary";
|
|
71
|
+
} | {
|
|
72
|
+
readonly action: "manual";
|
|
73
|
+
readonly reason: DocumentRecoveryManualReason;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Classifies a fully observed recovery snapshot. This function never mutates
|
|
77
|
+
* evidence and deliberately has no catch-all optimistic branch.
|
|
78
|
+
*/
|
|
79
|
+
export declare function classifyDocumentRecovery(observation: DocumentRecoveryObservation): DocumentRecoveryDecision;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=classify-document-recovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify-document-recovery.d.ts","sourceRoot":"","sources":["../../../src/application/policies/classify-document-recovery.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,oCAAoC,GAC5C;IAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,GACzD;IAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,GAC5D;IAAE,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;CAAE,GACnC;IAAE,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;CAAE,CAAC;AAEvC,MAAM,MAAM,sCAAsC,GAC9C;IAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GAC9B;IACE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,QAAQ,EACb,SAAS,GACT,iBAAiB,GACjB,mBAAmB,GACnB,WAAW,GACX,eAAe,CAAC;CACrB,GACD;IAAE,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;CAAE,CAAC;AAEvC,KAAK,kCAAkC,GACnC;IACE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B,GACD;IACE,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,SAAS,GAAG,eAAe,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IAAE,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,GAC3C;IAAE,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,GACtC;IACE,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAAC;CAC9C,GACD;IACE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,4BAA4B,CAAC;CAC/C,CAAC;AAqIN;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,2BAA2B,GACvC,wBAAwB,CAsB1B"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
function manual(reason) {
|
|
2
|
+
return { action: "manual", reason };
|
|
3
|
+
}
|
|
4
|
+
function containsZeroIdentity(observation) {
|
|
5
|
+
if (observation.journal.fileIdentity === "zero-identity") {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
if (observation.temporary.state === "zero-identity") {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (observation.destination.state === "exact" &&
|
|
12
|
+
observation.destination.identity === "zero-identity") {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
return observation.journal.version === "v2" &&
|
|
16
|
+
observation.journal.boundIdentity === "zero-identity";
|
|
17
|
+
}
|
|
18
|
+
function containsUnverifiableIdentity(observation) {
|
|
19
|
+
if (observation.journal.fileIdentity === "unverifiable") {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (observation.temporary.state === "unverifiable") {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
if (observation.destination.state === "unverifiable") {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
return observation.journal.version === "v2" &&
|
|
29
|
+
observation.journal.boundIdentity === "unverifiable";
|
|
30
|
+
}
|
|
31
|
+
function classifyWithoutJournal(observation) {
|
|
32
|
+
if (observation.temporary.state !== "absent") {
|
|
33
|
+
return manual("orphan-temporary");
|
|
34
|
+
}
|
|
35
|
+
switch (observation.destination.state) {
|
|
36
|
+
case "absent":
|
|
37
|
+
return { action: "resume-prepare" };
|
|
38
|
+
case "conflict":
|
|
39
|
+
return manual("destination-conflict");
|
|
40
|
+
case "unverifiable":
|
|
41
|
+
return manual("unverifiable-identity");
|
|
42
|
+
case "exact":
|
|
43
|
+
return observation.destination.identity === "unbound"
|
|
44
|
+
? { action: "already-applied", cleanup: "none" }
|
|
45
|
+
: manual("inconsistent-lifecycle");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function classifyPrepared(observation) {
|
|
49
|
+
if (observation.temporary.state !== "absent") {
|
|
50
|
+
return manual("orphan-temporary");
|
|
51
|
+
}
|
|
52
|
+
switch (observation.destination.state) {
|
|
53
|
+
case "absent":
|
|
54
|
+
return observation.journal.version === "v2" &&
|
|
55
|
+
observation.journal.lifecycle === "PREPARED" &&
|
|
56
|
+
observation.journal.preparedState === "pending"
|
|
57
|
+
? { action: "resume-prepare" }
|
|
58
|
+
: manual("inconsistent-lifecycle");
|
|
59
|
+
case "conflict":
|
|
60
|
+
return manual("destination-conflict");
|
|
61
|
+
case "unverifiable":
|
|
62
|
+
return manual("unverifiable-identity");
|
|
63
|
+
case "exact":
|
|
64
|
+
return observation.journal.version === "v2" &&
|
|
65
|
+
observation.journal.lifecycle === "PREPARED" &&
|
|
66
|
+
observation.journal.preparedState === "preexisting"
|
|
67
|
+
? { action: "already-applied", cleanup: "none" }
|
|
68
|
+
: manual("inconsistent-lifecycle");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function classifyPublishing(observation) {
|
|
72
|
+
switch (observation.destination.state) {
|
|
73
|
+
case "conflict":
|
|
74
|
+
return manual("destination-conflict");
|
|
75
|
+
case "unverifiable":
|
|
76
|
+
return manual("unverifiable-identity");
|
|
77
|
+
case "absent":
|
|
78
|
+
if (observation.temporary.state === "absent") {
|
|
79
|
+
return manual("temporary-missing");
|
|
80
|
+
}
|
|
81
|
+
return observation.temporary.state === "exact"
|
|
82
|
+
? { action: "resume-publish" }
|
|
83
|
+
: manual("identity-drift");
|
|
84
|
+
case "exact":
|
|
85
|
+
if (observation.destination.identity === "bound-temporary") {
|
|
86
|
+
return observation.temporary.state === "absent" ||
|
|
87
|
+
observation.temporary.state === "exact"
|
|
88
|
+
? { action: "complete-publication" }
|
|
89
|
+
: manual("identity-drift");
|
|
90
|
+
}
|
|
91
|
+
return manual("identity-drift");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function classifyPublished(observation) {
|
|
95
|
+
if (observation.temporary.state !== "absent") {
|
|
96
|
+
return manual("orphan-temporary");
|
|
97
|
+
}
|
|
98
|
+
switch (observation.destination.state) {
|
|
99
|
+
case "absent":
|
|
100
|
+
return manual("publication-missing");
|
|
101
|
+
case "conflict":
|
|
102
|
+
return manual("destination-conflict");
|
|
103
|
+
case "unverifiable":
|
|
104
|
+
return manual("unverifiable-identity");
|
|
105
|
+
case "exact":
|
|
106
|
+
return observation.destination.identity === "bound-publication"
|
|
107
|
+
? { action: "finalize-checks" }
|
|
108
|
+
: manual("identity-drift");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Classifies a fully observed recovery snapshot. This function never mutates
|
|
113
|
+
* evidence and deliberately has no catch-all optimistic branch.
|
|
114
|
+
*/
|
|
115
|
+
export function classifyDocumentRecovery(observation) {
|
|
116
|
+
if (containsZeroIdentity(observation)) {
|
|
117
|
+
return manual("zero-identity");
|
|
118
|
+
}
|
|
119
|
+
if (containsUnverifiableIdentity(observation)) {
|
|
120
|
+
return manual("unverifiable-identity");
|
|
121
|
+
}
|
|
122
|
+
switch (observation.journal.version) {
|
|
123
|
+
case "none":
|
|
124
|
+
return classifyWithoutJournal(observation);
|
|
125
|
+
case "v1-legacy":
|
|
126
|
+
return manual("legacy-journal");
|
|
127
|
+
case "v2":
|
|
128
|
+
switch (observation.journal.lifecycle) {
|
|
129
|
+
case "PREPARED":
|
|
130
|
+
return classifyPrepared(observation);
|
|
131
|
+
case "PUBLISHING":
|
|
132
|
+
return classifyPublishing(observation);
|
|
133
|
+
case "PUBLISHED":
|
|
134
|
+
return classifyPublished(observation);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=classify-document-recovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify-document-recovery.js","sourceRoot":"","sources":["../../../src/application/policies/classify-document-recovery.ts"],"names":[],"mappings":"AAwFA,SAAS,MAAM,CAAC,MAAoC;IAClD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,oBAAoB,CAC3B,WAAwC;IAExC,IAAI,WAAW,CAAC,OAAO,CAAC,YAAY,KAAK,eAAe,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,WAAW,CAAC,SAAS,CAAC,KAAK,KAAK,eAAe,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IACE,WAAW,CAAC,WAAW,CAAC,KAAK,KAAK,OAAO;QACzC,WAAW,CAAC,WAAW,CAAC,QAAQ,KAAK,eAAe,EACpD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,WAAW,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI;QACzC,WAAW,CAAC,OAAO,CAAC,aAAa,KAAK,eAAe,CAAC;AAC1D,CAAC;AAED,SAAS,4BAA4B,CACnC,WAAwC;IAExC,IAAI,WAAW,CAAC,OAAO,CAAC,YAAY,KAAK,cAAc,EAAE,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,WAAW,CAAC,SAAS,CAAC,KAAK,KAAK,cAAc,EAAE,CAAC;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,WAAW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,CAAC;QAClC,KAAK,IAAI;YACP,QAAQ,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;gBACtC,KAAK,UAAU;oBACb,OAAO,gBAAgB,CAAC,WAAW,CAAC,CAAC;gBACvC,KAAK,YAAY;oBACf,OAAO,kBAAkB,CAAC,WAAW,CAAC,CAAC;gBACzC,KAAK,WAAW;oBACd,OAAO,iBAAiB,CAAC,WAAW,CAAC,CAAC;YAC1C,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DocumentAuthoringProfileDescriptionV2, DocumentAuthoringProfileDescriptionV3 } from "../model/document-authoring-profile-description.js";
|
|
2
|
+
import type { DocumentAuthorityDigest, DocumentDescriptorV2, DocumentationCatalogAuthorityV2, DocumentationCatalogDiagnostic, DocumentationCatalogSnapshotV2, DocumentIdentityProjectionEntry } from "../model/document-catalog.js";
|
|
3
|
+
import type { DocumentIntent, DocumentPlanningProfileSnapshot } from "../model/document-planning.js";
|
|
4
|
+
export declare function documentAuthoringProfileSemanticDigest(description: Omit<DocumentAuthoringProfileDescriptionV2, "semanticDigest">): DocumentAuthorityDigest;
|
|
5
|
+
export declare function documentAuthoringProfileSemanticDigestV3(description: Omit<DocumentAuthoringProfileDescriptionV3, "semanticDigest">): DocumentAuthorityDigest;
|
|
6
|
+
export interface DocumentationCatalogSemanticDigestInput {
|
|
7
|
+
readonly authority: DocumentationCatalogAuthorityV2;
|
|
8
|
+
readonly diagnostics: readonly DocumentationCatalogDiagnostic[];
|
|
9
|
+
readonly documents: readonly DocumentDescriptorV2[];
|
|
10
|
+
readonly identityProjection: readonly DocumentIdentityProjectionEntry[];
|
|
11
|
+
readonly ownerIds: readonly string[];
|
|
12
|
+
readonly projectId: string;
|
|
13
|
+
readonly status: "complete" | "partial";
|
|
14
|
+
}
|
|
15
|
+
export declare function documentationCatalogSemanticDigest(catalog: DocumentationCatalogSemanticDigestInput): DocumentAuthorityDigest;
|
|
16
|
+
export interface DocumentationCatalogSemanticTransitionV2 {
|
|
17
|
+
readonly catalogPreimageSemanticDigest: DocumentAuthorityDigest;
|
|
18
|
+
readonly expectedCatalogPostimageSemanticDigest: DocumentAuthorityDigest;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Projects the catalog transition caused by publishing one exact v2 Plan.
|
|
22
|
+
* An already-applied exact document is removed only from the logical preimage,
|
|
23
|
+
* which keeps the original Plan reproducible after its publication boundary.
|
|
24
|
+
*/
|
|
25
|
+
export declare function projectDocumentationCatalogSemanticTransitionV2(input: {
|
|
26
|
+
readonly catalog: DocumentationCatalogSnapshotV2;
|
|
27
|
+
readonly destination: string;
|
|
28
|
+
readonly intent: DocumentIntent;
|
|
29
|
+
readonly profile: DocumentPlanningProfileSnapshot;
|
|
30
|
+
}): DocumentationCatalogSemanticTransitionV2;
|
|
31
|
+
//# sourceMappingURL=document-authoring-semantic-digests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-authoring-semantic-digests.d.ts","sourceRoot":"","sources":["../../../src/application/policies/document-authoring-semantic-digests.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,qCAAqC,EACrC,qCAAqC,EACtC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,+BAA+B,EAC/B,8BAA8B,EAC9B,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,cAAc,EACd,+BAA+B,EAChC,MAAM,+BAA+B,CAAC;AAsDvC,wBAAgB,sCAAsC,CACpD,WAAW,EAAE,IAAI,CAAC,qCAAqC,EAAE,gBAAgB,CAAC,GACzE,uBAAuB,CAEzB;AAED,wBAAgB,wCAAwC,CACtD,WAAW,EAAE,IAAI,CAAC,qCAAqC,EAAE,gBAAgB,CAAC,GACzE,uBAAuB,CAEzB;AAED,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,SAAS,EAAE,+BAA+B,CAAC;IACpD,QAAQ,CAAC,WAAW,EAAE,SAAS,8BAA8B,EAAE,CAAC;IAChE,QAAQ,CAAC,SAAS,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACpD,QAAQ,CAAC,kBAAkB,EAAE,SAAS,+BAA+B,EAAE,CAAC;IACxE,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;CACzC;AAED,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,uCAAuC,GAC/C,uBAAuB,CA4BzB;AAED,MAAM,WAAW,wCAAwC;IACvD,QAAQ,CAAC,6BAA6B,EAAE,uBAAuB,CAAC;IAChE,QAAQ,CAAC,sCAAsC,EAAE,uBAAuB,CAAC;CAC1E;AAmFD;;;;GAIG;AACH,wBAAgB,+CAA+C,CAAC,KAAK,EAAE;IACrE,QAAQ,CAAC,OAAO,EAAE,8BAA8B,CAAC;IACjD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,+BAA+B,CAAC;CACnD,GAAG,wCAAwC,CA6E3C"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { compareBinaryStrings } from "../../binary-string-comparator.js";
|
|
2
|
+
import { canonicalJson, sha256Json } from "../../canonical-json.js";
|
|
3
|
+
import { projectCatalogMetadata } from "./project-catalog-metadata.js";
|
|
4
|
+
import { selectDocumentArtifact } from "./resolve-document-authoring.js";
|
|
5
|
+
const DOMAIN_PREFIX = "agent-teams.foundation.document-authoring";
|
|
6
|
+
function domainDigest(domain, payload) {
|
|
7
|
+
return sha256Json({ domain, payload });
|
|
8
|
+
}
|
|
9
|
+
function canonicalSortKey(value) {
|
|
10
|
+
return canonicalJson(value);
|
|
11
|
+
}
|
|
12
|
+
function profileSemanticDigest(description, version) {
|
|
13
|
+
const authority = {
|
|
14
|
+
...description.authority,
|
|
15
|
+
templates: [...description.authority.templates].toSorted((left, right) => compareBinaryStrings(left.type, right.type) ||
|
|
16
|
+
compareBinaryStrings(left.evidence.path, right.evidence.path))
|
|
17
|
+
};
|
|
18
|
+
const catalog = {
|
|
19
|
+
collections: [...description.catalog.collections].toSorted((left, right) => compareBinaryStrings(canonicalSortKey(left), canonicalSortKey(right))),
|
|
20
|
+
excludedPrefixes: [...description.catalog.excludedPrefixes].toSorted(compareBinaryStrings)
|
|
21
|
+
};
|
|
22
|
+
const payload = {
|
|
23
|
+
...description,
|
|
24
|
+
authority,
|
|
25
|
+
catalog,
|
|
26
|
+
ownerIds: [...description.ownerIds].toSorted(compareBinaryStrings),
|
|
27
|
+
types: [...description.types].toSorted((left, right) => compareBinaryStrings(left.type, right.type))
|
|
28
|
+
};
|
|
29
|
+
return domainDigest(`${DOMAIN_PREFIX}/profile-semantic-projection/v${version}`, payload);
|
|
30
|
+
}
|
|
31
|
+
export function documentAuthoringProfileSemanticDigest(description) {
|
|
32
|
+
return profileSemanticDigest(description, 2);
|
|
33
|
+
}
|
|
34
|
+
export function documentAuthoringProfileSemanticDigestV3(description) {
|
|
35
|
+
return profileSemanticDigest(description, 3);
|
|
36
|
+
}
|
|
37
|
+
export function documentationCatalogSemanticDigest(catalog) {
|
|
38
|
+
const payload = {
|
|
39
|
+
authority: catalog.authority,
|
|
40
|
+
diagnostics: [...catalog.diagnostics].toSorted((left, right) => compareBinaryStrings(left.ruleId, right.ruleId) ||
|
|
41
|
+
compareBinaryStrings(left.subject, right.subject) ||
|
|
42
|
+
compareBinaryStrings(left.message, right.message)),
|
|
43
|
+
documents: [...catalog.documents].toSorted((left, right) => compareBinaryStrings(left.repositoryPath, right.repositoryPath) ||
|
|
44
|
+
compareBinaryStrings(left.id, right.id)),
|
|
45
|
+
identityProjection: [...catalog.identityProjection].toSorted((left, right) => compareBinaryStrings(left.id, right.id) ||
|
|
46
|
+
compareBinaryStrings(left.repositoryPath, right.repositoryPath)),
|
|
47
|
+
ownerIds: [...catalog.ownerIds].toSorted(compareBinaryStrings),
|
|
48
|
+
projectId: catalog.projectId,
|
|
49
|
+
schemaVersion: 2,
|
|
50
|
+
status: catalog.status
|
|
51
|
+
};
|
|
52
|
+
return domainDigest(`${DOMAIN_PREFIX}/catalog-semantic-projection/v2`, payload);
|
|
53
|
+
}
|
|
54
|
+
function matchesPrefix(path, prefix) {
|
|
55
|
+
return path === prefix || path.startsWith(`${prefix}/`);
|
|
56
|
+
}
|
|
57
|
+
function catalogDocumentSource(profile, repositoryPath) {
|
|
58
|
+
return profile.collections.some((collection) => collection.kind === "frontmatter-readme" &&
|
|
59
|
+
repositoryPath.endsWith("/README.md") &&
|
|
60
|
+
collection.roots.some((root) => matchesPrefix(repositoryPath, root)))
|
|
61
|
+
? "frontmatter-readme"
|
|
62
|
+
: "markdown-tree";
|
|
63
|
+
}
|
|
64
|
+
function plannedDocumentDescriptor(input) {
|
|
65
|
+
const artifact = selectDocumentArtifact(input.profile, input.intent.type);
|
|
66
|
+
const title = artifact.heading.kind === "title"
|
|
67
|
+
? input.intent.title
|
|
68
|
+
: `${input.intent.id}: ${input.intent.title}`;
|
|
69
|
+
const metadata = projectCatalogMetadata({
|
|
70
|
+
id: input.intent.id,
|
|
71
|
+
owner: input.intent.owner,
|
|
72
|
+
status: artifact.initialStatus,
|
|
73
|
+
summary: input.intent.summary,
|
|
74
|
+
type: input.intent.type,
|
|
75
|
+
...(input.intent.related === undefined
|
|
76
|
+
? {}
|
|
77
|
+
: { related: input.intent.related }),
|
|
78
|
+
...input.intent.additionalMetadata
|
|
79
|
+
});
|
|
80
|
+
return Object.freeze({
|
|
81
|
+
id: input.intent.id,
|
|
82
|
+
metadata,
|
|
83
|
+
owner: input.intent.owner,
|
|
84
|
+
repositoryPath: input.destination,
|
|
85
|
+
source: catalogDocumentSource(input.profile, input.destination),
|
|
86
|
+
status: artifact.initialStatus,
|
|
87
|
+
summary: input.intent.summary,
|
|
88
|
+
title,
|
|
89
|
+
type: input.intent.type
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function sameGovernedDescriptor(left, right) {
|
|
93
|
+
return left.id === right.id &&
|
|
94
|
+
left.owner === right.owner &&
|
|
95
|
+
left.repositoryPath === right.repositoryPath &&
|
|
96
|
+
left.source === right.source &&
|
|
97
|
+
left.status === right.status &&
|
|
98
|
+
left.summary === right.summary &&
|
|
99
|
+
left.title === right.title &&
|
|
100
|
+
left.type === right.type;
|
|
101
|
+
}
|
|
102
|
+
function digestCatalogProjection(catalog, documents, identityProjection) {
|
|
103
|
+
return documentationCatalogSemanticDigest({
|
|
104
|
+
authority: catalog.authority,
|
|
105
|
+
diagnostics: catalog.diagnostics,
|
|
106
|
+
documents,
|
|
107
|
+
identityProjection,
|
|
108
|
+
ownerIds: catalog.ownerIds,
|
|
109
|
+
projectId: catalog.projectId,
|
|
110
|
+
status: catalog.status
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Projects the catalog transition caused by publishing one exact v2 Plan.
|
|
115
|
+
* An already-applied exact document is removed only from the logical preimage,
|
|
116
|
+
* which keeps the original Plan reproducible after its publication boundary.
|
|
117
|
+
*/
|
|
118
|
+
export function projectDocumentationCatalogSemanticTransitionV2(input) {
|
|
119
|
+
if (input.catalog.status !== "complete") {
|
|
120
|
+
throw new Error("Catalog semantic transitions require a complete v2 catalog.");
|
|
121
|
+
}
|
|
122
|
+
if (documentationCatalogSemanticDigest(input.catalog) !==
|
|
123
|
+
input.catalog.semanticDigest) {
|
|
124
|
+
throw new Error("Catalog semantic transition input does not match its digest.");
|
|
125
|
+
}
|
|
126
|
+
const planned = plannedDocumentDescriptor(input);
|
|
127
|
+
const collisions = input.catalog.documents.filter((document) => document.id === planned.id ||
|
|
128
|
+
document.repositoryPath === planned.repositoryPath);
|
|
129
|
+
const exact = collisions.find((document) => document.id === planned.id &&
|
|
130
|
+
document.repositoryPath === planned.repositoryPath);
|
|
131
|
+
if (collisions.length > (exact === undefined ? 0 : 1) ||
|
|
132
|
+
(exact !== undefined && !sameGovernedDescriptor(exact, planned))) {
|
|
133
|
+
throw new Error("Planned document conflicts with the complete catalog semantic projection.");
|
|
134
|
+
}
|
|
135
|
+
const matchingIdentities = input.catalog.identityProjection.filter((identity) => identity.id === planned.id ||
|
|
136
|
+
identity.repositoryPath === planned.repositoryPath);
|
|
137
|
+
if (matchingIdentities.length !== (exact === undefined ? 0 : 1) ||
|
|
138
|
+
matchingIdentities.some((identity) => identity.id !== planned.id ||
|
|
139
|
+
identity.repositoryPath !== planned.repositoryPath)) {
|
|
140
|
+
throw new Error("Planned document identity conflicts with the complete catalog projection.");
|
|
141
|
+
}
|
|
142
|
+
const preimageDocuments = exact === undefined
|
|
143
|
+
? input.catalog.documents
|
|
144
|
+
: input.catalog.documents.filter((document) => document !== exact);
|
|
145
|
+
const preimageIdentities = exact === undefined
|
|
146
|
+
? input.catalog.identityProjection
|
|
147
|
+
: input.catalog.identityProjection.filter((identity) => identity.id !== planned.id ||
|
|
148
|
+
identity.repositoryPath !== planned.repositoryPath);
|
|
149
|
+
const postimageDocuments = exact === undefined
|
|
150
|
+
? [...input.catalog.documents, planned]
|
|
151
|
+
: input.catalog.documents;
|
|
152
|
+
const postimageIdentities = exact === undefined
|
|
153
|
+
? [
|
|
154
|
+
...input.catalog.identityProjection,
|
|
155
|
+
Object.freeze({ id: planned.id, repositoryPath: planned.repositoryPath })
|
|
156
|
+
]
|
|
157
|
+
: input.catalog.identityProjection;
|
|
158
|
+
return Object.freeze({
|
|
159
|
+
catalogPreimageSemanticDigest: digestCatalogProjection(input.catalog, preimageDocuments, preimageIdentities),
|
|
160
|
+
expectedCatalogPostimageSemanticDigest: digestCatalogProjection(input.catalog, postimageDocuments, postimageIdentities)
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=document-authoring-semantic-digests.js.map
|