feat: workflow exit codes & kill mechanism
- Add exit_code to workflow_runs (0=success, 1=role error, 2=maxRounds, 137=killed, 255=crash) - Expand status enum: started/completed/failed/killed - Add kill-thread IPC message for graceful workflow termination - Add 'nerve workflow kill <runId>' CLI command - Show exit_code in 'nerve workflow list' output Fixes #121
This commit is contained in:
@@ -27,11 +27,18 @@ export type DaemonIpcListSensesRequest = {
|
||||
type: "list-senses";
|
||||
};
|
||||
|
||||
/** Client → daemon: kill a running or queued workflow thread by runId. */
|
||||
export type DaemonIpcKillWorkflowRequest = {
|
||||
type: "kill-workflow";
|
||||
runId: string;
|
||||
};
|
||||
|
||||
/** Union of all JSON requests the daemon IPC server accepts. */
|
||||
export type DaemonIpcRequest =
|
||||
| DaemonIpcTriggerWorkflowRequest
|
||||
| DaemonIpcTriggerSenseRequest
|
||||
| DaemonIpcListSensesRequest;
|
||||
| DaemonIpcListSensesRequest
|
||||
| DaemonIpcKillWorkflowRequest;
|
||||
|
||||
/** Successful trigger / trigger-sense reply (no body). */
|
||||
export type DaemonIpcTriggerOkResponse = { ok: true };
|
||||
@@ -87,6 +94,10 @@ export function parseDaemonIpcRequest(line: string): DaemonIpcRequest | null {
|
||||
if (req.type === "list-senses") {
|
||||
return { type: "list-senses" };
|
||||
}
|
||||
if (req.type === "kill-workflow") {
|
||||
if (typeof req.runId !== "string" || req.runId.length === 0) return null;
|
||||
return { type: "kill-workflow", runId: req.runId };
|
||||
}
|
||||
return null;
|
||||
} catch {
|
||||
return null;
|
||||
|
||||
@@ -38,6 +38,7 @@ export type {
|
||||
DaemonIpcTriggerWorkflowRequest,
|
||||
DaemonIpcTriggerSenseRequest,
|
||||
DaemonIpcListSensesRequest,
|
||||
DaemonIpcKillWorkflowRequest,
|
||||
DaemonIpcRequest,
|
||||
DaemonIpcTriggerOkResponse,
|
||||
DaemonIpcErrorResponse,
|
||||
|
||||
Reference in New Issue
Block a user