Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
Process Contracts
This directory owns authoritative cross-process OpenAPI and the generated Go and TypeScript modules consumed directly by Web, Agent, and TeamHub. It owns no product policy or application behavior.
Layout
openapi/
components/
paths/
teamhub-public/
teamhub-api.openapi.yaml
teamhub-agent-api/
openapi.yaml # Agent CLI -> TeamHub business API, incl. CLI files
teamhub-internal/
openapi.yaml # Node Services / Voice Runtime -> TeamHub
node-services-internal/
openapi.yaml # TeamHub -> Node Services (4319 and 4321)
runner-gateway/
asyncapi.yaml # Runner Gateway WebSocket channel
envelope.schema.json
fixtures/
fixtures/
service-credentials/ # shared TypeScript and Go derivation vectors
generated/
typescript/
package.json # @linger/wire-contracts
src/
generated/<id>/ # written by generation only
generated/runner-gateway/
<id>/client.ts # handwritten clients and servers
go/
<package>/ # written by generation only
codegen/
contracts.ts # generate and verify every contract
The LLM Wiki operations in node-services-internal define the stateless document normalization and Wiki
refresh candidate generation that TeamHub calls; TeamHub owns scheduling,
source selection, and settlement.
After consolidation, contracts/openapi is the only authority. Applications
must not retain copied schemas or app-local generated wire DTOs.
Generate every language boundary from the authoritative OpenAPI with:
make contracts-generate
make contracts-verify
contractEntries in codegen/contracts.ts lists every top-level contract
once: its id, its entrypoint, and, when Go uses it, go: { package, mode } with mode client
(types and a client for Go callers) or types (types only, for the contracts
TeamHub serves through its own route table). Generation and verification read only that list. Generation
clears generated/typescript/src/generated/ and each listed Go package
directory, bundles all references, and writes types.ts and openapi.gen.go
there. Verification generates into a temporary directory, compares those
directories whole, and fails on any directory that no contract owns.
Generated files are committed and never edited by hand.
Handwritten clients and servers live in generated/typescript/src/<id>/ and
import their types from ../generated/<id>/types.js. The package exports only
<id>/types, <id>/client, <id>/server, and the Runner Gateway schema and
validator.
To add a top-level contract, create openapi/<id>/openapi.yaml, add one
contractEntries entry, and run make contracts-generate. No Makefile or
test edit is needed.
JSON Schema and AsyncAPI directories are introduced only when a second real protocol needs them.
Local models flow
A Computer's model library is the localmodels tool's, reached through the
same chain as Skill scans. Schemas live in openapi/components/local-models.yaml
and the LocalModel* definitions of runner-gateway/envelope.schema.json.
Actions go Web → TeamHub → Agent Service → Computer → localmodels:
- Web posts
actOnLocalComputerModel(POST /v0/tenants/{tenantId}/local-computers/{computerId}/local-models/{modelId}/actions). Only the Computer owner may act. - TeamHub calls Node Services
actOnLocalComputerModels(POST /v1/tenants/{tenantId}/owners/{ownerActorId}/local-computers/{computerId}/local-model-actions). - Agent Service sends
executewith kindlocal_models(download, cancel, load withunload_first, unload, remove, or refresh). The Daemon answersexecutedwith outcomeacceptedorrefusedat once and runs thelocalmodels libraryjob itself. The ack returns to TeamHub asLocalModelActionAck; a refusal becomes aLocalModelsErrorCode.
Progress and outcomes travel back only as snapshots:
- The Daemon sends
runner.local_modelswith aLocalModelsSnapshotmapped fromlocalmodels.library-status/v1: afterrunner.hello, after every library change, and at most every 2 seconds while a download or load runs. A Computer without the tool reportsavailable: falsewithTOOL_NOT_INSTALLED. EachLocalModelmay also carry optional model-card metadata (family,publisher,architecture,parameters,active_parameters,capabilities,license,source_url,prompt_tokens_per_second). - Agent Service records it through TeamHub
recordAgentRuntimeLocalModels(POST /v0/agent-runtime/local-computers/local-models). TeamHub keeps the latest snapshot per Computer, so an offline Computer shows what it last reported, and publishes alocal-modelsinvalidation hint whose id is the Computer ID. - Web reads
getLocalComputerModels(GET /v0/tenants/{tenantId}/local-computers/{computerId}/local-models), where TeamHub adds each model'sused_by: active Agents on that Computer with runtimepiwhose runtime model is the model'spi_model. localmodels reportspi_modelfor every model on the Computer, loaded or not, so an idle model still lists the Agents that will run on it.
Model source flow
Which source a Computer's Agents use (local model, subscription or BYOK) is
the localmodels tool's <state>/model-source.json. Schemas live in
openapi/components/model-source.yaml and the CapabilityModelSource*
definitions of runner-gateway/envelope.schema.json.
Web → TeamHub → Agent Service → Computer → localmodels source:
- Web calls
getLocalComputerModelSource,switchLocalComputerModelSource,testLocalComputerModelSourceorlistLocalComputerByokModelsunder/v0/tenants/{tenantId}/local-computers/{computerId}/model-source. Only the Computer owner sees the source or acts on it. - TeamHub calls Node Services
getLocalComputerModelSource,applyLocalComputerModelSource,testLocalComputerByokorlistLocalComputerByokModelsunder/v1/tenants/{tenantId}/owners/{ownerActorId}/local-computers/{computerId}/model-source. - Agent Service sends
executewith kindmodel_source(status,test,modelsorapply), only to Computer 0.54.0 or later; an older Computer, or one whose installedlocalmodelstool lacks thesourcecommand, answersMODEL_SOURCE_UNSUPPORTED. The Daemon runslocalmodels source status|check|models|applyand answersexecuted. A BYOK API key travels in the request and the envelope only, reacheslocalmodelson stdin, and is kept on the Computer in an owner-only file.
A BYOK input names its address as base_url, path and endpoint, with the
protocol the owner's client derived from the address's ending (else the
Runtime's own format). Requests go to base_url + path + endpoint, models are
listed at base_url + path + /models, and nothing is probed. Agent Service
sends a BYOK input only to Computer 0.56.0 or later
(FIRST_BYOK_ENDPOINT_COMPUTER_VERSION), and declares byok_endpoint in
runner.welcome's service_features to the same releases; the Computer's BYOK
summary carries path and endpoint only after that declaration, because an
older Agent Service rejects unknown summary keys.
A switch runs apply on the Computer first, then moves the owner's Agents on it
to the Runtime and model it now serves, in one TeamHub transaction. An Agent
with running work stays where it is unless the owner chose to end that work:
work found before apply refuses the switch with AGENT_HAS_ACTIVE_RUNS, and
work that started during it leaves only that Agent behind, answered with the
same code after the others moved.