@clemrig/factory 0.16.0 → 0.18.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.
Files changed (35) hide show
  1. package/README.md +21 -6
  2. package/dist/app/define.js +5 -1
  3. package/dist/app/define.js.map +1 -1
  4. package/dist/app/workflows/implement.js +5 -6
  5. package/dist/app/workflows/implement.js.map +1 -1
  6. package/dist/app/workflows/stages/agents.d.ts +16 -0
  7. package/dist/app/workflows/stages/agents.js +80 -0
  8. package/dist/app/workflows/stages/agents.js.map +1 -1
  9. package/dist/app/workflows/stages/deliver.d.ts +2 -1
  10. package/dist/app/workflows/stages/deliver.js +4 -4
  11. package/dist/app/workflows/stages/deliver.js.map +1 -1
  12. package/dist/app/workflows/stages/implement.d.ts +2 -1
  13. package/dist/app/workflows/stages/implement.js +4 -4
  14. package/dist/app/workflows/stages/implement.js.map +1 -1
  15. package/dist/app/workflows/stages/review.d.ts +2 -1
  16. package/dist/app/workflows/stages/review.js +4 -4
  17. package/dist/app/workflows/stages/review.js.map +1 -1
  18. package/dist/app/workflows/stages/run.d.ts +1 -1
  19. package/dist/app/workflows/stages/run.js.map +1 -1
  20. package/dist/app/workflows/tidy.js +5 -6
  21. package/dist/app/workflows/tidy.js.map +1 -1
  22. package/dist/domain/app.d.ts +27 -0
  23. package/dist/domain/app.js +2 -0
  24. package/dist/domain/app.js.map +1 -0
  25. package/dist/domain/definition.d.ts +4 -1
  26. package/dist/domain/definition.js +19 -2
  27. package/dist/domain/definition.js.map +1 -1
  28. package/dist/index.d.ts +1 -0
  29. package/dist/system/app.d.ts +17 -0
  30. package/dist/system/app.js +147 -0
  31. package/dist/system/app.js.map +1 -0
  32. package/package.json +3 -3
  33. package/prompts/describe.md +10 -7
  34. package/prompts/implement.md +8 -5
  35. package/prompts/review.md +20 -17
package/README.md CHANGED
@@ -8,7 +8,7 @@ An idea becomes an issue; the operator specifies it with an agent; one run then
8
8
 
9
9
  - macOS or Linux, Node.js 24 or later, npm.
