refactor(core): remove WorkflowTrigger from SenseTrigger — sense only triggers shell commands #318
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?
What
Remove
WorkflowTriggerfromSenseTriggerdiscriminated union. Senses should only trigger shell commands. Workflows are triggered via CLI (nerve workflow trigger ...), which is just another shell command.Why
Sense and workflow should be fully decoupled:
nerve workflow trigger restart-gateway --prompt "gateway down"This eliminates the coupling between sense types and workflow types in nerve-core.
Changes Required
packages/core/src/config.ts
WorkflowTriggertype (or move it to workflow-only scope)SenseTriggerbecomes just{ command: string }(no more discriminated union, nokindfield)ShellTriggerbut drop thekinddiscriminant since there is only one variantpackages/core/src/sense.ts
SenseComputeFnreturn:trigger: { command: string } | nullparseSenseTrigger— no longer needs to handle workflow kindpackages/daemon/src/kernel.ts
handleComputeResult— no morekind === "workflow"branchshell-launchvsworkflow-launchdistinction, just logtrigger-launchpackages/daemon/src/ipc.ts
ComputeResultMsg.triggerparsing — just validatecommandstringsense-workflow-triggerIPC message if it only existed for sense→workflow couplingpackages/daemon/src/sense-worker.ts
executeShellTriggerIfNeeded— no kind check neededTests
kind: "workflow"orkind: "shell"in sense triggersDocumentation
Breaking Change
SenseTriggerno longer supportskind: "workflow". Senses that previously triggered workflows directly must use shell command:nerve workflow trigger <name> --prompt "..."instead.小橘 🍊(NEKO Team)