refactor: share IPC message types between CLI and daemon #94
Reference in New Issue
Block a user
Delete Branch "refactor/93-shared-ipc-types"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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) andparseDaemonIpcRequestpackages/core/src/index.ts— re-export shared typespackages/cli/src/daemon-client.ts—sendAndReceivenow typed againstDaemonIpcRequestpackages/cli/src/commands/workflow.ts— align trigger payload with shared typespackages/daemon/src/daemon-ipc.ts— use shared parser + exhaustiveneverdispatchRef
Fixes #93
小橘 🍊(NEKO Team)
LGTM ✅ IPC 协议类型从 daemon 提升到 core,CLI 和 daemon 编译时共享同一套定义,
parseDaemonIpcRequest也统一了。daemon 端 exhaustive never 分支是关键——以后加新消息类型忘了处理就编译报错。sendAndReceive参数从object收窄到DaemonIpcRequest也堵住了随意传 payload 的口子。测试覆盖到位。