cruo-agent 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/VERSION +1 -1
- package/dist/cli.js +44 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -110,7 +110,7 @@ given up on work nobody abandoned.
|
|
|
110
110
|
| `--worktree` | a checkout per card |
|
|
111
111
|
| `--allow <tools>` | what the harness may use |
|
|
112
112
|
| `--push` | publish the branch after a run that commits |
|
|
113
|
-
| `--harness-timeout <seconds>` | kill a run that wedges (default
|
|
113
|
+
| `--harness-timeout <seconds>` | kill a run that wedges (default 3000 — 50 minutes; keep it under an hour, which is how long a run's board session lasts) |
|
|
114
114
|
| `--max-attempts <n>` | give up on a card after n unproductive runs (default 3) |
|
|
115
115
|
|
|
116
116
|
The full list, and what each is for: <https://cruo.space/docs#agents>
|
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.14
|
package/dist/cli.js
CHANGED
|
@@ -46117,6 +46117,22 @@ function entryKindOf(token) {
|
|
|
46117
46117
|
if (!OWN_PACKAGE_MARKERS.some((marker) => normalised.includes(marker))) return null;
|
|
46118
46118
|
return isCliFile ? "cli" : "supervisor";
|
|
46119
46119
|
}
|
|
46120
|
+
function entryPosition(tokens) {
|
|
46121
|
+
const first = tokens[0];
|
|
46122
|
+
if (!first) return null;
|
|
46123
|
+
const direct = entryKindOf(first);
|
|
46124
|
+
if (direct) return { at: 0, kind: direct };
|
|
46125
|
+
const normalised = first.replace(/\\/g, "/");
|
|
46126
|
+
const program = normalised.slice(normalised.lastIndexOf("/") + 1);
|
|
46127
|
+
if (!/^(node|nodejs)(\d+)?$/.test(program)) return null;
|
|
46128
|
+
let i = 1;
|
|
46129
|
+
while (i < tokens.length && tokens[i].startsWith("-")) {
|
|
46130
|
+
i += NODE_FLAGS_WITH_VALUE.has(tokens[i]) ? 2 : 1;
|
|
46131
|
+
}
|
|
46132
|
+
const script = tokens[i];
|
|
46133
|
+
const kind = script ? entryKindOf(script) : null;
|
|
46134
|
+
return kind ? { at: i, kind } : null;
|
|
46135
|
+
}
|
|
46120
46136
|
function parsePsLine(line) {
|
|
46121
46137
|
const m = /^\s*(\d+)\s+(\d+)\s+(.*)$/.exec(line);
|
|
46122
46138
|
return m ? { pid: Number(m[1]), uid: Number(m[2]), args: m[3] } : null;
|
|
@@ -46149,16 +46165,9 @@ async function findSupervisorProcesses() {
|
|
|
46149
46165
|
const parsed = parsePsLine(line);
|
|
46150
46166
|
if (!parsed || parsed.uid !== uid || parsed.pid === process.pid) continue;
|
|
46151
46167
|
const tokens = parsed.args.trim().split(/\s+/).filter(Boolean);
|
|
46152
|
-
|
|
46153
|
-
|
|
46154
|
-
|
|
46155
|
-
kind = entryKindOf(tokens[i]);
|
|
46156
|
-
if (kind) {
|
|
46157
|
-
scriptAt = i;
|
|
46158
|
-
break;
|
|
46159
|
-
}
|
|
46160
|
-
}
|
|
46161
|
-
if (!kind) continue;
|
|
46168
|
+
const entry = entryPosition(tokens);
|
|
46169
|
+
if (!entry) continue;
|
|
46170
|
+
const { at: scriptAt, kind } = entry;
|
|
46162
46171
|
if (kind === "cli") {
|
|
46163
46172
|
const next = tokens[scriptAt + 1];
|
|
46164
46173
|
const isSubcommand = next !== void 0 && !next.startsWith("-") && NON_LOOPING_CLI_COMMANDS.includes(next);
|
|
@@ -46199,7 +46208,7 @@ function since(iso) {
|
|
|
46199
46208
|
if (ms2 < 864e5) return `${Math.round(ms2 / 36e5)}h`;
|
|
46200
46209
|
return `${Math.round(ms2 / 864e5)}d`;
|
|
46201
46210
|
}
|
|
46202
|
-
var exec, runDir, logDir, recordPath, CLI_BIN_NAMES, SUPERVISOR_BIN_NAMES, OWN_PACKAGE_MARKERS, NON_LOOPING_CLI_COMMANDS, SIGNALS;
|
|
46211
|
+
var exec, runDir, logDir, recordPath, CLI_BIN_NAMES, SUPERVISOR_BIN_NAMES, OWN_PACKAGE_MARKERS, NON_LOOPING_CLI_COMMANDS, NODE_FLAGS_WITH_VALUE, SIGNALS;
|
|
46203
46212
|
var init_process = __esm({
|
|
46204
46213
|
"src/process.ts"() {
|
|
46205
46214
|
"use strict";
|
|
@@ -46212,6 +46221,7 @@ var init_process = __esm({
|
|
|
46212
46221
|
SUPERVISOR_BIN_NAMES = /* @__PURE__ */ new Set(["cruo-supervisor"]);
|
|
46213
46222
|
OWN_PACKAGE_MARKERS = ["@cruo/mcp", "cruo-agent", "apps/mcp", "packages/cli"];
|
|
46214
46223
|
NON_LOOPING_CLI_COMMANDS = CRUO_COMMANDS.filter((c) => c !== "run");
|
|
46224
|
+
NODE_FLAGS_WITH_VALUE = /* @__PURE__ */ new Set(["--import", "--require", "-r", "--loader", "--experimental-loader"]);
|
|
46215
46225
|
SIGNALS = {
|
|
46216
46226
|
stop: "SIGTERM",
|
|
46217
46227
|
pause: "SIGUSR1",
|
|
@@ -46701,10 +46711,21 @@ var init_pacing = __esm({
|
|
|
46701
46711
|
function blocksAgentPickup(state) {
|
|
46702
46712
|
return state.requires_human === true;
|
|
46703
46713
|
}
|
|
46714
|
+
function byPriority(a, b) {
|
|
46715
|
+
return (PRIORITY_RANK[a.issue.priority] ?? 9) - (PRIORITY_RANK[b.issue.priority] ?? 9);
|
|
46716
|
+
}
|
|
46717
|
+
var PRIORITY_RANK;
|
|
46704
46718
|
var init_queries = __esm({
|
|
46705
46719
|
"src/queries.ts"() {
|
|
46706
46720
|
"use strict";
|
|
46707
46721
|
init_dist();
|
|
46722
|
+
PRIORITY_RANK = {
|
|
46723
|
+
urgent: 0,
|
|
46724
|
+
high: 1,
|
|
46725
|
+
medium: 2,
|
|
46726
|
+
low: 3,
|
|
46727
|
+
none: 4
|
|
46728
|
+
};
|
|
46708
46729
|
}
|
|
46709
46730
|
});
|
|
46710
46731
|
|
|
@@ -46919,7 +46940,7 @@ async function pollAssigned(ctx) {
|
|
|
46919
46940
|
notificationIds: []
|
|
46920
46941
|
}
|
|
46921
46942
|
];
|
|
46922
|
-
});
|
|
46943
|
+
}).sort(byPriority);
|
|
46923
46944
|
}
|
|
46924
46945
|
async function poll(ctx, identity) {
|
|
46925
46946
|
const { data: states, error: stateErr } = await ctx.client.from("workflow_states").select("*").eq("workspace_id", ctx.workspaceId).eq("owner_function", identity.jobFunction);
|
|
@@ -46956,9 +46977,7 @@ async function poll(ctx, identity) {
|
|
|
46956
46977
|
notificationIds: []
|
|
46957
46978
|
}
|
|
46958
46979
|
];
|
|
46959
|
-
}).sort(
|
|
46960
|
-
(a, b) => (PRIORITY_RANK[a.issue.priority] ?? 9) - (PRIORITY_RANK[b.issue.priority] ?? 9)
|
|
46961
|
-
);
|
|
46980
|
+
}).sort(byPriority);
|
|
46962
46981
|
}
|
|
46963
46982
|
async function pollMentions(ctx, identity) {
|
|
46964
46983
|
const { data: notes, error: error51 } = await ctx.client.schema("public").from("notifications").select("id, issue_id").eq("user_id", ctx.userId).eq("kind", "mention").is("read_at", null).not("issue_id", "is", null).order("created_at", { ascending: true });
|
|
@@ -47001,9 +47020,7 @@ async function pollMentions(ctx, identity) {
|
|
|
47001
47020
|
notificationIds: byIssue.get(issue2.id) ?? []
|
|
47002
47021
|
}
|
|
47003
47022
|
];
|
|
47004
|
-
}).sort(
|
|
47005
|
-
(a, b) => (PRIORITY_RANK[a.issue.priority] ?? 9) - (PRIORITY_RANK[b.issue.priority] ?? 9)
|
|
47006
|
-
);
|
|
47023
|
+
}).sort(byPriority);
|
|
47007
47024
|
}
|
|
47008
47025
|
async function claim(ctx, hit) {
|
|
47009
47026
|
const ttlMs = options.harnessTimeoutMs + 3e4;
|
|
@@ -47875,7 +47892,7 @@ to catch: a second supervisor nothing could see or stop.
|
|
|
47875
47892
|
if (stopping) return;
|
|
47876
47893
|
}
|
|
47877
47894
|
}
|
|
47878
|
-
var argv, flag, opt, num2, ms, readOptions, options, log, worktreeConfig, lastRefusal,
|
|
47895
|
+
var argv, flag, opt, num2, ms, readOptions, options, log, worktreeConfig, lastRefusal, CONFIG_DIR_PREFIX, CRUO_OWNED_ENV, HEAD_STORED, lastHolding, warnedAboutSpendTable, stopping, paused, stopRequestedAt, currentRun, pendingWait;
|
|
47879
47896
|
var init_supervisor = __esm({
|
|
47880
47897
|
"src/supervisor.ts"() {
|
|
47881
47898
|
"use strict";
|
|
@@ -47942,7 +47959,11 @@ var init_supervisor = __esm({
|
|
|
47942
47959
|
* test file — was killed at it twice, having written real work both times
|
|
47943
47960
|
* and committed neither. Err long: the cheap failure is the slow one.
|
|
47944
47961
|
*/
|
|
47945
|
-
|
|
47962
|
+
// 50 minutes since CRA-122: roughly double the longest real run (26.3 min),
|
|
47963
|
+
// and deliberately short of an hour — the run's own board session lasts
|
|
47964
|
+
// exactly 60 minutes (see `writeMcpConfig`), so a longer limit lets a run
|
|
47965
|
+
// lose the board in the minutes it hands the card on.
|
|
47966
|
+
harnessTimeoutMs: ms("harness-timeout", 3e3),
|
|
47946
47967
|
/**
|
|
47947
47968
|
* Give up on an issue after this many unproductive runs. Persisted in
|
|
47948
47969
|
* `pm.issue_attempts` since CRA-7 — it was in-memory, which meant a restart
|
|
@@ -48042,13 +48063,6 @@ cruo-supervisor: ${error51.message}
|
|
|
48042
48063
|
log = (...parts) => console.log(`[${(/* @__PURE__ */ new Date()).toLocaleTimeString("en-GB", { hour12: false })}]`, ...parts);
|
|
48043
48064
|
worktreeConfig = null;
|
|
48044
48065
|
lastRefusal = null;
|
|
48045
|
-
PRIORITY_RANK = {
|
|
48046
|
-
urgent: 0,
|
|
48047
|
-
high: 1,
|
|
48048
|
-
medium: 2,
|
|
48049
|
-
low: 3,
|
|
48050
|
-
none: 4
|
|
48051
|
-
};
|
|
48052
48066
|
CONFIG_DIR_PREFIX = "cruo-sup-";
|
|
48053
48067
|
CRUO_OWNED_ENV = [
|
|
48054
48068
|
"SUPABASE_URL",
|
|
@@ -48487,8 +48501,9 @@ ${name} started (pid ${child.pid}).
|
|
|
48487
48501
|
check cruo ps
|
|
48488
48502
|
stop cruo stop ${name}
|
|
48489
48503
|
|
|
48490
|
-
It survives this terminal closing
|
|
48491
|
-
|
|
48504
|
+
It survives this terminal closing, and the machine sleeping \u2014 it pauses
|
|
48505
|
+
and carries on when you wake it. It does not survive a restart or a
|
|
48506
|
+
shutdown; for that, see "Surviving a reboot" at
|
|
48492
48507
|
https://cruo.space/docs#agents.
|
|
48493
48508
|
`
|
|
48494
48509
|
);
|
package/package.json
CHANGED