@moondeck/station 1.0.8 → 1.0.9

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.
@@ -34,6 +34,7 @@ ENV MISE_VERSION=2026.11.1
34
34
 
35
35
  # Qualified agent builds. These are execution-contract pins: per-command env
36
36
  # freshness is requalified before any of them moves.
37
+ ENV UAI_CLAUDE_CODE_VERSION=2.1.322
37
38
  ENV UAI_CODEX_CLI_VERSION=0.164.0
38
39
  ENV UAI_CURSOR_AGENT_VERSION=2026.10.22-27dcf5f
39
40
  ENV UAI_GROK_CLI_VERSION=1.0.70
@@ -277,7 +278,7 @@ RUN bash -lc '\
277
278
  . /opt/asdf/asdf.sh; \
278
279
  COREPACK_VERSION="$(sed -n "1p" /usr/local/share/uai/corepack-version)"; \
279
280
  printf "%s" "$COREPACK_VERSION" | grep -Eq "^[0-9]+\\.[0-9]+\\.[0-9]+$"; \
280
- npm install -g @anthropic-ai/claude-code "@openai/codex@$UAI_CODEX_CLI_VERSION" "corepack@$COREPACK_VERSION" \
281
+ npm install -g "@anthropic-ai/claude-code@$UAI_CLAUDE_CODE_VERSION" "@openai/codex@$UAI_CODEX_CLI_VERSION" "corepack@$COREPACK_VERSION" \
281
282
  --registry=https://registry.npmjs.org/ \
282
283
  --userconfig=/dev/null \
283
284
  --globalconfig=/dev/uai-empty-npmrc; \
@@ -285,6 +286,7 @@ RUN bash -lc '\
285
286
  curl -fsSL https://code-server.dev/install.sh | sh -s -- --method standalone --prefix /home/node/.local; \
286
287
  asdf reshim nodejs; \
287
288
  test "$(codex --version)" = "codex-cli $UAI_CODEX_CLI_VERSION"; \
289
+ test "$(claude --version)" = "$UAI_CLAUDE_CODE_VERSION (Claude Code)"; \
288
290
  '
289
291
 
290
292
  # Optional agent CLIs — installed ONLY when the host has them configured
@@ -371,16 +371,73 @@ if [ -f "$HOME/.ssh/id_ed25519.pub" ]; then
371
371
  /usr/bin/git config --global tag.gpgsign true
372
372
  fi
373
373
 
374
- # Attribution policy: never co-author with the agents. Claude Code honors
375
- # `includeCoAuthoredBy: false` (drops the "Co-Authored-By: Claude" commit
376
- # trailer and the "Generated with Claude Code" PR footer). Seed it into the
377
- # per-task Claude user settings if absent. Codex is covered by the
374
+ # Attribution policy: never co-author with the agents. Claude Code 2.x reads
375
+ # `attribution` ({commit,pr}: "" hides that attribution; sessionUrl: false drops
376
+ # the session link); older CLIs read the deprecated `includeCoAuthoredBy: false`.
377
+ # Both are MERGED into the user settings on every run: another writer (credential
378
+ # materialization, an image layer, a previous run) may have created the file
379
+ # first, and every other key in it is left exactly as found. Only a MISSING file
380
+ # is created. An existing file is left byte-for-byte alone (with a warning) when
381
+ # it is a symlink, not a regular file, or not exactly one JSON object (empty,
382
+ # whitespace-only and several concatenated documents all count as invalid).
383
+ # The result is written to an unpredictable, exclusively created (mktemp, 0600)
384
+ # sibling and renamed into place, so a pre-placed symlink cannot redirect the
385
+ # write, the file never gets a wider mode than it had (it may hold credentials
386
+ # in `env`), and the temp file is removed on every path. Codex is covered by the
378
387
  # orchestrator's system preamble.
