@bpmsoftwaresolutions/sej-runtime-projector
v0.5.3
Published
Complete SEJ Runtime Projector distribution for Node.js, Python, and .NET.
Readme
SEJ Runtime Projector
The SEJ Runtime Projector is a contract-driven workspace reconciler. Its generic plan/apply core consumes authorized projection packages. Its direct code surface binds authoritative SEJ semantics to a client-owned execution-body and language disposition, then constructs the package internally. The repository enforces filesystem safety, creates deterministic plans, applies compare-and-swap changes, and emits receipts.
The projector does not invent target mechanics, paths, naming, DTO stitching, conditionality, or source templates. The SEJ owns operations and responsibility identity. The client disposition owns the execution-body profile and native code bodies; the optional CLI language argument only filters those client entries.
All three packages expose direct code-body projection without a separate request, package, feature-body authority, or semantic-analysis pass. The projector rejects a client disposition whose SEJ contract, responsibility, or declared execution operations do not match the authoritative SEJ.
code-projection-sej.valid.v1.json is the semantic authority. client-code-projection.valid.v1.json is the client-owned execution-body and native-language disposition. The latter owns paths, language labels, media types, function signatures, port calls, and composition without moving semantic operation authority out of SEJ.
The projected, standalone runnable files are checked in under conformance/runnable-code-projection. Each can be executed directly and prints the same classification result.
Protocol
The wire contracts live in contracts/schemas:
projection-package.schema.v1.json— immutable producer output containing opaque desired entries and supplied lineage hashes.client-code-projection.schema.v1.json— client-owned execution-body profile and native code-body disposition bound to an SEJ contract.project-request.schema.v1.json— workspace, bounds, explicit mode, package binding, and optional apply authorization.projection-plan.schema.v1.json— read-only comparison, preimages, ownership-proof results, and plan hash.projection-receipt.schema.v1.json— applied result and receipt hash usable as a future replacement proof.
Entries currently carry UTF-8 text. Their content is opaque to the projector and may contain any valid text, including no generated header. A package must declare a qualified producer, PROJECTION_ELIGIBLE, five lineage hashes, an output-scope hash, and a package hash over its canonical contents.
An existing artifact can only be replaced when the entry references a prior receipt and the request supplies that exact receipt. The receipt must prove the same canonical workspace, path, owner, and observed content hash. Text markers never authorize replacement.
Commands
Plan without writing:
sej-projector plan <project-request.json> <projection-package.json>Apply a previously produced plan:
sej-projector apply <projection-plan.json>Resolve an SEJ plus client disposition to a package, or project them directly:
sej-projector resolve-code <sej.json> <client-projection.json> [language]
sej-projector project-code <sej.json> <client-projection.json> <workspace-root> [language]Omit the language to emit every body admitted by the client disposition. The equivalent APIs are resolveCodeProjection / projectCode in Node, resolve_code_projection / project_code in Python, and CodeProjection.ResolveCodeProjection / CodeProjection.ProjectCode in C#.
mode is required in every project request. The projector never infers apply from an omitted value. An apply request also requires an authorization whose hash binds the package, eligibility result, and target qualification.
The Node, Python, and C# packages implement the same canonical JSON, hash, path-safety, preimage, ownership-proof, staging, rollback, and receipt protocol. They have no dependency on an authority registry, policy evaluator, language renderer, or runtime adapter.
Projection pattern lab
The executable lab in examples/projection-patterns/pattern-lab.cjs shows how a host can use the thin layer with different producer strategies:
- fan one logical artifact out to TypeScript, Python, and C# paths;
- atomically batch Markdown, JSON, and plain-text artifacts;
- apply a receipt-bound refactoring update with replacements plus a new file;
- emit different layouts for different qualified targets; and
- demonstrate that preimage drift blocks a batch before any new file is created.
It also includes a small semantic archaeology experiment that observes one feature, writes the candidate observation and admitted authority side by side, and emits a behavioral continuity report. For a denser client-facing proof, the generator now also emits an enterprise proof pack with a three-receipt chain, a metrics dossier, and a drift-blocked safety proof.
Run it with:
npm run pattern-lab --prefix packages/nodeFor inspectable workspaces, run the CLI-backed generator:
npm run pattern-generate --prefix packages/nodeThe host driver authors only the package/request JSON, then invokes the sej-projector plan and sej-projector apply commands. The resulting code bodies and metadata are written under generated/projection-patterns/, including TypeScript, Python, and C# fan-out, a receipt-bound refactor, target layouts, and an atomic preflight failure.
The host pattern is always the same: produce and hash a package, bind a request to its package and authorization, invoke the CLI plan command, inspect the plan, invoke the CLI apply command, and persist the receipt for the next generation. The producer controls the artifact set and paths; the projector controls only workspace safety and reconciliation.
Agentary executable client
examples/agentary/agentary.sej.json is a semantic executable application definition: it describes an intake analyst, delivery planner, execution coordinator, workflow actions, and priority/label policy. examples/agentary/project.cjs acts as the qualified producer. It renders a real multi-file Node application, packages those opaque bodies, invokes the projector CLI, and then runs the projected application and its executable test.
Run it with:
npm run agentary --prefix packages/nodeIf npm is not installed, invoke the producer directly with Node:
node examples/agentary/project.cjsIn the bundled-runtime environment used by this workspace, the equivalent command is:
/Users/wrenethajones/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin/node examples/agentary/project.cjsInspect generated/agentary/workspace/, generated/agentary/projection-plan.json, generated/agentary/projection-receipt.json, and generated/agentary/execution-result.json. The generated app classifies a checkout outage as high priority, adds a human-review step from semantic policy, executes all four workflow steps, and emits the resulting report.
Verification
Run the package tests with the repository's bundled runtimes or the corresponding installed language runtimes:
npm test --prefix packages/node
PYTHONPATH=packages/python/src python -m unittest discover -s packages/python/tests -p 'test_*.py'
dotnet run --project packages/csharp/tests/Loc.SejProjector.Tests.csprojThe conformance scripts also check package isolation, JSON validity, protocol alignment, and production-source domain neutrality.
