# WO-00 Inference Network Inventory

This document describes the machine-checked boundary for production inference
clients. The canonical inventory is
`test-support/inference-network-registry.ts`.

## Scope

The registry records two related surfaces:

1. Production source files that construct a network-capable backend.
2. Direct or delegating entry points that can reach inference after normal
   construction.

The construction-site list covers `OllamaBackend`, `VllmBackend`,
`OllamaAgenticBackend`, `NexusAgenticBackend`, and `CascadeBackend`.
The entry-point list also covers direct embedding, vision, media, voice,
background cognition, daemon proxy, model-broker, and setup probes.

The inventory distinguishes constructor work from deferred method work. Most
constructors only store configuration. `CascadeBackend` and the legacy
`AgentLoop` construct delegated clients immediately. Network I/O still occurs
only when a probe or inference method runs.

## Machine gate

`packages/orchestrator/tests/inference-network-registry.test.ts` parses every
production TypeScript source file. It fails when a covered backend constructor
appears in a new source file without a registry entry. It also confirms that
each documented entry point still resolves to a real declaration and expected
transport marker.

The same test checks every workspace Vitest configuration. Each configuration
must load `test-support/vitest-hermetic-network.ts`.

## Unit and fixture network policy

The test bootstrap blocks `fetch` and raw socket connections by default.
Tests can call `allowTestNetworkEndpoint()` for an exact loopback host and
port. This path is only for deterministic local fixtures.

An external integration test needs both controls:

1. Set `OMNIUS_INTEGRATION_TEST_NETWORK=1` in the operator environment.
2. Call `enableIntegrationTestNetwork()` with a non-empty test purpose.

The release function must run when the integration test ends. Production
runtime behavior is unchanged because this boundary loads only from Vitest
configuration.

Diagnostics retain only the transport kind, origin or host and port, test
name, and disposition. They do not retain URL paths, query values, request
bodies, headers, prompts, or message text.

## Replay fixture policy

Captured memory-compiler traces use the closed
`MemoryCompilerTraceFixtureV1` schema. The importer records counts, buckets,
fingerprints, pseudonyms, and approved behavioral labels. It does not copy
messages, prompts, paths, credentials, tool arguments, outputs, errors, run
identifiers, or session identifiers.

`memory-compiler-trace-import.test.ts` uses independent message and credential
canaries. The test proves that neither a secret nor a message body survives in
the serialized fixture. The validator also rejects a later attempt to add raw
message fields.

## Update rule

When production code adds an inference client:

1. Add its constructor source to the construction-site registry when it uses a
   covered backend.
2. Add the public or internal entry point to the entry-point registry.
3. State whether the client opens a direct transport or delegates to a backend.
4. State whether the transport starts in the constructor or a later method.
5. Add a deterministic fake or an exact loopback fixture to its unit tests.
6. Do not add a broad endpoint allowlist to make a unit test pass.