379
- cc_settings="$HOME/.claude/settings.json"
380
- if [ ! -f "$cc_settings" ]; then
381
- mkdir -p "$HOME/.claude"
382
- printf '{\n "includeCoAuthoredBy": false\n}\n' > "$cc_settings"
383
- log "seeded ~/.claude/settings.json (includeCoAuthoredBy: false)"
388
+ cc_dir="$HOME/.claude"
389
+ cc_settings="$cc_dir/settings.json"
390
+ cc_tmp=""
391
+ cc_skip() { log "warning: leaving $cc_settings untouched: $1"; }
392
+ cc_merge() {
393
+ jq -s '
394
+ if length == 1 and (.[0] | type) == "object" then .[0]
395
+ else error("not exactly one JSON object") end
396
+ | .includeCoAuthoredBy = false
397
+ | .attribution = (
398
+ (if (.attribution | type) == "object" then .attribution else {} end)
399
+ + {commit: "", pr: "", sessionUrl: false}
400
+ )'
401
+ }
402
+ mkdir -p "$cc_dir" 2>/dev/null || true
403
+ if [ -L "$cc_settings" ]; then
404
+ cc_skip "it is a symlink"
405
+ elif [ -e "$cc_settings" ] && [ ! -f "$cc_settings" ]; then
406
+ cc_skip "it is not a regular file"
407
+ else
408
+ cc_tmp="$(umask 077; mktemp "$cc_dir/settings.json.XXXXXX" 2>/dev/null)" || cc_tmp=""
409
+ if [ -z "$cc_tmp" ]; then
410
+ cc_skip "could not create a temporary file in $cc_dir"
411
+ elif [ -e "$cc_settings" ]; then
412
+ if cc_merge < "$cc_settings" > "$cc_tmp" 2>/dev/null; then
413
+ if cmp -s "$cc_tmp" "$cc_settings"; then
414
+ :
415
+ else
416
+ # Same mode as the file being replaced (the temp file is 0600); never wider.
417
+ # If the mode cannot be copied, do not replace: the 0600 temp file would
418
+ # change the original's mode.
419
+ if ! chmod --reference="$cc_settings" "$cc_tmp" 2>/dev/null; then
420
+ cc_skip "could not copy its mode to the replacement"
421
+ elif mv -f "$cc_tmp" "$cc_settings" 2>/dev/null; then
422
+ cc_tmp=""
423
+ log "ensured ~/.claude/settings.json attribution policy (no co-author trailers)"
424
+ else
425
+ cc_skip "could not replace it"
426
+ fi
427
+ fi
428
+ else
429
+ cc_skip "not exactly one JSON object (or unreadable)"
430
+ fi
431
+ else
432
+ # Missing: create it, never replacing a file that appears meanwhile (ln fails if it exists).
433
+ if printf '{}' | cc_merge > "$cc_tmp" 2>/dev/null \
434
+ && ln "$cc_tmp" "$cc_settings" 2>/dev/null; then
435
+ log "seeded ~/.claude/settings.json (no co-author trailers)"
436
+ else
437
+ cc_skip "could not create it"
438
+ fi
439
+ fi
440
+ [ -z "$cc_tmp" ] || rm -f -- "$cc_tmp"
384
441
  fi
385
442
  fi
386
443
 
@@ -602,6 +602,75 @@ async function seedEditorSettings(
602
602
  });
603
603
  }
604
604
 
