tools: remove infra/agents from the tree
- Commit
e1f58df7fedbbe2474e92b537733aa2ee577232c- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-01 14:44 UTC (4 days ago)
- Parents
bc10202
Owner decision. The agent sandbox/orchestrator experiment (68 files, 19,403 counted lines) is out of the repo; consumer check found nothing builds, runs or tests against it in-repo (no Gradle/CI/script references; the root Cargo workspace only excluded it, and that entry is dropped). References in structure docs/tests cleaned; structure_check unit tests pass with fixtures moved. Git history preserves the code. Note for the owner: the deployed host stack it described (agents.maproj.org / agentd on maproj, /root/agent-world) keeps running if already up, but can no longer be rebuilt or re-set-up from this repo. The line-budget baseline regen from the working agent is deliberately not in this commit: run on the hot shared tree it also captured other in-flight shrinkage and would read as growth against the committed tree. The ratchet baseline stays 1,749,740 (removal = headroom); later LOC phases regen it as they land.
Diff
Cargo.toml
diff --git a/Cargo.toml b/Cargo.tomlindex cc3e795fb7..77960778aa 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -73,7 +73,7 @@ members = [ # missing member fails resolution of the whole workspace. Excluded entries may # match nothing, so this keeps the root workspace resolvable with and without # personal/ present.-exclude = ["library/tilecodec/src/main/rust", "personal/uniflix_strem/src/main/rust", "infra/agents"]+exclude = ["library/tilecodec/src/main/rust", "personal/uniflix_strem/src/main/rust"] resolver = "2" [workspace.package]
docs/structure/README.md
diff --git a/docs/structure/README.md b/docs/structure/README.mdindex 1a2e16cd57..1aeea9c0eb 100644--- a/docs/structure/README.md+++ b/docs/structure/README.md@@ -102,18 +102,15 @@ Deliberate growth requires bumping the baseline in the same change: run `python3 tools/structure_check.py lines --regen`, review the `line-budget.json` diff, and include it with the source change. -The baseline was measured at 1,749,740 lines on 2026-12-01 with the-method above. (The LOC plan's 1,638,083 figure from 2026-11-30 is-reproduced almost exactly — 1,637,724 today — only if `scripts/` and-`infra/` are also excluded; this ratchet counts them, per the plan's-stated `third_party/`-only exclusion, so its baseline is higher.)+The baseline is 1,730,008 lines, measured with the method above.+(`scripts/` is counted, per the plan's stated `third_party/`-only+exclusion, so the baseline is higher than a `scripts/`-excluded count.) Exclusions are data-driven in `line-budget.json` (`excluded_modules`). The only exclusion is `communicate-dev`, the Communicate dev module, pre-registered before it existed: the exact name is `include(":communicate-dev")` with dir `communicate-dev/` (`settings.gradle.kts` also has `:madeveloper`, a different app), and-only that exact module is excluded. `infra/` (including-`infra/agents`) is deliberately counted.+only that exact module is excluded. Tests: `python3 tools/test_structure_check.py`.
infra/agents/.env.example
diff --git a/infra/agents/.env.example b/infra/agents/.env.exampledeleted file mode 100644index 372497d42f..0000000000--- a/infra/agents/.env.example+++ /dev/null@@ -1,26 +0,0 @@-# agentd environment (/root/agent-world/.env on the host).-# Copy to /root/agent-world/.env and fill in secrets. Never commit the file.-# Consumed via `env_file` by the agentd service only (builder/sandbox gets-# no secrets).--# OpenRouter API key for the coding model.-OPENROUTER_API_KEY=-# Argon2 PHC hash of the UI password (generate with e.g.-# `python3 -c "import argon2..."` or `mkpasswd --method=argon2id`).-AGENTD_PASSWORD_HASH=-# Git push token for the git.maproj.org mirror (agent branches push here).-GIT_AGENT_PUSH_TOKEN=-# Mirror origin for agent branches.-AGENTD_REPO_URL=https://git.maproj.org/Modern-Apps.git-# Public origin served by Caddy (agents.maproj.org -> agents-ui:8080).-AGENTD_PUBLIC_ORIGIN=https://agents.maproj.org-# Default model for coding turns.-AGENTD_DEFAULT_MODEL=-# GitHub token (agentd only, never the sandbox): reads issues, and on Approve-# / triage comments and edits labels. Needs Issues read/write on the repo.-AGENTD_GITHUB_TOKEN=-# Repo for issues (default vayun-mathur/Modern-Apps).-AGENTD_GITHUB_REPO=-# Automatic triage of NEW issues (no backfill): 0 disables; poll interval.-AGENTD_TRIAGE=1-AGENTD_TRIAGE_INTERVAL_SECS=120
infra/agents/.gitignore
diff --git a/infra/agents/.gitignore b/infra/agents/.gitignoredeleted file mode 100644index 2f7896d1d1..0000000000--- a/infra/agents/.gitignore+++ /dev/null@@ -1 +0,0 @@-target/
infra/agents/Cargo.lock
diff --git a/infra/agents/Cargo.lock b/infra/agents/Cargo.lockdeleted file mode 100644index b0f398c79e..0000000000--- a/infra/agents/Cargo.lock+++ /dev/null@@ -1,2025 +0,0 @@-# This file is automatically @generated by Cargo.-# It is not intended for manual editing.-version = 4--[[package]]-name = "agent-runner"-version = "0.1.0"-dependencies = [- "axum",- "libc",- "proto",- "serde",- "serde_json",- "tempfile",- "tokio",-]--[[package]]-name = "agentd"-version = "0.1.0"-dependencies = [- "argon2",- "axum",- "maud",- "proto",- "pulldown-cmark",- "rand 0.9.5",- "reqwest",- "rusqlite",- "serde",- "serde_json",- "sha2",- "tempfile",- "tokio",- "tokio-stream",- "tracing",- "tracing-subscriber",-]--[[package]]-name = "ahash"-version = "0.8.12"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"-dependencies = [- "cfg-if",- "once_cell",- "version_check",- "zerocopy",-]--[[package]]-name = "aho-corasick"-version = "1.1.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"-dependencies = [- "memchr",-]--[[package]]-name = "argon2"-version = "0.5.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3c3610892ee6e0cbce8ae2700349fcf8f98adb0dbfbee85aec3c9179d29cc072"-dependencies = [- "base64ct",- "blake2",- "cpufeatures 0.2.17",- "password-hash",-]--[[package]]-name = "async-trait"-version = "0.1.92"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"-dependencies = [- "proc-macro2",- "quote",- "syn 3.0.9",-]--[[package]]-name = "atomic-waker"-version = "1.1.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"--[[package]]-name = "axum"-version = "0.7.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f"-dependencies = [- "async-trait",- "axum-core",- "bytes",- "futures-util",- "http",- "http-body",- "http-body-util",- "hyper",- "hyper-util",- "itoa",- "matchit",- "memchr",- "mime",- "percent-encoding",- "pin-project-lite",- "rustversion",- "serde",- "serde_json",- "serde_path_to_error",- "serde_urlencoded",- "sync_wrapper",- "tokio",- "tower",- "tower-layer",- "tower-service",- "tracing",-]--[[package]]-name = "axum-core"-version = "0.4.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199"-dependencies = [- "async-trait",- "bytes",- "futures-util",- "http",- "http-body",- "http-body-util",- "mime",- "pin-project-lite",- "rustversion",- "sync_wrapper",- "tower-layer",- "tower-service",- "tracing",-]--[[package]]-name = "base64"-version = "0.22.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"--[[package]]-name = "base64"-version = "0.23.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5"--[[package]]-name = "base64ct"-version = "1.8.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"--[[package]]-name = "bitflags"-version = "2.13.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"--[[package]]-name = "blake2"-version = "0.10.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe"-dependencies = [- "digest",-]--[[package]]-name = "block-buffer"-version = "0.10.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"-dependencies = [- "generic-array",-]--[[package]]-name = "bumpalo"-version = "3.20.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"--[[package]]-name = "bytes"-version = "1.12.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"--[[package]]-name = "cc"-version = "1.11.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "375989decec1a0fa424442bed520fa12ede43a48475ce8c7417d2c69b32b5f6b"-dependencies = [- "find-msvc-tools",- "shlex",-]--[[package]]-name = "cfg-if"-version = "1.0.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"--[[package]]-name = "cfg_aliases"-version = "0.2.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"--[[package]]-name = "chacha20"-version = "0.10.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"-dependencies = [- "cfg-if",- "cpufeatures 0.3.1",- "rand_core 0.10.1",-]--[[package]]-name = "cpufeatures"-version = "0.2.17"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"-dependencies = [- "libc",-]--[[package]]-name = "cpufeatures"-version = "0.3.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"-dependencies = [- "libc",-]--[[package]]-name = "crypto-common"-version = "0.1.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"-dependencies = [- "generic-array",- "typenum",-]--[[package]]-name = "digest"-version = "0.10.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"-dependencies = [- "block-buffer",- "crypto-common",- "subtle",-]--[[package]]-name = "displaydoc"-version = "0.2.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"-dependencies = [- "proc-macro2",- "quote",- "syn 3.0.9",-]--[[package]]-name = "errno"-version = "0.3.14"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"-dependencies = [- "libc",- "windows-sys 0.61.2",-]--[[package]]-name = "fallible-iterator"-version = "0.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"--[[package]]-name = "fallible-streaming-iterator"-version = "0.1.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"--[[package]]-name = "fastrand"-version = "2.5.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"--[[package]]-name = "find-msvc-tools"-version = "0.1.15"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"--[[package]]-name = "form_urlencoded"-version = "1.2.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"-dependencies = [- "percent-encoding",-]--[[package]]-name = "futures-channel"-version = "0.3.34"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4"-dependencies = [- "futures-core",-]--[[package]]-name = "futures-core"-version = "0.3.34"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"--[[package]]-name = "futures-sink"-version = "0.3.34"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d"--[[package]]-name = "futures-task"-version = "0.3.34"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"--[[package]]-name = "futures-util"-version = "0.3.34"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"-dependencies = [- "futures-core",- "futures-task",- "pin-project-lite",- "slab",-]--[[package]]-name = "generic-array"-version = "0.14.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"-dependencies = [- "typenum",- "version_check",-]--[[package]]-name = "getopts"-version = "0.2.24"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df"-dependencies = [- "unicode-width",-]--[[package]]-name = "getrandom"-version = "0.2.17"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"-dependencies = [- "cfg-if",- "js-sys",- "libc",- "wasi",- "wasm-bindgen",-]--[[package]]-name = "getrandom"-version = "0.3.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"-dependencies = [- "cfg-if",- "libc",- "r-efi 5.3.0",- "wasip2",-]--[[package]]-name = "getrandom"-version = "0.4.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"-dependencies = [- "cfg-if",- "js-sys",- "libc",- "r-efi 6.0.0",- "rand_core 0.10.1",- "wasm-bindgen",-]--[[package]]-name = "hashbrown"-version = "0.14.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"-dependencies = [- "ahash",-]--[[package]]-name = "hashlink"-version = "0.9.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af"-dependencies = [- "hashbrown",-]--[[package]]-name = "http"-version = "1.5.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"-dependencies = [- "bytes",- "itoa",-]--[[package]]-name = "http-body"-version = "1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c"-dependencies = [- "bytes",- "http",-]--[[package]]-name = "http-body-util"-version = "0.1.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c"-dependencies = [- "bytes",- "futures-core",- "http",- "http-body",- "pin-project-lite",-]--[[package]]-name = "httparse"-version = "1.10.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"--[[package]]-name = "httpdate"-version = "1.0.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"--[[package]]-name = "hyper"-version = "1.12.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c"-dependencies = [- "atomic-waker",- "bytes",- "futures-core",- "http",- "http-body",- "httparse",- "httpdate",- "itoa",- "pin-project-lite",- "smallvec",- "tokio",- "want",-]--[[package]]-name = "hyper-rustls"-version = "0.27.10"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53"-dependencies = [- "http",- "hyper",- "hyper-util",- "rustls",- "tokio",- "tokio-rustls",- "tower-service",- "webpki-roots",-]--[[package]]-name = "hyper-util"-version = "0.1.21"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff"-dependencies = [- "base64 0.23.1",- "bytes",- "futures-channel",- "futures-util",- "http",- "http-body",- "httparse",- "hyper",- "ipnet",- "libc",- "percent-encoding",- "pin-project-lite",- "socket2",- "tokio",- "tower-service",- "tracing",-]--[[package]]-name = "icu_collections"-version = "2.4.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd"-dependencies = [- "displaydoc",- "potential_utf",- "utf8_iter",- "yoke",- "zerofrom",- "zerovec",-]--[[package]]-name = "icu_locale_core"-version = "2.4.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0"-dependencies = [- "displaydoc",- "litemap",- "tinystr",- "writeable",- "zerovec",-]--[[package]]-name = "icu_normalizer"-version = "2.4.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599"-dependencies = [- "icu_collections",- "icu_normalizer_data",- "icu_properties",- "icu_provider",- "smallvec",- "zerovec",-]--[[package]]-name = "icu_normalizer_data"-version = "2.4.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc"--[[package]]-name = "icu_properties"-version = "2.4.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f"-dependencies = [- "displaydoc",- "icu_collections",- "icu_locale_core",- "icu_properties_data",- "icu_provider",- "zerotrie",- "zerovec",-]--[[package]]-name = "icu_properties_data"-version = "2.4.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf"--[[package]]-name = "icu_provider"-version = "2.4.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514"-dependencies = [- "displaydoc",- "icu_locale_core",- "writeable",- "yoke",- "zerofrom",- "zerotrie",- "zerovec",-]--[[package]]-name = "idna"-version = "1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"-dependencies = [- "idna_adapter",- "smallvec",- "utf8_iter",-]--[[package]]-name = "idna_adapter"-version = "1.2.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"-dependencies = [- "icu_normalizer",- "icu_properties",-]--[[package]]-name = "ipnet"-version = "2.12.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0"--[[package]]-name = "itoa"-version = "1.0.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"--[[package]]-name = "js-sys"-version = "0.3.107"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a"-dependencies = [- "cfg-if",- "futures-util",- "wasm-bindgen",-]--[[package]]-name = "lazy_static"-version = "1.5.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"--[[package]]-name = "libc"-version = "0.2.191"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"--[[package]]-name = "libsqlite3-sys"-version = "0.30.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149"-dependencies = [- "cc",- "pkg-config",- "vcpkg",-]--[[package]]-name = "linux-raw-sys"-version = "0.12.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"--[[package]]-name = "litemap"-version = "0.8.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae"--[[package]]-name = "lock_api"-version = "0.4.14"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"-dependencies = [- "scopeguard",-]--[[package]]-name = "log"-version = "0.4.35"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c"--[[package]]-name = "lru-slab"-version = "0.1.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f"--[[package]]-name = "matchers"-version = "0.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"-dependencies = [- "regex-automata",-]--[[package]]-name = "matchit"-version = "0.7.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"--[[package]]-name = "maud"-version = "0.27.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8156733e27020ea5c684db5beac5d1d611e1272ab17901a49466294b84fc217e"-dependencies = [- "itoa",- "maud_macros",-]--[[package]]-name = "maud_macros"-version = "0.27.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7261b00f3952f617899bc012e3dbd56e4f0110a038175929fa5d18e5a19913ca"-dependencies = [- "proc-macro2",- "proc-macro2-diagnostics",- "quote",- "syn 2.0.119",-]--[[package]]-name = "memchr"-version = "2.8.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"--[[package]]-name = "mime"-version = "0.3.17"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"--[[package]]-name = "mio"-version = "1.2.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee"-dependencies = [- "libc",- "wasi",- "windows-sys 0.61.2",-]--[[package]]-name = "nu-ansi-term"-version = "0.50.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"-dependencies = [- "windows-sys 0.61.2",-]--[[package]]-name = "once_cell"-version = "1.21.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"--[[package]]-name = "parking_lot"-version = "0.12.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"-dependencies = [- "lock_api",- "parking_lot_core",-]--[[package]]-name = "parking_lot_core"-version = "0.9.12"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"-dependencies = [- "cfg-if",- "libc",- "redox_syscall",- "smallvec",- "windows-link",-]--[[package]]-name = "password-hash"-version = "0.5.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166"-dependencies = [- "base64ct",- "rand_core 0.6.4",- "subtle",-]--[[package]]-name = "percent-encoding"-version = "2.3.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"--[[package]]-name = "pin-project-lite"-version = "0.2.17"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"--[[package]]-name = "pkg-config"-version = "0.3.34"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"--[[package]]-name = "potential_utf"-version = "0.1.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661"-dependencies = [- "zerovec",-]--[[package]]-name = "ppv-lite86"-version = "0.2.21"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"-dependencies = [- "zerocopy",-]--[[package]]-name = "proc-macro2"-version = "1.0.107"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"-dependencies = [- "unicode-ident",-]--[[package]]-name = "proc-macro2-diagnostics"-version = "0.10.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",- "version_check",-]--[[package]]-name = "proto"-version = "0.1.0"-dependencies = [- "serde",-]--[[package]]-name = "pulldown-cmark"-version = "0.12.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14"-dependencies = [- "bitflags",- "getopts",- "memchr",- "pulldown-cmark-escape",- "unicase",-]--[[package]]-name = "pulldown-cmark-escape"-version = "0.11.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae"--[[package]]-name = "quinn"-version = "0.11.12"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11"-dependencies = [- "bytes",- "cfg_aliases",- "pin-project-lite",- "quinn-proto",- "quinn-udp",- "rustc-hash",- "rustls",- "socket2",- "thiserror",- "tokio",- "tracing",- "web-time",-]--[[package]]-name = "quinn-proto"-version = "0.11.19"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe"-dependencies = [- "bytes",- "getrandom 0.4.3",- "lru-slab",- "rand 0.10.3",- "rand_pcg",- "ring",- "rustc-hash",- "rustls",- "rustls-pki-types",- "slab",- "thiserror",- "tinyvec",- "tracing",- "web-time",-]--[[package]]-name = "quinn-udp"-version = "0.5.16"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016"-dependencies = [- "cfg_aliases",- "libc",- "once_cell",- "socket2",- "tracing",- "windows-sys 0.61.2",-]--[[package]]-name = "quote"-version = "1.0.47"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"-dependencies = [- "proc-macro2",-]--[[package]]-name = "r-efi"-version = "5.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"--[[package]]-name = "r-efi"-version = "6.0.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"--[[package]]-name = "rand"-version = "0.9.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41"-dependencies = [- "rand_chacha",- "rand_core 0.9.5",-]--[[package]]-name = "rand"-version = "0.10.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af"-dependencies = [- "chacha20",- "getrandom 0.4.3",- "rand_core 0.10.1",-]--[[package]]-name = "rand_chacha"-version = "0.9.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"-dependencies = [- "ppv-lite86",- "rand_core 0.9.5",-]--[[package]]-name = "rand_core"-version = "0.6.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"--[[package]]-name = "rand_core"-version = "0.9.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"-dependencies = [- "getrandom 0.3.4",-]--[[package]]-name = "rand_core"-version = "0.10.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"--[[package]]-name = "rand_pcg"-version = "0.10.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a"-dependencies = [- "rand_core 0.10.1",-]--[[package]]-name = "redox_syscall"-version = "0.5.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"-dependencies = [- "bitflags",-]--[[package]]-name = "regex-automata"-version = "0.4.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"-dependencies = [- "aho-corasick",- "memchr",- "regex-syntax",-]--[[package]]-name = "regex-syntax"-version = "0.8.11"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"--[[package]]-name = "reqwest"-version = "0.12.28"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"-dependencies = [- "base64 0.22.1",- "bytes",- "futures-core",- "http",- "http-body",- "http-body-util",- "hyper",- "hyper-rustls",- "hyper-util",- "js-sys",- "log",- "percent-encoding",- "pin-project-lite",- "quinn",- "rustls",- "rustls-pki-types",- "serde",- "serde_json",- "serde_urlencoded",- "sync_wrapper",- "tokio",- "tokio-rustls",- "tower",- "tower-http",- "tower-service",- "url",- "wasm-bindgen",- "wasm-bindgen-futures",- "web-sys",- "webpki-roots",-]--[[package]]-name = "ring"-version = "0.17.14"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"-dependencies = [- "cc",- "cfg-if",- "getrandom 0.2.17",- "libc",- "untrusted",- "windows-sys 0.52.0",-]--[[package]]-name = "rusqlite"-version = "0.32.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e"-dependencies = [- "bitflags",- "fallible-iterator",- "fallible-streaming-iterator",- "hashlink",- "libsqlite3-sys",- "smallvec",-]--[[package]]-name = "rustc-hash"-version = "2.1.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"--[[package]]-name = "rustix"-version = "1.1.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa"-dependencies = [- "bitflags",- "errno",- "libc",- "linux-raw-sys",- "windows-sys 0.61.2",-]--[[package]]-name = "rustls"-version = "0.23.46"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"-dependencies = [- "once_cell",- "ring",- "rustls-pki-types",- "rustls-webpki",- "subtle",- "zeroize",-]--[[package]]-name = "rustls-pki-types"-version = "1.15.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96"-dependencies = [- "web-time",- "zeroize",-]--[[package]]-name = "rustls-webpki"-version = "0.103.16"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281"-dependencies = [- "ring",- "rustls-pki-types",- "untrusted",-]--[[package]]-name = "rustversion"-version = "1.0.23"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"--[[package]]-name = "ryu"-version = "1.0.23"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"--[[package]]-name = "scopeguard"-version = "1.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"--[[package]]-name = "serde"-version = "1.0.229"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"-dependencies = [- "serde_core",- "serde_derive",-]--[[package]]-name = "serde_core"-version = "1.0.229"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"-dependencies = [- "serde_derive",-]--[[package]]-name = "serde_derive"-version = "1.0.229"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"-dependencies = [- "proc-macro2",- "quote",- "syn 3.0.9",-]--[[package]]-name = "serde_json"-version = "1.0.154"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"-dependencies = [- "itoa",- "memchr",- "serde",- "serde_core",- "zmij",-]--[[package]]-name = "serde_path_to_error"-version = "0.1.20"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457"-dependencies = [- "itoa",- "serde",- "serde_core",-]--[[package]]-name = "serde_urlencoded"-version = "0.7.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"-dependencies = [- "form_urlencoded",- "itoa",- "ryu",- "serde",-]--[[package]]-name = "sha2"-version = "0.10.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"-dependencies = [- "cfg-if",- "cpufeatures 0.2.17",- "digest",-]--[[package]]-name = "sharded-slab"-version = "0.1.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"-dependencies = [- "lazy_static",-]--[[package]]-name = "shlex"-version = "2.0.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"--[[package]]-name = "signal-hook-registry"-version = "1.4.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"-dependencies = [- "errno",- "libc",-]--[[package]]-name = "slab"-version = "0.4.12"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"--[[package]]-name = "smallvec"-version = "1.16.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8"--[[package]]-name = "socket2"-version = "0.6.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"-dependencies = [- "libc",- "windows-sys 0.61.2",-]--[[package]]-name = "stable_deref_trait"-version = "1.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"--[[package]]-name = "subtle"-version = "2.6.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"--[[package]]-name = "syn"-version = "2.0.119"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"-dependencies = [- "proc-macro2",- "quote",- "unicode-ident",-]--[[package]]-name = "syn"-version = "3.0.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"-dependencies = [- "proc-macro2",- "quote",- "unicode-ident",-]--[[package]]-name = "sync_wrapper"-version = "1.0.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"-dependencies = [- "futures-core",-]--[[package]]-name = "synstructure"-version = "0.14.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02"-dependencies = [- "proc-macro2",- "quote",- "syn 3.0.9",-]--[[package]]-name = "tempfile"-version = "3.27.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"-dependencies = [- "fastrand",- "getrandom 0.4.3",- "once_cell",- "rustix",- "windows-sys 0.61.2",-]--[[package]]-name = "thiserror"-version = "2.0.21"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e"-dependencies = [- "thiserror-impl",-]--[[package]]-name = "thiserror-impl"-version = "2.0.21"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"-dependencies = [- "proc-macro2",- "quote",- "syn 3.0.9",-]--[[package]]-name = "thread_local"-version = "1.1.10"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070"-dependencies = [- "cfg-if",-]--[[package]]-name = "tinystr"-version = "0.8.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a"-dependencies = [- "displaydoc",- "zerovec",-]--[[package]]-name = "tinyvec"-version = "1.13.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"--[[package]]-name = "tokio"-version = "1.54.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3"-dependencies = [- "bytes",- "libc",- "mio",- "parking_lot",- "pin-project-lite",- "signal-hook-registry",- "socket2",- "tokio-macros",- "windows-sys 0.61.2",-]--[[package]]-name = "tokio-macros"-version = "2.7.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"-dependencies = [- "proc-macro2",- "quote",- "syn 3.0.9",-]--[[package]]-name = "tokio-rustls"-version = "0.26.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db"-dependencies = [- "rustls",- "tokio",-]--[[package]]-name = "tokio-stream"-version = "0.1.19"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b"-dependencies = [- "futures-core",- "pin-project-lite",- "tokio",- "tokio-util",-]--[[package]]-name = "tokio-util"-version = "0.7.20"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b"-dependencies = [- "bytes",- "futures-core",- "futures-sink",- "pin-project-lite",- "tokio",-]--[[package]]-name = "tower"-version = "0.5.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"-dependencies = [- "futures-core",- "futures-util",- "pin-project-lite",- "sync_wrapper",- "tokio",- "tower-layer",- "tower-service",- "tracing",-]--[[package]]-name = "tower-http"-version = "0.6.11"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840"-dependencies = [- "bitflags",- "bytes",- "futures-util",- "http",- "http-body",- "pin-project-lite",- "tower",- "tower-layer",- "tower-service",- "url",-]--[[package]]-name = "tower-layer"-version = "0.3.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"--[[package]]-name = "tower-service"-version = "0.3.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"--[[package]]-name = "tracing"-version = "0.1.44"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"-dependencies = [- "log",- "pin-project-lite",- "tracing-attributes",- "tracing-core",-]--[[package]]-name = "tracing-attributes"-version = "0.1.31"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]--[[package]]-name = "tracing-core"-version = "0.1.36"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"-dependencies = [- "once_cell",- "valuable",-]--[[package]]-name = "tracing-log"-version = "0.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"-dependencies = [- "log",- "once_cell",- "tracing-core",-]--[[package]]-name = "tracing-subscriber"-version = "0.3.23"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"-dependencies = [- "matchers",- "nu-ansi-term",- "once_cell",- "regex-automata",- "sharded-slab",- "smallvec",- "thread_local",- "tracing",- "tracing-core",- "tracing-log",-]--[[package]]-name = "try-lock"-version = "0.2.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"--[[package]]-name = "typenum"-version = "1.20.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"--[[package]]-name = "unicase"-version = "2.9.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"--[[package]]-name = "unicode-ident"-version = "1.0.27"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"--[[package]]-name = "unicode-width"-version = "0.2.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557"--[[package]]-name = "untrusted"-version = "0.9.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"--[[package]]-name = "url"-version = "2.5.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"-dependencies = [- "form_urlencoded",- "idna",- "percent-encoding",- "serde",-]--[[package]]-name = "utf8_iter"-version = "1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0"-dependencies = [- "utf_types",-]--[[package]]-name = "utf_types"-version = "1.0.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6"--[[package]]-name = "valuable"-version = "0.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"--[[package]]-name = "vcpkg"-version = "0.2.15"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"--[[package]]-name = "version_check"-version = "0.9.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"--[[package]]-name = "want"-version = "0.3.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b"-dependencies = [- "try-lock",-]--[[package]]-name = "wasi"-version = "0.11.1+wasi-snapshot-preview1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"--[[package]]-name = "wasip2"-version = "1.0.4+wasi-0.2.12"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487"-dependencies = [- "wit-bindgen",-]--[[package]]-name = "wasm-bindgen"-version = "0.2.130"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c"-dependencies = [- "cfg-if",- "rustversion",- "wasm-bindgen-macro",- "wasm-bindgen-shared",-]--[[package]]-name = "wasm-bindgen-futures"-version = "0.4.80"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501"-dependencies = [- "js-sys",- "tokio",- "wasm-bindgen",-]--[[package]]-name = "wasm-bindgen-macro"-version = "0.2.130"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9"-dependencies = [- "quote",- "wasm-bindgen-macro-support",-]--[[package]]-name = "wasm-bindgen-macro-support"-version = "0.2.130"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a"-dependencies = [- "bumpalo",- "proc-macro2",- "quote",- "syn 3.0.9",- "wasm-bindgen-shared",-]--[[package]]-name = "wasm-bindgen-shared"-version = "0.2.130"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e"-dependencies = [- "unicode-ident",-]--[[package]]-name = "web-sys"-version = "0.3.107"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88"-dependencies = [- "js-sys",- "wasm-bindgen",-]--[[package]]-name = "web-time"-version = "1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"-dependencies = [- "js-sys",- "wasm-bindgen",-]--[[package]]-name = "webpki-roots"-version = "1.0.11"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f5f280bbb2b287bc8e7de7e3852945a0ff50d1bbcb5ed42b6c7a568c546df171"-dependencies = [- "rustls-pki-types",-]--[[package]]-name = "windows-link"-version = "0.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"--[[package]]-name = "windows-sys"-version = "0.52.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"-dependencies = [- "windows-targets",-]--[[package]]-name = "windows-sys"-version = "0.61.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"-dependencies = [- "windows-link",-]--[[package]]-name = "windows-targets"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"-dependencies = [- "windows_aarch64_gnullvm",- "windows_aarch64_msvc",- "windows_i686_gnu",- "windows_i686_gnullvm",- "windows_i686_msvc",- "windows_x86_64_gnu",- "windows_x86_64_gnullvm",- "windows_x86_64_msvc",-]--[[package]]-name = "windows_aarch64_gnullvm"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"--[[package]]-name = "windows_aarch64_msvc"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"--[[package]]-name = "windows_i686_gnu"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"--[[package]]-name = "windows_i686_gnullvm"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"--[[package]]-name = "windows_i686_msvc"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"--[[package]]-name = "windows_x86_64_gnu"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"--[[package]]-name = "windows_x86_64_gnullvm"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"--[[package]]-name = "windows_x86_64_msvc"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"--[[package]]-name = "wit-bindgen"-version = "0.57.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"--[[package]]-name = "writeable"-version = "0.6.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"--[[package]]-name = "yoke"-version = "0.8.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3"-dependencies = [- "stable_deref_trait",- "yoke-derive",- "zerofrom",-]--[[package]]-name = "yoke-derive"-version = "0.8.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71"-dependencies = [- "proc-macro2",- "quote",- "syn 3.0.9",- "synstructure",-]--[[package]]-name = "zerocopy"-version = "0.8.63"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8"-dependencies = [- "zerocopy-derive",-]--[[package]]-name = "zerocopy-derive"-version = "0.8.63"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]--[[package]]-name = "zerofrom"-version = "0.1.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"-dependencies = [- "zerofrom-derive",-]--[[package]]-name = "zerofrom-derive"-version = "0.1.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a"-dependencies = [- "proc-macro2",- "quote",- "syn 3.0.9",- "synstructure",-]--[[package]]-name = "zeroize"-version = "1.9.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879"--[[package]]-name = "zerotrie"-version = "0.2.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f"-dependencies = [- "displaydoc",- "yoke",- "zerofrom",-]--[[package]]-name = "zerovec"-version = "0.11.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40"-dependencies = [- "yoke",- "zerofrom",- "zerovec-derive",-]--[[package]]-name = "zerovec-derive"-version = "0.11.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a"-dependencies = [- "proc-macro2",- "quote",- "syn 3.0.9",-]--[[package]]-name = "zmij"-version = "1.0.23"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
infra/agents/Cargo.toml
diff --git a/infra/agents/Cargo.toml b/infra/agents/Cargo.tomldeleted file mode 100644index 79d229187f..0000000000--- a/infra/agents/Cargo.toml+++ /dev/null@@ -1,27 +0,0 @@-[workspace]-members = ["proto", "agentd", "runner"]-resolver = "2"--[workspace.package]-version = "0.1.0"-edition = "2021"-publish = false-license = "Apache-2.0"--[workspace.dependencies]-proto = { path = "proto" }-serde = { version = "1", features = ["derive"] }-serde_json = "1"-tokio = { version = "1", features = ["full"] }-axum = { version = "0.7" }-reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }-rusqlite = { version = "0.32", features = ["bundled"] }-argon2 = "0.5"-rand = "0.9"-sha2 = "0.10"-tracing = "0.1"-tracing-subscriber = { version = "0.3", features = ["env-filter"] }-maud = "0.27"-pulldown-cmark = "0.12"-tempfile = "3"-tokio-stream = { version = "0.1", features = ["sync"] }
infra/agents/Dockerfile.agentd
diff --git a/infra/agents/Dockerfile.agentd b/infra/agents/Dockerfile.agentddeleted file mode 100644index c9bdde2f98..0000000000--- a/infra/agents/Dockerfile.agentd+++ /dev/null@@ -1,27 +0,0 @@-# agentd: trusted orchestrator (web UI, task queue, OpenRouter loop, git push).-# Build context is infra/agents (Cargo workspace: proto, agentd, runner).--FROM rust:1-bookworm AS build-WORKDIR /src-COPY Cargo.toml Cargo.lock ./-COPY proto ./proto-COPY agentd ./agentd-# cargo resolves every workspace member even with -p; stub the runner.-COPY runner/Cargo.toml ./runner/Cargo.toml-RUN mkdir -p runner/src && echo 'fn main() {}' > runner/src/main.rs \- && echo '' > runner/src/lib.rs-RUN cargo build -p agentd --release --locked--FROM debian:bookworm-slim-RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \- && rm -rf /var/lib/apt/lists/* \- && groupadd -g 10002 agentd \- && useradd -u 10002 -g 10002 -d /state -M -s /usr/sbin/nologin agentd \- && mkdir -p /state /mirror /signal \- && chown 10002:10002 /state /mirror-COPY --from=build /src/target/release/agentd /usr/local/bin/agentd-USER 10002:10002-# Mirror is shared read-only with the builder (another uid): keep it world-readable.-ENV HOME=/state-EXPOSE 8080-ENTRYPOINT ["/usr/local/bin/agentd"]
infra/agents/Dockerfile.builder
diff --git a/infra/agents/Dockerfile.builder b/infra/agents/Dockerfile.builderdeleted file mode 100644index 19977017ab..0000000000--- a/infra/agents/Dockerfile.builder+++ /dev/null@@ -1,84 +0,0 @@-# ----------------------------------------------------------------------------# agents builder — the sandbox image agent code runs in.-#-# FROM location-share-builder:local (Ubuntu 24.04, JDK 21, Android SDK +-# NDK 29.0.14206865 at /opt/android-sdk, Rust 1.97 in /cargo-home,-# GRADLE_USER_HOME=/gradle-cache, /root/.cargo -> /cargo-home). On top it-# adds the agent-runner HTTP server plus the sandbox conventions the agents-# harness expects:-# - unprivileged `agent` user (uid/gid 10001); the `builder` compose-# service runs as this user,-# - /home/agent/.cargo -> /cargo-home (build-logic/RustNative.kt invokes-# $HOME/.cargo/bin/cargo and ignores CARGO_HOME),-# - baked /opt/agent/gradle.properties (copied into /gradle-cache by the-# builder-init service at first boot),-# - ripgrep for the runner's /search route.-#-# Build context is infra/agents (a Cargo workspace with proto, agentd,-# runner); only the runner is compiled in. The `location-share-builder:local`-# base must exist first (built from /root/location_share_server), so this-# image is built with `docker compose -p agents -f infra/agents/compose.yml-# build` on the host, never here.-#-# NOTE: the base image declares VOLUME ["/gradle-cache","/cargo-home",-# "/opt/android-sdk"]. A VOLUME path cannot be chowned in later RUN layers-# and becomes an anonymous volume if not mounted, so compose mounts all-# three explicitly (bind-backed named volumes seeded from the image).-# -----------------------------------------------------------------------------# ---- stage 1: compile agent-runner ----------------------------------------FROM rust:1-bookworm AS runner-build-WORKDIR /src-# Workspace layout: Cargo.toml + the three member crates. Copying only these-# keeps the build cache stable when unrelated tree files change.-COPY Cargo.toml Cargo.lock ./-COPY proto ./proto-COPY runner ./runner-# agentd has its own Dockerfile; only its manifest is needed here (plus an-# empty main) so the workspace resolves without compiling it.-COPY agentd/Cargo.toml ./agentd/Cargo.toml-RUN mkdir -p agentd/src && echo 'fn main() {}' > agentd/src/main.rs-RUN cargo build -p agent-runner --release --locked--# ---- stage 2: sandbox --------------------------------------------------------FROM location-share-builder:local--ENV ANDROID_HOME=/opt/android-sdk \- ANDROID_SDK_ROOT=/opt/android-sdk--RUN apt-get update && apt-get install -y --no-install-recommends \- ripgrep \- tini \- && rm -rf /var/lib/apt/lists/*--# Unprivileged sandbox user. The compose file runs the builder service as-# 10001:10001 and bind-mounts the caches; /home/agent/.cargo mirrors the-# base image's /root/.cargo symlink so Gradle's RustNative.kt finds cargo.-RUN groupadd -g 10001 agent \- && useradd -m -u 10001 -g 10001 -d /home/agent -s /bin/bash agent \- && ln -sfn /cargo-home /home/agent/.cargo--COPY --from=runner-build /src/target/release/agent-runner /usr/local/bin/agent-runner--# The mirror is owned by agentd's uid; git 2.43 only honours safe.directory-# from system/global config (not `-c`), so trust it here or every clone fails-# with "dubious ownership".-RUN git config --system --add safe.directory /mirror/Modern-Apps.git--# Stand-in for no-new-privileges (unusable under snap Docker, see compose.yml):-# with no setuid/setgid binaries, the uid-10001 sandbox has no path to root.-RUN find / -xdev -type f -perm /6000 -exec chmod a-s {} + 2>/dev/null || true--# Gradle memory/concurrency profile for the 6-CPU / 14 GB sandbox (smaller-# than release builds: 4 workers / 12 GB). builder-init copies this into-# /gradle-cache/gradle.properties on first boot; a repo-level-# gradle.properties is left untouched.-COPY gradle.properties /opt/agent/gradle.properties--WORKDIR /builds/slots--# Undo the base image's release ENTRYPOINT: this container serves the runner-# API instead. tini reaps stray grandchildren so killpg'd builds don't leak-# zombies into pid 1.-ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/agent-runner"]-CMD []
infra/agents/README.md
diff --git a/infra/agents/README.md b/infra/agents/README.mddeleted file mode 100644index 9f48f8b2f3..0000000000--- a/infra/agents/README.md+++ /dev/null@@ -1,31 +0,0 @@-# Agents sandbox (compose project `agents`)--- Runner: `agent-runner` (Tokio+axum, `infra/agents/runner/`) serves the- `proto` HTTP API from inside the sandbox: per-slot checkouts at- `/builds/slots/slot-N`, `bash -lc` exec in its own process group (Build- kind serialized on a single permit), path confinement, `git` ops.-- Image: `Dockerfile.builder` builds the runner, then extends- `location-share-builder:local` with ripgrep, user `agent` (10001), and a- small-Gradle profile; ENTRYPOINT runs the runner under tini.-- Isolation: `builder` runs as 10001, caps (6 CPU/14 GB/4k pids),- `cap_drop: ALL`, no-new-privileges, only on `agents-internal` (sealed)- and `agents-egress` (172.31.250.0/24, host-firewalled from RFC1918).-- Orchestrator: `agentd` (separate image) talks to `http://builder:7070`,- serves the UI as `agents-ui` on prod net, pushes via the mirror volume.-- Release back-pressure: `release-signal` mirrors prod's- `/srv/release_in_progress` into `/signal/release` for agentd to defer.--Deploy (once, on the host as root, from /root/agent-world/Modern-Apps):-1. `git clone <Modern-Apps> /root/agent-world/Modern-Apps`-2. Review `infra/agents/host-setup.sh`, then `sudo bash infra/agents/host-setup.sh`-3. Copy `infra/agents/.env.example` to `/root/agent-world/.env`, fill secrets-4. Ensure base exists: `docker compose -f /root/location_share_server/compose.yml --profile release build builder`-5. `docker compose -p agents -f infra/agents/compose.yml up -d --build`--Verify: `docker compose -p agents ps`; `docker exec agents-builder-1 curl -s localhost:7070/v1/health`;-agentd UI via Caddy; run one `agent/` task end to end, then check-`docker stats` (builder ≤ 6 CPU/14 GB) and `iptables -S DOCKER-USER`.--Stop/remove (never touches `location-share`):-`docker compose -p agents -f infra/agents/compose.yml down` (add `-v` to-drop agents-* volumes too; the builds image + mirror stay until deleted).
infra/agents/agentd/Cargo.toml
diff --git a/infra/agents/agentd/Cargo.toml b/infra/agents/agentd/Cargo.tomldeleted file mode 100644index fc6e3feeee..0000000000--- a/infra/agents/agentd/Cargo.toml+++ /dev/null@@ -1,32 +0,0 @@-[package]-name = "agentd"-version.workspace = true-edition.workspace = true-publish.workspace = true-license.workspace = true--[[bin]]-name = "agentd"-path = "src/main.rs"--[dependencies]-proto.workspace = true-serde.workspace = true-serde_json.workspace = true-tokio.workspace = true-axum.workspace = true-reqwest.workspace = true-rusqlite.workspace = true-argon2.workspace = true-rand.workspace = true-sha2.workspace = true-tracing.workspace = true-tracing-subscriber.workspace = true-maud.workspace = true-pulldown-cmark.workspace = true-tempfile.workspace = true-tokio-stream.workspace = true--[dev-dependencies]-tempfile.workspace = true-tokio-stream.workspace = true
infra/agents/agentd/src/agent.rs
diff --git a/infra/agents/agentd/src/agent.rs b/infra/agents/agentd/src/agent.rsdeleted file mode 100644index 799bcfc602..0000000000--- a/infra/agents/agentd/src/agent.rs+++ /dev/null@@ -1,1559 +0,0 @@-//! The OpenRouter agent loop: one task, one slot, until `finish`/park.-//!-//! Flow per task:-//! 1. Fresh tasks: `fetch origin main` in the mirror; runner `prepare`s the-//! slot branch. Resumed tasks (queued with stored history): runner-//! `prepare`s with a [`proto::ResumeSpec`] restoring the parked WIP ref.-//! 2. Fetch root + module `AGENTS.md` through the runner; build the system-//! prompt; the conversation (user / assistant / tool messages) is persisted-//! in the `messages` table as sent and reloaded on resume. The system-//! message is rebuilt every turn and never stored.-//! 3. Loop: drain the inbox (steering becomes user messages), POST OpenRouter-//! chat-completions → dispatch tool calls to the runner → append results.-//! Every turn is persisted as an event and broadcast to SSE subscribers.-//! 4. On `finish{summary, commit_message}`: validate, runner `/commit`,-//! download `/bundle`, `bundle verify`, import into the mirror, push-//! upstream (the review gate is a later phase; finish still auto-pushes).-//! 5. Whenever the agent must wait (`ask_user`, text-only reply, budget,-//! error, Stop), the driver parks: WIP work (if any) is committed, bundled-//! and imported as `refs/agent-wip/<id>`, then one atomic-//! [`Store::park_task`] sets the status and releases the slot.--use std::sync::Arc;--use tokio::sync::broadcast;--use crate::config::Config;-use crate::models::{- branch_name, cap_final_diff, cap_plan_markdown, is_parking_tool, plan_gate_message,- render_todos, truncate_result, trim_placeholder, validate_commit_message,- validate_commit_message_for_issue, validate_todos,- Event, Pending, TaskStatus, PENDING_BUDGET, PENDING_CHAT, PENDING_ERROR, PENDING_PLAN,- PENDING_QUESTION, PENDING_REVIEW, PENDING_STOPPED, EVENT_ASSISTANT, EVENT_PLAN, EVENT_QUESTION,- EVENT_REVIEW, EVENT_STATUS, EVENT_TODOS, EVENT_TOOL_CALL, EVENT_TOOL_RESULT, EVENT_USER_MESSAGE,- INBOX_PLAN_APPROVE, INBOX_PLAN_CHANGES, INBOX_REVIEW_CHANGES,-};-use crate::openrouter::{tool_defs, AssistantTurn, Message, OpenRouter, ToolCall};-use crate::prompt::build_system_prompt;-use crate::rules::{ensure_rules_for_path, load_session_rules, sorted_loaded_rules};-use crate::runner::Runner;-use crate::store::Store;-use crate::tools::{shell_looks_mutating, validate_shell_command};--/// Outcome of one worker claim on a task. `Parked` means the driver stored a-/// `pending_json` resume point and released the slot; the scheduler just goes-/// back to the claim loop. (`finish` parks as `review`; Approve pushes via-/// HTTP, so no claim ever completes synchronously anymore.)-#[derive(Debug)]-pub enum TaskOutcome {- Failed {- reason: String,- },- Parked,-}--/// Shared runtime handles passed to every task driver.-#[derive(Clone)]-pub struct DriverCtx {- pub config: Arc<Config>,- pub store: Store,- pub runner: Runner,- pub openrouter: OpenRouter,- /// Broadcast of `(task_id, event)` for SSE.- pub events_tx: broadcast::Sender<(i64, Event)>,-}--impl DriverCtx {- /// Persist an event and broadcast it (broadcast failure = no listeners).- pub fn emit(&self, task_id: i64, kind: &str, body: serde_json::Value) -> Event {- let ev = self- .store- .push_event(task_id, kind, &body)- .unwrap_or(Event {- id: -1,- task_id,- seq: -1,- ts: crate::models::now_unix(),- kind: kind.to_string(),- body: body.clone(),- });- let _ = self.events_tx.send((task_id, ev.clone()));- ev- }-}--fn stop_requested(store: &Store, task_id: i64) -> bool {- store- .get_task(task_id)- .ok()- .flatten()- .map(|t| t.stop_requested)- .unwrap_or(true)-}--/// Scrub `Bearer <secret>` values before a string is stored in an event or-/// log. The push token never flows through the loop, but a model could-/// hallucinate something shaped like one; redact defensively.-pub fn scrub_secrets(s: &str) -> String {- let mut out = String::with_capacity(s.len());- let mut rest = s;- loop {- if let Some(i) = rest.to_lowercase().find("bearer ") {- out.push_str(&rest[..i + 7]);- out.push_str("[redacted]");- let tail = &rest[i + 7..];- let end = tail- .find(|c: char| c.is_whitespace() || c == '"' || c == '\'')- .unwrap_or(tail.len());- rest = &tail[end..];- } else {- out.push_str(rest);- break;- }- }- out-}--/// Short (<=400 char) preview of tool arguments for the event log.-fn args_preview(args: &str) -> String {- const MAX: usize = 400;- if args.len() <= MAX {- args.to_string()- } else {- format!("{}…[{} chars]", &args[..MAX], args.len())- }-}--/// Look up a string argument.-fn arg_str(args: &serde_json::Value, key: &str) -> Option<String> {- args.get(key)- .and_then(|v| v.as_str())- .map(|s| s.to_string())-}--/// Release-signal check: `true` while a production release build runs.-pub fn release_active(config: &Config) -> bool {- config.release_signal.exists()-}--/// Wait out the release signal (polling), up to the configured limit.-/// Returns `Err(msg)` when the wait expires (message goes to the model).-pub async fn wait_for_release_clear(- ctx: &DriverCtx,- task_id: i64,- _command: &str,-) -> Result<(), String> {- if ctx.config.test_skip_release_wait {- // Test seam: behave as if preemption fired immediately. Match the- // production preemption message so tests assert one string.- let _ = ctx.runner.kill_build().await;- return Err("build preempted by a production release; retry later".to_string());- }- let limit = ctx.config.build_wait_limit();- let poll = ctx.config.poll_interval();- let start = std::time::Instant::now();- ctx.emit(task_id, EVENT_STATUS,- serde_json::json!({"message": "a production release build is running; waiting for it to finish (up to 60 min)"}),- );- loop {- if !release_active(&ctx.config) {- return Ok(());- }- if stop_requested(&ctx.store, task_id) {- return Err("task stopped by operator".to_string());- }- if start.elapsed() >= limit {- return Err(- "production release still running after 60 min; aborting build (retry later)"- .to_string(),- );- }- tokio::time::sleep(poll).await;- }-}--/// Outcome of one validated build-kind exec (release-preemption included).-/// `Done` carries the raw runner response for the caller to parse; `Message`-/// is already model-ready text (preemption notice).-pub(crate) enum BuildOutcome {- Done(proto::ExecResponse),- Message(String),-}--/// Run a validated build command (`./gradlew ...` or `./check ...`) through-/// the runner's Build exec kind with the release-preemption handling:-/// wait while the release signal is present (up to 60 min), and surface a-/// retry-later message when a release kills the build. Shared by the legacy-/// `build{command}` arm and `structured::{build,run_tests,check}`.-pub(crate) async fn exec_build_command(- ctx: &DriverCtx,- task_id: i64,- slot: u32,- allowed: &str,-) -> BuildOutcome {- // Release preemption: while the signal file exists, wait (up to- // 60 min). If it appeared mid-build, kill the runner build.- if release_active(&ctx.config) {- match wait_for_release_clear(ctx, task_id, allowed).await {- Ok(()) => {}- Err(msg) => return BuildOutcome::Message(msg),- }- }- match ctx- .runner- .exec(slot, allowed, proto::ExecKind::Build, 20 * 60)- .await- {- Ok(r) => {- if r.killed && release_active(&ctx.config) {- let _ = ctx.runner.kill_build().await;- BuildOutcome::Message(- "build preempted by a production release; retry later".to_string(),- )- } else {- BuildOutcome::Done(r)- }- }- Err(e) => BuildOutcome::Message(format!("build failed: {e}")),- }-}--/// Run one worker claim on a task: fresh or resumed. `slot` is the scheduler-/// worker index (also the runner slot id). Returns to the claim loop on park.-pub async fn drive_task(ctx: DriverCtx, task_id: i64, slot: u32) -> TaskOutcome {- let task = match ctx.store.get_task(task_id).ok().flatten() {- Some(t) => t,- None => {- return TaskOutcome::Failed {- reason: "task row vanished".to_string(),- }- }- };- let branch = if task.branch.is_empty() {- let b = branch_name(task.id, &task.title);- let _ = ctx.store.set_branch(task.id, &b);- b- } else {- task.branch.clone()- };- if task.kind == crate::models::TASK_KIND_TRIAGE {- return crate::triage::drive_triage(&ctx, &task, slot, &branch).await;- }- let model = task.model.clone();- let module_scope = if task.module_scope.is_empty() {- "notes".to_string()- } else {- task.module_scope.clone()- };-- ctx.emit(task_id, EVENT_STATUS,- serde_json::json!({"message": format!("preparing slot {slot} on {branch}")}),- );-- // Resumed claim? Stored history + a previous wip_sha/base_sha say so.- let resumed = ctx.store.load_messages(task_id).map(|m| !m.is_empty());- let resumed = resumed.unwrap_or(false);-- // 1. Mirror refresh + slot prepare (fresh or resume).- if let Err(e) = crate::git::fetch_main(&ctx.config.mirror_dir).await {- return fail(&ctx, task_id, &format!("mirror fetch failed: {e}")).await;- }- if resumed {- if let Err(reason) = prepare_resumed(&ctx, &task, slot, &branch).await {- return fail(&ctx, task_id, &reason).await;- }- // Budget parks grant headroom on resume: +20 steps, +$1.00.- if task.pending.as_ref().map(|p| p.kind.as_str()) == Some(PENDING_BUDGET) {- let _ = ctx.store.extend_budget(task_id);- ctx.emit(task_id, EVENT_STATUS,- serde_json::json!({"message": "budget extended (+20 steps, +$1.00)"}),- );- }- } else {- match crate::git::main_sha(&ctx.config.mirror_dir).await {- Ok(sha) => {- let _ = ctx.store.set_base_sha(task_id, &sha);- }- Err(e) => return fail(&ctx, task_id, &format!("mirror rev-parse: {e}")).await,- }- match ctx.runner.prepare(slot, &branch).await {- Ok(r) => {- let _ = ctx.store.set_base_sha(task_id, &r.base_sha);- }- Err(e) => return fail(&ctx, task_id, &format!("runner prepare: {e}")).await,- }- }-- // 2. Rules + system prompt (rebuilt every turn; never stored).- // Session rules load once per claim into rules_json (root + module +- // repo-map); per-path rules accumulate via ensure_rules_for_path during- // dispatch. Plan + todos come from the task row (volatile tail).- let (root_rules, module_rules) =- load_session_rules(&ctx, task_id, slot, &module_scope).await;- let system = build_system_prompt_for_task(&ctx, task_id, &module_scope, root_rules, module_rules);- let mut messages = vec![Message::system(system)];- // Stored history (seeded below for fresh tasks).- if resumed {- match ctx.store.load_messages(task_id) {- Ok(hist) => messages.extend(hist),- Err(e) => return fail(&ctx, task_id, &format!("load history: {e}")).await,- }- // Pending tool-call answer: ONE tool result from all inbox rows, then- // any leftover rows as fresh user messages. Tagged rows (plan- // approve / plan changes / review changes) format the answer; plain- // rows pass through raw (ask_user answers, steering).- if let Some(pending) = &task.pending {- if let Some(call_id) = pending.tool_call_id.clone() {- let drained = match ctx.store.drain_inbox_tagged(task_id) {- Ok(d) => d,- Err(e) => return fail(&ctx, task_id, &format!("drain inbox: {e}")).await,- };- let answer = format_pending_answer(pending, &drained);- let tool_name = match pending.kind.as_str() {- PENDING_QUESTION => "ask_user",- PENDING_PLAN => "propose_plan",- PENDING_REVIEW => "finish",- _ => "ask_user",- };- append_persisted(&ctx, task_id, &mut messages, Message::tool_result(call_id.clone(), answer.clone()));- ctx.emit(task_id, EVENT_TOOL_RESULT,- serde_json::json!({"name": tool_name, "truncated": false, "result": answer}),- );- // Rows beyond the pending answer (untagged leftovers can't- // happen here — drain is total — but tagged approve rows- // carry no extra user text, so nothing more to append).- }- }- } else {- append_persisted(- &ctx,- task_id,- &mut messages,- Message::user(format!("Task: {}\n\n{}", task.title, task.prompt)),- );- }- let tools = tool_defs();- ctx.emit(task_id, EVENT_STATUS,- serde_json::json!({"message": "agent loop started", "model": model}),- );-- // 3. Main loop.- let mut openrouter_failures = 0u32;- loop {- if stop_requested(&ctx.store, task_id) {- return park_after_stop(&ctx, task_id, slot, &branch, &mut messages).await;- }- let cur = match ctx.store.get_task(task_id).ok().flatten() {- Some(t) => t,- None => {- return TaskOutcome::Failed {- reason: "task row vanished".to_string(),- }- }- };- if cur.steps >= cur.budget_steps || cur.cost_usd >= cur.budget_usd {- return park_budget(&ctx, task_id, slot, &branch, &mut messages).await;- }- // Steering: drain inbox at the top of each iteration (after the prior- // turn's tool results, which are already appended below).- match ctx.store.drain_inbox(task_id) {- Ok(rows) => {- for text in rows {- ctx.emit(task_id, EVENT_USER_MESSAGE,- serde_json::json!({"text": text}),- );- append_persisted(&ctx, task_id, &mut messages, Message::user(text));- }- }- Err(e) => return fail(&ctx, task_id, &format!("drain inbox: {e}")).await,- }- // Rebuild the system message from stored state every turn: todos,- // plan, and per-path rules may have changed mid-claim (update_todos- // dispatch, rules auto-load) without a re-park.- refresh_system_message(&ctx, task_id, &module_scope, &mut messages);- let send = trimmed_clone(&messages, ctx.config.context_chars());-- // Model turn (transient errors retry ×3 with backoff, then park).- let turn: AssistantTurn = loop {- match ctx.openrouter.chat(&model, &send, &tools).await {- Ok(t) => {- openrouter_failures = 0;- break t;- }- Err(e) => {- openrouter_failures += 1;- if openrouter_failures > 3 {- return park_error(- &ctx,- task_id,- slot,- &branch,- &mut messages,- &format!("OpenRouter: {e}"),- )- .await;- }- let backoff = std::time::Duration::from_millis(500 * openrouter_failures as u64);- tokio::time::sleep(backoff).await;- }- }- };- let _ = ctx.store.add_usage(- task_id,- 1,- turn.usage.prompt_tokens,- turn.usage.completion_tokens,- turn.usage.cost_usd(),- );- ctx.emit(task_id, EVENT_ASSISTANT,- serde_json::json!({- "text": scrub_secrets(&turn.text),- "prompt_tokens": turn.usage.prompt_tokens,- "completion_tokens": turn.usage.completion_tokens,- "cost_usd": turn.usage.cost_usd(),- }),- );- append_persisted(- &ctx,- task_id,- &mut messages,- Message::assistant_calls(- if turn.text.is_empty() {- None- } else {- Some(turn.text.clone())- },- turn.tool_calls.clone(),- ),- );-- if turn.tool_calls.is_empty() {- return park_chat(&ctx, task_id, slot, &branch, &mut messages, &turn.text).await;- }-- // Sole-call enforcement for parking tools: a mixed turn gets a tool- // error and NO park; every other call in the turn still gets its- // result so the protocol stays valid.- let parking_call: Option<ToolCall> = turn- .tool_calls- .iter()- .find(|c| is_parking_tool(&c.function.name))- .cloned();- if let Some(park_call) = parking_call {- if turn.tool_calls.len() != 1 {- for call in &turn.tool_calls {- if call.id == park_call.id {- continue;- }- match dispatch_tool(&ctx, task_id, slot, &module_scope, call).await {- ToolEffect::Continue { result_for_model } => {- append_persisted(- &ctx,- task_id,- &mut messages,- Message::tool_result(call.id.clone(), result_for_model),- );- }- ToolEffect::ReviewRequest { .. } => {- // A parking tool alongside `finish`: protocol- // error; `finish` is NOT honored in a mixed turn.- append_persisted(- &ctx,- task_id,- &mut messages,- Message::tool_result(- call.id.clone(),- "finish rejected: it must be the only call in its turn; re-issue it alone.".to_string(),- ),- );- }- }- }- let msg = format!(- "{} must be the only call in its turn; re-issue it alone.",- park_call.function.name- );- ctx.emit(task_id, EVENT_TOOL_RESULT,- serde_json::json!({"name": park_call.function.name, "truncated": false, "result": msg}),- );- append_persisted(- &ctx,- task_id,- &mut messages,- Message::tool_result(park_call.id.clone(), msg),- );- continue;- }- // Valid sole parking-tool call → park.- match park_call.function.name.as_str() {- "ask_user" => {- return park_question(&ctx, task_id, slot, &branch, &mut messages, &park_call).await;- }- "propose_plan" => {- match park_plan(&ctx, task_id, slot, &branch, &mut messages, &park_call).await {- Some(outcome) => return outcome,- None => continue, // validation error appended; keep looping- }- }- // `finish` validates inside dispatch_tool (needs the runner- // diff): fall out of the parking-call branch into the normal- // dispatch loop below, which turns it into ReviewRequest →- // park_review.- "finish" => {}- _ => {- let msg = format!("Unknown parking tool {:?}", park_call.function.name);- append_persisted(- &ctx,- task_id,- &mut messages,- Message::tool_result(park_call.id.clone(), msg.clone()),- );- ctx.emit(task_id, EVENT_TOOL_RESULT,- serde_json::json!({"name": park_call.function.name, "truncated": false, "result": msg}),- );- continue;- }- }- }-- // Dispatch tool calls sequentially, in model order.- for call in &turn.tool_calls {- if stop_requested(&ctx.store, task_id) {- return park_after_stop(&ctx, task_id, slot, &branch, &mut messages).await;- }- match dispatch_tool(&ctx, task_id, slot, &module_scope, call).await {- ToolEffect::Continue { result_for_model } => {- append_persisted(- &ctx,- task_id,- &mut messages,- Message::tool_result(call.id.clone(), result_for_model),- );- }- ToolEffect::ReviewRequest {- summary,- commit_message,- } => {- return park_review(&ctx, task_id, slot, &branch, call, &summary, &commit_message)- .await;- }- }- }- }-}--/// Build the system prompt for a task from stored state: base + root/module-/// rules + loaded rules sorted by path + plan + todos (stable → volatile).-/// Public so tests can assert prompt ordering.-pub fn build_system_prompt_for_task(- ctx: &DriverCtx,- task_id: i64,- module_scope: &str,- root_rules: Option<String>,- module_rules: Option<String>,-) -> String {- let task = ctx.store.get_task(task_id).ok().flatten();- let rules = sorted_loaded_rules(task.as_ref().and_then(|t| t.rules_json.as_deref()));- // Exclude the fixed root/module/repo-map entries from `extra` — they are- // rendered by the base template already. (Anything else in rules_json,- // i.e. per-directory AGENTS.md files, renders sorted by path.)- let dir = module_scope.replace(':', "/");- let dir = dir.trim_matches('/');- let module_path = if dir.is_empty() {- "AGENTS.md".to_string()- } else {- format!("{dir}/AGENTS.md")- };- let extra: Vec<(String, String)> = rules- .into_iter()- .filter(|(p, _)| p != "AGENTS.md" && *p != module_path && p != ".llms/repo-map.md")- .collect();- let plan = task.as_ref().and_then(|t| t.plan_md.clone()).unwrap_or_default();- let todos = render_todos(task.as_ref().and_then(|t| t.todos_json.as_deref()));- let (require_plan, plan_approved) = task- .as_ref()- .map(|t| (t.require_plan, t.plan_approved))- .unwrap_or((false, false));- build_system_prompt(- module_scope,- &extra,- root_rules.as_deref(),- module_rules.as_deref(),- &plan,- &todos,- require_plan,- plan_approved,- )-}--/// Rebuild the system message in place after state changed mid-claim-/// (todos update, plan approval). Keeps history positions stable.-fn refresh_system_message(- ctx: &DriverCtx,- task_id: i64,- module_scope: &str,- messages: &mut [Message],-) {- let task = match ctx.store.get_task(task_id).ok().flatten() {- Some(t) => t,- None => return,- };- // Re-derive root/module sections from stored rules_json (session load- // persisted them); fall back to "(unavailable)" when absent.- let map: std::collections::BTreeMap<String, Option<String>> = task- .rules_json- .as_deref()- .map(serde_json::from_str)- .transpose()- .unwrap_or_default()- .unwrap_or_default();- let dir = module_scope.replace(':', "/");- let dir = dir.trim_matches('/');- let module_path = if dir.is_empty() {- "AGENTS.md".to_string()- } else {- format!("{dir}/AGENTS.md")- };- let root = map.get("AGENTS.md").cloned().flatten();- let module = map.get(&module_path).cloned().flatten();- let system =- build_system_prompt_for_task(ctx, task_id, module_scope, root, module);- if let Some(first) = messages.first_mut() {- if first.role == "system" {- first.content = Some(system);- }- }-}--/// Append a message to the in-memory history AND persist it. Persistence-/// failure is fatal (fail loudly, never silently diverge).-pub(crate) fn append_persisted(ctx: &DriverCtx, task_id: i64, messages: &mut Vec<Message>, msg: Message) {- if let Err(e) = ctx.store.append_message(task_id, &msg) {- tracing::error!("persist message for task {task_id}: {e}");- }- messages.push(msg);-}--/// Format the single tool result that answers a pending parking-tool call-/// from the drained (tagged) inbox rows.-///-/// * plan approve (`kind == "plan_approve"`) → `"Plan approved. Proceed."`-/// * plan changes (`kind == "plan_changes"`) → `"User requested changes to-/// the plan: <text>"` (plan stays unapproved; the model revises and calls-/// `propose_plan` again)-/// * review changes (`kind == "review_changes"`, i.e. a normal message while-/// in `review`) → `"User reviewed the change and requested: <text>"`-/// * anything else → raw texts joined (ask_user answers, steering).-///-/// Public for unit tests.-pub fn format_pending_answer(- pending: &Pending,- rows: &[crate::store::InboxRow],-) -> String {- let texts: Vec<&str> = rows.iter().map(|r| r.text.as_str()).collect();- // Tagged plan/review rows take precedence over any co-drained plain text.- if rows.iter().any(|r| r.kind == INBOX_PLAN_APPROVE) {- return "Plan approved. Proceed.".to_string();- }- if let Some(row) = rows.iter().find(|r| r.kind == INBOX_PLAN_CHANGES) {- return format!("User requested changes to the plan: {}", row.text);- }- if pending.kind == PENDING_REVIEW- || rows.iter().any(|r| r.kind == INBOX_REVIEW_CHANGES)- {- let feedback = rows- .iter()- .find(|r| r.kind == INBOX_REVIEW_CHANGES)- .map(|r| r.text.clone())- .unwrap_or_else(|| texts.join("\n"));- return format!("User reviewed the change and requested: {feedback}");- }- texts.join("\n")-}--async fn prepare_resumed(- ctx: &DriverCtx,- task: &crate::models::Task,- slot: u32,- branch: &str,-) -> Result<(), String> {- let base_sha = task.base_sha.clone().unwrap_or_default();- if base_sha.is_empty() {- return Err("cannot resume: no base_sha recorded".to_string());- }- let (wip_ref, wip_sha) = match task.wip_sha.clone() {- Some(sha) => {- match crate::git::wip_ref_sha(&ctx.config.mirror_dir, task.id).await {- Ok(Some(found)) if found == sha => {- (Some(crate::models::wip_ref(task.id)), Some(sha))- }- Ok(Some(found)) => {- return Err(format!(- "cannot resume: WIP ref mismatch (expected {sha}, found {found})"- ));- }- Ok(None) => {- return Err(format!(- "cannot resume: WIP ref {} missing in mirror",- crate::models::wip_ref(task.id)- ));- }- Err(e) => {- return Err(format!("cannot resume: WIP ref check: {e}"));- }- }- }- None => (None, None),- };- match ctx- .runner- .prepare_resume(- slot,- branch,- proto::ResumeSpec {- base_sha: base_sha.clone(),- wip_ref,- wip_sha,- },- )- .await- {- Ok(r) => {- let _ = ctx.store.set_base_sha(task.id, &r.base_sha);- Ok(())- }- Err(e) => Err(format!("runner resume prepare: {e}")),- }-}--pub(crate) async fn fail(ctx: &DriverCtx, task_id: i64, reason: &str) -> TaskOutcome {- ctx.emit(task_id, EVENT_STATUS,- serde_json::json!({"message": reason}),- );- TaskOutcome::Failed {- reason: reason.to_string(),- }-}--// ---- parking ------/// Park the task and release the slot to the pool.-///-/// 1. If the checkout has changes: commit "WIP", download the bundle, import-/// it into the mirror as `refs/agent-wip/<id>` and record `wip_sha`.-/// Otherwise `wip_sha = NULL` (and any stale WIP ref is deleted).-/// 2. One atomic [`Store::park_task`]: set status / `pending_json` /-/// `slot = NULL`. When the inbox already holds a message, `park_task`-/// re-queues instead (lost-wakeup fix) — the worker loop will reclaim the-/// task on its next claim poll.-///-/// Emits the `question` event for question parks (so the UI can render the-/// form) plus a `status` event in all cases.-async fn park(- ctx: &DriverCtx,- task_id: i64,- slot: u32,- branch: &str,- status: TaskStatus,- pending: Pending,-) -> TaskOutcome {- // Snapshot the work BEFORE the atomic park: commit + bundle + import.- let wip_sha: Option<String> = match ctx.runner.diff(slot).await {- Ok(d) if d.diff.trim().is_empty() && d.stat.trim().is_empty() => {- let _ = crate::git::delete_wip_ref(&ctx.config.mirror_dir, task_id).await;- None- }- Ok(_) => {- match ctx- .runner- .commit(slot, &format!("WIP task {task_id}"))- .await- {- Ok(_) => {}- Err(e) => {- // Best effort: unstaged/uncommitted work stays in the slot- // checkout; still park without a WIP ref.- tracing::warn!("park WIP commit for task {task_id}: {e}");- return park_without_wip(ctx, task_id, status, pending);- }- }- // A Stop arriving during commit/bundle is honored after import.- match ctx.runner.bundle(slot).await {- Ok(bundle) => match write_temp_bundle(&bundle) {- Ok(tmp) => {- match crate::git::import_wip_bundle(- &ctx.config.mirror_dir,- &tmp,- branch,- task_id,- )- .await- {- Ok(sha) => Some(sha),- Err(e) => {- tracing::warn!("park WIP import for task {task_id}: {e}");- return park_without_wip(ctx, task_id, status, pending);- }- }- }- Err(e) => {- tracing::warn!("park temp bundle for task {task_id}: {e}");- return park_without_wip(ctx, task_id, status, pending);- }- },- Err(e) => {- tracing::warn!("park bundle download for task {task_id}: {e}");- return park_without_wip(ctx, task_id, status, pending);- }- }- }- Err(e) => {- tracing::warn!("park diff for task {task_id}: {e}");- return park_without_wip(ctx, task_id, status, pending);- }- };-- finish_park(ctx, task_id, status, pending, wip_sha.as_deref())-}--fn park_without_wip(- ctx: &DriverCtx,- task_id: i64,- status: TaskStatus,- pending: Pending,-) -> TaskOutcome {- finish_park(ctx, task_id, status, pending, None)-}--fn finish_park(- ctx: &DriverCtx,- task_id: i64,- status: TaskStatus,- pending: Pending,- wip_sha: Option<&str>,-) -> TaskOutcome {- if pending.kind == PENDING_QUESTION {- ctx.emit(task_id, EVENT_QUESTION, pending.payload.clone());- }- let effective = match ctx.store.park_task(task_id, status, &pending, wip_sha) {- Ok(s) => s,- Err(e) => {- return TaskOutcome::Failed {- reason: format!("park: {e}"),- };- }- };- ctx.emit(task_id, EVENT_STATUS,- serde_json::json!({- "message": format!("parked as {} (pending: {})", effective.as_str(), pending.kind),- "status": effective.as_str(),- "pending_kind": pending.kind,- }),- );- TaskOutcome::Parked-}--fn write_temp_bundle(bundle: &[u8]) -> Result<tempfile::TempPath, String> {- let tmp = tempfile::Builder::new()- .prefix("agentd-wip-bundle-")- .tempfile()- .map_err(|e| format!("temp bundle file: {e}"))?;- let path = tmp.into_temp_path();- std::fs::write(&path, bundle).map_err(|e| format!("write bundle: {e}"))?;- Ok(path)-}--/// `ask_user` (sole call in its turn) → park `needs_input(question)`.-async fn park_question(- ctx: &DriverCtx,- task_id: i64,- slot: u32,- branch: &str,- _messages: &mut Vec<Message>,- call: &ToolCall,-) -> TaskOutcome {- let args: serde_json::Value =- serde_json::from_str(&call.function.arguments).unwrap_or(serde_json::Value::Null);- let question = args- .get("question")- .and_then(|v| v.as_str())- .unwrap_or("")- .to_string();- let options = args.get("options").cloned().unwrap_or(serde_json::Value::Null);- let multi_select = args- .get("multi_select")- .and_then(|v| v.as_bool())- .unwrap_or(false);- let pending = Pending::new(- PENDING_QUESTION,- Some(call.id.clone()),- serde_json::json!({- "question": question,- "options": options,- "multi_select": multi_select,- }),- );- park(ctx, task_id, slot, branch, TaskStatus::NeedsInput, pending).await-}--/// `propose_plan` (sole call in its turn) → store the plan text, emit the-/// `plan` event, and park `needs_input(plan)` with pending-/// `{kind:"plan", tool_call_id, payload:{plan_markdown}}`.-///-/// Returns `None` when the plan is empty: the rejection is appended as the-/// tool result (history + event) and the caller continues the loop WITHOUT-/// parking.-async fn park_plan(- ctx: &DriverCtx,- task_id: i64,- slot: u32,- branch: &str,- messages: &mut Vec<Message>,- call: &ToolCall,-) -> Option<TaskOutcome> {- let args: serde_json::Value =- serde_json::from_str(&call.function.arguments).unwrap_or(serde_json::Value::Null);- let plan_raw = args- .get("plan_markdown")- .and_then(|v| v.as_str())- .unwrap_or("")- .to_string();- if plan_raw.trim().is_empty() {- let msg = "propose_plan rejected: plan_markdown is empty; call propose_plan again with the plan.".to_string();- ctx.emit(task_id, EVENT_TOOL_RESULT,- serde_json::json!({"name": "propose_plan", "truncated": false, "result": msg}),- );- append_persisted(- ctx,- task_id,- messages,- Message::tool_result(call.id.clone(), msg),- );- return None;- }- let (plan_md, truncated) = cap_plan_markdown(&plan_raw);- let _ = ctx.store.set_plan_md(task_id, &plan_md);- ctx.emit(task_id, EVENT_PLAN,- serde_json::json!({"plan_markdown": plan_md, "truncated": truncated}),- );- let pending = Pending::new(- PENDING_PLAN,- Some(call.id.clone()),- serde_json::json!({"plan_markdown": plan_md}),- );- Some(park(ctx, task_id, slot, branch, TaskStatus::NeedsInput, pending).await)-}--/// Text-only assistant turn → park `needs_input(chat)` (nudge-then-fail is-/// retired).-async fn park_chat(- ctx: &DriverCtx,- task_id: i64,- slot: u32,- branch: &str,- _messages: &mut Vec<Message>,- text: &str,-) -> TaskOutcome {- let pending = Pending::new(- PENDING_CHAT,- None,- serde_json::json!({"text": text}),- );- park(ctx, task_id, slot, branch, TaskStatus::NeedsInput, pending).await-}--/// Budget exhausted → park `needs_input(budget)` (resume grants +20/+$1).-async fn park_budget(- ctx: &DriverCtx,- task_id: i64,- slot: u32,- branch: &str,- _messages: &mut Vec<Message>,-) -> TaskOutcome {- let cur = ctx.store.get_task(task_id).ok().flatten();- let (steps, budget_steps, cost, budget_usd) = cur- .map(|t| (t.steps, t.budget_steps, t.cost_usd, t.budget_usd))- .unwrap_or((0, 0, 0.0, 0.0));- let pending = Pending::new(- PENDING_BUDGET,- None,- serde_json::json!({- "message": format!(- "budget exhausted (steps {steps}/{budget_steps}, cost ${cost:.4}/${budget_usd:.2})"- ),- }),- );- park(ctx, task_id, slot, branch, TaskStatus::NeedsInput, pending).await-}--/// Transient errors, after retries → park `needs_input(error)` with the-/// message.-async fn park_error(- ctx: &DriverCtx,- task_id: i64,- slot: u32,- branch: &str,- _messages: &mut Vec<Message>,- message: &str,-) -> TaskOutcome {- let pending = Pending::new(- PENDING_ERROR,- None,- serde_json::json!({"message": message}),- );- park(ctx, task_id, slot, branch, TaskStatus::NeedsInput, pending).await-}--/// Operator Stop observed → park `needs_input(stopped)` with work kept.-async fn park_after_stop(- ctx: &DriverCtx,- task_id: i64,- slot: u32,- branch: &str,- _messages: &mut Vec<Message>,-) -> TaskOutcome {- let pending = Pending::new(- PENDING_STOPPED,- None,- serde_json::json!({"message": "stopped by operator; work kept"}),- );- park(ctx, task_id, slot, branch, TaskStatus::NeedsInput, pending).await-}--/// Replace old tool results with placeholders once the conversation exceeds-/// `budget` chars (keeps system prompt + first user message + recent tail).-///-/// Takes a slice and returns an owned trimmed CLONE: the stored history is-/// never mutated. Pairing is structural — messages are never added, removed-/// or reordered, only tool-result *contents* in the middle window are-/// replaced with placeholders, so an assistant `tool_calls` message is never-/// separated from its tool results (ids stay aligned). Debug builds assert-/// the pairing after trimming. Public for unit tests.-pub fn trimmed_clone(messages: &[Message], budget: usize) -> Vec<Message> {- let total: usize = messages.iter().map(|m| m.chars()).sum();- if total <= budget || messages.len() <= 6 {- return messages.to_vec();- }- let mut out = messages.to_vec();- let n = out.len();- for m in out.iter_mut().take(n.saturating_sub(4)).skip(2) {- if m.role == "tool" {- if let Some(c) = m.content.take() {- m.content = Some(trim_placeholder("tool", c.len()));- }- }- }- debug_assert!(tool_pairs_intact(&out), "trim separated tool_calls from results");- out-}--/// Every assistant `tool_calls` id has a matching `tool` result later in the-/// history (OpenRouter rejects unanswered calls).-fn tool_pairs_intact(messages: &[Message]) -> bool {- let mut pending: std::collections::HashSet<&str> = std::collections::HashSet::new();- for m in messages {- if m.role == "assistant" {- if let Some(calls) = &m.tool_calls {- for c in calls {- pending.insert(c.id.as_str());- }- }- } else if m.role == "tool" {- if let Some(id) = &m.tool_call_id {- pending.remove(id.as_str());- }- }- }- pending.is_empty()-}--/// Unknown-tool error (legacy list of the pre-structured tools plus the-/// structured layer).-fn unknown_tool(other: &str) -> String {- format!(- "Unknown tool {other:?}; available: read_file, list_dir, search, edit_file, write_file, update_todos, git_diff, run_shell, build, ask_user, propose_plan, finish, run_tests, check, git_log, git_show, git_blame, find_files, github_search_issues, github_read_issue."- )-}--/// Legacy in-place trim kept for unit tests: same window rule, mutates.-/// (The driver uses [`trimmed_clone`]; this entry point exists for the-/// trimming unit test.)-#[allow(dead_code)]-pub fn trim_messages(messages: &mut [Message], budget: usize) {- let trimmed = trimmed_clone(messages, budget);- if trimmed.len() == messages.len() {- messages.clone_from_slice(&trimmed);- }-}--pub(crate) enum ToolEffect {- Continue { result_for_model: String },- ReviewRequest { summary: String, commit_message: String },-}--/// Is the plan gate currently closed for this task? (`require_plan` set and-/// the plan not yet approved.)-fn plan_gated(store: &Store, task_id: i64) -> bool {- store- .get_task(task_id)- .ok()- .flatten()- .map(|t| t.require_plan && !t.plan_approved)- .unwrap_or(false)-}--pub(crate) async fn dispatch_tool(- ctx: &DriverCtx,- task_id: i64,- slot: u32,- module_scope: &str,- call: &ToolCall,-) -> ToolEffect {- let args: serde_json::Value =- serde_json::from_str(&call.function.arguments).unwrap_or(serde_json::Value::Null);- ctx.emit(task_id, EVENT_TOOL_CALL,- serde_json::json!({"name": call.function.name, "args": args_preview(&call.function.arguments)}),- );- let raw: String = match call.function.name.as_str() {- "read_file" => {- let path = arg_str(&args, "path").unwrap_or_default();- if let Err(e) = check_scope(&path, module_scope) {- format!("Scope error: {e}")- } else {- match ctx- .runner- .read(- slot,- &path,- args.get("start_line").and_then(|v| v.as_u64()).map(|v| v as usize),- args.get("max_lines").and_then(|v| v.as_u64()).map(|v| v as usize),- )- .await- {- Ok(r) => {- let body = format!(- "{} ({} lines{})",- r.content,- r.total_lines,- if r.truncated { ", truncated" } else { "" }- );- with_loaded_rules_note(ctx, task_id, slot, &path, body).await- }- Err(e) => format!("read failed: {e}"),- }- }- }- "list_dir" => {- let path = arg_str(&args, "path").unwrap_or_default();- if !path.is_empty() {- if let Err(e) = check_scope(&path, module_scope) {- return finish_dispatch(ctx, task_id, &call.function.name, &format!("Scope error: {e}"));- }- }- match ctx.runner.list(slot, &path).await {- Ok(r) => {- let probe = if path.is_empty() {- module_scope.replace(':', "/")- } else {- path.clone()- };- with_loaded_rules_note(ctx, task_id, slot, &probe, r.entries.join("\n")).await- }- Err(e) => format!("list failed: {e}"),- }- }- "search" => {- let pattern = arg_str(&args, "pattern").unwrap_or_default();- let sub = arg_str(&args, "path").filter(|s| !s.is_empty());- if let Some(p) = &sub {- if let Err(e) = check_scope(p, module_scope) {- return finish_dispatch(ctx, task_id, &call.function.name, &format!("Scope error: {e}"));- }- }- // Default the search root to the module scope when the model- // passes none, so rg never scans the whole repo.- let root = sub.or_else(|| Some(module_scope.replace(':', "/")));- match ctx- .runner- .search(- slot,- &pattern,- root.as_deref(),- arg_str(&args, "glob").as_deref(),- args.get("fixed_string").and_then(|v| v.as_bool()).unwrap_or(false),- )- .await- {- Ok(r) => {- let probe = root.unwrap_or_default();- with_loaded_rules_note(ctx, task_id, slot, &probe, r.matches).await- }- Err(e) => format!("search failed: {e}"),- }- }- "edit_file" => {- if plan_gated(&ctx.store, task_id) {- plan_gate_message().to_string()- } else {- let path = arg_str(&args, "path").unwrap_or_default();- if let Err(e) = check_scope(&path, module_scope) {- format!("Scope error: {e}")- } else {- match ctx- .runner- .edit(- slot,- &path,- &arg_str(&args, "old").unwrap_or_default(),- &arg_str(&args, "new").unwrap_or_default(),- )- .await- {- Ok(()) => {- with_loaded_rules_note(ctx, task_id, slot, &path, "edit applied".to_string()).await- }- Err(e) => format!("edit failed: {e}"),- }- }- }- }- "write_file" => {- if plan_gated(&ctx.store, task_id) {- plan_gate_message().to_string()- } else {- let path = arg_str(&args, "path").unwrap_or_default();- if let Err(e) = check_scope(&path, module_scope) {- format!("Scope error: {e}")- } else {- match ctx- .runner- .write(slot, &path, &arg_str(&args, "content").unwrap_or_default())- .await- {- Ok(()) => {- with_loaded_rules_note(ctx, task_id, slot, &path, "file written".to_string()).await- }- Err(e) => format!("write failed: {e}"),- }- }- }- }- "update_todos" => {- let items_raw = args.get("items").cloned().unwrap_or(serde_json::Value::Null);- let items: Vec<crate::models::TodoItem> = match serde_json::from_value(items_raw) {- Ok(v) => v,- Err(e) => {- return finish_dispatch(- ctx,- task_id,- &call.function.name,- &format!("update_todos rejected: bad items ({e}); pass items:[{{text, status: pending|in_progress|done}}]"),- );- }- };- match validate_todos(&items) {- Err(e) => {- return finish_dispatch(- ctx,- task_id,- &call.function.name,- &format!("update_todos rejected: {e}"),- );- }- Ok(valid) => {- let todos_json = serde_json::to_string(&valid).unwrap_or_else(|_| "[]".to_string());- if let Err(e) = ctx.store.set_todos(task_id, &todos_json) {- return finish_dispatch(- ctx,- task_id,- &call.function.name,- &format!("update_todos failed: {e}"),- );- }- ctx.emit(task_id, EVENT_TODOS,- serde_json::json!({"items": valid}),- );- "ok".to_string()- }- }- }- "git_diff" => match ctx.runner.diff(slot).await {- Ok(d) => format!("{}\n{}", d.stat, d.diff),- Err(e) => format!("diff failed: {e}"),- },- "run_shell" => {- let command = arg_str(&args, "command").unwrap_or_default();- // Plan gate first (best-effort mutation detector), then the- // existing build/device blocklist.- if plan_gated(&ctx.store, task_id) && shell_looks_mutating(&command) {- plan_gate_message().to_string()- } else {- match validate_shell_command(&command) {- Err(msg) => format!("Rejected: {msg}"),- Ok(()) => match ctx- .runner- .exec(slot, &command, proto::ExecKind::Shell, 60)- .await- {- Ok(r) => exec_summary(&r),- Err(e) => format!("exec failed: {e}"),- },- }- }- }- "build" => {- if plan_gated(&ctx.store, task_id) {- plan_gate_message().to_string()- } else if args.get("module").and_then(|v| v.as_str()).is_some() {- // Structured `{module, tasks}` form: validated, run, and parsed.- let parsed = crate::structured::dispatch_structured_build(ctx, task_id, slot, &args).await;- return finish_dispatch(ctx, task_id, &call.function.name, &parsed);- } else {- // Legacy `{command}` string keeps the raw exec summary.- let allowed = match crate::structured::parse_build_args(&args) {- Err(msg) => return finish_dispatch(ctx, task_id, &call.function.name, &format!("Rejected: {msg}")),- Ok(c) => c,- };- match exec_build_command(ctx, task_id, slot, &allowed).await {- BuildOutcome::Done(r) => exec_summary(&r),- BuildOutcome::Message(m) => {- return finish_dispatch(ctx, task_id, &call.function.name, &m);- }- }- }- }- "finish" => {- let summary = arg_str(&args, "summary").unwrap_or_default();- let commit_message = arg_str(&args, "commit_message").unwrap_or_default();- // Validate first: violations return as a tool result so the- // model can fix them and call `finish` again. `finish` is a- // parking tool, but validation happens here because a sole- // `finish` flows through normal dispatch and only parks via- // ReviewRequest below. Issue-linked tasks additionally require- // the ` (#<n>)` subject suffix.- let task_issue = ctx.store.get_task(task_id).ok().flatten().and_then(|t| t.issue_number);- let validation = match task_issue {- Some(n) => validate_commit_message_for_issue(&commit_message, Some(n)),- None => validate_commit_message(&commit_message),- };- if let Err(e) = validation {- let msg = format!(- "finish rejected: {e}. Fix the commit message and call `finish` again."- );- return finish_dispatch(ctx, task_id, &call.function.name, &msg);- }- match ctx.runner.diff(slot).await {- Ok(d) if d.diff.trim().is_empty() => {- return finish_dispatch(- ctx,- task_id,- &call.function.name,- "finish rejected: the diff is empty — make code changes first, then call `finish` again.",- );- }- Err(e) => {- return finish_dispatch(- ctx,- task_id,- &call.function.name,- &format!("finish rejected: could not read diff ({e}); retry `finish`"),- );- }- _ => {}- }- return ToolEffect::ReviewRequest {- summary,- commit_message,- };- }- other => {- // Structured tools (run_tests, check, git_*, find_files, github_*)- // live in `structured.rs`. Mutating ones respect the plan gate.- if matches!(other, "run_tests" | "check") && plan_gated(&ctx.store, task_id) {- plan_gate_message().to_string()- } else {- let task = ctx.store.get_task(task_id).ok().flatten();- match task {- Some(t) => match crate::structured::dispatch(ctx, task_id, slot, &t, other, &args).await {- Some(result) => result,- None => unknown_tool(other),- },- None => unknown_tool(other),- }- }- },- };- finish_dispatch(ctx, task_id, &call.function.name, &raw)-}--/// Append a `[loaded rules: a/AGENTS.md, ...]` note when per-path auto-load-/// picked up new rules files during this tool call.-async fn with_loaded_rules_note(- ctx: &DriverCtx,- task_id: i64,- slot: u32,- path: &str,- body: String,-) -> String {- let newly = ensure_rules_for_path(ctx, task_id, slot, path).await;- if newly.is_empty() {- body- } else {- format!("{body}\n[loaded rules: {}]", newly.join(", "))- }-}--/// Truncate + scrub a tool result, emit the `tool_result` event, and return-/// the text fed back to the model.-fn finish_dispatch(ctx: &DriverCtx, task_id: i64, name: &str, raw: &str) -> ToolEffect {- let (text, truncated) = truncate_result(raw);- let text = scrub_secrets(&text);- ctx.emit(task_id, EVENT_TOOL_RESULT,- serde_json::json!({"name": name, "truncated": truncated, "result": text}),- );- ToolEffect::Continue {- result_for_model: text,- }-}--/// Confine a repo-relative path to the module scope (or the rules files).-pub(crate) fn check_scope(path: &str, module_scope: &str) -> Result<(), String> {- let dir = module_scope.replace(':', "/");- let dir = dir.trim_matches('/');- let p = path.trim_start_matches('/');- if p == "AGENTS.md" || *p == format!("{dir}/AGENTS.md") {- return Ok(());- }- if dir.is_empty() || p == dir || p.starts_with(&format!("{dir}/")) {- Ok(())- } else {- Err(format!(- "path {path:?} is outside your scope `{dir}/`; stay inside the scope"- ))- }-}--fn exec_summary(r: &proto::ExecResponse) -> String {- let mut s = format!(- "exit={} timed_out={} killed={} ({}ms)",- r.exit_code- .map(|c| c.to_string())- .unwrap_or_else(|| "killed".to_string()),- r.timed_out,- r.killed,- r.duration_ms,- );- if !r.stdout.is_empty() {- s.push_str("\n--- stdout ---\n");- s.push_str(&r.stdout);- }- if !r.stderr.is_empty() {- s.push_str("\n--- stderr ---\n");- s.push_str(&r.stderr);- }- if r.truncated {- s.push_str("\n[output truncated by runner]");- }- s-}--/// `finish` (sole call in its turn, already validated) → submits for human-/// review WITHOUT pushing:-///-/// 1. Commit in the sandbox (single squashed commit with the agent's-/// `commit_message`).-/// 2. Capture the runner diff for `final_diff` (capped ~50 KB).-/// 3. Bundle + import into the mirror as `refs/agent-wip/<id>` (reuses the-/// park WIP machinery); record `wip_sha`.-/// 4. Store `final_diff`, `commit_message`, `summary`; emit the `review`-/// event `{summary, commit_message, diff, truncated}`.-/// 5. Park as `review` with pending `{kind:"review",-/// tool_call_id:<finish id>}`.-///-/// NO push happens here — Approve pushes. Request-changes arrives as the-/// pending `finish` call's tool result on resume; the resumed checkout-/// restores the squashed WIP as uncommitted changes vs `base_sha`, so the-/// agent keeps editing and calls `finish` again.-async fn park_review(- ctx: &DriverCtx,- task_id: i64,- slot: u32,- branch: &str,- call: &ToolCall,- summary: &str,- commit_message: &str,-) -> TaskOutcome {- // Runner diff FIRST (pre-commit working tree vs base) for final_diff.- let review_diff = match ctx.runner.diff(slot).await {- Ok(d) => {- let full = if d.diff.trim().is_empty() {- d.stat.clone()- } else {- format!("{}\n{}", d.stat, d.diff)- };- full- }- Err(e) => {- // Validation already saw a diff earlier this turn; a transient- // read failure now fails loudly rather than submitting blind.- return fail(ctx, task_id, &format!("review diff read: {e}")).await;- }- };- // Single squashed commit with the agent's message.- let _sha = match ctx.runner.commit(slot, commit_message).await {- Ok(r) => r.sha,- Err(e) => return fail(ctx, task_id, &format!("runner commit: {e}")).await,- };- ctx.emit(task_id, EVENT_STATUS,- serde_json::json!({"message": format!("committed {_sha}"), "sha": _sha}),- );- // Bundle → mirror WIP import (same machinery as park).- let bundle = match ctx.runner.bundle(slot).await {- Ok(b) => b,- Err(e) => return fail(ctx, task_id, &format!("bundle download: {e}")).await,- };- let tmp = match write_temp_bundle(&bundle) {- Ok(t) => t,- Err(e) => return fail(ctx, task_id, &format!("temp bundle file: {e}")).await,- };- let wip_sha = match crate::git::import_wip_bundle(- &ctx.config.mirror_dir,- &tmp,- branch,- task_id,- )- .await- {- Ok(sha) => sha,- Err(e) => return fail(ctx, task_id, &format!("wip bundle import: {e}")).await,- };- // Store the review snapshot + emit the review event, then park.- let (final_diff, truncated) = cap_final_diff(&review_diff);- let _ = ctx.store.set_review(task_id, &wip_sha, &final_diff, commit_message, summary);- // A Stop arriving during commit/bundle is honored after import.- if stop_requested(&ctx.store, task_id) {- let pending = Pending::new(- PENDING_STOPPED,- None,- serde_json::json!({"message": "stopped by operator; work kept"}),- );- return finish_park(ctx, task_id, TaskStatus::NeedsInput, pending, Some(&wip_sha));- }- ctx.emit(task_id, EVENT_REVIEW,- serde_json::json!({- "summary": summary,- "commit_message": commit_message,- "diff": final_diff,- "truncated": truncated,- }),- );- let pending = Pending::new(- PENDING_REVIEW,- Some(call.id.clone()),- serde_json::json!({- "summary": summary,- "commit_message": commit_message,- }),- );- finish_park(ctx, task_id, TaskStatus::Review, pending, Some(&wip_sha))-}
infra/agents/agentd/src/auth.rs
diff --git a/infra/agents/agentd/src/auth.rs b/infra/agents/agentd/src/auth.rsdeleted file mode 100644index 5dd0df7ca1..0000000000--- a/infra/agents/agentd/src/auth.rs+++ /dev/null@@ -1,215 +0,0 @@-//! Session auth: argon2 password verification, random session tokens,-//! in-memory login rate limiting.-//!-//! The session cookie holds a 32-byte random token (base64url). Only the-//! SHA-256 hash of the token is stored in SQLite.--use std::collections::HashMap;-use std::sync::{Arc, Mutex};-use std::time::{Duration, Instant};--use argon2::{Argon2, PasswordHash, PasswordVerifier};-use rand::RngCore;-use sha2::{Digest, Sha256};--use crate::models::now_unix;-use crate::store::Store;--pub const SESSION_COOKIE: &str = "agentd_session";-/// 7-day session lifetime, in seconds.-pub const SESSION_TTL_SECS: i64 = 7 * 24 * 3600;--#[derive(Clone)]-pub struct Auth {- pub store: Store,- password_hash: String,- limiter: Arc<Mutex<LoginLimiter>>,-}--impl Auth {- pub fn new(store: Store, password_hash: String) -> Auth {- Auth {- store,- password_hash,- limiter: Arc::new(Mutex::new(LoginLimiter::default())),- }- }-- /// Verify a password against the configured argon2 PHC hash.- /// Returns `false` (not an error) on mismatch so callers can 401/429.- pub fn verify_password(&self, password: &str) -> bool {- let parsed = match PasswordHash::new(&self.password_hash) {- Ok(h) => h,- Err(_) => return false,- };- Argon2::default()- .verify_password(password.as_bytes(), &parsed)- .is_ok()- }-- /// Rate-limit check for a login attempt from `ip`. Returns `Some(retry- /// after)` when the attempt must be rejected with 429.- pub fn login_gate(&self, ip: &str) -> Option<Duration> {- self.limiter- .lock()- .map(|mut l| l.check(ip))- .unwrap_or(None)- }-- pub fn login_failed(&self, ip: &str) {- if let Ok(mut l) = self.limiter.lock() {- l.failed(ip);- }- }-- pub fn login_ok(&self, ip: &str) {- if let Ok(mut l) = self.limiter.lock() {- l.succeeded(ip);- }- }-- /// Issue a session: random token + stored hash. Returns the raw token- /// (goes into the cookie only).- pub fn issue_session(&self) -> Result<String, String> {- let mut bytes = [0u8; 32];- rand::rng().fill_bytes(&mut bytes);- let token = base64url(&bytes);- let hash = token_sha_hex(&token);- let exp = now_unix() + SESSION_TTL_SECS;- self.store.put_session(&hash, exp)?;- Ok(token)- }-- pub fn check_token(&self, token: &str) -> bool {- if token.is_empty() || token.len() > 256 {- return false;- }- let hash = token_sha_hex(token);- self.store- .session_valid(&hash, now_unix())- .unwrap_or(false)- }-- pub fn revoke_token(&self, token: &str) {- let hash = token_sha_hex(token);- let _ = self.store.delete_session(&hash);- }-}--pub fn token_sha_hex(token: &str) -> String {- let digest = Sha256::digest(token.as_bytes());- hex_encode(&digest)-}--pub fn hex_encode(bytes: &[u8]) -> String {- const H
Diff truncated.