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,79 @@
|
|
|
1
|
+
import { occurrenceHome } from "./homes.js";
|
|
2
|
+
import { evaluateIn, isInst } from "./evaluation.js";
|
|
3
|
+
// Instances grouped by account and subject home, built once per instance map and rebuilt
|
|
4
|
+
// only when the map grows, so finding producers stays linear in the number of instances.
|
|
5
|
+
const homeIndex = new WeakMap();
|
|
6
|
+
const instancesByHome = (p, instances) => {
|
|
7
|
+
const cached = homeIndex.get(instances);
|
|
8
|
+
if (cached && cached.size === instances.size)
|
|
9
|
+
return cached.byHome;
|
|
10
|
+
const byHome = new Map();
|
|
11
|
+
for (const inst of instances.values()) {
|
|
12
|
+
const home = occurrenceHome(p, inst, instances);
|
|
13
|
+
if (!home)
|
|
14
|
+
continue;
|
|
15
|
+
const key = `${inst.account}\u0000${home.id}`;
|
|
16
|
+
const list = byHome.get(key);
|
|
17
|
+
if (list)
|
|
18
|
+
list.push(inst);
|
|
19
|
+
else
|
|
20
|
+
byHome.set(key, [inst]);
|
|
21
|
+
}
|
|
22
|
+
homeIndex.set(instances, { size: instances.size, byHome });
|
|
23
|
+
return byHome;
|
|
24
|
+
};
|
|
25
|
+
export const missingCondition = (cx, text, expr) => {
|
|
26
|
+
const other = { text, kind: "other" };
|
|
27
|
+
if (expr.k === "attr" || expr.k === "read")
|
|
28
|
+
return { text, kind: "fact", fact: expr.meta.path };
|
|
29
|
+
if (expr.k !== "call")
|
|
30
|
+
return other;
|
|
31
|
+
const arg = expr.args[0];
|
|
32
|
+
if (!arg)
|
|
33
|
+
return other;
|
|
34
|
+
if (["known?", "unknown?"].includes(expr.fn) && (arg.k === "attr" || arg.k === "read"))
|
|
35
|
+
return { text, kind: "fact", fact: arg.meta.path };
|
|
36
|
+
if (["satisfied?", "applies?", "met?", "not-applicable?"].includes(expr.fn)) {
|
|
37
|
+
const target = arg.k === "inst" ? evaluateIn(cx, arg.of) : null;
|
|
38
|
+
const instance = isInst(target) ? target.inst : arg.k === "var" ? cx.inst?.id : undefined;
|
|
39
|
+
const requirement = arg.k === "inst" ? arg.field : arg.k === "var" ? arg.name : undefined;
|
|
40
|
+
if (instance && requirement)
|
|
41
|
+
return { text, kind: "requirement", instance, requirement };
|
|
42
|
+
}
|
|
43
|
+
if (["attested", "valid"].includes(expr.fn) && arg.k === "ref" && arg.kind === "evidence") {
|
|
44
|
+
const produces = (e) => e.k === "list"
|
|
45
|
+
? e.items.some(produces)
|
|
46
|
+
: e.k === "call" &&
|
|
47
|
+
((["attested", "valid"].includes(e.fn) &&
|
|
48
|
+
e.args[0]?.k === "ref" &&
|
|
49
|
+
e.args[0].name === arg.name) ||
|
|
50
|
+
(["and", "or", "all?", "any?"].includes(e.fn) && e.args.some(produces)));
|
|
51
|
+
const home = cx.inst && cx.k ? occurrenceHome(cx.p, cx.inst, cx.k.instances) : null;
|
|
52
|
+
const instances = !cx.inst
|
|
53
|
+
? []
|
|
54
|
+
: home && cx.k
|
|
55
|
+
? (instancesByHome(cx.p, cx.k.instances).get(`${cx.inst.account}\u0000${home.id}`) ?? [])
|
|
56
|
+
: [cx.inst];
|
|
57
|
+
const producedBy = instances
|
|
58
|
+
.flatMap((inst) => (cx.p.components.get(inst.component)?.requirements ?? [])
|
|
59
|
+
.filter((r) => produces(r.satisfiedBy))
|
|
60
|
+
.map((r) => ({ requirement: r.name, instance: inst.id })))
|
|
61
|
+
.sort((a, b) => a.instance.localeCompare(b.instance) || a.requirement.localeCompare(b.requirement));
|
|
62
|
+
return { text, kind: "evidence", evidence: arg.name, producedBy };
|
|
63
|
+
}
|
|
64
|
+
if (["in-state?", "started?", "final?"].includes(expr.fn)) {
|
|
65
|
+
const value = evaluateIn(cx, arg);
|
|
66
|
+
if (value && typeof value === "object" && "machine" in value) {
|
|
67
|
+
const states = expr.args[1] ? evaluateIn(cx, expr.args[1]) : null;
|
|
68
|
+
return {
|
|
69
|
+
text,
|
|
70
|
+
kind: "machine",
|
|
71
|
+
machine: value.machine,
|
|
72
|
+
...(Array.isArray(states) && states.every((s) => typeof s === "string")
|
|
73
|
+
? { states: states }
|
|
74
|
+
: {}),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return other;
|
|
79
|
+
};
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import type { TimePoint } from "./instants.js";
|
|
2
|
+
import { type Basis, type EvidenceRecord, type Scalar } from "./basis.js";
|
|
3
|
+
import { type Calendar, type LocalDate } from "./dates.js";
|
|
4
|
+
import { ReadSet, type Dependency } from "./dependencies.js";
|
|
5
|
+
import type * as IR from "../world-ir/types.generated.js";
|
|
6
|
+
export type Truth = true | false | "unknown";
|
|
7
|
+
export type Status = "NotApplicable" | "Unknown" | "Open" | "Overdue" | "Satisfied" | "Waived";
|
|
8
|
+
export interface Program {
|
|
9
|
+
/** Authored IR retained for validated edits; ir below contains account-resolved reads. */
|
|
10
|
+
readonly sourceIR: IR.WorldIR;
|
|
11
|
+
readonly ir: IR.WorldIR;
|
|
12
|
+
readonly account: IR.Account;
|
|
13
|
+
readonly library: IR.WorldIR["libraries"][number];
|
|
14
|
+
readonly release: string;
|
|
15
|
+
readonly components: ReadonlyMap<string, IR.Component>;
|
|
16
|
+
readonly derives: ReadonlyMap<string, IR.WorldIR["derives"][number]>;
|
|
17
|
+
readonly evidence: ReadonlyMap<string, IR.Evidence>;
|
|
18
|
+
readonly interactions: ReadonlyMap<string, IR.Interaction>;
|
|
19
|
+
readonly machines: ReadonlyMap<string, IR.Machine>;
|
|
20
|
+
readonly connectors: ReadonlyMap<string, IR.WorldIR["connectors"][number]>;
|
|
21
|
+
readonly calendars: ReadonlyMap<string, Calendar>;
|
|
22
|
+
/** Entity declarations by stored namespace, for display and writes. */
|
|
23
|
+
readonly entities: ReadonlyMap<string, IR.Entity>;
|
|
24
|
+
/** Role field → the attributes it reads in this account, and whether it can be written. */
|
|
25
|
+
readonly bindings: ReadonlyMap<string, {
|
|
26
|
+
readonly attrs: readonly string[];
|
|
27
|
+
readonly entity: string;
|
|
28
|
+
}>;
|
|
29
|
+
readonly params: ReadonlyMap<string, Value>;
|
|
30
|
+
readonly roots: ReadonlyArray<{
|
|
31
|
+
readonly component: string;
|
|
32
|
+
readonly namespaces: readonly string[];
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
export declare class Unknown {
|
|
36
|
+
readonly why: string;
|
|
37
|
+
constructor(why: string);
|
|
38
|
+
}
|
|
39
|
+
export interface InstRef {
|
|
40
|
+
readonly inst: string;
|
|
41
|
+
}
|
|
42
|
+
export interface MachineRef {
|
|
43
|
+
readonly machine: string;
|
|
44
|
+
}
|
|
45
|
+
export interface Duration {
|
|
46
|
+
readonly n: number;
|
|
47
|
+
readonly unit: "days" | "months" | "years" | "hours" | "minutes";
|
|
48
|
+
}
|
|
49
|
+
export interface Ref {
|
|
50
|
+
readonly ref: "evidence" | "calendar" | "decision" | "notice";
|
|
51
|
+
readonly name: string;
|
|
52
|
+
}
|
|
53
|
+
export interface Closure {
|
|
54
|
+
readonly params: readonly string[];
|
|
55
|
+
readonly body: IR.Expr;
|
|
56
|
+
readonly env: Env;
|
|
57
|
+
}
|
|
58
|
+
export type Value = Scalar | null | Unknown | readonly Value[] | InstRef | MachineRef | Duration | Ref | Closure;
|
|
59
|
+
/** Names an expression can see. Instance scopes resolve lazily; nothing is copied per call. */
|
|
60
|
+
export type StatusReader = (inst: Instance, name: string) => Status;
|
|
61
|
+
export interface Env {
|
|
62
|
+
readonly get: (name: string, statusRead?: StatusReader, parameter?: (name: string, base: Value | undefined) => Value) => Value | undefined;
|
|
63
|
+
/** Passive lexical data for verification; never resolves lazy instance names. */
|
|
64
|
+
readonly snapshot: () => unknown;
|
|
65
|
+
}
|
|
66
|
+
export interface ChildSlot {
|
|
67
|
+
readonly name: string;
|
|
68
|
+
readonly component: string;
|
|
69
|
+
readonly mode: "child" | "attach";
|
|
70
|
+
readonly applies: Truth;
|
|
71
|
+
readonly reason: string;
|
|
72
|
+
readonly instances: string[];
|
|
73
|
+
}
|
|
74
|
+
export interface Instance {
|
|
75
|
+
readonly params?: ReadonlyMap<string, Value>;
|
|
76
|
+
readonly id: string;
|
|
77
|
+
readonly account: string;
|
|
78
|
+
readonly component: string;
|
|
79
|
+
readonly key: readonly Value[];
|
|
80
|
+
readonly inputs: ReadonlyMap<string, Value>;
|
|
81
|
+
readonly cycle: number;
|
|
82
|
+
/** The subjects (for-each entities) attached to this occurrence in this cycle. */
|
|
83
|
+
readonly attached: string[];
|
|
84
|
+
readonly parents: Set<string>;
|
|
85
|
+
readonly children: ChildSlot[];
|
|
86
|
+
readonly prior: string | null;
|
|
87
|
+
}
|
|
88
|
+
/** One step of a derivation, located in the source that computed it. */
|
|
89
|
+
export interface Step {
|
|
90
|
+
readonly branch?: "true" | "false" | "Unknown";
|
|
91
|
+
readonly at: IR.Span;
|
|
92
|
+
readonly value: Value;
|
|
93
|
+
readonly note?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface ReasonNode {
|
|
96
|
+
readonly label: string;
|
|
97
|
+
readonly outcome: "passed" | "failed" | "unknown";
|
|
98
|
+
readonly detail: string;
|
|
99
|
+
readonly at?: IR.Span;
|
|
100
|
+
}
|
|
101
|
+
export interface RecurrencePeriod {
|
|
102
|
+
readonly index: number;
|
|
103
|
+
readonly start: LocalDate;
|
|
104
|
+
readonly next: LocalDate | null;
|
|
105
|
+
}
|
|
106
|
+
export interface RenewalResult {
|
|
107
|
+
readonly evidence: string;
|
|
108
|
+
readonly expiresAt: LocalDate | null;
|
|
109
|
+
readonly availableAt: LocalDate | null;
|
|
110
|
+
readonly state: "waiting" | "ready" | "expired" | "unknown";
|
|
111
|
+
readonly unknown: string | null;
|
|
112
|
+
}
|
|
113
|
+
export interface RequirementResult {
|
|
114
|
+
readonly renewal?: RenewalResult | null;
|
|
115
|
+
readonly recurrence?: RecurrencePeriod | null;
|
|
116
|
+
readonly addition?: import("./basis.js").DecisionRecord;
|
|
117
|
+
readonly additionVotes?: readonly import("./basis.js").DecisionRecord[];
|
|
118
|
+
readonly decision?: import("./basis.js").DecisionRecord;
|
|
119
|
+
readonly decisionVotes?: readonly import("./basis.js").DecisionRecord[];
|
|
120
|
+
readonly name: string;
|
|
121
|
+
readonly label: string;
|
|
122
|
+
readonly occurrence: string;
|
|
123
|
+
readonly status: Status;
|
|
124
|
+
readonly due: TimePoint | null;
|
|
125
|
+
readonly dueSteps: readonly Step[];
|
|
126
|
+
readonly dueUnknown: string | null;
|
|
127
|
+
readonly remindAt: TimePoint | null;
|
|
128
|
+
readonly reasons: readonly ReasonNode[];
|
|
129
|
+
readonly evidence: EvidenceRecord | null;
|
|
130
|
+
readonly evidenceType: string | null;
|
|
131
|
+
readonly via: string;
|
|
132
|
+
readonly awaits: string | null;
|
|
133
|
+
readonly at: IR.Span;
|
|
134
|
+
}
|
|
135
|
+
export interface EscalationIntent {
|
|
136
|
+
readonly instance: string;
|
|
137
|
+
readonly requirement: string;
|
|
138
|
+
readonly occurrence: string;
|
|
139
|
+
readonly kind: "notify" | "reassign";
|
|
140
|
+
readonly availableAt: LocalDate;
|
|
141
|
+
readonly target: {
|
|
142
|
+
readonly id: string;
|
|
143
|
+
readonly kind: "entity" | "group";
|
|
144
|
+
};
|
|
145
|
+
readonly idempotencyKey: string;
|
|
146
|
+
readonly at: IR.Span;
|
|
147
|
+
}
|
|
148
|
+
export interface EscalationResult {
|
|
149
|
+
readonly kind: EscalationIntent["kind"];
|
|
150
|
+
readonly target: EscalationIntent["target"] | null;
|
|
151
|
+
readonly requirement: string;
|
|
152
|
+
readonly step: number;
|
|
153
|
+
readonly availableAt: LocalDate | null;
|
|
154
|
+
readonly state: "waiting" | "ready" | "held" | "unknown" | "inactive";
|
|
155
|
+
readonly unknown: string | null;
|
|
156
|
+
readonly heldBy: readonly string[];
|
|
157
|
+
readonly intent: EscalationIntent | null;
|
|
158
|
+
readonly at: IR.Span;
|
|
159
|
+
}
|
|
160
|
+
export interface HoldResult {
|
|
161
|
+
readonly name: string;
|
|
162
|
+
readonly label: string;
|
|
163
|
+
readonly condition: Truth;
|
|
164
|
+
readonly unknown: string | null;
|
|
165
|
+
readonly pauses: IR.Hold["pauses"];
|
|
166
|
+
readonly cites?: readonly IR.Citation[];
|
|
167
|
+
readonly at: IR.Span;
|
|
168
|
+
}
|
|
169
|
+
export interface FactCollection {
|
|
170
|
+
readonly key: string;
|
|
171
|
+
readonly entity: string;
|
|
172
|
+
readonly attribute: string;
|
|
173
|
+
readonly name: string;
|
|
174
|
+
readonly required: boolean;
|
|
175
|
+
readonly confirmAt: TimePoint | null;
|
|
176
|
+
readonly unknown?: string;
|
|
177
|
+
}
|
|
178
|
+
export interface InteractionField {
|
|
179
|
+
readonly collection?: FactCollection;
|
|
180
|
+
readonly field: string;
|
|
181
|
+
readonly mode: "ask" | "confirm" | "read-only";
|
|
182
|
+
readonly value: Scalar | null;
|
|
183
|
+
readonly unknown?: string;
|
|
184
|
+
}
|
|
185
|
+
export interface ActionResult {
|
|
186
|
+
readonly advancesAll?: readonly string[];
|
|
187
|
+
readonly authorityConstraints?: readonly import("./policies.js").AuthorityConstraint[];
|
|
188
|
+
readonly fields?: readonly InteractionField[];
|
|
189
|
+
readonly heldBy?: readonly string[];
|
|
190
|
+
readonly dispatch?: "auto" | "claim" | "manual";
|
|
191
|
+
readonly onIneligible?: "withdraw" | "keep" | "review";
|
|
192
|
+
readonly assigneeId?: string | null;
|
|
193
|
+
readonly action: string;
|
|
194
|
+
readonly label: string;
|
|
195
|
+
readonly advances: string;
|
|
196
|
+
readonly assignee: string;
|
|
197
|
+
/** Who the assignee is: a person (an entity), a group, or a connector. */
|
|
198
|
+
readonly assigneeKind: "entity" | "group" | "connector";
|
|
199
|
+
readonly via: string;
|
|
200
|
+
readonly kind: "interaction" | "connector" | "decision";
|
|
201
|
+
readonly interaction: string | null;
|
|
202
|
+
readonly idempotencyKey: string;
|
|
203
|
+
readonly state: "eligible" | "waiting" | "dispatched" | "held";
|
|
204
|
+
readonly missing: readonly import("./missing.js").Missing[];
|
|
205
|
+
readonly at: IR.Span;
|
|
206
|
+
}
|
|
207
|
+
export type WorkIntent = {
|
|
208
|
+
readonly instance: string;
|
|
209
|
+
readonly action: string;
|
|
210
|
+
readonly occurrence: string;
|
|
211
|
+
readonly idempotencyKey: string;
|
|
212
|
+
readonly at: IR.Span;
|
|
213
|
+
} & ({
|
|
214
|
+
readonly kind: "open";
|
|
215
|
+
readonly occurrences?: readonly string[];
|
|
216
|
+
readonly authorityConstraints?: readonly import("./policies.js").AuthorityConstraint[];
|
|
217
|
+
readonly dispatch: "auto" | "claim" | "manual";
|
|
218
|
+
readonly onIneligible: "withdraw" | "keep" | "review";
|
|
219
|
+
readonly assignee: {
|
|
220
|
+
readonly id: string;
|
|
221
|
+
readonly kind: ActionResult["assigneeKind"];
|
|
222
|
+
};
|
|
223
|
+
} | {
|
|
224
|
+
readonly kind: "withdraw" | "keep" | "review";
|
|
225
|
+
});
|
|
226
|
+
export interface OutputResult {
|
|
227
|
+
readonly name: string;
|
|
228
|
+
readonly label: string;
|
|
229
|
+
readonly status: Status;
|
|
230
|
+
readonly expr: string;
|
|
231
|
+
readonly at: IR.Span;
|
|
232
|
+
}
|
|
233
|
+
export interface MilestoneResult {
|
|
234
|
+
readonly name: string;
|
|
235
|
+
readonly label: string;
|
|
236
|
+
readonly condition: Truth;
|
|
237
|
+
readonly unknown: string | null;
|
|
238
|
+
readonly reached: boolean;
|
|
239
|
+
readonly pending: boolean;
|
|
240
|
+
readonly record: import("./basis.js").MilestoneRecord | null;
|
|
241
|
+
readonly finding: "regressed" | null;
|
|
242
|
+
readonly at: IR.Span;
|
|
243
|
+
}
|
|
244
|
+
export interface Reconciliation {
|
|
245
|
+
readonly milestones?: readonly MilestoneResult[];
|
|
246
|
+
readonly escalations?: readonly EscalationResult[];
|
|
247
|
+
readonly holds?: readonly HoldResult[];
|
|
248
|
+
/** Pure requested work changes; persisted lifecycle belongs to the host. */
|
|
249
|
+
readonly workIntents?: readonly WorkIntent[];
|
|
250
|
+
readonly digest: string;
|
|
251
|
+
readonly instance: string;
|
|
252
|
+
readonly component: string;
|
|
253
|
+
readonly requirements: readonly RequirementResult[];
|
|
254
|
+
readonly outputs: readonly OutputResult[];
|
|
255
|
+
readonly actions: readonly ActionResult[];
|
|
256
|
+
readonly blocked: ReadonlyArray<{
|
|
257
|
+
readonly requirement: string;
|
|
258
|
+
readonly reason: string;
|
|
259
|
+
}>;
|
|
260
|
+
readonly wakeAt: TimePoint | null;
|
|
261
|
+
readonly wakeReason: string;
|
|
262
|
+
/** Evaluation and structural discovery queries with their observed values. */
|
|
263
|
+
readonly dependsOn: ReadonlyMap<string, Dependency>;
|
|
264
|
+
readonly retention: {
|
|
265
|
+
readonly until: LocalDate | null;
|
|
266
|
+
readonly eligible: boolean | null;
|
|
267
|
+
readonly steps: readonly Step[];
|
|
268
|
+
readonly unknown: string | null;
|
|
269
|
+
readonly disposal: string;
|
|
270
|
+
} | null;
|
|
271
|
+
}
|
|
272
|
+
export interface WorldReconciliation {
|
|
273
|
+
readonly applicabilityUnknown?: boolean;
|
|
274
|
+
readonly releases: readonly string[];
|
|
275
|
+
readonly now: TimePoint;
|
|
276
|
+
readonly roots: ReadonlyArray<{
|
|
277
|
+
readonly subject: string;
|
|
278
|
+
readonly account: string;
|
|
279
|
+
readonly instance: string;
|
|
280
|
+
}>;
|
|
281
|
+
readonly instances: ReadonlyMap<string, Instance>;
|
|
282
|
+
readonly results: ReadonlyMap<string, Reconciliation>;
|
|
283
|
+
readonly blockedTotal: number;
|
|
284
|
+
readonly programs: readonly Program[];
|
|
285
|
+
}
|
|
286
|
+
export type EvaluationResult = Omit<Reconciliation, "digest" | "dependsOn">;
|
|
287
|
+
export interface Trace {
|
|
288
|
+
steps: Step[];
|
|
289
|
+
witness?: {
|
|
290
|
+
evidence: EvidenceRecord | null;
|
|
291
|
+
via: string;
|
|
292
|
+
detail: string;
|
|
293
|
+
type?: string;
|
|
294
|
+
};
|
|
295
|
+
/** Per-item witnesses for lists consumed by all?/any?, including mapped lists. */
|
|
296
|
+
listWitnesses?: WeakMap<readonly Value[], readonly Trace["witness"][]>;
|
|
297
|
+
awaits?: string;
|
|
298
|
+
}
|
|
299
|
+
export interface Cx {
|
|
300
|
+
readonly p: Program;
|
|
301
|
+
readonly b: Basis;
|
|
302
|
+
readonly inst: Instance | undefined;
|
|
303
|
+
readonly env: Env;
|
|
304
|
+
readonly k?: KernelState;
|
|
305
|
+
readonly occurrence?: string;
|
|
306
|
+
readonly proofPeriod?: RecurrencePeriod;
|
|
307
|
+
readonly trace?: Trace;
|
|
308
|
+
readonly reads?: ReadSet;
|
|
309
|
+
readonly temporal?: Set<TimePoint>;
|
|
310
|
+
readonly statusRead?: StatusReader;
|
|
311
|
+
readonly policyGuard?: boolean;
|
|
312
|
+
}
|
|
313
|
+
export interface KernelState {
|
|
314
|
+
uncertainMembership?: boolean;
|
|
315
|
+
readonly instances: Map<string, Instance>;
|
|
316
|
+
readonly status: (inst: Instance, requirement: string) => Status;
|
|
317
|
+
}
|
|
318
|
+
export interface ReconcileScope {
|
|
319
|
+
readonly home: SubjectHome;
|
|
320
|
+
readonly reads: ReadSet;
|
|
321
|
+
readonly subjects: (component: string, namespaces: readonly string[]) => readonly string[];
|
|
322
|
+
readonly complete: (instances: ReadonlyMap<string, Instance>) => boolean;
|
|
323
|
+
readonly select: (instance: Instance) => boolean;
|
|
324
|
+
}
|
|
325
|
+
export interface SubjectHome {
|
|
326
|
+
readonly kind: "entity";
|
|
327
|
+
readonly id: string;
|
|
328
|
+
}
|
|
329
|
+
export interface SubjectReconciliation extends WorldReconciliation {
|
|
330
|
+
readonly home: SubjectHome;
|
|
331
|
+
/** Includes indexed discovery observations even when this home has no occurrences. */
|
|
332
|
+
readonly dependsOn: ReadonlyMap<string, Dependency>;
|
|
333
|
+
readonly wakeAt: TimePoint | null;
|
|
334
|
+
readonly wakeReason: string;
|
|
335
|
+
}
|
|
336
|
+
export interface Violation {
|
|
337
|
+
readonly instance: string;
|
|
338
|
+
readonly invariant: string;
|
|
339
|
+
readonly reason: string;
|
|
340
|
+
readonly at: IR.Span;
|
|
341
|
+
}
|
|
342
|
+
export interface UpgradeConsequence {
|
|
343
|
+
readonly account: string;
|
|
344
|
+
readonly occurrence: string;
|
|
345
|
+
readonly label: string;
|
|
346
|
+
readonly status: Status;
|
|
347
|
+
readonly policy: IR.Account["upgrade"];
|
|
348
|
+
readonly outcome: "keeps" | "replans" | "review" | "next-cycle" | "unchanged";
|
|
349
|
+
readonly detail: string;
|
|
350
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Basis, NoticeDeliveryRecord, NoticeAcknowledgmentRecord, NoticeIdentity } from "./basis.js";
|
|
2
|
+
import type { Cx, WorldReconciliation } from "./model.js";
|
|
3
|
+
import { type Dependency } from "./dependencies.js";
|
|
4
|
+
export interface NoticeCopy extends NoticeIdentity {
|
|
5
|
+
readonly delivery: NoticeDeliveryRecord | null;
|
|
6
|
+
readonly acknowledgment: NoticeAcknowledgmentRecord | null;
|
|
7
|
+
}
|
|
8
|
+
/** Current exact copies and passive proof; delivery and authentication belong to the host. */
|
|
9
|
+
export declare const noticeProjection: (recon: WorldReconciliation, snapshot: Basis) => {
|
|
10
|
+
readonly copies: readonly NoticeCopy[];
|
|
11
|
+
readonly dependsOn: ReadonlyMap<string, Dependency>;
|
|
12
|
+
};
|
|
13
|
+
/** The evaluator shares exact-copy validation without recursively reconciling the world. */
|
|
14
|
+
export declare const noticeCopiesFor: (cx: Cx, name?: string) => readonly NoticeCopy[];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { contentDigest, fileDigest } from "../ir-checks/index.js";
|
|
2
|
+
import { assertSnapshot, evaluateIn, instanceContext } from "./evaluation.js";
|
|
3
|
+
import { documentIntentsFor } from "./documents.js";
|
|
4
|
+
import { observeBasis, programDependency, ReadSet } from "./dependencies.js";
|
|
5
|
+
import { canonicalJson } from "./result-digest.js";
|
|
6
|
+
import { sha256 } from "./sha256.js";
|
|
7
|
+
import { timeOrder } from "./instants.js";
|
|
8
|
+
/** Current exact copies and passive proof; delivery and authentication belong to the host. */
|
|
9
|
+
export const noticeProjection = (recon, snapshot) => {
|
|
10
|
+
assertSnapshot(snapshot, recon.now);
|
|
11
|
+
const reads = new ReadSet(), b = observeBasis(snapshot, reads), copies = [];
|
|
12
|
+
for (const p of recon.programs)
|
|
13
|
+
reads.add(programDependency(p));
|
|
14
|
+
for (const inst of recon.instances.values())
|
|
15
|
+
copies.push(...noticeCopiesFor(instanceContext(recon, b, inst, reads)));
|
|
16
|
+
return {
|
|
17
|
+
copies: copies.sort((a, b) => (a.key < b.key ? -1 : a.key > b.key ? 1 : 0)),
|
|
18
|
+
dependsOn: reads.snapshot(),
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/** The evaluator shares exact-copy validation without recursively reconciling the world. */
|
|
22
|
+
export const noticeCopiesFor = (cx, name) => {
|
|
23
|
+
const b = cx.b, copies = [];
|
|
24
|
+
for (const intent of documentIntentsFor(cx)) {
|
|
25
|
+
const inst = cx.inst, declarations = (cx.p.ir.notices ?? []).filter((n) => n.of === inst.component &&
|
|
26
|
+
n.document === intent.document &&
|
|
27
|
+
(name === undefined || n.name === name));
|
|
28
|
+
if (!declarations.length)
|
|
29
|
+
continue;
|
|
30
|
+
const document = b.document?.(intent.account, intent.home, intent.key);
|
|
31
|
+
if (!document ||
|
|
32
|
+
document.templateDigest !== intent.templateDigest ||
|
|
33
|
+
document.sourceDigest !== intent.sourceDigest ||
|
|
34
|
+
document.edition !== intent.edition ||
|
|
35
|
+
!fileDigest(document.digest) ||
|
|
36
|
+
canonicalJson(document.evidenceIds) !== canonicalJson(intent.evidence.map((e) => e.id)) ||
|
|
37
|
+
document.instance !== intent.instance ||
|
|
38
|
+
document.document !== intent.document ||
|
|
39
|
+
document.account !== intent.account ||
|
|
40
|
+
document.home !== intent.home ||
|
|
41
|
+
document.key !== intent.key)
|
|
42
|
+
continue;
|
|
43
|
+
for (const notice of declarations) {
|
|
44
|
+
const recipient = evaluateIn(cx, notice.to);
|
|
45
|
+
if (typeof recipient !== "string" || !recipient || !b.nsOf(recipient))
|
|
46
|
+
continue;
|
|
47
|
+
const identity = {
|
|
48
|
+
key: sha256(canonicalJson({
|
|
49
|
+
account: intent.account,
|
|
50
|
+
home: intent.home,
|
|
51
|
+
instance: intent.instance,
|
|
52
|
+
notice: contentDigest(notice),
|
|
53
|
+
recipient,
|
|
54
|
+
documentKey: intent.key,
|
|
55
|
+
documentDigest: document.digest,
|
|
56
|
+
})),
|
|
57
|
+
account: intent.account,
|
|
58
|
+
home: intent.home,
|
|
59
|
+
instance: intent.instance,
|
|
60
|
+
notice: notice.name,
|
|
61
|
+
recipient,
|
|
62
|
+
documentKey: intent.key,
|
|
63
|
+
documentDigest: document.digest,
|
|
64
|
+
};
|
|
65
|
+
const matches = (record) => !!record &&
|
|
66
|
+
Object.entries(identity).every(([k, v]) => record[k] === v);
|
|
67
|
+
const delivered = b.noticeDelivery?.(identity.account, identity.home, identity.key), acknowledged = b.noticeAcknowledgment?.(identity.account, identity.home, identity.key), delivery = matches(delivered) && delivered.receipt && timeOrder(document.at, delivered.at) <= 0
|
|
68
|
+
? delivered
|
|
69
|
+
: null, acknowledgment = delivery &&
|
|
70
|
+
matches(acknowledged) &&
|
|
71
|
+
acknowledged.by === recipient &&
|
|
72
|
+
acknowledged.deliveryReceipt === delivery.receipt &&
|
|
73
|
+
timeOrder(delivery.at, acknowledged.at) <= 0
|
|
74
|
+
? acknowledged
|
|
75
|
+
: null;
|
|
76
|
+
copies.push({ ...identity, delivery, acknowledgment });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return copies.sort((a, b) => (a.key < b.key ? -1 : a.key > b.key ? 1 : 0));
|
|
80
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type Instance, type Value, type WorldReconciliation } from "./reconcile.js";
|
|
2
|
+
/** Resolve fully specified keys against a finite reconciled graph, preserving unknown keys. */
|
|
3
|
+
export declare const findOccurrence: (recon: WorldReconciliation, account: string, component: string, key: readonly Value[], cycle?: number, attachedTo?: string) => Instance | undefined;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Unknown } from "./reconcile.js";
|
|
2
|
+
const equalKey = (a, b) => {
|
|
3
|
+
if (a instanceof Unknown || b instanceof Unknown)
|
|
4
|
+
return false;
|
|
5
|
+
if (a === b)
|
|
6
|
+
return true;
|
|
7
|
+
return (!!a &&
|
|
8
|
+
!!b &&
|
|
9
|
+
typeof a === "object" &&
|
|
10
|
+
typeof b === "object" &&
|
|
11
|
+
"inst" in a &&
|
|
12
|
+
"inst" in b &&
|
|
13
|
+
a.inst === b.inst);
|
|
14
|
+
};
|
|
15
|
+
/** Resolve fully specified keys against a finite reconciled graph, preserving unknown keys. */
|
|
16
|
+
export const findOccurrence = (recon, account, component, key, cycle, attachedTo) => {
|
|
17
|
+
let found;
|
|
18
|
+
for (const inst of recon.instances.values()) {
|
|
19
|
+
if (inst.account !== account ||
|
|
20
|
+
inst.component !== component ||
|
|
21
|
+
inst.key.length !== key.length ||
|
|
22
|
+
(cycle !== undefined && inst.cycle !== cycle) ||
|
|
23
|
+
(attachedTo !== undefined && !inst.attached.includes(attachedTo)) ||
|
|
24
|
+
!inst.key.every((v, i) => equalKey(v, key[i])))
|
|
25
|
+
continue;
|
|
26
|
+
if (!found || inst.cycle > found.cycle)
|
|
27
|
+
found = inst;
|
|
28
|
+
}
|
|
29
|
+
return found;
|
|
30
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type EvaluationContext } from "./context.js";
|
|
2
|
+
import { ReadSet } from "./dependencies.js";
|
|
3
|
+
import type * as IR from "../world-ir/types.generated.js";
|
|
4
|
+
import { type Instance, type Status } from "./model.js";
|
|
5
|
+
export declare const allOf: (statuses: readonly Status[]) => Status;
|
|
6
|
+
export declare const anyOf: (statuses: readonly Status[]) => Status;
|
|
7
|
+
export declare const outputTexts: WeakMap<IR.Output, string>;
|
|
8
|
+
export declare const outputText: (o: IR.Output) => string;
|
|
9
|
+
export declare function requirementStatus(ctx: EvaluationContext, inst: Instance, name: string): Status;
|
|
10
|
+
export declare function statusAt(ctx: EvaluationContext, owner: Instance, segments: readonly string[], focus: string | undefined, reads: ReadSet): Status;
|
|
11
|
+
export declare function outputStatus(ctx: EvaluationContext, inst: Instance, output: IR.Output): Status;
|
|
12
|
+
export declare const readStatus: (ctx: EvaluationContext, inst: Instance, name: string) => Status;
|