Compare commits

..

No commits in common. "62377e372f73d2d8c36b6710b247d27a4c3d818d" and "5d79274cd66bf260e8d1e4f521019c0b028d0288" have entirely different histories.

12 changed files with 55 additions and 1032 deletions

958
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -36,11 +36,9 @@ opentelemetry-otlp = { version = "0.27.0", features = ["grpc-tonic", "trace"] }
opentelemetry_sdk = { version = "0.27.1", features = ["metrics", "rt-tokio"] }
opentelemetry-semantic-conventions = "0.27.0"
opentelemetry-stdout = "0.27.0"
progenitor = "0.8.0"
reqwest = { version = "0.12.9", features = ["json", "stream", "rustls-tls"] }
schemars = "0.8.21"
semver = "1.0.23"
serde = { version = "1.0.215", features = ["derive"] }
serde = "1.0.215"
slog = "2.7.0"
slog-async = "2.8.0"
tokio = { version = "1.41.1", features = ["full"] }
@ -55,4 +53,3 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features =
"env-filter",
"fmt",
] }
uuid = { version = "1", features = [ "serde", "v4" ] }

View file

@ -7,14 +7,10 @@ license = "MPL-2.0"
[dependencies]
anyhow.workspace = true
clap.workspace = true
progenitor.workspace = true
reqwest.workspace = true
schemars.workspace = true
serde.workspace = true
tokio.workspace = true
tracing.workspace = true
tracing-chrome.workspace = true
tracing-subscriber.workspace = true
tracing.workspace = true
[[bin]]
name = "patagia-agent"

View file

@ -3,8 +3,6 @@ use clap::Parser;
use tokio::time::{sleep, Duration};
use tracing_subscriber::prelude::*;
mod patagia_api;
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Cli {}
@ -21,10 +19,6 @@ async fn main() -> Result<()> {
tracing::info!("Patagia Agent");
let client = patagia_api::Client::new("http://localhost:9474");
let result = client.version().await?;
tracing::info!("Result: {:?}", result);
sleep(Duration::from_secs(3)).await;
Ok(())
}

View file

@ -1,3 +0,0 @@
use progenitor::generate_api;
generate_api!(spec = "../api.json", derives = [schemars::JsonSchema]);

View file

