worldvm 0.0.0-stage → 0.1.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/AUTHORING.md +833 -0
- package/README.md +154 -2
- package/bin/worldvm.mjs +3 -0
- package/dist/_internal/forma/index.d.ts +1 -0
- package/dist/_internal/forma/index.js +1 -0
- package/dist/_internal/forma/world/authoring-help.d.ts +25 -0
- package/dist/_internal/forma/world/authoring-help.js +130 -0
- package/dist/_internal/forma/world/citations.d.ts +3 -0
- package/dist/_internal/forma/world/citations.js +26 -0
- package/dist/_internal/forma/world/clock-bindings.d.ts +4 -0
- package/dist/_internal/forma/world/clock-bindings.js +45 -0
- package/dist/_internal/forma/world/compile.d.ts +13 -0
- package/dist/_internal/forma/world/compile.js +190 -0
- package/dist/_internal/forma/world/coverage.d.ts +10 -0
- package/dist/_internal/forma/world/coverage.js +242 -0
- package/dist/_internal/forma/world/digest.d.ts +1 -0
- package/dist/_internal/forma/world/digest.js +1 -0
- package/dist/_internal/forma/world/documentation.d.ts +3 -0
- package/dist/_internal/forma/world/documentation.js +38 -0
- package/dist/_internal/forma/world/homes.d.ts +4 -0
- package/dist/_internal/forma/world/homes.js +202 -0
- package/dist/_internal/forma/world/index.d.ts +6 -0
- package/dist/_internal/forma/world/index.js +5 -0
- package/dist/_internal/forma/world/lowering/accounts.d.ts +4 -0
- package/dist/_internal/forma/world/lowering/accounts.js +36 -0
- package/dist/_internal/forma/world/lowering/action-policy.d.ts +5 -0
- package/dist/_internal/forma/world/lowering/action-policy.js +16 -0
- package/dist/_internal/forma/world/lowering/agents.d.ts +6 -0
- package/dist/_internal/forma/world/lowering/agents.js +116 -0
- package/dist/_internal/forma/world/lowering/bundles.d.ts +3 -0
- package/dist/_internal/forma/world/lowering/bundles.js +13 -0
- package/dist/_internal/forma/world/lowering/child-parameters.d.ts +14 -0
- package/dist/_internal/forma/world/lowering/child-parameters.js +36 -0
- package/dist/_internal/forma/world/lowering/collects.d.ts +3 -0
- package/dist/_internal/forma/world/lowering/collects.js +51 -0
- package/dist/_internal/forma/world/lowering/component-operations.d.ts +6 -0
- package/dist/_internal/forma/world/lowering/component-operations.js +26 -0
- package/dist/_internal/forma/world/lowering/components.d.ts +7 -0
- package/dist/_internal/forma/world/lowering/components.js +236 -0
- package/dist/_internal/forma/world/lowering/connectors.d.ts +4 -0
- package/dist/_internal/forma/world/lowering/connectors.js +31 -0
- package/dist/_internal/forma/world/lowering/context.d.ts +80 -0
- package/dist/_internal/forma/world/lowering/context.js +316 -0
- package/dist/_internal/forma/world/lowering/contracts.d.ts +7 -0
- package/dist/_internal/forma/world/lowering/contracts.js +73 -0
- package/dist/_internal/forma/world/lowering/decisions.d.ts +3 -0
- package/dist/_internal/forma/world/lowering/decisions.js +164 -0
- package/dist/_internal/forma/world/lowering/derives.d.ts +3 -0
- package/dist/_internal/forma/world/lowering/derives.js +22 -0
- package/dist/_internal/forma/world/lowering/discretionary.d.ts +7 -0
- package/dist/_internal/forma/world/lowering/discretionary.js +15 -0
- package/dist/_internal/forma/world/lowering/documents.d.ts +3 -0
- package/dist/_internal/forma/world/lowering/documents.js +68 -0
- package/dist/_internal/forma/world/lowering/effective.d.ts +5 -0
- package/dist/_internal/forma/world/lowering/effective.js +26 -0
- package/dist/_internal/forma/world/lowering/entities.d.ts +3 -0
- package/dist/_internal/forma/world/lowering/entities.js +43 -0
- package/dist/_internal/forma/world/lowering/escalations.d.ts +6 -0
- package/dist/_internal/forma/world/lowering/escalations.js +31 -0
- package/dist/_internal/forma/world/lowering/evidence.d.ts +3 -0
- package/dist/_internal/forma/world/lowering/evidence.js +75 -0
- package/dist/_internal/forma/world/lowering/files.d.ts +4 -0
- package/dist/_internal/forma/world/lowering/files.js +56 -0
- package/dist/_internal/forma/world/lowering/holds.d.ts +6 -0
- package/dist/_internal/forma/world/lowering/holds.js +35 -0
- package/dist/_internal/forma/world/lowering/index.d.ts +89 -0
- package/dist/_internal/forma/world/lowering/index.js +115 -0
- package/dist/_internal/forma/world/lowering/interactions.d.ts +7 -0
- package/dist/_internal/forma/world/lowering/interactions.js +190 -0
- package/dist/_internal/forma/world/lowering/library.d.ts +5 -0
- package/dist/_internal/forma/world/lowering/library.js +41 -0
- package/dist/_internal/forma/world/lowering/milestones.d.ts +6 -0
- package/dist/_internal/forma/world/lowering/milestones.js +17 -0
- package/dist/_internal/forma/world/lowering/notices.d.ts +3 -0
- package/dist/_internal/forma/world/lowering/notices.js +33 -0
- package/dist/_internal/forma/world/lowering/param-bounds.d.ts +15 -0
- package/dist/_internal/forma/world/lowering/param-bounds.js +71 -0
- package/dist/_internal/forma/world/lowering/policies.d.ts +6 -0
- package/dist/_internal/forma/world/lowering/policies.js +95 -0
- package/dist/_internal/forma/world/lowering/principals.d.ts +62 -0
- package/dist/_internal/forma/world/lowering/principals.js +32 -0
- package/dist/_internal/forma/world/lowering/recurrences.d.ts +9 -0
- package/dist/_internal/forma/world/lowering/recurrences.js +56 -0
- package/dist/_internal/forma/world/lowering/renewal.d.ts +5 -0
- package/dist/_internal/forma/world/lowering/renewal.js +21 -0
- package/dist/_internal/forma/world/lowering/resources.d.ts +6 -0
- package/dist/_internal/forma/world/lowering/resources.js +19 -0
- package/dist/_internal/forma/world/lowering/reuse.d.ts +5 -0
- package/dist/_internal/forma/world/lowering/reuse.js +75 -0
- package/dist/_internal/forma/world/lowering/sources.d.ts +10 -0
- package/dist/_internal/forma/world/lowering/sources.js +47 -0
- package/dist/_internal/forma/world/lowering/syntax.d.ts +84 -0
- package/dist/_internal/forma/world/lowering/syntax.js +94 -0
- package/dist/_internal/forma/world/lowering/vaults.d.ts +11 -0
- package/dist/_internal/forma/world/lowering/vaults.js +148 -0
- package/dist/_internal/forma/world/prelude.generated.d.ts +1 -0
- package/dist/_internal/forma/world/prelude.generated.js +2 -0
- package/dist/_internal/forma/world/properties.d.ts +9 -0
- package/dist/_internal/forma/world/properties.js +387 -0
- package/dist/_internal/forma/world/scenarios.d.ts +10 -0
- package/dist/_internal/forma/world/scenarios.js +757 -0
- package/dist/_internal/forma/world/sensitivity.d.ts +3 -0
- package/dist/_internal/forma/world/sensitivity.js +118 -0
- package/dist/_internal/forma/world/source-syntax.d.ts +6 -0
- package/dist/_internal/forma/world/source-syntax.js +27 -0
- package/dist/_internal/forma/world/status-handling.d.ts +3 -0
- package/dist/_internal/forma/world/status-handling.js +143 -0
- package/dist/_internal/forma/world/surface.d.ts +30 -0
- package/dist/_internal/forma/world/surface.js +213 -0
- package/dist/_internal/forma/world/table-expressions.d.ts +3 -0
- package/dist/_internal/forma/world/table-expressions.js +41 -0
- package/dist/_internal/forma-tools/index.d.ts +17 -0
- package/dist/_internal/forma-tools/index.js +124 -0
- package/dist/_internal/ir-checks/advances.d.ts +7 -0
- package/dist/_internal/ir-checks/advances.js +6 -0
- package/dist/_internal/ir-checks/agent-reads.d.ts +14 -0
- package/dist/_internal/ir-checks/agent-reads.js +118 -0
- package/dist/_internal/ir-checks/amendments.d.ts +3 -0
- package/dist/_internal/ir-checks/amendments.js +21 -0
- package/dist/_internal/ir-checks/canonical-json.d.ts +3 -0
- package/dist/_internal/ir-checks/canonical-json.js +85 -0
- package/dist/_internal/ir-checks/child-parameters.d.ts +2 -0
- package/dist/_internal/ir-checks/child-parameters.js +43 -0
- package/dist/_internal/ir-checks/clock-bindings.d.ts +3 -0
- package/dist/_internal/ir-checks/clock-bindings.js +43 -0
- package/dist/_internal/ir-checks/collect-types.d.ts +14 -0
- package/dist/_internal/ir-checks/collect-types.js +34 -0
- package/dist/_internal/ir-checks/component-operations.d.ts +4 -0
- package/dist/_internal/ir-checks/component-operations.js +23 -0
- package/dist/_internal/ir-checks/content-digest.d.ts +4 -0
- package/dist/_internal/ir-checks/content-digest.js +78 -0
- package/dist/_internal/ir-checks/contract-validation.d.ts +3 -0
- package/dist/_internal/ir-checks/contract-validation.js +307 -0
- package/dist/_internal/ir-checks/contracts.d.ts +25 -0
- package/dist/_internal/ir-checks/contracts.js +80 -0
- package/dist/_internal/ir-checks/dates.d.ts +2 -0
- package/dist/_internal/ir-checks/dates.js +7 -0
- package/dist/_internal/ir-checks/documents.d.ts +3 -0
- package/dist/_internal/ir-checks/documents.js +45 -0
- package/dist/_internal/ir-checks/evidence.d.ts +20 -0
- package/dist/_internal/ir-checks/evidence.js +56 -0
- package/dist/_internal/ir-checks/files.d.ts +7 -0
- package/dist/_internal/ir-checks/files.js +47 -0
- package/dist/_internal/ir-checks/index.d.ts +59 -0
- package/dist/_internal/ir-checks/index.js +166 -0
- package/dist/_internal/ir-checks/instants.d.ts +7 -0
- package/dist/_internal/ir-checks/instants.js +61 -0
- package/dist/_internal/ir-checks/notices.d.ts +4 -0
- package/dist/_internal/ir-checks/notices.js +58 -0
- package/dist/_internal/ir-checks/policy-bounds.d.ts +5 -0
- package/dist/_internal/ir-checks/policy-bounds.js +28 -0
- package/dist/_internal/ir-checks/principals.d.ts +26 -0
- package/dist/_internal/ir-checks/principals.js +162 -0
- package/dist/_internal/ir-checks/prior-cycle.d.ts +41 -0
- package/dist/_internal/ir-checks/prior-cycle.js +21 -0
- package/dist/_internal/ir-checks/read-classification.d.ts +12 -0
- package/dist/_internal/ir-checks/read-classification.js +67 -0
- package/dist/_internal/ir-checks/read-types.d.ts +2 -0
- package/dist/_internal/ir-checks/read-types.js +40 -0
- package/dist/_internal/ir-checks/resource-proofs.d.ts +4 -0
- package/dist/_internal/ir-checks/resource-proofs.js +98 -0
- package/dist/_internal/ir-checks/resources.d.ts +3 -0
- package/dist/_internal/ir-checks/resources.js +30 -0
- package/dist/_internal/ir-checks/reuse.d.ts +10 -0
- package/dist/_internal/ir-checks/reuse.js +99 -0
- package/dist/_internal/ir-checks/sealing.d.ts +14 -0
- package/dist/_internal/ir-checks/sealing.js +123 -0
- package/dist/_internal/ir-checks/sensitive-flow.d.ts +4 -0
- package/dist/_internal/ir-checks/sensitive-flow.js +240 -0
- package/dist/_internal/ir-checks/sensitivity.d.ts +19 -0
- package/dist/_internal/ir-checks/sensitivity.js +133 -0
- package/dist/_internal/ir-checks/signatures.d.ts +4 -0
- package/dist/_internal/ir-checks/signatures.js +22 -0
- package/dist/_internal/ir-checks/vaults.d.ts +10 -0
- package/dist/_internal/ir-checks/vaults.js +140 -0
- package/dist/_internal/protocol/index.d.ts +1234 -0
- package/dist/_internal/protocol/index.js +215 -0
- package/dist/_internal/reconciler/action-intents.d.ts +17 -0
- package/dist/_internal/reconciler/action-intents.js +161 -0
- package/dist/_internal/reconciler/actions.d.ts +7 -0
- package/dist/_internal/reconciler/actions.js +134 -0
- package/dist/_internal/reconciler/amendments.d.ts +12 -0
- package/dist/_internal/reconciler/amendments.js +52 -0
- package/dist/_internal/reconciler/basis.d.ts +253 -0
- package/dist/_internal/reconciler/basis.js +16 -0
- package/dist/_internal/reconciler/bundles.d.ts +22 -0
- package/dist/_internal/reconciler/bundles.js +110 -0
- package/dist/_internal/reconciler/change-detection.d.ts +5 -0
- package/dist/_internal/reconciler/change-detection.js +82 -0
- package/dist/_internal/reconciler/collection-rules.d.ts +7 -0
- package/dist/_internal/reconciler/collection-rules.js +46 -0
- package/dist/_internal/reconciler/collection-state.d.ts +11 -0
- package/dist/_internal/reconciler/collection-state.js +62 -0
- package/dist/_internal/reconciler/collection-values.d.ts +5 -0
- package/dist/_internal/reconciler/collection-values.js +60 -0
- package/dist/_internal/reconciler/collections.d.ts +35 -0
- package/dist/_internal/reconciler/collections.js +141 -0
- package/dist/_internal/reconciler/commands.d.ts +60 -0
- package/dist/_internal/reconciler/commands.js +468 -0
- package/dist/_internal/reconciler/component-operations.d.ts +48 -0
- package/dist/_internal/reconciler/component-operations.js +256 -0
- package/dist/_internal/reconciler/context.d.ts +38 -0
- package/dist/_internal/reconciler/context.js +44 -0
- package/dist/_internal/reconciler/coverage.d.ts +31 -0
- package/dist/_internal/reconciler/coverage.js +124 -0
- package/dist/_internal/reconciler/dates.d.ts +38 -0
- package/dist/_internal/reconciler/dates.js +121 -0
- package/dist/_internal/reconciler/decide.d.ts +25 -0
- package/dist/_internal/reconciler/decide.js +263 -0
- package/dist/_internal/reconciler/decision-evaluation.d.ts +9 -0
- package/dist/_internal/reconciler/decision-evaluation.js +67 -0
- package/dist/_internal/reconciler/decision-records.d.ts +14 -0
- package/dist/_internal/reconciler/decision-records.js +77 -0
- package/dist/_internal/reconciler/decision-release.d.ts +3 -0
- package/dist/_internal/reconciler/decision-release.js +12 -0
- package/dist/_internal/reconciler/dependencies.d.ts +179 -0
- package/dist/_internal/reconciler/dependencies.js +372 -0
- package/dist/_internal/reconciler/discovery.d.ts +9 -0
- package/dist/_internal/reconciler/discovery.js +65 -0
- package/dist/_internal/reconciler/document-corrections.d.ts +18 -0
- package/dist/_internal/reconciler/document-corrections.js +59 -0
- package/dist/_internal/reconciler/documents.d.ts +26 -0
- package/dist/_internal/reconciler/documents.js +88 -0
- package/dist/_internal/reconciler/effective.d.ts +6 -0
- package/dist/_internal/reconciler/effective.js +17 -0
- package/dist/_internal/reconciler/escalations.d.ts +4 -0
- package/dist/_internal/reconciler/escalations.js +76 -0
- package/dist/_internal/reconciler/evaluation.d.ts +56 -0
- package/dist/_internal/reconciler/evaluation.js +704 -0
- package/dist/_internal/reconciler/evidence-authority.d.ts +6 -0
- package/dist/_internal/reconciler/evidence-authority.js +70 -0
- package/dist/_internal/reconciler/evidence-history.d.ts +5 -0
- package/dist/_internal/reconciler/evidence-history.js +22 -0
- package/dist/_internal/reconciler/evidence-validity.d.ts +17 -0
- package/dist/_internal/reconciler/evidence-validity.js +135 -0
- package/dist/_internal/reconciler/fact-validation.d.ts +5 -0
- package/dist/_internal/reconciler/fact-validation.js +49 -0
- package/dist/_internal/reconciler/files.d.ts +9 -0
- package/dist/_internal/reconciler/files.js +56 -0
- package/dist/_internal/reconciler/graph.d.ts +40 -0
- package/dist/_internal/reconciler/graph.js +298 -0
- package/dist/_internal/reconciler/holds.d.ts +6 -0
- package/dist/_internal/reconciler/holds.js +18 -0
- package/dist/_internal/reconciler/home-definitions.d.ts +11 -0
- package/dist/_internal/reconciler/home-definitions.js +25 -0
- package/dist/_internal/reconciler/homes.d.ts +6 -0
- package/dist/_internal/reconciler/homes.js +32 -0
- package/dist/_internal/reconciler/index.d.ts +42 -0
- package/dist/_internal/reconciler/index.js +58 -0
- package/dist/_internal/reconciler/instants.d.ts +17 -0
- package/dist/_internal/reconciler/instants.js +56 -0
- package/dist/_internal/reconciler/interaction-fields.d.ts +10 -0
- package/dist/_internal/reconciler/interaction-fields.js +30 -0
- package/dist/_internal/reconciler/invariants.d.ts +8 -0
- package/dist/_internal/reconciler/invariants.js +34 -0
- package/dist/_internal/reconciler/journal.d.ts +3 -0
- package/dist/_internal/reconciler/journal.js +4 -0
- package/dist/_internal/reconciler/linking.d.ts +10 -0
- package/dist/_internal/reconciler/linking.js +259 -0
- package/dist/_internal/reconciler/memory.d.ts +32 -0
- package/dist/_internal/reconciler/memory.js +190 -0
- package/dist/_internal/reconciler/milestones.d.ts +7 -0
- package/dist/_internal/reconciler/milestones.js +58 -0
- package/dist/_internal/reconciler/missing.d.ts +18 -0
- package/dist/_internal/reconciler/missing.js +79 -0
- package/dist/_internal/reconciler/model.d.ts +350 -0
- package/dist/_internal/reconciler/model.js +9 -0
- package/dist/_internal/reconciler/notices.d.ts +14 -0
- package/dist/_internal/reconciler/notices.js +80 -0
- package/dist/_internal/reconciler/occurrences.d.ts +3 -0
- package/dist/_internal/reconciler/occurrences.js +30 -0
- package/dist/_internal/reconciler/outputs.d.ts +12 -0
- package/dist/_internal/reconciler/outputs.js +132 -0
- package/dist/_internal/reconciler/parameters.d.ts +4 -0
- package/dist/_internal/reconciler/parameters.js +27 -0
- package/dist/_internal/reconciler/policies.d.ts +22 -0
- package/dist/_internal/reconciler/policies.js +94 -0
- package/dist/_internal/reconciler/policy-edits.d.ts +11 -0
- package/dist/_internal/reconciler/policy-edits.js +42 -0
- package/dist/_internal/reconciler/policy-linking.d.ts +4 -0
- package/dist/_internal/reconciler/policy-linking.js +104 -0
- package/dist/_internal/reconciler/principal-types.d.ts +2 -0
- package/dist/_internal/reconciler/principal-types.js +38 -0
- package/dist/_internal/reconciler/prior-decisions.d.ts +3 -0
- package/dist/_internal/reconciler/prior-decisions.js +34 -0
- package/dist/_internal/reconciler/projections.d.ts +4 -0
- package/dist/_internal/reconciler/projections.js +85 -0
- package/dist/_internal/reconciler/proofs.d.ts +9 -0
- package/dist/_internal/reconciler/proofs.js +24 -0
- package/dist/_internal/reconciler/properties.d.ts +25 -0
- package/dist/_internal/reconciler/properties.js +67 -0
- package/dist/_internal/reconciler/property-eval.d.ts +5 -0
- package/dist/_internal/reconciler/property-eval.js +101 -0
- package/dist/_internal/reconciler/property-generator.d.ts +9 -0
- package/dist/_internal/reconciler/property-generator.js +288 -0
- package/dist/_internal/reconciler/property-shrink.d.ts +14 -0
- package/dist/_internal/reconciler/property-shrink.js +183 -0
- package/dist/_internal/reconciler/provenance.d.ts +8 -0
- package/dist/_internal/reconciler/provenance.js +61 -0
- package/dist/_internal/reconciler/reconcile.d.ts +32 -0
- package/dist/_internal/reconciler/reconcile.js +164 -0
- package/dist/_internal/reconciler/recurrence.d.ts +9 -0
- package/dist/_internal/reconciler/recurrence.js +44 -0
- package/dist/_internal/reconciler/requirements.d.ts +5 -0
- package/dist/_internal/reconciler/requirements.js +331 -0
- package/dist/_internal/reconciler/resource-generation.d.ts +9 -0
- package/dist/_internal/reconciler/resource-generation.js +17 -0
- package/dist/_internal/reconciler/resource-scenarios.d.ts +26 -0
- package/dist/_internal/reconciler/resource-scenarios.js +78 -0
- package/dist/_internal/reconciler/resources.d.ts +24 -0
- package/dist/_internal/reconciler/resources.js +178 -0
- package/dist/_internal/reconciler/result-digest.d.ts +13 -0
- package/dist/_internal/reconciler/result-digest.js +66 -0
- package/dist/_internal/reconciler/reuse.d.ts +16 -0
- package/dist/_internal/reconciler/reuse.js +119 -0
- package/dist/_internal/reconciler/scenarios.d.ts +32 -0
- package/dist/_internal/reconciler/scenarios.js +442 -0
- package/dist/_internal/reconciler/scheduling.d.ts +9 -0
- package/dist/_internal/reconciler/scheduling.js +203 -0
- package/dist/_internal/reconciler/sha256.d.ts +1 -0
- package/dist/_internal/reconciler/sha256.js +1 -0
- package/dist/_internal/reconciler/signatures.d.ts +13 -0
- package/dist/_internal/reconciler/signatures.js +37 -0
- package/dist/_internal/reconciler/temporal.d.ts +10 -0
- package/dist/_internal/reconciler/temporal.js +46 -0
- package/dist/_internal/reconciler/upgrades.d.ts +6 -0
- package/dist/_internal/reconciler/upgrades.js +65 -0
- package/dist/_internal/reconciler/wire.d.ts +2 -0
- package/dist/_internal/reconciler/wire.js +5 -0
- package/dist/_internal/reconciler/work.d.ts +32 -0
- package/dist/_internal/reconciler/work.js +101 -0
- package/dist/_internal/world-ir/schema.generated.d.ts +180 -0
- package/dist/_internal/world-ir/schema.generated.js +1127 -0
- package/dist/_internal/world-ir/types.generated.d.ts +1011 -0
- package/dist/_internal/world-ir/types.generated.js +1 -0
- package/dist/authoring.d.ts +9 -0
- package/dist/authoring.js +10 -0
- package/dist/catalogue.d.ts +20 -0
- package/dist/catalogue.js +531 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +553 -0
- package/dist/codegen.d.ts +6 -0
- package/dist/codegen.js +89 -0
- package/dist/coverage.d.ts +60 -0
- package/dist/coverage.js +128 -0
- package/dist/deploy.d.ts +21 -0
- package/dist/deploy.js +72 -0
- package/dist/diagnostics.d.ts +9 -0
- package/dist/diagnostics.js +37 -0
- package/dist/diff.d.ts +17 -0
- package/dist/diff.js +19 -0
- package/dist/durable-object.d.ts +14 -0
- package/dist/durable-object.js +30 -0
- package/dist/explain.d.ts +113 -0
- package/dist/explain.js +225 -0
- package/dist/fixes.d.ts +4 -0
- package/dist/fixes.js +70 -0
- package/dist/fmt.d.ts +12 -0
- package/dist/fmt.js +39 -0
- package/dist/handle/open.d.ts +18 -0
- package/dist/handle/open.js +28 -0
- package/dist/handle/protocol.d.ts +12 -0
- package/dist/handle/protocol.js +96 -0
- package/dist/handle/store.d.ts +31 -0
- package/dist/handle/store.js +11 -0
- package/dist/handle/types.d.ts +37 -0
- package/dist/handle/types.js +1 -0
- package/dist/handle/world.d.ts +190 -0
- package/dist/handle/world.js +533 -0
- package/dist/http.d.ts +3 -0
- package/dist/http.js +72 -0
- package/dist/impact.d.ts +21 -0
- package/dist/impact.js +57 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +43 -0
- package/dist/init.d.ts +13 -0
- package/dist/init.js +99 -0
- package/dist/ir-schema.json +4213 -0
- package/dist/lints.d.ts +8 -0
- package/dist/lints.js +154 -0
- package/dist/lsp.d.ts +14 -0
- package/dist/lsp.js +380 -0
- package/dist/manual/catalog.d.ts +12 -0
- package/dist/manual/catalog.js +23 -0
- package/dist/manual/examples.d.ts +15 -0
- package/dist/manual/examples.js +39 -0
- package/dist/manual/projections.d.ts +77 -0
- package/dist/manual/projections.js +344 -0
- package/dist/manual/prose.d.ts +19 -0
- package/dist/manual/prose.js +215 -0
- package/dist/manual/render.d.ts +76 -0
- package/dist/manual/render.js +250 -0
- package/dist/manual/text.d.ts +7 -0
- package/dist/manual/text.js +15 -0
- package/dist/mcp.d.ts +32 -0
- package/dist/mcp.js +269 -0
- package/dist/mutate.d.ts +36 -0
- package/dist/mutate.js +123 -0
- package/dist/project.d.ts +26 -0
- package/dist/project.js +80 -0
- package/dist/refine.d.ts +18 -0
- package/dist/refine.js +197 -0
- package/dist/release/diff.d.ts +45 -0
- package/dist/release/diff.js +103 -0
- package/dist/release/impact.d.ts +83 -0
- package/dist/release/impact.js +214 -0
- package/dist/release/nodes.d.ts +20 -0
- package/dist/release/nodes.js +118 -0
- package/dist/render.d.ts +19 -0
- package/dist/render.js +43 -0
- package/dist/serve.d.ts +18 -0
- package/dist/serve.js +140 -0
- package/dist/snapshot.d.ts +19 -0
- package/dist/snapshot.js +45 -0
- package/dist/sqlite.d.ts +16 -0
- package/dist/sqlite.js +151 -0
- package/dist/test.d.ts +54 -0
- package/dist/test.js +131 -0
- package/dist/world.d.ts +7 -0
- package/dist/world.js +5 -0
- package/docs/authoring/vendor-risk/example.forma +11 -0
- package/docs/authoring/vendor-risk/library/vendor.forma +76 -0
- package/docs/authoring/vendor-risk/scenarios/reviews.forma +107 -0
- package/docs/protocol.md +195 -0
- package/docs/reference.md +258 -0
- package/package.json +81 -3
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Citation, Expr, SourceFile, Span, WorldIR } from "../_internal/forma/world/index.js";
|
|
2
|
+
import { type Description } from "./prose.js";
|
|
3
|
+
export { describe } from "./prose.js";
|
|
4
|
+
export type { Description, Context } from "./prose.js";
|
|
5
|
+
import { type RequirementExample } from "./examples.js";
|
|
6
|
+
export interface CitationView {
|
|
7
|
+
readonly title: string;
|
|
8
|
+
readonly clause: string;
|
|
9
|
+
readonly kind: string;
|
|
10
|
+
readonly asOf: string;
|
|
11
|
+
readonly url: string | null;
|
|
12
|
+
readonly caveat: string;
|
|
13
|
+
readonly at: Span;
|
|
14
|
+
}
|
|
15
|
+
export declare const citationView: (ir: WorldIR, cite: Citation) => CitationView;
|
|
16
|
+
export interface RequirementView {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly component: string;
|
|
19
|
+
readonly title: string;
|
|
20
|
+
readonly at: Span;
|
|
21
|
+
readonly rows: readonly {
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly description: Description;
|
|
24
|
+
}[];
|
|
25
|
+
readonly citations: readonly CitationView[];
|
|
26
|
+
readonly examples: readonly string[];
|
|
27
|
+
readonly exampleDetails: readonly RequirementExample[];
|
|
28
|
+
readonly actions: readonly {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly title: string;
|
|
31
|
+
readonly interaction: string | null;
|
|
32
|
+
readonly at: Span;
|
|
33
|
+
}[];
|
|
34
|
+
}
|
|
35
|
+
export declare const projectRequirements: (ir: WorldIR, files: readonly SourceFile[]) => readonly RequirementView[];
|
|
36
|
+
export interface RecordView {
|
|
37
|
+
readonly id: string;
|
|
38
|
+
readonly kind: string;
|
|
39
|
+
readonly title: string;
|
|
40
|
+
readonly doc: string;
|
|
41
|
+
readonly at: Span;
|
|
42
|
+
readonly component: string;
|
|
43
|
+
readonly rows: readonly {
|
|
44
|
+
readonly label: string;
|
|
45
|
+
readonly description: Description;
|
|
46
|
+
}[];
|
|
47
|
+
readonly citations: readonly CitationView[];
|
|
48
|
+
}
|
|
49
|
+
export declare const projectPeople: (ir: WorldIR, files: readonly SourceFile[]) => readonly RecordView[];
|
|
50
|
+
export declare const projectHomes: (ir: WorldIR) => {
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
at: Span;
|
|
54
|
+
key: string;
|
|
55
|
+
home: string;
|
|
56
|
+
owners: string;
|
|
57
|
+
inputs: string;
|
|
58
|
+
edges: {
|
|
59
|
+
name: string;
|
|
60
|
+
target: string;
|
|
61
|
+
mode: "child" | "attach";
|
|
62
|
+
at: Span;
|
|
63
|
+
bindings: readonly {
|
|
64
|
+
readonly input: string;
|
|
65
|
+
readonly expr: Expr;
|
|
66
|
+
}[];
|
|
67
|
+
}[];
|
|
68
|
+
library: string;
|
|
69
|
+
}[];
|
|
70
|
+
export declare const componentPath: (ir: WorldIR, account: string, target: string) => readonly string[];
|
|
71
|
+
export declare const projectManual: (ir: WorldIR, files: readonly SourceFile[], account: string) => {
|
|
72
|
+
account: import("../_internal/world-ir/types.generated.js").Account | undefined;
|
|
73
|
+
used: RequirementView[];
|
|
74
|
+
examples: RequirementView[];
|
|
75
|
+
people: readonly RecordView[];
|
|
76
|
+
sources: readonly import("../_internal/world-ir/types.generated.js").Source[];
|
|
77
|
+
};
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { definitionReferences } from "../_internal/forma/world/index.js";
|
|
2
|
+
import { accountComponents, requirementCards } from "./catalog.js";
|
|
3
|
+
import { firstLine, humanize, safeUrl, sourceTitle } from "./text.js";
|
|
4
|
+
import { describe, actorDescription, sentence } from "./prose.js";
|
|
5
|
+
export { describe } from "./prose.js";
|
|
6
|
+
import { requirementExamples } from "./examples.js";
|
|
7
|
+
const words = (name) => humanize(name).replace(/\//g, " / ");
|
|
8
|
+
const join = (text, parts = []) => ({
|
|
9
|
+
text,
|
|
10
|
+
fallbacks: parts.flatMap((p) => p.fallbacks),
|
|
11
|
+
notes: parts.flatMap((p) => p.notes ?? []),
|
|
12
|
+
});
|
|
13
|
+
export const citationView = (ir, cite) => {
|
|
14
|
+
const source = ir.references?.find((s) => s.name === cite.source);
|
|
15
|
+
return {
|
|
16
|
+
title: source ? sourceTitle(source) : words(cite.source),
|
|
17
|
+
clause: cite.clause.replace(/\s*\(illustrative mapping\)/gi, ""),
|
|
18
|
+
kind: source?.kind ?? "undeclared source",
|
|
19
|
+
asOf: source?.asOf ?? "unknown",
|
|
20
|
+
url: source ? safeUrl(source.url) : null,
|
|
21
|
+
caveat: source?.doc ?? "",
|
|
22
|
+
at: cite.at,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export const projectRequirements = (ir, files) => {
|
|
26
|
+
const refs = definitionReferences(ir);
|
|
27
|
+
return requirementCards(ir).map(({ id, component: c, requirement: r, at }) => {
|
|
28
|
+
const actions = c.actions.filter((a) => (Array.isArray(a.advances) ? a.advances : [a.advances]).includes(r.name));
|
|
29
|
+
const ctx = { ir, files, component: c, actors: actions };
|
|
30
|
+
const timing = [];
|
|
31
|
+
if (r.remind)
|
|
32
|
+
timing.push({
|
|
33
|
+
label: "Reminder",
|
|
34
|
+
description: join(`${describe(ctx, r.remind).text} before the due date.`, [
|
|
35
|
+
describe(ctx, r.remind),
|
|
36
|
+
]),
|
|
37
|
+
});
|
|
38
|
+
if (r.recur)
|
|
39
|
+
timing.push({
|
|
40
|
+
label: "Repeats",
|
|
41
|
+
description: join(`Every ${r.recur.every.n} ${r.recur.every.unit} from ${describe(ctx, r.recur.from).text}; each period keeps independent proof.`, [describe(ctx, r.recur.from)]),
|
|
42
|
+
});
|
|
43
|
+
if (r.effective)
|
|
44
|
+
timing.push({
|
|
45
|
+
label: "Effective",
|
|
46
|
+
description: join(`${r.effective.from ? `From ${r.effective.from} (inclusive)` : "No fixed start"}${r.effective.until ? ` until ${r.effective.until} (exclusive)` : "; no fixed end"}.`),
|
|
47
|
+
});
|
|
48
|
+
const evidenceRefs = new Set();
|
|
49
|
+
const visit = (value) => {
|
|
50
|
+
if (!value || typeof value !== "object")
|
|
51
|
+
return;
|
|
52
|
+
if (Array.isArray(value)) {
|
|
53
|
+
value.forEach(visit);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const object = value;
|
|
57
|
+
if (object.k === "ref" && object.kind === "evidence")
|
|
58
|
+
evidenceRefs.add(String(object.name));
|
|
59
|
+
for (const [key, v] of Object.entries(object))
|
|
60
|
+
if (key !== "at")
|
|
61
|
+
visit(v);
|
|
62
|
+
};
|
|
63
|
+
visit(r.satisfiedBy);
|
|
64
|
+
for (const name of evidenceRefs) {
|
|
65
|
+
const evidence = ir.evidence.find((e) => e.name === name);
|
|
66
|
+
if (evidence?.expires)
|
|
67
|
+
timing.push({ label: "Proof expires", description: describe(ctx, evidence.expires) });
|
|
68
|
+
}
|
|
69
|
+
if (r.renewWithin)
|
|
70
|
+
timing.push({
|
|
71
|
+
label: "Renewal",
|
|
72
|
+
description: join(`New work ${r.renewWithin.n} ${r.renewWithin.unit} before proof expires; current proof remains in history.`),
|
|
73
|
+
});
|
|
74
|
+
if (r.accepts)
|
|
75
|
+
timing.push({
|
|
76
|
+
label: "Prior proof",
|
|
77
|
+
description: join(`Prior-cycle proof may be offered${r.accepts.within ? ` within ${describe(ctx, r.accepts.within).text}` : ""}${r.accepts.confirm ? `, confirmed by ${describe(ctx, r.accepts.confirm).text}` : " under its declared acceptance rule"}.`),
|
|
78
|
+
});
|
|
79
|
+
if (r.reuse)
|
|
80
|
+
timing.push({
|
|
81
|
+
label: "Reuse",
|
|
82
|
+
description: join(`Proof may be shared within ${r.reuse.within.n} ${r.reuse.within.unit}${r.reuse.confirm ? `, confirmed by ${describe(ctx, r.reuse.confirm).text}` : " under the declared scope"}.`),
|
|
83
|
+
});
|
|
84
|
+
const examples = requirementExamples(ir, c.name, r.name, (refs.get(id) ?? []).filter((ref) => ref.kind === "scenario").map((ref) => ref.name));
|
|
85
|
+
return {
|
|
86
|
+
id,
|
|
87
|
+
component: c.name,
|
|
88
|
+
title: r.label ?? words(r.name),
|
|
89
|
+
at,
|
|
90
|
+
rows: [
|
|
91
|
+
{
|
|
92
|
+
label: "Done when",
|
|
93
|
+
description: describe({ ...ctx, conditionOnly: true }, r.satisfiedBy),
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: "Who",
|
|
97
|
+
description: actions.length
|
|
98
|
+
? join(actions
|
|
99
|
+
.map((a) => actorDescription(ctx, a.assignee, a.assigneeKind).text)
|
|
100
|
+
.join("; "), actions.map((a) => actorDescription(ctx, a.assignee, a.assigneeKind)))
|
|
101
|
+
: join("No action is declared. Read the condition and any awaited signal in source."),
|
|
102
|
+
},
|
|
103
|
+
{ label: "Due", description: sentence(describe(ctx, r.due, "No explicit deadline.")) },
|
|
104
|
+
...(r.appliesWhen
|
|
105
|
+
? [{ label: "Applies when", description: describe(ctx, r.appliesWhen) }]
|
|
106
|
+
: []),
|
|
107
|
+
...timing,
|
|
108
|
+
],
|
|
109
|
+
citations: (r.cites ?? []).map((cite) => citationView(ir, cite)),
|
|
110
|
+
examples: examples.map((e) => e.name),
|
|
111
|
+
exampleDetails: examples,
|
|
112
|
+
actions: actions.map((a) => ({
|
|
113
|
+
name: a.name,
|
|
114
|
+
title: a.label ?? words(a.name),
|
|
115
|
+
interaction: a.via.kind === "interaction" ? a.via.name : null,
|
|
116
|
+
at: a.at,
|
|
117
|
+
})),
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
export const projectPeople = (ir, files) => {
|
|
122
|
+
const records = [];
|
|
123
|
+
for (const c of ir.components)
|
|
124
|
+
for (const a of c.actions) {
|
|
125
|
+
const ctx = { ir, files, component: c }, via = a.via;
|
|
126
|
+
records.push({
|
|
127
|
+
id: `${c.name}/${a.name}`,
|
|
128
|
+
kind: "Action",
|
|
129
|
+
component: c.name,
|
|
130
|
+
title: a.label ?? words(a.name),
|
|
131
|
+
doc: c.doc ?? "",
|
|
132
|
+
at: a.at,
|
|
133
|
+
citations: [],
|
|
134
|
+
rows: [
|
|
135
|
+
{ label: "Who", description: actorDescription(ctx, a.assignee, a.assigneeKind) },
|
|
136
|
+
{
|
|
137
|
+
label: "Advances",
|
|
138
|
+
description: join((Array.isArray(a.advances) ? a.advances : [a.advances])
|
|
139
|
+
.map((name) => c.requirements.find((r) => r.name === name)?.label ?? words(name))
|
|
140
|
+
.join("; ")),
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
label: "Needs",
|
|
144
|
+
description: join(a.needs.map((n) => describe(ctx, n.expr).text).join("; ") || "No additional gate.", a.needs.map((n) => describe(ctx, n.expr))),
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
label: "Via",
|
|
148
|
+
description: join(via.kind === "interaction"
|
|
149
|
+
? (ir.interactions.find((i) => i.name === via.name)?.doc ?? words(via.name))
|
|
150
|
+
: `${words(via.connector)} / ${words(via.capability)}`),
|
|
151
|
+
},
|
|
152
|
+
...(a.dispatch || a.onIneligible
|
|
153
|
+
? [
|
|
154
|
+
{
|
|
155
|
+
label: "Dispatch",
|
|
156
|
+
description: join([
|
|
157
|
+
a.dispatch ? `Dispatch: ${a.dispatch}` : "",
|
|
158
|
+
a.onIneligible ? `If ineligible: ${a.onIneligible}` : "",
|
|
159
|
+
]
|
|
160
|
+
.filter(Boolean)
|
|
161
|
+
.join("; ")),
|
|
162
|
+
},
|
|
163
|
+
]
|
|
164
|
+
: []),
|
|
165
|
+
],
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
for (const c of ir.components) {
|
|
169
|
+
const ctx = { ir, files, component: c };
|
|
170
|
+
for (const invariant of c.invariants)
|
|
171
|
+
records.push({
|
|
172
|
+
id: `${c.name}/${invariant.name}`,
|
|
173
|
+
component: c.name,
|
|
174
|
+
kind: "Prohibition",
|
|
175
|
+
title: words(invariant.name),
|
|
176
|
+
doc: "Admission checks apply while the declared condition holds.",
|
|
177
|
+
at: invariant.at,
|
|
178
|
+
citations: (invariant.cites ?? []).map((cite) => citationView(ir, cite)),
|
|
179
|
+
rows: [
|
|
180
|
+
{
|
|
181
|
+
label: "Forbids",
|
|
182
|
+
description: join(`${words(invariant.forbids.action)} for ${describe(ctx, invariant.forbids.subject).text}`),
|
|
183
|
+
},
|
|
184
|
+
{ label: "While", description: describe(ctx, invariant.while) },
|
|
185
|
+
],
|
|
186
|
+
});
|
|
187
|
+
if (c.retention)
|
|
188
|
+
records.push({
|
|
189
|
+
id: `${c.name}/retention`,
|
|
190
|
+
component: c.name,
|
|
191
|
+
kind: "Retention",
|
|
192
|
+
title: "Record retention",
|
|
193
|
+
doc: "A declared retention deadline does not itself delete evidence.",
|
|
194
|
+
at: c.retention.at,
|
|
195
|
+
citations: (c.retention.cites ?? []).map((cite) => citationView(ir, cite)),
|
|
196
|
+
rows: [
|
|
197
|
+
{ label: "Keep until", description: describe(ctx, c.retention.until) },
|
|
198
|
+
{ label: "Disposition", description: join(c.retention.disposal) },
|
|
199
|
+
],
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
for (const d of ir.decisions ?? []) {
|
|
203
|
+
const ctx = { ir, files, component: ir.components.find((c) => c.name === d.of) };
|
|
204
|
+
records.push({
|
|
205
|
+
id: d.name,
|
|
206
|
+
kind: "Decision",
|
|
207
|
+
component: d.of,
|
|
208
|
+
title: d.doc ? firstLine(d.doc) : words(d.name),
|
|
209
|
+
doc: "Declared human authority; actual membership is checked by the host.",
|
|
210
|
+
at: d.at,
|
|
211
|
+
citations: (d.cites ?? []).map((c) => citationView(ir, c)),
|
|
212
|
+
rows: [
|
|
213
|
+
{ label: "Who", description: describe(ctx, d.by) },
|
|
214
|
+
{ label: "Effect", description: join(`${d.effect} ${words(d.applies)}`) },
|
|
215
|
+
{ label: "Quorum", description: describe(ctx, d.approvals, "1 distinct human") },
|
|
216
|
+
{
|
|
217
|
+
label: "Must differ from",
|
|
218
|
+
description: join((d.distinctFrom ?? []).map((e) => describe(ctx, e).text).join("; ") ||
|
|
219
|
+
"No extra exclusion declared."),
|
|
220
|
+
},
|
|
221
|
+
{ label: "When", description: describe(ctx, d.when, "No additional condition.") },
|
|
222
|
+
{
|
|
223
|
+
label: "Expires",
|
|
224
|
+
description: describe(ctx, d.expires, d.until ? describe(ctx, d.until).text : "No declared expiry."),
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
for (const d of ir.documents ?? [])
|
|
230
|
+
records.push({
|
|
231
|
+
id: d.name,
|
|
232
|
+
kind: "Document",
|
|
233
|
+
component: d.of,
|
|
234
|
+
title: d.title,
|
|
235
|
+
doc: d.doc ?? "",
|
|
236
|
+
at: d.at,
|
|
237
|
+
citations: [],
|
|
238
|
+
rows: [
|
|
239
|
+
{ label: "Edition", description: join(d.edition) },
|
|
240
|
+
{
|
|
241
|
+
label: "Signed sources",
|
|
242
|
+
description: join(d.sources
|
|
243
|
+
.map((s) => ir.evidence.find((e) => e.name === s)?.label ?? words(s))
|
|
244
|
+
.join("; ")),
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
label: "Fields",
|
|
248
|
+
description: join(d.fields.map((f) => `${f.label} ← ${words(f.evidence)} / ${words(f.field)}`).join("; ")),
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
label: "Effective",
|
|
252
|
+
description: join(`${d.effective.from ?? "No fixed start"} → ${d.effective.until ?? "no fixed end"}`),
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
});
|
|
256
|
+
for (const n of ir.notices ?? [])
|
|
257
|
+
records.push({
|
|
258
|
+
id: n.name,
|
|
259
|
+
kind: "Notice",
|
|
260
|
+
component: n.of,
|
|
261
|
+
title: n.doc ? firstLine(n.doc) : words(n.name),
|
|
262
|
+
doc: "Delivery and human acknowledgment are separate observations.",
|
|
263
|
+
at: n.at,
|
|
264
|
+
citations: [],
|
|
265
|
+
rows: [
|
|
266
|
+
{
|
|
267
|
+
label: "Copy of",
|
|
268
|
+
description: join(ir.documents?.find((d) => d.name === n.document)?.title ?? words(n.document)),
|
|
269
|
+
},
|
|
270
|
+
{ label: "Recipient", description: describe({ ir, files }, n.to) },
|
|
271
|
+
],
|
|
272
|
+
});
|
|
273
|
+
return records;
|
|
274
|
+
};
|
|
275
|
+
const homeRole = (ir, c, path = c.home.path, seen = new Set()) => {
|
|
276
|
+
const key = `${c.name}/${path.join(".")}`;
|
|
277
|
+
if (seen.has(key))
|
|
278
|
+
return null;
|
|
279
|
+
const field = c.inputs.find((f) => f.name === path[0]);
|
|
280
|
+
if (!field)
|
|
281
|
+
return null;
|
|
282
|
+
let type = field.type;
|
|
283
|
+
if (Array.isArray(type) && type[0] === "Option")
|
|
284
|
+
type = type[1];
|
|
285
|
+
if (!Array.isArray(type) || type[0] !== "Id" || typeof type[1] !== "string")
|
|
286
|
+
return null;
|
|
287
|
+
const target = ir.components.find((component) => component.name === type[1]);
|
|
288
|
+
return target
|
|
289
|
+
? homeRole(ir, target, path.length > 1 ? path.slice(1) : target.home.path, new Set([...seen, key]))
|
|
290
|
+
: type[1];
|
|
291
|
+
};
|
|
292
|
+
export const projectHomes = (ir) => ir.components.map((c) => ({
|
|
293
|
+
id: c.name,
|
|
294
|
+
title: c.doc ? firstLine(c.doc) : words(c.name),
|
|
295
|
+
at: c.at,
|
|
296
|
+
key: c.key.join(" × "),
|
|
297
|
+
home: c.home.path.join(" → "),
|
|
298
|
+
owners: ir.entities
|
|
299
|
+
.filter((e) => e.name === homeRole(ir, c) || e.implements.some((b) => b.role === homeRole(ir, c)))
|
|
300
|
+
.map((e) => words(e.name))
|
|
301
|
+
.join(" / ") || `Declared role: ${homeRole(ir, c) ?? "unresolved; read source"}`,
|
|
302
|
+
inputs: c.inputs
|
|
303
|
+
.map((i) => `${words(i.name)}: ${Array.isArray(i.type) ? i.type.join(" ") : i.type}`)
|
|
304
|
+
.join("; "),
|
|
305
|
+
edges: c.slots.map((s) => ({
|
|
306
|
+
name: s.name,
|
|
307
|
+
target: s.component,
|
|
308
|
+
mode: s.mode,
|
|
309
|
+
at: s.at,
|
|
310
|
+
bindings: s.bind,
|
|
311
|
+
})),
|
|
312
|
+
library: c.library ?? "local package",
|
|
313
|
+
}));
|
|
314
|
+
export const componentPath = (ir, account, target) => {
|
|
315
|
+
const visit = (name, path) => {
|
|
316
|
+
if (path.includes(name))
|
|
317
|
+
return [];
|
|
318
|
+
const next = [...path, name];
|
|
319
|
+
if (name === target)
|
|
320
|
+
return next;
|
|
321
|
+
for (const slot of ir.components.find((c) => c.name === name)?.slots ?? []) {
|
|
322
|
+
const found = visit(slot.component, next);
|
|
323
|
+
if (found.length)
|
|
324
|
+
return found;
|
|
325
|
+
}
|
|
326
|
+
return [];
|
|
327
|
+
};
|
|
328
|
+
for (const root of ir.accounts.find((a) => a.name === account)?.forEach ?? []) {
|
|
329
|
+
const found = visit(root.component, []);
|
|
330
|
+
if (found.length)
|
|
331
|
+
return found;
|
|
332
|
+
}
|
|
333
|
+
return [];
|
|
334
|
+
};
|
|
335
|
+
export const projectManual = (ir, files, account) => {
|
|
336
|
+
const used = accountComponents(ir, account), requirements = projectRequirements(ir, files);
|
|
337
|
+
return {
|
|
338
|
+
account: ir.accounts.find((a) => a.name === account),
|
|
339
|
+
used: requirements.filter((r) => used.has(r.component)),
|
|
340
|
+
examples: requirements.filter((r) => !used.has(r.component)),
|
|
341
|
+
people: projectPeople(ir, files),
|
|
342
|
+
sources: ir.references ?? [],
|
|
343
|
+
};
|
|
344
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Action, Component, Expr, SourceFile, WorldIR } from "../_internal/forma/world/index.js";
|
|
2
|
+
export interface Description {
|
|
3
|
+
readonly text: string;
|
|
4
|
+
readonly fallbacks: readonly {
|
|
5
|
+
readonly at: Expr["at"];
|
|
6
|
+
readonly text: string;
|
|
7
|
+
}[];
|
|
8
|
+
readonly notes?: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
export interface Context {
|
|
11
|
+
readonly ir: WorldIR;
|
|
12
|
+
readonly files: readonly SourceFile[];
|
|
13
|
+
readonly component?: Component;
|
|
14
|
+
readonly actors?: readonly Action[];
|
|
15
|
+
readonly conditionOnly?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const sentence: (d: Description) => Description;
|
|
18
|
+
export declare const actorDescription: (ctx: Context, expr: Expr | undefined, kind?: string) => Description;
|
|
19
|
+
export declare const describe: (ctx: Context, expr: Expr | undefined, absent?: string) => Description;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { firstLine, humanize } from "./text.js";
|
|
2
|
+
const words = (name) => humanize(name)
|
|
3
|
+
.replace(/\//g, " / ")
|
|
4
|
+
.replace(/\b([a-z])(\d+)\b/gi, (_, letter, digits) => `${letter.toUpperCase()}-${digits}`);
|
|
5
|
+
const unitFor = (n, unit) => n === "1" ? unit.replace(/s$/, "") : unit;
|
|
6
|
+
const fragment = (text) => text.replace(/[.!?]+$/u, "").replace(/^[A-Z](?=[a-z])/, (c) => c.toLowerCase());
|
|
7
|
+
const join = (text, parts = []) => ({
|
|
8
|
+
text,
|
|
9
|
+
fallbacks: parts.flatMap((p) => p.fallbacks),
|
|
10
|
+
notes: [...new Set(parts.flatMap((p) => p.notes ?? []))],
|
|
11
|
+
});
|
|
12
|
+
const phrase = (doc, name) => {
|
|
13
|
+
const first = firstLine(doc)
|
|
14
|
+
.split(":")[0]
|
|
15
|
+
.trim()
|
|
16
|
+
.replace(/[.!?]+$/u, "");
|
|
17
|
+
return fragment(first.length <= 75 ? first : words(name).replace(/\?$/, ""));
|
|
18
|
+
};
|
|
19
|
+
export const sentence = (d) => ({
|
|
20
|
+
...d,
|
|
21
|
+
text: `${d.text.replace(/^[a-z]/, (c) => c.toUpperCase()).replace(/[.!?]+$/u, "")}.`,
|
|
22
|
+
});
|
|
23
|
+
export const actorDescription = (ctx, expr, kind) => {
|
|
24
|
+
if (!expr)
|
|
25
|
+
return join("No assignee declared");
|
|
26
|
+
if (expr.k === "var")
|
|
27
|
+
return join(`the ${words(expr.name)}`);
|
|
28
|
+
if (expr.k === "call" && expr.fn === "members" && expr.args[0]) {
|
|
29
|
+
const group = expr.args[0];
|
|
30
|
+
if (group.k === "read" || group.k === "attr") {
|
|
31
|
+
const field = words(group.k === "read" ? group.field : group.attr.split("/").at(-1));
|
|
32
|
+
const owner = describe(ctx, group.of).text;
|
|
33
|
+
if (/\b(reviewers|approvers|owners|operators|leads|managers|admins|developers)$/.test(field)) {
|
|
34
|
+
const role = field.replace(/s$/u, "");
|
|
35
|
+
return join(`${/^[aeiou]/i.test(role) ? "an" : "a"} ${role} ${/employer|company|organization/.test(owner) ? "at" : "for"} the ${owner}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const value = describe(ctx, group);
|
|
39
|
+
return join(`a member of ${value.text}`, [value]);
|
|
40
|
+
}
|
|
41
|
+
const value = describe(ctx, expr);
|
|
42
|
+
return join(`${kind === "group" ? "a member of " : "the "}${value.text}`, [value]);
|
|
43
|
+
};
|
|
44
|
+
export const describe = (ctx, expr, absent = "Not declared.") => {
|
|
45
|
+
if (!expr)
|
|
46
|
+
return join(absent);
|
|
47
|
+
const child = (e) => describe(ctx, e);
|
|
48
|
+
const fallback = () => ({
|
|
49
|
+
text: "Read the declared expression in source.",
|
|
50
|
+
fallbacks: [
|
|
51
|
+
{
|
|
52
|
+
at: expr.at,
|
|
53
|
+
text: ctx.files.find((f) => f.id === expr.at.src)?.text.slice(expr.at.from, expr.at.to) ??
|
|
54
|
+
JSON.stringify(expr),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
});
|
|
58
|
+
switch (expr.k) {
|
|
59
|
+
case "lit":
|
|
60
|
+
return join(expr.v === null ? "unknown" : String(expr.v));
|
|
61
|
+
case "kw":
|
|
62
|
+
return join(words(expr.v));
|
|
63
|
+
case "var": {
|
|
64
|
+
const bound = ctx.component?.paramBounds?.find((p) => p.name === expr.name);
|
|
65
|
+
return bound
|
|
66
|
+
? {
|
|
67
|
+
text: String(bound.default.n),
|
|
68
|
+
fallbacks: [],
|
|
69
|
+
notes: [
|
|
70
|
+
`${bound.name}, default ${bound.default.n}${bound.default.unit === "integer" ? "" : ` ${bound.default.unit}`}`,
|
|
71
|
+
],
|
|
72
|
+
}
|
|
73
|
+
: join(ctx.component?.requirements.find((r) => r.name === expr.name)?.label ??
|
|
74
|
+
words(expr.name));
|
|
75
|
+
}
|
|
76
|
+
case "ref": {
|
|
77
|
+
if (expr.kind === "calendar") {
|
|
78
|
+
const calendar = ctx.ir.calendars.find((c) => c.name === expr.name);
|
|
79
|
+
return {
|
|
80
|
+
text: words(calendar?.name ?? expr.name).replace(/\b[a-z]{2}\b/g, (w) => w.toUpperCase()),
|
|
81
|
+
fallbacks: [],
|
|
82
|
+
notes: calendar ? [`${calendar.doc ?? calendar.name} · version ${calendar.version}`] : [],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return join(ctx.ir.evidence.find((e) => e.name === expr.name)?.label ?? words(expr.name));
|
|
86
|
+
}
|
|
87
|
+
case "read":
|
|
88
|
+
case "attr": {
|
|
89
|
+
const base = child(expr.of);
|
|
90
|
+
return join(`${base.text}’s ${words(expr.k === "read" ? expr.field : expr.attr.split("/").at(-1))}`, [base]);
|
|
91
|
+
}
|
|
92
|
+
case "inst": {
|
|
93
|
+
const base = child(expr.of);
|
|
94
|
+
return join(`${base.text}’s ${words(expr.field)}`, [base]);
|
|
95
|
+
}
|
|
96
|
+
case "list": {
|
|
97
|
+
const parts = expr.items.map(child);
|
|
98
|
+
return join(parts.map((p) => p.text).join(", "), parts);
|
|
99
|
+
}
|
|
100
|
+
case "fn":
|
|
101
|
+
return fallback();
|
|
102
|
+
case "if": {
|
|
103
|
+
const yes = child(expr.then), no = child(expr.else);
|
|
104
|
+
if (expr.test.k === "call" &&
|
|
105
|
+
["false?", "true?"].includes(expr.test.fn) &&
|
|
106
|
+
expr.test.args[0]) {
|
|
107
|
+
const test = child(expr.test.args[0]);
|
|
108
|
+
return join(`${yes.text} when “${fragment(test.text)}” is known ${expr.test.fn === "false?" ? "false" : "true"}; otherwise, including when unknown, ${fragment(no.text)}`, [yes, test, no]);
|
|
109
|
+
}
|
|
110
|
+
const test = child(expr.test);
|
|
111
|
+
return join(`If ${fragment(test.text)}, ${fragment(yes.text)}; otherwise ${fragment(no.text)}`, [test, yes, no]);
|
|
112
|
+
}
|
|
113
|
+
case "call": {
|
|
114
|
+
const parts = expr.args.map(child), a = parts.map((p) => p.text), first = expr.args[0];
|
|
115
|
+
const finish = (text) => join(text, parts);
|
|
116
|
+
if (["attested", "valid"].includes(expr.fn) && first?.k === "ref") {
|
|
117
|
+
const evidence = ctx.ir.evidence.find((e) => e.name === first.name), label = evidence?.label ?? words(first.name);
|
|
118
|
+
if (expr.fn === "valid")
|
|
119
|
+
return finish(`there is current, unexpired attested ${label} evidence`);
|
|
120
|
+
if (ctx.conditionOnly && evidence?.attest)
|
|
121
|
+
return finish(`${label} is signed`);
|
|
122
|
+
let actor = `the ${words(evidence?.attest?.signer ?? "signer")}`;
|
|
123
|
+
if (evidence?.attest?.signer === "assignee") {
|
|
124
|
+
const choices = [
|
|
125
|
+
...new Set((ctx.actors ?? []).map((action) => actorDescription(ctx, action.assignee, action.assigneeKind).text)),
|
|
126
|
+
];
|
|
127
|
+
actor = choices.length ? choices.join(" or ") : "the assigned person";
|
|
128
|
+
}
|
|
129
|
+
return finish(evidence?.attest ? `${actor} signs ${label}` : `there is attested ${label} evidence`);
|
|
130
|
+
}
|
|
131
|
+
switch (expr.fn) {
|
|
132
|
+
case "members":
|
|
133
|
+
return finish(`members of ${a[0]}`);
|
|
134
|
+
case "days":
|
|
135
|
+
case "months":
|
|
136
|
+
case "years":
|
|
137
|
+
case "hours":
|
|
138
|
+
case "minutes":
|
|
139
|
+
return finish(`${a[0]} ${unitFor(a[0], expr.fn)}`);
|
|
140
|
+
case "first":
|
|
141
|
+
return finish(`the first of ${a[0]}`);
|
|
142
|
+
case "earliest":
|
|
143
|
+
case "latest":
|
|
144
|
+
return finish(`the ${expr.fn} of ${a[0]}`);
|
|
145
|
+
case "days-after":
|
|
146
|
+
case "months-after":
|
|
147
|
+
case "years-after":
|
|
148
|
+
case "hours-after":
|
|
149
|
+
case "minutes-after":
|
|
150
|
+
case "days-before": {
|
|
151
|
+
const [unit, direction] = expr.fn.split("-");
|
|
152
|
+
return finish(`${a[1]} ${unitFor(a[1], unit)} ${direction} ${fragment(a[0] ?? "unknown")}`);
|
|
153
|
+
}
|
|
154
|
+
case "business-days-after": {
|
|
155
|
+
const calendar = expr.args.findIndex((arg) => arg.k === "ref" && arg.kind === "calendar");
|
|
156
|
+
return finish(`${a[1]} business ${unitFor(a[1], "days")} after ${fragment(a[0] ?? "unknown")}${calendar >= 0 ? ` (${a[calendar]} calendar)` : ""}`);
|
|
157
|
+
}
|
|
158
|
+
case "=":
|
|
159
|
+
return finish(`${a[0]} is ${a[1]}`);
|
|
160
|
+
case "not=":
|
|
161
|
+
return finish(`${a[0]} differs from ${a[1]}`);
|
|
162
|
+
case "<":
|
|
163
|
+
return finish(`${a[0]} is less than ${a[1]}`);
|
|
164
|
+
case "<=":
|
|
165
|
+
return finish(`${a[0]} is at most ${a[1]}`);
|
|
166
|
+
case ">":
|
|
167
|
+
return finish(`${a[0]} is greater than ${a[1]}`);
|
|
168
|
+
case ">=":
|
|
169
|
+
return finish(`${a[0]} is at least ${a[1]}`);
|
|
170
|
+
case "known?":
|
|
171
|
+
return finish(`${a[0]} is known`);
|
|
172
|
+
case "true?":
|
|
173
|
+
return finish(`“${a[0]}” is known true`);
|
|
174
|
+
case "false?":
|
|
175
|
+
return finish(`“${a[0]}” is known false`);
|
|
176
|
+
case "unknown?":
|
|
177
|
+
return finish(`${a[0]} is unknown`);
|
|
178
|
+
case "negate":
|
|
179
|
+
return finish(`not (${a[0]})`);
|
|
180
|
+
case "all?":
|
|
181
|
+
return finish(`all of: ${a[0] || "no additional conditions"}`);
|
|
182
|
+
case "any?":
|
|
183
|
+
return finish(`at least one of: ${a[0]}`);
|
|
184
|
+
case "in?":
|
|
185
|
+
return finish(`${a[0]} is one of ${a[1]}`);
|
|
186
|
+
case "satisfied?":
|
|
187
|
+
return finish(`${a[0]} is satisfied`);
|
|
188
|
+
case "met?":
|
|
189
|
+
return finish(`${a[0]} is satisfied or does not apply`);
|
|
190
|
+
case "carried-over?":
|
|
191
|
+
return finish(`${a[0]} uses accepted prior proof`);
|
|
192
|
+
case "decided":
|
|
193
|
+
return finish(`the ${a[0]} decision stands`);
|
|
194
|
+
case "notice-delivered?":
|
|
195
|
+
return finish(`${a[0]} has been delivered`);
|
|
196
|
+
case "notice-acknowledged?":
|
|
197
|
+
return finish(`the recipient acknowledges ${a[0]}`);
|
|
198
|
+
case "final?":
|
|
199
|
+
return finish(`${a[0]} reaches a declared final state`);
|
|
200
|
+
case "started?":
|
|
201
|
+
return finish(`${a[0]} has started`);
|
|
202
|
+
case "in-state?":
|
|
203
|
+
return finish(`${a[0]} is in one of these states: ${a[1]}`);
|
|
204
|
+
}
|
|
205
|
+
const derive = ctx.ir.derives.find((d) => d.name === expr.fn);
|
|
206
|
+
if (derive?.doc)
|
|
207
|
+
return {
|
|
208
|
+
text: phrase(derive.doc, derive.name),
|
|
209
|
+
fallbacks: [],
|
|
210
|
+
notes: [derive.doc, ...parts.flatMap((p) => p.notes ?? [])],
|
|
211
|
+
};
|
|
212
|
+
return fallback();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
};
|