-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: extract the agent-spec crate #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
myobie
merged 5 commits into
main
from
schickling-assistant/2026-07-29-agent-spec-crate
Jul 29, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a8fc3b3
refactor: extract the agent-spec crate
schickling-assistant 8b97573
docs: link JobType plainly in the Declared docs
schickling-assistant baab666
docs: correct the parse_declared ordering claim
schickling-assistant 3cd5d9a
test: preserve agent-spec coverage
myobie 8c803e0
Merge remote-tracking branch 'origin/main' into schickling-assistant/…
myobie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [package] | ||
| name = "agent-spec" | ||
| version = "0.1.0" | ||
| edition = "2024" | ||
| description = "Parse a catalog of rendered agent specs (KDL/TOML/JSON) into the runner-normative agent job model." | ||
| license = "MIT" | ||
|
|
||
| [dependencies] | ||
| anyhow = "1" | ||
| kdl = "6" | ||
| serde = { version = "1", features = ["derive"] } | ||
| serde_json = "1" | ||
| toml = "0.9" | ||
|
|
||
| [dev-dependencies] | ||
| tempfile = "3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| //! agent-spec — read a catalog of rendered agent declarations. | ||
| //! | ||
| //! One agent is one declarative file, Nomad-style: the agent is the job and its `pty`/`exec` blocks | ||
| //! are the tasks. This crate owns the two halves any reader of that catalog needs and nothing else: | ||
| //! | ||
| //! - [`spec`] — the runner-normative model a declaration lowers to ([`AgentSpec`], [`Task`], …). | ||
| //! - [`discovery`] — the catalog walk: parse every `*.{kdl,toml,json}` that looks like a | ||
| //! declaration, and resolve each one's `identity`/`host` with the catalog's precedence rule | ||
| //! (content wins, the path supplies defaults, a mismatch is a warning). | ||
| //! | ||
| //! KDL is the canonical on-disk format; TOML and JSON lower to the same model. The KDL parser is a | ||
| //! private implementation detail — [`discovery`] is the only supported entry point, so every reader | ||
| //! resolves identity and host the same way rather than re-deriving it from filenames. | ||
| //! | ||
| //! st2 consumes this crate, which is what keeps it a reference implementation rather than a copy: | ||
| //! a second reader (a TUI, a linter) sees exactly the fields the runner sees, including the ones | ||
| //! the runner's roster JSON does not carry (`supervisor`, `role`, `workspace`, `host`). | ||
| //! | ||
| //! Render-only fields (`harness`, `model`, `persona`, `permissions`, `transport`, `strategy`, | ||
| //! `meta{}`) are read by the render layer and deliberately dropped here — that is what keeps a | ||
| //! consumer render-agnostic. | ||
|
|
||
| pub mod discovery; | ||
| mod kdl_format; | ||
| pub mod spec; | ||
|
|
||
| pub use discovery::{Declared, Discovered, SpecError, discover, parse_declared, path_defaults}; | ||
| pub use spec::{AgentSpec, JobType, Restart, RestartMode, Task, TaskKind, parse_duration}; |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.