benignswarm 0.12.94 → 0.12.95

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/args.js CHANGED
@@ -2,9 +2,9 @@ import { parseArgs } from "node:util";
2
2
  import { CliError } from "./errors.js";
3
3
  // These options accept comma-separated collections, so repeating them should
4
4
  // append another collection instead of discarding earlier values.
5
- export const LIST_FLAGS = ["tags", "projects", "evidence", "statuses", "depends-on", "default-tags", "units", "waits-on", "writable-root", "needs", "exclude", "remove", "post", "harness", "variant", "requires", "reworks", "confirm-causes"];
6
- export const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "tier", "description", "permissions", "cardinality", "assign-outside-qualifications", "machine", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "provider", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after", "unacked-after", "category", "command", "command-pattern", "follow-delay", "env", "scope", "scope-file", "scope-from", "append", "pr", "note", "add", "remove", "merged", "tag", "activity", "max-unanswered", "to", "replay-of", "branch", "effort", "max-budget-usd", "by", "target", "milestone", "file", "exit", "depends-on", "default-tags", "source", "on", "partial", "question", "ruling", "gaps", "unit", "units", "blocks", "sla", "takeover", "max-open", "max-in-progress", "require-scope", "require-evidence", "default-approver", "merged-by", "integrator-role", "require-rebased", "require-merge-commit", "require-pushed", "quiet", "summary", "meaning", "expert-role", "reviews", "works", "trials", "email", "repeat", "summary-minutes", "churn", "unmet", "require-cited-changes", "checks-every", "propose", "waits-on", "sandbox", "thread", "turn-timeout", "turns-per-hour", "session", "plain", "if-yes", "if-no", "ssh", "variant", "count", "needs", "min-ram", "exclude", "carry", "from", "to-ssh", "wait", "writable", "writable-root", "dsh", "agy", "for", "until", "reason", "at", "requires", "priority", "informs", "amend", "waive-informs", "text", "kind", "claim", "decision", "sha", "value", "expect", "expectations", "reworks", "cause", "lesson", "disputes", "annotation", "send-back-event", "confirm-causes"];
7
- export const BOOL_FLAGS = ["latest", "no-restart", "json", "follow", "account", "help", "version", "broadcast", "create-channels", "read-account-status", "replace-key", "mentions-me", "no-skill", "replace", "template", "scope-only", "unread", "pending", "force", "no-hooks", "yes", "open", "bind-here", "peek", "once", "launchd", "full", "no-bind", "all", "here", "keep-worktree", "prune", "abandon", "defer", "hold", "clear", "met", "shared", "archive", "approve", "turn", "service", "print-hooks", "create", "rotate", "codex-userns", "bwrap-userns", "print-apparmor", "cancel", "rerun", "confirmed", "refuted", "no-source", "allow-lower-tier"];
5
+ export const LIST_FLAGS = ["tags", "projects", "evidence", "statuses", "depends-on", "default-tags", "units", "waits-on", "writable-root", "needs", "exclude", "remove", "post", "harness", "variant", "requires", "reworks", "confirm-causes", "processes"];
6
+ export const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "tier", "description", "permissions", "cardinality", "assign-outside-qualifications", "machine", "idempotency-key", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "provider", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after", "unacked-after", "category", "command", "command-pattern", "follow-delay", "env", "scope", "scope-file", "scope-from", "append", "pr", "note", "note-file", "add", "remove", "merged", "tag", "activity", "max-unanswered", "to", "replay-of", "branch", "effort", "max-budget-usd", "by", "target", "milestone", "file", "exit", "depends-on", "default-tags", "source", "on", "partial", "question", "ruling", "gaps", "unit", "units", "blocks", "sla", "takeover", "max-open", "max-in-progress", "require-scope", "require-evidence", "default-approver", "merged-by", "integrator-role", "require-rebased", "require-merge-commit", "require-pushed", "quiet", "summary", "meaning", "expert-role", "reviews", "works", "trials", "email", "repeat", "summary-minutes", "churn", "unmet", "require-cited-changes", "checks-every", "propose", "waits-on", "sandbox", "thread", "turn-timeout", "turns-per-hour", "unproductive-per-hour", "session", "plain", "if-yes", "if-no", "ssh", "variant", "count", "needs", "min-ram", "exclude", "carry", "from", "to-ssh", "wait", "writable", "writable-root", "dsh", "agy", "for", "until", "reason", "at", "requires", "priority", "informs", "amend", "waive-informs", "text", "kind", "claim", "decision", "sha", "value", "expect", "expectations", "reworks", "cause", "lesson", "disputes", "annotation", "send-back-event", "confirm-causes", "floor", "tool", "processes"];
7
+ export const BOOL_FLAGS = ["latest", "no-restart", "json", "follow", "account", "help", "version", "broadcast", "create-channels", "read-account-status", "replace-key", "mentions-me", "no-skill", "replace", "template", "scope-only", "unread", "pending", "force", "no-hooks", "yes", "open", "bind-here", "peek", "once", "launchd", "full", "no-bind", "all", "here", "keep-worktree", "prune", "abandon", "defer", "hold", "clear", "met", "shared", "archive", "approve", "turn", "service", "print-hooks", "create", "rotate", "codex-userns", "bwrap-userns", "print-apparmor", "cancel", "rerun", "confirmed", "refuted", "no-source", "allow-lower-tier", "confirm-bypass-signal"];
8
8
  export function parse(argv) {
9
9
  const options = {};
10
10
  for (const f of STRING_FLAGS)
@@ -0,0 +1,39 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { platform, uptime } from "node:os";
3
+ /** Returns the Unix boot time in milliseconds, or null when the host denies both sources. */
4
+ export function bootTimeMs(readUptime = uptime, readSysctl = readMacBootTime, os = platform(), now = Date.now) {
5
+ try {
6
+ const seconds = readUptime();
7
+ const nowMs = now();
8
+ const bootedAt = nowMs - seconds * 1000;
9
+ if (Number.isFinite(seconds) && seconds >= 0 && Number.isFinite(bootedAt) && bootedAt <= nowMs)
10
+ return bootedAt;
11
+ }
12
+ catch {
13
+ // Sandboxed macOS can refuse uv_uptime; try its native boot-time source below.
14
+ }
15
+ if (os !== "darwin")
16
+ return null;
17
+ try {
18
+ const bootedAt = readSysctl();
19
+ const nowMs = now();
20
+ return typeof bootedAt === "number" && Number.isFinite(bootedAt) && bootedAt >= 0 && bootedAt <= nowMs ? bootedAt : null;
21
+ }
22
+ catch {
23
+ return null;
24
+ }
25
+ }
26
+ function readMacBootTime() {
27
+ const result = spawnSync("sysctl", ["-n", "kern.boottime"], { encoding: "utf8", timeout: 1000 });
28
+ if (result.error || result.status !== 0)
29
+ return null;
30
+ const seconds = /\bsec\s*=\s*(\d+)\b/.exec(result.stdout)?.[1];
31
+ const microseconds = /\busec\s*=\s*(\d+)\b/.exec(result.stdout)?.[1] ?? "0";
32
+ if (seconds === undefined)
33
+ return null;
34
+ const sec = Number(seconds);
35
+ const usec = Number(microseconds);
36
+ if (!Number.isSafeInteger(sec) || !Number.isInteger(usec) || usec < 0 || usec >= 1_000_000)
37
+ return null;
38
+ return sec * 1000 + Math.floor(usec / 1000);
39
+ }