Metadata-Version: 2.4
Name: cf-runtime
Version: 0.1.9
Summary: Local Cogniflow runtime bootstrap and lifecycle provider.
Author: Cogniflow Maintainers
License: GPL-3
Requires-Python: >=3.11
Provides-Extra: test
Requires-Dist: pytest>=8; extra == 'test'
Requires-Dist: rdflib>=7; extra == 'test'
Description-Content-Type: text/markdown

# cf-runtime

`cf_runtime` defines Cogniflow runtime identity, filesystem layout, managed tools, manifests, connection targets, and process lifecycle. Other implementation packages cross its installed process boundary with validated JSON rather than importing runtime internals.

## Runtime model

The closed runtime identities are `development` and `production`. Development uses an explicit source tree and semantic seed with managed Java and Fuseki on loopback port 3030. Production uses an explicitly installed instance outside `.cogniflow`, isolated port 3130, the instance's canonical Python executable, and its installed native MCP service executable.

`CogniflowHome` and `RuntimePaths` own all `.cogniflow` paths. `RuntimeManifest` schema version 2 is strict, deterministic, pair-validated, and atomically written. Unknown fields and obsolete schemas are rejected. Development lifecycle operations use an exclusive canonical lock and publish process and readiness identity atomically.

## Process protocol

`cf-runtime-bootstrap` reads one `cf.runtime.bootstrap.v1` JSON request per stdin line and writes one response per stdout line. Supported methods include target resolution, production preflight, managed-tool provisioning, and development prepare/start/status/stop. The principal outputs are canonical runtime targets, verified managed-tool paths, production composition evidence, and development lifecycle state.

Production preflight validates an installed instance and publishes runtime composition but never starts a process. Development preparation receives its source root and semantic seed explicitly. A resolved development target uses stdio and exposes only `COGNIFLOW_RUNTIME_MANIFEST` to the child process.

## Managed tools

`managed-tools/provision` accepts `cf.runtime.managed-tools.request.v1` with exact Java and Fuseki versions and returns `cf.runtime.managed-tools.result.v1`. Acquisition is HTTPS-only for production URLs, cache-backed, locked, exact-size and SHA-256 verified, archive-safe, version-checked, and idempotent. Provisioning does not disable TLS verification and does not start Fuseki.

## Boundaries

The runtime package does not choose installation profiles, resolve Python artifacts, create the target instance, or own service-level install, repair, transition, and uninstall policy. Bootstrap components may invoke managed-tool provisioning before Fuseki exists; local profile and capability discovery therefore remains outside the runtime and does not depend on SPARQL. Package semantics are under `src/cf_runtime/semantics/`.
