@celestia-island/plana-types 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +38 -0
- package/bindings/FileAnchor.ts +3 -0
- package/bindings/engine.ts +277 -0
- package/bindings/enums.ts +31 -0
- package/bindings/httpTypes.ts +197 -0
- package/bindings/index.ts +47 -0
- package/bindings/mcp/aporia.ts +61 -0
- package/bindings/mcp/eleos.ts +18 -0
- package/bindings/mcp/epieikeia.ts +48 -0
- package/bindings/mcp/haplotes.ts +47 -0
- package/bindings/mcp/hubris.ts +41 -0
- package/bindings/mcp/index.ts +13 -0
- package/bindings/mcp/kalos.ts +47 -0
- package/bindings/mcp/neikos.ts +76 -0
- package/bindings/mcp/orexis.ts +64 -0
- package/bindings/mcp/philia.ts +57 -0
- package/bindings/mcp/polemos.ts +55 -0
- package/bindings/mcp/skemma.ts +58 -0
- package/bindings/mcp/skopeo.ts +56 -0
- package/bindings/mcp/webAutomation.ts +31 -0
- package/bindings/model.ts +240 -0
- package/bindings/package.json +16 -0
- package/bindings/region.ts +3 -0
- package/bindings/serde_json/JsonValue.ts +3 -0
- package/bindings/ws/agentLifecycle.ts +41 -0
- package/bindings/ws/auth.ts +15 -0
- package/bindings/ws/baseMessages.ts +7 -0
- package/bindings/ws/bridgeNetwork.ts +71 -0
- package/bindings/ws/core.ts +51 -0
- package/bindings/ws/fileBrowsing.ts +57 -0
- package/bindings/ws/handshake.ts +23 -0
- package/bindings/ws/industrial.ts +72 -0
- package/bindings/ws/knowledgeBase.ts +10 -0
- package/bindings/ws/layer2.ts +25 -0
- package/bindings/ws/llmProvider.ts +74 -0
- package/bindings/ws/logs.ts +11 -0
- package/bindings/ws/malkuth.ts +62 -0
- package/bindings/ws/noa.ts +17 -0
- package/bindings/ws/stateSync.ts +19 -0
- package/bindings/ws/systemUi.ts +5 -0
- package/bindings/ws/tasks.ts +6 -0
- package/bindings/ws/views.ts +163 -0
- package/bindings/ws/workspace.ts +11 -0
- package/bindings/ws/yolo.ts +32 -0
- package/examples/schema_dump.rs +51 -0
- package/package.json +6 -0
- package/pnpm-workspace.yaml +2 -0
- package/src/engine.rs +602 -0
- package/src/enums.rs +334 -0
- package/src/external_mcp.rs +132 -0
- package/src/http.rs +1077 -0
- package/src/identity.rs +160 -0
- package/src/lib.rs +1215 -0
- package/src/malkuth.rs +145 -0
- package/src/mcp/aporia.rs +272 -0
- package/src/mcp/eleos.rs +210 -0
- package/src/mcp/epieikeia.rs +194 -0
- package/src/mcp/haplotes.rs +310 -0
- package/src/mcp/hubris.rs +377 -0
- package/src/mcp/kalos.rs +251 -0
- package/src/mcp/mod.rs +23 -0
- package/src/mcp/neikos.rs +533 -0
- package/src/mcp/orexis.rs +493 -0
- package/src/mcp/philia.rs +267 -0
- package/src/mcp/polemos.rs +241 -0
- package/src/mcp/skemma.rs +442 -0
- package/src/mcp/skopeo.rs +282 -0
- package/src/mcp/web_automation.rs +122 -0
- package/src/model.rs +421 -0
- package/src/protocol/base_messages.rs +125 -0
- package/src/protocol/handshake.rs +364 -0
- package/src/protocol/jsonrpc.rs +888 -0
- package/src/protocol/mod.rs +10 -0
- package/src/rbac.rs +786 -0
- package/src/region.rs +362 -0
- package/src/tracing_helpers.rs +9 -0
- package/src/ws/agent/agent_lifecycle.rs +221 -0
- package/src/ws/agent/layer2.rs +126 -0
- package/src/ws/agent/mod.rs +9 -0
- package/src/ws/agent/state_sync.rs +111 -0
- package/src/ws/agent/tasks.rs +43 -0
- package/src/ws/agent/yolo.rs +161 -0
- package/src/ws/mod.rs +10 -0
- package/src/ws/services/auth.rs +99 -0
- package/src/ws/services/industrial.rs +647 -0
- package/src/ws/services/knowledge_base.rs +59 -0
- package/src/ws/services/llm_provider.rs +371 -0
- package/src/ws/services/mod.rs +7 -0
- package/src/ws/ui/bridge_network.rs +96 -0
- package/src/ws/ui/file_browsing.rs +88 -0
- package/src/ws/ui/logs.rs +55 -0
- package/src/ws/ui/mod.rs +11 -0
- package/src/ws/ui/noa.rs +105 -0
- package/src/ws/ui/system_ui.rs +27 -0
- package/src/ws/ui/views.rs +159 -0
- package/src/ws/ui/workspace.rs +73 -0
package/src/identity.rs
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
//! Cross-platform machine fingerprint.
|
|
2
|
+
//!
|
|
3
|
+
//! Provides a deterministic, installation-unique identifier that can be read
|
|
4
|
+
//! without admin privileges. The fingerprint is used as key material for the
|
|
5
|
+
//! local OAuth issuer — the same machine always derives the same key, so the
|
|
6
|
+
//! issuer and the resource server (both running on the same host) can
|
|
7
|
+
//! independently compute the same HS256 signing/verification key.
|
|
8
|
+
//!
|
|
9
|
+
//! The raw platform identifier is hashed with SHA-256 so the output is a
|
|
10
|
+
//! fixed-width, opaque hex string regardless of the underlying source format.
|
|
11
|
+
//!
|
|
12
|
+
//! # Sources
|
|
13
|
+
//!
|
|
14
|
+
//! | Platform | Source |
|
|
15
|
+
//! |----------|--------|
|
|
16
|
+
//! | Linux | `/etc/machine-id` (systemd) |
|
|
17
|
+
//! | Windows | `HKLM\SOFTWARE\Microsoft\Cryptography\MachineGuid` |
|
|
18
|
+
//! | macOS | `IOPlatformUUID` via ioreg |
|
|
19
|
+
//! | WSL2 | `/etc/machine-id` (WSL2 distro's own) |
|
|
20
|
+
//!
|
|
21
|
+
//! If the primary source is unavailable, falls back to a composite of the
|
|
22
|
+
//! hostname + OS details — less unique but stable across reboots.
|
|
23
|
+
|
|
24
|
+
use sha2::{Digest, Sha256};
|
|
25
|
+
|
|
26
|
+
/// 64 hex chars — the SHA-256 hash of the machine identifier.
|
|
27
|
+
pub fn machine_fingerprint() -> Option<String> {
|
|
28
|
+
let raw = raw_machine_id()?;
|
|
29
|
+
let hash = Sha256::digest(raw.as_bytes());
|
|
30
|
+
Some(hex::encode(hash))
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/// Return the best available raw platform identifier, or None.
|
|
34
|
+
fn raw_machine_id() -> Option<String> {
|
|
35
|
+
#[cfg(target_os = "linux")]
|
|
36
|
+
{
|
|
37
|
+
// Standard systemd machine-id; present on virtually all modern Linux
|
|
38
|
+
// distros AND inside WSL2 distros (each WSL2 distro gets its own).
|
|
39
|
+
if let Ok(id) = std::fs::read_to_string("/etc/machine-id") {
|
|
40
|
+
let trimmed = id.trim().to_string();
|
|
41
|
+
if !trimmed.is_empty() {
|
|
42
|
+
return Some(trimmed);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Fallback: /var/lib/dbus/machine-id (older systems).
|
|
46
|
+
if let Ok(id) = std::fs::read_to_string("/var/lib/dbus/machine-id") {
|
|
47
|
+
let trimmed = id.trim().to_string();
|
|
48
|
+
if !trimmed.is_empty() {
|
|
49
|
+
return Some(trimmed);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
#[cfg(target_os = "windows")]
|
|
55
|
+
{
|
|
56
|
+
// MachineGuid is a REG_SZ under HKLM; it's set at Windows
|
|
57
|
+
// installation and never changes. Reading it does not require admin.
|
|
58
|
+
if let Ok(output) = std::process::Command::new("reg")
|
|
59
|
+
.args([
|
|
60
|
+
"query",
|
|
61
|
+
r"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography",
|
|
62
|
+
"/v",
|
|
63
|
+
"MachineGuid",
|
|
64
|
+
])
|
|
65
|
+
.output()
|
|
66
|
+
{
|
|
67
|
+
let text = String::from_utf8_lossy(&output.stdout);
|
|
68
|
+
// Output format:
|
|
69
|
+
// HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography
|
|
70
|
+
// MachineGuid REG_SZ {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
|
|
71
|
+
for line in text.lines() {
|
|
72
|
+
if let Some(pos) = line.find("REG_SZ") {
|
|
73
|
+
let val = line[pos + 6..].trim();
|
|
74
|
+
// Strip curly braces if present.
|
|
75
|
+
let val = val.trim_start_matches('{').trim_end_matches('}');
|
|
76
|
+
if !val.is_empty() {
|
|
77
|
+
return Some(val.to_string());
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#[cfg(target_os = "macos")]
|
|
85
|
+
{
|
|
86
|
+
if let Ok(output) = std::process::Command::new("ioreg")
|
|
87
|
+
.args(["-d2", "-c", "IOPlatformExpertDevice"])
|
|
88
|
+
.output()
|
|
89
|
+
{
|
|
90
|
+
let text = String::from_utf8_lossy(&output.stdout);
|
|
91
|
+
for line in text.lines() {
|
|
92
|
+
if let Some(pos) = line.find("IOPlatformUUID") {
|
|
93
|
+
let remainder = &line[pos..];
|
|
94
|
+
// Line looks like: "IOPlatformUUID" = "XXXXXXXX-XXXX-..."
|
|
95
|
+
if let Some(q1) = remainder.find('"') {
|
|
96
|
+
let after_key = &remainder[q1 + 1..];
|
|
97
|
+
if let Some(q2) = after_key.find('"') {
|
|
98
|
+
let after_eq = &after_key[q2 + 1..];
|
|
99
|
+
if let Some(q3) = after_eq.find('"') {
|
|
100
|
+
if let Some(q4) = after_eq[q3 + 1..].find('"') {
|
|
101
|
+
let uuid = &after_eq[q3 + 1..q3 + 1 + q4];
|
|
102
|
+
return Some(uuid.to_string());
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Universal fallback: hostname + OS. Not unique across clones, but stable
|
|
113
|
+
// across reboots and sufficient for a dev machine where the primary source
|
|
114
|
+
// failed for some reason.
|
|
115
|
+
let host = hostname::get().ok().and_then(|h| h.into_string().ok())?;
|
|
116
|
+
Some(format!(
|
|
117
|
+
"{}:{}:{}",
|
|
118
|
+
host,
|
|
119
|
+
std::env::consts::OS,
|
|
120
|
+
std::env::consts::ARCH
|
|
121
|
+
))
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/// Thin wrapper — hostname detection without pulling in a crate.
|
|
125
|
+
/// Windows: COMPUTERNAME env (always set). Unix: /proc/sys/kernel/hostname
|
|
126
|
+
/// or /etc/hostname. Fallback: "unknown".
|
|
127
|
+
mod hostname {
|
|
128
|
+
use std::ffi::OsString;
|
|
129
|
+
|
|
130
|
+
pub fn get() -> std::io::Result<OsString> {
|
|
131
|
+
#[cfg(windows)]
|
|
132
|
+
{
|
|
133
|
+
std::env::var("COMPUTERNAME")
|
|
134
|
+
.map(OsString::from)
|
|
135
|
+
.map_err(|_| std::io::Error::new(std::io::ErrorKind::NotFound, "COMPUTERNAME"))
|
|
136
|
+
}
|
|
137
|
+
#[cfg(unix)]
|
|
138
|
+
{
|
|
139
|
+
for path in ["/proc/sys/kernel/hostname", "/etc/hostname"] {
|
|
140
|
+
if let Ok(s) = std::fs::read_to_string(path) {
|
|
141
|
+
let trimmed = s.trim().to_string();
|
|
142
|
+
if !trimmed.is_empty() {
|
|
143
|
+
return Ok(OsString::from(trimmed));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
Err(std::io::Error::new(
|
|
148
|
+
std::io::ErrorKind::NotFound,
|
|
149
|
+
"hostname files",
|
|
150
|
+
))
|
|
151
|
+
}
|
|
152
|
+
#[cfg(not(any(windows, unix)))]
|
|
153
|
+
{
|
|
154
|
+
Err(std::io::Error::new(
|
|
155
|
+
std::io::ErrorKind::Unsupported,
|
|
156
|
+
"unsupported platform",
|
|
157
|
+
))
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|