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,242 @@
|
|
|
1
|
+
import { advanceTargets } from "../../ir-checks/index.js";
|
|
2
|
+
const walk = (value, f) => {
|
|
3
|
+
if (!value || typeof value !== "object")
|
|
4
|
+
return;
|
|
5
|
+
if (Array.isArray(value)) {
|
|
6
|
+
value.forEach((v) => walk(v, f));
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const object = value;
|
|
10
|
+
f(object);
|
|
11
|
+
for (const [key, child] of Object.entries(object))
|
|
12
|
+
if (key !== "at")
|
|
13
|
+
walk(child, f);
|
|
14
|
+
};
|
|
15
|
+
const references = (set) => [...set].sort().map((key) => {
|
|
16
|
+
const split = key.indexOf("\0");
|
|
17
|
+
return { kind: key.slice(0, split), name: key.slice(split + 1) };
|
|
18
|
+
});
|
|
19
|
+
export const definitionReferences = (ir) => {
|
|
20
|
+
const components = new Map(ir.components.map((c) => [c.name, c]));
|
|
21
|
+
const rows = new Map();
|
|
22
|
+
for (const c of ir.components) {
|
|
23
|
+
for (const r of c.requirements)
|
|
24
|
+
rows.set(`${c.name}/${r.name}`, {
|
|
25
|
+
component: c.name,
|
|
26
|
+
name: r.name,
|
|
27
|
+
kind: "requirement",
|
|
28
|
+
refs: new Set(),
|
|
29
|
+
});
|
|
30
|
+
for (const r of c.invariants)
|
|
31
|
+
rows.set(`${c.name}/invariant:${r.name}`, {
|
|
32
|
+
component: c.name,
|
|
33
|
+
name: r.name,
|
|
34
|
+
kind: "invariant",
|
|
35
|
+
refs: new Set(),
|
|
36
|
+
});
|
|
37
|
+
if (c.retention)
|
|
38
|
+
rows.set(`${c.name}/retention`, {
|
|
39
|
+
component: c.name,
|
|
40
|
+
name: "retention",
|
|
41
|
+
kind: "retention",
|
|
42
|
+
refs: new Set(),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const mark = (component, name, ref, seen = new Set()) => {
|
|
46
|
+
const key = `${component}/${name}`;
|
|
47
|
+
if (seen.has(key))
|
|
48
|
+
return;
|
|
49
|
+
seen.add(key);
|
|
50
|
+
const row = rows.get(key);
|
|
51
|
+
if (row) {
|
|
52
|
+
row.refs.add(ref);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const c = components.get(component), output = c?.outputs.find((o) => o.name === name);
|
|
56
|
+
for (const path of output?.paths ?? []) {
|
|
57
|
+
let owner = c;
|
|
58
|
+
for (const segment of path.segments.slice(0, -1))
|
|
59
|
+
owner = components.get(owner?.slots.find((s) => s.name === segment)?.component ?? "");
|
|
60
|
+
if (owner && path.segments.length)
|
|
61
|
+
mark(owner.name, path.segments.at(-1), ref, seen);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const evidence = (component, name, ref) => {
|
|
65
|
+
for (const r of components.get(component)?.requirements ?? [])
|
|
66
|
+
walk(r.satisfiedBy, (e) => {
|
|
67
|
+
if (e.k === "ref" && e.kind === "evidence" && e.name === name)
|
|
68
|
+
mark(component, r.name, ref);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
const action = (component, name, ref) => {
|
|
72
|
+
if (name.startsWith("accept-reuse:"))
|
|
73
|
+
mark(component, name.slice(13), ref);
|
|
74
|
+
if (name.startsWith("accept-prior:")) {
|
|
75
|
+
const requirement = name.slice(13);
|
|
76
|
+
mark(component, requirement, ref);
|
|
77
|
+
const from = components.get(component)?.requirements.find((r) => r.name === requirement)
|
|
78
|
+
?.accepts?.from;
|
|
79
|
+
if (from)
|
|
80
|
+
mark(component, from, ref);
|
|
81
|
+
}
|
|
82
|
+
const a = components.get(component)?.actions.find((a) => a.name === name);
|
|
83
|
+
if (!a)
|
|
84
|
+
return;
|
|
85
|
+
for (const target of advanceTargets(a))
|
|
86
|
+
mark(component, target, ref);
|
|
87
|
+
walk(a.needs, (e) => {
|
|
88
|
+
if (e.k === "ref" && e.kind === "evidence" && typeof e.name === "string")
|
|
89
|
+
evidence(component, e.name, ref);
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
const predicate = (expr, ref) => walk(expr, (e) => {
|
|
93
|
+
const target = e.target;
|
|
94
|
+
if (e.k === "status" && target && typeof e.name === "string")
|
|
95
|
+
mark(target.component, e.name, ref);
|
|
96
|
+
if (e.k === "attested" && target && typeof e.evidence === "string")
|
|
97
|
+
evidence(target.component, e.evidence, ref);
|
|
98
|
+
});
|
|
99
|
+
for (const p of ir.properties ?? [])
|
|
100
|
+
predicate(p.predicate, `property\0${p.name}`);
|
|
101
|
+
for (const s of ir.scenarios ?? []) {
|
|
102
|
+
const ref = `scenario\0${s.name}`;
|
|
103
|
+
for (const record of s.records ?? [])
|
|
104
|
+
if (record.kind === "evidence")
|
|
105
|
+
mark(record.target.component, record.requirement, ref);
|
|
106
|
+
for (const step of s.steps) {
|
|
107
|
+
for (const command of step.commands ?? []) {
|
|
108
|
+
if (command.kind === "decide") {
|
|
109
|
+
const decision = ir.decisions?.find((d) => d.name === command.decision && d.of === command.target.component);
|
|
110
|
+
if (decision)
|
|
111
|
+
mark(decision.of, decision.applies, ref);
|
|
112
|
+
}
|
|
113
|
+
else if (command.kind === "perform")
|
|
114
|
+
action(command.target.component, command.action, ref);
|
|
115
|
+
else if (command.kind === "accept")
|
|
116
|
+
action(command.target.component, `accept-prior:${command.requirement}`, ref);
|
|
117
|
+
else if (command.kind === "evidence")
|
|
118
|
+
mark(command.target.component, command.requirement, ref);
|
|
119
|
+
else if (command.kind === "signal") {
|
|
120
|
+
for (const r of components.get(command.target.component)?.requirements ?? [])
|
|
121
|
+
walk(r.satisfiedBy, (e) => {
|
|
122
|
+
if (e.k === "var" && e.name === command.machine)
|
|
123
|
+
mark(command.target.component, r.name, ref);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
else if (command.kind === "resource") {
|
|
127
|
+
const c = components.get(command.target.component), r = c?.resources?.find((r) => r.name === command.name);
|
|
128
|
+
if (r && command.phase === "acquire")
|
|
129
|
+
for (const a of c.actions)
|
|
130
|
+
if (a.via.kind === "connector" &&
|
|
131
|
+
a.via.connector === r.acquire.connector &&
|
|
132
|
+
a.via.capability === r.acquire.capability)
|
|
133
|
+
action(c.name, a.name, ref);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
for (const row of rows.values())
|
|
137
|
+
if (row.kind === "invariant" &&
|
|
138
|
+
components
|
|
139
|
+
.get(row.component)
|
|
140
|
+
?.invariants.some((i) => i.name === row.name && i.forbids.action === (command.commandKind ?? "set")))
|
|
141
|
+
row.refs.add(ref);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
for (const expect of step.expects) {
|
|
145
|
+
if (expect.kind === "property") {
|
|
146
|
+
const p = ir.properties?.find((p) => p.name === expect.name && p.world === s.world);
|
|
147
|
+
if (p)
|
|
148
|
+
predicate(p.predicate, ref);
|
|
149
|
+
}
|
|
150
|
+
else if (expect.kind !== "rejected") {
|
|
151
|
+
if (expect.kind === "work")
|
|
152
|
+
action(expect.target.component, expect.name, ref);
|
|
153
|
+
else
|
|
154
|
+
mark(expect.target.component, expect.name, ref);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return new Map([...rows].map(([key, row]) => [key, references(row.refs)]));
|
|
160
|
+
};
|
|
161
|
+
/** Advisory reference analysis deliberately over-approximates reads; it proves no reachability. */
|
|
162
|
+
export const requirementDiagnostics = (ir) => {
|
|
163
|
+
const refs = definitionReferences(ir), consumed = new Set();
|
|
164
|
+
const components = new Map(ir.components.map((c) => [c.name, c]));
|
|
165
|
+
const refType = (type) => {
|
|
166
|
+
if (!Array.isArray(type))
|
|
167
|
+
return [];
|
|
168
|
+
if (type[0] === "Option")
|
|
169
|
+
return refType(type[1]);
|
|
170
|
+
return type[0] === "Id" && typeof type[1] === "string" && components.has(type[1])
|
|
171
|
+
? [type[1]]
|
|
172
|
+
: [];
|
|
173
|
+
};
|
|
174
|
+
const owners = (e, c) => {
|
|
175
|
+
if (e.k === "var") {
|
|
176
|
+
if (e.name === "self")
|
|
177
|
+
return [c.name];
|
|
178
|
+
const slot = c.slots.find((s) => s.name === e.name);
|
|
179
|
+
return slot ? [slot.component] : refType(c.inputs.find((i) => i.name === e.name)?.type);
|
|
180
|
+
}
|
|
181
|
+
if (e.k === "if")
|
|
182
|
+
return [...new Set([...owners(e.then, c), ...owners(e.else, c)])];
|
|
183
|
+
if (e.k === "inst")
|
|
184
|
+
return owners(e.of, c).flatMap((owner) => {
|
|
185
|
+
const component = components.get(owner);
|
|
186
|
+
const slot = component.slots.find((s) => s.name === e.field);
|
|
187
|
+
return slot
|
|
188
|
+
? [slot.component]
|
|
189
|
+
: refType(component.inputs.find((i) => i.name === e.field)?.type);
|
|
190
|
+
});
|
|
191
|
+
return [];
|
|
192
|
+
};
|
|
193
|
+
for (const c of ir.components) {
|
|
194
|
+
for (const output of c.outputs)
|
|
195
|
+
for (const path of output.paths) {
|
|
196
|
+
let owner = c;
|
|
197
|
+
for (const segment of path.segments.slice(0, -1))
|
|
198
|
+
owner = components.get(owner?.slots.find((s) => s.name === segment)?.component ?? "");
|
|
199
|
+
if (owner && path.segments.length)
|
|
200
|
+
consumed.add(`${owner.name}/${path.segments.at(-1)}`);
|
|
201
|
+
}
|
|
202
|
+
walk(c, (e) => {
|
|
203
|
+
if (e.k === "var" && c.requirements.some((r) => r.name === e.name))
|
|
204
|
+
consumed.add(`${c.name}/${String(e.name)}`);
|
|
205
|
+
if (e.k !== "inst" || typeof e.field !== "string")
|
|
206
|
+
return;
|
|
207
|
+
const targets = owners(e.of, c);
|
|
208
|
+
// An indirect owner that cannot be resolved still conservatively consumes that name.
|
|
209
|
+
for (const owner of targets.length ? targets : ir.components.map((c) => c.name))
|
|
210
|
+
consumed.add(`${owner}/${e.field}`);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
// Derive parameters can hide the owning component; treating every matching name as
|
|
214
|
+
// consumed avoids false warnings without enumerating possible runtime occurrences.
|
|
215
|
+
walk(ir.derives, (e) => {
|
|
216
|
+
if (e.k === "inst" && typeof e.field === "string")
|
|
217
|
+
for (const c of ir.components)
|
|
218
|
+
consumed.add(`${c.name}/${e.field}`);
|
|
219
|
+
});
|
|
220
|
+
const diagnostics = [];
|
|
221
|
+
for (const c of ir.components)
|
|
222
|
+
for (const r of c.requirements) {
|
|
223
|
+
const key = `${c.name}/${r.name}`;
|
|
224
|
+
if (!(refs.get(key) ?? []).some((ref) => ref.kind === "scenario"))
|
|
225
|
+
diagnostics.push({
|
|
226
|
+
code: "W_NO_SCENARIO",
|
|
227
|
+
severity: "warning",
|
|
228
|
+
at: r.at,
|
|
229
|
+
message: `${key} has no authored scenario reference.`,
|
|
230
|
+
help: `Add a scenario that observes it, for example (at "<date>" (expect (status (${c.name} <subject>) ${String(r.name)}) :Open)), or one that expects an output containing it or records work or evidence advancing it. Run worldvm coverage to see executed branches. Advisory: check still passes.`,
|
|
231
|
+
});
|
|
232
|
+
if (!consumed.has(key))
|
|
233
|
+
diagnostics.push({
|
|
234
|
+
code: "W_UNREACHABLE_REQUIREMENT",
|
|
235
|
+
severity: "warning",
|
|
236
|
+
at: r.at,
|
|
237
|
+
message: `${key} has no status consumer.`,
|
|
238
|
+
help: `Nothing reads this requirement's status, so no output or parent reports it. Add it to an output, for example (output done (all-of ${String(r.name)} …)), or read it with (satisfied? <component>.${String(r.name)}) from another component; remove it if unintended. Advisory: this is not a reachability proof.`,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
return diagnostics;
|
|
242
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { sha256, canonicalJson, contentDigest } from "../../ir-checks/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { sha256, canonicalJson, contentDigest } from "../../ir-checks/index.js";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** These named declarations are published contracts; private children keep their grammar. */
|
|
2
|
+
export const documentationDiagnostics = (ir) => [
|
|
3
|
+
...ir.libraries,
|
|
4
|
+
...ir.roles,
|
|
5
|
+
...ir.entities,
|
|
6
|
+
...ir.calendars,
|
|
7
|
+
...ir.derives,
|
|
8
|
+
...ir.evidence,
|
|
9
|
+
...(ir.decisions ?? []),
|
|
10
|
+
...ir.interactions,
|
|
11
|
+
...(ir.collects ?? []),
|
|
12
|
+
...(ir.bundles ?? []),
|
|
13
|
+
...(ir.documents ?? []),
|
|
14
|
+
...(ir.notices ?? []),
|
|
15
|
+
...(ir.vaults ?? []),
|
|
16
|
+
...(ir.agents ?? []),
|
|
17
|
+
...ir.layouts,
|
|
18
|
+
...ir.connectors,
|
|
19
|
+
...ir.machines,
|
|
20
|
+
...(ir.componentContracts ?? []),
|
|
21
|
+
...(ir.componentImports ?? []),
|
|
22
|
+
...ir.components,
|
|
23
|
+
...ir.accounts,
|
|
24
|
+
...ir.accounts.flatMap((a) => a.policies ?? []),
|
|
25
|
+
...(ir.references ?? []),
|
|
26
|
+
...(ir.scenarios ?? []),
|
|
27
|
+
...(ir.properties ?? []),
|
|
28
|
+
].flatMap((declaration) => declaration.doc?.trim()
|
|
29
|
+
? []
|
|
30
|
+
: [
|
|
31
|
+
{
|
|
32
|
+
code: "E_MISSING_DOC",
|
|
33
|
+
severity: "error",
|
|
34
|
+
message: `Published declaration ${declaration.name} needs a nonempty docstring.`,
|
|
35
|
+
at: declaration.at,
|
|
36
|
+
help: "Add a nonempty docstring immediately after the declaration name. Describe its public contract; the first sentence is its summary.",
|
|
37
|
+
},
|
|
38
|
+
]);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type * as IR from "../../world-ir/types.generated.js";
|
|
2
|
+
export declare const inputHomeOf: (component: IR.Component) => IR.InputHome;
|
|
3
|
+
/** Compare symbolic identities, never assume two references of the same type are equal. */
|
|
4
|
+
export declare const homeDiagnostics: (ir: IR.WorldIR) => readonly IR.Diagnostic[];
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// Lowering publishes input homes; occurrence/missing variants belong to legacy wire data.
|
|
2
|
+
export const inputHomeOf = (component) => {
|
|
3
|
+
if (component.home?.kind !== "input")
|
|
4
|
+
throw new Error(`Expected a checked input home for ${component.name}`);
|
|
5
|
+
return component.home;
|
|
6
|
+
};
|
|
7
|
+
/** Compare symbolic identities, never assume two references of the same type are equal. */
|
|
8
|
+
export const homeDiagnostics = (ir) => {
|
|
9
|
+
const components = new Map(ir.components.map((c) => [c.name, c]));
|
|
10
|
+
const derives = new Map(ir.derives.map((d) => [d.name, d]));
|
|
11
|
+
const diagnostics = [];
|
|
12
|
+
const reported = new Set();
|
|
13
|
+
const reference = (type) => {
|
|
14
|
+
if (!Array.isArray(type))
|
|
15
|
+
return undefined;
|
|
16
|
+
if (type[0] === "Option")
|
|
17
|
+
return reference(type[1]);
|
|
18
|
+
return type[0] === "Id" && typeof type[1] === "string" ? type[1] : undefined;
|
|
19
|
+
};
|
|
20
|
+
const componentOf = (v) => components.get(reference(v.type) ?? "");
|
|
21
|
+
const instance = (c, inputs) => ({
|
|
22
|
+
identity: JSON.stringify([c.name, c.key.map((k) => inputs.get(k)?.identity)]),
|
|
23
|
+
type: ["Id", c.name],
|
|
24
|
+
inputs,
|
|
25
|
+
});
|
|
26
|
+
const scopeOf = (v) => new Map([
|
|
27
|
+
...componentOf(v).inputs.map((f) => [f.name, field(v, f.name)]),
|
|
28
|
+
["self", v],
|
|
29
|
+
["attached", field(v, "attached")],
|
|
30
|
+
]);
|
|
31
|
+
const field = (v, name) => {
|
|
32
|
+
const bound = v.inputs?.get(name);
|
|
33
|
+
if (bound)
|
|
34
|
+
return bound;
|
|
35
|
+
const c = componentOf(v);
|
|
36
|
+
const slot = c?.slots.find((s) => s.name === name);
|
|
37
|
+
if (slot)
|
|
38
|
+
return instance(components.get(slot.component), new Map(slot.bind.map((b) => [b.input, value(b.expr, scopeOf(v))])));
|
|
39
|
+
const owner = reference(v.type);
|
|
40
|
+
const fields = c?.inputs ??
|
|
41
|
+
ir.roles.find((r) => r.name === owner)?.fields ??
|
|
42
|
+
ir.entities.find((e) => e.name === owner)?.fields;
|
|
43
|
+
return {
|
|
44
|
+
identity: JSON.stringify([v.identity, name]),
|
|
45
|
+
type: name === "attached" && c
|
|
46
|
+
? ["List", ["Id", ir.libraries[0]?.subject ?? ""]]
|
|
47
|
+
: fields?.find((f) => f.name === name)?.type,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const home = (v) => {
|
|
51
|
+
const h = inputHomeOf(componentOf(v));
|
|
52
|
+
return h.path.reduce(field, v).identity;
|
|
53
|
+
};
|
|
54
|
+
const unknown = (e) => ({
|
|
55
|
+
identity: JSON.stringify([e.at.src, e.at.from, e.at.to]),
|
|
56
|
+
type: undefined,
|
|
57
|
+
});
|
|
58
|
+
const argumentsOf = (d, args, scope, active) => new Map(d.params.map((p, i) => [
|
|
59
|
+
p.name,
|
|
60
|
+
args[i]
|
|
61
|
+
? value(args[i], scope, active)
|
|
62
|
+
: {
|
|
63
|
+
identity: `missing:${p.name}`,
|
|
64
|
+
type: p.type,
|
|
65
|
+
},
|
|
66
|
+
]));
|
|
67
|
+
const value = (e, scope, active = new Set()) => {
|
|
68
|
+
switch (e.k) {
|
|
69
|
+
case "var":
|
|
70
|
+
return scope.get(e.name) ?? unknown(e);
|
|
71
|
+
case "inst":
|
|
72
|
+
case "read":
|
|
73
|
+
return field(value(e.of, scope, active), e.field);
|
|
74
|
+
case "attr":
|
|
75
|
+
return field(value(e.of, scope, active), e.attr.split("/").at(-1));
|
|
76
|
+
case "lit":
|
|
77
|
+
case "kw":
|
|
78
|
+
return { identity: JSON.stringify([e.k, e.v]), type: undefined };
|
|
79
|
+
case "if": {
|
|
80
|
+
const a = value(e.then, scope, active), b = value(e.else, scope, active);
|
|
81
|
+
return a.identity === b.identity ? a : { ...unknown(e), type: a.type };
|
|
82
|
+
}
|
|
83
|
+
case "call": {
|
|
84
|
+
const d = derives.get(e.fn);
|
|
85
|
+
if (d && !active.has(d.name))
|
|
86
|
+
return value(d.body, argumentsOf(d, e.args, scope, active), new Set([...active, d.name]));
|
|
87
|
+
if (e.fn === "filter" || e.fn === "spells")
|
|
88
|
+
return value(e.args[e.fn === "filter" ? 1 : 0], scope, active);
|
|
89
|
+
return unknown(e);
|
|
90
|
+
}
|
|
91
|
+
case "list":
|
|
92
|
+
return {
|
|
93
|
+
...unknown(e),
|
|
94
|
+
type: ["List", e.items[0] ? (value(e.items[0], scope, active).type ?? "Any") : "Any"],
|
|
95
|
+
};
|
|
96
|
+
default:
|
|
97
|
+
return unknown(e);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
for (const c of ir.components) {
|
|
101
|
+
const inputs = new Map(c.inputs.map((f) => [f.name, { identity: f.name, type: f.type }]));
|
|
102
|
+
const self = instance(c, inputs);
|
|
103
|
+
const scope = scopeOf(self);
|
|
104
|
+
const warn = (at, label, published) => {
|
|
105
|
+
const key = JSON.stringify([c.name, at.src, at.from, at.to]);
|
|
106
|
+
if (reported.has(key))
|
|
107
|
+
return;
|
|
108
|
+
reported.add(key);
|
|
109
|
+
diagnostics.push({
|
|
110
|
+
code: "W_CROSS_HOME_READ",
|
|
111
|
+
severity: "warning",
|
|
112
|
+
at,
|
|
113
|
+
message: `${c.name} reads ${label} through a home not proven equal to its own.`,
|
|
114
|
+
help: published
|
|
115
|
+
? "Expect eventual consistency here, or bind the components to the same home."
|
|
116
|
+
: "Publish an output on the other component and read it with eventual consistency, or bind it to the same home.",
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
const walk = (e, env, active = new Set()) => {
|
|
120
|
+
switch (e.k) {
|
|
121
|
+
case "inst": {
|
|
122
|
+
const owner = value(e.of, env);
|
|
123
|
+
const target = componentOf(owner);
|
|
124
|
+
if (target &&
|
|
125
|
+
!target.inputs.some((f) => f.name === e.field) &&
|
|
126
|
+
home(owner) !== home(self))
|
|
127
|
+
warn(e.at, `${target.name}.${e.field}`, false);
|
|
128
|
+
walk(e.of, env, active);
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
case "read":
|
|
132
|
+
case "attr":
|
|
133
|
+
walk(e.of, env, active);
|
|
134
|
+
break;
|
|
135
|
+
case "if":
|
|
136
|
+
walk(e.test, env, active);
|
|
137
|
+
walk(e.then, env, active);
|
|
138
|
+
walk(e.else, env, active);
|
|
139
|
+
break;
|
|
140
|
+
case "list":
|
|
141
|
+
e.items.forEach((x) => walk(x, env, active));
|
|
142
|
+
break;
|
|
143
|
+
case "fn": {
|
|
144
|
+
const inner = new Map(env);
|
|
145
|
+
e.params.forEach((p) => inner.set(p, { ...unknown(e), identity: `${unknown(e).identity}:${p}` }));
|
|
146
|
+
walk(e.body, inner, active);
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
case "call": {
|
|
150
|
+
for (const [i, arg] of e.args.entries()) {
|
|
151
|
+
if (i === 0 && arg.k === "fn" && (e.fn === "map" || e.fn === "filter")) {
|
|
152
|
+
const list = value(e.args[1], env);
|
|
153
|
+
const inner = new Map(env);
|
|
154
|
+
arg.params.forEach((p) => inner.set(p, {
|
|
155
|
+
identity: `${list.identity}:element`,
|
|
156
|
+
type: Array.isArray(list.type) && list.type[0] === "List" ? list.type[1] : undefined,
|
|
157
|
+
}));
|
|
158
|
+
walk(arg.body, inner, active);
|
|
159
|
+
}
|
|
160
|
+
else
|
|
161
|
+
walk(arg, env, active);
|
|
162
|
+
}
|
|
163
|
+
const d = derives.get(e.fn);
|
|
164
|
+
if (d && !active.has(d.name))
|
|
165
|
+
walk(d.body, argumentsOf(d, e.args, env, active), new Set([...active, d.name]));
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
// Component expressions occur in requirements, actions, bindings, invariants and retention.
|
|
171
|
+
const visit = (node) => {
|
|
172
|
+
if (!node || typeof node !== "object")
|
|
173
|
+
return;
|
|
174
|
+
if ("k" in node)
|
|
175
|
+
walk(node, scope);
|
|
176
|
+
else
|
|
177
|
+
Object.values(node).forEach(visit);
|
|
178
|
+
};
|
|
179
|
+
visit(c);
|
|
180
|
+
for (const interaction of ir.interactions)
|
|
181
|
+
if (ir.evidence.find((e) => e.name === interaction.produces)?.of === c.name)
|
|
182
|
+
visit(interaction);
|
|
183
|
+
for (const output of c.outputs)
|
|
184
|
+
for (const path of output.paths) {
|
|
185
|
+
let owner = self;
|
|
186
|
+
let crossing = false;
|
|
187
|
+
let published = false;
|
|
188
|
+
for (const segment of path.segments) {
|
|
189
|
+
const target = componentOf(owner);
|
|
190
|
+
if (target.slots.some((s) => s.name === segment)) {
|
|
191
|
+
owner = field(owner, segment);
|
|
192
|
+
crossing ||= home(owner) !== home(self);
|
|
193
|
+
}
|
|
194
|
+
else
|
|
195
|
+
published = target.outputs.some((o) => o.name === segment);
|
|
196
|
+
}
|
|
197
|
+
if (crossing)
|
|
198
|
+
warn(path.at, path.segments.join("."), published);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return diagnostics;
|
|
202
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { compileWorld, KERNEL_FUNCTIONS, type CompileResult, type SourceFile } from "./compile.js";
|
|
2
|
+
export { canonicalJson, contentDigest, sha256 } from "./digest.js";
|
|
3
|
+
export type * from "../../world-ir/types.generated.js";
|
|
4
|
+
export { CHILD_FORMS, suggestForm, TOP_LEVEL_FORMS } from "./authoring-help.js";
|
|
5
|
+
export { definitionReferences, type DefinitionReference } from "./coverage.js";
|
|
6
|
+
export { DIAGNOSTIC_RENAMES, diagnosticCode, coreDiagnostics, OLD_OPERATORS } from "./surface.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { compileWorld, KERNEL_FUNCTIONS } from "./compile.js";
|
|
2
|
+
export { canonicalJson, contentDigest, sha256 } from "./digest.js";
|
|
3
|
+
export { CHILD_FORMS, suggestForm, TOP_LEVEL_FORMS } from "./authoring-help.js";
|
|
4
|
+
export { definitionReferences } from "./coverage.js";
|
|
5
|
+
export { DIAGNOSTIC_RENAMES, diagnosticCode, coreDiagnostics, OLD_OPERATORS } from "./surface.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PrincipalIR } from "../../../ir-checks/index.js";
|
|
2
|
+
import type * as IR from "../../../world-ir/types.generated.js";
|
|
3
|
+
import { type LoweringContext } from "./context.js";
|
|
4
|
+
export declare const lowerAccounts: (context: LoweringContext, entityIR: readonly IR.Entity[], components: readonly IR.Component[], principals: PrincipalIR) => IR.Account[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { lowerPolicies } from "./policies.js";
|
|
2
|
+
import { checkAccountParams } from "./param-bounds.js";
|
|
3
|
+
import { contentDigest } from "../digest.js";
|
|
4
|
+
import {} from "./context.js";
|
|
5
|
+
import { mapPairs, option, symName, VALUE } from "./syntax.js";
|
|
6
|
+
export const lowerAccounts = (context, entityIR, components, principals) => {
|
|
7
|
+
const { byForm, payload, formOf, docOf, lowerExpr, at } = context;
|
|
8
|
+
return byForm("account").map((d) => {
|
|
9
|
+
const p = payload(d);
|
|
10
|
+
const form = formOf(d);
|
|
11
|
+
checkAccountParams(context, d, form, components);
|
|
12
|
+
const policies = lowerPolicies(context, d, form, components, principals);
|
|
13
|
+
const packaged = entityIR.filter((e) => e.ns.split(".")[0] === p.package);
|
|
14
|
+
return {
|
|
15
|
+
name: d.summary.name,
|
|
16
|
+
...docOf(p.doc),
|
|
17
|
+
requires: p.requires,
|
|
18
|
+
package: {
|
|
19
|
+
name: p.package,
|
|
20
|
+
...(p.version ? { version: p.version } : {}),
|
|
21
|
+
digest: contentDigest(packaged),
|
|
22
|
+
},
|
|
23
|
+
params: mapPairs(option(form, "params")).map(([k, v]) => ({
|
|
24
|
+
name: symName(k).replace(/^:/, ""),
|
|
25
|
+
value: lowerExpr(d, v, new Map([
|
|
26
|
+
["today", VALUE],
|
|
27
|
+
["now", VALUE],
|
|
28
|
+
])),
|
|
29
|
+
})),
|
|
30
|
+
...(policies.length ? { policies: [policies[0], ...policies.slice(1)] } : {}),
|
|
31
|
+
upgrade: p.upgrade,
|
|
32
|
+
forEach: p["for-each"].map((f) => ({ role: f.role, component: f.component })),
|
|
33
|
+
at: at(d, form),
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ElaboratedDeclaration } from "@forma-language/forma/descriptor";
|
|
2
|
+
import type { SExpr } from "@forma-language/forma/reader";
|
|
3
|
+
import type * as IR from "../../../world-ir/types.generated.js";
|
|
4
|
+
import type { LoweringContext } from "./context.js";
|
|
5
|
+
export declare const lowerActionPolicy: (context: LoweringContext, d: ElaboratedDeclaration, form: SExpr) => Pick<IR.Action, "dispatch" | "onIneligible">;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LowerError, option, symName } from "./syntax.js";
|
|
2
|
+
export const lowerActionPolicy = (context, d, form) => {
|
|
3
|
+
const mode = (key, values, code) => {
|
|
4
|
+
const syntax = option(form, key);
|
|
5
|
+
if (!syntax)
|
|
6
|
+
return undefined;
|
|
7
|
+
const literal = symName(syntax);
|
|
8
|
+
const value = literal?.startsWith(":") ? literal.slice(1) : undefined;
|
|
9
|
+
if (!values.includes(value))
|
|
10
|
+
throw new LowerError(code, `Unsupported :${key} policy.`, context.at(d, syntax), `Choose a literal keyword: ${values.map((v) => ":" + v).join(", ")}.`);
|
|
11
|
+
return value;
|
|
12
|
+
};
|
|
13
|
+
const dispatch = mode("dispatch", ["auto", "claim", "manual"], "E_DISPATCH");
|
|
14
|
+
const onIneligible = mode("on-ineligible", ["withdraw", "keep", "review"], "E_ON_INELIGIBLE");
|
|
15
|
+
return { ...(dispatch ? { dispatch } : {}), ...(onIneligible ? { onIneligible } : {}) };
|
|
16
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as IR from "../../../world-ir/types.generated.js";
|
|
2
|
+
import type { SourceFile } from "../compile.js";
|
|
3
|
+
import type { LoweringContext } from "./context.js";
|
|
4
|
+
/** Closed read syntax gets actionable spans before generic descriptor validation. */
|
|
5
|
+
export declare const agentSourceDiagnostics: (files: readonly SourceFile[]) => IR.Diagnostic[];
|
|
6
|
+
export declare const lowerAgents: (context: LoweringContext, components: readonly IR.Component[]) => IR.Agent[];
|