Skip to main content

supercode_interchange/ontology/
identity.rs

1//! Harness identity: the one list every registry, ledger and codec keys on.
2
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5
6/// Extensible identifier for a coding harness.
7#[derive(
8    Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize, JsonSchema,
9)]
10#[serde(transparent)]
11pub struct HarnessId(pub String);
12
13impl HarnessId {
14    /// Claude Code's stable identifier.
15    pub const CLAUDE_CODE: &'static str = "claude-code";
16    /// Codex's stable identifier.
17    pub const CODEX: &'static str = "codex";
18    /// Pi's stable identifier.
19    pub const PI: &'static str = "pi";
20    /// OpenCode's stable identifier.
21    pub const OPENCODE: &'static str = "opencode";
22    /// Grok's stable identifier.
23    pub const GROK: &'static str = "grok";
24    /// Gemini CLI's stable identifier.
25    pub const GEMINI: &'static str = "gemini";
26    /// Goose's stable identifier.
27    pub const GOOSE: &'static str = "goose";
28    /// Hermes Agent's stable identifier.
29    pub const HERMES: &'static str = "hermes";
30    /// OpenClaw's stable identifier.
31    pub const OPENCLAW: &'static str = "openclaw";
32    /// Supercode's native saved-session store.
33    pub const SUPERCODE: &'static str = "supercode";
34    /// The supercode orchestrator's stable identifier (ORC-7). Its home is a
35    /// Hermes-shaped folder tree, not a transcript store: it owns bindings
36    /// that point AT other harnesses' sessions.
37    pub const ORCHESTRATOR: &'static str = "orchestrator";
38
39    /// Construct an identifier without restricting third-party harness names.
40    pub fn new(value: impl Into<String>) -> Self {
41        Self(value.into())
42    }
43
44    /// Return the identifier as a string slice.
45    pub fn as_str(&self) -> &str {
46        &self.0
47    }
48}
49
50impl From<&str> for HarnessId {
51    fn from(value: &str) -> Self {
52        Self::new(value)
53    }
54}