Skip to content

refactor(module): de-inline payload bodies into modules/src/ (#154 Phase 1) - #181

Open
defangdevs wants to merge 1 commit into
refactor/phase0-golden-snapshotfrom
refactor/phase1-deinline-payloads
Open

refactor(module): de-inline payload bodies into modules/src/ (#154 Phase 1)#181
defangdevs wants to merge 1 commit into
refactor/phase0-golden-snapshotfrom
refactor/phase1-deinline-payloads

Conversation

@defangdevs

Copy link
Copy Markdown
Owner

Phase 1 of #154, stacked on #179 (Phase 0) — it uses the golden-snapshot check as its proof; retarget to master once #179 merges.

What moved

The 15 payloads still inlined in modules/agent-box.nix.in now live as files under modules/src/, spliced back by the assembler: supervisor (supervisor.sh), session CLI, env-exec wrapper, attach script, password helper, the Caddyfile template (header/terminal/root/webhook fragments), spot monitor, self-update script, codex remote-control wrapper, webhook CLI + spawner, and the default AGENTS.md. The template drops 3341 → 1784 lines. (settings-daemon.py had already established the pattern in #97/#140.)

Why the new @@include-verbatim: marker

The existing @@include: escapes content for Nix indented strings, which would turn a live ${pkgs.jq} antiquote into a literal. These payloads still carry live antiquotes (that's Phase 2's target), so Phase 1 adds a -verbatim marker that splices the file unescaped: each src file holds the body exactly as it sat inside the template string — Nix-string dialect, ''$-escapes and all.

That makes this PR a pure cut/paste whose correctness is machine-checked, and defers all content changes to Phase 2, where each file becomes a genuine shell/python script and its marker flips to the escaping @@include: form. Reviewing this PR = reviewing the assembler change (+8 lines) and trusting the byte-identity proofs; the src files need no line-by-line read.

Proof of byte-identity

  • Regenerated modules/agent-box.nix is byte-identical — the committed file has no diff in this PR, and module-generated-up-to-date is green.
  • checks.aarch64-linux.golden-snapshot: the snapshot derivation didn't even rebuild (same input hashes); fixture untouched.
  • module-single-file, multi-user eval checks green.

Second checkbox of #154.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NPHNnT2DsWHLhbbhsq2Wc7

, Phase 1)

Move the 15 remaining inline payloads out of agent-box.nix.in into real
files under modules/src/: the per-user supervisor (mkStart), session CLI,
env-exec wrapper, attach script, password helper, the four Caddyfile
fragments, spot monitor, self-update script, codex remote-control
wrapper, webhook CLI + spawner, and the default AGENTS.md. The template
drops from 3341 to 1784 lines.

The move is a PURE byte-identical cut: a new @@include-verbatim:@@
assembler marker splices a file with NO escaping, so each src file holds
the body exactly as it sat inside the template's indented string —
Nix-string dialect, live ${...} antiquotes and ''$-escapes included.
That is deliberate: Phase 2 converts each payload into a genuine
shell/python file (antiquotes purged, dialect unescaped) and flips its
marker to the escaping @@include:@@ form, and THAT diff is where content
review belongs. This one is verifiable mechanically:

  - regenerated modules/agent-box.nix is byte-identical (empty git diff;
    module-generated-up-to-date green)
  - golden-snapshot check: derivation unchanged, fixture untouched
  - module-single-file green

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NPHNnT2DsWHLhbbhsq2Wc7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants