Skip to main content

rightkit_context/
lib.rs

1//! Membrane: the one program the host app runs for context, memory and Blueprint queries.
2//!
3//! `cli` defines the command line (C4), `dispatch` runs it, `modes` holds what each command
4//! does (resident first, then in process), and `serve` is the resident the host app supervises.
5//! `activation` keeps the activation lock, and `native_init`
6//! the repository enrollment behind `init`. Real work is delegated to `membrane_runtime`.
7
8pub mod activation;
9pub mod cli;
10pub mod dispatch;
11pub mod modes;
12pub mod native_init;
13pub mod serve;
14
15/// Process-wide exit-code contract (README "CLI contract"). Scripts distinguish the outcomes
16/// below without parsing stderr; a hook ignores all of this and always exits 0.
17pub const EXIT_OK: i32 = 0;
18/// An internal failure: a bug or an unreadable/corrupt store.
19pub const EXIT_INTERNAL_ERROR: i32 = 1;
20/// A usage error: bad arguments, empty input. Same code clap uses for a parse failure.
21pub const EXIT_USER_ERROR: i32 = 2;
22/// The answer is not available: no memory store, or Membrane could not produce the context or
23/// Blueprint answer asked for. The reason is one line on stderr.
24pub const EXIT_NOT_AVAILABLE: i32 = 3;
25/// `status --require-resident` found no resident answering.
26pub const EXIT_RESIDENT_UNREACHABLE: i32 = 4;
27
28/// Top-level `"schema"` of each `--json` document: `membrane.<command>.v<version>`. A change
29/// that removes or retypes a field bumps the version; adding a field does not.
30pub const SCHEMA_CONTEXT_PULL: &str = "membrane.context.pull.v1";
31pub const SCHEMA_BLUEPRINT: &str = "membrane.blueprint.v1";
32/// `membrane blueprint search <text>` carries this id; other Blueprint verbs keep
33/// `SCHEMA_BLUEPRINT`.
34pub const SCHEMA_BLUEPRINT_SEARCH: &str = "membrane.blueprint.search.v1";
35pub const SCHEMA_WHERE: &str = "membrane.where.v1";
36pub const SCHEMA_MEMORY_LIST: &str = "membrane.memory.list.v1";
37pub const SCHEMA_MEMORY_SEARCH: &str = "membrane.memory.search.v1";
38pub const SCHEMA_MEMORY_DELETE: &str = "membrane.memory.delete.v1";
39pub const SCHEMA_MEMORY_PUSH: &str = "membrane.memory.push.v1";
40pub const SCHEMA_MEMORY_GET: &str = "membrane.memory.get.v1";
41pub const SCHEMA_MEMORY_SCOPES: &str = "membrane.memory.scopes.v1";
42pub const SCHEMA_MEMORY_INFO: &str = "membrane.memory.info.v1";
43pub const SCHEMA_RECEIPTS_MARK: &str = "membrane.receipts.mark.v1";
44pub const SCHEMA_STATUS: &str = "membrane.status.v1";
45/// `membrane adapt <verb>`: one schema per verb.
46pub const SCHEMA_ADAPT_OBSERVE: &str = "membrane.adapt.observe.v1";
47pub const SCHEMA_ADAPT_RECALL: &str = "membrane.adapt.recall.v1";
48pub const SCHEMA_ADAPT_APPLY: &str = "membrane.adapt.apply.v1";
49pub const SCHEMA_ADAPT_TASTE_REVIEW: &str = "membrane.adapt.taste_review.v1";
50pub const SCHEMA_ADAPT_STATUS: &str = "membrane.adapt.status.v1";
51pub const SCHEMA_ADAPT_ADJUDICATE_TASTE: &str = "membrane.adapt.adjudicate_taste.v1";
52pub const SCHEMA_ADAPT_MINE_SESSION: &str = "membrane.adapt.mine_session.v1";
53/// `membrane transcript append`.
54pub const SCHEMA_TRANSCRIPT_APPEND: &str = "membrane.transcript.append.v1";
55pub const SCHEMA_TRANSCRIPT_TIP: &str = "membrane.transcript.tip.v1";
56
57pub use rightkit_context_protocol as protocol;
58pub use rightkit_context_runtime as runtime;
59pub use serve::run_serve;