M1: agent loop, tools, sessions, context, skills
ci / check (push) Canceled after 0s

- hx-core: Tool trait + registry (schema validation, parallel calls), event bus with Block/Mutate/Inject hooks,
  agent loop (abort, max turns, AgentEnd inject), JSONL session tree (fork, resume, torn-line tolerant),
  AGENTS.md/CLAUDE.md hierarchy, skills index (bodies on demand)
- hx-tools: read (ranges, binary, images, caps), write/edit (exact match, ambiguity, CRLF, diff, read-guard), bash (merged output, timeout kills process group, tail truncation to temp file)
- hx-cli: -p runs full agent loop, --session / --continue, Ctrl-C abort, HX_BASE_URL override
- tests/e2e.sh: scripted fake Anthropic server drives write -> bash -> answer

Closes #6, closes #7, closes #8, closes #9, closes #10, closes #11, closes #12, closes #13, closes #14
This commit is contained in:
hermes committed 2026-09-30 09:36:16 +00:00
1 parent da9d5d1ae0
commit 21d4d2bb3d
15 files changed
+1752 -52

No files matched your search

+34 -10
View File
@@ -1,14 +1,38 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
//! hx core: tools, hooks, agent loop, sessions, context.
pub mod agent;
pub mod context;
pub mod hook;
pub mod session;
pub mod tool;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Mutex;
use std::time::SystemTime;
/// Cross-tool shared state.
#[derive(Default)]
pub struct State {
/// File -> mtime when the agent last read or wrote it. Used by the read-guard.
pub seen: Mutex<HashMap<PathBuf, Option<SystemTime>>>,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
impl State {
pub fn mark_seen(&self, p: &std::path::Path) {
let m = std::fs::metadata(p).and_then(|m| m.modified()).ok();
self.seen
.lock()
.unwrap_or_else(|e| e.into_inner())
.insert(p.to_path_buf(), m);
}
/// True when the file was read/written by the agent and not changed on disk since.
pub fn is_fresh(&self, p: &std::path::Path) -> bool {
let now = std::fs::metadata(p).and_then(|m| m.modified()).ok();
self.seen
.lock()
.unwrap_or_else(|e| e.into_inner())
.get(p)
.is_some_and(|m| *m == now)
}
}