605
+ /** Merge the no-co-author attribution policy into the machine's Claude user
606
+ * settings (machines do not run uai-init, which does the same for containers;
607
+ * keep the two in step). Only a MISSING file is created. An existing file is
608
+ * left byte-for-byte alone (exit 3, reason on stderr) when it is a symlink, not
609
+ * a regular file, or not exactly one JSON object (empty, whitespace-only and
610
+ * concatenated documents are all invalid). The result goes to an
611
+ * unpredictable, exclusively created (mode 0600) sibling and is renamed into
612
+ * place, so a pre-placed symlink cannot redirect the write, the file keeps its
613
+ * existing mode (it may hold credentials in env; never widened), and the temp
614
+ * file is removed on every path. */
615
+ const CLAUDE_ATTRIBUTION_MERGE_JS = `
616
+ const fs = require("fs"), path = require("path"), crypto = require("crypto");
617
+ const p = process.argv[1];
618
+ const dir = path.dirname(p);
619
+ const untouched = (why) => { console.error("leaving " + p + " untouched: " + why); process.exit(3); };
620
+ fs.mkdirSync(dir, { recursive: true });
621
+ let st = null;
622
+ try { st = fs.lstatSync(p); } catch (e) { if (e.code !== "ENOENT") untouched(String(e.code)); }
623
+ if (st && st.isSymbolicLink()) untouched("it is a symlink");
624
+ if (st && !st.isFile()) untouched("it is not a regular file");
625
+ let s = {}, original = null;
626
+ if (st) {
627
+ try { original = fs.readFileSync(p, "utf8"); } catch (e) { untouched("unreadable"); }
628
+ try { s = JSON.parse(original); } catch (e) { untouched("not exactly one JSON object"); }
629
+ if (!s || typeof s !== "object" || Array.isArray(s)) untouched("not a JSON object");
630
+ }
631
+ s.includeCoAuthoredBy = false;
632
+ const a = s.attribution && typeof s.attribution === "object" && !Array.isArray(s.attribution) ? s.attribution : {};
633
+ s.attribution = { ...a, commit: "", pr: "", sessionUrl: false };
634
+ const out = JSON.stringify(s, null, 2) + "\\n";
635
+ if (out === original) process.exit(0);
636
+ const tmp = path.join(dir, "settings.json." + crypto.randomBytes(8).toString("hex") + ".tmp");
637
+ let fd = null, failed = null;
638
+ try {
639
+ fd = fs.openSync(tmp, "wx", 0o600);
640
+ fs.writeFileSync(fd, out);
641
+ fs.fchmodSync(fd, st ? st.mode & 0o777 : 0o600);
642
+ fs.closeSync(fd); fd = null;
643
+ if (st) fs.renameSync(tmp, p); else fs.linkSync(tmp, p);
644
+ } catch (e) {
645
+ failed = e;
646
+ } finally {
647
+ if (fd !== null) { try { fs.closeSync(fd); } catch (e) {} }
648
+ try { fs.unlinkSync(tmp); } catch (e) {}
649
+ }
650
+ if (failed) untouched(String(failed.code || failed.message));
651
+ `;
652
+
653
+ export async function ensureClaudeAttributionPolicy(
654
+ handle: TaskEnvironmentHandle<unknown>,
655
+ ): Promise<void> {
656
+ const result = await handle.exec({
657
+ argv: [
658
+ "node",
659
+ "-e",
660
+ CLAUDE_ATTRIBUTION_MERGE_JS,
661
+ "/home/node/.claude/settings.json",
662
+ ],
663
+ projectEnvProfile: "maintenance",
664
+ timeoutMs: GIT_STEP_TIMEOUT_MS,
665
+ maxOutputBytes: STEP_OUTPUT_BYTES,
666
+ });
667
+ if (result.exitCode !== 0) {
668
+ throw new Error(
669
+ `claude attribution merge exited ${result.exitCode}: ${Buffer.from(result.stderr).toString("utf8").trim()}`,
670
+ );
671
+ }
672
+ }
673
+
605
674
  const execFileAsync = promisify(execFile);
606
675
  /** Shared-files snapshots are reference docs, not repos; a tree past this
607
676
  * is skipped with a warning rather than ballooning host memory. */
@@ -1204,6 +1273,18 @@ export function createMachineHostTaskEnvironmentProvider(
1204
1273
  }
1205
1274
  }
1206
1275
 
1276
+ // Attribution policy (no Claude co-author trailers) — uai-init does
1277
+ // this for containers; machines never run it. Best-effort.
1278
+ await stage(
1279
+ ensureClaudeAttributionPolicy(own).catch((error: unknown) => {
1280
+ console.warn(
1281
+ `[machine] task ${request.taskId}: claude attribution policy failed: ${
1282
+ error instanceof Error ? error.message : String(error)
1283
+ }`,
1284
+ );
1285
+ }),
1286
+ );
1287
+
1207
1288
  // Editor pane: code-server on the machine (same flags as uai-init's
1208
1289
  // container launch), idempotent across provision re-runs and resume.
1209
1290
  // Best-effort — a missing binary degrades the Editor tab, never the task.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moondeck/station",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Moondeck Station: runs Moondeck tasks in containers on a machine you control.",
5
5
  "license": "MIT",
6
6
  "author": "Moondeck <team@moondeck.io>",
@@ -5,9 +5,11 @@
5
5
  * here has no guide entry. Pure data: no runtime imports.
6
6
  */
7
7
 
8
- // Claude Code's aliases, which follow its own model table (2.1.310:
9
- // fable = Claude Fable 5.1, opus = Opus 5.5, sonnet = Sonnet 5.5,
10
- // haiku = Haiku 5.5). Update alongside the CLI.
8
+ // Claude Code's aliases, which follow its own model table: fable = Claude
9
+ // Fable 5.2 as of Claude Code 2.1.321 (the images pin 2.1.322 via
10
+ // UAI_CLAUDE_CODE_VERSION; read 2026-11-10), opus = Opus 5.5, sonnet = Sonnet
11
+ // 5.5, haiku = Haiku 5.5. The CLI version decides which model an alias runs,
12
+ // so update this list and the pin together.
11
13
  export const CLAUDE_MODELS: readonly string[] = ["fable", "opus", "sonnet", "haiku"];
12
14
 
13
15
  // Codex model slugs accepted via `-c model=<slug>`. Keep the newest version of