|
| 1 | +//! # ACP NATS Subject Hierarchy |
| 2 | +//! |
| 3 | +//! Every ACP subject, its transport, and why. |
| 4 | +//! |
| 5 | +//! ## Core NATS (request/reply or fire-and-forget) |
| 6 | +//! |
| 7 | +//! Stateless operations where the agent must be online now and the response |
| 8 | +//! is immediate. No session state to recover on failure — just retry. |
| 9 | +//! |
| 10 | +//! | Subject | Pattern | Rationale | |
| 11 | +//! |--------------------------------------|------------------|----------------------------------------------| |
| 12 | +//! | `agent.initialize` | request/reply | Handshake, agent must be alive | |
| 13 | +//! | `agent.authenticate` | request/reply | Auth, agent must be alive | |
| 14 | +//! | `agent.session.list` | request/reply | Read-only query, no state change | |
| 15 | +//! | `agent.ext.>` | request/reply | Stateless global extension calls | |
| 16 | +//! | `session.{id}.client.*` | request/reply | Agent-to-bridge ops (fs, terminal, perms) | |
| 17 | +//! |
| 18 | +//! ## JetStream (durable delivery via streams) |
| 19 | +//! |
| 20 | +//! Commands that create or mutate session state. Durable delivery means the |
| 21 | +//! agent receives the command even after a restart, and the bridge can replay |
| 22 | +//! responses on reconnect. |
| 23 | +//! |
| 24 | +//! | Subject | Stream | Rationale | |
| 25 | +//! |----------------------------------------------|-----------------|--------------------------------------------| |
| 26 | +//! | `agent.session.new` | GLOBAL | Creates session state | |
| 27 | +//! | `session.*.agent.cancel` | COMMANDS | Must survive agent reconnect | |
| 28 | +//! | `session.*.agent.prompt` | COMMANDS | Long-running, must survive restarts | |
| 29 | +//! | `session.*.agent.load` | COMMANDS | Loads session into agent, mutates state | |
| 30 | +//! | `session.*.agent.close` | COMMANDS | Ends session lifecycle | |
| 31 | +//! | `session.*.agent.set_mode` | COMMANDS | Mutates session config | |
| 32 | +//! | `session.*.agent.set_config_option` | COMMANDS | Mutates session config | |
| 33 | +//! | `session.*.agent.set_model` | COMMANDS | Mutates session config | |
| 34 | +//! | `session.*.agent.fork` | COMMANDS | Creates new session from existing | |
| 35 | +//! | `session.*.agent.resume` | COMMANDS | Resumes session, mutates state | |
| 36 | +//! | `session.*.agent.prompt.response.>` | RESPONSES | Streamed prompt responses | |
| 37 | +//! | `session.*.agent.response.>` | RESPONSES | One-shot command responses | |
| 38 | +//! | `session.*.agent.ext.ready` | RESPONSES | Extension ready signal | |
| 39 | +//! | `session.*.agent.cancelled` | RESPONSES | Cancellation confirmation | |
| 40 | +//! | `session.*.agent.update.>` | NOTIFICATIONS | Async streaming updates | |
| 41 | +//! |
| 42 | +//! ## Passive JetStream Capture (audit only) |
| 43 | +//! |
| 44 | +//! These subjects use Core NATS for the actual request/reply, but JetStream |
| 45 | +//! streams capture a copy for audit and observability. The stream doesn't |
| 46 | +//! participate in the request/reply flow. |
| 47 | +//! |
| 48 | +//! | Subject | Stream | Rationale | |
| 49 | +//! |-------------------------|------------|------------------------------------| |
| 50 | +//! | `agent.initialize` | GLOBAL | Audit agent lifecycle | |
| 51 | +//! | `agent.authenticate` | GLOBAL | Audit auth attempts | |
| 52 | +//! | `agent.session.new` | GLOBAL | Audit session creation | |
| 53 | +//! | `agent.ext.>` | GLOBAL_EXT | Audit extension calls | |
| 54 | +//! |
| 55 | +//! ## Not in JetStream |
| 56 | +//! |
| 57 | +//! | Subject | Reason | |
| 58 | +//! |------------------------|-----------------------------------------------------------| |
| 59 | +//! | `agent.session.list` | Pure read, no state change, no audit value | |
| 60 | +//! | `session.*.client.>` | Agent-to-bridge ops, bridge IS the process, no disconnect | |
| 61 | +
|
1 | 62 | pub mod agent { |
2 | 63 | pub fn initialize(prefix: &str) -> String { |
3 | 64 | format!("{}.agent.initialize", prefix) |
|
0 commit comments