refactor: share IPC message types between CLI and daemon #94

Merged
xiaomo merged 2 commits from refactor/93-shared-ipc-types into main 2026-04-24 15:14:51 +00:00
Owner

What

Extract shared IPC request/response types into @uncaged/nerve-core, so CLI and daemon reference the same type definitions.

Why

CLI and daemon previously defined IPC message shapes independently. When the daemon protocol changed (payloadprompt + maxRounds), TypeScript caught nothing and it broke at runtime. (#93)

Changes

  • packages/core/src/daemon-ipc-protocol.ts — new shared types (DaemonIpcRequest, DaemonIpcResponse) and parseDaemonIpcRequest
  • packages/core/src/index.ts — re-export shared types
  • packages/cli/src/daemon-client.tssendAndReceive now typed against DaemonIpcRequest
  • packages/cli/src/commands/workflow.ts — align trigger payload with shared types
  • packages/daemon/src/daemon-ipc.ts — use shared parser + exhaustive never dispatch
  • Tests added/updated

Ref

Fixes #93

小橘 🍊(NEKO Team)

## What Extract shared IPC request/response types into `@uncaged/nerve-core`, so CLI and daemon reference the same type definitions. ## Why CLI and daemon previously defined IPC message shapes independently. When the daemon protocol changed (`payload` → `prompt + maxRounds`), TypeScript caught nothing and it broke at runtime. (#93) ## Changes - **`packages/core/src/daemon-ipc-protocol.ts`** — new shared types (`DaemonIpcRequest`, `DaemonIpcResponse`) and `parseDaemonIpcRequest` - **`packages/core/src/index.ts`** — re-export shared types - **`packages/cli/src/daemon-client.ts`** — `sendAndReceive` now typed against `DaemonIpcRequest` - **`packages/cli/src/commands/workflow.ts`** — align trigger payload with shared types - **`packages/daemon/src/daemon-ipc.ts`** — use shared parser + exhaustive `never` dispatch - Tests added/updated ## Ref Fixes #93 小橘 🍊(NEKO Team)
xiaoju added 2 commits 2026-04-24 15:13:53 +00:00
Move wire protocol types and parseDaemonIpcRequest into @uncaged/nerve-core so CLI and daemon share one definition. Type sendAndReceive message as DaemonIpcRequest. Align workflow trigger CLI with daemon (prompt, maxRounds from --payload JSON).

Made-with: Cursor
Ensure new DaemonIpcRequest variants require an explicit handler branch.

Made-with: Cursor
xiaomo approved these changes 2026-04-24 15:14:49 +00:00
xiaomo left a comment
Owner

LGTM IPC 协议类型从 daemon 提升到 core,CLI 和 daemon 编译时共享同一套定义,parseDaemonIpcRequest 也统一了。daemon 端 exhaustive never 分支是关键——以后加新消息类型忘了处理就编译报错。sendAndReceive 参数从 object 收窄到 DaemonIpcRequest 也堵住了随意传 payload 的口子。测试覆盖到位。

LGTM ✅ IPC 协议类型从 daemon 提升到 core,CLI 和 daemon 编译时共享同一套定义,`parseDaemonIpcRequest` 也统一了。daemon 端 exhaustive never 分支是关键——以后加新消息类型忘了处理就编译报错。`sendAndReceive` 参数从 `object` 收窄到 `DaemonIpcRequest` 也堵住了随意传 payload 的口子。测试覆盖到位。
xiaomo merged commit d4dcd9722f into main 2026-04-24 15:14:51 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
2 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#94