Prompt History und Verbrauchsauswertung (#660), englische Hauptsprache (#661)

Prompt history: every run records its transcript (task, each model step with
tokens and cost, tool calls and results, engine follow-ups) - bounded in size,
scrubbed of recognisable secrets, system prompts stored once per text.
Retention in days per instance (default 14) and per agent (0 = never, -1 =
forever); an hourly janitor deletes what is past it, "never" also purges.

Usage analysis over run receipts: filter by period, agent, model, event, status,
cost and free text; sort by every column; totals over the whole filter; hourly
or daily series grouped by agent, model or event; markers for budget denials and
model changes; run detail with receipt, transcript, tool calls and approvals.

WebUI: Analysis > Token usage > Runs / Timeline, run detail, Prompt History with
retention settings. New code, comments and texts in English; texts come from
language packs (i18n/en.json, de.json) via modules/i18n.js. CLAUDE.md records
English as the main language.

Version 0.1.12.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-09-19 15:33:09 +02:00
co-authored by Claude Opus 5
parent 2f0361278b
commit 5adf4c1ca6
40 changed files with 3521 additions and 10 deletions
@@ -288,6 +288,37 @@ public sealed class SqliteStorage
CREATE INDEX IF NOT EXISTS IX_Dauerfreigaben_Agent
ON Dauerfreigaben (AgentId, Tool, Operation);
-- #660: Prompt history - prompt and response of every run, kept as long as the
-- retention of the agent allows. System prompts are stored once per text.
CREATE TABLE IF NOT EXISTS RunTranscripts (
RunId TEXT PRIMARY KEY,
AgentId TEXT NOT NULL,
Model TEXT NOT NULL DEFAULT '',
Source TEXT NOT NULL DEFAULT '',
TaskId TEXT NULL,
StartedAt TEXT NOT NULL,
CompletedAt TEXT NULL,
Status TEXT NOT NULL DEFAULT '',
SystemPromptHash TEXT NULL,
Prompt TEXT NOT NULL DEFAULT '',
Response TEXT NOT NULL DEFAULT '',
EntriesJson TEXT NOT NULL DEFAULT '[]',
SizeChars INTEGER NOT NULL DEFAULT 0,
Truncated INTEGER NOT NULL DEFAULT 0
);
CREATE INDEX IF NOT EXISTS IX_RunTranscripts_Agent
ON RunTranscripts (AgentId, StartedAt);
CREATE INDEX IF NOT EXISTS IX_RunTranscripts_Started
ON RunTranscripts (StartedAt DESC);
CREATE TABLE IF NOT EXISTS SystemPrompts (
Hash TEXT PRIMARY KEY,
Text TEXT NOT NULL,
FirstSeenAt TEXT NOT NULL
);
""";
cmd.ExecuteNonQuery();