agent-joule/crates/joule_coded/Cargo.toml
David Charlot 71b0959274 Measure real token counts and intercept prompts on the L3 path
Bump the open-standards deps (0a8fb779 -> 320fa1e4) whose decode result now carries
the accepted-token and prompt-token counts, and use them:

- l3_generate_counted returns (text, tokens_out, tokens_in) from the on-device decode
  so the session's efficiency/1 receipt carries measured uJ/accepted-token and
  tokens/sec instead of leaving them at zero.
- The GUI agent loop scrubs each prompt through a ModelInterceptor (secrets on the
  way IN to the model, the gap the tool gate/egress policy leave) and accumulates the
  real token totals across the session.
- session_eval seals the efficiency/1 receipt from those measured counts + wall time.

(Committed on the author's behalf to unblock the debug-panel + GUI-metering work.)
2026-07-07 08:01:51 -04:00

100 lines
6.1 KiB
TOML

[package]
name = "joule_coded"
version = "0.1.0"
edition.workspace = true
publish.workspace = true
license = "GPL-3.0-or-later"
[lints]
workspace = true
# The headless agent-joule worker: it owns the same `joule_core` engine the GUI
# panel drives, answers the same control protocol over a Unix socket, and runs
# real on-device coding ops (the L3 cascade tier via JouleClaw's GGUF runtime)
# into a worktree-isolated, signed session ledger — no window, no cloud.
[lib]
path = "src/lib.rs"
[[bin]]
name = "joule-coded"
path = "src/main.rs"
[dependencies]
# joule_core's `l3` model tier is opt-in; the worker enables it via its own `l3`
# feature (default on), so a `--no-default-features` build drops it for Windows.
joule_core.workspace = true
anyhow.workspace = true
futures.workspace = true
log.workspace = true
env_logger.workspace = true
serde.workspace = true
serde_json.workspace = true
clap.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "sync", "time"] }
ed25519-dalek = "2"
# Tier tag for recorded ops. The L3 on-device model tier and host energy
# metering come through `joule_core` (one engine, shared with the GUI editor) —
# the daemon no longer depends on jouleclaw directly.
joule-code-schema = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
# The Sandbox standard's own S5 (microVM) executor + runtime/grant/receipt types.
# The fabric routes untrusted, highest-isolation work to this — a Firecracker
# (or supervised-VMM) driver with real per-device RAPL energy metering and a
# signed JCR-1 receipt — booting our own JouleOS PVH guest, not a borrowed kernel.
sandbox-exec-microvm = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
sandbox-runtime = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
sandbox-capability = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
sandbox-meter = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
sandbox-schema = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
sandbox-attest = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
# The standard's S2 (Sandbox/WASM) executor — deterministic, fuel→joule metered,
# with a per-run replay journal. Heavy (wasmtime), so it is the optional
# `sandbox-wasm` feature (on by default; a --no-default-features worker drops it).
sandbox-exec-wasm = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c", optional = true }
# The standard's S6 (Confidential) TEE layer: SEV-SNP/TDX report parsing + policy
# + real ECDSA verification, with a configfs-tsm hardware provider and a
# software-grounded test provider — so the S6 seal path is exercisable anywhere.
sandbox-tee = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
# Federation transport: CommunicationOS's MoQT-over-QUIC reference impl. We use
# its QuicEndpoint (quinn + a self-signed/pinned cert) to carry the control
# protocol over real QUIC cross-machine — the same proven transport as the
# standard's lockstep-quic. Optional (the `quic` feature, on by default) so the
# daemon can build with no C dependencies (quinn → aws-lc/ring need cmake + a C
# toolchain) on hosts that lack them — e.g. a stock Windows box: build with
# `--no-default-features`, and the worker serves over the Unix socket / TCP.
joule-moq = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c", features = ["quic"], optional = true }
quinn = { version = "0.11", optional = true }
rustls = { version = "0.23", features = ["ring", "std"], optional = true }
# BFT consensus: signed ops (joule-code-cargo SignedOp) committed by a
# supermajority of fleet members via joule-code-collab's proven LockstepCluster
# rule. The QUIC/TCP/socket transport carries the signed proposals between nodes.
joule-code-cargo = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
joule-code-collab = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
blake3 = "1"
hex.workspace = true
# Serve the worker's on-device inference as an OpenAI-compatible endpoint
# (/v1/chat/completions + /v1/responses) whose usage.energy carries the sealed
# mesh/1 receipt — the Mesh standard's own serving stack, reused unchanged.
mesh-openai = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c", features = ["server"] }
mesh-core = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
mesh-engine = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
mesh-meter = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
mesh-router = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
mesh-schema = { git = "https://github.com/Transaction-Science/open-standards.git", rev = "320fa1e4c98b51433cbcfe660e8fa8b43e87228c" }
[dev-dependencies]
# Compile WAT → WASM in the S2 cell's tests.
wat = "1"
[features]
default = ["quic", "l3", "sandbox-wasm"]
# Real-QUIC federation transport (pulls quinn/rustls and their C crypto deps).
quic = ["dep:joule-moq", "dep:quinn", "dep:rustls"]
# The on-device L3 model tier (forwards to joule_core's `l3` feature).
l3 = ["joule_core/l3"]
# The S2 (Sandbox/WASM) executor tier — pulls wasmtime via sandbox-exec-wasm.
sandbox-wasm = ["dep:sandbox-exec-wasm"]