1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! Client-side vocabulary for the evernight terminal route: JSON-RPC method
//! names and the request-scoped authentication field.
//!
//! Specification: `docs/zh-Hans/designs/polemos-evernight-terminal-routing.md`
//! in the entelecheia repository (P83/M1 routing contract) — §4.1 for the
//! method surface and §3.2 / §7 decision two for the static-token model.
//!
//! Token discipline (hard rule): the shared secret exists only as a
//! process-environment value held in memory. It never lands in git, logs or
//! docs; every checked-in appearance is the literal placeholder
//! `<your-evernight-token>`.
/// JSON-RPC method for one-shot shell command execution (`Command.Exec`).
///
/// The broker executes the single `command` string with `sh -c` and answers
/// with `{exit_code, stdout, stderr}` (spec §4.1, fact F6). Structured argv
/// is *not* part of the protocol and must not be invented here.
pub const METHOD_COMMAND_EXEC: &str = "Command.Exec";
/// JSON-RPC method used as the connectivity probe against the broker
/// (`System.Ping`). The deployment runbook uses one ping to verify the route
/// after a token rotation (spec §7 decision two, rotation memo).
pub const METHOD_SYSTEM_PING: &str = "System.Ping";
/// Top-level params field that carries the request-scoped shared token when
/// one is configured. The broker is expected to strip this field before the
/// params reach the `Command.Exec` handler; it is never part of
/// [`crate::envelope::DispatchEnvelope::wire_params`] itself.
pub const AUTH_PARAM_KEY: &str = "auth";
/// Environment variable through which the deployment injects the static
/// shared token (spec §3.2 / §7 decision two).
pub const ENV_TOKEN_VAR: &str = "EVERNIGHT_TOKEN";
/// Reads the static token from the process environment.
///
/// Returns `None` when [`ENV_TOKEN_VAR`] is unset or empty. The returned
/// string is held in memory only — callers must not persist or log it.