- Add node store implementation for edge app - Add adapters factory for node app - Update edge and node transport layers - Update domain rules for edge and node - Add bin scripts for edge and node - Update configs and documentation - Add agent-task node_centralized_mgmt directory
69 lines
2.1 KiB
Markdown
69 lines
2.1 KiB
Markdown
# node — Node Agent
|
|
|
|
디바이스당 1개 실행되는 IOP 노드 에이전트.
|
|
실제 AI 모델 추론 어댑터를 관리하고, TCP + Protobuf + mTLS 소켓을 통해 요청을 처리한다.
|
|
|
|
## 내부 구조 (Hexagonal Architecture)
|
|
|
|
```
|
|
cmd/node/ — CLI 진입점 (cobra)
|
|
internal/
|
|
bootstrap/ — fx 의존성 주입 모듈
|
|
node/ — 핵심 노드 서비스 (transport.Handler 구현)
|
|
runtime/ — 도메인 타입: ExecutionSpec, RuntimeEvent, 인터페이스
|
|
router/ — RunRequest → ExecutionSpec 라우팅
|
|
transport/ — TCP 서버, 세션 관리, 프레임 코덱
|
|
adapters/
|
|
mock/ — 에코 테스트 어댑터
|
|
ollama/ — Ollama API 어댑터 (TODO)
|
|
vllm/ — vLLM OpenAI-compatible 어댑터 (TODO)
|
|
cli/ — CLI 프로세스 어댑터 (claude/gemini/codex/opencode)
|
|
store/ — SQLite 실행 이력
|
|
```
|
|
|
|
## 실행
|
|
|
|
```bash
|
|
# 빌드
|
|
go build -o bin/node ./apps/node/cmd/node
|
|
|
|
# 버전 확인
|
|
./bin/node version
|
|
|
|
# 설정 확인
|
|
./bin/node config print --config configs/node.yaml
|
|
|
|
# 서버 실행
|
|
./bin/node serve --config configs/node.yaml
|
|
```
|
|
|
|
원격 edge에 붙는 수동 테스트는 `configs/node.yaml`의 `transport.edge_addr`와 `transport.token`을 먼저 맞춘 뒤 repo root에서 실행한다.
|
|
|
|
```bash
|
|
./bin/node.sh
|
|
```
|
|
|
|
edge에서 실행 요청을 받으면 node 콘솔에는 받은 입력과 node가 돌려보내는 이벤트/응답이 분리되어 표시된다.
|
|
|
|
```text
|
|
[edge-message] hello
|
|
[node-event] start run_id=manual-...
|
|
[node-event] complete run_id=manual-... detail="mock execution complete"
|
|
[node-message] echo: hello
|
|
```
|
|
|
|
## 어댑터
|
|
|
|
| 어댑터 | 설명 | 상태 |
|
|
|---|---|---|
|
|
| `mock` | 입력 에코, 스트리밍 테스트용 | 구현 완료 |
|
|
| `ollama` | 로컬 Ollama 서버 연동 | TODO |
|
|
| `vllm` | vLLM OpenAI-compatible API | TODO |
|
|
| `cli` | claude/gemini/codex/opencode CLI 실행 | 구현 완료 |
|
|
|
|
## Transport
|
|
|
|
- TCP 4-byte length-prefix framing
|
|
- JSON-encoded Envelope (TODO: protobuf 교체)
|
|
- mTLS (configs/node.yaml에서 활성화)
|
|
- 하트비트: 30초 간격
|