From 19e2393721f74390aa0baa0da2b1204f9a2b967f Mon Sep 17 00:00:00 2001 From: Quino Terrasa <26749475+espetro@users.noreply.github.com> Date: Wed, 2 Dec 2026 08:10:25 -0800 Subject: [PATCH 1/2] fix(cli): normalize the optional daemon action arg before indexing The library hands an absent optional positional over as null. On the Node path the loose cast hid it, but the native binary's type claim rejects null before the string cast, so the compiled daemon exited with 'typeerror: expected string at $[0], got null' on every start. Map the slot to a string before rest[] indexing. --- src/main.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 61bd215..498076e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1117,7 +1117,11 @@ function buildCommands(): Record { cmds["daemon"] = command("runs the claim loop on this machine", { args: [{ name: "action", description: "restart: hand off to the current binary", optional: true }], handler: (o: unknown, a: unknown[]) => { - return cmdDaemon(a as string[]); + // An optional arg absent from the argv arrives as null on the native + // path (the type claim rejects it before the string cast would), so + // normalize here before the rest[] index. + const rest = a.map((x) => (typeof x === "string" ? x : "")); + return cmdDaemon(rest); }, }) as unknown as CommandDef; From 3fae033dd8ca387531007fa2344aa984328a4e62 Mon Sep 17 00:00:00 2001 From: Quino Terrasa <26749475+espetro@users.noreply.github.com> Date: Wed, 2 Dec 2026 08:10:33 -0800 Subject: [PATCH 2/2] chore: add changeset for the daemon optional-arg fix --- .changeset/daemon-optional-arg.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/daemon-optional-arg.md diff --git a/.changeset/daemon-optional-arg.md b/.changeset/daemon-optional-arg.md new file mode 100644 index 0000000..94149e5 --- /dev/null +++ b/.changeset/daemon-optional-arg.md @@ -0,0 +1,5 @@ +--- +"coordinate": patch +--- + +Fix the compiled daemon failing to start with `expected string at $[0], got null`. The library hands an absent optional positional over as null, and the native binary's type claim rejects it before the string cast; the daemon handler now normalizes the slot before indexing.