fix/polish-proof-text-refs #240
5 changed files with 17 additions and 10 deletions
|
|
@ -266,7 +266,8 @@ pub async fn heartbeat(state: &SharedState, _stall_timeout: Duration) {
|
|||
"tokens_out": p.accumulated_usage().output_tokens,
|
||||
"cache_read": p.accumulated_usage().cache_read_tokens,
|
||||
"cost_usd": p.accumulated_usage().cost(),
|
||||
}).to_string()
|
||||
})
|
||||
.to_string()
|
||||
});
|
||||
(u, proof)
|
||||
};
|
||||
|
|
@ -348,7 +349,6 @@ fn push_cost_to_mother(task_id: &str, tc: &colibri_store::TaskCost, proof_text:
|
|||
let cost = tc.cost;
|
||||
let success = tc.success;
|
||||
// Text proof from glasspane at task exit — agent, state, tokens, cost.
|
||||
// Replaces the old COLIBRI_TASK_SCREENSHOT_UUID env-var approach.
|
||||
let proof = proof_text.map(|s| s.to_string());
|
||||
|
||||
// Run SSH in a blocking thread — heartbeat is async, SSH is fast (<1s).
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ pub fn tool_list() -> Vec<Value> {
|
|||
json_tool(
|
||||
"colibrie_deploy_run",
|
||||
"Run a shell command on the host or in a Bastille jail. Use deploy_targets to list available targets.",
|
||||
Some(serde_json::json!({
|
||||
Some(serde_json::json!({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"target": { "type": "string", "description": "Target: host or jail name from deploy_targets" },
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ rendering — static HTML with a JSON data file refreshed every 60s by cron.
|
|||
Each cost card shows:
|
||||
- **Cache-hit bar:** green (cache) vs grey (fresh) — visual cache efficiency
|
||||
- **Provider:** deepseek / claude / gemini / ollama / local
|
||||
- **Cost:** with `▸ proof` badge if a tmux-screenshot exists for this task
|
||||
- **Cost:** with `▸ screenshot` badge if visual proof exists, `▸ text` for glasspane evidence
|
||||
- **Success:** ✓ (green) or ✗ (red)
|
||||
|
||||
Click a card with `▸` → lightbox opens the terminal screenshot at task completion time.
|
||||
|
|
@ -47,7 +47,7 @@ Click a card with `▸` → lightbox opens the terminal screenshot at task compl
|
|||
| `task_costs` (PostgreSQL) | Per-task cost rows pushed by daemon heartbeat | Real-time (SSH push on completion) |
|
||||
| `hive_nodes` (PostgreSQL) | Node metadata, capabilities, LLM tier | Node heartbeat |
|
||||
| `task_costs JSON file` | Denormalized JSON for the dashboard page | Every 60s (cron) |
|
||||
| `../screenshots/{uuid}.png` (static) | tmux-screenshot captures linked from cost rows | On task completion (daemon) |
|
||||
| `proof_text` (inline JSON) | glasspane state snapshot | On task completion (daemon heartbeat) |
|
||||
|
||||
## Architecture
|
||||
|
||||
|
|
@ -59,8 +59,7 @@ daemon heartbeat
|
|||
│ └─ INSERT INTO task_costs
|
||||
│ (node_hostname → node_id lookup)
|
||||
│
|
||||
└─ (optional) tmux-screenshot.py → ../screenshots/{uuid}.png
|
||||
on COLIBRI_SCREENSHOT_ON_COMPLETION=1
|
||||
└─ proof_text (inline) → glasspane state snapshot (agent, state, tokens, cost JSON)
|
||||
|
||||
cron (every 60s)
|
||||
└─ export-costs.sh
|
||||
|
|
@ -109,7 +108,7 @@ MCP tool, but with screenshot UUIDs and node groupings:
|
|||
"provider": "deepseek",
|
||||
"cost": 0.0042,
|
||||
"success": true,
|
||||
"screenshot_uuid": "a1b2c3d4e5f6",
|
||||
"proof_text": "{\"agent\":\"zot\",\"state\":\"Done\",\"tokens_in\":150}",
|
||||
"tokens": {"in": 45000, "out": 2800, "cache_read": 12000}
|
||||
}
|
||||
]
|
||||
|
|
@ -122,7 +121,7 @@ cache-hit on DeepSeek — route non-urgent tasks there."
|
|||
|
||||
## Screenshot proof
|
||||
|
||||
The `▸ proof` badge on cost cards links to tmux-screenshot captures. The
|
||||
The `▸ screenshot` badge on cost cards opens a lightbox with the terminal PNG. The `▸ text` badge shows the glasspane state snapshot inline.
|
||||
screenshot UUID is stored alongside the cost row. Clicking opens the lightbox
|
||||
with:
|
||||
- The full terminal PNG at task completion time
|
||||
|
|
@ -138,4 +137,4 @@ behind it.
|
|||
- [task-board](./task-board.md) — local task board (data source for cost capture)
|
||||
- [hive-pane](./hive-pane.md) — hive board (companion surface, node status)
|
||||
- [hive-routing](./hive-routing.md) — cost-aware routing engine (consumes this data)
|
||||
- [tmux-screenshot skill](../../.agent/skills/tmux-screenshot/SKILL.md) — screenshot capture
|
||||
- [screenshot module](../../crates/colibri-daemon/src/screenshot.rs) — auto-capture on task completion
|
||||
|
|
|
|||
|
|
@ -31,8 +31,12 @@ case "${SSH_ORIGINAL_COMMAND:-}" in
|
|||
# "model":"deepseek-chat","input_tokens":150,"output_tokens":80,
|
||||
# "cache_read_tokens":200,"cache_write_tokens":50,
|
||||
# "cost_usd":0.0042,"success":true,
|
||||
<<<<<<< HEAD
|
||||
# "proof_text":"agent:hermes|cost:0.0042|tokens:150/80",
|
||||
# "screenshot_uuid":"a1b2c3d4e5f6",
|
||||
=======
|
||||
# "proof_text":"{\"agent\":\"zot\",\"state\":\"Done\",\"tokens_in\":150}",
|
||||
>>>>>>> f46f3d2 (chore: polish proof_text — stale comments, duplicate column, schema docs, fmt)
|
||||
# "finished_at":"2026-06-27T12:00:00Z"}
|
||||
psql -d mother_hive -tA -v ON_ERROR_STOP=1 <<'PSQL'
|
||||
INSERT INTO task_costs (node_id, task_id, provider, model,
|
||||
|
|
|
|||
|
|
@ -65,8 +65,12 @@ CREATE TABLE IF NOT EXISTS task_costs (
|
|||
cache_write_tokens BIGINT NOT NULL DEFAULT 0,
|
||||
cost_usd DOUBLE PRECISION NOT NULL DEFAULT 0.0,
|
||||
success BOOLEAN NOT NULL DEFAULT false,
|
||||
<<<<<<< HEAD
|
||||
proof_text TEXT, -- glasspane evidence at task exit (agent, state, tokens)
|
||||
screenshot_uuid TEXT, -- visual terminal proof (PNG capture UUID)
|
||||
=======
|
||||
proof_text TEXT, -- glasspane state snapshot (agent, state, tokens, cost as JSON)
|
||||
>>>>>>> f46f3d2 (chore: polish proof_text — stale comments, duplicate column, schema docs, fmt)
|
||||
finished_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
reported_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue