raminga

module
v0.1.0-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: Apache-2.0

README

Raminga

Decentralized, node-first P2P social network.

Raminga 以独立 Raminga Node 为基础单位。节点可以发布内容、维护关系并提供结构化档案;获得授权的客户端或 AI Agent 可以操作节点,但 AI、DSH 和内置智能体都不是节点运行的前提。长期目标是开放、可独立实现的网络协议。

当前状态(2026-11-12): Go 节点已实现并通过 G1–G4.5.1 的本地/Docker 验收;G6 已删除退役的 TypeScript 节点、Node workspace、旧脚本/测试、PoC 与历史 M1–M5/Phase 文档。G5 的 Claude/Codex/DSH 插件外壳已实现并做过部分真实宿主验证,发布流水线已实现,尚未首发;签名和预发布安装冒烟尚未完成。真实公网 M6-D 在 IPv6 有状态防火墙场景 PASS 一次;IPv4 NAT 打洞与 M6-R 计数仍 NOT_TESTED(Docker 不等于公网);TCP 双 NAT direct 通常 BLOCKED(Docker 偶见 simultaneous-open,非确定性)。

快速开始

取得对应平台的归档(根目录自带 install.sh / install.ps1):

tar xzf raminga_<os>_<arch>.tar.gz
cd raminga_<os>_<arch>
sh ./install.sh
raminga

Windows PowerShell:

Expand-Archive -Path .\raminga_<os>_<arch>.zip -DestinationPath .\raminga-dist
cd .\raminga-dist\raminga_<os>_<arch>
powershell -ExecutionPolicy Bypass -File .\install.ps1
raminga

不带子命令的 raminga 在终端里会确保该数据目录的 daemon 在后台运行,然后打开 TUI;在管道里只打印帮助。停止、重启、升级:

raminga stop
raminga restart          # 切换到刚安装的新版本

systemd 服务器用 sudo ./install.sh --service;由 systemd 管理时请用 sudo systemctl stop|restart raminga,CLI 会拒绝直接操作。自动启动的日志在 <data-dir>/daemon.log(0600,超过 10 MiB 轮转)。

默认数据目录是 $RAMINGA_DATA_DIR,否则 ~/.raminga;--data-dir 仍可覆盖。完整的平台选择、校验、--prefix、服务安装、自定义数据目录迁移、源码构建与故障排查见 docs/install.md。

开始开发

要求 Go 1.27。go.mod 在仓库根(module github.com/Raminga/raminga)。

make check      # vet/lint/buf lint/单测/fuzz 种子
make install-test # install.sh --service 的 Linux 容器隔离测试(stub systemctl)
make test       # 单测/集成
make e2e-g1     # G1 Docker:LAN 直连聊天/重启/单实例/API 边界
make e2e-g2     # G2 Docker:双 NAT QUIC direct/Relay 故障切换/DHT/配额/单侧/PeerStore
make e2e-g3     # G3:Go Docker e2e(IPv6/单侧/协议封锁/netem/对称 NAT/双 NAT/ipv6fw)
make e2e        # G1 + G2 + G3
make e2e-g4     # G4 安全/稳定性
make lab-up LAB=dualnat   # 手动 lab;详见 docs/manual-lab.md
make interactive-tui-test # 真实 pty 驱动 TUI

raminga tui 是单屏 slash-command 测试面板,只通过本地 UDS Connect API 操作 daemon;TUI 退出不停止节点。节点不要求 Go/Node 环境变量;Docker 只是受控模拟。

架构

路径 边界
cmd/raminga/ daemon + CLI 入口
internal/{identity,storage,network,protocol,node,profile,social,api,config,tui}/ 模块化单体;node 编排,network 持有 go-libp2p
api/ 本地 API 的 .proto(语言中立,buf 管理)
spec/ 跨节点 wire 的 .proto 与语言无关测试向量
tests/e2e/ Go e2e runner、手动 lab 与默认证据输出目录(不提交证据)
plugins/dsh/ TypeScript DSH 薄插件(connect-es,own package.json)

进程模型: raminga daemon 是节点状态唯一来源;不带子命令的 raminga 只负责确保 daemon 已运行并打开 TUI,raminga stop/restart 通过本地 Shutdown RPC 生命周期,raminga chat/status/... 与 TUI 都是本地 API 客户端;测试 harness 通过同一 API 驱动 daemon,不直接打开 go-libp2p 或复制 PeerStore。