@ -8,7 +8,7 @@
"/version": {
"get": {
"summary": "Fetch version info.",
"operationId": "version",
"operationId": "api_version",
"responses": {
"200": {
"description": "successful operation",

View file

@ -28,7 +28,7 @@ tracing-opentelemetry.workspace = true
tracing-slog.workspace = true
tracing-subscriber.workspace = true
tracing.workspace = true
#
# [[bin]]
# name = "patagia-controller"
# doc = false
[[bin]]
name = "patagia-controller"
doc = false

View file

@ -10,6 +10,6 @@ type ControllerApiDescription = ApiDescription<Arc<ControllerContext>>;
pub fn api() -> Result<ControllerApiDescription> {
let mut api = ControllerApiDescription::new();
api.register(version::version)?;
api.register(version::api_version)?;
Ok(api)
}

View file

@ -29,7 +29,7 @@ struct VersionInfo {
),
err(Debug),
)]
pub(crate) async fn version(
pub async fn api_version(
rqctx: RequestContext<Arc<ControllerContext>>,
) -> Result<HttpResponseOk<VersionInfo>, HttpError> {
let ver = VersionInfo {

30
flake.lock generated
View file

@ -3,11 +3,11 @@
"advisory-db": {
"flake": false,
"locked": {
"lastModified": 1733749954,
"narHash": "sha256-2Ug80Uf/oUujxgh02Iy5vTG0V+Ab9+YUHuRLRY0ayiY=",
"lastModified": 1731808107,
"narHash": "sha256-HSx5EDsO07KULW4bNPVeGVAfpQqzwwS005vqISdOzNg=",
"owner": "rustsec",
"repo": "advisory-db",
"rev": "ec9ce28714bb38d77a2223e7266df705500a7f11",
"rev": "8e353a172f1baf11c0c917cfc9ae3c5eff8b9d06",
"type": "github"
},
"original": {
@ -18,11 +18,11 @@
},
"crane": {
"locked": {
"lastModified": 1733688869,
"narHash": "sha256-KrhxxFj1CjESDrL5+u/zsVH0K+Ik9tvoac/oFPoxSB8=",
"lastModified": 1731974733,
"narHash": "sha256-enYSSZVVl15FI5p+0Y5/Ckf5DZAvXe6fBrHxyhA/njc=",
"owner": "ipetkov",
"repo": "crane",
"rev": "604637106e420ad99907cae401e13ab6b452e7d9",
"rev": "3cb338ce81076ce5e461cf77f7824476addb0e1c",
"type": "github"
},
"original": {
@ -98,11 +98,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1733097829,
"narHash": "sha256-9hbb1rqGelllb4kVUCZ307G2k3/UhmA8PPGBoyuWaSw=",
"lastModified": 1731890469,
"narHash": "sha256-D1FNZ70NmQEwNxpSSdTXCSklBH1z2isPR84J6DQrJGs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2c15aa59df0017ca140d9ba302412298ab4bf22a",
"rev": "5083ec887760adfe12af64830a66807423a859a7",
"type": "github"
},
"original": {
@ -128,11 +128,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1734230139,
"narHash": "sha256-zsp0Mz8VgyIAnU8UhP/YT1g+zlsl+NIJTBMAbY+RifQ=",
"lastModified": 1732328983,
"narHash": "sha256-RHt12f/slrzDpSL7SSkydh8wUE4Nr4r23HlpWywed9E=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "150fbc8aa2bc501041810bbc1dbfe73694a861be",
"rev": "ed8aa5b64f7d36d9338eb1d0a3bb60cf52069a72",
"type": "github"
},
"original": {
@ -161,11 +161,11 @@
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1733761991,
"narHash": "sha256-s4DalCDepD22jtKL5Nw6f4LP5UwoMcPzPZgHWjAfqbQ=",
"lastModified": 1732292307,
"narHash": "sha256-5WSng844vXt8uytT5djmqBCkopyle6ciFgteuA9bJpw=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "0ce9d149d99bc383d1f2d85f31f6ebd146e46085",
"rev": "705df92694af7093dfbb27109ce16d828a79155f",
"type": "github"
},
"original": {

View file

@ -26,7 +26,7 @@
flake-utils.lib.eachDefaultSystem (
system:
let
rustVersion = "1.83.0";
rustVersion = "1.81.0"; # Skipping 1.82 because of https://github.com/rust-lang/rust/issues/132064
overlays = [
(import rust-overlay)
@ -49,24 +49,29 @@
nativeBuildInputs = with pkgs; [
clang_18
mold
pkg-config
];
jsonFilter = path: _type: builtins.match ".*json$" path != null;
sourceAndFixtures = path: type:
(jsonFilter path type) || (craneLib.filterCargoSources path type);
sourceAndFixtures = path: type: (craneLib.filterCargoSources path type);
src = pkgs.lib.cleanSourceWith {
src = ./.;
filter = sourceAndFixtures;
};
treefmtEval = treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
nixfmt.package = pkgs.nixfmt-rfc-style;
shfmt.enable = true;
rustfmt.enable = true;
};
settings.formatter.rustfmt.command = pkgs.lib.mkForce "${pkgs.rust-toolchain}/bin/rustfmt";
};
commonArgs = {
inherit src stdenv nativeBuildInputs;
strictDeps = true;
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
buildInputs = with pkgs; [
openssl
];
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
@ -118,18 +123,6 @@
src = fileSetForCrate ./xtask;
}
);
treefmtEval = treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
nixfmt.package = pkgs.nixfmt-rfc-style;
shfmt.enable = true;
rustfmt.enable = true;
};
settings.formatter.rustfmt.command = pkgs.lib.mkForce "${pkgs.rust-toolchain}/bin/rustfmt";
};
in
{
# `nix build`
@ -149,7 +142,7 @@
}
);
# fmt = craneLib.cargoFmt (commonArgs // { inherit src; });
fmt = craneLib.cargoFmt (commonArgs // { inherit src; });
audit = craneLib.cargoAudit (commonArgs // { inherit src advisory-db; });
@ -163,17 +156,11 @@
);
openapi =
pkgs.runCommand "openapi"
(
commonArgs
// {
inherit cargoArtifacts;
src = fileSetForCrate ./xtask;
}
)
''
${self.packages.${system}.xtask}/bin/xtask open-api | ${pkgs.diffutils}/bin/diff -u $src/api.json - | tee $out
'';
pkgs.runCommand "openapi" (commonArgs // {
src = fileSetForCrate ./xtask;
}) ''
${self.packages.${system}.xtask}/bin/xtask open-api | ${pkgs.diffutils}/bin/diff -u $src/api.json - | tee $out
'';
};
# For `nix fmt`
@ -191,16 +178,14 @@
cargo-nextest
cargo-watch
hyperfine
openssl
just
rust-dev-toolchain
watchexec
];
RUST_BACKTRACE = 1;
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc; # Required for rust-analyzer
shellHook = ''
export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc} # Required for rust-analyzer
echo
echo "🛠 Welcome to the Patagia development environment 🛠"
echo " Welcome to the Patagia development environment! "
echo "Run 'just' to see available commands."
echo
'';

View file

@ -12,14 +12,6 @@ run-controller $RUST_LOG="debug,h2=info,hyper_util=info,tower=info":
dev-controller:
watchexec --clear --restart --stop-signal INT --debounce 300ms -- just run-controller
# Run agent
run-agent $RUST_LOG="debug,h2=info,hyper_util=info,tower=info":
cargo run --package patagia-agent
# Run agent local development
dev-agent:
watchexec --clear --restart --stop-signal INT --debounce 300ms -- just run-agent
# Lint all source code
lint:
cargo clippy