feat(ipc): port 3g IPC + bgbash — framed Unix-socket server/client + background job registry, wire bash tools

This commit is contained in:
asepharyana
2026-09-02 22:50:38 +07:00
parent fd58b4661f
commit 4b4730cff7
12 changed files with 523 additions and 32 deletions
+8 -7
View File
@@ -3,7 +3,7 @@
> Plan lengkap migrasi in-place dari Rust (11 crate, clean architecture 4 lapis) ke monorepo
> TypeScript/Bun. Bahasa Indonesia, commit pakai Conventional Commits.
>
> **Status:** Fase 0–2 + 3a + 3b + 3e + 3c + 3d + 3f **selesai**. Berikutnya: **3g IPC + bgbash**.
> **Status:** Fase 0–2 + 3a + 3b + 3e + 3c + 3d + 3f + 3g **selesai**. Berikutnya: **4 gateway + CLI + TUI**.
> Base: `bun run check` bersih, 54 test hijau.
---
@@ -136,12 +136,13 @@ apps/
### Fase 3g — IPC + bgbash
**Sumber Rust:** `apps/infrastructure/src/ipc/{frame,protocol,server,client,conn}.rs`, `apps/infrastructure/src/bgbash/{job,control}.rs`
- [ ] `ipc/frame.ts` — length-prefixed framing via `node:net` (kirim/terima bingkai biner)
- [ ] `ipc/server.ts` + `ipc/client.ts` — Unix socket server + attach client; protocol message (NLJSON/binary)
- [ ] `bgbash/job.ts` — `BashJob` (pid, output file, log), `spawn_bash_job`
- [ ] `bgbash/control.ts` — registry job global: `register`, `cancel(job_id)`, `is_running`
- [ ] Wire `bash` tool `run_in_background` → `spawn_bash_job` + `register`; `bash_kill` → `cancel`
- [ ] Update `bash_output` untuk baca dari registry/output dir
- [x] `ipc/frame.ts` — length-prefixed framing via `node:net` (kirim/terima bingkai biner)
- [x] `ipc/conn.ts` — `Connection` framed JSON socket; `ipc/protocol.ts` — wire types
- [x] `ipc/server.ts` + `ipc/client.ts` — Unix socket server + attach client; protocol message (NLJSON/binary)
- [x] `bgbash/job.ts` — `BashJob` (pid, output file, log), `spawnBashJob`
- [x] `bgbash/control.ts` — registry job global: `register`, `cancel(job_id)`, `is_running`
- [x] Wire `bash` tool `run_in_background` → `spawnBashJob` + `register`; `bash_kill` → `cancel`
- [x] Update `bash_output` untuk baca dari registry/output dir
### Fase 4 — Gateway + CLI + TUI
**Sumber Rust:** `apps/gateway/src/{lib,main}.rs`, `apps/interfaces/tui/src/**`