Skip to main content

Module bus

Module bus 

Source
Expand description

The cross-instance agent bus: the local bus (ctx_agent) of every machine of an organization joined through Cloud.

One relay per machine runs in the daemon (spawn); it never runs in a tool call. Offline, the local bus keeps working exactly as before; on reconnect the relay catches up from its cursors and republishes what is pending (Cloud deduplicates by client_msg_id).

Modules§

address
Bus addresses (SPEC-ENGINE §3.7.1, C0 2.0 bus.schema.json $defs/address). Only an explicitly addressed message leaves the machine; no address, local or a local agent id stays on the local bus.
control
Bus controls from Cloud (hold, stop, veto, resume) and the admission answers derived from them.
exchange
Agent exchange through LeanCTX Cloud (Welle 4, contract §40): the rules every knowledge item (finding) and task hand-over (handoff, with its question, offer and answer conversation) passes when it leaves this machine for another machine’s agent or person, or arrives from one, and the audit record each exchange leaves.
handoff
The handoffs this machine offered through Cloud.
leases
Cross-instance leases through Cloud (C5c).
messages_v2
Typed agent messages on a C0 2.0 Cloud (bus v2, E14): ctx_agent send and reply become place.publish frames to the vault bus of the checkout.
person_rules
What an agent may never say on the bus (process v1 §7): no approval or decision in a person’s name, no refused action passed on to another agent, and only the registered Queen appears as the Queen.
plan_body
The plan body leanctx.plan-body/v1 (contract §37.3) and its publish (lean-ctx cloud plan publish, §37.10).
plan_events
Plan updates to running agents (contract §37). A person changes the plan or a team decision in LeanCTX Code; Cloud tells every engine of the vault with a text-free frame:
plan_view
The plan versions this instance applied, with what its agents answered, for a local reader (kind cloud.plan.updates, contract §37.6).
presence
Who works where: the workers of other machines on the vault buses this machine follows, as Cloud reports them in presence.update frames. ctx_agent list shows them under the local agents; a message or a handoff addresses one by its worker id (wkr_…).
queen_kinds
The Queen network’s message kinds on agent-bus/1 (QN0) and the Queen relay rule (HN0).
relay_v2
The bus v2 relay’s decisions (C0 2.0 section 3; SPEC-ENGINE §3.7): which vault buses this machine subscribes, the hello with its presence, which local posts become place.publish frames, how deliveries land and which Cloud-signed controls hold a worker.
task_events
task.event frames (C0 2.2 §10.1): Cloud tells every engine of a vault when one of its tasks changed. The engine outdates its task cache (the next ctx_tasks read fetches the task again) and hands the work to its own agents on the local bus, so agents orchestrate tasks themselves:
v2
Bus v2 wire shapes the engine sends and reads (C0 2.0 section 3, bus.schema.json; SPEC-ENGINE §3.7): typed messages on vault buses, Cloud-signed controls and presence.
veto
A maintainer’s veto of a host handoff or lock (SPEC-ENGINE §3.7.4, V9.5 phase A): a verified control frame with action = veto and a ref of kind lease (a bus lock) or handoff.

Structs§

Report
Where a relay says what it does. The foreground cloud bus relay prints it; the daemon’s relay is quiet (its errors reach cloud status). A line equal to the one said last is not repeated, so a relay that waits says why once, not on every tick.

Functions§

run_for
Run the relay in the foreground for duration (lean-ctx cloud bus relay --for <seconds>), e.g. to watch it or in tests. When another relay (the daemon’s) already runs, nothing runs here and Ok(false) says so: the caller then asks that relay to announce now. report hears what the relay sends (each hello’s workers, roles and buses) and why it sends nothing, when it does not.
spawn
Start the bus relay thread when this machine is connected. While the bus is off or Cloud is disabled it waits and sends nothing; rc4-82: a daemon started with bus = "off" used to stay without a relay for its whole life, so turning the bus on later never reached the team.