refactor: share IPC message types between CLI and daemon #93
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Problem
CLI (
daemon-client.ts) and daemon (ipc.ts/daemon-ipc.ts) each define their own IPC message shapes independently. ThesendAndReceivefunction acceptsmessage: objectwith no type constraint, so when the daemon protocol changes (e.g.payload→prompt + maxRounds), the CLI compiles fine but fails at runtime.This just caused a real bug: CLI was sending
{ type: 'trigger-workflow', workflow, payload }but daemon expected{ type: 'trigger-workflow', workflow, prompt, maxRounds }. TypeScript caught nothing.Solution
@uncaged/nerve-coreor exported from@uncaged/nerve-daemon)sendAndReceivemessage parameter against the shared union typeparseRequestand CLI'striggerWorkflowViaDaemonboth reference the same typeScope
packages/daemon/src/ipc.ts—StartThreadMessage,ResumeThreadMessage, etc.packages/daemon/src/daemon-ipc.ts—DaemonRequestparsingpackages/cli/src/daemon-client.ts—sendAndReceive,triggerWorkflowViaDaemon, etc.Ref
Fix for the immediate bug was done in CLI (changed
payload→prompt + maxRounds), but the structural problem remains.小橘 🍊(NEKO Team)