Skip to main content

lsp_max_protocol/
custom_methods.rs

1use crate::*;
2use lsp_types_max::request::Request;
3
4// ---------------------------------------------------------------------------
5// Method name constants for the 11 new max/* methods
6// ---------------------------------------------------------------------------
7
8/// max/hook — Register or query hook descriptors. Returns all hooks if no id given.
9pub const METHOD_HOOK: &str = "max/hook";
10
11/// max/hookGraph — Return the directed hook dependency graph rooted at an optional node.
12pub const METHOD_HOOK_GRAPH: &str = "max/hookGraph";
13
14/// max/chain — Return chain descriptors. Returns all chains if no chain_id given.
15pub const METHOD_CHAIN: &str = "max/chain";
16
17/// max/propagate — Propagate a signal through a chain or from a hook. Returns affected nodes and receipts.
18pub const METHOD_PROPAGATE: &str = "max/propagate";
19
20/// max/autonomicLoop — Query or trigger an autonomic (self-regulating) loop. Returns loop status.
21pub const METHOD_AUTONOMIC_LOOP: &str = "max/autonomicLoop";
22
23/// max/manifoldSnapshot — Return a full manifold snapshot: conformance, hooks, chains, receipts.
24pub const METHOD_MANIFOLD_SNAPSHOT: &str = "max/manifoldSnapshot";
25
26/// max/lawfulTransition — Assert a phase transition is lawful against all active LawAxes. Returns violated laws.
27pub const METHOD_LAWFUL_TRANSITION: &str = "max/lawfulTransition";
28
29/// max/admission — Admissibility gate. Returns Admitted/Refused/Unknown. Never collapses Unknown.
30pub const METHOD_ADMISSION: &str = "max/admission";
31
32/// max/refusal — Explicit refusal gate. Records a refused LawAxis with rationale and receipt.
33pub const METHOD_REFUSAL: &str = "max/refusal";
34
35/// max/replay — Replay an event log against a snapshot and return conformance evidence.
36pub const METHOD_REPLAY: &str = "max/replay";
37
38/// max/releaseActuation — Actuate a release if and only if the ConformanceVector admits it. Strict mode blocks on Unknown.
39pub const METHOD_RELEASE_ACTUATION: &str = "max/releaseActuation";
40
41/// max/lsif — Stream the current registry state as an exhaustive LSIF NDJSON graph.
42pub const METHOD_LSIF_EXPORT: &str = "max/lsif";
43
44// Request implementations
45
46pub enum MaxSnapshot {}
47impl Request for MaxSnapshot {
48    type Params = ();
49    type Result = SnapshotId;
50    const METHOD: &'static str = "max/snapshot";
51}
52
53pub enum MaxConformanceVector {}
54impl Request for MaxConformanceVector {
55    type Params = SnapshotId;
56    type Result = ConformanceVector;
57    const METHOD: &'static str = "max/conformanceVector";
58}
59
60pub enum MaxExplainDiagnostic {}
61impl Request for MaxExplainDiagnostic {
62    type Params = String; // diagnostic_id
63    type Result = MaxDiagnostic;
64    const METHOD: &'static str = "max/explainDiagnostic";
65}
66
67pub enum MaxRepairPlan {}
68impl Request for MaxRepairPlan {
69    type Params = String; // diagnostic_id or law_id
70    type Result = Vec<MaxCodeAction>;
71    const METHOD: &'static str = "max/repairPlan";
72}
73
74pub enum MaxApplyRepairTransaction {}
75impl Request for MaxApplyRepairTransaction {
76    type Params = MaxCodeAction;
77    type Result = Receipt;
78    const METHOD: &'static str = "max/applyRepairTransaction";
79}
80
81pub enum MaxExportAnalysisBundle {}
82impl Request for MaxExportAnalysisBundle {
83    type Params = SnapshotId;
84    type Result = AnalysisBundle;
85    const METHOD: &'static str = "max/exportAnalysisBundle";
86}
87
88pub enum MaxRunGate {}
89impl Request for MaxRunGate {
90    type Params = GateId;
91    type Result = bool;
92    const METHOD: &'static str = "max/runGate";
93}
94
95pub enum MaxClearDiagnostic {}
96impl Request for MaxClearDiagnostic {
97    type Params = String; // diagnostic_id
98    type Result = ();
99    const METHOD: &'static str = "max/clearDiagnostic";
100}
101
102pub enum MaxReceipt {}
103impl Request for MaxReceipt {
104    type Params = String; // receipt_id
105    type Result = Receipt;
106    const METHOD: &'static str = "max/receipt";
107}
108
109// New doctrine methods
110
111pub enum MaxHook {}
112impl Request for MaxHook {
113    type Params = Option<String>; // optional hook_id; None = list all
114    type Result = Vec<HookDescriptor>;
115    const METHOD: &'static str = "max/hook";
116}
117
118pub enum MaxHookGraph {}
119impl Request for MaxHookGraph {
120    type Params = Option<String>; // optional root node_id
121    type Result = Vec<HookGraphNode>;
122    const METHOD: &'static str = "max/hookGraph";
123}
124
125pub enum MaxChain {}
126impl Request for MaxChain {
127    type Params = Option<String>; // optional chain_id
128    type Result = Vec<ChainDescriptor>;
129    const METHOD: &'static str = "max/chain";
130}
131
132pub enum MaxPropagate {}
133impl Request for MaxPropagate {
134    type Params = String; // chain_id or hook_id to propagate from
135    type Result = PropagationResult;
136    const METHOD: &'static str = "max/propagate";
137}
138
139pub enum MaxAutonomicLoop {}
140impl Request for MaxAutonomicLoop {
141    type Params = Option<String>; // optional loop_id
142    type Result = AutonomicLoopStatus;
143    const METHOD: &'static str = "max/autonomicLoop";
144}
145
146pub enum MaxManifoldSnapshot {}
147impl Request for MaxManifoldSnapshot {
148    type Params = SnapshotId;
149    type Result = ManifoldSnapshot;
150    const METHOD: &'static str = "max/manifoldSnapshot";
151}
152
153pub enum MaxLawfulTransition {}
154impl Request for MaxLawfulTransition {
155    type Params = TransitionAttempt;
156    type Result = LawfulTransitionResult;
157    const METHOD: &'static str = "max/lawfulTransition";
158}
159
160pub enum MaxAdmission {}
161impl Request for MaxAdmission {
162    type Params = LawAxis;
163    type Result = AdmissionResult;
164    const METHOD: &'static str = "max/admission";
165}
166
167pub enum MaxRefusal {}
168impl Request for MaxRefusal {
169    type Params = LawAxis;
170    type Result = RefusalResult;
171    const METHOD: &'static str = "max/refusal";
172}
173
174pub enum MaxReplay {}
175impl Request for MaxReplay {
176    type Params = SnapshotId;
177    type Result = ReplayResult;
178    const METHOD: &'static str = "max/replay";
179}
180
181pub enum MaxReleaseActuation {}
182impl Request for MaxReleaseActuation {
183    type Params = SnapshotId;
184    type Result = ReleaseActuationResult;
185    const METHOD: &'static str = "max/releaseActuation";
186}