@clemrig/flow 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,7 +6,7 @@ A workflow is an explicit graph of **CODE** stages (your code), **AGENT** stages
6
6
 
7
7
  ## Requirements
8
8
 
9
- macOS or Linux, Node.js 24 or later. For agent stages, the `claude` CLI (2.1.296 or later), the `codex` CLI (0.160.1 or later, in a Git repository) or the `pi` CLI (1.1.0 or later) in the `PATH`, connected to its provider. Each agent runs with the machine's own configuration of its CLI, plus its profile's settings; a Claude Code call also waits for the agent's background work, its sub-agents included, however long it stays idle, within the profile's timeout (`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS=0`), where print mode would stop it after 10 minutes and drop its results. The engine never reads or stores credentials.
9
+ macOS or Linux, Node.js 24 or later. For agent stages, the `claude` CLI (2.1.296 or later), the `codex` CLI (0.160.1 or later, in a Git repository) or the `pi` CLI (1.1.0 or later) in the `PATH`, connected to its provider. Each agent runs with the machine's own configuration of its CLI, plus its profile's settings; a Claude Code call also waits for the agent's sub-agents, however long they stay idle, within the profile's timeout (`CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS=0`), where print mode would stop them after 10 minutes and drop their results. The agent's answer ends the call: Claude Code is stopped there, with any command the agent left running in the background, such as a dev server, and the stage's journal counts them. Each command of a Claude Code agent registers the process group it runs in, so that whatever it leaves running, detached with `&` or `nohup` included, ends with the call, whatever ends it: this needs a `ps` that lists processes with their group and start time (macOS's, or procps on Linux), checked before the run. The engine never reads or stores credentials.
10
10
 
11
11
  ## Run a workflow
12
12
 
@@ -45,7 +45,7 @@ console.log(state.status, state.data);
45
45
 
46
46
  A workflow may declare `steps`: ordered groups of its stages that show how far a run went, for instance `steps: [{ name: "greet", stages: ["greet"] }]`. `defineWorkflow` refuses steps unless they name each step once and hold each stage exactly once; the engine itself ignores them, and the factory's Kanban shows them.
47
47
 
48
- Before it creates the run, `startRun` checks, in this order, `dir` (an existing directory), the budget (`maxCostUsd`, in USD, replaces the workflow's; refused when an agent stage uses Codex, which announces no cost), the input against the workflow's `input` (an `InvalidInputError` lists every problem), the prompts (a non-empty text for each agent stage's prompt) and each runtime the workflow uses, its version and connection checked in `dir`; the first failing check rejects it with its reasons. It then records the launch (a `launch` event: flow's version, the `caller` labels given, such as a caller's version and where its prompts come from, each runtime as checked, the budget in force and whether it was given, the run's own or the workflow's, the machine, `dir`, and the names of the variables set that the runtimes read, never their values) and returns the run, its end (`done`) and `stop(reason)`, which fails the run before its next stage. Runs are kept in `runsDir` when it is given. The engine never changes the process's current directory: stage code reaches the working directory through `dir`, and the run's own folder through `runDir`, where it can keep files that belong to the run. While child processes run (agents, commands), a SIGINT or SIGTERM to the program interrupts them, each agent with the signal on which it ends its own commands, so that none outlives it, and stops each run before its next stage, even if a stage catches the interruption. A program about to quit at once can call `killChildProcesses()`, which kills the child processes of every run, but not the commands Codex runs in their own process groups.
48
+ Before it creates the run, `startRun` checks, in this order, `dir` (an existing directory), the budget (`maxCostUsd`, in USD, replaces the workflow's; refused when an agent stage uses Codex, which announces no cost), the input against the workflow's `input` (an `InvalidInputError` lists every problem), the prompts (a non-empty text for each agent stage's prompt) and each runtime the workflow uses, its version and connection checked in `dir`; the first failing check rejects it with its reasons. It then records the launch (a `launch` event: flow's version, the `caller` labels given, such as a caller's version and where its prompts come from, each runtime as checked, the budget in force and whether it was given, the run's own or the workflow's, the machine, `dir`, and the names of the variables set that the runtimes read, never their values) and returns the run, its end (`done`) and `stop(reason)`, which fails the run before its next stage. Runs are kept in `runsDir` when it is given. The engine never changes the process's current directory: stage code reaches the working directory through `dir`, and the run's own folder through `runDir`, where it can keep files that belong to the run. While child processes run (agents, commands), a SIGINT or SIGTERM to the program interrupts them, each agent with the signal on which it ends its own commands, so that none outlives it, and stops each run before its next stage, even if a stage catches the interruption. `runCommand(argv, { cwd, timeoutMs, signal, env, onLine, stdin, output })` is `runProcess`'s full form: `signal` stops the program, its process group included, without failing once it aborts, such as a server its caller no longer needs, which then needs no `timeoutMs`; `output` appends what the program writes, errors included, to a file instead of capturing it. A program about to quit at once can call `killChildProcesses()`, which kills the child processes of every run, but not the commands Codex runs in their own process groups.
49
49
 
50
50
  `resumeRun({ workflow, runId, maxCostUsd, data, prompts, dir, configDir, runsDir, caller }, hooks)` resumes a failed run at the stage where it stopped, with the same ID, input, data, corrections, measures and agent conversations: that stage runs again, journals why the run had stopped (`Resumed after: …`) and passes it on to its agent, which is asked to continue rather than start over. It refuses, changing nothing, a run that did not fail (a run left `running` after its process was killed included), a run of another workflow, a stage the workflow no longer has, a run that already spent its budget, and whatever the workflow's optional `resumeProblem({ state, dir })` returns, for instance a working directory that is no longer as the stage left it; then it checks prompts and runtimes like `startRun`, takes the run over (two resumptions never both run it: the state is reloaded and marked `running` under a `run.lock` file created atomically in the run's folder), records the launch with the values given, and returns the same handle. The budget is the `maxCostUsd` given, else the one the run was started or last resumed with (`state.maxCostUsd`), else the workflow's. The stage starts over: what it did before it failed must be safe to do again, or `resumeProblem` must refuse. `data` gives the run values decided by the operator, merged into its data before the stage runs again, seen by `resumeProblem` and named in the cause it journals. A run stopped by a retry edge past its maximum is allowed one more correction on that edge by each resumption (`state.allowances`; `exceededEdge(workflow, state)` names that edge, `<stage>.<outcome>`: `state.exceeded`, or for a run stopped before the engine kept it, the edge of its stage whose message its error is, if a single one is): the stage runs again and, if it asks for the correction again, takes it; the correction it could not take is kept in its failed stage event's `feedback`. Each finished stage event also carries its agent's answer (`output`) and the correction it sent back (`feedback`). Calls that announced no cost before the resumption (a call stopped by its timeout) no longer fail the budget; later ones do. The time a run spent stopped is not part of its duration (`state.pausedMs`, left out by `elapsedMs`).
51
51
 
@@ -53,7 +53,7 @@ The stages, gates, corrections, agent profiles, sessions and prompts are describ
53
53
 
54
54
  ## Runs
55
55
 
56
- Each run keeps `state.json`, `events.jsonl` and, for each agent call, a record in `calls/<n>.json` (the workflow's prompt, the request as the runtime read it, the command with the prompt and the MCP servers' configuration replaced by what names them, the configuration the session confirmed when its runtime announces one, the end of a successful call's error output, and the agent's final text) in its own folder of `runsDir`, by default `.flow/runs/` of `dir`. When the engine creates `.flow/`, it writes a `.gitignore` that ignores everything in it: runs hold inputs, agent outputs and the journal, and stay private. `listRuns(runsDir)`, `loadRun(runsDir, id)`, `loadRunEvents(runsDir, id)`, `loadAgentCall(runsDir, id, n)`, `summarizeRun(state)`, `summarizeCorrections(state, events)` (each retry edge taken, with the maximum its events recorded) and `presentResult(workflow, state)` (any object with a `presentResult` in place of the workflow; without one, the validated data as JSON) read them; `flow-ui` shows them.
56
+ Each run keeps `state.json`, `events.jsonl` and, for each agent call, a record in `calls/<n>.json` (the workflow's prompt, the request as the runtime read it, the command with the prompt and the MCP servers' configuration replaced by what names them and the names of the variables the request added (`env`), never their values, the configuration the session confirmed when its runtime announces one, the end of a successful call's error output, and the agent's final text) in its own folder of `runsDir`, by default `.flow/runs/` of `dir`. When the engine creates `.flow/`, it writes a `.gitignore` that ignores everything in it: runs hold inputs, agent outputs and the journal, and stay private. `listRuns(runsDir)`, `loadRun(runsDir, id)`, `loadRunEvents(runsDir, id)`, `loadAgentCall(runsDir, id, n)`, `summarizeRun(state)`, `summarizeCorrections(state, events)` (each retry edge taken, with the maximum its events recorded) and `presentResult(workflow, state)` (any object with a `presentResult` in place of the workflow; without one, the validated data as JSON) read them; `flow-ui` shows them.
57
57
 
58
58
  ## License
59
59
 
package/dist/app/run.js CHANGED
@@ -48,9 +48,9 @@ function budgetFrom(usd, given, own) {
48
48
  }
49
49
  /**
50
50
  * Saves the run, records its launch, then executes it from its current stage.
51
- * The run fails once its budget is exceeded, or once a call announced no cost;
52
- * calls without a cost recorded before it executes, by an earlier execution,
53
- * do not count.
51
+ * No agent call starts once its budget is exceeded, or once a call announced
52
+ * no cost: the run fails at that call's stage. Calls without a cost recorded
53
+ * before it executes, by an earlier execution, do not count.
54
54
  */
55
55
  async function execute(state, store, setup, checked, hooks, resumed) {
56
56
  const { workflow, dir, configDir } = setup;
@@ -101,30 +101,21 @@ async function execute(state, store, setup, checked, hooks, resumed) {
101
101
  const accepted = state.metrics?.usage.missing ?? 0;
102
102
  const controller = new AbortController();
103
103
  /**
104
- * Past its budget, the run stops: the abort fails it at its next stage
105
- * boundary even if workflow code catches the error, and no call starts.
104
+ * Checked before each agent call, on the figures the runtimes announced: past
105
+ * the budget, the call does not start, and the abort stops the run at its
106
+ * next stage boundary even if workflow code catches the refusal. A call that
107
+ * exceeds the budget keeps its answer, already paid for.
106
108
  */
107
- const overBudget = () => {
108
- const problem = maxCostUsd === undefined || !state.metrics
109
- ? undefined
110
- : budgetProblem(state.metrics, maxCostUsd, accepted);
111
- if (problem)
112
- controller.abort(new Error(problem));
113
- return problem;
114
- };
115
- // Checked before each agent call and after it, failed or not, on the figures its runtime announced.
116
109
  const budgeted = {
117
110
  async execute(request, record) {
118
- const refused = overBudget();
119
- if (refused)
111
+ const refused = maxCostUsd === undefined || !state.metrics
112
+ ? undefined
113
+ : budgetProblem(state.metrics, maxCostUsd, accepted);
114
+ if (refused) {
115
+ controller.abort(new Error(refused));
120
116
  throw new Error(refused);
121
- const value = await agent
122
- .execute(request, record)
123
- .finally(() => overBudget());
124
- const exceeded = overBudget();
125
- if (exceeded)
126
- throw new Error(exceeded);
127
- return value;
117
+ }
118
+ return agent.execute(request, record);
128
119
  },
129
120
  };
130
121
  // The signal that interrupts its processes also stops the run, even if a stage catches the interruption.
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/app/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAQpE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,O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CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACnC,IAAI,QAAQ;YACV,OAAO,CAAC,UAAU,GAAG;gBACnB,GAAG,OAAO,CAAC,UAAU;gBACrB,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;aACtD,CAAC;QACJ,OAAO,OAAO,CAAC,KAAK,CAAC;QACrB,OAAO,OAAO,CAAC,QAAQ,CAAC;QACxB,OAAO,CAAC,SAAS,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACtC,OAAO,CAAC,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACpD,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1B,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CACZ,KAAK,EACL,KAAK,EACL,KAAK,EACL;QACE,GAAG,OAAO;QACV,UAAU;QACV,MAAM,EAAE,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC;KACnE,EACD,KAAK,EACL,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAC/B,CAAC;AACJ,CAAC"}
@@ -14,6 +14,12 @@ export interface AgentRequest {
14
14
  schema: Record<string, unknown>;
15
15
  /** Why the run had stopped, on the requests of the stage a resumed run starts again with. */
16
16
  resumedAfter?: string;
17
+ /**
18
+ * Variables added to the agent's environment for this call, such as those
19
+ * of the application it uses; the runtime's own, which flow sets, prevail.
20
+ * The call's record keeps their names only: a value can be a secret.
21
+ */
22
+ env?: Record<string, string>;
17
23
  }
18
24
  /** Adds a message to the run journal (`events.jsonl`), with optional data. */
19
25
  export type Log = (message: string, data?: Record<string, unknown>) => void;
@@ -85,10 +91,12 @@ export type AgentActivity = {
85
91
  };
86
92
  /**
87
93
  * A subscription limit, tools the runtime refused, a request it sent again, a
88
- * conversation it compacted, the models the call used, or what a successful
89
- * call wrote on its error output.
94
+ * conversation it compacted, the models the call used, what a successful call
95
+ * wrote on its error output, the background commands stopped with the call
96
+ * once the agent had answered, or the processes the agent's commands left
97
+ * running, stopped with the call.
90
98
  */
91
- export type NoticeKind = "limit" | "denied" | "retry" | "compaction" | "models" | "stderr";
99
+ export type NoticeKind = "limit" | "denied" | "retry" | "compaction" | "models" | "stderr" | "background" | "leftover";
92
100
  /**
93
101
  * What flow sent an agent in one call, and the agent's final text: kept beside
94
102
  * the journal, one file per call, so that the journal stays light.
@@ -104,12 +112,14 @@ export interface AgentCallRecord {
104
112
  /**
105
113
  * How flow launched the runtime: the executable's name, its arguments with
106
114
  * the workflow's prompt, the MCP servers' configuration and the machine's
107
- * paths replaced by what names them, and the variables flow added.
115
+ * paths replaced by what names them, the variables flow added, and the
116
+ * names of those the request gave.
108
117
  */
109
118
  command: {
110
119
  executable: string;
111
120
  args: string[];
112
121
  env: Record<string, string>;
122
+ given?: string[];
113
123
  };
114
124
  /** The agent's final text, before the engine reads it; absent from a call that ended without one. */
115
125
  answer?: string;
package/dist/index.d.ts CHANGED
@@ -12,6 +12,6 @@ export { agent, type Check, code, END, gate, node, pick, retry, schemaGate, step
12
12
  export { type AgentProfile, type AgentSettings, profileProblems, type Runtime, runtimeLabels, } from "./engine/profiles.js";
13
13
  export type { AgentActivity, AgentCallRecord, AgentStage, LaunchEvent, Log, RunEvent, RunState, Stage, StageContext, StageEvent, StageResult, Workflow, WorkflowDefinition, WorkflowStep, } from "./engine/types.js";
14
14
  export { defineWorkflow, type InputProblem, InvalidInputError, isWorkflow, parseInput, } from "./engine/workflow.js";
15
- export { killChildProcesses, ProcessInterruptedError, ProcessTimeoutError, runProcess, } from "./system/process.js";
15
+ export { killChildProcesses, type ProcessOptions, ProcessInterruptedError, type ProcessResult, ProcessTimeoutError, runCommand, runProcess, } from "./system/process.js";
16
16
  export { type AgentProblem, inspectNode, inspectRuntimes, type RuntimeStatus, } from "./system/runtimes/inspect.js";
17
17
  export { defaultRunsDir, UnknownRunError } from "./system/store.js";
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ export { exceededEdge } from "./engine/runner.js";
11
11
  export { agent, code, END, gate, node, pick, retry, schemaGate, step, } from "./engine/primitives.js";
12
12
  export { profileProblems, runtimeLabels, } from "./engine/profiles.js";
13
13
  export { defineWorkflow, InvalidInputError, isWorkflow, parseInput, } from "./engine/workflow.js";
14
- export { killChildProcesses, ProcessInterruptedError, ProcessTimeoutError, runProcess, } from "./system/process.js";
14
+ export { killChildProcesses, ProcessInterruptedError, ProcessTimeoutError, runCommand, runProcess, } from "./system/process.js";
15
15
  export { inspectNode, inspectRuntimes, } from "./system/runtimes/inspect.js";
16
16
  export { defaultRunsDir, UnknownRunError } from "./system/store.js";
17
17
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAIL,SAAS,EAET,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,QAAQ,EACR,aAAa,EACb,OAAO,EACP,aAAa,EACb,aAAa,EAEb,oBAAoB,EACpB,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,SAAS,GAEV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,KAAK,EAEL,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,UAAU,EACV,IAAI,GACL,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,eAAe,EAEf,aAAa,GACd,MAAM,sBAAsB,CAAC;AAiB9B,OAAO,EACL,cAAc,EAEd,iBAAiB,EACjB,UAAU,EACV,UAAU,GACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,UAAU,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,WAAW,EACX,eAAe,GAEhB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAIL,SAAS,EAET,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,QAAQ,EACR,aAAa,EACb,OAAO,EACP,aAAa,EACb,aAAa,EAEb,oBAAoB,EACpB,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,SAAS,GAEV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,KAAK,EAEL,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,UAAU,EACV,IAAI,GACL,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,eAAe,EAEf,aAAa,GACd,MAAM,sBAAsB,CAAC;AAiB9B,OAAO,EACL,cAAc,EAEd,iBAAiB,EACjB,UAAU,EACV,UAAU,GACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kBAAkB,EAElB,uBAAuB,EAEvB,mBAAmB,EACnB,UAAU,EACV,UAAU,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,WAAW,EACX,eAAe,GAEhB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -23,22 +23,54 @@ export declare class ProcessTimeoutError extends Error {
23
23
  export declare function whenInterrupted(handler: (signal: NodeJS.Signals) => void): () => void;
24
24
  /**
25
25
  * Kills the process group of every child still running in this process, of
26
- * every run, at once: for a program about to quit.
26
+ * every run, and the groups their commands registered, at once: for a program
27
+ * about to quit.
27
28
  */
28
29
  export declare function killChildProcesses(): void;
30
+ /**
31
+ * Why this machine cannot end the groups a program's commands register, if it
32
+ * cannot: `ps` must list every process with its group and start, as that of
33
+ * macOS and that of procps on Linux do.
34
+ */
35
+ export declare function groupsProblem(): Promise<string | undefined>;
29
36
  export interface ProcessResult {
30
37
  exitCode: number;
31
38
  stdout: string;
32
39
  stderr: string;
33
40
  stdoutTruncated: boolean;
34
41
  stderrTruncated: boolean;
42
+ /** Stopped at its caller's request, once it had what was needed: its exit code is the stop's. */
43
+ stopped: boolean;
44
+ /** Processes still running in the groups the program's commands registered once it was done, stopped then. */
45
+ left: number;
35
46
  }
36
- export interface ProcessOptions {
37
- cwd: string;
47
+ /**
48
+ * How a program is bounded: by its timeout, or by its caller, whose signal
49
+ * stops it as `onLine`'s `"stop"` does once it aborts, such as a server the
50
+ * caller no longer needs; a program can have both.
51
+ */
52
+ type Bound = {
38
53
  timeoutMs: number;
39
- /** Each line of standard output, as it comes. */
40
- onLine?: (line: string) => void;
54
+ signal?: AbortSignal;
55
+ } | {
56
+ timeoutMs?: number;
57
+ signal: AbortSignal;
58
+ };
59
+ export type ProcessOptions = Bound & {
60
+ cwd: string;
61
+ /**
62
+ * Each line of standard output, as it comes. Returning `"stop"` once the
63
+ * program has given what was needed stops it as at its timeout, without
64
+ * failing; what it writes after is no longer read.
65
+ */
66
+ onLine?: (line: string) => unknown;
41
67
  stdin?: string;
68
+ /**
69
+ * A file the program's output and errors are appended to as it writes
70
+ * them, such as a server's log, instead of being captured: the result's
71
+ * are empty, and `onLine` reads nothing.
72
+ */
73
+ output?: string;
42
74
  /** Variables added to the environment the program inherits, replacing those of the same name. */
43
75
  env?: Record<string, string>;
44
76
  /**
@@ -46,12 +78,27 @@ export interface ProcessOptions {
46
78
  * sent to its group before SIGKILL; SIGTERM by default.
47
79
  */
48
80
  stopSignal?: NodeJS.Signals;
49
- }
50
- /** `runCommand` with its arguments in order: the form workflows use. */
81
+ /** How long the program may take to stop cleanly before its group is killed; a second by default. */
82
+ stopGraceMs?: number;
83
+ /**
84
+ * A file where the program's commands, each in a process group of its own,
85
+ * register it as they start: one `<group> <start, in epoch seconds>` line
86
+ * each. Those groups end with the program: what they still hold once it is
87
+ * done is stopped then, its own group's way, and counted in `left`.
88
+ */
89
+ groups?: string;
90
+ };
91
+ /**
92
+ * `runCommand` with its arguments in order: the form workflows use, whose line
93
+ * callback never stops the program.
94
+ */
51
95
  export declare function runProcess(command: string[], cwd: string, timeoutMs: number, onLine?: (line: string) => void, stdin?: string): Promise<ProcessResult>;
52
96
  /**
53
- * Runs an executable without a shell, in its own process group. A failure
54
- * terminates the entire group, with the program's stop signal then SIGKILL, and
55
- * settles only after the child closes and the grace period finishes.
97
+ * Runs an executable without a shell, in its own process group. A failure, or
98
+ * the caller's stop, terminates the entire group with the program's stop
99
+ * signal, then SIGKILL for what remains once the program's time to stop has
100
+ * passed, and settles once the child has closed and its group is gone, after
101
+ * ending the groups its commands registered.
56
102
  */
57
103
  export declare function runCommand(command: string[], options: ProcessOptions): Promise<ProcessResult>;
104
+ export {};