Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(macrod): Windows builds and one-line installers (#8448)
Wolf Mermelstein00a7838f0a56
diff --git a/.gitattributes b/.gitattributesindex 2fb2b5b892..ac020903d0 100644--- a/.gitattributes+++ b/.gitattributes@@ -11,3 +11,7 @@ packages/sdk-docs/reference/** linguist-generated=true# and exclude from language stats; edit the Rust source, not the YAML..github/workflows/code_check_cloud_storage.yml linguist-generated=true.github/workflows/check_generated.yml linguist-generated=true++# sqlx keys its offline cache (.sqlx) on the exact query text, so a CRLF+# checkout (Git for Windows) of a `query_file!` source misses the cache.+*.sql text eol=lfdiff --git a/.github/workflows/build_agent_daemon_on_tag.yml b/.github/workflows/build_agent_daemon_on_tag.ymlindex 86bfb3a578..75a09c2901 100644--- a/.github/workflows/build_agent_daemon_on_tag.yml+++ b/.github/workflows/build_agent_daemon_on_tag.yml@@ -174,7 +174,11 @@ jobs:# exactly the failure this whole pipeline exists to prevent, so it is checked# here rather than assumed.- binary="target/$TARGET/release/macrod"+ case "$TARGET" in+ *-windows-*) executable="macrod.exe" ;;+ *) executable="macrod" ;;+ esac+ binary="target/$TARGET/release/$executable"if [ ! -x "$binary" ]; thenecho "no daemon binary at $binary" >&2exit 1@@ -203,6 +207,19 @@ jobs:exit 1fi;;+ *-windows-msvc)+ # Every DLL must come from Windows itself. Git Bash's ldd resolves the+ # imports; one found outside C:\Windows (a vcruntime, a build-tool DLL)+ # will not be on a user's machine.+ imports=$(ldd "$binary")+ strays=$(printf '%s\n' "$imports" | awk '$2 == "=>" { print $3 }' \+ | grep -Eiv '^(/c/windows/|\?\?\?$)' || true)+ if [ -n "$strays" ]; then+ echo "daemon links DLLs that will not exist on a user's PC:" >&2+ echo "$strays" >&2+ exit 1+ fi+ ;;*)echo "no self-containment check defined for $TARGET" >&2exit 1@@ -220,23 +237,37 @@ jobs:fimkdir -p artifacts- name="macrod-${SAFE_TAG}-${SLUG}"stage=$(mktemp -d)- install -m 755 "$binary" "$stage/macrod"- tar -czf "artifacts/${name}.tar.gz" -C "$stage" macrod- rm -rf "$stage"+ install -m 755 "$binary" "$stage/$executable"++ # Every archive is published twice: under the tag, and under a name without+ # it, which `releases/latest/download/<name>` serves — the URL the install+ # scripts download from.+ for name in "macrod-${SAFE_TAG}-${SLUG}" "macrod-${SLUG}"; do+ case "$TARGET" in+ *-windows-*)+ archive="${name}.zip"+ powershell.exe -NoProfile -NonInteractive -Command \+ "Compress-Archive -Path '$(cygpath -w "$stage/$executable")' -DestinationPath '$(cygpath -w "artifacts/$archive")'"+ ;;+ *)+ archive="${name}.tar.gz"+ tar -czf "artifacts/$archive" -C "$stage" "$executable"+ ;;+ esac- # coreutils on Linux, BSD/perl on macOS.- (- cd artifacts- if command -v sha256sum >/dev/null 2>&1; then- sha256sum "${name}.tar.gz" >"${name}.tar.gz.sha256"- else- shasum -a 256 "${name}.tar.gz" >"${name}.tar.gz.sha256"- fi- )-- echo "packaged ${name}.tar.gz"+ # coreutils on Linux and Git Bash, BSD/perl on macOS.+ (+ cd artifacts+ if command -v sha256sum >/dev/null 2>&1; then+ sha256sum "$archive" >"$archive.sha256"+ else+ shasum -a 256 "$archive" >"$archive.sha256"+ fi+ )+ echo "packaged $archive"+ done+ rm -rf "$stage"shell: bashenv:TARGET: x86_64-unknown-linux-musl@@ -358,7 +389,11 @@ jobs:# exactly the failure this whole pipeline exists to prevent, so it is checked# here rather than assumed.- binary="target/$TARGET/release/macrod"+ case "$TARGET" in+ *-windows-*) executable="macrod.exe" ;;+ *) executable="macrod" ;;+ esac+ binary="target/$TARGET/release/$executable"if [ ! -x "$binary" ]; thenecho "no daemon binary at $binary" >&2exit 1@@ -387,6 +422,19 @@ jobs:exit 1fi;;+ *-windows-msvc)+ # Every DLL must come from Windows itself. Git Bash's ldd resolves the+ # imports; one found outside C:\Windows (a vcruntime, a build-tool DLL)+ # will not be on a user's machine.+ imports=$(ldd "$binary")+ strays=$(printf '%s\n' "$imports" | awk '$2 == "=>" { print $3 }' \+ | grep -Eiv '^(/c/windows/|\?\?\?$)' || true)+ if [ -n "$strays" ]; then+ echo "daemon links DLLs that will not exist on a user's PC:" >&2+ echo "$strays" >&2+ exit 1+ fi+ ;;*)echo "no self-containment check defined for $TARGET" >&2exit 1@@ -404,23 +452,37 @@ jobs:fimkdir -p artifacts- name="macrod-${SAFE_TAG}-${SLUG}"stage=$(mktemp -d)- install -m 755 "$binary" "$stage/macrod"- tar -czf "artifacts/${name}.tar.gz" -C "$stage" macrod- rm -rf "$stage"+ install -m 755 "$binary" "$stage/$executable"- # coreutils on Linux, BSD/perl on macOS.- (- cd artifacts- if command -v sha256sum >/dev/null 2>&1; then- sha256sum "${name}.tar.gz" >"${name}.tar.gz.sha256"- else- shasum -a 256 "${name}.tar.gz" >"${name}.tar.gz.sha256"- fi- )-- echo "packaged ${name}.tar.gz"+ # Every archive is published twice: under the tag, and under a name without+ # it, which `releases/latest/download/<name>` serves — the URL the install+ # scripts download from.+ for name in "macrod-${SAFE_TAG}-${SLUG}" "macrod-${SLUG}"; do+ case "$TARGET" in+ *-windows-*)+ archive="${name}.zip"+ powershell.exe -NoProfile -NonInteractive -Command \+ "Compress-Archive -Path '$(cygpath -w "$stage/$executable")' -DestinationPath '$(cygpath -w "artifacts/$archive")'"+ ;;+ *)+ archive="${name}.tar.gz"+ tar -czf "artifacts/$archive" -C "$stage" "$executable"+ ;;+ esac++ # coreutils on Linux and Git Bash, BSD/perl on macOS.+ (+ cd artifacts+ if command -v sha256sum >/dev/null 2>&1; then+ sha256sum "$archive" >"$archive.sha256"+ else+ shasum -a 256 "$archive" >"$archive.sha256"+ fi+ )+ echo "packaged $archive"+ done+ rm -rf "$stage"shell: bashenv:TARGET: aarch64-unknown-linux-musl@@ -502,7 +564,11 @@ jobs:# exactly the failure this whole pipeline exists to prevent, so it is checked# here rather than assumed.- binary="target/$TARGET/release/macrod"+ case "$TARGET" in+ *-windows-*) executable="macrod.exe" ;;+ *) executable="macrod" ;;+ esac+ binary="target/$TARGET/release/$executable"if [ ! -x "$binary" ]; thenecho "no daemon binary at $binary" >&2exit 1@@ -531,6 +597,19 @@ jobs:exit 1fi;;+ *-windows-msvc)+ # Every DLL must come from Windows itself. Git Bash's ldd resolves the+ # imports; one found outside C:\Windows (a vcruntime, a build-tool DLL)+ # will not be on a user's machine.+ imports=$(ldd "$binary")+ strays=$(printf '%s\n' "$imports" | awk '$2 == "=>" { print $3 }' \+ | grep -Eiv '^(/c/windows/|\?\?\?$)' || true)+ if [ -n "$strays" ]; then+ echo "daemon links DLLs that will not exist on a user's PC:" >&2+ echo "$strays" >&2+ exit 1+ fi+ ;;*)echo "no self-containment check defined for $TARGET" >&2exit 1@@ -548,23 +627,37 @@ jobs:fimkdir -p artifacts- name="macrod-${SAFE_TAG}-${SLUG}"stage=$(mktemp -d)- install -m 755 "$binary" "$stage/macrod"- tar -czf "artifacts/${name}.tar.gz" -C "$stage" macrod- rm -rf "$stage"+ install -m 755 "$binary" "$stage/$executable"- # coreutils on Linux, BSD/perl on macOS.- (- cd artifacts- if command -v sha256sum >/dev/null 2>&1; then- sha256sum "${name}.tar.gz" >"${name}.tar.gz.sha256"- else- shasum -a 256 "${name}.tar.gz" >"${name}.tar.gz.sha256"- fi- )-- echo "packaged ${name}.tar.gz"+ # Every archive is published twice: under the tag, and under a name without+ # it, which `releases/latest/download/<name>` serves — the URL the install+ # scripts download from.+ for name in "macrod-${SAFE_TAG}-${SLUG}" "macrod-${SLUG}"; do+ case "$TARGET" in+ *-windows-*)+ archive="${name}.zip"+ powershell.exe -NoProfile -NonInteractive -Command \+ "Compress-Archive -Path '$(cygpath -w "$stage/$executable")' -DestinationPath '$(cygpath -w "artifacts/$archive")'"+ ;;+ *)+ archive="${name}.tar.gz"+ tar -czf "artifacts/$archive" -C "$stage" "$executable"+ ;;+ esac++ # coreutils on Linux and Git Bash, BSD/perl on macOS.+ (+ cd artifacts+ if command -v sha256sum >/dev/null 2>&1; then+ sha256sum "$archive" >"$archive.sha256"+ else+ shasum -a 256 "$archive" >"$archive.sha256"+ fi+ )+ echo "packaged $archive"+ done+ rm -rf "$stage"shell: bashenv:TARGET: aarch64-apple-darwin@@ -643,7 +736,11 @@ jobs:# exactly the failure this whole pipeline exists to prevent, so it is checked# here rather than assumed.- binary="target/$TARGET/release/macrod"+ case "$TARGET" in+ *-windows-*) executable="macrod.exe" ;;+ *) executable="macrod" ;;+ esac+ binary="target/$TARGET/release/$executable"if [ ! -x "$binary" ]; thenecho "no daemon binary at $binary" >&2exit 1@@ -672,6 +769,19 @@ jobs:exit 1fi;;+ *-windows-msvc)+ # Every DLL must come from Windows itself. Git Bash's ldd resolves the+ # imports; one found outside C:\Windows (a vcruntime, a build-tool DLL)+ # will not be on a user's machine.+ imports=$(ldd "$binary")+ strays=$(printf '%s\n' "$imports" | awk '$2 == "=>" { print $3 }' \+ | grep -Eiv '^(/c/windows/|\?\?\?$)' || true)+ if [ -n "$strays" ]; then+ echo "daemon links DLLs that will not exist on a user's PC:" >&2+ echo "$strays" >&2+ exit 1+ fi+ ;;*)echo "no self-containment check defined for $TARGET" >&2exit 1@@ -689,23 +799,37 @@ jobs:fimkdir -p artifacts- name="macrod-${SAFE_TAG}-${SLUG}"stage=$(mktemp -d)- install -m 755 "$binary" "$stage/macrod"- tar -czf "artifacts/${name}.tar.gz" -C "$stage" macrod- rm -rf "$stage"+ install -m 755 "$binary" "$stage/$executable"++ # Every archive is published twice: under the tag, and under a name without+ # it, which `releases/latest/download/<name>` serves — the URL the install+ # scripts download from.+ for name in "macrod-${SAFE_TAG}-${SLUG}" "macrod-${SLUG}"; do+ case "$TARGET" in+ *-windows-*)+ archive="${name}.zip"+ powershell.exe -NoProfile -NonInteractive -Command \+ "Compress-Archive -Path '$(cygpath -w "$stage/$executable")' -DestinationPath '$(cygpath -w "artifacts/$archive")'"+ ;;+ *)+ archive="${name}.tar.gz"+ tar -czf "artifacts/$archive" -C "$stage" "$executable"+ ;;+ esac- # coreutils on Linux, BSD/perl on macOS.- (- cd artifacts- if command -v sha256sum >/dev/null 2>&1; then- sha256sum "${name}.tar.gz" >"${name}.tar.gz.sha256"- else- shasum -a 256 "${name}.tar.gz" >"${name}.tar.gz.sha256"- fi- )-- echo "packaged ${name}.tar.gz"+ # coreutils on Linux and Git Bash, BSD/perl on macOS.+ (+ cd artifacts+ if command -v sha256sum >/dev/null 2>&1; then+ sha256sum "$archive" >"$archive.sha256"+ else+ shasum -a 256 "$archive" >"$archive.sha256"+ fi+ )+ echo "packaged $archive"+ done+ rm -rf "$stage"shell: bashenv:TARGET: x86_64-apple-darwin@@ -719,6 +843,184 @@ jobs:path: artifacts/*if-no-files-found: errorretention-days: '30'+ build-daemon-windows-x86-64:+ needs:+ - resolve-ref+ name: Build daemon (windows-x86_64)+ runs-on: nscloud-windows-2022-amd64-8x16+ steps:+ - name: Checkout Repo+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10+ with:+ ref: ${{ needs.resolve-ref.outputs.ref }}+ persist-credentials: 'false'+ - name: Setup Rust+ uses: './.github/actions/setup-rust'+ with:+ sccache: 'false'+ rust-cache: 'false'+ - id: metadata+ name: Derive artifact metadata+ run: |+ set -euo pipefail+ tag="${RAW_REF#refs/tags/}"+ if [ -z "$tag" ]; then+ tag="${GITHUB_REF_NAME:-untagged}"+ fi+ safe_tag=$(printf '%s' "$tag" | sed 's#[/\\:*?"<>|]#-#g' | tr -d '\r\n')+ echo "tag=$tag" >> "$GITHUB_OUTPUT"+ echo "safe_tag=$safe_tag" >> "$GITHUB_OUTPUT"+ shell: bash+ env:+ RAW_REF: ${{ needs.resolve-ref.outputs.ref }}+ - name: Build daemon+ run: |+ set -euo pipefail++ # Windows build of the self-hosted coding-agent daemon, with the runner's MSVC+ # toolchain.+ #+ # See build_agent_daemon_linux.sh for why sqlx runs offline.+ export SQLX_OFFLINE=true++ # Link the C runtime into the binary. Without this, macrod.exe needs the Visual+ # C++ redistributable's vcruntime DLLs, which a user's machine may not have.+ # With an explicit --target, RUSTFLAGS reach only target code, and the cc and+ # cmake builds of the C dependencies follow it to the static runtime.+ export RUSTFLAGS="-C target-feature=+crt-static"++ # aws-lc-sys assembles its x86_64 crypto with NASM; it ships those objects+ # pre-assembled, which saves installing NASM on the runner.+ export AWS_LC_SYS_PREBUILT_NASM=1++ rustup target add "$TARGET"++ if ! command -v cmake >/dev/null 2>&1; then+ choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' --no-progress -y+ export PATH="/c/Program Files/CMake/bin:$PATH"+ fi++ cargo build --release --package coding_agent_worker --target "$TARGET"+ shell: bash+ env:+ TARGET: x86_64-pc-windows-msvc+ - name: Package daemon+ run: |+ set -euo pipefail++ # Package one built daemon binary as a release asset — and prove it is as+ # self-contained as its platform allows before it ships. A binary that resolves+ # a library at startup on the build runner and not on a user's machine is+ # exactly the failure this whole pipeline exists to prevent, so it is checked+ # here rather than assumed.++ case "$TARGET" in+ *-windows-*) executable="macrod.exe" ;;+ *) executable="macrod" ;;+ esac+ binary="target/$TARGET/release/$executable"+ if [ ! -x "$binary" ]; then+ echo "no daemon binary at $binary" >&2+ exit 1+ fi++ case "$TARGET" in+ *-linux-musl)+ # Statically linked: nothing may be left to resolve at run time. `ldd`+ # exits non-zero with "not a dynamic executable" for a static binary, so+ # a successful ldd that names shared objects is the failure case.+ if ldd "$binary" 2>/dev/null | grep -q '=>'; then+ echo "expected a static binary, but $binary still links:" >&2+ ldd "$binary" >&2+ exit 1+ fi+ ;;+ *-apple-darwin)+ # macOS has no static libSystem, so "self-contained" means nothing from+ # outside the OS: a Homebrew or Nix-store path is one that will not exist+ # on the machine that downloads this.+ strays=$(otool -L "$binary" | tail -n +2 | awk '{ print $1 }' \+ | grep -Ev '^(/usr/lib/|/System/Library/)' || true)+ if [ -n "$strays" ]; then+ echo "daemon links libraries that will not exist on a user's Mac:" >&2+ echo "$strays" >&2+ exit 1+ fi+ ;;+ *-windows-msvc)+ # Every DLL must come from Windows itself. Git Bash's ldd resolves the+ # imports; one found outside C:\Windows (a vcruntime, a build-tool DLL)+ # will not be on a user's machine.+ imports=$(ldd "$binary")+ strays=$(printf '%s\n' "$imports" | awk '$2 == "=>" { print $3 }' \+ | grep -Eiv '^(/c/windows/|\?\?\?$)' || true)+ if [ -n "$strays" ]; then+ echo "daemon links DLLs that will not exist on a user's PC:" >&2+ echo "$strays" >&2+ exit 1+ fi+ ;;+ *)+ echo "no self-containment check defined for $TARGET" >&2+ exit 1+ ;;+ esac++ # It has to actually run, too — a binary that links cleanly and dies on its+ # first instruction still ships broken. `--version` is the cheapest end-to-end+ # proof, and the caller says whether this runner can execute this slice: the+ # cross-built ones (aarch64 anywhere, x86_64 on an Apple Silicon runner) cannot.+ if [ "$SMOKE_RUN" = "1" ]; then+ "$binary" --version+ else+ echo "skipping smoke run: $TARGET does not execute on this runner"+ fi++ mkdir -p artifacts+ stage=$(mktemp -d)+ install -m 755 "$binary" "$stage/$executable"++ # Every archive is published twice: under the tag, and under a name without+ # it, which `releases/latest/download/<name>` serves — the URL the install+ # scripts download from.+ for name in "macrod-${SAFE_TAG}-${SLUG}" "macrod-${SLUG}"; do+ case "$TARGET" in+ *-windows-*)+ archive="${name}.zip"+ powershell.exe -NoProfile -NonInteractive -Command \+ "Compress-Archive -Path '$(cygpath -w "$stage/$executable")' -DestinationPath '$(cygpath -w "artifacts/$archive")'"+ ;;+ *)+ archive="${name}.tar.gz"+ tar -czf "artifacts/$archive" -C "$stage" "$executable"+ ;;+ esac++ # coreutils on Linux and Git Bash, BSD/perl on macOS.+ (+ cd artifacts+ if command -v sha256sum >/dev/null 2>&1; then+ sha256sum "$archive" >"$archive.sha256"+ else+ shasum -a 256 "$archive" >"$archive.sha256"+ fi+ )+ echo "packaged $archive"+ done+ rm -rf "$stage"+ shell: bash+ env:+ TARGET: x86_64-pc-windows-msvc+ SLUG: windows-x86_64+ SAFE_TAG: ${{ steps.metadata.outputs.safe_tag }}+ SMOKE_RUN: '1'+ - name: Upload macrod-windows-x86_64-${{ steps.metadata.outputs.safe_tag }} artifact+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02+ with:+ name: macrod-windows-x86_64-${{ steps.metadata.outputs.safe_tag }}+ path: artifacts/*+ if-no-files-found: error+ retention-days: '30'publish-daemon:needs:- resolve-ref@@ -726,7 +1028,8 @@ jobs:- build-daemon-linux-aarch64- build-daemon-macos-aarch64- build-daemon-macos-x86-64- if: '!cancelled() && needs.resolve-ref.result == ''success'' && (needs.build-daemon-linux-x86-64.result == ''success'' || needs.build-daemon-linux-aarch64.result == ''success'' || needs.build-daemon-macos-aarch64.result == ''success'' || needs.build-daemon-macos-x86-64.result == ''success'')'+ - build-daemon-windows-x86-64+ if: '!cancelled() && needs.resolve-ref.result == ''success'' && (needs.build-daemon-linux-x86-64.result == ''success'' || needs.build-daemon-linux-aarch64.result == ''success'' || needs.build-daemon-macos-aarch64.result == ''success'' || needs.build-daemon-macos-x86-64.result == ''success'' || needs.build-daemon-windows-x86-64.result == ''success'')'name: Upload Release Artifactsruns-on: ubuntu-latestpermissions:diff --git a/Cargo.lock b/Cargo.lockindex 217ad8d2bf..5e17fe674b 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -4475,6 +4475,7 @@ dependencies = ["macro_user_id","macro_uuid","messages",+ "openssl-sys","ratatui","reqwest 0.13.4","rootcause",@@ -4499,6 +4500,7 @@ dependencies = ["uuid","webbrowser","webhook",+ "windows-sys 0.61.2","workspace-hack",]diff --git a/Cargo.toml b/Cargo.tomlindex fd10c3a765..4922829a2a 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -299,6 +299,7 @@ lru = "0.16"miniz_oxide = { version = "0.8", features = ["with-alloc"] }mockall = "0.13"nom = "8"+openssl-sys = "0.9"opus-pure = "0.2.1"opentelemetry = { version = "0.31.0", default-features = false }opentelemetry-appender-tracing = { version = "0.31.1", default-features = false }@@ -436,6 +437,7 @@ wasm-bindgen-test = "0.3"web-sys = "0.3"web-time = "1.1.0"webbrowser = { version = "=1.2.2", features = ["hardened"] }+windows-sys = "0.61"worker = "0.8.1"# this is pinned to match axum 0.7.9 dependency requirementsasync-stripe = { version = "0.41", default-features = false, features = [diff --git a/apps/docs/AI/bring-your-own.mdx b/apps/docs/AI/bring-your-own.mdxindex d23748f34e..4ae219343f 100644--- a/apps/docs/AI/bring-your-own.mdx+++ b/apps/docs/AI/bring-your-own.mdx@@ -31,7 +31,7 @@ Run the Macro daemon (`macrod`) on your computer or server.## Before you start-You need a macOS or Linux computer that can stay online and an installed, authenticated coding agent. `macrod` recognizes Claude Code, Codex, OpenCode, OpenClaw, and Hermes. You can also configure a custom command for an Agent Client Protocol (ACP) agent.+You need a macOS, Linux, or Windows computer that can stay online and an installed, authenticated coding agent. `macrod` recognizes Claude Code, Codex, OpenCode, OpenClaw, and Hermes. You can also configure a custom command for an Agent Client Protocol (ACP) agent.`macrod` connects out to Macro. You do not need a public webhook endpoint, port forwarding, or an HTTPS tunnel.@@ -43,16 +43,37 @@ You need a macOS or Linux computer that can stay online and an installed, authen<Steps><Step title="Install macrod">- Download the `macrod` archive for your operating system and architecture from [Macro releases](https://github.com/macro-inc/macro/releases), then extract it.+ Run the install command for your computer in a terminal:++ <Tabs>+ <Tab title="macOS and Linux">+ ```bash+ curl -fsSL https://raw.githubusercontent.com/macro-inc/macro/main/crates/coding_agent_worker/install/install.sh | sh+ ```++ This installs `macrod` to `~/.local/bin`. If that folder is not on your `PATH`, the installer prints the line to add.+ </Tab>+ <Tab title="Windows">+ In PowerShell:++ ```powershell+ irm https://raw.githubusercontent.com/macro-inc/macro/main/crates/coding_agent_worker/install/install.ps1 | iex+ ```++ This installs `macrod.exe` to `%LOCALAPPDATA%\Programs\macrod` and adds it to your `PATH`. Open a new terminal afterwards.+ </Tab>+ </Tabs>++ You can also download the archive for your operating system and architecture from [Macro releases](https://github.com/macro-inc/macro/releases) and extract it.Open **Settings → General → Agents → Runtimes → New runtime** in Macro. The page walks you through installation, configuration, and pairing.</Step><Step title="Run macrod">- Open a terminal in the extracted folder and run:+ Open a terminal in the folder where `macrod` should keep its configuration and run:```bash- ./macrod+ macrod```Keep the terminal open while you use your runtime.@@ -99,6 +120,12 @@ Leave `macrod` running and your computer awake while you use the runtime. Its teTo reconnect later, run `macrod` from the same directory so it loads your saved configuration. If you revoke the runtime, pair it again before using it.+## Update macrod++Run the install command again. It replaces `macrod` with the latest release and keeps your `macrod.toml`. A running `macrod` keeps the old version until you restart it.++To install a specific release instead, set the `MACROD_VERSION` environment variable to its tag, such as `v2026.10.18.0`, before running the install command.+## Troubleshooting- **Your agent is missing from Quickstart:** check that it is installed and its command is available in the terminal where you launch `macrod`. For a different ACP agent, use **Custom command**.diff --git a/apps/web/src/features/settings/components/runtime-setup-steps.tsx b/apps/web/src/features/settings/components/runtime-setup-steps.tsxindex 3d55420943..03097402b3 100644--- a/apps/web/src/features/settings/components/runtime-setup-steps.tsx+++ b/apps/web/src/features/settings/components/runtime-setup-steps.tsx@@ -55,6 +55,21 @@ export function SetupField(props: { class?: string; children: JSX.Element }) {);}+const INSTALL_SCRIPT_BASE =+ 'https://raw.githubusercontent.com/macro-inc/macro/main/crates/coding_agent_worker/install';++/** A shell command to type, behind its prompt; long commands wrap. */+function SetupCommand(props: { prompt: string; command: string }) {+ return (+ <div class="flex gap-2 rounded-lg border border-edge-muted bg-ink/[0.025] px-3 py-2 font-mono text-sm text-ink">+ <span aria-hidden="true" class="select-none text-ink-extra-muted">+ {props.prompt}+ </span>+ <code class="min-w-0 [overflow-wrap:anywhere]">{props.command}</code>+ </div>+ );+}+/** Installation instructions surrounding the live pairing-code form. */export function RuntimeSetupSteps(props: { children: JSX.Element }) {return (@@ -69,22 +84,24 @@ export function RuntimeSetupSteps(props: { children: JSX.Element }) {</Show><ol aria-label="Runtime setup steps" class="list-none"><SetupStep number={1} title="Install macrod">- <p>Download the macrod archive for your computer, then extract it.</p>- <SetupLink href="https://github.com/macro-inc/macro/releases">- Download macrod- </SetupLink>+ <p>On macOS or Linux, run in a terminal:</p>+ <SetupCommand+ prompt="$"+ command={`curl -fsSL ${INSTALL_SCRIPT_BASE}/install.sh | sh`}+ />+ <p>On Windows, run in PowerShell:</p>+ <SetupCommand+ prompt=">"+ command={`irm ${INSTALL_SCRIPT_BASE}/install.ps1 | iex`}+ />+ <p>Run it again later to update macrod.</p></SetupStep><SetupStep number={2} title="Run macrod">- <p>Open a terminal in the extracted folder and run:</p>- <div class="rounded-lg border border-edge-muted bg-ink/[0.025] px-3 py-2 font-mono text-sm text-ink">- <span- aria-hidden="true"- class="mr-2 select-none text-ink-extra-muted"- >- $- </span>- <code>./macrod</code>- </div>+ <p>+ Open a terminal in the folder where macrod should keep its+ configuration and run:+ </p>+ <SetupCommand prompt="$" command="macrod" /><p>Choose your agent, workspace, and access in Quickstart, then select{' '}<span class="font-medium text-ink">Create and pair</span>. Keepdiff --git a/crates/coding_agent_worker/AGENTS.md b/crates/coding_agent_worker/AGENTS.mdindex 1a837fbd2c..deadaa660a 100644--- a/crates/coding_agent_worker/AGENTS.md+++ b/crates/coding_agent_worker/AGENTS.md@@ -20,6 +20,10 @@ the local ACP process (Claude Code, Codex, ...), and drives nativesessions, config form, logs).- `src/herdr.rs` (`src/herdr/`): native herdr pane integration — only compiled`#[cfg(unix)]`.+- `src/executable.rs`: `PATH` lookup; every spawn of a bare command name goes+ through `launchable`, which finds Windows `.cmd` shims (`npm`, `npx`).+- `install/`: `install.sh` and `install.ps1`, the one-line installers the docs+ serve from `main`. They download `macrod-<os>-<arch>` from the latest release.- `README.md`: native Herdr session behavior (repositories, reconnect, modelswitching, MCP) — read before changing anything under `src/herdr/`.@@ -52,11 +56,18 @@ external chat replies depend on it. Direct session controls still mint IDs.- `OPENSSL_NO_VENDOR=0 just build-static` to build and smoke-test the release `macrod` the waythe tag workflow does (needs the Nix devshell: cargo-zigbuild, zig, cmake).The override enables bundled OpenSSL for the musl target in the devshell.+- Windows is built natively on a Namespace Windows runner by+ `build_agent_daemon_on_tag` (MSVC, static CRT). Run that workflow with+ `workflow_dispatch` on your branch to check a Windows-affecting change.+- `cargo tree -p coding_agent_worker -i rdkafka-sys --target x86_64-unknown-linux-musl`+ must find nothing: librdkafka breaks the static and Windows builds.## Gotchas- `src/herdr.rs` and its submodule are Unix-only (`#[cfg(unix)]`); don't addWindows-breaking code there without a cfg gate.+- The ACP child is killed with its whole tree: a process group on Unix, a Job+ Object on Windows (`src/outbound/acp_process/job.rs`).- macrod never pulls into the operator's working branch — new herdr worktreesstart from a fresh fetch of `origin/main` (see README.md).- Switching native agents clears the previous agent's model/extra-args butdiff --git a/crates/coding_agent_worker/Cargo.toml b/crates/coding_agent_worker/Cargo.tomlindex b92da95f97..1e40312f67 100644--- a/crates/coding_agent_worker/Cargo.toml+++ b/crates/coding_agent_worker/Cargo.toml@@ -63,6 +63,18 @@ workspace-hack = { version = "0.1", path = "../workspace-hack" }[target.'cfg(unix)'.dependencies]rustix = { workspace = true }+# Stripe (agent_session -> ai_billing) reaches native-tls, which is OpenSSL on+# Linux, and a musl build has no system OpenSSL to link: compile it in.+[target.'cfg(target_env = "musl")'.dependencies]+openssl-sys = { workspace = true, features = ["vendored"] }++[target.'cfg(windows)'.dependencies]+windows-sys = { workspace = true, features = [+ "Win32_Foundation",+ "Win32_Security",+ "Win32_System_JobObjects",+] }+[dev-dependencies]bot_id = { path = "../bot_id", features = ["test-utils"] }channel_sender = { path = "../channel_sender" }diff --git a/crates/coding_agent_worker/install/install.ps1 b/crates/coding_agent_worker/install/install.ps1new file mode 100644index 0000000000..da45ad024a--- /dev/null+++ b/crates/coding_agent_worker/install/install.ps1@@ -0,0 +1,70 @@+# Install macrod, Macro's agent daemon, on Windows:+#+# irm https://raw.githubusercontent.com/macro-inc/macro/main/crates/coding_agent_worker/install/install.ps1 | iex+#+# Run it again to update. MACROD_VERSION pins a release tag (v2026.10.18.0);+# MACROD_INSTALL_DIR overrides where the binary goes+# (%LOCALAPPDATA%\Programs\macrod), which is added to the user PATH.++# A script block, so `irm | iex` leaves no variables behind in the caller's+# session and a failure does not close it.+& {+ $ErrorActionPreference = 'Stop'+ $ProgressPreference = 'SilentlyContinue'+ # Windows PowerShell 5.1 may still default to TLS 1.0, which GitHub refuses.+ [Net.ServicePointManager]::SecurityProtocol =+ [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12++ $repo = 'macro-inc/macro'+ $installDir = if ($env:MACROD_INSTALL_DIR) { $env:MACROD_INSTALL_DIR }+ else { Join-Path $env:LOCALAPPDATA 'Programs\macrod' }+ $version = if ($env:MACROD_VERSION) { $env:MACROD_VERSION } else { 'latest' }++ if (-not [Environment]::Is64BitOperatingSystem) {+ throw 'macrod install: 64-bit Windows is required'+ }+ # The x86_64 build also runs on Windows on Arm, under emulation.+ if ($version -eq 'latest') {+ $asset = 'macrod-windows-x86_64.zip'+ $url = "https://github.com/$repo/releases/latest/download/$asset"+ } else {+ $asset = "macrod-$version-windows-x86_64.zip"+ $url = "https://github.com/$repo/releases/download/$version/$asset"+ }++ $work = Join-Path ([IO.Path]::GetTempPath()) ([Guid]::NewGuid())+ New-Item -ItemType Directory -Path $work | Out-Null+ try {+ Write-Host "Downloading $url"+ $archive = Join-Path $work $asset+ Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $archive+ Invoke-WebRequest -UseBasicParsing -Uri "$url.sha256" -OutFile "$archive.sha256"++ $expected = ((Get-Content "$archive.sha256" -Raw).Trim() -split '\s+')[0]+ $actual = (Get-FileHash $archive -Algorithm SHA256).Hash+ if ($actual -ne $expected) { throw "macrod install: checksum mismatch for $asset" }++ Expand-Archive -Path $archive -DestinationPath $work -Force+ New-Item -ItemType Directory -Path $installDir -Force | Out-Null+ $target = Join-Path $installDir 'macrod.exe'+ # A running macrod.exe cannot be overwritten, but it can be renamed+ # aside; it keeps running from there until it restarts.+ if (Test-Path $target) {+ Remove-Item "$target.old" -Force -ErrorAction SilentlyContinue+ Move-Item $target "$target.old" -Force+ }+ Copy-Item (Join-Path $work 'macrod.exe') $target++ $userPath = [Environment]::GetEnvironmentVariable('Path', 'User')+ if (-not (($userPath -split ';') -contains $installDir)) {+ $newPath = if ($userPath) { "$userPath;$installDir" } else { $installDir }+ [Environment]::SetEnvironmentVariable('Path', $newPath, 'User')+ $env:Path = "$env:Path;$installDir"+ Write-Host "Added $installDir to your PATH; open a new terminal to use it there."+ }+ Write-Host "Installed $(& $target --version) to $target"+ Write-Host 'Run: macrod'+ } finally {+ Remove-Item $work -Recurse -Force -ErrorAction SilentlyContinue+ }+}diff --git a/crates/coding_agent_worker/install/install.sh b/crates/coding_agent_worker/install/install.shnew file mode 100644index 0000000000..d4bc06b240--- /dev/null+++ b/crates/coding_agent_worker/install/install.sh@@ -0,0 +1,78 @@+#!/bin/sh+# Install macrod, Macro's agent daemon, on macOS or Linux:+#+# curl -fsSL https://raw.githubusercontent.com/macro-inc/macro/main/crates/coding_agent_worker/install/install.sh | sh+#+# Run it again to update. MACROD_VERSION pins a release tag (v2026.10.18.0);+# MACROD_INSTALL_DIR overrides where the binary goes (~/.local/bin).++set -eu++repo="macro-inc/macro"+install_dir="${MACROD_INSTALL_DIR:-$HOME/.local/bin}"+version="${MACROD_VERSION:-latest}"++fail() {+ echo "macrod install: $*" >&2+ exit 1+}++command -v curl >/dev/null 2>&1 || fail "curl is required"++case "$(uname -s)" in+ Linux) os=linux ;;+ Darwin) os=macos ;;+ *) fail "unsupported OS $(uname -s); on Windows use install.ps1" ;;+esac++case "$(uname -m)" in+ x86_64 | amd64) arch=x86_64 ;;+ arm64 | aarch64) arch=aarch64 ;;+ *) fail "unsupported CPU $(uname -m)" ;;+esac+# A shell running under Rosetta reports x86_64 on Apple Silicon.+if [ "$os" = macos ] && [ "$arch" = x86_64 ] && [ "$(sysctl -n hw.optional.arm64 2>/dev/null || true)" = 1 ]; then+ arch=aarch64+fi++if [ "$version" = latest ]; then+ asset="macrod-$os-$arch.tar.gz"+ url="https://github.com/$repo/releases/latest/download/$asset"+else+ asset="macrod-$version-$os-$arch.tar.gz"+ url="https://github.com/$repo/releases/download/$version/$asset"+fi++work=$(mktemp -d)+trap 'rm -rf "$work"' EXIT++echo "Downloading $url"+curl -fsSL --proto '=https' --tlsv1.2 -o "$work/$asset" "$url" ||+ fail "download failed; is $os-$arch published for $version?"+curl -fsSL --proto '=https' --tlsv1.2 -o "$work/$asset.sha256" "$url.sha256" ||+ fail "checksum download failed"++(+ cd "$work"+ if command -v sha256sum >/dev/null 2>&1; then+ sha256sum -c "$asset.sha256" >/dev/null+ else+ shasum -a 256 -c "$asset.sha256" >/dev/null+ fi+) || fail "checksum mismatch for $asset"++tar -xzf "$work/$asset" -C "$work" macrod+mkdir -p "$install_dir"+# Rename into place: a running macrod keeps its old binary until it restarts.+install -m 755 "$work/macrod" "$install_dir/.macrod.new"+mv -f "$install_dir/.macrod.new" "$install_dir/macrod"++echo "Installed $("$install_dir/macrod" --version) to $install_dir/macrod"+case ":$PATH:" in+ *":$install_dir:"*) echo "Run: macrod" ;;+ *)+ echo "$install_dir is not on your PATH. Add it, e.g.:"+ echo " echo 'export PATH=\"$install_dir:\$PATH\"' >> ~/.profile"+ echo "or run: $install_dir/macrod"+ ;;+esacdiff --git a/crates/coding_agent_worker/src/executable.rs b/crates/coding_agent_worker/src/executable.rsnew file mode 100644index 0000000000..77450e8390--- /dev/null+++ b/crates/coding_agent_worker/src/executable.rs@@ -0,0 +1,69 @@+//! Finding executables on `PATH`.+//!+//! On Unix `Command::new("npm")` searches `PATH` itself. On Windows it only+//! tries `npm.exe`, while npm, npx and every npm package bin are `.cmd`+//! shims, so every spawn of a bare command name goes through [`launchable`].++use std::ffi::OsString;+use std::path::{Path, PathBuf};++mod environment {+ macro_env_var::maybe_env_var! {+ pub struct Path;+ }+}++/// The directories on this process's `PATH`, in search order.+pub fn search_paths() -> Vec<PathBuf> {+ environment::Path::new()+ .and_then(|path| path.value().map(OsString::from))+ .map(|path| std::env::split_paths(&path).collect())+ .unwrap_or_default()+}++/// The first `command` in `paths`, trying the Windows launcher extensions.+pub fn find(paths: &[PathBuf], command: &str) -> Option<PathBuf> {+ #[cfg(windows)]+ let names = [+ command.to_owned(),+ format!("{command}.exe"),+ format!("{command}.cmd"),+ format!("{command}.bat"),+ ];+ #[cfg(not(windows))]+ let names = [command.to_owned()];++ paths+ .iter()+ .flat_map(|directory| names.iter().map(move |name| directory.join(name)))+ .find(|candidate| is_executable(candidate))+}++/// The program to hand `Command::new` for `command`: on Windows a bare name is+/// resolved to its full path, extension included. A name that is not found is+/// passed through, so the spawn reports it missing.+pub fn launchable(command: &Path) -> OsString {+ #[cfg(windows)]+ if command.components().count() == 1+ && command.extension().is_none()+ && let Some(found) = command+ .to_str()+ .and_then(|name| find(&search_paths(), name))+ {+ return found.into_os_string();+ }+ command.into()+}++#[cfg(unix)]+fn is_executable(path: &Path) -> bool {+ use std::os::unix::fs::PermissionsExt as _;++ path.metadata()+ .is_ok_and(|metadata| metadata.is_file() && metadata.permissions().mode() & 0o111 != 0)+}++#[cfg(not(unix))]+fn is_executable(path: &Path) -> bool {+ path.is_file()+}diff --git a/crates/coding_agent_worker/src/main.rs b/crates/coding_agent_worker/src/main.rsindex cb6d025722..c176b7a150 100644--- a/crates/coding_agent_worker/src/main.rs+++ b/crates/coding_agent_worker/src/main.rs@@ -18,6 +18,7 @@mod config;mod daemon;mod dispatch;+mod executable;mod harness;#[cfg(unix)]mod herdr;diff --git a/crates/coding_agent_worker/src/outbound/acp_process.rs b/crates/coding_agent_worker/src/outbound/acp_process.rsindex 7f55b7b87c..a634ca4acc 100644--- a/crates/coding_agent_worker/src/outbound/acp_process.rs+++ b/crates/coding_agent_worker/src/outbound/acp_process.rs@@ -43,6 +43,8 @@ use agent_client_protocol::{Agent, Client, ConnectTo, Error, LineDirection, Lineuse tokio::process::{Child, ChildStderr, ChildStdin, ChildStdout};use tokio_util::compat::{TokioAsyncReadCompatExt as _, TokioAsyncWriteCompatExt as _};+#[cfg(windows)]+mod job;#[cfg(test)]mod test;@@ -105,7 +107,7 @@ impl AcpProcess {}fn spawn(&self) -> Result<SpawnedChild, Error> {- let mut command = std::process::Command::new(&self.command);+ let mut command = std::process::Command::new(crate::executable::launchable(&self.command));command.args(&self.args).current_dir(&self.cwd)@@ -125,7 +127,9 @@ impl AcpProcess {command.process_group(0);}+ // `kill_on_drop` covers a child dropped before `ChildGuard` holds it.let mut child = tokio::process::Command::from(command)+ .kill_on_drop(true).spawn().map_err(|error| internal_error(format!("Failed to spawn process: {error}")))?;let stdin = child@@ -145,7 +149,8 @@ impl AcpProcess {stdin,stdout,stderr,- guard: ChildGuard::new(child),+ guard: ChildGuard::new(child)+ .map_err(|error| internal_error(format!("Failed to supervise process: {error}")))?,})}}@@ -157,26 +162,36 @@ struct SpawnedChild {guard: ChildGuard,}-/// Kills the child - and, on Unix, its whole process group - when dropped.+/// Kills the child - and its whole process group (Unix) or job (Windows) -+/// when dropped.struct ChildGuard {child: Child,/// Captured at spawn: tokio forgets the pid once the child is reaped, and/// the group kill must still reach descendants a wrapper left behind.#[cfg(unix)]process_group: Option<rustix::process::Pid>,+ #[cfg(windows)]+ job: job::Job,}impl ChildGuard {- fn new(child: Child) -> Self {+ fn new(child: Child) -> std::io::Result<Self> {#[cfg(unix)]let process_group = child.id().and_then(|id| rustix::process::Pid::from_raw(id.cast_signed()));- Self {+ #[cfg(windows)]+ let job = child+ .raw_handle()+ .ok_or_else(|| std::io::Error::other("the child exited before it could be supervised"))+ .and_then(job::Job::containing)?;+ Ok(Self {child,#[cfg(unix)]process_group,- }+ #[cfg(windows)]+ job,+ })}async fn wait(&mut self) -> std::io::Result<std::process::ExitStatus> {@@ -193,8 +208,9 @@ impl ChildGuard {let _result =rustix::process::kill_process_group(process_group, rustix::process::Signal::KILL);}- // Fallback for platforms without group semantics, and a no-op double- // tap on Unix.+ #[cfg(windows)]+ self.job.terminate();+ // A no-op double tap: the group or job already held the child.drop(self.child.start_kill());}}diff --git a/crates/coding_agent_worker/src/outbound/acp_process/job.rs b/crates/coding_agent_worker/src/outbound/acp_process/job.rsnew file mode 100644index 0000000000..89115c8474--- /dev/null+++ b/crates/coding_agent_worker/src/outbound/acp_process/job.rs@@ -0,0 +1,66 @@+//! A Windows Job Object holding the ACP child and everything it spawns: the+//! Windows counterpart of the Unix process group. Terminating the job reaches+//! the real agent behind a wrapper launcher (`npx.cmd`, `uvx`), and closing its+//! last handle kills whatever is left, so even a crashed daemon leaves no+//! orphans.+//!+//! The child is assigned right after it starts, so a process it spawns before+//! that moment escapes the job. Wrapper launchers take far longer than that to+//! start the agent.++use std::os::windows::io::{AsRawHandle as _, FromRawHandle as _, OwnedHandle, RawHandle};++use windows_sys::Win32::System::JobObjects::{+ AssignProcessToJobObject, CreateJobObjectW, JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE,+ JOBOBJECT_BASIC_LIMIT_INFORMATION, JOBOBJECT_EXTENDED_LIMIT_INFORMATION,+ JobObjectExtendedLimitInformation, SetInformationJobObject, TerminateJobObject,+};++pub(super) struct Job(OwnedHandle);++impl Job {+ /// A kill-on-close job containing `process`.+ pub(super) fn containing(process: RawHandle) -> std::io::Result<Self> {+ // SAFETY: both pointers may be null: no security attributes, no name.+ let handle = unsafe { CreateJobObjectW(std::ptr::null(), std::ptr::null()) };+ if handle.is_null() {+ return Err(std::io::Error::last_os_error());+ }+ // SAFETY: `handle` is a fresh job handle that nothing else owns.+ let job = Self(unsafe { OwnedHandle::from_raw_handle(handle) });++ let limits = JOBOBJECT_EXTENDED_LIMIT_INFORMATION {+ BasicLimitInformation: JOBOBJECT_BASIC_LIMIT_INFORMATION {+ LimitFlags: JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE,+ ..Default::default()+ },+ ..Default::default()+ };+ // SAFETY: `limits` is the struct this information class names, and+ // the length passed is its size.+ let set = unsafe {+ SetInformationJobObject(+ job.0.as_raw_handle(),+ JobObjectExtendedLimitInformation,+ std::ptr::from_ref(&limits).cast(),+ u32::try_from(size_of::<JOBOBJECT_EXTENDED_LIMIT_INFORMATION>())+ .map_err(std::io::Error::other)?,+ )+ };+ if set == 0 {+ return Err(std::io::Error::last_os_error());+ }+ // SAFETY: both handles are live: the job is owned here, and the+ // caller holds the child whose handle `process` is.+ if unsafe { AssignProcessToJobObject(job.0.as_raw_handle(), process) } == 0 {+ return Err(std::io::Error::last_os_error());+ }+ Ok(job)+ }++ /// Kill every process in the job. Failure means they are already gone.+ pub(super) fn terminate(&self) {+ // SAFETY: the job handle is owned by `self` and still open.+ let _terminated = unsafe { TerminateJobObject(self.0.as_raw_handle(), 1) };+ }+}diff --git a/crates/coding_agent_worker/src/tui/agent_catalog.rs b/crates/coding_agent_worker/src/tui/agent_catalog.rsindex faf92ba8f1..30988239e4 100644--- a/crates/coding_agent_worker/src/tui/agent_catalog.rs+++ b/crates/coding_agent_worker/src/tui/agent_catalog.rs@@ -21,10 +21,12 @@ mod test;mod environment {macro_env_var::maybe_env_var! {- pub struct Path;+ pub struct Home;}+ // Windows sets no `HOME`; this is its home directory.+ #[cfg(windows)]macro_env_var::maybe_env_var! {- pub struct Home;+ pub struct Userprofile;}}@@ -160,10 +162,7 @@ pub struct PathCommands {impl PathCommands {/// Scan once for every command understood by the built-in presets.pub fn discover() -> Self {- let paths = environment::Path::new()- .and_then(|path| path.value().map(std::ffi::OsString::from))- .map(|path| std::env::split_paths(&path).collect::<Vec<_>>())- .unwrap_or_default();+ let paths = crate::executable::search_paths();let mut found = std::collections::HashMap::new();for command in ["hermes",@@ -175,13 +174,16 @@ impl PathCommands {"openclaw","opencode",] {- if let Some(path) = find_command(&paths, command) {+ if let Some(path) = crate::executable::find(&paths, command) {found.insert(command, path);}}- let adapter_root = environment::Home::new()- .and_then(|home| home.value().map(PathBuf::from))- .map(|home| home.join(".macrod").join("adapters"));+ let home = environment::Home::new().and_then(|home| home.value().map(PathBuf::from));+ #[cfg(windows)]+ let home = home.or_else(|| {+ environment::Userprofile::new().and_then(|home| home.value().map(PathBuf::from))+ });+ let adapter_root = home.map(|home| home.join(".macrod").join("adapters"));Self {found,adapter_root,@@ -189,36 +191,6 @@ impl PathCommands {}}-fn find_command(paths: &[PathBuf], command: &str) -> Option<PathBuf> {- #[cfg(windows)]- let names = [- command.to_owned(),- format!("{command}.exe"),- format!("{command}.cmd"),- format!("{command}.bat"),- ];- #[cfg(not(windows))]- let names = [command.to_owned()];-- paths- .iter()- .flat_map(|directory| names.iter().map(move |name| directory.join(name)))- .find(|candidate| is_executable(candidate))-}--#[cfg(unix)]-fn is_executable(path: &Path) -> bool {- use std::os::unix::fs::PermissionsExt as _;-- path.metadata()- .is_ok_and(|metadata| metadata.is_file() && metadata.permissions().mode() & 0o111 != 0)-}--#[cfg(not(unix))]-fn is_executable(path: &Path) -> bool {- path.is_file()-}-impl CommandLookup for PathCommands {fn resolve(&self, command: &str) -> Option<&Path> {self.found.get(command).map(PathBuf::as_path)diff --git a/crates/coding_agent_worker/src/tui/agent_catalog/npm_adapter.rs b/crates/coding_agent_worker/src/tui/agent_catalog/npm_adapter.rsindex 9d6bebdade..069aab28e0 100644--- a/crates/coding_agent_worker/src/tui/agent_catalog/npm_adapter.rs+++ b/crates/coding_agent_worker/src/tui/agent_catalog/npm_adapter.rs@@ -73,10 +73,16 @@ impl NpmAdapter {/// version in the path is what makes an existing installation trustworthy/// without inspecting it.fn bin_path(&self) -> PathBuf {+ // npm writes a `.cmd` shim on Windows; the extensionless file beside+ // it is a shell script Windows cannot launch.+ #[cfg(windows)]+ let bin = format!("{}.cmd", self.bin);+ #[cfg(not(windows))]+ let bin = self.bin;Path::new(self.package).join("node_modules").join(".bin")- .join(self.bin)+ .join(bin)}}@@ -102,7 +108,7 @@ impl AdapterInstall {if self.is_installed() {return Ok(());}- let output = tokio::process::Command::new("npm")+ let output = tokio::process::Command::new(crate::executable::launchable(Path::new("npm"))).args(["install", "--no-audit", "--no-fund", "--loglevel=error"]).arg("--prefix").arg(&self.prefix)diff --git a/crates/invite_email/Cargo.toml b/crates/invite_email/Cargo.tomlindex 01b4667acd..eaeefe6417 100644--- a/crates/invite_email/Cargo.toml+++ b/crates/invite_email/Cargo.toml@@ -10,7 +10,7 @@ askama = { workspace = true }macro_env = { path = "../macro_env" }macro_user_id = { path = "../macro_user_id" }model-entity = { path = "../model-entity" }-notification = { path = "../notification" }+notification = { path = "../notification", default-features = false }rootcause = { workspace = true }serde = { workspace = true }url = { workspace = true, features = ["serde"] }diff --git a/crates/model_notifications/Cargo.toml b/crates/model_notifications/Cargo.tomlindex 5fe82e20f9..07395707d7 100644--- a/crates/model_notifications/Cargo.toml+++ b/crates/model_notifications/Cargo.toml@@ -14,7 +14,7 @@ mention_utils = { path = "../mention_utils" }model-entity = { path = "../model-entity" }model_owner = { path = "../model_owner" }models_pagination = { path = "../models_pagination" }-notification = { path = "../notification" }+notification = { path = "../notification", default-features = false }paste = { workspace = true }invite_email = { path = "../invite_email" }rootcause = { workspace = true }diff --git a/crates/notification/AGENTS.md b/crates/notification/AGENTS.mdindex b10e6d8ad5..bde6a00065 100644--- a/crates/notification/AGENTS.md+++ b/crates/notification/AGENTS.md@@ -69,13 +69,16 @@ through the same service.## Gotchas- Feature flags gate most adapters (`axum`, `ai_tool`, `clear_ios_push`,- `schema`); building without the feature a caller needs silently drops the+ `schema`, and the default `kafka` for the Kafka publishers and consumer); building without the feature a caller needs silently drops themodule instead of failing loudly — check `Cargo.toml` before assuming anadapter is compiled in.- Ingress records publication completion only after the queue accepts thenotification. Retries preserve original IDs, recipients, and lifecycle state.- Access-request withdrawals suppress delayed ingress and queued push/realtimedelivery; keep tombstone checks when changing either delivery boundary.+- Crates on `macrod`'s dependency path (`teams`, `model_notifications`,+ `invite_email`) take this crate with `default-features = false`, which keeps+ librdkafka out of the self-hosted daemon; keep it that way.- Independent Kafka consumers have no durable group lag. Health logs distinguishstale/unknown measurements from zero; they are not client-delivery ACKs.- Notification payloads must not be logged on tracing spans (see thediff --git a/crates/notification/Cargo.toml b/crates/notification/Cargo.tomlindex 877d6001cf..f1dea09804 100644--- a/crates/notification/Cargo.toml+++ b/crates/notification/Cargo.toml@@ -23,7 +23,11 @@ axum = ["schema",]clear_ios_push = []+default = ["kafka"]docs = ["dep:aquamarine"]+# The Kafka publishers and consumer. Off for crates that only need the+# notification ports, so librdkafka stays out of the self-hosted `macrod`.+kafka = ["dep:kafka_util", "dep:rdkafka", "macro_event_broker/outbound"]redis-tests = []schema = ["dep:utoipa", "macro_user_id/schema", "notification_state/schema"]@@ -44,13 +48,13 @@ futures = { workspace = true }hex = { workspace = true }hmac = { workspace = true }itertools = { workspace = true }-kafka_util = { path = "../kafka_util" }+kafka_util = { path = "../kafka_util", optional = true }last_online_tracker = { path = "../last_online_tracker" }macro_authorization = { path = "../macro_authorization", default-features = false, features = ["axum",], optional = true }macro_env = { path = "../macro_env" }-macro_event_broker = { path = "../macro_event_broker" }+macro_event_broker = { path = "../macro_event_broker", default-features = false }macro_event_topics = { path = "../macro_event_topics" }macro_service_urls = { path = "../macro_service_urls" }macro_user_id = { path = "../macro_user_id" }@@ -61,7 +65,7 @@ model_user = { path = "../model_user", optional = true }models_pagination = { path = "../models_pagination" }notification_state = { path = "../notification_state", features = ["postgres"] }rate_limit = { path = "../rate_limit" }-rdkafka = { workspace = true }+rdkafka = { workspace = true, optional = true }redis = { workspace = true, features = ["aio","tokio-comp",diff --git a/crates/notification/src/outbound.rs b/crates/notification/src/outbound.rsindex 12016e3a71..7f45b698dd 100644--- a/crates/notification/src/outbound.rs+++ b/crates/notification/src/outbound.rs@@ -13,13 +13,16 @@ pub mod fanout_notification_realtime;pub mod fanout_realtime;pub mod item_preferences;/// Kafka-backed notification status update publication.+#[cfg(feature = "kafka")]pub mod kafka_notification_realtime;/// Kafka-backed realtime notification delivery.+#[cfg(feature = "kafka")]pub mod kafka_realtime;pub mod last_online_checker;pub mod message_receipt_repository;pub mod mobile;/// Independent Kafka consumer for WebSocket notification delivery requests.+#[cfg(feature = "kafka")]pub mod notification_consumer;/// Postgres LISTEN adapter for notification database events.pub mod notification_events;diff --git a/docs/agent-guide/ai-chat.md b/docs/agent-guide/ai-chat.mdindex 01a186d488..34af6120b3 100644--- a/docs/agent-guide/ai-chat.md+++ b/docs/agent-guide/ai-chat.md@@ -562,8 +562,9 @@ the shimmer.up the bundled macrod daemon in one click: **Set up** detects installed agents,then **Start running agents here** configures, pairs (auto-approved, no code),and starts it. The manual flow below remains for pairing other machines.- **New runtime** shows three steps: install macrod from the linked release,- run `./macrod` and configure your agent in Quickstart, then enter your pairing+ **New runtime** shows three steps: install macrod with the shown `curl … |+ sh` (macOS, Linux) or `irm … | iex` (Windows) command, run `macrod` and+ configure your agent in Quickstart, then enter your pairingcode and click **Look up**. Review the request and click **Approve** to connect.The setup guide contains configuration and pairing screenshots in that order.Enter the code from your own terminal, not the example screenshot.diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/build_agent_daemon_on_tag.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/build_agent_daemon_on_tag.rsindex 8dbaa5ea38..a34897505b 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/build_agent_daemon_on_tag.rs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/build_agent_daemon_on_tag.rs@@ -1,11 +1,11 @@-//! `Build Agent Daemon on Tag` — self-contained `macrod` binaries for Linux-//! and macOS, attached to the release its tag names.+//! `Build Agent Daemon on Tag` — self-contained `macrod` binaries for Linux,+//! macOS, and Windows, attached to the release its tag names.//!//! Unlike everything else this repo builds, the daemon runs on a machine we//! know nothing about: a self-hoster points it at their own checkout and their//! own agent harness. So the Linux builds are musl-static (there is no host-//! libc to match) and the macOS builds link nothing outside the OS. Neither is-//! taken on faith — `package_agent_daemon.sh` inspects each binary and refuses+//! libc to match), and the macOS and Windows builds link nothing outside the+//! OS. None of that is taken on faith — `package_agent_daemon.sh` inspects each binary and refuses//! to package one that would reach for something that will not be there.//!//! Separate from [`super::build_desktop_on_tag`] on purpose. It publishes to@@ -69,6 +69,21 @@ const MACOS_TARGETS: &[DaemonTarget] = &[},];+/// Built natively with MSVC: a cross-compile cannot link against the Windows+/// SDK import libraries, and this runner can smoke-run what it builds.+const WINDOWS_TARGETS: &[DaemonTarget] = &[DaemonTarget {+ triple: "x86_64-pc-windows-msvc",+ slug: "windows-x86_64",+ smoke_run: true,+}];++fn all_targets() -> impl Iterator<Item = &'static DaemonTarget> {+ LINUX_TARGETS+ .iter()+ .chain(MACOS_TARGETS)+ .chain(WINDOWS_TARGETS)+}+/// Build the workflow.pub fn build_agent_daemon_on_tag() -> Workflow {let mut workflow = Workflow::new("Build Agent Daemon on Tag")@@ -87,13 +102,16 @@ pub fn build_agent_daemon_on_tag() -> Workflow {for target in MACOS_TARGETS {workflow = workflow.add_job(job_id(target), macos_job(target).add_needs("resolve-ref"));}+ for target in WINDOWS_TARGETS {+ workflow = workflow.add_job(job_id(target), windows_job(target).add_needs("resolve-ref"));+ }let mut publish = build_appimage_on_tag::publish_job(RESOLVED_REF,xtask_paths::runtime_path!("release-artifacts/*"),).add_needs("resolve-ref");- for target in LINUX_TARGETS.iter().chain(MACOS_TARGETS) {+ for target in all_targets() {publish = publish.add_needs(job_id(target));}// A failed platform must not prevent successful platform artifacts from@@ -104,9 +122,7 @@ pub fn build_agent_daemon_on_tag() -> Workflow {}fn publish_when_any_build_succeeded() -> String {- let any_build = LINUX_TARGETS- .iter()- .chain(MACOS_TARGETS)+ let any_build = all_targets().map(|target| format!("needs.{}.result == 'success'", job_id(target))).collect::<Vec<_>>().join(" || ");@@ -206,6 +222,25 @@ fn macos_job(target: &DaemonTarget) -> Job {.add_step(upload_step(target))}+/// The runner's own Visual Studio toolchain links the binary; the build+/// script makes it independent of the Visual C++ redistributable.+fn windows_job(target: &DaemonTarget) -> Job {+ Job::default()+ .name(format!("Build daemon ({})", target.slug))+ .runs_on(runners::Runner::Windows.to_string())+ .add_step(steps::checkout_ref(RESOLVED_REF))+ .add_step(steps::setup_rust_light())+ .add_step(steps::derive_artifact_metadata(RESOLVED_REF))+ .add_step(+ Step::new("Build daemon")+ .run(include_str!("scripts/build_agent_daemon_windows.sh"))+ .shell("bash")+ .add_env(("TARGET", target.triple)),+ )+ .add_step(package_step(target))+ .add_step(upload_step(target))+}+fn package_step(target: &DaemonTarget) -> Step<Run> {Step::new("Package daemon").run(include_str!("scripts/package_agent_daemon.sh"))diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/build_agent_daemon_on_tag/test.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/build_agent_daemon_on_tag/test.rsindex 88c7a19311..f0a13fb25e 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/build_agent_daemon_on_tag/test.rs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/build_agent_daemon_on_tag/test.rs@@ -41,7 +41,7 @@ fn publish_runs_when_any_platform_succeeds() {assert!(if_line.contains("needs.resolve-ref.result"));assert!(if_line.contains(" || "));assert!(!if_line.contains(" && needs.build-daemon"));- for target in LINUX_TARGETS.iter().chain(MACOS_TARGETS) {+ for target in all_targets() {assert!(if_line.contains(&format!("needs.{}.result == ''success''", job_id(target))));}}diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/runners.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/runners.rsindex af6963dabb..fda5b00953 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/runners.rs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/runners.rs@@ -31,6 +31,9 @@ pub enum Runner {MacOsArm,/// Larger Apple Silicon machine for desktop release builds.MacOsArmLarge,+ /// Windows Server on x86_64, for jobs that need the MSVC toolchain. A+ /// machine label like [`Runner::MacOsArm`].+ Windows,}impl fmt::Display for Runner {@@ -42,6 +45,7 @@ impl fmt::Display for Runner {Runner::RustCi => "namespace-profile-linux-rust-ci",Runner::MacOsArm => "nscloud-macos-sequoia-arm64-6x14",Runner::MacOsArmLarge => "nscloud-macos-sequoia-arm64-12x28",+ Runner::Windows => "nscloud-windows-2022-amd64-8x16",})}}diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/build_agent_daemon_windows.sh b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/build_agent_daemon_windows.shnew file mode 100644index 0000000000..bf2af3d53d--- /dev/null+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/build_agent_daemon_windows.sh@@ -0,0 +1,26 @@+set -euo pipefail++# Windows build of the self-hosted coding-agent daemon, with the runner's MSVC+# toolchain.+#+# See build_agent_daemon_linux.sh for why sqlx runs offline.+export SQLX_OFFLINE=true++# Link the C runtime into the binary. Without this, macrod.exe needs the Visual+# C++ redistributable's vcruntime DLLs, which a user's machine may not have.+# With an explicit --target, RUSTFLAGS reach only target code, and the cc and+# cmake builds of the C dependencies follow it to the static runtime.+export RUSTFLAGS="-C target-feature=+crt-static"++# aws-lc-sys assembles its x86_64 crypto with NASM; it ships those objects+# pre-assembled, which saves installing NASM on the runner.+export AWS_LC_SYS_PREBUILT_NASM=1++rustup target add "$TARGET"++if ! command -v cmake >/dev/null 2>&1; then+ choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' --no-progress -y+ export PATH="/c/Program Files/CMake/bin:$PATH"+fi++cargo build --release --package coding_agent_worker --target "$TARGET"diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/package_agent_daemon.sh b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/package_agent_daemon.shindex 0e9c181d3a..4e2a9f7b04 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/package_agent_daemon.sh+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/package_agent_daemon.sh@@ -6,7 +6,11 @@ set -euo pipefail# exactly the failure this whole pipeline exists to prevent, so it is checked# here rather than assumed.-binary="target/$TARGET/release/macrod"+case "$TARGET" in+ *-windows-*) executable="macrod.exe" ;;+ *) executable="macrod" ;;+esac+binary="target/$TARGET/release/$executable"if [ ! -x "$binary" ]; thenecho "no daemon binary at $binary" >&2exit 1@@ -35,6 +39,19 @@ case "$TARGET" inexit 1fi;;+ *-windows-msvc)+ # Every DLL must come from Windows itself. Git Bash's ldd resolves the+ # imports; one found outside C:\Windows (a vcruntime, a build-tool DLL)+ # will not be on a user's machine.+ imports=$(ldd "$binary")+ strays=$(printf '%s\n' "$imports" | awk '$2 == "=>" { print $3 }' \+ | grep -Eiv '^(/c/windows/|\?\?\?$)' || true)+ if [ -n "$strays" ]; then+ echo "daemon links DLLs that will not exist on a user's PC:" >&2+ echo "$strays" >&2+ exit 1+ fi+ ;;*)echo "no self-containment check defined for $TARGET" >&2exit 1@@ -52,20 +69,34 @@ elsefimkdir -p artifacts-name="macrod-${SAFE_TAG}-${SLUG}"stage=$(mktemp -d)-install -m 755 "$binary" "$stage/macrod"-tar -czf "artifacts/${name}.tar.gz" -C "$stage" macrod-rm -rf "$stage"+install -m 755 "$binary" "$stage/$executable"-# coreutils on Linux, BSD/perl on macOS.-(- cd artifacts- if command -v sha256sum >/dev/null 2>&1; then- sha256sum "${name}.tar.gz" >"${name}.tar.gz.sha256"- else- shasum -a 256 "${name}.tar.gz" >"${name}.tar.gz.sha256"- fi-)+# Every archive is published twice: under the tag, and under a name without+# it, which `releases/latest/download/<name>` serves — the URL the install+# scripts download from.+for name in "macrod-${SAFE_TAG}-${SLUG}" "macrod-${SLUG}"; do+ case "$TARGET" in+ *-windows-*)+ archive="${name}.zip"+ powershell.exe -NoProfile -NonInteractive -Command \+ "Compress-Archive -Path '$(cygpath -w "$stage/$executable")' -DestinationPath '$(cygpath -w "artifacts/$archive")'"+ ;;+ *)+ archive="${name}.tar.gz"+ tar -czf "artifacts/$archive" -C "$stage" "$executable"+ ;;+ esac-echo "packaged ${name}.tar.gz"+ # coreutils on Linux and Git Bash, BSD/perl on macOS.+ (+ cd artifacts+ if command -v sha256sum >/dev/null 2>&1; then+ sha256sum "$archive" >"$archive.sha256"+ else+ shasum -a 256 "$archive" >"$archive.sha256"+ fi+ )+ echo "packaged $archive"+done+rm -rf "$stage"