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,253 @@
|
|
|
1
|
+
import type { SignatureTrail } from "./signatures.js";
|
|
2
|
+
import type { TimePoint } from "./instants.js";
|
|
3
|
+
import type * as IR from "../world-ir/types.generated.js";
|
|
4
|
+
export interface LifecycleRecord {
|
|
5
|
+
readonly routing?: readonly {
|
|
6
|
+
readonly entity: string;
|
|
7
|
+
readonly attribute: string;
|
|
8
|
+
}[];
|
|
9
|
+
readonly account: string;
|
|
10
|
+
readonly home: string;
|
|
11
|
+
readonly instance: string;
|
|
12
|
+
readonly generation: number;
|
|
13
|
+
readonly active: boolean;
|
|
14
|
+
readonly at: TimePoint;
|
|
15
|
+
}
|
|
16
|
+
export interface ResourceIntent {
|
|
17
|
+
readonly account: string;
|
|
18
|
+
readonly home: string;
|
|
19
|
+
readonly instance: string;
|
|
20
|
+
readonly resource: string;
|
|
21
|
+
readonly generation: number;
|
|
22
|
+
readonly policy: IR.Resource;
|
|
23
|
+
readonly programDigest: string;
|
|
24
|
+
readonly phase: "acquire" | "release";
|
|
25
|
+
readonly key: string;
|
|
26
|
+
readonly connector: string;
|
|
27
|
+
readonly capability: string;
|
|
28
|
+
readonly handle?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ResourceRecord extends ResourceIntent {
|
|
31
|
+
readonly observation?: {
|
|
32
|
+
readonly revision: number;
|
|
33
|
+
readonly state: string;
|
|
34
|
+
};
|
|
35
|
+
readonly commandId?: string;
|
|
36
|
+
readonly state: "acquiring" | "acquired" | "releasing" | "released" | "failed" | "uncertain" | "timed-out";
|
|
37
|
+
readonly by: string;
|
|
38
|
+
readonly at: TimePoint;
|
|
39
|
+
readonly code?: string;
|
|
40
|
+
}
|
|
41
|
+
export type Scalar = string | number | boolean;
|
|
42
|
+
/** An attribute assertion with valid time. A null value retracts the attribute. */
|
|
43
|
+
export interface Fact {
|
|
44
|
+
readonly command?: string;
|
|
45
|
+
readonly e: string;
|
|
46
|
+
readonly a: string;
|
|
47
|
+
readonly v: Scalar | null;
|
|
48
|
+
readonly at: TimePoint;
|
|
49
|
+
readonly by: string;
|
|
50
|
+
}
|
|
51
|
+
/** A host-attested upload target; this provenance grants no byte access. */
|
|
52
|
+
export type FileProducer = {
|
|
53
|
+
readonly actor: {
|
|
54
|
+
readonly id: string;
|
|
55
|
+
readonly kind: "human" | "agent" | "service";
|
|
56
|
+
};
|
|
57
|
+
} & ({
|
|
58
|
+
readonly kind: "evidence";
|
|
59
|
+
readonly evidence: string;
|
|
60
|
+
readonly field: string;
|
|
61
|
+
readonly instance: string;
|
|
62
|
+
} | {
|
|
63
|
+
readonly kind: "document";
|
|
64
|
+
readonly key: string;
|
|
65
|
+
readonly sourceIds: readonly string[];
|
|
66
|
+
});
|
|
67
|
+
/** Trusted scanner metadata; bytes are held outside the reconciliation world. */
|
|
68
|
+
export interface FileRecord {
|
|
69
|
+
readonly account: string;
|
|
70
|
+
readonly home: string;
|
|
71
|
+
readonly digest: string;
|
|
72
|
+
readonly mediaType: string;
|
|
73
|
+
readonly size: number;
|
|
74
|
+
readonly scan: "pending" | "clean" | "rejected";
|
|
75
|
+
readonly redacted: boolean;
|
|
76
|
+
readonly at: TimePoint;
|
|
77
|
+
readonly by: string;
|
|
78
|
+
readonly producer?: FileProducer;
|
|
79
|
+
}
|
|
80
|
+
/** A generated artifact retains the exact template and immutable source signatures. */
|
|
81
|
+
export interface DocumentRecord {
|
|
82
|
+
readonly key: string;
|
|
83
|
+
readonly account: string;
|
|
84
|
+
readonly home: string;
|
|
85
|
+
readonly instance: string;
|
|
86
|
+
readonly document: string;
|
|
87
|
+
readonly edition: string;
|
|
88
|
+
readonly templateDigest: string;
|
|
89
|
+
readonly sourceDigest: string;
|
|
90
|
+
readonly evidenceIds: readonly string[];
|
|
91
|
+
readonly digest: string;
|
|
92
|
+
readonly renderer: string;
|
|
93
|
+
readonly at: TimePoint;
|
|
94
|
+
readonly by: string;
|
|
95
|
+
}
|
|
96
|
+
/** Identity shared by immutable delivery and the human's separate acknowledgment. */
|
|
97
|
+
export interface NoticeIdentity {
|
|
98
|
+
readonly key: string;
|
|
99
|
+
readonly account: string;
|
|
100
|
+
readonly home: string;
|
|
101
|
+
readonly instance: string;
|
|
102
|
+
readonly notice: string;
|
|
103
|
+
readonly recipient: string;
|
|
104
|
+
readonly documentKey: string;
|
|
105
|
+
readonly documentDigest: string;
|
|
106
|
+
}
|
|
107
|
+
export interface NoticeDeliveryRecord extends NoticeIdentity {
|
|
108
|
+
readonly receipt: string;
|
|
109
|
+
readonly at: TimePoint;
|
|
110
|
+
readonly by: string;
|
|
111
|
+
}
|
|
112
|
+
export interface NoticeAcknowledgmentRecord extends NoticeIdentity {
|
|
113
|
+
readonly deliveryReceipt: string;
|
|
114
|
+
readonly at: TimePoint;
|
|
115
|
+
readonly by: string;
|
|
116
|
+
}
|
|
117
|
+
export interface EvidenceRecord {
|
|
118
|
+
readonly amendment?: {
|
|
119
|
+
readonly previous: string;
|
|
120
|
+
readonly reason: string;
|
|
121
|
+
readonly previousDigest: string;
|
|
122
|
+
};
|
|
123
|
+
readonly signature?: SignatureTrail;
|
|
124
|
+
readonly reuseScopes?: readonly string[];
|
|
125
|
+
readonly occurrences?: readonly string[];
|
|
126
|
+
readonly workKey?: string;
|
|
127
|
+
readonly interaction?: string;
|
|
128
|
+
readonly id: string;
|
|
129
|
+
readonly type: string;
|
|
130
|
+
readonly occurrence: string;
|
|
131
|
+
readonly status: "submitted" | "attested" | "superseded";
|
|
132
|
+
readonly at: TimePoint;
|
|
133
|
+
readonly by: string;
|
|
134
|
+
readonly values: Readonly<Record<string, string>>;
|
|
135
|
+
}
|
|
136
|
+
/** First observed reach; a host adds durable journal positions when it persists this record. */
|
|
137
|
+
export interface MilestoneRecord {
|
|
138
|
+
readonly instance: string;
|
|
139
|
+
readonly milestone: string;
|
|
140
|
+
readonly at: TimePoint;
|
|
141
|
+
readonly release: string;
|
|
142
|
+
readonly basis: {
|
|
143
|
+
readonly at: TimePoint;
|
|
144
|
+
readonly digest: string;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/** A human grant or revocation. Timing is captured at admission, never recomputed. */
|
|
148
|
+
export interface DecisionRecord {
|
|
149
|
+
readonly id: string;
|
|
150
|
+
readonly instance: string;
|
|
151
|
+
readonly decision: string;
|
|
152
|
+
readonly requirement: string;
|
|
153
|
+
readonly effect: "approve" | "reject" | "waive" | "defer" | "accept" | "add";
|
|
154
|
+
readonly kind: "grant" | "revoke";
|
|
155
|
+
readonly at: TimePoint;
|
|
156
|
+
readonly by: string;
|
|
157
|
+
readonly reason: Scalar | null;
|
|
158
|
+
readonly release: string;
|
|
159
|
+
readonly commandDigest: string;
|
|
160
|
+
readonly authority?: {
|
|
161
|
+
readonly kind: "individual" | "group";
|
|
162
|
+
readonly principal: string;
|
|
163
|
+
};
|
|
164
|
+
readonly approvals?: number;
|
|
165
|
+
readonly distinctFrom?: readonly string[];
|
|
166
|
+
readonly revokes?: string;
|
|
167
|
+
readonly expiresAt?: TimePoint;
|
|
168
|
+
readonly deferredUntil?: TimePoint;
|
|
169
|
+
readonly from?: string;
|
|
170
|
+
readonly evidence?: string;
|
|
171
|
+
}
|
|
172
|
+
/** A recorded decision to accept (or decline) a prior cycle's evidence for a requirement. */
|
|
173
|
+
export interface AcceptanceRecord {
|
|
174
|
+
readonly instance: string;
|
|
175
|
+
readonly requirement: string;
|
|
176
|
+
readonly from: string;
|
|
177
|
+
readonly decision: "accepted" | "declined";
|
|
178
|
+
readonly by: string;
|
|
179
|
+
readonly at: TimePoint;
|
|
180
|
+
}
|
|
181
|
+
/** An inbound signal that moved a machine to a state. */
|
|
182
|
+
export interface SignalRecord {
|
|
183
|
+
readonly generation?: number;
|
|
184
|
+
readonly account?: string;
|
|
185
|
+
readonly instance: string;
|
|
186
|
+
readonly machine: string;
|
|
187
|
+
readonly state: string;
|
|
188
|
+
readonly at: TimePoint;
|
|
189
|
+
readonly by: string;
|
|
190
|
+
}
|
|
191
|
+
export interface DispatchRecord {
|
|
192
|
+
readonly key: string;
|
|
193
|
+
readonly action: string;
|
|
194
|
+
readonly occurrence: string;
|
|
195
|
+
readonly assignee: string;
|
|
196
|
+
readonly at: TimePoint;
|
|
197
|
+
}
|
|
198
|
+
export interface JournalEntry {
|
|
199
|
+
readonly id: string;
|
|
200
|
+
readonly at: TimePoint;
|
|
201
|
+
readonly actor: string;
|
|
202
|
+
readonly title: string;
|
|
203
|
+
readonly context: string;
|
|
204
|
+
readonly changes: ReadonlyArray<{
|
|
205
|
+
label: string;
|
|
206
|
+
before: string;
|
|
207
|
+
after: string;
|
|
208
|
+
}>;
|
|
209
|
+
}
|
|
210
|
+
/** A human's confirmation is separate from the original assertion and signed documents. */
|
|
211
|
+
export interface ConfirmationRecord {
|
|
212
|
+
readonly entity: string;
|
|
213
|
+
readonly attribute: string;
|
|
214
|
+
readonly value: Scalar;
|
|
215
|
+
readonly at: TimePoint;
|
|
216
|
+
readonly by: string;
|
|
217
|
+
}
|
|
218
|
+
/** Historical metadata only; never evidence that satisfies a current requirement. */
|
|
219
|
+
export interface RedactionObservation {
|
|
220
|
+
readonly entity: string;
|
|
221
|
+
readonly attribute?: string;
|
|
222
|
+
readonly at: TimePoint;
|
|
223
|
+
readonly by?: string;
|
|
224
|
+
readonly attestation?: Pick<EvidenceRecord, "id" | "type" | "occurrence" | "status">;
|
|
225
|
+
}
|
|
226
|
+
/** Facts visible at `now`: the reconciliation basis. Later records do not exist yet. */
|
|
227
|
+
export interface Basis {
|
|
228
|
+
readonly redactions?: (entity: string) => readonly RedactionObservation[];
|
|
229
|
+
readonly lifecycleRecords?: (account: string, home: string) => readonly LifecycleRecord[];
|
|
230
|
+
readonly lifecycle?: (account: string, instance: string) => LifecycleRecord | undefined;
|
|
231
|
+
readonly resourceRecords?: (account: string, home: string) => readonly ResourceRecord[];
|
|
232
|
+
readonly now: TimePoint;
|
|
233
|
+
readonly document?: (account: string, home: string, key: string) => DocumentRecord | undefined;
|
|
234
|
+
readonly noticeDelivery?: (account: string, home: string, key: string) => NoticeDeliveryRecord | undefined;
|
|
235
|
+
readonly noticeAcknowledgment?: (account: string, home: string, key: string) => NoticeAcknowledgmentRecord | undefined;
|
|
236
|
+
readonly file?: (account: string, home: string, digest: string) => FileRecord | undefined;
|
|
237
|
+
readonly fact: (e: string, a: string) => Fact | undefined;
|
|
238
|
+
readonly confirmation?: (e: string, a: string) => ConfirmationRecord | undefined;
|
|
239
|
+
readonly entities: (ns?: string) => readonly string[];
|
|
240
|
+
/** Entities with this current attribute value, in lexical id order. */
|
|
241
|
+
readonly matching: (a: string, v: Scalar) => readonly string[];
|
|
242
|
+
readonly nsOf: (e: string) => string | undefined;
|
|
243
|
+
readonly evidence: (occurrence: string) => readonly EvidenceRecord[];
|
|
244
|
+
/** Evidence recorded for any occurrence of an instance. */
|
|
245
|
+
readonly evidenceIn?: (scope: string) => readonly EvidenceRecord[];
|
|
246
|
+
readonly evidenceOf: (instance: string) => readonly EvidenceRecord[];
|
|
247
|
+
readonly milestone?: (instance: string, name: string) => MilestoneRecord | undefined;
|
|
248
|
+
readonly decisions?: (instance: string) => readonly DecisionRecord[];
|
|
249
|
+
readonly acceptance: (instance: string, requirement: string) => AcceptanceRecord | undefined;
|
|
250
|
+
readonly history: (instance: string, machine: string) => readonly SignalRecord[];
|
|
251
|
+
readonly dispatched: (key: string) => DispatchRecord | undefined;
|
|
252
|
+
}
|
|
253
|
+
export declare const emptyBasis: (now: TimePoint) => Basis;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const emptyBasis = (now) => ({
|
|
2
|
+
now,
|
|
3
|
+
fact: () => undefined,
|
|
4
|
+
confirmation: () => undefined,
|
|
5
|
+
entities: () => [],
|
|
6
|
+
matching: () => [],
|
|
7
|
+
nsOf: () => undefined,
|
|
8
|
+
evidence: () => [],
|
|
9
|
+
evidenceOf: () => [],
|
|
10
|
+
evidenceIn: () => [],
|
|
11
|
+
milestone: () => undefined,
|
|
12
|
+
decisions: () => [],
|
|
13
|
+
acceptance: () => undefined,
|
|
14
|
+
history: () => [],
|
|
15
|
+
dispatched: () => undefined,
|
|
16
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Basis } from "./basis.js";
|
|
2
|
+
import type { ActionResult, WorldReconciliation } from "./model.js";
|
|
3
|
+
import { type ProjectedWork } from "./work.js";
|
|
4
|
+
export interface BundleItem {
|
|
5
|
+
readonly work: ProjectedWork;
|
|
6
|
+
readonly instance: string;
|
|
7
|
+
readonly action: ActionResult;
|
|
8
|
+
readonly due: string | null;
|
|
9
|
+
readonly prerequisites: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
export interface BundleSession {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly actor: string;
|
|
15
|
+
readonly cyclic: boolean;
|
|
16
|
+
readonly items: readonly BundleItem[];
|
|
17
|
+
}
|
|
18
|
+
/** A view over the supplied graph, not a new work/eligibility/signature state machine. */
|
|
19
|
+
export declare const bundleFor: (recon: WorldReconciliation, b: Basis, account: string, name: string, actor: {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly groups: readonly string[];
|
|
22
|
+
}) => BundleSession | null;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { permitsConstraints } from "./policies.js";
|
|
2
|
+
import { deadlineOrder } from "./instants.js";
|
|
3
|
+
import { workItems, actionTargets } from "./work.js";
|
|
4
|
+
/** A view over the supplied graph, not a new work/eligibility/signature state machine. */
|
|
5
|
+
export const bundleFor = (recon, b, account, name, actor) => {
|
|
6
|
+
const p = recon.programs.find((p) => p.account.name === account), definition = p?.ir.bundles?.find((d) => d.name === name);
|
|
7
|
+
const ns = b.nsOf(actor.id), entity = ns ? p?.entities.get(ns) : undefined;
|
|
8
|
+
if (!p || !definition || !entity?.implements.some((i) => i.role === definition.role))
|
|
9
|
+
return null;
|
|
10
|
+
const items = [];
|
|
11
|
+
for (const work of workItems(recon)) {
|
|
12
|
+
if (work.account !== account ||
|
|
13
|
+
!(work.assignee.kind === "entity"
|
|
14
|
+
? work.assignee.id === actor.id
|
|
15
|
+
: work.assignee.kind === "group" &&
|
|
16
|
+
work.assignee.id !== null &&
|
|
17
|
+
actor.groups.includes(work.assignee.id)))
|
|
18
|
+
continue;
|
|
19
|
+
const member = work.members[0], result = recon.results.get(member.instance), action = result.actions.find((a) => a.action === member.action);
|
|
20
|
+
if (!permitsConstraints(action.authorityConstraints ?? [], actor))
|
|
21
|
+
continue;
|
|
22
|
+
const dates = work.members
|
|
23
|
+
.flatMap((m) => {
|
|
24
|
+
const value = recon.results.get(m.instance), a = value.actions.find((a) => a.action === m.action);
|
|
25
|
+
return value.requirements
|
|
26
|
+
.filter((r) => actionTargets(a).includes(r.name) && r.due !== null)
|
|
27
|
+
.map((r) => r.due);
|
|
28
|
+
})
|
|
29
|
+
.sort(deadlineOrder);
|
|
30
|
+
items.push({
|
|
31
|
+
work,
|
|
32
|
+
instance: member.instance,
|
|
33
|
+
action,
|
|
34
|
+
due: dates[0] ?? null,
|
|
35
|
+
prerequisites: [],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const projected = items.map((item) => {
|
|
39
|
+
const prerequisites = new Set();
|
|
40
|
+
const add = (other) => {
|
|
41
|
+
if (other.work.key !== item.work.key)
|
|
42
|
+
prerequisites.add(other.work.key);
|
|
43
|
+
};
|
|
44
|
+
for (const member of item.work.members) {
|
|
45
|
+
const instance = recon.instances.get(member.instance), component = p.components.get(instance.component);
|
|
46
|
+
const action = component.actions.find((a) => a.name === member.action);
|
|
47
|
+
const visit = (e) => {
|
|
48
|
+
if (e.k === "ref" && e.kind === "evidence")
|
|
49
|
+
for (const other of items) {
|
|
50
|
+
const interaction = other.action.interaction
|
|
51
|
+
? p.interactions.get(other.action.interaction)
|
|
52
|
+
: undefined;
|
|
53
|
+
if (other.instance === member.instance && interaction?.produces === e.name)
|
|
54
|
+
add(other);
|
|
55
|
+
}
|
|
56
|
+
if (e.k === "var" && component.requirements.some((r) => r.name === e.name))
|
|
57
|
+
for (const other of items)
|
|
58
|
+
if (other.work.members.some((m) => m.instance === member.instance &&
|
|
59
|
+
recon.results
|
|
60
|
+
.get(m.instance)
|
|
61
|
+
.actions.some((a) => a.action === m.action && actionTargets(a).includes(e.name))))
|
|
62
|
+
add(other);
|
|
63
|
+
// Opaque reads/derives may hide producers. Over-order supplied work instead of discovering entities.
|
|
64
|
+
if (e.k === "inst" ||
|
|
65
|
+
e.k === "read" ||
|
|
66
|
+
e.k === "attr" ||
|
|
67
|
+
(e.k === "call" && p.derives.has(e.fn)) ||
|
|
68
|
+
(e.k === "ref" && e.kind === "decision"))
|
|
69
|
+
items.forEach(add);
|
|
70
|
+
if (e.k === "call")
|
|
71
|
+
e.args.forEach(visit);
|
|
72
|
+
if (e.k === "list")
|
|
73
|
+
e.items.forEach(visit);
|
|
74
|
+
if (e.k === "fn")
|
|
75
|
+
visit(e.body);
|
|
76
|
+
if (e.k === "if")
|
|
77
|
+
[e.test, e.then, e.else].forEach(visit);
|
|
78
|
+
if (e.k === "read" || e.k === "attr" || e.k === "inst")
|
|
79
|
+
visit(e.of);
|
|
80
|
+
};
|
|
81
|
+
action?.needs?.forEach((need) => visit(need.expr));
|
|
82
|
+
}
|
|
83
|
+
return { ...item, prerequisites: [...prerequisites].sort() };
|
|
84
|
+
});
|
|
85
|
+
const order = (a, b) => a.due && b.due
|
|
86
|
+
? deadlineOrder(a.due, b.due) ||
|
|
87
|
+
(a.work.key < b.work.key ? -1 : a.work.key > b.work.key ? 1 : 0)
|
|
88
|
+
: a.due
|
|
89
|
+
? -1
|
|
90
|
+
: b.due
|
|
91
|
+
? 1
|
|
92
|
+
: a.work.key < b.work.key
|
|
93
|
+
? -1
|
|
94
|
+
: a.work.key > b.work.key
|
|
95
|
+
? 1
|
|
96
|
+
: 0;
|
|
97
|
+
const remaining = new Map(projected.map((i) => [i.work.key, i])), ordered = [];
|
|
98
|
+
while (remaining.size) {
|
|
99
|
+
const ready = [...remaining.values()]
|
|
100
|
+
.filter((i) => i.prerequisites.every((key) => !remaining.has(key)))
|
|
101
|
+
.sort(order)[0];
|
|
102
|
+
if (!ready)
|
|
103
|
+
break;
|
|
104
|
+
ordered.push(ready);
|
|
105
|
+
remaining.delete(ready.work.key);
|
|
106
|
+
}
|
|
107
|
+
const cyclic = remaining.size > 0;
|
|
108
|
+
ordered.push(...[...remaining.values()].sort(order));
|
|
109
|
+
return { name, label: definition.label, actor: actor.id, cyclic, items: ordered };
|
|
110
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Basis } from "./basis.js";
|
|
2
|
+
import type { Program, SubjectReconciliation } from "./reconcile.js";
|
|
3
|
+
/** Replay a complete subject read set on an immutable snapshot. True permits extra work;
|
|
4
|
+
* false permits reuse only at the same date under the same linked program semantics. */
|
|
5
|
+
export declare const subjectChanged: (previous: SubjectReconciliation, program: Program, next: Basis) => boolean;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { isLocalDependency } from "./dependencies.js";
|
|
2
|
+
import { canonicalJson } from "./result-digest.js";
|
|
3
|
+
const programText = (p) => canonicalJson({ ir: p.ir, account: p.account, library: p.library, release: p.release });
|
|
4
|
+
const observed = (d, b) => {
|
|
5
|
+
switch (d.kind) {
|
|
6
|
+
case "lifecycle":
|
|
7
|
+
return b.lifecycle?.(d.account, d.instance) ?? null;
|
|
8
|
+
case "lifecycles":
|
|
9
|
+
return b.lifecycleRecords?.(d.account, d.home) ?? [];
|
|
10
|
+
case "resources":
|
|
11
|
+
return b.resourceRecords?.(d.account, d.home) ?? [];
|
|
12
|
+
case "document":
|
|
13
|
+
return b.document?.(d.account, d.home, d.key) ?? null;
|
|
14
|
+
case "notice-delivery":
|
|
15
|
+
return b.noticeDelivery?.(d.account, d.home, d.key) ?? null;
|
|
16
|
+
case "notice-acknowledgment":
|
|
17
|
+
return b.noticeAcknowledgment?.(d.account, d.home, d.key) ?? null;
|
|
18
|
+
case "file":
|
|
19
|
+
return b.file?.(d.account, d.home, d.digest) ?? null;
|
|
20
|
+
case "scoped-evidence":
|
|
21
|
+
return b.evidenceIn?.(d.scope) ?? [];
|
|
22
|
+
case "milestone":
|
|
23
|
+
return b.milestone?.(d.instance, d.name) ?? null;
|
|
24
|
+
case "confirmation":
|
|
25
|
+
return b.confirmation?.(d.entity, d.attribute) ?? null;
|
|
26
|
+
case "fact":
|
|
27
|
+
return b.fact(d.entity, d.attribute) ?? null;
|
|
28
|
+
case "entities":
|
|
29
|
+
return [...b.entities(d.namespace ?? undefined)].sort();
|
|
30
|
+
case "matching":
|
|
31
|
+
return [...b.matching(d.attribute, d.where)].sort();
|
|
32
|
+
case "namespace":
|
|
33
|
+
return b.nsOf(d.entity) ?? null;
|
|
34
|
+
case "evidence":
|
|
35
|
+
return b.evidence(d.occurrence);
|
|
36
|
+
case "decisions":
|
|
37
|
+
return b.decisions?.(d.instance) ?? [];
|
|
38
|
+
case "instance-evidence":
|
|
39
|
+
return b.evidenceOf(d.instance);
|
|
40
|
+
case "acceptance":
|
|
41
|
+
return b.acceptance(d.instance, d.requirement) ?? null;
|
|
42
|
+
case "signals":
|
|
43
|
+
return b.history(d.instance, d.machine);
|
|
44
|
+
case "dispatch":
|
|
45
|
+
return b.dispatched(d.key) ?? null;
|
|
46
|
+
case "clock":
|
|
47
|
+
return b.now;
|
|
48
|
+
// These projections are pure functions of the IR, clock and recorded Basis queries.
|
|
49
|
+
case "program":
|
|
50
|
+
case "input":
|
|
51
|
+
case "members":
|
|
52
|
+
case "status":
|
|
53
|
+
case "slot":
|
|
54
|
+
case "time":
|
|
55
|
+
return d.value;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/** Replay a complete subject read set on an immutable snapshot. True permits extra work;
|
|
59
|
+
* false permits reuse only at the same date under the same linked program semantics. */
|
|
60
|
+
export const subjectChanged = (previous, program, next) => {
|
|
61
|
+
if (previous.now !== next.now)
|
|
62
|
+
return true;
|
|
63
|
+
const before = previous.programs[0];
|
|
64
|
+
if (previous.programs.length !== 1 ||
|
|
65
|
+
!before ||
|
|
66
|
+
(before !== program && programText(before) !== programText(program)))
|
|
67
|
+
return true;
|
|
68
|
+
for (const d of previous.dependsOn.values()) {
|
|
69
|
+
// A remote projection can change without any of this home's Basis queries changing.
|
|
70
|
+
// Until output revisions can be replayed, never skip a remote graph projection.
|
|
71
|
+
// Timer observations are forecasts over the recorded queries and the checked date.
|
|
72
|
+
if (d.kind !== "time" &&
|
|
73
|
+
isLocalDependency(d) &&
|
|
74
|
+
"instance" in d &&
|
|
75
|
+
!previous.instances.has(d.instance))
|
|
76
|
+
return true;
|
|
77
|
+
const value = observed(d, next);
|
|
78
|
+
if (value !== d.value && canonicalJson(value) !== canonicalJson(d.value))
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type * as IR from "../world-ir/types.generated.js";
|
|
2
|
+
import type { Basis } from "./basis.js";
|
|
3
|
+
import { type TimePoint } from "./instants.js";
|
|
4
|
+
import type { FactCollection, Program } from "./model.js";
|
|
5
|
+
export declare const factKey: (entity: string, attribute: string) => string;
|
|
6
|
+
export declare const collectionRule: (p: Program, attribute: string) => IR.Collect | undefined;
|
|
7
|
+
export declare const collectionState: (p: Program, b: Basis, entity: string, attribute: string, temporal?: Set<TimePoint>) => FactCollection | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { plus } from "./evaluation.js";
|
|
2
|
+
import { timeOrder } from "./instants.js";
|
|
3
|
+
export const factKey = (entity, attribute) => JSON.stringify([entity, attribute]);
|
|
4
|
+
const rulesFor = (p, attribute) => (p.ir.collects ?? []).filter((c) => c.facts.some((field) => {
|
|
5
|
+
const attrs = p.bindings.get(`${c.from}.${field}`)?.attrs;
|
|
6
|
+
return attrs?.length === 1 && attrs[0] === attribute;
|
|
7
|
+
}));
|
|
8
|
+
export const collectionRule = (p, attribute) => rulesFor(p, attribute)[0];
|
|
9
|
+
export const collectionState = (p, b, entity, attribute, temporal) => {
|
|
10
|
+
const rules = rulesFor(p, attribute), rule = rules[0];
|
|
11
|
+
if (!rule)
|
|
12
|
+
return undefined;
|
|
13
|
+
const fact = b.fact(entity, attribute);
|
|
14
|
+
let confirmAt = null, unknown;
|
|
15
|
+
if (fact) {
|
|
16
|
+
const receipt = rules.some((r) => r.confirmAfter)
|
|
17
|
+
? b.confirmation?.(entity, attribute)
|
|
18
|
+
: undefined;
|
|
19
|
+
const last = receipt?.value === fact.v && timeOrder(receipt.at, fact.at) >= 0 ? receipt.at : fact.at;
|
|
20
|
+
for (const current of rules) {
|
|
21
|
+
if (!current.confirmAfter)
|
|
22
|
+
continue;
|
|
23
|
+
try {
|
|
24
|
+
const cutoff = plus(last, current.confirmAfter);
|
|
25
|
+
if (!confirmAt || timeOrder(cutoff, confirmAt) < 0)
|
|
26
|
+
confirmAt = cutoff;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (!(error instanceof RangeError))
|
|
30
|
+
throw error;
|
|
31
|
+
unknown = "The confirmation date is outside the supported calendar.";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (confirmAt && timeOrder(confirmAt, b.now) > 0)
|
|
35
|
+
temporal?.add(confirmAt);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
key: factKey(entity, attribute),
|
|
39
|
+
entity,
|
|
40
|
+
attribute,
|
|
41
|
+
name: rule.name,
|
|
42
|
+
required: !fact || (!!confirmAt && timeOrder(b.now, confirmAt) >= 0),
|
|
43
|
+
confirmAt,
|
|
44
|
+
...(unknown ? { unknown } : {}),
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Scalar } from "./basis.js";
|
|
2
|
+
import { type World } from "./memory.js";
|
|
3
|
+
import { type TimePoint } from "./instants.js";
|
|
4
|
+
import type { WorldReconciliation } from "./model.js";
|
|
5
|
+
export declare const confirmFacts: (world: World, at: TimePoint, by: string, facts: readonly {
|
|
6
|
+
entity: string;
|
|
7
|
+
attribute: string;
|
|
8
|
+
value: Scalar;
|
|
9
|
+
}[]) => World;
|
|
10
|
+
/** Refresh only provided active drafts; signed evidence is never a correction target. */
|
|
11
|
+
export declare const refreshDrafts: (recon: WorldReconciliation, world: World, at: TimePoint, changed: ReadonlySet<string>) => World;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { basis } from "./memory.js";
|
|
2
|
+
import { evaluateFor } from "./evaluation.js";
|
|
3
|
+
import { programFor } from "./reconcile.js";
|
|
4
|
+
import { factKey } from "./collection-rules.js";
|
|
5
|
+
import { timeOrder } from "./instants.js";
|
|
6
|
+
export const confirmFacts = (world, at, by, facts) => {
|
|
7
|
+
const current = basis(world, at);
|
|
8
|
+
const records = facts
|
|
9
|
+
.filter((f) => {
|
|
10
|
+
const old = current.confirmation?.(f.entity, f.attribute);
|
|
11
|
+
return old?.value !== f.value || old.at !== at || old.by !== by;
|
|
12
|
+
})
|
|
13
|
+
.map((f) => ({ ...f, at, by }));
|
|
14
|
+
return records.length
|
|
15
|
+
? { ...world, confirmations: [...(world.confirmations ?? []), ...records] }
|
|
16
|
+
: world;
|
|
17
|
+
};
|
|
18
|
+
/** Refresh only provided active drafts; signed evidence is never a correction target. */
|
|
19
|
+
export const refreshDrafts = (recon, world, at, changed) => {
|
|
20
|
+
if (!changed.size)
|
|
21
|
+
return world;
|
|
22
|
+
const snapshot = basis(world, at);
|
|
23
|
+
let modified = false;
|
|
24
|
+
const evidence = world.evidence.map((record) => {
|
|
25
|
+
if (record.status !== "submitted" || timeOrder(record.at, at) > 0)
|
|
26
|
+
return record;
|
|
27
|
+
const instance = record.occurrence.slice(0, record.occurrence.lastIndexOf("/")), p = programFor(recon, instance);
|
|
28
|
+
if (!p)
|
|
29
|
+
return record;
|
|
30
|
+
const candidates = [...p.interactions.values()].filter((i) => i.produces === record.type);
|
|
31
|
+
const interaction = record.interaction
|
|
32
|
+
? p.interactions.get(record.interaction)
|
|
33
|
+
: candidates.length === 1
|
|
34
|
+
? candidates[0]
|
|
35
|
+
: undefined;
|
|
36
|
+
if (!interaction)
|
|
37
|
+
return record;
|
|
38
|
+
let values = record.values;
|
|
39
|
+
for (const binding of interaction.binds) {
|
|
40
|
+
const expr = binding.from ?? binding.target;
|
|
41
|
+
if (expr?.k !== "attr")
|
|
42
|
+
continue;
|
|
43
|
+
const entity = evaluateFor(recon, snapshot, at, instance, expr.of, record.occurrence);
|
|
44
|
+
if (typeof entity !== "string" || !changed.has(factKey(entity, expr.attr)))
|
|
45
|
+
continue;
|
|
46
|
+
const value = snapshot.fact(entity, expr.attr)?.v;
|
|
47
|
+
if (value === undefined || value === null) {
|
|
48
|
+
if (Object.hasOwn(values, binding.field)) {
|
|
49
|
+
const { [binding.field]: old, ...rest } = values;
|
|
50
|
+
values = rest;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else if (values[binding.field] !== String(value))
|
|
54
|
+
values = { ...values, [binding.field]: String(value) };
|
|
55
|
+
}
|
|
56
|
+
if (values === record.values)
|
|
57
|
+
return record;
|
|
58
|
+
modified = true;
|
|
59
|
+
return { ...record, values };
|
|
60
|
+
});
|
|
61
|
+
return modified ? { ...world, evidence } : world;
|
|
62
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type * as IR from "../world-ir/types.generated.js";
|
|
2
|
+
import type { Scalar } from "./basis.js";
|
|
3
|
+
import type { Program } from "./model.js";
|
|
4
|
+
/** Collection writes are scalar facts, validated against the owning entity's type. */
|
|
5
|
+
export declare const collectionValue: (p: Program, type: IR.TypeRef, value: Scalar) => Scalar | undefined;
|