本地 API: Connect-RPC(connect-go)over Unix domain socket,api/*.proto 由 buf 管理;token + 0600;server-streaming 事件;测试专用操作在显式 flag 后且默认关闭;不监听网络端口。

数据目录: identity/(libp2p protobuf Ed25519)、raminga.db(SQLite,纯 Go 驱动;业务数据 + bootstrap cache/known peers/pinned relays/peer names)、config.toml、本地 API socket/token(0600)。PeerStore 运行时在内存,重启后经 DHT 重新发现。

分发(G5,发布流水线已实现,尚未首发): 单静态二进制(CGO_ENABLED=0)覆盖 darwin/linux/windows 的 arm64/amd64;DSH 插件经 npm optionalDependencies 携带平台二进制。安装与插件说明见 docs/install.md。

协议与第三方接入(目标能力)

  • 本地 API: UDS + Connect-RPC + api/*.proto;第三方客户端无需导入 TypeScript 包。
  • 跨节点 wire: HTTP over libp2p /raminga/http/1.0.0,POST /chat JSON;契约与向量见 spec/chat-http-v1.md 与 spec/chat-http-v1-vectors.json。
  • 无需官方准入: 符合协议的节点不应被要求注册官方账号、申请官方 API Key、使用唯一官方引导节点或取得运营商批准。各节点自主决定连接、限流、可见性及授权。
  • 仍处于 Experimental 阶段: Relay、DCUtR 与恢复的主要证据来自 Docker 受控测试;真实公网只有一次 IPv6 有状态防火墙打洞证据,IPv4 NAT、Raminga DHT 的公网行为、正式 E2EE/授权尚未验收。M6-R 与 IPv4 NAT M6-D 保持 NOT_TESTED,不能用 Docker 结果冒充公网 PASS。

文档与开发

从 文档索引 按需查阅;参与开发见 CONTRIBUTING.md。

本地开发笔记可存于忽略提交的 .local/;节点运行数据位于 .raminga/。测试结果按 PASS/FAIL/BLOCKED/NOT_TESTED 如实记录,证据默认写到忽略提交的 tests/e2e/evidence/。

License

Apache-2.0。

Directories

Path Synopsis
Package agent embeds the single-source Raminga Agent content tree (agent/) into the binary.
Package agent embeds the single-source Raminga Agent content tree (agent/) into the binary.
cmd
raminga command
gen
raminga/api/v1/apiv1connect
Package raminga.api.v1 is the local, language-neutral Raminga node API.
Package raminga.api.v1 is the local, language-neutral Raminga node API.
internal
api
Package api implements the local Connect-RPC API.
Package api implements the local Connect-RPC API.
api/client
Package client is a Connect-RPC client for the local Raminga API.
Package client is a Connect-RPC client for the local Raminga API.
api/endpoint
Package endpoint reads and writes the protected local-TCP API discovery document.
Package endpoint reads and writes the protected local-TCP API discovery document.
api/paths
Package paths centralizes the local API file names so the server and the CLI client agree without the client importing the server package (which would pull node internals into the thin client).
Package paths centralizes the local API file names so the server and the CLI client agree without the client importing the server package (which would pull node internals into the thin client).
config
Package config loads and validates <dataDir>/config.toml.
Package config loads and validates <dataDir>/config.toml.
content
Package content owns the public directory scanner, manifest and safe file access.
Package content owns the public directory scanner, manifest and safe file access.
identity
Package identity owns the new libp2p Ed25519 identity, the logical Raminga node ID and the per-data-directory single-instance lock.
Package identity owns the new libp2p Ed25519 identity, the logical Raminga node ID and the per-data-directory single-instance lock.
mcp
Package mcp exposes the local Raminga API as a stdio MCP server (the `raminga mcp` subcommand).
Package mcp exposes the local Raminga API as a stdio MCP server (the `raminga mcp` subcommand).
network
Package network owns the go-libp2p host and the G2 network capabilities: TCP/QUIC transports, Circuit Relay v2 client/service, DCUtR, AutoNAT v2, the independent Raminga Kademlia DHT, AutoRelay, an in-memory PeerStore with a bounded SQLite hint cache, and resource limits.
Package network owns the go-libp2p host and the G2 network capabilities: TCP/QUIC transports, Circuit Relay v2 client/service, DCUtR, AutoNAT v2, the independent Raminga Kademlia DHT, AutoRelay, an in-memory PeerStore with a bounded SQLite hint cache, and resource limits.
node
Package node orchestrates identity, config, storage, network and protocol.
Package node orchestrates identity, config, storage, network and protocol.
p2phttp
Package p2phttp implements Raminga HTTP over libp2p streams using net/http and gostream.
Package p2phttp implements Raminga HTTP over libp2p streams using net/http and gostream.
peerarg
Package peerarg normalizes user-supplied Peer IDs and multiaddrs.
Package peerarg normalizes user-supplied Peer IDs and multiaddrs.
profile
Package profile is a G1 placeholder for node profile views and visibility.
Package profile is a G1 placeholder for node profile views and visibility.
protocol
Package protocol owns the cross-node chat contract: strict JSON over the Raminga HTTP-over-libp2p transport.
Package protocol owns the cross-node chat contract: strict JSON over the Raminga HTTP-over-libp2p transport.
report
Package report builds the redacted Raminga test report used by the TUI and by `raminga report export`.
Package report builds the redacted Raminga test report used by the TUI and by `raminga report export`.
social
Package social is a G1 placeholder for publish, relationship and interaction rules.
Package social is a G1 placeholder for publish, relationship and interaction rules.
storage
Package storage owns the SQLite business database.
Package storage owns the SQLite business database.
textsafe
Package textsafe renders untrusted remote text for a terminal.
Package textsafe renders untrusted remote text for a terminal.
tui
Package tui implements the Raminga terminal test panel: inline output in the terminal's normal scrollback plus a small live region (status, input and completion popup).
Package tui implements the Raminga terminal test panel: inline output in the terminal's normal scrollback plus a small live region (status, input and completion popup).
tuiinit
Package tuiinit bounds Bubble Tea v1's terminal-status probe.
Package tuiinit bounds Bubble Tea v1's terminal-status probe.
untrusted
Package untrusted defines the one envelope and injection-signal policy used for every remote-content tool result.
Package untrusted defines the one envelope and injection-signal policy used for every remote-content tool result.
scripts
genplugins command
Command genplugins renders the single-source Raminga Agent content (agent/) and the repository-root VERSION into each host plugin shell, marketplace manifest and the CLI's fallback version, then verifies the committed output matches.
Command genplugins renders the single-source Raminga Agent content (agent/) and the repository-root VERSION into each host plugin shell, marketplace manifest and the CLI's fallback version, then verifies the committed output matches.
npmdist command
Command npmdist stages the npm release artifacts from a GoReleaser dist directory and the repository-root VERSION file.
Command npmdist stages the npm release artifacts from a GoReleaser dist directory and the repository-root VERSION file.
tests
e2e command
Command e2e is the unified entry point for the G1, G2 and G3 Docker suites.
Command e2e is the unified entry point for the G1, G2 and G3 Docker suites.
e2e/evsummary command
Command evsummary converts legacy raw e2e evidence to the compact committed summary format.
Command evsummary converts legacy raw e2e evidence to the compact committed summary format.
e2e/g1 command
Command g1 runs the G1 Docker acceptance scenarios, writes evidence JSON and exits non-zero on any failure.
Command g1 runs the G1 Docker acceptance scenarios, writes evidence JSON and exits non-zero on any failure.
e2e/g2 command
Command g2 runs the G2 Docker acceptance scenarios.
Command g2 runs the G2 Docker acceptance scenarios.
e2e/g3 command
Command g3 runs the G3 Docker test-infrastructure acceptance suite.
Command g3 runs the G3 Docker test-infrastructure acceptance suite.
e2e/g4 command
Command g4 runs the G4 security and stability acceptance suite.
Command g4 runs the G4 security and stability acceptance suite.
e2e/g4/attacker command
Command raminga-attacker is a TEST-ONLY malicious peer used by the G4 acceptance suite.
Command raminga-attacker is a TEST-ONLY malicious peer used by the G4 acceptance suite.
e2e/g45 command
Command g45 validates a TUI-exported test report for the G4.5 lab walkthrough.
Command g45 validates a TUI-exported test report for the G4.5 lab walkthrough.
e2e/internal/evidence
Package evidence converts verbose e2e output into compact committed summaries while keeping raw command output under .local/evidence.
Package evidence converts verbose e2e output into compact committed summaries while keeping raw command output under .local/evidence.
e2e/plugins command
Command e2e-plugins is the repeatable MCP smoke test for the plugin shells.
Command e2e-plugins is the repeatable MCP smoke test for the plugin shells.
e2e/tuipty
Package tuipty drives the real Raminga TUI binary through a pty.
Package tuipty drives the real Raminga TUI binary through a pty.
e2e/tuiwalk command
Command tuiwalk drives the real interactive TUI on a pty inside a lab container.
Command tuiwalk drives the real interactive TUI on a pty inside a lab container.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL