foldrun 26.7.1 → 26.8.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/bin/foldrun.mjs +1 -1
- package/docs/cli.md +1 -1
- package/package.json +2 -2
- package/src/commands.mjs +104 -16
package/bin/foldrun.mjs
CHANGED
|
@@ -121,7 +121,7 @@ const HELP = `foldrun — agents are just folders
|
|
|
121
121
|
foldrun check --to <ws> --online also the network checks, run by the platform: known vulnerabilities for exact runtime pins (OSV) and remote MCP servers' tool text — and what could not be checked
|
|
122
122
|
foldrun agent run <name> run one agent once on the platform (--task "…", --to, --wait, --test, --context <id>, --file <path> repeatable)
|
|
123
123
|
foldrun agent run <name> --snapshot [dir|id] …on a folder: sent first (what git would commit, checked for secrets), the agent works on it in snapshot/, and the patch of its changes is on the run (foldrun report <run-id> patch)
|
|
124
|
-
foldrun code [dir] code with an agent on the platform: each message sends the folder (a snapshot), the agent works on it in its own sandbox, and you apply the patch it hands back after git apply --check (--to — made, with its coder agent, after a yes when it does not exist; --agent <name> (default coder, added on first use with a yes), --task "…" one turn and exit, --yes apply without asking, --test, --context <id
|
|
124
|
+
foldrun code [dir] code with an agent on the platform: each message sends the folder (a snapshot), the agent works on it in its own sandbox, and you apply the patch it hands back after git apply --check (--to — made, with its coder agent, after a yes when it does not exist; --agent <name> (default coder, added on first use with a yes), --task "…" one turn and exit, --yes apply without asking, --test, --context <id>, --verbose the platform's notes on each step too)
|
|
125
125
|
foldrun agent run <name> --no-task run it with no instruction, on its own prompt alone — the dashboard's Run (--to, --wait, --test)
|
|
126
126
|
foldrun agent link <agent> add to its team, in its frontmatter: --subagent <worker> (--isolated: sandbox: own on the worker), --consult <agent> or --can-ask (--description for a worker with none)
|
|
127
127
|
foldrun agent unlink <agent> take one away: --subagent <name>, --consult <name> or --can-ask
|
package/docs/cli.md
CHANGED
|
@@ -136,7 +136,7 @@ claude.ai or Claude Code there, nor any MCP configuration on disk.
|
|
|
136
136
|
| `foldrun export [workspace]` | a deployed project as a `.zip` — agents, flows, tools, skills, scripts, evals, knowledge; never memory, state, storage or a secret's value. `--flow <name>` exports that flow with every flow and agent it runs and the tools, skills and scripts they grant; `--agent <name>` that agent and what it grants. Written under the name the platform gives it (`<ws>.zip`, `<ws>-flow-<name>.zip`); `--file <path>` (`-` for stdout), `--force` to replace (`GET …/export`) |
|
|
137
137
|
| `foldrun import <file.zip>` | take a package in: first shows what it adds, what is identical, what it would replace and what it still needs (secrets, tools, skills, scripts, agents, flows), then asks. Never deletes; replacing a file needs `--overwrite`. `--to <workspace>` (a name that does not exist makes it, from a project package), `--dry-run` previews only (`--json` for the plan), `--yes` with no terminal (`POST …/import`) |
|
|
138
138
|
| `foldrun snapshot push [dir]` | send a folder for an agent on foldrun to work on (a snapshot). What goes is what git would commit — tracked files and untracked ones `.gitignore` does not exclude, as they are on disk; links and submodules are left out and named. A secret in any file stops it before anything leaves the machine (remove it, or leave the file out with `.gitignore`); the platform checks again. Answers the snapshot id, kept 7 days from the last send and while a run uses it. `--to <workspace>`, `--dry-run` packs and checks only, `--out <file.tar.gz>` keeps the archive (`--force` over a file that is there), `--json` (`POST …/snapshots`) |
|
|
139
|
-
| `foldrun code [dir]` | code with an agent that works in a sandbox on the platform, not on this computer — see [Coding in a sandbox](#coding-in-a-sandbox). Each message sends the folder as a snapshot (as `snapshot push` does), runs the agent on it in its own sandbox as a turn of one conversation, prints what it does as it does it, and offers the patch it hands back: `git apply --check`, git's stat, a yes, then `git apply`. Ctrl-C stops the run; `/new` starts a fresh conversation, `/quit` leaves. `--to <workspace>` (a project that does not exist is made, blank with its `coder` agent, after a yes), `--agent <name>` (default `coder`, added to the project on first use after a yes), `--task "…"` one turn and exit (for scripts), `--yes` applies without asking (required with no terminal), `--test`, `--context <id
|
|
139
|
+
| `foldrun code [dir]` | code with an agent that works in a sandbox on the platform, not on this computer — see [Coding in a sandbox](#coding-in-a-sandbox). Each message sends the folder as a snapshot (as `snapshot push` does), runs the agent on it in its own sandbox as a turn of one conversation, prints what it does as it does it (its tool calls and words, and any refusal or failure; the platform's other notes on the step stay on the run page, `--verbose` shows them too), and offers the patch it hands back: `git apply --check`, git's stat, a yes, then `git apply`. Ctrl-C stops the run; `/new` starts a fresh conversation, `/quit` leaves. `--to <workspace>` (a project that does not exist is made, blank with its `coder` agent, after a yes), `--agent <name>` (default `coder`, added to the project on first use after a yes), `--task "…"` one turn and exit (for scripts), `--yes` applies without asking (required with no terminal), `--test`, `--context <id>`, `--verbose` |
|
|
140
140
|
| `foldrun status [workspace]` | per workspace: what is added, changed and only-on-the-platform, plus which files moved there since your last deploy from here. Reads only |
|
|
141
141
|
| `foldrun status --platform` | is the platform up: overall, each component (dashboard and API, run workers, scheduler, model providers, email, storage) and any incident or maintenance the operator posted, with its latest update. Reads the open `/api/status` — no key needed; the signed-in platform, `--url` / `FOLDRUN_URL`, or the default, dash.foldrun.io. `--json` prints the answer as is. Exits 1, saying *status unavailable — the platform may be down*, when it does not answer. Plain `foldrun status` opens with the same one-line verdict |
|
|
142
142
|
| `foldrun status --platform --history` | what the status page draws as bars: each component's uptime over the window and a mark per day — up, degraded or maintenance, an outage, or no samples — then the incidents and maintenance in it, from the open `GET /api/status/history?days=<n>`. `--days 1-90` (default 90), `--json` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldrun",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.8.0",
|
|
4
4
|
"description": "Agents are just folders. Write them, check them, run them — on your machine.",
|
|
5
5
|
"license": "FSL-1.1-ALv2",
|
|
6
6
|
"type": "module",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"node": ">=22"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@foldrun/core": "^24.3.
|
|
14
|
+
"@foldrun/core": "^24.3.1"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"bin",
|
package/src/commands.mjs
CHANGED
|
@@ -2741,21 +2741,95 @@ function eventLine(e, rawAgent, open) {
|
|
|
2741
2741
|
* tool call is two events — one line per call, printed when it completes.
|
|
2742
2742
|
* `open` carries the calls still in flight across polls and reconnects.
|
|
2743
2743
|
*/
|
|
2744
|
-
function printNew(run, seen, open = new Map(), { skipResult = false } = {}) {
|
|
2744
|
+
export function printNew(run, seen, open = new Map(), { skipResult = false, quiet = false } = {}) {
|
|
2745
2745
|
// skipResult: the caller prints the last top-level step's reply in full
|
|
2746
2746
|
// afterwards (foldrun code), so that one step's reply line is not printed
|
|
2747
|
-
// twice; any other step's (a sub-agent's) stays (Codex).
|
|
2747
|
+
// twice; any other step's (a sub-agent's) stays (Codex). While the run is
|
|
2748
|
+
// live the step has no result yet to compare with, so that step's newest
|
|
2749
|
+
// text is HELD until something follows it: a tool call after it means it
|
|
2750
|
+
// was a remark on the way and it is printed; the run ending with it means
|
|
2751
|
+
// it is the reply (dropHeldReply) — 19 Nov 2026, the reply showed twice.
|
|
2752
|
+
// quiet (foldrun code): the platform's own notes on the step (`info`:
|
|
2753
|
+
// clock, credential, isolation, network, dns, timing, egress …) are left
|
|
2754
|
+
// to the run page; tool calls, the agent's words and errors stay.
|
|
2755
|
+
// An info note is not "something after" the held text: it neither
|
|
2756
|
+
// releases it (a trailing note would print the reply before its result,
|
|
2757
|
+
// then the caller again — Codex) nor, when quiet, shows at all — except a
|
|
2758
|
+
// note that something was refused (a `limits:` refusal is an info note,
|
|
2759
|
+
// and the user must see why a call did not run — Codex).
|
|
2748
2760
|
const own = run.steps.filter((x) => !x.subagentOf);
|
|
2749
2761
|
const replying = skipResult ? own.at(-1) : undefined;
|
|
2762
|
+
const held = heldText(seen);
|
|
2763
|
+
// Steps are visited in order, not in time: an older event of a later step
|
|
2764
|
+
// (a sub-agent's, unseen until this frame) must not release a parent's
|
|
2765
|
+
// newer text — that text may be the reply, whose result is still to come
|
|
2766
|
+
// (Codex). Events carry `t`; without one, the event releases.
|
|
2767
|
+
const release = (by) => {
|
|
2768
|
+
for (const [j, h] of held) {
|
|
2769
|
+
if (by?.t && h.t && String(by.t) < String(h.t)) continue;
|
|
2770
|
+
console.log(eventLine(h, run.steps[j]?.agent, open));
|
|
2771
|
+
held.delete(j);
|
|
2772
|
+
}
|
|
2773
|
+
};
|
|
2774
|
+
// One frame's new events, from every step, in the order they happened
|
|
2775
|
+
// (`t`; stable, so events with no time keep step order): a sub-agent's
|
|
2776
|
+
// call between two of the parent's remarks prints between them (Codex).
|
|
2777
|
+
const fresh = [];
|
|
2750
2778
|
run.steps.forEach((step, i) => {
|
|
2751
2779
|
const from = seen.get(i) ?? 0;
|
|
2752
|
-
|
|
2753
|
-
if (step === replying && e.type === "text" && step.result && String(e.text).trim() === String(step.result).trim()) continue;
|
|
2754
|
-
const line = eventLine(e, step.agent, open);
|
|
2755
|
-
if (line !== null) console.log(line);
|
|
2756
|
-
}
|
|
2780
|
+
step.events.slice(from).forEach((e) => fresh.push({ i, step, e }));
|
|
2757
2781
|
seen.set(i, step.events.length);
|
|
2758
2782
|
});
|
|
2783
|
+
if (fresh.every((x) => x.e.t)) fresh.sort((a, b) => (String(a.e.t) < String(b.e.t) ? -1 : String(a.e.t) > String(b.e.t) ? 1 : 0));
|
|
2784
|
+
for (const { i, step, e } of fresh) {
|
|
2785
|
+
const note = e.type === "info";
|
|
2786
|
+
if (note && quiet && !REFUSED_NOTE.test(String(e.text ?? ""))) continue;
|
|
2787
|
+
if (step === replying && e.type === "text") {
|
|
2788
|
+
if (step.result && String(e.text).trim() === String(step.result).trim()) continue;
|
|
2789
|
+
release();
|
|
2790
|
+
held.set(i, { ...e, __agent: step.agent });
|
|
2791
|
+
continue;
|
|
2792
|
+
}
|
|
2793
|
+
// Anything else that is not a note — a tool call, an error, any other
|
|
2794
|
+
// step's words (a sub-agent's) — came after the held text: it shows first.
|
|
2795
|
+
if (!note) release(e);
|
|
2796
|
+
const line = eventLine(e, step.agent, open);
|
|
2797
|
+
if (line !== null) console.log(line);
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
/** An info note that something was refused or went wrong (a `limits:`
|
|
2802
|
+
* refusal, "browser pod: reconnect failed …"): shown even in the quiet view. */
|
|
2803
|
+
const REFUSED_NOTE = /\b(refused|denied|blocked|failed|failure|error|lost|timed out)\b/i;
|
|
2804
|
+
|
|
2805
|
+
/** Whatever text is still held is printed: the turn is ending another way
|
|
2806
|
+
* (an error, a second Ctrl-C), so no reply follows it (Codex). */
|
|
2807
|
+
export function flushHeld(seen, open) {
|
|
2808
|
+
if (!seen) return;
|
|
2809
|
+
const held = heldText(seen);
|
|
2810
|
+
for (const [, h] of held) console.log(eventLine(h, h.__agent ?? "", open ?? new Map()));
|
|
2811
|
+
held.clear();
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
/** printNew's held text, per step, kept beside `seen` across polls and reconnects. */
|
|
2815
|
+
const HELD = new WeakMap();
|
|
2816
|
+
/** @param {Map<number, number>} seen */
|
|
2817
|
+
function heldText(seen) {
|
|
2818
|
+
let m = HELD.get(seen);
|
|
2819
|
+
if (!m) HELD.set(seen, (m = new Map()));
|
|
2820
|
+
return m;
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2823
|
+
/** The run is over: a held text that is not the reply printed after it is
|
|
2824
|
+
* printed now (the reply itself is not printed twice). */
|
|
2825
|
+
export function dropHeldReply(run, seen, open) {
|
|
2826
|
+
const held = heldText(seen);
|
|
2827
|
+
const own = (run.steps ?? []).filter((x) => !x.subagentOf);
|
|
2828
|
+
const reply = String(own.at(-1)?.result ?? "").trim();
|
|
2829
|
+
for (const [i, e] of held) {
|
|
2830
|
+
if (String(e.text).trim() !== reply) console.log(eventLine(e, run.steps[i]?.agent, open));
|
|
2831
|
+
}
|
|
2832
|
+
held.clear();
|
|
2759
2833
|
}
|
|
2760
2834
|
|
|
2761
2835
|
/** The stream is over: print a start line for each call that never completed. */
|
|
@@ -2899,10 +2973,10 @@ async function streamOnce(url, flags, ws, runId, seen, open = new Map(), print =
|
|
|
2899
2973
|
* from printing twice. It used to block `invoke --watch` and `logs
|
|
2900
2974
|
* --follow` for as long as a stalled tunnel cared to keep the socket.
|
|
2901
2975
|
*/
|
|
2902
|
-
async function followRemote(url, flags, ws, runId, seen = new Map(), open = new Map(), { holdOpen = false, skipResult = false } = {}) {
|
|
2976
|
+
async function followRemote(url, flags, ws, runId, seen = new Map(), open = new Map(), { holdOpen = false, skipResult = false, quiet = false } = {}) {
|
|
2903
2977
|
for (let attempt = 1; ; attempt++) {
|
|
2904
2978
|
try {
|
|
2905
|
-
const run = await streamOnce(url, flags, ws, runId, seen, open, { skipResult });
|
|
2979
|
+
const run = await streamOnce(url, flags, ws, runId, seen, open, { skipResult, quiet });
|
|
2906
2980
|
// holdOpen: the caller reads the run once more when the stream ended
|
|
2907
2981
|
// with it still live, and flushes after — a start flushed here would
|
|
2908
2982
|
// print a second time when that read brings its completion (Codex).
|
|
@@ -2911,7 +2985,7 @@ async function followRemote(url, flags, ws, runId, seen = new Map(), open = new
|
|
|
2911
2985
|
} catch (err) {
|
|
2912
2986
|
if (!(err instanceof StreamIdle)) throw err;
|
|
2913
2987
|
const run = await remoteCall(url, flags, `/api/workspaces/${ws}/runs/${runId}`);
|
|
2914
|
-
printNew(run, seen, open, { skipResult });
|
|
2988
|
+
printNew(run, seen, open, { skipResult, quiet });
|
|
2915
2989
|
if (!isLive(run)) {
|
|
2916
2990
|
flushCalls(open);
|
|
2917
2991
|
return run;
|
|
@@ -12855,6 +12929,7 @@ async function codeTurn(s, task) {
|
|
|
12855
12929
|
return;
|
|
12856
12930
|
}
|
|
12857
12931
|
if (cancel.asked && cancel.stop === "acked") {
|
|
12932
|
+
flushHeld(seen, open);
|
|
12858
12933
|
console.log(`\n ${c.dim(`left — the platform took the stop for ${cancel.runId}`)}`);
|
|
12859
12934
|
process.exit(130);
|
|
12860
12935
|
}
|
|
@@ -12873,6 +12948,10 @@ async function codeTurn(s, task) {
|
|
|
12873
12948
|
process.on("SIGINT", onInt);
|
|
12874
12949
|
let run;
|
|
12875
12950
|
let runId;
|
|
12951
|
+
/** @type {Map<number, number> | null} */
|
|
12952
|
+
let seen = null;
|
|
12953
|
+
/** @type {Map<string, unknown> | null} */
|
|
12954
|
+
let open = null;
|
|
12876
12955
|
try {
|
|
12877
12956
|
const { packed, left, unscanned, summary } = await packFolder(dir);
|
|
12878
12957
|
if (cancel.asked) return "cancelled";
|
|
@@ -12902,14 +12981,16 @@ async function codeTurn(s, task) {
|
|
|
12902
12981
|
if (cancel.asked) stop(); // pressed while the run was being started
|
|
12903
12982
|
console.log(` ${c.dim(`run ${plainText(runId)}${started.test ? " (test)" : ""} — Ctrl-C stops it; the dashboard shows it live`)}\n`);
|
|
12904
12983
|
run = await remoteCall(url, flags, `/api/workspaces/${enc(ws)}/runs/${enc(runId)}`);
|
|
12905
|
-
|
|
12906
|
-
|
|
12907
|
-
|
|
12908
|
-
|
|
12984
|
+
seen = new Map();
|
|
12985
|
+
open = new Map();
|
|
12986
|
+
const view = { skipResult: true, quiet: flags.verbose !== true };
|
|
12987
|
+
printNew(run, seen, open, view);
|
|
12988
|
+
if (isLive(run)) run = (await followRemote(url, flags, ws, runId, seen, open, { holdOpen: true, ...view })) ?? run;
|
|
12909
12989
|
if (isLive(run)) {
|
|
12910
12990
|
run = await remoteCall(url, flags, `/api/workspaces/${enc(ws)}/runs/${enc(runId)}`);
|
|
12911
|
-
printNew(run, seen, open,
|
|
12991
|
+
printNew(run, seen, open, view);
|
|
12912
12992
|
}
|
|
12993
|
+
dropHeldReply(run, seen, open);
|
|
12913
12994
|
flushCalls(open);
|
|
12914
12995
|
cancel.phase = "patch";
|
|
12915
12996
|
|
|
@@ -12941,6 +13022,9 @@ async function codeTurn(s, task) {
|
|
|
12941
13022
|
}
|
|
12942
13023
|
return run.status;
|
|
12943
13024
|
} finally {
|
|
13025
|
+
// The success path has printed or dropped any held text already; an
|
|
13026
|
+
// error on the way out has not (Codex).
|
|
13027
|
+
flushHeld(seen, open);
|
|
12944
13028
|
// A stop still on its way is waited for on every way out — a thrown
|
|
12945
13029
|
// follower included — so the turn never ends before the platform was
|
|
12946
13030
|
// told, and says so when it cannot tell (Codex).
|
|
@@ -12972,7 +13056,11 @@ async function codeTurn(s, task) {
|
|
|
12972
13056
|
*/
|
|
12973
13057
|
async function codeCmd(positional, flags, layout) {
|
|
12974
13058
|
const dir = path.resolve(positional[0] ?? ".");
|
|
12975
|
-
if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory())
|
|
13059
|
+
if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) {
|
|
13060
|
+
// `foldrun code to my-project` (19 Nov 2026, a tester): the dashes left off.
|
|
13061
|
+
if (positional[0] === "to" && positional[1]) throw new Error(`${dir} is not a folder — did you mean \`foldrun code --to ${positional[1]}\`?`);
|
|
13062
|
+
throw new Error(`${dir} is not a folder`);
|
|
13063
|
+
}
|
|
12976
13064
|
if (spawnSync("git", ["-C", dir, "rev-parse", "--show-toplevel"], { encoding: "utf8" }).status !== 0) {
|
|
12977
13065
|
throw new Error(`${dir} is not in a git repository — foldrun code sends what git would commit and applies the agent's patch with git, so \`git init\` it first`);
|
|
12978
13066
|
}
|