@sunshaobei/dsh-workflow 0.0.0-stage → 2.1.2
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/README.md +43 -2
- package/cordis.patch.yml +17 -0
- package/lib/client.js +14708 -0
- package/lib/core.js +137 -0
- package/lib/engine-adapter.js +1387 -0
- package/lib/host-driver.js +298 -0
- package/lib/index.js +536 -0
- package/lib/projection.js +159 -0
- package/lib/registry.js +218 -0
- package/lib/session-records.js +54 -0
- package/lib/submission-commit.js +34 -0
- package/lib/world-driver.js +275 -0
- package/package.json +67 -4
- package/vendor/PROVENANCE.md +9 -0
- package/vendor/dynamic-workflow/analysis/actor-graph.d.ts +47 -0
- package/vendor/dynamic-workflow/analysis/actor-graph.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/actor-graph.js +95 -0
- package/vendor/dynamic-workflow/analysis/actor-models.d.ts +60 -0
- package/vendor/dynamic-workflow/analysis/actor-models.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/actor-models.js +208 -0
- package/vendor/dynamic-workflow/analysis/actor-names.d.ts +56 -0
- package/vendor/dynamic-workflow/analysis/actor-names.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/actor-names.js +155 -0
- package/vendor/dynamic-workflow/analysis/analyze.d.ts +63 -0
- package/vendor/dynamic-workflow/analysis/analyze.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/analyze.js +92 -0
- package/vendor/dynamic-workflow/analysis/array-methods.d.ts +21 -0
- package/vendor/dynamic-workflow/analysis/array-methods.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/array-methods.js +132 -0
- package/vendor/dynamic-workflow/analysis/artifact-types.d.ts +39 -0
- package/vendor/dynamic-workflow/analysis/artifact-types.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/artifact-types.js +114 -0
- package/vendor/dynamic-workflow/analysis/artifacts.d.ts +67 -0
- package/vendor/dynamic-workflow/analysis/artifacts.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/artifacts.js +263 -0
- package/vendor/dynamic-workflow/analysis/assign.d.ts +42 -0
- package/vendor/dynamic-workflow/analysis/assign.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/assign.js +287 -0
- package/vendor/dynamic-workflow/analysis/callbacks.d.ts +71 -0
- package/vendor/dynamic-workflow/analysis/callbacks.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/callbacks.js +133 -0
- package/vendor/dynamic-workflow/analysis/calls.d.ts +40 -0
- package/vendor/dynamic-workflow/analysis/calls.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/calls.js +495 -0
- package/vendor/dynamic-workflow/analysis/causality-graph-lanes.d.ts +25 -0
- package/vendor/dynamic-workflow/analysis/causality-graph-lanes.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/causality-graph-lanes.js +161 -0
- package/vendor/dynamic-workflow/analysis/causality-graph-types.d.ts +163 -0
- package/vendor/dynamic-workflow/analysis/causality-graph-types.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/causality-graph-types.js +8 -0
- package/vendor/dynamic-workflow/analysis/causality-graph.d.ts +39 -0
- package/vendor/dynamic-workflow/analysis/causality-graph.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/causality-graph.js +530 -0
- package/vendor/dynamic-workflow/analysis/causality-order-calls.d.ts +29 -0
- package/vendor/dynamic-workflow/analysis/causality-order-calls.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/causality-order-calls.js +266 -0
- package/vendor/dynamic-workflow/analysis/causality-order-functions.d.ts +26 -0
- package/vendor/dynamic-workflow/analysis/causality-order-functions.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/causality-order-functions.js +116 -0
- package/vendor/dynamic-workflow/analysis/causality-order-loops.d.ts +5 -0
- package/vendor/dynamic-workflow/analysis/causality-order-loops.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/causality-order-loops.js +148 -0
- package/vendor/dynamic-workflow/analysis/causality-order-settle.d.ts +39 -0
- package/vendor/dynamic-workflow/analysis/causality-order-settle.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/causality-order-settle.js +263 -0
- package/vendor/dynamic-workflow/analysis/causality-order-state.d.ts +110 -0
- package/vendor/dynamic-workflow/analysis/causality-order-state.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/causality-order-state.js +162 -0
- package/vendor/dynamic-workflow/analysis/causality-order-strands.d.ts +79 -0
- package/vendor/dynamic-workflow/analysis/causality-order-strands.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/causality-order-strands.js +154 -0
- package/vendor/dynamic-workflow/analysis/causality-order-types.d.ts +174 -0
- package/vendor/dynamic-workflow/analysis/causality-order-types.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/causality-order-types.js +1 -0
- package/vendor/dynamic-workflow/analysis/causality-order-walk.d.ts +17 -0
- package/vendor/dynamic-workflow/analysis/causality-order-walk.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/causality-order-walk.js +282 -0
- package/vendor/dynamic-workflow/analysis/causality-order.d.ts +60 -0
- package/vendor/dynamic-workflow/analysis/causality-order.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/causality-order.js +110 -0
- package/vendor/dynamic-workflow/analysis/causality-reduce.d.ts +60 -0
- package/vendor/dynamic-workflow/analysis/causality-reduce.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/causality-reduce.js +198 -0
- package/vendor/dynamic-workflow/analysis/classes.d.ts +47 -0
- package/vendor/dynamic-workflow/analysis/classes.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/classes.js +264 -0
- package/vendor/dynamic-workflow/analysis/constants.d.ts +35 -0
- package/vendor/dynamic-workflow/analysis/constants.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/constants.js +23 -0
- package/vendor/dynamic-workflow/analysis/control-flow.d.ts +26 -0
- package/vendor/dynamic-workflow/analysis/control-flow.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/control-flow.js +132 -0
- package/vendor/dynamic-workflow/analysis/core-json.d.ts +45 -0
- package/vendor/dynamic-workflow/analysis/core-json.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/core-json.js +49 -0
- package/vendor/dynamic-workflow/analysis/core.d.ts +194 -0
- package/vendor/dynamic-workflow/analysis/core.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/core.js +204 -0
- package/vendor/dynamic-workflow/analysis/domain.d.ts +269 -0
- package/vendor/dynamic-workflow/analysis/domain.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/domain.js +523 -0
- package/vendor/dynamic-workflow/analysis/facade-misuse.d.ts +56 -0
- package/vendor/dynamic-workflow/analysis/facade-misuse.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/facade-misuse.js +350 -0
- package/vendor/dynamic-workflow/analysis/fanout-cardinality.d.ts +11 -0
- package/vendor/dynamic-workflow/analysis/fanout-cardinality.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/fanout-cardinality.js +121 -0
- package/vendor/dynamic-workflow/analysis/flow-graph.d.ts +113 -0
- package/vendor/dynamic-workflow/analysis/flow-graph.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/flow-graph.js +411 -0
- package/vendor/dynamic-workflow/analysis/flow-phase.d.ts +28 -0
- package/vendor/dynamic-workflow/analysis/flow-phase.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/flow-phase.js +104 -0
- package/vendor/dynamic-workflow/analysis/flow-strands.d.ts +39 -0
- package/vendor/dynamic-workflow/analysis/flow-strands.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/flow-strands.js +47 -0
- package/vendor/dynamic-workflow/analysis/flow-tree.d.ts +35 -0
- package/vendor/dynamic-workflow/analysis/flow-tree.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/flow-tree.js +33 -0
- package/vendor/dynamic-workflow/analysis/graph.d.ts +5 -0
- package/vendor/dynamic-workflow/analysis/graph.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/graph.js +199 -0
- package/vendor/dynamic-workflow/analysis/handoff-graph.d.ts +48 -0
- package/vendor/dynamic-workflow/analysis/handoff-graph.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/handoff-graph.js +0 -0
- package/vendor/dynamic-workflow/analysis/heap-ops.d.ts +14 -0
- package/vendor/dynamic-workflow/analysis/heap-ops.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/heap-ops.js +70 -0
- package/vendor/dynamic-workflow/analysis/hole-id.d.ts +28 -0
- package/vendor/dynamic-workflow/analysis/hole-id.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/hole-id.js +41 -0
- package/vendor/dynamic-workflow/analysis/hole-sites.d.ts +32 -0
- package/vendor/dynamic-workflow/analysis/hole-sites.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/hole-sites.js +215 -0
- package/vendor/dynamic-workflow/analysis/hole-splice.d.ts +45 -0
- package/vendor/dynamic-workflow/analysis/hole-splice.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/hole-splice.js +100 -0
- package/vendor/dynamic-workflow/analysis/interpret.d.ts +26 -0
- package/vendor/dynamic-workflow/analysis/interpret.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/interpret.js +200 -0
- package/vendor/dynamic-workflow/analysis/literals.d.ts +18 -0
- package/vendor/dynamic-workflow/analysis/literals.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/literals.js +125 -0
- package/vendor/dynamic-workflow/analysis/mermaid.d.ts +60 -0
- package/vendor/dynamic-workflow/analysis/mermaid.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/mermaid.js +477 -0
- package/vendor/dynamic-workflow/analysis/patterns.d.ts +31 -0
- package/vendor/dynamic-workflow/analysis/patterns.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/patterns.js +94 -0
- package/vendor/dynamic-workflow/analysis/phase-graph.d.ts +47 -0
- package/vendor/dynamic-workflow/analysis/phase-graph.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/phase-graph.js +334 -0
- package/vendor/dynamic-workflow/analysis/phases.d.ts +24 -0
- package/vendor/dynamic-workflow/analysis/phases.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/phases.js +54 -0
- package/vendor/dynamic-workflow/analysis/promise-ops.d.ts +52 -0
- package/vendor/dynamic-workflow/analysis/promise-ops.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/promise-ops.js +123 -0
- package/vendor/dynamic-workflow/analysis/relays.d.ts +12 -0
- package/vendor/dynamic-workflow/analysis/relays.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/relays.js +78 -0
- package/vendor/dynamic-workflow/analysis/serialize.d.ts +125 -0
- package/vendor/dynamic-workflow/analysis/serialize.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/serialize.js +321 -0
- package/vendor/dynamic-workflow/analysis/site-phases.d.ts +32 -0
- package/vendor/dynamic-workflow/analysis/site-phases.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/site-phases.js +69 -0
- package/vendor/dynamic-workflow/analysis/sites-labels.d.ts +71 -0
- package/vendor/dynamic-workflow/analysis/sites-labels.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/sites-labels.js +189 -0
- package/vendor/dynamic-workflow/analysis/sites.d.ts +267 -0
- package/vendor/dynamic-workflow/analysis/sites.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/sites.js +225 -0
- package/vendor/dynamic-workflow/analysis/state.d.ts +254 -0
- package/vendor/dynamic-workflow/analysis/state.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/state.js +569 -0
- package/vendor/dynamic-workflow/analysis/taint.d.ts +97 -0
- package/vendor/dynamic-workflow/analysis/taint.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/taint.js +649 -0
- package/vendor/dynamic-workflow/analysis/types.d.ts +100 -0
- package/vendor/dynamic-workflow/analysis/types.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/types.js +1 -0
- package/vendor/dynamic-workflow/analysis/world-run.d.ts +27 -0
- package/vendor/dynamic-workflow/analysis/world-run.d.ts.map +1 -0
- package/vendor/dynamic-workflow/analysis/world-run.js +44 -0
- package/vendor/dynamic-workflow/compiler/compile.d.ts +59 -0
- package/vendor/dynamic-workflow/compiler/compile.d.ts.map +1 -0
- package/vendor/dynamic-workflow/compiler/compile.js +159 -0
- package/vendor/dynamic-workflow/compiler/libs.generated.d.ts +3 -0
- package/vendor/dynamic-workflow/compiler/libs.generated.d.ts.map +1 -0
- package/vendor/dynamic-workflow/compiler/libs.generated.js +64 -0
- package/vendor/dynamic-workflow/engine/artifact-spec.d.ts +26 -0
- package/vendor/dynamic-workflow/engine/artifact-spec.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/artifact-spec.js +173 -0
- package/vendor/dynamic-workflow/engine/ask-observation-types.d.ts +54 -0
- package/vendor/dynamic-workflow/engine/ask-observation-types.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/ask-observation-types.js +19 -0
- package/vendor/dynamic-workflow/engine/cached-ask-facts.d.ts +28 -0
- package/vendor/dynamic-workflow/engine/cached-ask-facts.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/cached-ask-facts.js +35 -0
- package/vendor/dynamic-workflow/engine/concurrency.d.ts +151 -0
- package/vendor/dynamic-workflow/engine/concurrency.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/concurrency.js +282 -0
- package/vendor/dynamic-workflow/engine/engine-artifacts-primary.d.ts +17 -0
- package/vendor/dynamic-workflow/engine/engine-artifacts-primary.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/engine-artifacts-primary.js +29 -0
- package/vendor/dynamic-workflow/engine/engine-artifacts.d.ts +55 -0
- package/vendor/dynamic-workflow/engine/engine-artifacts.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/engine-artifacts.js +367 -0
- package/vendor/dynamic-workflow/engine/engine-config.d.ts +90 -0
- package/vendor/dynamic-workflow/engine/engine-config.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/engine-config.js +6 -0
- package/vendor/dynamic-workflow/engine/engine-holes.d.ts +116 -0
- package/vendor/dynamic-workflow/engine/engine-holes.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/engine-holes.js +142 -0
- package/vendor/dynamic-workflow/engine/engine-launch.d.ts +34 -0
- package/vendor/dynamic-workflow/engine/engine-launch.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/engine-launch.js +26 -0
- package/vendor/dynamic-workflow/engine/engine-phase-stamp.d.ts +35 -0
- package/vendor/dynamic-workflow/engine/engine-phase-stamp.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/engine-phase-stamp.js +74 -0
- package/vendor/dynamic-workflow/engine/engine-report.d.ts +27 -0
- package/vendor/dynamic-workflow/engine/engine-report.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/engine-report.js +151 -0
- package/vendor/dynamic-workflow/engine/engine-resume.d.ts +18 -0
- package/vendor/dynamic-workflow/engine/engine-resume.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/engine-resume.js +38 -0
- package/vendor/dynamic-workflow/engine/engine-settlement.d.ts +30 -0
- package/vendor/dynamic-workflow/engine/engine-settlement.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/engine-settlement.js +79 -0
- package/vendor/dynamic-workflow/engine/engine-state.d.ts +99 -0
- package/vendor/dynamic-workflow/engine/engine-state.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/engine-state.js +13 -0
- package/vendor/dynamic-workflow/engine/engine-world.d.ts +36 -0
- package/vendor/dynamic-workflow/engine/engine-world.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/engine-world.js +189 -0
- package/vendor/dynamic-workflow/engine/engine.d.ts +263 -0
- package/vendor/dynamic-workflow/engine/engine.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/engine.js +602 -0
- package/vendor/dynamic-workflow/engine/errors.d.ts +87 -0
- package/vendor/dynamic-workflow/engine/errors.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/errors.js +56 -0
- package/vendor/dynamic-workflow/engine/hash-mismatch.d.ts +10 -0
- package/vendor/dynamic-workflow/engine/hash-mismatch.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/hash-mismatch.js +15 -0
- package/vendor/dynamic-workflow/engine/hash.d.ts +16 -0
- package/vendor/dynamic-workflow/engine/hash.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/hash.js +48 -0
- package/vendor/dynamic-workflow/engine/imported-cache-types.d.ts +96 -0
- package/vendor/dynamic-workflow/engine/imported-cache-types.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/imported-cache-types.js +6 -0
- package/vendor/dynamic-workflow/engine/imported-cache.d.ts +127 -0
- package/vendor/dynamic-workflow/engine/imported-cache.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/imported-cache.js +244 -0
- package/vendor/dynamic-workflow/engine/index.d.ts +11 -0
- package/vendor/dynamic-workflow/engine/index.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/index.js +10 -0
- package/vendor/dynamic-workflow/engine/journal-memory.d.ts +32 -0
- package/vendor/dynamic-workflow/engine/journal-memory.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/journal-memory.js +243 -0
- package/vendor/dynamic-workflow/engine/journal-read-types.d.ts +72 -0
- package/vendor/dynamic-workflow/engine/journal-read-types.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/journal-read-types.js +28 -0
- package/vendor/dynamic-workflow/engine/persona.d.ts +20 -0
- package/vendor/dynamic-workflow/engine/persona.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/persona.js +43 -0
- package/vendor/dynamic-workflow/engine/replay-order.d.ts +96 -0
- package/vendor/dynamic-workflow/engine/replay-order.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/replay-order.js +229 -0
- package/vendor/dynamic-workflow/engine/run-terminal.d.ts +35 -0
- package/vendor/dynamic-workflow/engine/run-terminal.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/run-terminal.js +7 -0
- package/vendor/dynamic-workflow/engine/scheduler-submit.d.ts +22 -0
- package/vendor/dynamic-workflow/engine/scheduler-submit.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/scheduler-submit.js +84 -0
- package/vendor/dynamic-workflow/engine/scheduler-types.d.ts +105 -0
- package/vendor/dynamic-workflow/engine/scheduler-types.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/scheduler-types.js +17 -0
- package/vendor/dynamic-workflow/engine/scheduler.d.ts +113 -0
- package/vendor/dynamic-workflow/engine/scheduler.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/scheduler.js +484 -0
- package/vendor/dynamic-workflow/engine/types.d.ts +979 -0
- package/vendor/dynamic-workflow/engine/types.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/types.js +26 -0
- package/vendor/dynamic-workflow/engine/world-read-input.d.ts +10 -0
- package/vendor/dynamic-workflow/engine/world-read-input.d.ts.map +1 -0
- package/vendor/dynamic-workflow/engine/world-read-input.js +55 -0
- package/vendor/dynamic-workflow/facade/artifact-caps.d.ts +48 -0
- package/vendor/dynamic-workflow/facade/artifact-caps.d.ts.map +1 -0
- package/vendor/dynamic-workflow/facade/artifact-caps.js +47 -0
- package/vendor/dynamic-workflow/facade/dts-hole.d.ts +16 -0
- package/vendor/dynamic-workflow/facade/dts-hole.d.ts.map +1 -0
- package/vendor/dynamic-workflow/facade/dts-hole.js +26 -0
- package/vendor/dynamic-workflow/facade/dts-model.d.ts +11 -0
- package/vendor/dynamic-workflow/facade/dts-model.d.ts.map +1 -0
- package/vendor/dynamic-workflow/facade/dts-model.js +18 -0
- package/vendor/dynamic-workflow/facade/dts-stream.d.ts +15 -0
- package/vendor/dynamic-workflow/facade/dts-stream.d.ts.map +1 -0
- package/vendor/dynamic-workflow/facade/dts-stream.js +41 -0
- package/vendor/dynamic-workflow/facade/dts.d.ts +29 -0
- package/vendor/dynamic-workflow/facade/dts.d.ts.map +1 -0
- package/vendor/dynamic-workflow/facade/dts.js +324 -0
- package/vendor/dynamic-workflow/facade/registry.d.ts +218 -0
- package/vendor/dynamic-workflow/facade/registry.d.ts.map +1 -0
- package/vendor/dynamic-workflow/facade/registry.js +203 -0
- package/vendor/dynamic-workflow/facade/report-caps.d.ts +40 -0
- package/vendor/dynamic-workflow/facade/report-caps.d.ts.map +1 -0
- package/vendor/dynamic-workflow/facade/report-caps.js +39 -0
- package/vendor/dynamic-workflow/facade/world-read-caps.d.ts +37 -0
- package/vendor/dynamic-workflow/facade/world-read-caps.d.ts.map +1 -0
- package/vendor/dynamic-workflow/facade/world-read-caps.js +36 -0
- package/vendor/dynamic-workflow/index.d.ts +41 -0
- package/vendor/dynamic-workflow/index.d.ts.map +1 -0
- package/vendor/dynamic-workflow/index.js +51 -0
- package/vendor/dynamic-workflow/lowering/index.d.ts +2 -0
- package/vendor/dynamic-workflow/lowering/index.d.ts.map +1 -0
- package/vendor/dynamic-workflow/lowering/index.js +1 -0
- package/vendor/dynamic-workflow/lowering/lower-hole.d.ts +16 -0
- package/vendor/dynamic-workflow/lowering/lower-hole.d.ts.map +1 -0
- package/vendor/dynamic-workflow/lowering/lower-hole.js +63 -0
- package/vendor/dynamic-workflow/lowering/lower.d.ts +82 -0
- package/vendor/dynamic-workflow/lowering/lower.d.ts.map +1 -0
- package/vendor/dynamic-workflow/lowering/lower.js +333 -0
- package/vendor/dynamic-workflow/projections.d.ts +26 -0
- package/vendor/dynamic-workflow/projections.d.ts.map +1 -0
- package/vendor/dynamic-workflow/projections.js +23 -0
- package/vendor/dynamic-workflow/schema/actor-submit-profiles.d.ts +49 -0
- package/vendor/dynamic-workflow/schema/actor-submit-profiles.d.ts.map +1 -0
- package/vendor/dynamic-workflow/schema/actor-submit-profiles.js +69 -0
- package/vendor/dynamic-workflow/schema/emit.d.ts +55 -0
- package/vendor/dynamic-workflow/schema/emit.d.ts.map +1 -0
- package/vendor/dynamic-workflow/schema/emit.js +325 -0
- package/vendor/dynamic-workflow/schema/jsdoc.d.ts +10 -0
- package/vendor/dynamic-workflow/schema/jsdoc.d.ts.map +1 -0
- package/vendor/dynamic-workflow/schema/jsdoc.js +83 -0
- package/vendor/dynamic-workflow/schema/serialize.d.ts +8 -0
- package/vendor/dynamic-workflow/schema/serialize.d.ts.map +1 -0
- package/vendor/dynamic-workflow/schema/serialize.js +20 -0
- package/vendor/dynamic-workflow/schema/synthesize.d.ts +48 -0
- package/vendor/dynamic-workflow/schema/synthesize.d.ts.map +1 -0
- package/vendor/dynamic-workflow/schema/synthesize.js +138 -0
- package/vendor/dynamic-workflow/schema/types.d.ts +67 -0
- package/vendor/dynamic-workflow/schema/types.d.ts.map +1 -0
- package/vendor/dynamic-workflow/schema/types.js +18 -0
- package/vendor/dynamic-workflow/schema/validate.d.ts +15 -0
- package/vendor/dynamic-workflow/schema/validate.d.ts.map +1 -0
- package/vendor/dynamic-workflow/schema/validate.js +213 -0
- package/vendor/dynamic-workflow/testing/index.d.ts +6 -0
- package/vendor/dynamic-workflow/testing/index.d.ts.map +1 -0
- package/vendor/dynamic-workflow/testing/index.js +5 -0
- package/vendor/dynamic-workflow/testing/journal-contract-artifacts.d.ts +9 -0
- package/vendor/dynamic-workflow/testing/journal-contract-artifacts.d.ts.map +1 -0
- package/vendor/dynamic-workflow/testing/journal-contract-artifacts.js +195 -0
- package/vendor/dynamic-workflow/testing/journal-contract-events.d.ts +9 -0
- package/vendor/dynamic-workflow/testing/journal-contract-events.d.ts.map +1 -0
- package/vendor/dynamic-workflow/testing/journal-contract-events.js +163 -0
- package/vendor/dynamic-workflow/testing/journal-contract-helpers.d.ts +9 -0
- package/vendor/dynamic-workflow/testing/journal-contract-helpers.d.ts.map +1 -0
- package/vendor/dynamic-workflow/testing/journal-contract-helpers.js +12 -0
- package/vendor/dynamic-workflow/testing/journal-contract-isolation.d.ts +9 -0
- package/vendor/dynamic-workflow/testing/journal-contract-isolation.d.ts.map +1 -0
- package/vendor/dynamic-workflow/testing/journal-contract-isolation.js +46 -0
- package/vendor/dynamic-workflow/testing/journal-contract-nodes.d.ts +9 -0
- package/vendor/dynamic-workflow/testing/journal-contract-nodes.d.ts.map +1 -0
- package/vendor/dynamic-workflow/testing/journal-contract-nodes.js +234 -0
- package/vendor/dynamic-workflow/testing/journal-contract-reads.d.ts +11 -0
- package/vendor/dynamic-workflow/testing/journal-contract-reads.d.ts.map +1 -0
- package/vendor/dynamic-workflow/testing/journal-contract-reads.js +281 -0
- package/vendor/dynamic-workflow/testing/journal-contract-runs.d.ts +9 -0
- package/vendor/dynamic-workflow/testing/journal-contract-runs.d.ts.map +1 -0
- package/vendor/dynamic-workflow/testing/journal-contract-runs.js +396 -0
- package/vendor/dynamic-workflow/testing/journal-contract-script.d.ts +12 -0
- package/vendor/dynamic-workflow/testing/journal-contract-script.d.ts.map +1 -0
- package/vendor/dynamic-workflow/testing/journal-contract-script.js +82 -0
- package/vendor/dynamic-workflow/testing/journal-contract.d.ts +15 -0
- package/vendor/dynamic-workflow/testing/journal-contract.d.ts.map +1 -0
- package/vendor/dynamic-workflow/testing/journal-contract.js +31 -0
- package/vendor/dynamic-workflow-runtime/child-cell-streams.js +128 -0
- package/vendor/dynamic-workflow-runtime/child-entry-file.js +43 -0
- package/vendor/dynamic-workflow-runtime/child-source.js +299 -0
- package/vendor/dynamic-workflow-runtime/harness.js +302 -0
- package/vendor/dynamic-workflow-runtime/index.js +4 -0
- package/vendor/dynamic-workflow-runtime/protocol.js +2 -0
- package/vendor/mcode-host/dynamic-workflow-import.js +269 -0
- package/vendor/mcode-host/workflow-git-world-read.js +183 -0
- package/vendor/mcode-host/workflow-world-read.js +282 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { clearExact, cloneValue, collapse, collapseInto, emptyValue, mergeInto, } from "./domain.js";
|
|
3
|
+
import { applyPessimistically, recordCall } from "./calls.js";
|
|
4
|
+
/**
|
|
5
|
+
* Promise and constructor transfer rules, split out of calls.ts (max-lines): the unknown-`new`
|
|
6
|
+
* keystone with the promise-executor rule, `await` of a thenable, `Promise.reject`, and the
|
|
7
|
+
* script-class constructor application. Same `Evaluator` instance, same contract; they call back into calls.ts's shared primitives.
|
|
8
|
+
*/
|
|
9
|
+
/** The taint fed to invocations of function `fn`'s parameters (the promise resolve/reject/
|
|
10
|
+
* continuation pattern). Empty for a non-tracked fn or one whose params are never invoked. */
|
|
11
|
+
function appliedCallbackTaint(ev, fn) {
|
|
12
|
+
const out = emptyValue();
|
|
13
|
+
const id = ev.s.fnId.get(fn);
|
|
14
|
+
if (id === undefined)
|
|
15
|
+
return out;
|
|
16
|
+
const paramCount = (ev.s.fnParamSymbols.get(id) ?? []).length;
|
|
17
|
+
for (let param = 0; param < paramCount; param += 1) {
|
|
18
|
+
const captured = ev.s.phCallActualsOf(id, param);
|
|
19
|
+
if (captured !== undefined)
|
|
20
|
+
mergeInto(out, captured);
|
|
21
|
+
}
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* `new UnknownThing(args)` (a non-class callee: `new Promise(exec)`, `new Set([x])`): the
|
|
26
|
+
* union of the argument collapses (exact preserved, "strings launder nothing"), PLUS the
|
|
27
|
+
* unknown-call keystone — function-valued args are pessimistically applied (their return
|
|
28
|
+
* summary joins the result) — PLUS the promise-executor rule: whatever a function arg feeds
|
|
29
|
+
* to invocations of its OWN parameters joins the result (`new Promise((resolve) =>
|
|
30
|
+
* resolve(draft))` resolves to `draft`; a `reject(x)` arg lands in the pot too, an
|
|
31
|
+
* over-approximation of the rejection path). Generic: `new X(fn)` may invoke fn and capture
|
|
32
|
+
* what fn's params receive — never special-cased by name.
|
|
33
|
+
*/
|
|
34
|
+
export function handleNewUnknown(ev, node, ctx) {
|
|
35
|
+
const out = emptyValue();
|
|
36
|
+
const argVals = (node.arguments ?? []).map((arg) => ev.evalExpr(arg, ctx));
|
|
37
|
+
for (const argVal of argVals)
|
|
38
|
+
collapseInto(out, argVal);
|
|
39
|
+
// The pot the constructor may feed to a callback arg's params is the sibling DATA, not the
|
|
40
|
+
// callables themselves (a function arg is the callback being invoked, not data passed to a
|
|
41
|
+
// sibling), so strip `fns`: otherwise binding a param to the executor's own fn would make
|
|
42
|
+
// `resolve(draft)` dispatch as the executor and bypass the placeholder-invocation capture.
|
|
43
|
+
const pot = clearExact(out);
|
|
44
|
+
pot.fns.clear();
|
|
45
|
+
for (const argVal of argVals) {
|
|
46
|
+
applyPessimistically(ev, argVal, pot, ctx, out, node);
|
|
47
|
+
for (const fn of argVal.fns)
|
|
48
|
+
mergeInto(out, appliedCallbackTaint(ev, fn));
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* `await e`: model awaiting a thenable = invoking its `then`. When the awaited value carries
|
|
54
|
+
* a tracked `then` method, the promise resolves to whatever that method feeds its continuation
|
|
55
|
+
* callback (`appliedCallbackTaint`): a custom thenable whose `then(onOk)` calls
|
|
56
|
+
* `draft.then(onOk)` resolves to `draft`. When no `then` fn is visible (a plain settled value,
|
|
57
|
+
* or a thenable collapsed past field-sensitivity), the operand's own taint already flows
|
|
58
|
+
* through unchanged — the await is a passthrough, as before.
|
|
59
|
+
*
|
|
60
|
+
* Both exits also RECORD the returned value as the settle oracle for this await. Recording only; the value returned to
|
|
61
|
+
* the evaluator is untouched, so no transfer rule changes.
|
|
62
|
+
*/
|
|
63
|
+
export function evalAwait(ev, node, ctx) {
|
|
64
|
+
const at = node.getStart(ev.s.scriptFile);
|
|
65
|
+
const inner = ev.evalExpr(node.expression, ctx);
|
|
66
|
+
const thenField = inner.fields.get("then");
|
|
67
|
+
if (thenField === undefined || thenField.fns.size === 0) {
|
|
68
|
+
ev.s.mergeSink(ev.s.awaitVal, at, inner);
|
|
69
|
+
return inner;
|
|
70
|
+
}
|
|
71
|
+
const out = cloneValue(inner);
|
|
72
|
+
for (const fn of thenField.fns) {
|
|
73
|
+
const id = ev.s.fnId.get(fn);
|
|
74
|
+
if (id !== undefined)
|
|
75
|
+
ev.s.markCalled(ctx.regionStack, id);
|
|
76
|
+
mergeInto(out, appliedCallbackTaint(ev, fn));
|
|
77
|
+
}
|
|
78
|
+
ev.s.mergeSink(ev.s.awaitVal, at, out);
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
/** `Promise.reject(x)` — a rejected promise. Await unwraps it as a THROW, so feed collapse(x)
|
|
82
|
+
* into the global thrown set (read by every catch binding). Returns collapse(x) as before
|
|
83
|
+
* (the unknown-call result), so nothing on the resolved path regresses. */
|
|
84
|
+
export function handlePromiseReject(ev, node, ctx) {
|
|
85
|
+
const arg = node.arguments[0];
|
|
86
|
+
const val = arg === undefined ? emptyValue() : collapse(ev.evalExpr(arg, ctx));
|
|
87
|
+
ev.s.mergeThrown(val);
|
|
88
|
+
return val;
|
|
89
|
+
}
|
|
90
|
+
/** `Promise.reject` on the global Promise (textual match, mirroring {@link isJsonStringify}). */
|
|
91
|
+
export function isPromiseReject(access) {
|
|
92
|
+
return ts.isIdentifier(access.expression) && access.expression.text === "Promise" && access.name.text === "reject";
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Apply a script-local constructor `id` for a `new C(args)` (or a `super(args)` in a
|
|
96
|
+
* derived ctor): record the actuals as the constructor's parameter placeholders and
|
|
97
|
+
* write parameter mutations back into place actuals, exactly like an ordinary direct
|
|
98
|
+
* call. The constructor's OWN body (which writes `this.x = param`) is evaluated in the
|
|
99
|
+
* function pass, so the shared instance picks up the placeholder there; here we only
|
|
100
|
+
* seed the actuals. The instance itself is returned by the caller (NewExpression), never
|
|
101
|
+
* this call's result. A direct `new`/`super` keeps exactness (no clearing).
|
|
102
|
+
*/
|
|
103
|
+
export function applyConstructor(ev, id, ctx, argVals, argPlaces, site) {
|
|
104
|
+
recordCall(ev, id, ctx.regionStack, argVals, argPlaces, site === undefined ? undefined : { site, via: "callee" });
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Apply an UNRESOLVABLE-heritage constructor (`new D()` where `class D extends mix(Base)`):
|
|
108
|
+
* the base class is produced by a mixin CALL we cannot resolve statically, so the inherited
|
|
109
|
+
* constructor is unreachable. Sound over-approximation: the ctor may store any argument in any
|
|
110
|
+
* field, so smear the collapsed (INEXACT) args into the instance's container-level taint —
|
|
111
|
+
* surfaced by every field read via smear-on-read — and pessimistically apply function-valued
|
|
112
|
+
* args (the keystone: the base ctor may invoke them). Never a drop.
|
|
113
|
+
*/
|
|
114
|
+
export function applyMixinConstructor(ev, ctx, instance, argVals) {
|
|
115
|
+
const pot = emptyValue();
|
|
116
|
+
for (const arg of argVals)
|
|
117
|
+
collapseInto(pot, arg);
|
|
118
|
+
const inexact = clearExact(pot);
|
|
119
|
+
if (mergeInto(instance, inexact))
|
|
120
|
+
ev.s.changed = true;
|
|
121
|
+
for (const arg of argVals)
|
|
122
|
+
applyPessimistically(ev, arg, inexact, ctx, instance);
|
|
123
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { type AbstractValue } from "./domain.js";
|
|
3
|
+
import type { EvalContext, Evaluator } from "./taint.js";
|
|
4
|
+
/**
|
|
5
|
+
* Facade sink and relay transfers: `Agent.ask`, `files.glob`/`read` (world reads), and
|
|
6
|
+
* `Promise.all` join relays. Split out of calls.ts (pure move, no behavior change) to keep
|
|
7
|
+
* that file under the line cap; `evalCall` dispatches here via the site lookups.
|
|
8
|
+
*/
|
|
9
|
+
export declare function handleAsk(ev: Evaluator, node: ts.CallExpression, askId: string, ctx: EvalContext): AbstractValue;
|
|
10
|
+
export declare function handleWorldRead(ev: Evaluator, id: string, args: readonly ts.Expression[], ctx: EvalContext): AbstractValue;
|
|
11
|
+
export declare function handleJoin(ev: Evaluator, node: ts.CallExpression, id: string, arg: ts.Expression | undefined, ctx: EvalContext): AbstractValue;
|
|
12
|
+
//# sourceMappingURL=relays.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relays.d.ts","sourceRoot":"","sources":["../../src/analysis/relays.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAqD,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;GAIG;AAEH,wBAAgB,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,GAAG,aAAa,CAchH;AAED,wBAAgB,eAAe,CAC7B,EAAE,EAAE,SAAS,EACb,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,EAAE,CAAC,UAAU,EAAE,EAC9B,GAAG,EAAE,WAAW,GACf,aAAa,CAMf;AAED,wBAAgB,UAAU,CACxB,EAAE,EAAE,SAAS,EACb,IAAI,EAAE,EAAE,CAAC,cAAc,EACvB,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,EAAE,CAAC,UAAU,GAAG,SAAS,EAC9B,GAAG,EAAE,WAAW,GACf,aAAa,CAyCf"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { addOcc, collapse, liveField, mergeInto, singleOcc } from "./domain.js";
|
|
3
|
+
/**
|
|
4
|
+
* Facade sink and relay transfers: `Agent.ask`, `files.glob`/`read` (world reads), and
|
|
5
|
+
* `Promise.all` join relays. Split out of calls.ts (pure move, no behavior change) to keep
|
|
6
|
+
* that file under the line cap; `evalCall` dispatches here via the site lookups.
|
|
7
|
+
*/
|
|
8
|
+
export function handleAsk(ev, node, askId, ctx) {
|
|
9
|
+
ev.s.markFacade(ctx.regionStack);
|
|
10
|
+
const site = ev.s.askSites.get(askId);
|
|
11
|
+
if (site !== undefined) {
|
|
12
|
+
ev.s.mergeSink(ev.s.askRecv, askId, collapse(ev.evalExpr(site.receiver, ctx)));
|
|
13
|
+
if (site.instructions !== undefined) {
|
|
14
|
+
ev.s.mergeSink(ev.s.askInstr, askId, collapse(ev.evalExpr(site.instructions, ctx)));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
// Evaluate any extra arguments for their side effects (heap writes etc.).
|
|
18
|
+
node.arguments.forEach((arg, index) => {
|
|
19
|
+
if (index !== 0)
|
|
20
|
+
ev.evalExpr(arg, ctx);
|
|
21
|
+
});
|
|
22
|
+
return singleOcc(askId, true);
|
|
23
|
+
}
|
|
24
|
+
export function handleWorldRead(ev, id, args, ctx) {
|
|
25
|
+
ev.s.markFacade(ctx.regionStack);
|
|
26
|
+
// Every positional argument is a sink: ops differ in arity (`files.grep(pattern, glob?)`,
|
|
27
|
+
// `git.diff(base?, path?)`), and an artifact reaching any of them is a data dependency.
|
|
28
|
+
for (const arg of args)
|
|
29
|
+
ev.s.mergeSink(ev.s.worldRead, id, collapse(ev.evalExpr(arg, ctx)));
|
|
30
|
+
return singleOcc(id, true);
|
|
31
|
+
}
|
|
32
|
+
export function handleJoin(ev, node, id, arg, ctx) {
|
|
33
|
+
ev.s.markFacade(ctx.regionStack);
|
|
34
|
+
// The join result is the PERSISTENT node of this call site (state.ts joinResultOf), NOT a
|
|
35
|
+
// fresh value per pass: it is a place other values may-alias, and the canonical-heap
|
|
36
|
+
// invariant requires every alias target to have pass-stable identity. Each merge below is
|
|
37
|
+
// therefore weak and reports its growth into `ev.s.changed` — a pass in which only this
|
|
38
|
+
// node grew must not terminate the fixpoint, or a consumer evaluated earlier in the pass
|
|
39
|
+
// (a function body, a later re-read) would never observe the growth.
|
|
40
|
+
const result = ev.s.joinResultOf(node);
|
|
41
|
+
if (arg !== undefined && ts.isArrayLiteralExpression(arg) && !arg.elements.some(ts.isSpreadElement)) {
|
|
42
|
+
// Static array literal: element positions become ports.
|
|
43
|
+
arg.elements.forEach((el, port) => {
|
|
44
|
+
const elemValue = ev.evalExpr(el, ctx);
|
|
45
|
+
ev.s.mergeJoinIn(id, port, collapse(elemValue));
|
|
46
|
+
const field = liveField(result, String(port));
|
|
47
|
+
if (mergeInto(field, elemValue))
|
|
48
|
+
ev.s.changed = true;
|
|
49
|
+
if (addOcc(field, { exact: true, port, site: id }))
|
|
50
|
+
ev.s.changed = true;
|
|
51
|
+
// A place element aliases its slot in the resolved tuple: `Promise.all([secret, box])`
|
|
52
|
+
// resolves the non-promise `box` to box ITSELF, so a write through `res[k]` / a
|
|
53
|
+
// destructured element reaches the original (weak, inexact via mayAlias). The field
|
|
54
|
+
// KEEPS the join port occ (added above), so no relay edge is lost.
|
|
55
|
+
const elemPlace = ev.resolvePlace(el);
|
|
56
|
+
if (elemPlace !== undefined) {
|
|
57
|
+
const targets = (field.mayAlias ??= new Set());
|
|
58
|
+
if (!targets.has(elemPlace)) {
|
|
59
|
+
targets.add(elemPlace);
|
|
60
|
+
ev.s.changed = true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
if (addOcc(result, { exact: true, site: id }))
|
|
65
|
+
ev.s.changed = true;
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
// Non-literal iterable: portless in-taint; the result is an additive relay.
|
|
69
|
+
if (arg !== undefined) {
|
|
70
|
+
const argCollapsed = collapse(ev.evalExpr(arg, ctx));
|
|
71
|
+
ev.s.mergeJoinIn(id, -1, argCollapsed);
|
|
72
|
+
if (mergeInto(result, argCollapsed))
|
|
73
|
+
ev.s.changed = true;
|
|
74
|
+
}
|
|
75
|
+
if (addOcc(result, { exact: true, site: id }))
|
|
76
|
+
ev.s.changed = true;
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { ActorGraph } from "./actor-graph.js";
|
|
2
|
+
import type { CausalityGraph, Lane } from "./causality-graph.js";
|
|
3
|
+
import type { ControlFlowGraph } from "./flow-graph.js";
|
|
4
|
+
import type { HandoffGraph } from "./handoff-graph.js";
|
|
5
|
+
import type { SiteGraph } from "./types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Canonical, deterministic text form of a site graph — the snapshot and debugging
|
|
8
|
+
* surface. Grammar:
|
|
9
|
+
*
|
|
10
|
+
* node source
|
|
11
|
+
* node ask#1 "scanner" @3:24 actors=actor#1 type="Flaky"
|
|
12
|
+
* node ask#2 "judge" @8:20 within=fan-out#1
|
|
13
|
+
* node sink
|
|
14
|
+
* actor actor#1 "planner" @5:17
|
|
15
|
+
* actor actor#2 "judge" @8:14 within=fan-out#1
|
|
16
|
+
* edge ask#1 -> ask#2 data exact type="Flaky"
|
|
17
|
+
* edge join#1 -> sink data inexact port=2 type="Review"
|
|
18
|
+
*
|
|
19
|
+
* Nodes come first (virtual `source` first, `sink` last, sites between in source
|
|
20
|
+
* order); then actors in source order; then edges. `source`/`sink` carry no label
|
|
21
|
+
* or location. `ask` nodes carry a trailing `actors=...` lane membership when
|
|
22
|
+
* non-empty; any node or actor lexically inside a promoted fan-out carries a
|
|
23
|
+
* trailing `within=fan-out#N` (after `actors=` when both are present); a producer
|
|
24
|
+
* node/edge carries a trailing `type="<artifactType>"` last, when known (the type
|
|
25
|
+
* string is quoted with embedded `"` escaped as `\"`, since a string-literal-union
|
|
26
|
+
* artifact type can contain quotes, e.g. `ask<"yes" | "no">`). Edges are sorted by
|
|
27
|
+
* (from position, to position, kind, port).
|
|
28
|
+
*/
|
|
29
|
+
export declare function serializeGraph(graph: SiteGraph): string;
|
|
30
|
+
/**
|
|
31
|
+
* Canonical text form of the derived {@link ActorGraph} (its own snapshot surface,
|
|
32
|
+
* a sibling of {@link serializeGraph}). Grammar:
|
|
33
|
+
*
|
|
34
|
+
* actor-node main
|
|
35
|
+
* actor-node workspace
|
|
36
|
+
* actor-node actor#1 "planner" @17:17
|
|
37
|
+
* actor-node actor#2 "judge" @29:32 family=fan-out#1
|
|
38
|
+
* actor-edge main -> actor#1 exact count=1
|
|
39
|
+
* actor-edge actor#1 -> actor#2 inexact count=2 types="Plan","Review"
|
|
40
|
+
*
|
|
41
|
+
* Nodes come first in node order (already `main`, then `workspace` when present,
|
|
42
|
+
* then actors in site order); edges follow, sorted by (from position, to position).
|
|
43
|
+
* `main`/`workspace` carry no name or location; actor nodes carry a `"name"` when
|
|
44
|
+
* known, always a location, and a trailing `family=fan-out#N` when they are a lane
|
|
45
|
+
* family (their site sits inside a promoted fan-out). An actor edge carries a trailing
|
|
46
|
+
* `types="A","B"` (each type individually quoted, embedded `"` escaped as `\"` — type
|
|
47
|
+
* strings can contain quotes, e.g. `ask<"yes" | "no">`) when it carries message types.
|
|
48
|
+
*/
|
|
49
|
+
export declare function serializeActorGraph(graph: ActorGraph): string;
|
|
50
|
+
/**
|
|
51
|
+
* Canonical text form of the {@link CausalityGraph} — its snapshot and debugging
|
|
52
|
+
* surface, third sibling of {@link serializeGraph} / {@link serializeActorGraph}.
|
|
53
|
+
* Grammar:
|
|
54
|
+
*
|
|
55
|
+
* phase unphased
|
|
56
|
+
* phase phase#1 "preflight" @3:1
|
|
57
|
+
* lane workspace
|
|
58
|
+
* lane actor#2 "planner" @17:17
|
|
59
|
+
* lane actor#4 "judge" @29:32 families=fanout#1
|
|
60
|
+
* lane actor#1 name-head="研究员" @53:5 families=fanout#1
|
|
61
|
+
* region seq#1 seq
|
|
62
|
+
* region loop#1 loop parent=seq#1 @21:1 bound=5
|
|
63
|
+
* step ask#1 ask "scanner" @14:41 lane=actor#1 region=seq#1 always
|
|
64
|
+
* step ask#4 ask "judge" @29:47 lane=actor#4 region=fanout#1 maybe stack
|
|
65
|
+
* step ask#2~actor#1 ask "move" @12:40 lane=actor#1 lanes=actor#1,actor#2 source=ask#2 \
|
|
66
|
+
* phase=phase#2 region=loop#1 maybe serial
|
|
67
|
+
* edge ask#1 -> ask#2 seq always
|
|
68
|
+
* edge ask#3 -> ask#2 carry always
|
|
69
|
+
* phase-edge phase#1 -> phase#2 seq always
|
|
70
|
+
* sink ask#2,ask#4
|
|
71
|
+
*
|
|
72
|
+
* Sections are fixed: phases (when the script declares any marker at all — see below),
|
|
73
|
+
* lanes (workspace first, then actors in creation order, `unknown`
|
|
74
|
+
* last), regions in creation order, steps in source order, edges in the graph's
|
|
75
|
+
* canonical order, the phase quotient's edges, then the sink line when the script returns
|
|
76
|
+
* an artifact. `lanes=`
|
|
77
|
+
* appears on a step whose receiver is a may-set and `source=` only on a may-set COPY (so
|
|
78
|
+
* a step that did not expand serializes exactly as it did pre-expansion); `exact`/`inexact`
|
|
79
|
+
* only on `data` edges, where the bit means something.
|
|
80
|
+
*
|
|
81
|
+
* The phase vocabulary — `phase` lines, the step's `phase=` field, `phase-edge` lines —
|
|
82
|
+
* appears only when the script declares at least one `phase("…")` marker, and then all
|
|
83
|
+
* three appear. A script with no markers serializes byte-for-byte as it did before phase
|
|
84
|
+
* annotations existed; that is the regression nail the whole fixture corpus stands on.
|
|
85
|
+
*
|
|
86
|
+
* `name-head=`/`name-tail=` (lane) and `label-head=`/`label-tail=` (step) carry a
|
|
87
|
+
* {@link NamePattern} — the static shape of a name the script interpolates. They sit in
|
|
88
|
+
* the same slot as the quoted name they stand in for, and they carry the affixes as
|
|
89
|
+
* **data**: the ellipsis that turns them into `研究员…` is a render-time decision, not
|
|
90
|
+
* part of this form.
|
|
91
|
+
*/
|
|
92
|
+
export declare function serializeCausalityGraph(graph: CausalityGraph): string;
|
|
93
|
+
/**
|
|
94
|
+
* Canonical text form of the control-flow graph,
|
|
95
|
+
* fifth sibling of the serializers above:
|
|
96
|
+
*
|
|
97
|
+
* phase phase#1 "preflight"
|
|
98
|
+
* phase phase#2 "review" alongside=phase#1
|
|
99
|
+
* phase hole#21b40fca "决定分组"
|
|
100
|
+
* hole hole#cd7e8315 "评判" type="Verdict" phase=phase#2 tail
|
|
101
|
+
* node ask#1@1 issue site=ask#1 phase=phase#2
|
|
102
|
+
* node phase#6@1 mark phase=phase#6 alongside=phase#1,phase#2
|
|
103
|
+
* node ask#9@1 issue site=ask#9 phase=unphased detached
|
|
104
|
+
* edge entry -> world-read#2@1 next
|
|
105
|
+
* edge world-read#4@1 -> ask#1@1 loop via=continue
|
|
106
|
+
* edge ask#3@1 -> abort throw
|
|
107
|
+
* phase-edge phase#3 -> phase#2 loop via=continue
|
|
108
|
+
*
|
|
109
|
+
* Nodes in leaf-stream order, edges in the graph's canonical order (`entry` first, the
|
|
110
|
+
* terminals last). `phase` and `phase-edge` lines appear only when the script declares a
|
|
111
|
+
* marker — the same all-or-nothing contract as the causality serializer's phase vocabulary.
|
|
112
|
+
* `alongside` (a mark's, and its phase's union) names the phases whose strands were still
|
|
113
|
+
* running when the marker was entered; it is a node fact, never an edge. `fill=` on a phase
|
|
114
|
+
* names the filled hole whose body wrote it; a `hole` line is an OPEN hole with the phase it
|
|
115
|
+
* stands in and `tail` when it is the script's open end (docs/analysis.md「Sites」).
|
|
116
|
+
*/
|
|
117
|
+
export declare function serializeControlFlow(flow: ControlFlowGraph): string;
|
|
118
|
+
/**
|
|
119
|
+
* Canonical text form of the hand-off graph,
|
|
120
|
+
* snapshotted as `<fixture>.handoff.txt`. Participants in the analyzer's order (which IS
|
|
121
|
+
* the stack order), grouped under their phase; the lane's literal name is echoed for
|
|
122
|
+
* readability only — `lanes` carries it in the payload.
|
|
123
|
+
*/
|
|
124
|
+
export declare function serializeHandoffGraph(graph: HandoffGraph, lanes: readonly Lane[]): string;
|
|
125
|
+
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/analysis/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,UAAU,EAAa,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EACV,cAAc,EACd,IAAI,EAML,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAY,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAuB,SAAS,EAAY,MAAM,YAAY,CAAC;AAO3E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAevD;AAmCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAM7D;AAkBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAWrE;AA+DD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CA4BnE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,MAAM,CAwBzF"}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/** Quote a type string for a `type=`/`types=` field: embedded `"` escaped as `\"`. */
|
|
2
|
+
function quoteType(type) {
|
|
3
|
+
return `"${type.replace(/"/g, '\\"')}"`;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Canonical, deterministic text form of a site graph — the snapshot and debugging
|
|
7
|
+
* surface. Grammar:
|
|
8
|
+
*
|
|
9
|
+
* node source
|
|
10
|
+
* node ask#1 "scanner" @3:24 actors=actor#1 type="Flaky"
|
|
11
|
+
* node ask#2 "judge" @8:20 within=fan-out#1
|
|
12
|
+
* node sink
|
|
13
|
+
* actor actor#1 "planner" @5:17
|
|
14
|
+
* actor actor#2 "judge" @8:14 within=fan-out#1
|
|
15
|
+
* edge ask#1 -> ask#2 data exact type="Flaky"
|
|
16
|
+
* edge join#1 -> sink data inexact port=2 type="Review"
|
|
17
|
+
*
|
|
18
|
+
* Nodes come first (virtual `source` first, `sink` last, sites between in source
|
|
19
|
+
* order); then actors in source order; then edges. `source`/`sink` carry no label
|
|
20
|
+
* or location. `ask` nodes carry a trailing `actors=...` lane membership when
|
|
21
|
+
* non-empty; any node or actor lexically inside a promoted fan-out carries a
|
|
22
|
+
* trailing `within=fan-out#N` (after `actors=` when both are present); a producer
|
|
23
|
+
* node/edge carries a trailing `type="<artifactType>"` last, when known (the type
|
|
24
|
+
* string is quoted with embedded `"` escaped as `\"`, since a string-literal-union
|
|
25
|
+
* artifact type can contain quotes, e.g. `ask<"yes" | "no">`). Edges are sorted by
|
|
26
|
+
* (from position, to position, kind, port).
|
|
27
|
+
*/
|
|
28
|
+
export function serializeGraph(graph) {
|
|
29
|
+
const source = graph.nodes.filter((node) => node.kind === "source");
|
|
30
|
+
const sink = graph.nodes.filter((node) => node.kind === "sink");
|
|
31
|
+
const middle = graph.nodes.filter((node) => node.kind !== "source" && node.kind !== "sink");
|
|
32
|
+
const ordered = [...source, ...middle, ...sink];
|
|
33
|
+
const position = new Map(ordered.map((node, index) => [node.id, index]));
|
|
34
|
+
const edges = [...graph.edges].sort((a, b) => compareEdges(a, b, position));
|
|
35
|
+
const lines = [
|
|
36
|
+
...ordered.map(renderNode),
|
|
37
|
+
...graph.actors.map(renderActor),
|
|
38
|
+
...edges.map(renderEdge),
|
|
39
|
+
];
|
|
40
|
+
return `${lines.join("\n")}\n`;
|
|
41
|
+
}
|
|
42
|
+
function renderNode(node) {
|
|
43
|
+
if (node.loc === undefined)
|
|
44
|
+
return `node ${node.id}`;
|
|
45
|
+
let line = `node ${node.id} "${node.label}" @${node.loc.line}:${node.loc.column}`;
|
|
46
|
+
if (node.actors !== undefined && node.actors.length > 0)
|
|
47
|
+
line += ` actors=${node.actors.join(",")}`;
|
|
48
|
+
if (node.within !== undefined)
|
|
49
|
+
line += ` within=${node.within}`;
|
|
50
|
+
if (node.artifactType !== undefined)
|
|
51
|
+
line += ` type=${quoteType(node.artifactType)}`;
|
|
52
|
+
return line;
|
|
53
|
+
}
|
|
54
|
+
function renderActor(actor) {
|
|
55
|
+
const name = actor.name === undefined ? "" : ` "${actor.name}"`;
|
|
56
|
+
let line = `actor ${actor.id}${name} @${actor.loc.line}:${actor.loc.column}`;
|
|
57
|
+
if (actor.within !== undefined)
|
|
58
|
+
line += ` within=${actor.within}`;
|
|
59
|
+
return line;
|
|
60
|
+
}
|
|
61
|
+
function renderEdge(edge) {
|
|
62
|
+
const exact = edge.exact ? "exact" : "inexact";
|
|
63
|
+
const port = edge.port === undefined ? "" : ` port=${edge.port}`;
|
|
64
|
+
const type = edge.type === undefined ? "" : ` type=${quoteType(edge.type)}`;
|
|
65
|
+
return `edge ${edge.from} -> ${edge.to} ${edge.kind} ${exact}${port}${type}`;
|
|
66
|
+
}
|
|
67
|
+
function compareEdges(a, b, position) {
|
|
68
|
+
const rank = (id) => position.get(id) ?? Number.MAX_SAFE_INTEGER;
|
|
69
|
+
return (rank(a.from) - rank(b.from) ||
|
|
70
|
+
rank(a.to) - rank(b.to) ||
|
|
71
|
+
a.kind.localeCompare(b.kind) ||
|
|
72
|
+
(a.port ?? -1) - (b.port ?? -1));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Canonical text form of the derived {@link ActorGraph} (its own snapshot surface,
|
|
76
|
+
* a sibling of {@link serializeGraph}). Grammar:
|
|
77
|
+
*
|
|
78
|
+
* actor-node main
|
|
79
|
+
* actor-node workspace
|
|
80
|
+
* actor-node actor#1 "planner" @17:17
|
|
81
|
+
* actor-node actor#2 "judge" @29:32 family=fan-out#1
|
|
82
|
+
* actor-edge main -> actor#1 exact count=1
|
|
83
|
+
* actor-edge actor#1 -> actor#2 inexact count=2 types="Plan","Review"
|
|
84
|
+
*
|
|
85
|
+
* Nodes come first in node order (already `main`, then `workspace` when present,
|
|
86
|
+
* then actors in site order); edges follow, sorted by (from position, to position).
|
|
87
|
+
* `main`/`workspace` carry no name or location; actor nodes carry a `"name"` when
|
|
88
|
+
* known, always a location, and a trailing `family=fan-out#N` when they are a lane
|
|
89
|
+
* family (their site sits inside a promoted fan-out). An actor edge carries a trailing
|
|
90
|
+
* `types="A","B"` (each type individually quoted, embedded `"` escaped as `\"` — type
|
|
91
|
+
* strings can contain quotes, e.g. `ask<"yes" | "no">`) when it carries message types.
|
|
92
|
+
*/
|
|
93
|
+
export function serializeActorGraph(graph) {
|
|
94
|
+
const position = new Map(graph.nodes.map((node, index) => [node.id, index]));
|
|
95
|
+
const rank = (id) => position.get(id) ?? Number.MAX_SAFE_INTEGER;
|
|
96
|
+
const edges = [...graph.edges].sort((a, b) => rank(a.from) - rank(b.from) || rank(a.to) - rank(b.to));
|
|
97
|
+
const lines = [...graph.nodes.map(renderActorNode), ...edges.map(renderActorEdge)];
|
|
98
|
+
return `${lines.join("\n")}\n`;
|
|
99
|
+
}
|
|
100
|
+
function renderActorNode(node) {
|
|
101
|
+
let line = `actor-node ${node.id}`;
|
|
102
|
+
if (node.name !== undefined)
|
|
103
|
+
line += ` "${node.name}"`;
|
|
104
|
+
if (node.loc !== undefined)
|
|
105
|
+
line += ` @${node.loc.line}:${node.loc.column}`;
|
|
106
|
+
if (node.family !== undefined)
|
|
107
|
+
line += ` family=${node.family}`;
|
|
108
|
+
return line;
|
|
109
|
+
}
|
|
110
|
+
function renderActorEdge(edge) {
|
|
111
|
+
let line = `actor-edge ${edge.from} -> ${edge.to} ${edge.exact ? "exact" : "inexact"} count=${edge.count}`;
|
|
112
|
+
if (edge.types !== undefined && edge.types.length > 0) {
|
|
113
|
+
line += ` types=${edge.types.map(quoteType).join(",")}`;
|
|
114
|
+
}
|
|
115
|
+
return line;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Canonical text form of the {@link CausalityGraph} — its snapshot and debugging
|
|
119
|
+
* surface, third sibling of {@link serializeGraph} / {@link serializeActorGraph}.
|
|
120
|
+
* Grammar:
|
|
121
|
+
*
|
|
122
|
+
* phase unphased
|
|
123
|
+
* phase phase#1 "preflight" @3:1
|
|
124
|
+
* lane workspace
|
|
125
|
+
* lane actor#2 "planner" @17:17
|
|
126
|
+
* lane actor#4 "judge" @29:32 families=fanout#1
|
|
127
|
+
* lane actor#1 name-head="研究员" @53:5 families=fanout#1
|
|
128
|
+
* region seq#1 seq
|
|
129
|
+
* region loop#1 loop parent=seq#1 @21:1 bound=5
|
|
130
|
+
* step ask#1 ask "scanner" @14:41 lane=actor#1 region=seq#1 always
|
|
131
|
+
* step ask#4 ask "judge" @29:47 lane=actor#4 region=fanout#1 maybe stack
|
|
132
|
+
* step ask#2~actor#1 ask "move" @12:40 lane=actor#1 lanes=actor#1,actor#2 source=ask#2 \
|
|
133
|
+
* phase=phase#2 region=loop#1 maybe serial
|
|
134
|
+
* edge ask#1 -> ask#2 seq always
|
|
135
|
+
* edge ask#3 -> ask#2 carry always
|
|
136
|
+
* phase-edge phase#1 -> phase#2 seq always
|
|
137
|
+
* sink ask#2,ask#4
|
|
138
|
+
*
|
|
139
|
+
* Sections are fixed: phases (when the script declares any marker at all — see below),
|
|
140
|
+
* lanes (workspace first, then actors in creation order, `unknown`
|
|
141
|
+
* last), regions in creation order, steps in source order, edges in the graph's
|
|
142
|
+
* canonical order, the phase quotient's edges, then the sink line when the script returns
|
|
143
|
+
* an artifact. `lanes=`
|
|
144
|
+
* appears on a step whose receiver is a may-set and `source=` only on a may-set COPY (so
|
|
145
|
+
* a step that did not expand serializes exactly as it did pre-expansion); `exact`/`inexact`
|
|
146
|
+
* only on `data` edges, where the bit means something.
|
|
147
|
+
*
|
|
148
|
+
* The phase vocabulary — `phase` lines, the step's `phase=` field, `phase-edge` lines —
|
|
149
|
+
* appears only when the script declares at least one `phase("…")` marker, and then all
|
|
150
|
+
* three appear. A script with no markers serializes byte-for-byte as it did before phase
|
|
151
|
+
* annotations existed; that is the regression nail the whole fixture corpus stands on.
|
|
152
|
+
*
|
|
153
|
+
* `name-head=`/`name-tail=` (lane) and `label-head=`/`label-tail=` (step) carry a
|
|
154
|
+
* {@link NamePattern} — the static shape of a name the script interpolates. They sit in
|
|
155
|
+
* the same slot as the quoted name they stand in for, and they carry the affixes as
|
|
156
|
+
* **data**: the ellipsis that turns them into `研究员…` is a render-time decision, not
|
|
157
|
+
* part of this form.
|
|
158
|
+
*/
|
|
159
|
+
export function serializeCausalityGraph(graph) {
|
|
160
|
+
const lines = [
|
|
161
|
+
...(graph.phases ?? []).map(renderPhase),
|
|
162
|
+
...graph.lanes.map(renderLane),
|
|
163
|
+
...graph.regions.map(renderRegion),
|
|
164
|
+
...graph.steps.map(renderStep),
|
|
165
|
+
...graph.edges.map(renderOrderEdge),
|
|
166
|
+
...(graph.phaseEdges ?? []).map(renderPhaseEdge),
|
|
167
|
+
...(graph.sink === undefined ? [] : [`sink ${graph.sink.fedBy.join(",")}`]),
|
|
168
|
+
];
|
|
169
|
+
return `${lines.join("\n")}\n`;
|
|
170
|
+
}
|
|
171
|
+
function renderPhase(phase) {
|
|
172
|
+
let line = `phase ${phase.id}`;
|
|
173
|
+
if (phase.name !== undefined)
|
|
174
|
+
line += ` "${phase.name}"`;
|
|
175
|
+
if (phase.loc !== undefined)
|
|
176
|
+
line += ` @${phase.loc.line}:${phase.loc.column}`;
|
|
177
|
+
if (phase.fill !== undefined)
|
|
178
|
+
line += ` fill=${phase.fill}`;
|
|
179
|
+
return line;
|
|
180
|
+
}
|
|
181
|
+
function renderPhaseEdge(edge) {
|
|
182
|
+
return `phase-edge ${edge.from} -> ${edge.to} ${edge.kind} ${edge.certainty}`;
|
|
183
|
+
}
|
|
184
|
+
function renderLane(lane) {
|
|
185
|
+
let line = `lane ${lane.id}`;
|
|
186
|
+
if (lane.name !== undefined)
|
|
187
|
+
line += ` "${lane.name}"`;
|
|
188
|
+
line += renderNamePattern("name", lane.namePattern);
|
|
189
|
+
if (lane.loc !== undefined)
|
|
190
|
+
line += ` @${lane.loc.line}:${lane.loc.column}`;
|
|
191
|
+
if (lane.families !== undefined && lane.families.length > 0) {
|
|
192
|
+
line += ` families=${lane.families.join(",")}`;
|
|
193
|
+
}
|
|
194
|
+
return line;
|
|
195
|
+
}
|
|
196
|
+
/** `name-head="研究员" name-tail="-worker"` — affixes as data, never the rendered glyph. */
|
|
197
|
+
function renderNamePattern(field, pattern) {
|
|
198
|
+
if (pattern === undefined)
|
|
199
|
+
return "";
|
|
200
|
+
let out = "";
|
|
201
|
+
if (pattern.head !== undefined)
|
|
202
|
+
out += ` ${field}-head=${quoteType(pattern.head)}`;
|
|
203
|
+
if (pattern.tail !== undefined)
|
|
204
|
+
out += ` ${field}-tail=${quoteType(pattern.tail)}`;
|
|
205
|
+
return out;
|
|
206
|
+
}
|
|
207
|
+
function renderRegion(region) {
|
|
208
|
+
let line = `region ${region.id} ${region.kind}`;
|
|
209
|
+
if (region.parent !== undefined)
|
|
210
|
+
line += ` parent=${region.parent}`;
|
|
211
|
+
if (region.loc !== undefined)
|
|
212
|
+
line += ` @${region.loc.line}:${region.loc.column}`;
|
|
213
|
+
if (region.bound !== undefined)
|
|
214
|
+
line += ` bound=${region.bound}`;
|
|
215
|
+
if (region.label !== undefined)
|
|
216
|
+
line += ` label=${quoteType(region.label)}`;
|
|
217
|
+
return line;
|
|
218
|
+
}
|
|
219
|
+
function renderStep(step) {
|
|
220
|
+
let line = `step ${step.id} ${step.kind} "${step.label}"`;
|
|
221
|
+
line += renderNamePattern("label", step.labelPattern);
|
|
222
|
+
line += ` @${step.loc.line}:${step.loc.column}`;
|
|
223
|
+
line += ` lane=${step.lane}`;
|
|
224
|
+
if (step.lanes !== undefined)
|
|
225
|
+
line += ` lanes=${step.lanes.join(",")}`;
|
|
226
|
+
if (step.source !== undefined)
|
|
227
|
+
line += ` source=${step.source}`;
|
|
228
|
+
if (step.phase !== undefined)
|
|
229
|
+
line += ` phase=${step.phase}`;
|
|
230
|
+
line += ` region=${step.region} ${step.certainty}`;
|
|
231
|
+
if (step.repeat !== undefined)
|
|
232
|
+
line += ` ${step.repeat}`;
|
|
233
|
+
if (step.fill !== undefined)
|
|
234
|
+
line += ` fill=${step.fill}`;
|
|
235
|
+
return line;
|
|
236
|
+
}
|
|
237
|
+
function renderOrderEdge(edge) {
|
|
238
|
+
let line = `edge ${edge.from} -> ${edge.to} ${edge.kind} ${edge.certainty}`;
|
|
239
|
+
if (edge.exact !== undefined)
|
|
240
|
+
line += edge.exact ? " exact" : " inexact";
|
|
241
|
+
return line;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Canonical text form of the control-flow graph,
|
|
245
|
+
* fifth sibling of the serializers above:
|
|
246
|
+
*
|
|
247
|
+
* phase phase#1 "preflight"
|
|
248
|
+
* phase phase#2 "review" alongside=phase#1
|
|
249
|
+
* phase hole#21b40fca "决定分组"
|
|
250
|
+
* hole hole#cd7e8315 "评判" type="Verdict" phase=phase#2 tail
|
|
251
|
+
* node ask#1@1 issue site=ask#1 phase=phase#2
|
|
252
|
+
* node phase#6@1 mark phase=phase#6 alongside=phase#1,phase#2
|
|
253
|
+
* node ask#9@1 issue site=ask#9 phase=unphased detached
|
|
254
|
+
* edge entry -> world-read#2@1 next
|
|
255
|
+
* edge world-read#4@1 -> ask#1@1 loop via=continue
|
|
256
|
+
* edge ask#3@1 -> abort throw
|
|
257
|
+
* phase-edge phase#3 -> phase#2 loop via=continue
|
|
258
|
+
*
|
|
259
|
+
* Nodes in leaf-stream order, edges in the graph's canonical order (`entry` first, the
|
|
260
|
+
* terminals last). `phase` and `phase-edge` lines appear only when the script declares a
|
|
261
|
+
* marker — the same all-or-nothing contract as the causality serializer's phase vocabulary.
|
|
262
|
+
* `alongside` (a mark's, and its phase's union) names the phases whose strands were still
|
|
263
|
+
* running when the marker was entered; it is a node fact, never an edge. `fill=` on a phase
|
|
264
|
+
* names the filled hole whose body wrote it; a `hole` line is an OPEN hole with the phase it
|
|
265
|
+
* stands in and `tail` when it is the script's open end (docs/analysis.md「Sites」).
|
|
266
|
+
*/
|
|
267
|
+
export function serializeControlFlow(flow) {
|
|
268
|
+
const edgeLine = (head, edge) => `${head} ${edge.from} -> ${edge.to} ${edge.kind}${edge.via === undefined ? "" : ` via=${edge.via}`}`;
|
|
269
|
+
const lines = [
|
|
270
|
+
...(flow.phases ?? []).map((phase) => `phase ${phase.id}${phase.name === undefined ? "" : ` ${quoteType(phase.name)}`}` +
|
|
271
|
+
(phase.alongside === undefined ? "" : ` alongside=${phase.alongside.join(",")}`) +
|
|
272
|
+
(phase.fill === undefined ? "" : ` fill=${phase.fill}`)),
|
|
273
|
+
...(flow.holes ?? []).map((hole) => `hole ${hole.siteId} ${quoteType(hole.name)} type=${quoteType(hole.type)}` +
|
|
274
|
+
(hole.phase === undefined ? "" : ` phase=${hole.phase}`) +
|
|
275
|
+
(hole.tail ? " tail" : "")),
|
|
276
|
+
...flow.nodes.map((node) => `node ${node.id} ${node.kind}` +
|
|
277
|
+
(node.site === undefined ? "" : ` site=${node.site}`) +
|
|
278
|
+
` phase=${node.phase}` +
|
|
279
|
+
(node.alongside === undefined ? "" : ` alongside=${node.alongside.join(",")}`) +
|
|
280
|
+
(node.detached ? " detached" : "")),
|
|
281
|
+
...flow.edges.map((edge) => edgeLine("edge", edge)),
|
|
282
|
+
...(flow.phaseEdges ?? []).map((edge) => edgeLine("phase-edge", edge)),
|
|
283
|
+
];
|
|
284
|
+
return `${lines.join("\n")}\n`;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Canonical text form of the hand-off graph,
|
|
288
|
+
* snapshotted as `<fixture>.handoff.txt`. Participants in the analyzer's order (which IS
|
|
289
|
+
* the stack order), grouped under their phase; the lane's literal name is echoed for
|
|
290
|
+
* readability only — `lanes` carries it in the payload.
|
|
291
|
+
*/
|
|
292
|
+
export function serializeHandoffGraph(graph, lanes) {
|
|
293
|
+
const nameOf = new Map(lanes.map((lane) => [lane.id, lane.name]));
|
|
294
|
+
const lines = [];
|
|
295
|
+
let phase;
|
|
296
|
+
for (const participant of graph.participants) {
|
|
297
|
+
if (participant.phase !== phase) {
|
|
298
|
+
phase = participant.phase;
|
|
299
|
+
lines.push(`phase ${phase}`);
|
|
300
|
+
}
|
|
301
|
+
let line = `participant ${participant.id}`;
|
|
302
|
+
const name = nameOf.get(participant.lane);
|
|
303
|
+
if (name !== undefined)
|
|
304
|
+
line += ` ${quoteType(name)}`;
|
|
305
|
+
if (participant.member !== undefined)
|
|
306
|
+
line += ` member=${participant.member.index}/${participant.member.of}`;
|
|
307
|
+
if (participant.many)
|
|
308
|
+
line += " many";
|
|
309
|
+
line += ` steps=${participant.steps.join(",")}`;
|
|
310
|
+
lines.push(line);
|
|
311
|
+
}
|
|
312
|
+
for (const edge of graph.handoffs) {
|
|
313
|
+
let line = `handoff ${edge.from} -> ${edge.to}`;
|
|
314
|
+
if (edge.back)
|
|
315
|
+
line += " back";
|
|
316
|
+
if (edge.types !== undefined)
|
|
317
|
+
line += ` types=${quoteType(edge.types.join(","))}`;
|
|
318
|
+
lines.push(line);
|
|
319
|
+
}
|
|
320
|
+
return `${lines.join("\n")}\n`;
|
|
321
|
+
}
|