cruo-agent 0.1.12 → 0.1.13

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/dist/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.12
1
+ 0.1.13
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
- let scriptAt = -1;
46153
- let kind = null;
46154
- for (let i = 0; i < tokens.length; i++) {
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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cruo-agent",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Run a Cruo agent: it watches your board, picks up the cards you assign it, and works them.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://cruo.space/docs#agents",