@clemrig/factory 0.12.0 → 0.14.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 +3 -3
- package/dist/app/run.js +3 -1
- package/dist/app/run.js.map +1 -1
- package/dist/cli/reporter.d.ts +3 -1
- package/dist/cli/reporter.js +19 -0
- package/dist/cli/reporter.js.map +1 -1
- package/dist/system/factory.d.ts +5 -0
- package/dist/system/factory.js +16 -1
- package/dist/system/factory.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -306,17 +306,17 @@ factory doctor [--json]
|
|
|
306
306
|
|
|
307
307
|
Before creating a run, `factory run` validates the input, reads the prompts and checks from the repository, where the agents will work, for each runtime the workflow uses, that its executable is in the `PATH`, at least the supported version, and connected; a missing piece fails the command with the stage, runtime and reason. The terminal then shows each runtime's version and connection. A model the account cannot use fails the run at its first call, with the runtime's message.
|
|
308
308
|
|
|
309
|
-
The run executes in the foreground. The terminal shows each stage's start and end, decisions and corrections with their counter (`[verify.failed 1/3]`), journal messages and, for an agent, the start of its call with its model, thinking, runtime choices and tools, its end, each finished tool with its duration and the runtime's warnings; then the result, the duration, the agents' tokens and estimated cost, and the runtimes used. `--json` writes every event, then the result, as JSON lines on standard output. Exit codes: 0 completed, 1 error or failed run.
|
|
309
|
+
The run executes in the foreground. The terminal first shows the launch (flow's and the factory's versions, where the workflow's prompts come from, the budget in force and whether it was given, the run's own or the workflow's), then each stage's start and end, decisions and corrections with their counter (`[verify.failed 1/3]`), journal messages and, for an agent, the start of its call with its model, thinking, runtime choices and tools, its end, each finished tool with its duration and the runtime's warnings; then the result, the duration, the agents' tokens and estimated cost, and the runtimes used. `--json` writes every event, then the result, as JSON lines on standard output. Exit codes: 0 completed, 1 error or failed run.
|
|
310
310
|
|
|
311
311
|
**Ctrl-C** stops the run's child processes and ends the run as `failed` with its cause before its next stage, or instead of completing; a second Ctrl-C kills the remaining child processes and quits at once (exit code 130, the run may then stay `running`); commands that Codex runs in their own process groups are stopped by Codex on the first Ctrl-C, not by the second.
|
|
312
312
|
|
|
313
313
|
**Resume.** `factory resume RUN_ID` runs a failed run again in the foreground, under the same ID, at the stage where it stopped (with `--accept-review`, an `implement` or `tidy` run its review stopped by asking for changes is delivered as the review left it: see The pull request): its input, data, corrections, cost and agents' conversations are kept, the stage's journal starts with why the run had stopped (`Resumed after: …`), and its agent is told so and asked to continue rather than start over. The workflow is the one `factory.ts` defines now, its prompts are read again, and its runtimes are checked as for `factory run`. The budget is the one given with `--max-cost-usd`, else the run's own, else the workflow's; a run that already spent it does not resume without a higher one. The run's budget still counts its whole cost, but calls that announced no cost before the resumption, such as a call stopped by its timeout, no longer fail it; their cost counts only if the runtime includes it in the total it later announces for the resumed session, and the run's cost stays marked partial. The run's duration leaves out the time it spent stopped. Only a failed run resumes, and by one command at a time: a run left `running` after a second Ctrl-C does not, and a workflow may refuse to resume from the state of the repository, as `implement` does. A resumed stage starts over: what it did before it failed must be safe to do again. A run stopped by a correction maximum resumes at the stage that asked for it, which may then take one more correction: the checks may pass after a fix by hand, and a gate judging the same answer sends it back once more.
|
|
314
314
|
|
|
315
|
-
`factory status` lists the repository's runs or shows one; while `factory.ts` cannot load, `status` and `ui` say so and still show the runs with the default rendering. `factory ui` serves on `127.0.0.1` (port chosen by the system unless `--port` sets it, URL printed; Ctrl-C stops it) the Kanban on `/` and, under `/runs/`, a read-only dashboard of the repository's runs, with a Board link back to the Kanban: the runs in a rail grouped by day, named by their issue, filtered and searched; for a run its figures and links, its launches on one bar with the pauses between them and why each stopped, its stage executions in lanes over its active time with its rounds and corrections, then the selected execution's panel (Overview, Input with the correction it received, Output with the agent's answer
|
|
315
|
+
`factory status` lists the repository's runs or shows one; while `factory.ts` cannot load, `status` and `ui` say so and still show the runs with the default rendering. `factory ui` serves on `127.0.0.1` (port chosen by the system unless `--port` sets it, URL printed; Ctrl-C stops it) the Kanban on `/` and, under `/runs/`, a read-only dashboard of the repository's runs, with a Board link back to the Kanban: the runs in a rail grouped by day, named by their issue, filtered and searched; for a run its figures and links, its launches on one bar with the pauses between them and why each stopped, each opening what it ran with and what changed since the one before, its stage executions in lanes over its active time with its rounds and corrections, then the selected execution's panel (Overview, Input with the correction it received and what flow sent each agent call, loaded on demand: the workflow's prompt, the instructions, the context and the output schema, the whole request and the command, Output with the agent's answer, the correction sent back or not and each call's answer when it made several, Activity with its calls, tool calls, journal and warnings in one timeline), beside its cost by session and over time, its result with its links and its data as a tree. The address keeps the run, the execution and the tab. It follows a running run as it goes. To watch on another machine, forward the same port through SSH: `ssh -L 4321:127.0.0.1:4321 machine`, run `factory ui --port 4321` there, and open `http://localhost:4321/`. `factory doctor` checks Node, loads the workflows, reads their prompts, lists each workflow's options and checks each runtime's executable, version and connection, without any provider request.
|
|
316
316
|
|
|
317
317
|
## Data
|
|
318
318
|
|
|
319
|
-
Issues live in `.factory/issues/` and are committed: their specs and plans are part of the repository's history. Each run keeps `state.json
|
|
319
|
+
Issues live in `.factory/issues/` and are committed: their specs and plans are part of the repository's history. 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 agent's final text) in `.factory/runs/<RUN_ID>/`, plus its Pi sessions and Claude Code and Codex session markers; Claude Code and Codex keep their transcripts in their own storage (`~/.claude/projects/…`, `~/.codex/sessions/…`). Runs hold inputs, what flow sent the agents, their outputs and the journal: they stay private and are ignored by Git. `.factory/.env` is loaded automatically, without overriding variables already set in the shell; runtimes, MCP servers and commands inherit the environment. `factory run` executes the code of `.factory/`: trust it as you trust `npm run`. The Kanban and the runs dashboard show the same data to any local process that can reach `127.0.0.1`.
|
|
320
320
|
|
|
321
321
|
Tokens and costs are the figures each runtime announces: Claude Code announces at the end of a call its session's total, earlier calls included, and its tokens during a call are provisional; Codex announces at the end of each turn its thread's total tokens, earlier turns included, without a cost (its input includes the cached tokens, which flow takes out so that input counts the same tokens for every runtime); Pi announces each response with its cost. A run's total is the sum of its sessions, with the cost they announced: a call without a cost makes the cost partial, unknown while no call announced one. The estimated cost is the runtime's public-price estimate, not a bill.
|
|
322
322
|
|
package/dist/app/run.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { exceededEdge, resumeRun as resume, startRun as start, } from "@clemrig/flow";
|
|
2
|
-
import { loadPrompts, workflowOf } from "../system/factory.js";
|
|
2
|
+
import { callerOf, loadPrompts, workflowOf, } from "../system/factory.js";
|
|
3
3
|
import { asOptionsError, inputFromOptions, parseBudget } from "./options.js";
|
|
4
4
|
import { DELIVERY } from "../domain/delivery.js";
|
|
5
5
|
import { TIDY } from "../domain/tidy.js";
|
|
@@ -23,6 +23,7 @@ export async function startRun(factory, name, options, hooks) {
|
|
|
23
23
|
dir: factory.dir,
|
|
24
24
|
configDir: factory.factoryDir,
|
|
25
25
|
runsDir: factory.runsDir,
|
|
26
|
+
caller: callerOf(factory, workflow),
|
|
26
27
|
}, hooks);
|
|
27
28
|
}
|
|
28
29
|
catch (error) {
|
|
@@ -60,6 +61,7 @@ export async function resumeRun(factory, runId, options, hooks) {
|
|
|
60
61
|
dir: factory.dir,
|
|
61
62
|
configDir: factory.factoryDir,
|
|
62
63
|
runsDir: factory.runsDir,
|
|
64
|
+
caller: callerOf(factory, workflow),
|
|
63
65
|
}, hooks);
|
|
64
66
|
}
|
|
65
67
|
//# sourceMappingURL=run.js.map
|
package/dist/app/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/app/run.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,SAAS,IAAI,MAAM,EAEnB,QAAQ,IAAI,KAAK,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/app/run.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,SAAS,IAAI,MAAM,EA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AO,EAAE,QAAQ,CAAC;QAC7C,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,SAAS,EAAE,OAAO,CAAC,UAAU;QAC7B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,MAAM,EAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;KACpC,EACD,KAAK,CACN,CAAC;AACJ,CAAC"}
|
package/dist/cli/reporter.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { type RunEvent, type RunState } from "@clemrig/flow";
|
|
1
|
+
import { type LaunchEvent, type RunEvent, type RunState } from "@clemrig/flow";
|
|
2
2
|
/** The run's duration, then its agents' tokens and estimated cost. */
|
|
3
3
|
export declare function metricsSummary(state: RunState, now?: number): string[];
|
|
4
|
+
/** What a launch executes with: versions, then the budget in force and where it comes from. */
|
|
5
|
+
export declare function launchLine(event: LaunchEvent): string;
|
|
4
6
|
/** Stage events and journal on stderr; results on stdout; JSON lines on stdout with --json. */
|
|
5
7
|
export declare class TerminalReporter {
|
|
6
8
|
#private;
|
package/dist/cli/reporter.js
CHANGED
|
@@ -68,6 +68,21 @@ function activityLines(activity) {
|
|
|
68
68
|
return [];
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
const budgetFrom = {
|
|
72
|
+
given: "given to this launch",
|
|
73
|
+
run: "the run's own",
|
|
74
|
+
workflow: "the workflow's",
|
|
75
|
+
};
|
|
76
|
+
/** What a launch executes with: versions, then the budget in force and where it comes from. */
|
|
77
|
+
export function launchLine(event) {
|
|
78
|
+
return [
|
|
79
|
+
`flow ${event.flow}`,
|
|
80
|
+
...Object.entries(event.caller ?? {}).map(([name, value]) => `${name} ${value}`),
|
|
81
|
+
...(event.budget
|
|
82
|
+
? [`budget ${event.budget.usd} USD, ${budgetFrom[event.budget.from]}`]
|
|
83
|
+
: []),
|
|
84
|
+
].join(" · ");
|
|
85
|
+
}
|
|
71
86
|
/** Stage events and journal on stderr; results on stdout; JSON lines on stdout with --json. */
|
|
72
87
|
export class TerminalReporter {
|
|
73
88
|
#present;
|
|
@@ -92,6 +107,10 @@ export class TerminalReporter {
|
|
|
92
107
|
this.detail(line);
|
|
93
108
|
return;
|
|
94
109
|
}
|
|
110
|
+
if (event.type === "launch") {
|
|
111
|
+
this.detail(launchLine(event));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
95
114
|
const correction = event.decision?.verdict === "correction";
|
|
96
115
|
const icon = correction && event.status !== "failed" ? "↻" : icons[event.status];
|
|
97
116
|
const color = process.stderr.isTTY && !process.env.NO_COLOR
|
package/dist/cli/reporter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporter.js","sourceRoot":"","sources":["../../src/cli/reporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,
|
|
1
|
+
{"version":3,"file":"reporter.js","sourceRoot":"","sources":["../../src/cli/reporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAIT,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,SAAS,QAAQ,CAAC,EAAU;IAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAClD,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,QAAQ,OAAO,GAAG,EAAE,IAAI,CAAC;AACzE,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,cAAc,CAAC,KAAe,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IAC9D,MAAM,OAA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KAAK,CAClB,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAC9E,CAAC;YACF,OAAO;QACT,CAAC;QACD,MAAM,KAAK,GAAG;YACZ,EAAE;YACF,GAAG,KAAK,CAAC,QAAQ,MAAM,KAAK,CAAC,EAAE,MAAM,KAAK,CAAC,MAAM,EAAE;YACnD,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACrC,GAAG,cAAc,CAAC,KAAK,CAAC;YACxB,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CACxC,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,OAAO,EAAE,CACnC;YACD,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;SACxB,CAAC;QACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;CACF"}
|
package/dist/system/factory.d.ts
CHANGED
|
@@ -14,5 +14,10 @@ export declare function emptyFactory(factoryDir: string): Factory;
|
|
|
14
14
|
/** Imports `.factory/factory.ts` and returns its default export, unchecked. */
|
|
15
15
|
export declare function importFactory(factoryDir: string): Promise<unknown>;
|
|
16
16
|
export declare function workflowOf(factory: Factory, name: string): Workflow;
|
|
17
|
+
/**
|
|
18
|
+
* What the factory runs a workflow with, recorded with each launch of its
|
|
19
|
+
* runs: its version, and where the workflow's prompts come from.
|
|
20
|
+
*/
|
|
21
|
+
export declare function callerOf(factory: Factory, workflow: Workflow): Record<string, string>;
|
|
17
22
|
/** Reads `<name>.md` for each agent stage of the workflow, at every run. */
|
|
18
23
|
export declare function loadPrompts(factory: Factory, workflow: Workflow): Promise<Record<string, string>>;
|
package/dist/system/factory.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
1
2
|
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
+
import { dirname, join, relative } from "node:path";
|
|
3
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
5
|
/** A factory without workflows, to read runs when `factory.ts` cannot load. */
|
|
5
6
|
export function emptyFactory(factoryDir) {
|
|
@@ -34,6 +35,20 @@ function promptsDir(factory, workflow) {
|
|
|
34
35
|
? join(packageRoot, "prompts")
|
|
35
36
|
: join(factory.factoryDir, "workflows", workflow.name, "prompts");
|
|
36
37
|
}
|
|
38
|
+
/** This package's version, as installed. */
|
|
39
|
+
const version = JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8")).version;
|
|
40
|
+
/**
|
|
41
|
+
* What the factory runs a workflow with, recorded with each launch of its
|
|
42
|
+
* runs: its version, and where the workflow's prompts come from.
|
|
43
|
+
*/
|
|
44
|
+
export function callerOf(factory, workflow) {
|
|
45
|
+
return {
|
|
46
|
+
factory: version,
|
|
47
|
+
prompts: factory.packaged.has(workflow.name)
|
|
48
|
+
? `@clemrig/factory ${version}`
|
|
49
|
+
: relative(factory.dir, promptsDir(factory, workflow)),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
37
52
|
/** Reads `<name>.md` for each agent stage of the workflow, at every run. */
|
|
38
53
|
export async function loadPrompts(factory, workflow) {
|
|
39
54
|
const prompts = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/system/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/system/factory.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,QAAQ,CAAC,EAAE,GAAG,IAAI,KAAK,CAAC,CAAC;QAC/D,IAAI,IAAY,CAAC;QACjB,IAAI,CAAC;YACH,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;gBAAE,MAAM,KAAK,CAAC;YACpE,QAAQ,CAAC,IAAI,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;YACzC,SAAS;QACX,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YAAE,QAAQ,CAAC,IAAI,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IACjC,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clemrig/factory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Take a repository's issues from spec to pull request with agents, watch them on a local Kanban, and run the repository's own workflows",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@clemrig/factory-ui": "0.2.0",
|
|
43
|
-
"@clemrig/flow": "0.
|
|
44
|
-
"@clemrig/flow-ui": "0.
|
|
43
|
+
"@clemrig/flow": "0.9.0",
|
|
44
|
+
"@clemrig/flow-ui": "0.8.0"
|
|
45
45
|
}
|
|
46
46
|
}
|