feat(hive-claude): parse turn telemetry in the lib, return it from run
This commit is contained in:
parent
faa7f982af
commit
487e62a9ca
7 changed files with 260 additions and 227 deletions
|
|
@ -22,7 +22,8 @@ Two layers — reach for the high-level one:
|
|||
`Result<Progress, Error>` does resume-or-create, compacts **reactively** on
|
||||
overflow (compact + retry once), and **proactively** after a clean turn when
|
||||
the policy says so (optional checkpoint turn, then compact). `.compact(…)`
|
||||
forces one. `Progress { created, compacted }` reports what happened.
|
||||
forces one. `Progress { created, compacted, telemetry }` reports what happened
|
||||
— including the turn's parsed `Telemetry`, finalised at the `result` event.
|
||||
- **`Claude::run(&config, &attach, prompt, &sink)`** → `Result<(), Error>` —
|
||||
the low-level driver: one turn, one `Attach` target (`Resume` / `Create` /
|
||||
`Continue` / `OneOff`). A clean turn is `Ok(())`; every other state is an
|
||||
|
|
@ -38,8 +39,9 @@ Supporting pieces:
|
|||
- **`Sink`** — a trait with no-op defaults; implement what you care about to
|
||||
observe stream events, non-JSON stdout, and stderr. `NoopSink` ignores all.
|
||||
- **`SessionStore`** — locate and archive on-disk sessions by title.
|
||||
- **`Usage`** — the minimal context signal (`context_tokens`,
|
||||
`context_window`) the policy sees.
|
||||
- **`Telemetry`** (`context`, `cost`, `context_window`, `model`) — everything
|
||||
the driver parses from a turn's stream, returned in `Progress`. **`Usage`** is
|
||||
the minimal slice (`context_tokens`, `context_window`) the policy sees.
|
||||
|
||||
`Error` unifies the two things that can stop a turn: recognized **sentinels**
|
||||
(`PromptTooLong`, `RateLimited`, `AuthFailed`, `SessionNotFound`) and **hard
|
||||
|
|
|
|||
Loading…
Reference in a new issue