10
10
  - For the `implement` run: Git, a GitHub repository whose remote is `origin`, with `origin/HEAD` naming the main branch (`git clone` sets it; otherwise `git remote set-head origin --auto`), and the [GitHub CLI](https://cli.github.com) `gh` 2.99.0 or later (it attaches screenshots to the pull request), logged in (`gh auth login`).
11
- - For agents run by Claude Code: the `claude` CLI 2.1.296 or later in the `PATH`, logged in with a claude.ai subscription (`claude`, then `/login`) or given an API key (`ANTHROPIC_API_KEY`).
11
+ - For agents run by Claude Code: the `claude` CLI 2.1.296 or later in the `PATH`, logged in with a claude.ai subscription (`claude`, then `/login`) or given an API key (`ANTHROPIC_API_KEY`), and a `ps` that lists processes with their group and start time (macOS's, or procps on Linux), with which each call ends what its agent's commands leave running.
12
12
  - For agents run by Codex: the `codex` CLI 0.160.1 or later in the `PATH`, logged in with a ChatGPT account or an API key (`codex login`) or given an API key (`CODEX_API_KEY`); Codex works only in a Git repository.
13
13
  - For agents run by Pi: the `pi` CLI (`@earendil-works/pi-coding-agent` 1.1.0 or later) in the `PATH`, connected to the provider each Pi profile names (`pi`, then `/login`, or the provider's API key).
14
14
 
@@ -86,11 +86,25 @@ If its profile allows it, the reviewer runs commands (tests, reproductions, the
86
86
  - After each call, even a failed one, what the agent changed is put back (`.gitignore` files first, so that an ignored file is never taken for an addition), and it starts again in a new conversation, once per run.
87
87
  - A second change, a commit or a branch switch stops the run. So does a list of changed files longer than the 2 MiB the run reads from Git, which leaves the repository as it is for inspection.
88
88
 
89
- A malformed agent response goes back to that agent, 2 times at most. The text the agents write for people (the plan, the deviations, the review's evidence and findings, the description) is in the language of the spec's content, the commit subject in English, and written for a reader who knows neither the spec nor the code: things named by what they do, an identifier only beside its meaning, a sentence or two per item. Agents change no data they did not create: they use what the repository's instructions provide for tests, or create their own. The run's result shows the pull request, the review rounds, the checks passed, the merge's danger and how many readings of the spec the plan chose for you to confirm.
89
+ A malformed agent response goes back to that agent, 2 times at most. The text the agents write for people (the plan, the deviations, the review's evidence and findings, the description) is in the language of the spec's content, the commit subject in English, and written for a reader who knows neither the spec nor the code: things named by what they do, an identifier only beside its meaning, a sentence or two per item. Agents change no data they did not create: they use what the repository's instructions provide for tests, or create their own; the data of the application the run gives them (see below) is theirs. The run's result shows the pull request, the review rounds, the checks passed, the merge's danger and how many readings of the spec the plan chose for you to confirm.
90
+
91
+ #### The application
92
+
93
+ When `factory.ts` declares the repository's `app`, the run owns it, as it owns the browser: for each execution of the `implement`, `review` and `describe` stages, it picks a free port for each name in `ports`, runs `setup`, which prepares data of the application's own (a database created, migrated and seeded, for instance) and writes the application's variables as `NAME=value` lines in the file `FACTORY_APP_ENV` names, then `start`, in the foreground, and waits until its `url`, a function of its variables, answers in HTTP, whatever the status (5 minutes at most; 10 for `setup`, 5 for `teardown`). Each command runs in the repository, without a shell, with the application's variables: `FACTORY_APP`, a short identifier of its own that can name a database, the ports, then what `setup` wrote. The agents receive `app` (its `url`, and `logs`, the file of its output, in the run's folder) and its variables in their environment, so that their own commands, such as a migration or a query, reach the same data; their prompts tell them it already runs, with data they may change, and to start or stop no server. Once the stage is over, failed or not, the run stops the application (5 seconds, then SIGKILL of its process group) and runs `teardown`, even after a failed `setup`; the stage's journal tells when the application stopped by itself during the call, or when its data could not be removed. An application that cannot start fails the stage, with the end of its output; `factory resume` starts the stage again. None of the three commands may change the repository's files, which the run would take for the agents' work: what they change as the application starts or stops is put back and named in the stage's journal, and a change as it starts fails the stage; what the application writes while the agents work cannot be told from theirs. Without `app`, the agents start the application as the repository's agent instructions say.
94
+
95
+ ```ts
96
+ app: {
97
+ setup: ["sh", "scripts/factory-app.sh", "setup"], // creates, migrates and seeds the database app_$FACTORY_APP
98
+ start: ["npm", "run", "dev"], // reads API_PORT, WEB_PORT and DATABASE_URL
99
+ teardown: ["sh", "scripts/factory-app.sh", "teardown"],
100
+ ports: ["API_PORT", "WEB_PORT"],
101
+ url: ({ WEB_PORT }) => `http://localhost:${WEB_PORT}`,
102
+ },
103
+ ```
90
104
 
91
105
  #### The browser
92
106
 
93
- The `implement`, `review` and `describe` agents check a change that shows in a web interface in a browser: they start the application as the repository's agent instructions say, and stop everything they started before answering. When `.factory/` installs Playwright CLI, as `factory init` does, the run writes in its folder a command that runs it from the run's own workspace (a `browser/` folder holding `.playwright`), so that every session the agents open stays there, out of the repository and away from yours; it keeps its files in the run's folder, reports them by their absolute path and uses the downloaded Chromium (a repository's own `.playwright/cli.config.json` is not read), and it refuses `kill-all`, which would end your browsers too. The agents receive it as `browser`. Playwright CLI keeps its browser open after the agent that opened it, so at the end of each of these agents' stages the run closes every session of that workspace (`close-all`). The prompts name no tool: an agent without this command uses its own, such as a Pi extension. The repository's agent instructions must say how to start the application.
107
+ The `implement`, `review` and `describe` agents check a change that shows in a web interface in a browser: on the run's application or, without one, on the application they start as the repository's agent instructions say, stopping everything they started before answering. When `.factory/` installs Playwright CLI, as `factory init` does, the run writes in its folder a command that runs it from the run's own workspace (a `browser/` folder holding `.playwright`), so that every session the agents open stays there, out of the repository and away from yours; it keeps its files in the run's folder, reports them by their absolute path and uses the downloaded Chromium (a repository's own `.playwright/cli.config.json` is not read), and it refuses `kill-all`, which would end your browsers too. The agents receive it as `browser`. Playwright CLI keeps its browser open after the agent that opened it, so at the end of each of these agents' stages the run closes every session of that workspace (`close-all`). The prompts name no tool: an agent without this command uses its own, such as a Pi extension. Without `app`, the repository's agent instructions must say how to start the application.
94
108
 
95
109
  #### The pull request
96
110
 
@@ -176,6 +190,7 @@ export default defineFactory({
176
190
  - `maxCostUsd`: the budget of an `implement` run, in USD; `factory run implement --issue <slug> --max-cost-usd 40` changes it for one run. Codex announces no cost, so the agents of `implement` and `tidy` (`plan`, `implement`, `review`, `describe`) cannot run with Codex.
177
191
  - `tidy` (optional): `{ maxCostUsd }`, the budget of a `tidy` run, that of `implement` when absent; `--max-cost-usd` changes it for one run.
178
192
  - `profiles`: the agents of `plan`, `implement` and `review`, and optionally `describe`, which writes the pull request (the review's profile without it; see Profiles below); `tidy` runs its scout with the `plan` profile. Each profile decides what its agent may do: here, `plan` only reads the repository, handing areas of a large spec to sub-agents (`Agent`); `implement` also edits it and runs commands, and `permissionMode: "dontAsk"` refuses any other tool instead of waiting for a permission prompt; `review` and `describe` read it and run commands, such as tests, reproductions or the application in a browser (they must not change the repository: the run puts back what they change). `Agent` in the review's tools lets it split the review of a large change between sub-agents. Without a way to start the application and a browser, `describe` takes no screenshot and says why.
193
+ - `app` (optional): how to run the repository's application for the agents that check a change: `{ setup?, start, teardown?, ports?, url }`, `url` a function of its variables that gives its address (see The application above).
179
194
  - `workflows` (optional): the repository's own workflows.
180
195
 
181
196
  `defineFactory` lists every problem at once, each agent's profile checked on its own even when other fields are wrong; it also refuses a workflow not made by `defineWorkflow`, or named like another, `issue-save`, `implement` and `tidy` included. Any other default export of `factory.ts` is refused.
@@ -275,7 +290,7 @@ Workflows are TypeScript run directly by Node: use erasable syntax only (no `enu
275
290
 
276
291
  **Resumption.** `factory resume` starts a failed run again at the stage where it stopped (see Resume below). A workflow whose stages change the repository can declare `resumeProblem: async ({ state, dir }) => …`, which returns why the run cannot resume from the directory as it is now, or `undefined`; the resumption is then refused with that reason, before anything changes.
277
292
 
278
- **Budget.** `maxCostUsd` (optional) fails a run once the cost its agents' runtimes announced exceeds it; `factory run … --max-cost-usd 2` sets it for one run, instead of the workflow's, and the run keeps it when resumed. It is checked before and after each agent call, failed or not, on the runtime's figures: a running call is not stopped and can go past it; once it is exceeded, no further call starts and the run fails at its next stage boundary, even if workflow code catches the error. A call that announced no cost fails a run that has a budget, since the budget can no longer be checked, until the run is resumed (see Resume below); Codex announces tokens only, so a budget is refused, before any run, for a workflow with a Codex stage. With a subscription, the cost is an estimate.
293
+ **Budget.** `maxCostUsd` (optional) bounds the cost its agents' runtimes announce; `factory run … --max-cost-usd 2` sets it for one run, instead of the workflow's, and the run keeps it when resumed. It is checked before each agent call, on the runtime's figures: once it is exceeded, the call does not start, which fails its stage, and the run fails at its next stage boundary even if workflow code catches the error; the resumption starts there, without paying again for anything. A running call is not stopped and can go past it: it keeps its answer, already paid for, and the run goes on to its next agent call; a run whose last call goes past it completes. Once a call announced no cost, the next call of a run that has a budget does not start, since the budget can no longer be checked, until the run is resumed (see Resume below); Codex announces tokens only, so a budget is refused, before any run, for a workflow with a Codex stage. With a subscription, the cost is an estimate.
279
294
 
280
295
  **Profiles.** Each agent stage declares its profile; no machine setting of the factory changes it. A profile is a plain object: share one between stages with a constant, typed with `satisfies AgentProfile` (`AgentProfile` is exported by `@clemrig/factory`).
281
296
 
@@ -288,7 +303,7 @@ Workflows are TypeScript run directly by Node: use erasable syntax only (no `enu
288
303
  | other | `permissionMode` (a `--permission-mode` choice), `mcpServers: { name: { command, args? } }` | `sandbox`: `read-only`, `workspace-write` or `danger-full-access` | `skills`, `extensions` (paths) |
289
304
  | `timeoutMs` | default 15 minutes, no maximum | default 15 minutes, no maximum | default 15 minutes, no maximum |
290
305
 
291
- Each agent runs with this machine's and this repository's configuration, as you would run it yourself: Claude Code with its settings, `CLAUDE.md`, plugins, hooks, skills, MCP servers and memory; Codex with its `config.toml`, `AGENTS.md` files, skills and MCP servers; Pi with its extensions, skills, context files and MCP servers. The profile only adds its settings; without `tools`, `permissionMode` or `sandbox`, the agent's own configuration decides. A Claude Code call waits for its agent's background work, sub-agents included, until it ends or the profile's timeout stops the call: print mode alone would stop it after 10 minutes without a turn. The same workflow can therefore behave differently on another machine, and a repository's own hooks and MCP servers run with its agents. Relative skill, extension and MCP command paths are relative to `.factory/`; a bare command is looked up in the `PATH`. Runtimes are not sandboxes unless one is enabled: their tools act with your rights.
306
+ Each agent runs with this machine's and this repository's configuration, as you would run it yourself: Claude Code with its settings, `CLAUDE.md`, plugins, hooks, skills, MCP servers and memory; Codex with its `config.toml`, `AGENTS.md` files, skills and MCP servers; Pi with its extensions, skills, context files and MCP servers. The profile only adds its settings; without `tools`, `permissionMode` or `sandbox`, the agent's own configuration decides. A Claude Code call waits for its agent's sub-agents until they end or the profile's timeout stops the call: print mode alone would stop them after 10 minutes without a turn. The agent's answer ends the call: Claude Code is stopped then, with any command the agent left running in the background, such as the application it started, and the stage's journal counts them; whatever a Claude Code agent's commands leave running, detached with `&` or `nohup` included, ends with the call too. The same workflow can therefore behave differently on another machine, and a repository's own hooks and MCP servers run with its agents. Relative skill, extension and MCP command paths are relative to `.factory/`; a bare command is looked up in the `PATH`. Runtimes are not sandboxes unless one is enabled: their tools act with your rights.
292
307
 
293
308
  **Prompts.** An agent's prompt is `.factory/workflows/<workflow>/prompts/<name>.md`, where the name is the stage's unless `agent({ prompt })` names another; the factory's own workflows read theirs from the package. It is appended to the runtime's system prompt (Codex receives it as the session's `developer_instructions`); the request (context and output JSON Schema) follows on standard input. Prompts are read when a run starts: an edit applies to the next run, without building anything.
294
309
 
@@ -312,7 +327,7 @@ The run executes in the foreground. The terminal first shows the launch (flow's
312
327
 
313
328
  **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
329
 
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 with the session each call ran in as its runtime confirmed it, 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.
330
+ `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 above three tabs: Timeline with 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 with the session each call ran in as its runtime confirmed it, 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), Cost with its cost by session and over time, Result with its result, its links and its data as a tree. The address keeps the run, its tab, the execution chosen and the execution's 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
331
 
317
332
  ## Data
318
333
 
@@ -48,7 +48,11 @@ export function defineFactory(definition) {
48
48
  // (a budget with an agent that announces no cost).
49
49
  if (given.profiles && !flagged("profiles"))
50
50
  try {
51
- const settings = { verify: given.verify ?? [], profiles: given.profiles };
51
+ const settings = {
52
+ verify: given.verify ?? [],
53
+ profiles: given.profiles,
54
+ app: given.app,
55
+ };
52
56
  // A refused budget is already listed; the workflow does not repeat it.
53
57
  const maxCostUsd = flagged("maxCostUsd") ? undefined : given.maxCostUsd;
54
58
  base = [
@@ -1 +1 @@
1
- {"version":3,"file":"define.js","sourceRoot":"","sources":["../../src/app/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAiB,MAAM,eAAe,CAAC;AAC3E,OAAO,EACL,kBAAkB,GAEnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAqB3C,MAAM,OAAO,GAAG,IAAI,OAAO,EAA4B,CAAC;AAExD,2FAA2F;AAC3F,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAChD,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;QACpB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,UAA6B;IACzD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,UAAU,CA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AAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACxE,CAAC;IACH,IAAI,QAAQ,CAAC,MAAM;QACjB,MAAM,IAAI,KAAK,CACb,CAAC,kBAAkB,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CACrE,IAAI,CACL,CACF,CAAC;IACJ,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAmB,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IACpC,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -40,7 +40,9 @@ export function implement(definition) {
40
40
  invalid: retry("plan", 2),
41
41
  }),
42
42
  "commit-plan": node(commitPlan, { ok: "implement" }),
43
- implement: node(implementer(profiles.implement), { ok: "implemented" }),
43
+ implement: node(implementer(profiles.implement, definition.app), {
44
+ ok: "implemented",
45
+ }),
44
46
  implemented: node(judgeImplementation, {
45
47
  ok: "verify",
46
48
  invalid: retry("implement", 2),
@@ -50,7 +52,7 @@ export function implement(definition) {
50
52
  failed: retry("implement", 3),
51
53
  }),
52
54
  diff: node(diff, { ok: "review" }),
53
- review: node(reviewer(profiles.review), {
55
+ review: node(reviewer(profiles.review, definition.app), {
54
56
  ok: "reviewed",
55
57
  modified: retry("review", 1),
56
58
  }),
@@ -59,10 +61,7 @@ export function implement(definition) {
59
61
  changes: retry("implement", 4),
60
62
  invalid: retry("review", 2),
61
63
  }),
62
- describe: node(describer(profiles.describe ?? profiles.review), {
63
- ok: "described",
64
- modified: retry("describe", 1),
65
- }),
64
+ describe: node(describer(profiles.describe ?? profiles.review, definition.app), { ok: "described", modified: retry("describe", 1) }),
66
65
  described: node(judgeDescription, {
67
66
  ok: "deliver",
68
67
  invalid: ret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IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;YAClC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE;gBACtD,EAAE,EAAE,UAAU;gBACd,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;aAC7B,CAAC;YACF,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE;gBAC1B,QAAQ,EAAE,UAAU;gBACpB,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;gBAC9B,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;aAC5B,CAAC;YACF,QAAQ,EAAE,IAAI,CACZ,SAAS,CAAC,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,EAC/D,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CACpD;YACD,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE;gBAChC,EAAE,EAAE,SAAS;gBACb,OAAO,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;aAC9B,CAAC;YACF,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;YACvD,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC;SAClC;QACD,aAAa;QACb,8DAA8D;QAC9D,aAAa,EAAE,cAAc;KAC9B,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { RunState, Stage, StageContext } from "@clemrig/flow";
2
+ import type { AppDeclaration } from "../../../domain/app.js";
2
3
  /** The agents' browser, in the request of the agents that may use it. */
3
4
  export declare function browserContext(state: Readonly<RunState>): {
4
5
  browser?: string;
@@ -9,6 +10,21 @@ export declare function browserContext(state: Readonly<RunState>): {
9
10
  * of the run's workspace is closed, those a stopped call left included.
10
11
  */
11
12
  export declare function closingBrowser<O extends string>(stage: Stage<O>): Stage<O>;
13
+ /**
14
+ * Runs the repository's application for the stage's agents, when it declares
15
+ * one: started with data of its own before the stage, then stopped and its
16
+ * data removed once the stage is over, failed or not. Each of the stage's
17
+ * agent calls receives its address and its log (`app`) in its request, and
18
+ * its variables in its environment, so that the agent's commands reach the
19
+ * same data. An application that cannot start fails the stage.
20
+ *
21
+ * Its commands must leave the repository's files as they are, which the run
22
+ * would take for the agents' work: what they change as the application starts
23
+ * or stops is put back and named in the stage's journal, and a change as it
24
+ * starts fails the stage. What the application writes while the agents work
25
+ * cannot be told from theirs.
26
+ */
27
+ export declare function runningApp<O extends string>(app: AppDeclaration | undefined, stage: Stage<O>): Stage<O>;
12
28
  /** The agents work on the plan's commit, on the issue's branch: the run stops if one committed or switched branches. */
13
29
  export declare function ensureOnPlanCommit({ dir, state }: StageContext, agentName: "implementing" | "reviewing" | "describing"): Promise<void>;
14
30
  /** The agents that read the change without changing the repository: the review, then the description. */
@@ -1,3 +1,4 @@
1
+ import { startApp } from "../../../system/app.js";
1
2
  import { closeBrowser } from "../../../system/browser.js";
2
3
  import * as git from "../../../system/git.js";
3
4
  import { facts, message } from "./run.js";
@@ -27,6 +28,85 @@ export function closingBrowser(stage) {
27
28
  },
28
29
  };
29
30
  }
31
+ /**
32
+ * Runs the repository's application for the stage's agents, when it declares
33
+ * one: started with data of its own before the stage, then stopped and its
34
+ * data removed once the stage is over, failed or not. Each of the stage's
35
+ * agent calls receives its address and its log (`app`) in its request, and
36
+ * its variables in its environment, so that the agent's commands reach the
37
+ * same data. An application that cannot start fails the stage.
38
+ *
39
+ * Its commands must leave the repository's files as they are, which the run
40
+ * would take for the agents' work: what they change as the application starts
41
+ * or stops is put back and named in the stage's journal, and a change as it
42
+ * starts fails the stage. What the application writes while the agents work
43
+ * cannot be told from theirs.
44
+ */
45
+ export function runningApp(app, stage) {
46
+ if (!app)
47
+ return stage;
48
+ return {
49
+ ...stage,
50
+ async run(context) {
51
+ const { dir, log } = context;
52
+ const before = await git.snapshot(dir);
53
+ const running = await startApp(app, dir, context.runDir);
54
+ // The repository to put back once the application stops: as it was
55
+ // before, until the agents work in it; then as they leave it.
56
+ let kept = before;
57
+ try {
58
+ if ((await git.snapshot(dir)) !== before)
59
+ throw new Error("The application changed the repository's files as it started: its commands must leave them as they are");
60
+ kept = undefined;
61
+ log(`The application runs at ${running.url}`, { logs: running.logs });
62
+ return await stage.run({
63
+ ...context,
64
+ agent: {
65
+ execute: (request, record) => context.agent.execute({
66
+ ...request,
67
+ context: {
68
+ ...request.context,
69
+ app: { url: running.url, logs: running.logs },
70
+ },
71
+ env: { ...request.env, ...running.env },
72
+ }, record),
73
+ },
74
+ });
75
+ }
76
+ finally {
77
+ for (const problem of await stopApp(running, dir, kept))
78
+ log(problem);
79
+ }
80
+ },
81
+ };
82
+ }
83
+ /**
84
+ * Stops the application whatever the repository's state, then puts back what
85
+ * it changed there: since `before`, when the agents have not worked, else since
86
+ * it was asked to stop. Returns what went wrong, for the journal; it throws
87
+ * nothing, so that the stage keeps its own error.
88
+ */
89
+ async function stopApp(running, dir, before) {
90
+ const problems = [];
91
+ const kept = before ??
92
+ (await git.snapshot(dir).catch((error) => {
93
+ problems.push(`Could not tell the agents' work from what the application changes as it stops: ${message(error)}`);
94
+ return undefined;
95
+ }));
96
+ problems.push(...(await running.stop()));
97
+ if (kept === undefined)
98
+ return problems;
99
+ const when = before ? "started" : "stopped";
100
+ try {
101
+ const changed = await git.putBack(dir, kept);
102
+ if (changed.length > 0)
103
+ problems.push(`The application changed ${changed.join(", ")} as it ${when}: put back; its commands must leave the repository's files as they are`);
104
+ }
105
+ catch (error) {
106
+ problems.push(`Could not put back what the application changed as it ${when}: ${message(error)}`);
107
+ }
108
+ return problems;
109
+ }
30
110
  /** The agents work on the plan's commit, on the issue's branch: the run stops if one committed or switched branches. */
31
111
  export async function ensureOnPlanCommit({ dir, state }, agentName) {
32
112
  const { slug, planCommit } = facts(state);
@@ -1 +1 @@
1
- {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../../../src/app/workflows/stages/agents.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,GAAG,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1C,yEAAyE;AACzE,MAAM,UAAU,cAAc,CAAC,KAAyB;IAGtD,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAmB,KAAe;IAC9D,OAAO;QACL,GAAG,KAAK;QACR,KAAK,CAAC,GAAG,CAAC,OAAO;YACf,IAAI,CAAC;gBACH,OAAO,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAClC,CAAC;oBAAS,CAAC;gBACT,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACzC,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;gBACzD,IAAI,OAAO;oBACT,OAAO,CAAC,GAAG,CAAC,wCAAwC,OAAO,EAAE,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,wHAAwH;AACxH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,EAAE,GAAG,EAAE,KAAK,EAAgB,EAC5B,SAAsD;IAEtD,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,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type RunState, type Stage } from "@clemrig/flow";
2
+ import type { AppDeclaration } from "../../../domain/app.js";
2
3
  /**
3
4
  * The describing agent: once the change is approved, it explains it to a
4
5
  * reader who forgot its issue, and takes its screenshots. It never reads the
5
6
  * implementing agent's account of its own work.
6
7
  */
7
- export declare function describer(profile: AgentProfile): Stage<"ok" | "modified">;
8
+ export declare function describer(profile: AgentProfile, app?: AppDeclaration): Stage<"ok" | "modified">;
8
9
  /** Changed files only in the guide, distinct screenshots of their folder, a body GitHub accepts. */
9
10
  export declare const judgeDescription: Stage<"invalid" | "ok">;
10
11
  /**
@@ -4,7 +4,7 @@ import { interpretationsLine, maxBodyLength, mergeDangerLine, pullRequestBody, }
4
4
  import * as git from "../../../system/git.js";
5
5
  import * as github from "../../../system/github.js";
6
6
  import { screenshotProblems } from "../../../system/run-files.js";
7
- import { browserContext, readers, reading } from "./agents.js";
7
+ import { browserContext, readers, reading, runningApp } from "./agents.js";
8
8
  import { facts, message, reviewRounds, short, specCommitOf } from "./run.js";
9
9
  /** One conversation for the description, a new one once it changed the repository. */
10
10
  function describeSession(state) {
@@ -16,8 +16,8 @@ function describeSession(state) {
16
16
  * reader who forgot its issue, and takes its screenshots. It never reads the
17
17
  * implementing agent's account of its own work.
18
18
  */
19
- export function describer(profile) {
20
- return reading(readers.describe, agent({
19
+ export function describer(profile, app) {
20
+ return runningApp(app, reading(readers.describe, agent({
21
21
  profile,
22
22
  schema: descriptionOutput,
23
23
  session: describeSession,
@@ -36,7 +36,7 @@ export function describer(profile) {
36
36
  ...browserContext(state),
37
37
  };
38
38
  },
39
- }));
39
+ })));
40
40
  }
41
41
  /** What the pull request shows, from the run's data; its screenshots `pending` until attached. */
42
42
  function pullRequestFacts(state, description, pending) {
@@ -1 +1 @@
1
- {"version":3,"file":"deliver.js","sourceRoot":"","sources":["../../../../src/app/workflows/stages/deliver.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,IAAI,EACJ,IAAI,EAGJ,IAAI,EACJ,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C,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC7D,sEAAsE;QACtE,4BAA4B;QAC5B,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM;YAC/B,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YACpD,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { type AgentProfile, type Stage } from "@clemrig/flow";
2
+ import type { AppDeclaration } from "../../../domain/app.js";
2
3
  /** The implementing agent: one conversation for the run, from the spec and the plan. */
3
- export declare function implementer(profile: AgentProfile): Stage<"ok">;
4
+ export declare function implementer(profile: AgentProfile, app?: AppDeclaration): Stage<"ok">;
4
5
  /** What the implementing agent did first, whatever it answered; then its evidence for each criterion. */
5
6
  export declare const judgeImplementation: Stage<"invalid" | "ok">;
@@ -1,18 +1,18 @@
1
1
  import { agent, gate, z, } from "@clemrig/flow";
2
2
  import { implementationOutput, implementationProblem, } from "../../../domain/review.js";
3
3
  import * as git from "../../../system/git.js";
4
- import { browserContext, closingBrowser, ensureOnPlanCommit, } from "./agents.js";
4
+ import { browserContext, closingBrowser, ensureOnPlanCommit, runningApp, } from "./agents.js";
5
5
  import { facts } from "./run.js";
6
6
  /** The implementing agent: one conversation for the run, from the spec and the plan. */
7
- export function implementer(profile) {
8
- return closingBrowser(agent({
7
+ export function implementer(profile, app) {
8
+ return runningApp(app, closingBrowser(agent({
9
9
  profile,
10
10
  schema: implementationOutput,
11
11
  context: ({ state }) => {
12
12
  const { slug, spec, plan } = facts(state);
13
13
  return { issue: slug, spec, plan, ...browserContext(state) };
14
14
  },
15
- }));
15
+ })));
16
16
  }
17
17
  /** The implementing agent may not commit, switch branches or touch .factory/: the run stops if it did. */
18
18
  async function guard(context) {
@@ -1 +1 @@
1
- {"version":3,"file":"implement.js","sourceRoot":"","sources":["../../../../src/app/workflows/stages/implement.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,IAAI,EAGJ,CAAC,GACF,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,GAAG,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EACL,cAAc,EACd,cAAc,EACd,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,wFAAwF;AACxF,MAAM,UAAU,WAAW,CAAC,OAAqB;IAC/C,OAAO,cAAc,CACnB,KAAK,CAAC;QACJ,OAAO;QACP,MAAM,EAAE,oBAAoB;QAC5B,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;YACrB,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;YAC1C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/D,CAAC;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,0GAA0G;AAC1G,KAAK,UAAU,KAAK,CAAC,OAAqB;IACxC,MAAM,kBAAkB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAClD,IAAI,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;AAC/E,CAAC;AAED,yGAAyG;AACzG,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAC3E,sEAAsE;IACtE,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,MAAM,MAAM,GAAG,oBAAoB,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpE,IAAI,CAAC,MAAM,CAAC,OAAO;QACjB,OAAO;YACL,OAAO,EAAE,SAAS;YAClB,MAAM,EAAE,+BAA+B,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;SACvE,CAAC;IACJ,MAAM,OAAO,GAAG,qBAAqB,CACnC,MAAM,CAAC,IAAI,EACX,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAC9B,CAAC;IACF,IAAI,OAAO;QAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC5D,OAAO;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,wDAAwD;QAChE,IAAI,EAAE,EAAE,cAAc,EAAE,MAAM,CAAC,IAAI,EAAE;KACtC,CAAC;AACJ,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"implement.js","sourceRoot":"","sources":["../../../../src/app/workflows/stages/implement.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,IAAI,EAGJ,CAAC,GACF,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,GAAG,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EACL,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,wFAAwF;AACxF,MAAM,UAAU,WAAW,CACzB,OAAqB,EACrB,GAAoB;IAEpB,OAAO,UAAU,CACf,GAAG,EACH,cAAc,CACZ,KAAK,CAAC;QACJ,OAAO;QACP,MAAM,EAAE,oBAAoB;QAC5B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,EAAE,IAAI;QACb,MAAM,EAAE,wDAAwD;QAChE,IAAI,EAAE,EAAE,cAAc,EAAE,MAAM,CAAC,IAAI,EAAE;KACtC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { type AgentProfile, type Stage } from "@clemrig/flow";
2
+ import type { AppDeclaration } from "../../../domain/app.js";
2
3
  /**
3
4
  * Every change since the plan, new files included, and the tree the review
4
5
  * reads; a large diff is read from a file, part by part.
@@ -14,6 +15,6 @@ export declare const diff: Stage<"ok">;
14
15
  * ran, goes to the gate as it is: checked against the previous review, it
15
16
  * would leave that review alone to repeat.
16
17
  */
17
- export declare function reviewer(profile: AgentProfile): Stage<"ok" | "modified">;
18
+ export declare function reviewer(profile: AgentProfile, app?: AppDeclaration): Stage<"ok" | "modified">;
18
19
  /** An unmet criterion or a blocking finding sends the change back, unless the operator accepted the review. */
19
20
  export declare const judgeReview: Stage<"approved" | "changes" | "invalid">;
@@ -2,7 +2,7 @@ import { agent, gate, step, z, } from "@clemrig/flow";
2
2
  import { largeChangeLines, reviewChanges, reviewOutput, reviewProblem, } from "../../../domain/review.js";
3
3
  import * as git from "../../../system/git.js";
4
4
  import { keepInRun } from "../../../system/run-files.js";
5
- import { browserContext, readers, reading } from "./agents.js";
5
+ import { browserContext, readers, reading, runningApp } from "./agents.js";
6
6
  import { facts, reviewRounds } from "./run.js";
7
7
  /**
8
8
  * A new conversation for each review, and for a review started again after it
@@ -57,7 +57,7 @@ function readReview(output, criteria) {
57
57
  * ran, goes to the gate as it is: checked against the previous review, it
58
58
  * would leave that review alone to repeat.
59
59
  */
60
- export function reviewer(profile) {
60
+ export function reviewer(profile, app) {
61
61
  const call = (context) => agent({ profile, schema: reviewOutput, session: reviewSession, context });
62
62
  const fresh = call(({ state }) => {
63
63
  const { slug, spec, changes, checks } = facts(state);
@@ -66,7 +66,7 @@ export function reviewer(profile) {
66
66
  const recheck = call(({ state }) => ({
67
67
  previous: facts(state).reviews?.at(-1),
68
68
  }));
69
- return reading(readers.review, {
69
+ return runningApp(app, reading(readers.review, {
70
70
  ...fresh,
71
71
  async run(context) {
72
72
  const first = await fresh.run(context);
@@ -79,7 +79,7 @@ export function reviewer(profile) {
79
79
  }
80
80
  return recheck.run(context);
81
81
  },
82
- });
82
+ }));
83
83
  }
84
84
  /** An unmet criterion or a blocking finding sends the change back, unless the operator accepted the review. */
85
85
  export const judgeReview = gate(["approved", "changes", "invalid"], async ({ state }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"review.js","sourceRoot":"","sources":["../../../../src/app/workflows/stages/review.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,IAAI,EAIJ,IAAI,EACJ,CAAC,GACF,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,gBAAgB,EAEhB,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,GAAG,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE/C;;;GAGG;AACH,SAAS,aAAa,CAAC,KAAyB;IAC9C,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzD,OAAO,UAAU,YAAY,CAAC,KAAK,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAC9E,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;IAC7D,MAAM,EAAE,UA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AAE,MAAM;SACb,CAAC;IACJ,IAAI,OAAO;QACT,OAAO;YACL,OAAO,EAAE,SAAS;YAClB,MAAM,EAAE,6BAA6B;YACrC,QAAQ,EAAE,OAAO;YACjB,IAAI,EAAE,MAAM;SACb,CAAC;IACJ,OAAO;QACL,OAAO,EAAE,UAAU;QACnB,MAAM,EAAE,2CAA2C;QACnD,IAAI,EAAE,MAAM;KACb,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -6,7 +6,7 @@ import type { Changes, Implementation, Review } from "../../../domain/review.js"
6
6
  import type { Criterion } from "../../../domain/spec.js";
7
7
  import type { KeptCheck } from "../../../system/run-files.js";
8
8
  /** What the workflows use: the factory requires the budget, a workflow also runs without one. */
9
- export type Settings = Pick<FactoryDefinition, "verify" | "profiles"> & {
9
+ export type Settings = Pick<FactoryDefinition, "verify" | "profiles" | "app"> & {
10
10
  maxCostUsd?: number;
11
11
  };
12
12
  /** What the stages record in the run's data, each once its stage has passed. */
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../../src/app/workflows/stages/run.ts"],"names":[],"mappings":"AAyDA,MAAM,UAAU,KAAK,CAAC,KAAyB;IAC7C,OAAO,KAAK,CAAC,IAAwB,CAAC;AACxC,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,YAAY,CAAC,EAAE,UAAU,EAAE,UAAU,EAAS;IAC5D,OAAO,UAAU,IAAI,UAAU,CAAC;AAClC,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,YAAY,CAAC,KAAyB;IACpD,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,MAAc;IAClC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAc,EAAE,EAAE,CACxC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../../src/app/workflows/stages/run.ts"],"names":[],"mappings":"AA4DA,MAAM,UAAU,KAAK,CAAC,KAAyB;IAC7C,OAAO,KAAK,CAAC,IAAwB,CAAC;AACxC,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,YAAY,CAAC,EAAE,UAAU,EAAE,UAAU,EAAS;IAC5D,OAAO,UAAU,IAAI,UAAU,CAAC;AAClC,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,YAAY,CAAC,KAAyB;IACpD,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,MAAc;IAClC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAc,EAAE,EAAE,CACxC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC"}
@@ -41,7 +41,9 @@ export function tidy(definition) {
41
41
  invalid: retry("plan", 2),
42
42
  }),
43
43
  "commit-plan": node(commitPlan, { ok: "implement" }),
44
- implement: node(implementer(profiles.implement), { ok: "implemented" }),
44
+ implement: node(implementer(profiles.implement, definition.app), {
45
+ ok: "implemented",
46
+ }),
45
47
  implemented: node(judgeImplementation, {
46
48
  ok: "verify",
47
49
  invalid: retry("implement", 2),
@@ -51,7 +53,7 @@ export function tidy(definition) {
51
53
  failed: retry("implement", 3),
52
54
  }),
53
55
  diff: node(diff, { ok: "review" }),
54
- review: node(reviewer(profiles.review), {
56
+ review: node(reviewer(profiles.review, definition.app), {
55
57
  ok: "reviewed",
56
58
  modified: retry("review", 1),
57
59
  }),
@@ -60,10 +62,7 @@ export function tidy(definition) {
60
62
  changes: retry("implement", 2),
61
63
  invalid: retry("review", 2),
62
64
  }),
63
- describe: node(describer(profiles.describe ?? profiles.review), {
64
- ok: "described",
65
- modified: retry("describe", 1),
66
- }),
65
+ describe: node(describer(profiles.describe ?? profiles.review, definition.app), { ok: "described", modified: retry("describe", 1) }),
67
66
  described: node(judgeDescription, {
68
67
  ok: "deliver",
69
68
  invalid: retry("describe", 2),
@@ -1 +1 @@
1
- {"version":3,"file":"tidy.js","sourceRoot":"","sources":["../../../src/app/workflows/tidy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EACL,UAAU,EACV,WAAW,EACX,OAAO,EACP,KAAK,EACL,MAAM,EACN,UAAU,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,MAAM,EACN,OAAO,EACP,SAAS,EACT,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,UAAoB;IACvC,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC;IAChC,OAAO,cAAc,CAAC;QACpB,IAAI,E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AAE,CAAC,CAAC;aAC9B,CAAC;YACF,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;YAClC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE;gBACtD,EAAE,EAAE,UAAU;gBACd,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;aAC7B,CAAC;YACF,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE;gBAC1B,QAAQ,EAAE,UAAU;gBACpB,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;gBAC9B,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;aAC5B,CAAC;YACF,QAAQ,EAAE,IAAI,CACZ,SAAS,CAAC,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,EAC/D,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CACpD;YACD,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE;gBAChC,EAAE,EAAE,SAAS;gBACb,OAAO,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;aAC9B,CAAC;YACF,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;YACvD,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC;SAClC;QACD,aAAa;QACb,8DAA8D;QAC9D,aAAa,EAAE,UAAU;KAC1B,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,27 @@
1
+ /** An executable, then its arguments; run without a shell, in the repository. */
2
+ type Command = [string, ...string[]];
3
+ /**
4
+ * The application the agents check a change in. The factory runs it for each
5
+ * execution of their stages, with data of its own, gives them its address and
6
+ * its variables, then stops it and removes its data. Its commands receive its
7
+ * variables: `FACTORY_APP`, a short identifier of its own that can name a
8
+ * database, each of its `ports`, then what its setup wrote. None of them may
9
+ * change the repository's files.
10
+ */
11
+ export interface AppDeclaration {
12
+ /**
13
+ * Prepares the application's data, such as a database created, migrated and
14
+ * seeded, then writes the variables the application needs, as `NAME=value`
15
+ * lines, in the file `FACTORY_APP_ENV` names.
16
+ */
17
+ setup?: Command;
18
+ /** Runs the application in the foreground until it is stopped, reloading the code as it changes. */
19
+ start: Command;
20
+ /** Removes what setup prepared, even when setup failed halfway. */
21
+ teardown?: Command;
22
+ /** Variables the factory gives each a free port, such as `WEB_PORT`. */
23
+ ports?: string[];
24
+ /** Where the application answers once it runs, from its variables, such as `({ WEB_PORT }) => "http://localhost:" + WEB_PORT`. */
25
+ url: (variables: Record<string, string>) => string;
26
+ }
27
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/domain/app.ts"],"names":[],"mappings":""}
@@ -1,6 +1,7 @@
1
1
  import { type AgentProfile, type Workflow } from "@clemrig/flow";
2
+ import type { AppDeclaration } from "./app.js";
2
3
  import type { VerifyCommand } from "./verification.js";
3
- /** What a repository decides: its checks, its budgets per run, its agents and its own workflows. */
4
+ /** What a repository decides: its checks, its budgets per run, its agents, its application and its own workflows. */
4
5
  export interface FactoryDefinition {
5
6
  verify: VerifyCommand[];
6
7
  maxCostUsd: number;
@@ -11,6 +12,8 @@ export interface FactoryDefinition {
11
12
  /** The agent that writes the pull request; the review's when absent. */
12
13
  describe?: AgentProfile;
13
14
  };
15
+ /** The application its agents check a change in; without it, they start it as the repository's instructions say. */
16
+ app?: AppDeclaration;
14
17
  /** The `tidy` workflow's settings. */
15
18
  tidy?: {
16
19
  /** Its budget per run; the `implement` run's when absent. */
@@ -1,12 +1,28 @@
1
1
  import { z } from "@clemrig/flow";
2
2
  // Profiles are validated by defineWorkflow: each declares the tools its agent may use.
3
3
  const profile = z.looseObject({});
4
+ /** The executable, then its arguments; run without a shell. */
5
+ const command = z.tuple([z.string().min(1)], z.string());
6
+ const app = z.strictObject({
7
+ setup: command.optional(),
8
+ start: command,
9
+ teardown: command.optional(),
10
+ ports: z
11
+ .array(z
12
+ .string()
13
+ .regex(/^[A-Za-z_]\w*$/, "Expected a variable name")
14
+ .refine((name) => !name.startsWith("FACTORY_APP"), "FACTORY_APP… variables are the factory's"))
15
+ .refine((names) => new Set(names).size === names.length, {
16
+ message: "Expected distinct variables",
17
+ })
18
+ .optional(),
19
+ url: z.custom((value) => typeof value === "function", "Expected a function of the application's variables"),
20
+ });
4
21
  const definition = z.strictObject({
5
22
  verify: z
6
23
  .array(z.strictObject({
7
24
  name: z.string().min(1),
8
- /** The executable, then its arguments; run without a shell. */
9
- command: z.tuple([z.string().min(1)], z.string()),
25
+ command,
10
26
  timeoutMs: z.number().int().positive(),
11
27
  /** Globs of the files whose change makes the check run, such as `scripts/*deploy*`. */
12
28
  when: z.array(z.string().min(1)).min(1).optional(),
@@ -19,6 +35,7 @@ const definition = z.strictObject({
19
35
  review: profile,
20
36
  describe: profile.optional(),
21
37
  }),
38
+ app: app.optional(),
22
39
  tidy: z
23
40
  .strictObject({ maxCostUsd: z.number().positive().optional() })
24
41
  .optional(),
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/domain/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,CAAC,EAAE,MAAM,eAAe,CAAC;AAuBpE,uFAAuF;AACvF,MAAM,OAAO,GAAG,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;AAElC,MAAM,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC;IAChC,MAAM,EAAE,CAAC;SACN,KAAK,CACJ,CAAC,CAAC,YAAY,CAAC;QACb,IAAI,EAAE,CAAC,CAAC,MAA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B,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE,CACvD,CAAC;AACR,CAAC"}
package/dist/index.d.ts CHANGED
@@ -6,5 +6,6 @@
6
6
  */
7
7
  export { type AgentProfile, agent, type Check, code, defineWorkflow, END, gate, type Log, node, ProcessInterruptedError, pick, type RunState, retry, runProcess, type Stage, type StageContext, type StageResult, schemaGate, step, type WorkflowDefinition, type WorkflowStep, z, } from "@clemrig/flow";
8
8
  export { type DefinedFactory, defineFactory } from "./app/define.js";
9
+ export type { AppDeclaration } from "./domain/app.js";
9
10
  export type { FactoryDefinition } from "./domain/definition.js";
10
11
  export type { VerifyCommand } from "./domain/verification.js";
@@ -0,0 +1,17 @@
1
+ import type { AppDeclaration } from "../domain/app.js";
2
+ /** The application of one agent stage's execution, once it answers. */
3
+ export interface RunningApp {
4
+ url: string;
5
+ /** Its output, its setup's and teardown's included. */
6
+ logs: string;
7
+ /** Its variables: its identifier, its ports, then what its setup wrote. */
8
+ env: Record<string, string>;
9
+ /** Stops it, then removes its data; what went wrong, for the journal. */
10
+ stop(): Promise<string[]>;
11
+ }
12
+ /**
13
+ * Prepares and starts the application in `dir`, its files in `runDir/app/`,
14
+ * and resolves once its url answers. A failure stops what started, removes
15
+ * what setup prepared, and gives the end of the application's log.
16
+ */
17
+ export declare function startApp(app: AppDeclaration, dir: string, runDir: string): Promise<RunningApp>;
@@ -0,0 +1,147 @@
1
+ import { randomBytes } from "node:crypto";
2
+ import { appendFile, mkdir, readFile, rm } from "node:fs/promises";
3
+ import { createServer } from "node:net";
4
+ import { join } from "node:path";
5
+ import { parseEnv } from "node:util";
6
+ import { ProcessInterruptedError, runCommand, } from "@clemrig/flow";
7
+ const SETUP_TIMEOUT_MS = 10 * 60_000;
8
+ const READY_TIMEOUT_MS = 5 * 60_000;
9
+ const TEARDOWN_TIMEOUT_MS = 5 * 60_000;
10
+ /** Time for the application to close its connections before its data goes. */
11
+ const STOP_GRACE_MS = 5_000;
12
+ /** Ports free at once on this machine, one for each name. */
13
+ async function freePorts(names) {
14
+ const servers = [];
15
+ try {
16
+ const ports = await Promise.all(names.map(() => new Promise((resolve, reject) => {
17
+ const server = createServer();
18
+ servers.push(server);
19
+ server.once("error", reject);
20
+ server.listen(0, "127.0.0.1", () => resolve(server.address().port));
21
+ })));
22
+ return Object.fromEntries(names.map((name, index) => [name, String(ports[index])]));
23
+ }
24
+ finally {
25
+ // Held together until each is chosen, so that no two names get the same.
26
+ await Promise.all(servers.map((server) => new Promise((resolve) => server.close(resolve))));
27
+ }
28
+ }
29
+ /** The end of the application's log, for a failure's message. */
30
+ async function tail(logs) {
31
+ const text = await readFile(logs, "utf8").catch(() => "");
32
+ return text.trim().split("\n").slice(-20).join("\n").slice(-4000);
33
+ }
34
+ const message = (error) => error instanceof Error ? error.message : String(error);
35
+ /** Whether the url answers in HTTP, whatever its status. */
36
+ const answers = (url) => fetch(url, { redirect: "manual", signal: AbortSignal.timeout(2_000) }).then(() => true, () => false);
37
+ /**
38
+ * Prepares and starts the application in `dir`, its files in `runDir/app/`,
39
+ * and resolves once its url answers. A failure stops what started, removes
40
+ * what setup prepared, and gives the end of the application's log.
41
+ */
42
+ export async function startApp(app, dir, runDir) {
43
+ const id = randomBytes(4).toString("hex");
44
+ const folder = join(runDir, "app");
45
+ await mkdir(folder, { recursive: true });
46
+ const logs = join(folder, `${id}.log`);
47
+ const written = join(folder, `${id}.env`);
48
+ const own = { FACTORY_APP: id, ...(await freePorts(app.ports ?? [])) };
49
+ let env = own;
50
+ /** Runs a command of the application with its variables, its output in the log. */
51
+ const step = async (name, command, bound, extra = {}) => {
52
+ await appendFile(logs, `# ${name}: ${command.join(" ")}\n`);
53
+ return runCommand(command, {
54
+ cwd: dir,
55
+ env: { ...env, ...extra },
56
+ output: logs,
57
+ stopGraceMs: STOP_GRACE_MS,
58
+ ...bound,
59
+ });
60
+ };
61
+ /** Removes what setup prepared; why it could not, if it could not. */
62
+ const teardown = async () => {
63
+ if (!app.teardown)
64
+ return undefined;
65
+ try {
66
+ const { exitCode } = await step("teardown", app.teardown, {
67
+ timeoutMs: TEARDOWN_TIMEOUT_MS,
68
+ });
69
+ if (exitCode === 0)
70
+ return undefined;
71
+ return `Could not remove the application's data: its teardown exited with code ${exitCode}\n${await tail(logs)}`;
72
+ }
73
+ catch (error) {
74
+ return `Could not remove the application's data: ${message(error)}`;
75
+ }
76
+ };
77
+ /** Fails with what went wrong, once what setup prepared is removed. */
78
+ const fail = async (problem) => {
79
+ const left = await teardown();
80
+ throw new Error([problem, await tail(logs), ...(left ? [left] : [])].join("\n"));
81
+ };
82
+ if (app.setup) {
83
+ const failed = await step("setup", app.setup, { timeoutMs: SETUP_TIMEOUT_MS }, { FACTORY_APP_ENV: written }).then(({ exitCode }) => exitCode === 0
84
+ ? undefined
85
+ : `The application's setup exited with code ${exitCode}`, (error) => `The application's setup failed: ${message(error)}`);
86
+ const given = await readFile(written, "utf8").catch(() => "");
87
+ await rm(written, { force: true });
88
+ // What setup wrote reaches its teardown even when it failed; the
89
+ // identifier and the ports are the factory's.
90
+ env = { ...parseEnv(given), ...own };
91
+ if (failed)
92
+ return fail(failed);
93
+ }
94
+ let url;
95
+ try {
96
+ url = app.url(env);
97
+ }
98
+ catch (error) {
99
+ return fail(`The application's url failed: ${message(error)}`);
100
+ }
101
+ if (!/^https?:\/\/[^/]/.test(url))
102
+ return fail(`The application's url is not an http:// or https:// address: ${url}`);
103
+ const controller = new AbortController();
104
+ /** Why the application stopped before it was asked to. */
105
+ let ended;
106
+ /** Stopped with the run's other processes by a Ctrl-C, not by itself. */
107
+ let interrupted = false;
108
+ const running = step("start", app.start, { signal: controller.signal }).then(({ stopped, exitCode }) => {
109
+ if (!stopped)
110
+ ended = `it exited with code ${exitCode}`;
111
+ }, (error) => {
112
+ interrupted = error instanceof ProcessInterruptedError;
113
+ ended = message(error);
114
+ });
115
+ const stopped = async () => {
116
+ controller.abort();
117
+ await running;
118
+ };
119
+ const deadline = Date.now() + READY_TIMEOUT_MS;
120
+ while (!(await answers(url))) {
121
+ if (ended !== undefined || Date.now() >= deadline) {
122
+ const why = ended
123
+ ? `The application stopped before answering at ${url}: ${ended}`
124
+ : `The application did not answer at ${url} within ${READY_TIMEOUT_MS / 60_000} minutes`;
125
+ await stopped();
126
+ return fail(why);
127
+ }
128
+ await new Promise((resolve) => setTimeout(resolve, 500));
129
+ }
130
+ return {
131
+ url,
132
+ logs,
133
+ env,
134
+ async stop() {
135
+ const during = interrupted ? undefined : ended;
136
+ await stopped();
137
+ const left = await teardown();
138
+ return [
139
+ ...(during
140
+ ? [`The application stopped during the call: ${during}`]
141
+ : []),
142
+ ...(left ? [left] : []),
143
+ ];
144
+ },
145
+ };
146
+ }
147
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/system/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAoB,YAAY,EAAe,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EACL,uBAAuB,EAEvB,UAAU,GACX,MAAM,eAAe,CAAC;AAGvB,MAAM,gBAAgB,GAAG,EAAE,GAAG,MAAM,CAAC;AACrC,MAAM,gBAAgB,GAAG,CAAC,GAAG,MAAM,CAAC;AACpC,MAAM,mBAAmB,GAAG,CAAC,GAAG,MAAM,CAAC;AACvC,8EAA8E;AAC9E,MAAM,aAAa,GAAG,KAAK,CAAC;AAa5B,6DAA6D;AAC7D,KAAK,UAAU,SAAS,CAAC,KAAe;IACtC,MAAM,OAAO,GAA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GAAG;QACH,IAAI;QACJ,GAAG;QACH,KAAK,CAAC,IAAI;YACR,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;YAC/C,MAAM,OAAO,EAAE,CAAC;YAChB,MAAM,IAAI,GAAG,MAAM,QAAQ,EAAE,CAAC;YAC9B,OAAO;gBACL,GAAG,CAAC,MAAM;oBACR,CAAC,CAAC,CAAC,4CAA4C,MAAM,EAAE,CAAC;oBACxD,CAAC,CAAC,EAAE,CAAC;gBACP,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aACxB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clemrig/factory",
3
- "version": "0.16.0",
3
+ "version": "0.18.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.3.0",
43
- "@clemrig/flow": "0.10.0",
44
- "@clemrig/flow-ui": "0.10.0"
43
+ "@clemrig/flow": "0.11.0",
44
+ "@clemrig/flow-ui": "0.12.0"
45
45
  }
46
46
  }
@@ -59,13 +59,16 @@ else. The pull request's body must stay under 60,000 characters.
59
59
 
60
60
  ## Screenshots
61
61
 
62
- When the change shows in a web interface, take screenshots of its new state: the screens and states a reviewer
63
- must see. Start the application as the repository's instructions say. Use the request's `browser` when it gives
64
- one, a command line (run it with `--help` first), or else the browser tools you have. Do not change data you did
65
- not create: to show a state, use what the repository's instructions provide for tests, or create your own data.
66
- Save each image in the folder `screenshots` names, then give its file name, starting with a letter or a digit and
67
- made of letters, digits, `.`, `-` and `_`, and its caption, in a sentence: PNG, JPEG, GIF or WebP, 10 MB at most,
68
- 50 at most, each a file of its own. Stop everything you started, servers and browsers, before you answer.
62
+ When the change shows in a web interface, take screenshots of its new state: the screens and states a reviewer must
63
+ see. When the request gives `app`, the application already runs this working tree at `app.url`, with data of its own
64
+ that you may change freely to show a state and that is removed once you answer; its output is in the file
65
+ `app.logs`, and your commands run with its variables, so that they reach its data: start or stop no server.
66
+ Otherwise, start the application as the repository's instructions say, and do not change data you did not create: to
67
+ show a state, use what the repository's instructions provide for tests, or create your own data. Use the request's
68
+ `browser` when it gives one, a command line (run it with `--help` first), or else the browser tools you have. Save
69
+ each image in the folder `screenshots` names, then give its file name, starting with a letter or a digit and made of
70
+ letters, digits, `.`, `-` and `_`, and its caption, in a sentence: PNG, JPEG, GIF or WebP, 10 MB at most, 50 at
71
+ most, each a file of its own. Stop everything you started, servers and browsers, before you answer.
69
72
 
70
73
  When `repository.public` is true, anyone can see these images: show only test or seed data, never a secret, a
71
74
  token or a person's data; when you cannot, take none and say why.
@@ -11,11 +11,14 @@ handle and test besides its main path. When the code shows a better way than a s
11
11
  in `deviations`. Implement the spec through the plan, tests included, and run the relevant checks yourself before
12
12
  answering.
13
13
 
14
- When the change shows in a web interface, check it in a browser before answering. Start the application as the
15
- repository's instructions say. Use the request's `browser` when it gives one, a command line (run it with `--help`
16
- first), or else the browser tools you have. Do not change data you did not create: when the application needs
17
- data, use what the repository's instructions provide for tests, or create your own. Stop everything you started,
18
- servers and browsers, before you answer.
14
+ When the change shows in a web interface, check it in a browser before answering. When the request gives `app`, the
15
+ application already runs this working tree at `app.url`, with data of its own that you may change freely and that is
16
+ removed once you answer; its output is in the file `app.logs`, and your commands run with its variables, so that
17
+ they reach its data: start or stop no server. Otherwise, start the application as the repository's instructions say,
18
+ and do not change data you did not create: when the application needs data, use what the repository's instructions
19
+ provide for tests, or create your own. Use the request's `browser` when it gives one, a command line (run it with
20
+ `--help` first), or else the browser tools you have. Stop everything you started, servers and browsers, before you
21
+ answer.
19
22
 
20
23
  Never commit, switch branches or push: the run commits, pushes and opens the pull request itself, and it stops
21
24
  if you commit or switch branches.
package/prompts/review.md CHANGED
@@ -29,23 +29,26 @@ path that takes the same locks, every transition of the same mechanism. Report i
29
29
  it is fixed everywhere at once; when several defects come from one mechanism, report the mechanism, with the
30
30
  defects as its occurrences: the fix belongs there, not in a guard per case.
31
31
 
32
- If you can run commands, run what helps you judge: targeted tests, the scripts the change adds, small
33
- reproductions. When the change shows in a web interface, check it in a browser: start the application as the
34
- repository's instructions say, and use the request's `browser` when it gives one, a command line (run it with
35
- `--help` first), or else the browser tools you have. Do not change data you did not create: when the application
36
- needs data, use what the repository's instructions provide for tests, or create your own. Write temporary files
37
- only in the system's temporary directory, and stop everything you started, servers and browsers, before you
38
- answer. Never modify, stage, commit or delete anything in the repository: the run compares it before and after
39
- your review, restores what changed and starts the review again.
40
-
41
- When the change is large (`large` is true), or spans several applications or layers, and you can launch
42
- sub-agents, split the whole review between them for your first answer, five at most, and review no part yourself:
43
- a part you keep while you coordinate the others gets less attention than theirs. Each takes one part of the
44
- change, such as an application, a layer or a feature, with its checks in a browser when it shows in a web
45
- interface; one more, always, takes the paths that cross the parts: failures, interruptions, concurrent requests and
46
- recoveries. Give each the spec, its part, the files concerned and where to read the diff, and tell it to report its
47
- findings with their evidence, established as above, to look for each defect's other occurrences, to change nothing
48
- and to launch no agent itself. Check their reports, then give one answer for the whole change.
32
+ If you can run commands, run what helps you judge: targeted tests, the scripts the change adds, small reproductions.
33
+ When the change shows in a web interface, check it in a browser: the request's `browser` when it gives one, a
34
+ command line (run it with `--help` first), or else the browser tools you have. When the request gives `app`, the
35
+ application already runs this working tree at `app.url`, with data of its own that you may change freely and that is
36
+ removed once you answer; its output is in the file `app.logs`, and your commands run with its variables, so that
37
+ they reach its data: start or stop no server. Otherwise, start the application as the repository's instructions say,
38
+ and do not change data you did not create: when the application needs data, use what the repository's instructions
39
+ provide for tests, or create your own. Write temporary files only in the system's temporary directory, and stop
40
+ everything you started, servers and browsers, before you answer. Never modify, stage, commit or delete anything in
41
+ the repository: the run compares it before and after your review, restores what changed and starts the review again.
42
+
43
+ When the change is large (`large` is true), or spans several applications or layers, and you can launch sub-agents,
44
+ split the whole review between them for your first answer, five at most, and review no part yourself: a part you
45
+ keep while you coordinate the others gets less attention than theirs. Each takes one part of the change, such as an
46
+ application, a layer or a feature, with its checks in a browser when it shows in a web interface; one more, always,
47
+ takes the paths that cross the parts: failures, interruptions, concurrent requests and recoveries. Give each the
48
+ spec, its part, the files concerned, where to read the diff, and the request's `app` and `browser` when it gives
49
+ them, with the rules above on servers and data, and tell it to report its findings with their evidence, established
50
+ as above, to look for each defect's other occurrences, to change nothing and to launch no agent itself. Check their
51
+ reports, then give one answer for the whole change.
49
52
 
50
53
  Answer with:
51
54