feat: audit log, usage tracking UI, OpenAI orchestrator compaction, onboarding + docs
Tool audit log:
- Every orchestrator tool call logged to home/{user}/tool_audit/YYYY-MM-DD.jsonl
- Files panel sidebar: audit log group (collapsed), date-linked read-only table
- Admin endpoints: /api/audit/files, /api/audit/day, /api/audit/recent, /api/audit/stats
- Engine and model name recorded per entry
OpenAI orchestrator improvements:
- Context budget enforcement: 75% of model context_k (min 16k)
- Message compaction: truncates old tool results when approaching budget
- max_rounds respected per model config (intersected with server cap)
OpenRouter onboarding (setup.html, onboarding.py, app.js, settings.html):
- Step 3 of 3: /setup/model with curated model picker
- Chat banner for users on server-default model (informational, not alarmist)
- Settings quick-link card; /setup/model works standalone for existing users
Model registry + session store:
- set_role_config / get_role_config for per-role tool lists and system_append
- session_store: session rename, session name backfill endpoint
UI updates (app.js, index.html, style.css, local_llm.html):
- Role toggle in context panel
- Off-the-record mode
- Agent notes read-only viewer
- OPERATIONS.md loaded at T2+ in context
Documentation:
- HELP.md: full tool table, per-role tool sets, Agent Notes, usage tracking
- TOOLS.md: Agent Notes section, count corrected to 44
- ARCH__SYSTEM.md, ARCH__BACKENDS.md, MASTER.md updated to match reality
- CLAUDE.md: onboarding flow, documentation philosophy sections
- README.md: stack in practice, DeepSeek TUI mention, architecture diagram updated
- TODO__Agents.md: onboarding task completed with deviation notes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -127,6 +127,36 @@
|
||||
|
||||
.emoji-opt.selected { border-color: #7c3aed; background: #2d1f52; }
|
||||
#emoji-hidden { display: none; }
|
||||
|
||||
.provider-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
background: #2d1f52;
|
||||
border: 1px solid #7c3aed;
|
||||
border-radius: 6px;
|
||||
padding: 0.3rem 0.6rem;
|
||||
font-size: 0.78rem;
|
||||
color: #a78bfa;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.skip-link {
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin-top: 1rem;
|
||||
font-size: 0.8rem;
|
||||
color: #64748b;
|
||||
text-decoration: none;
|
||||
}
|
||||
.skip-link:hover { color: #94a3b8; }
|
||||
|
||||
.model-hint {
|
||||
font-size: 0.72rem;
|
||||
color: #64748b;
|
||||
margin-top: 0.75rem;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -137,10 +167,11 @@
|
||||
</div>
|
||||
|
||||
<!-- ERROR -->
|
||||
<!-- ERROR_MODEL -->
|
||||
|
||||
<!-- ── Step 1: password ───────────────────────────────────────── -->
|
||||
<div id="step-password">
|
||||
<div class="step-label">Step 1 of 2</div>
|
||||
<div class="step-label">Step 1 of 3</div>
|
||||
<h2>Set your password</h2>
|
||||
<form method="POST" action="" id="password-form">
|
||||
<input type="hidden" name="step" value="password">
|
||||
@@ -161,7 +192,7 @@
|
||||
|
||||
<!-- ── Step 2: persona ────────────────────────────────────────── -->
|
||||
<div id="step-persona" style="display:none">
|
||||
<div class="step-label">Step 2 of 2</div>
|
||||
<div class="step-label">Step 2 of 3</div>
|
||||
<h2>Create your persona</h2>
|
||||
<form method="POST" action="" id="persona-form">
|
||||
<input type="hidden" name="step" value="persona">
|
||||
@@ -203,6 +234,39 @@
|
||||
<button type="submit">Create my persona →</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- ── Step 3: model connect ─────────────────────────────────── -->
|
||||
<div id="step-model" style="display:none">
|
||||
<div class="step-label"><!-- SETUP_STEP3_LABEL --></div>
|
||||
<h2>Connect an AI model</h2>
|
||||
<div class="provider-badge">⚡ Recommended: OpenRouter</div>
|
||||
<p style="font-size:0.82rem;color:#94a3b8;margin-bottom:1rem;">
|
||||
One API key gives you access to Claude, Gemini, Llama, and dozens of other models.
|
||||
Get a free key at <a href="https://openrouter.ai/keys" target="_blank" style="color:#a78bfa;">openrouter.ai/keys</a>.
|
||||
</p>
|
||||
<form method="POST" action="/setup/model" id="model-form">
|
||||
<div class="field">
|
||||
<label for="api_key">OpenRouter API key</label>
|
||||
<input type="password" id="api_key" name="api_key"
|
||||
autocomplete="off" placeholder="sk-or-v1-..." required>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="model_name">Starting model</label>
|
||||
<select id="model_name" name="model_name">
|
||||
<option value="anthropic/claude-3-5-haiku-20241022">Claude 3.5 Haiku — Fast & affordable</option>
|
||||
<option value="anthropic/claude-3-7-sonnet-20250219">Claude 3.7 Sonnet — Smarter Claude</option>
|
||||
<option value="google/gemini-2.0-flash-001">Gemini 2.0 Flash — Fast Google model</option>
|
||||
<option value="meta-llama/llama-3.3-70b-instruct">Llama 3.3 70B — Open source</option>
|
||||
</select>
|
||||
<p class="hint">You can add more models or switch anytime in Account → Model Registry.</p>
|
||||
</div>
|
||||
<button type="submit">Connect & start chatting →</button>
|
||||
</form>
|
||||
<p class="model-hint">
|
||||
Using Ollama, a local model, or something else?
|
||||
<a href="#" id="skip-model-link" style="color:#64748b;">Skip this step →</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -232,6 +296,11 @@
|
||||
document.getElementById('step-password').style.display = 'none';
|
||||
document.getElementById('step-persona').style.display = 'block';
|
||||
}
|
||||
if (params.get('step') === '3') {
|
||||
document.getElementById('step-password').style.display = 'none';
|
||||
document.getElementById('step-persona').style.display = 'none';
|
||||
document.getElementById('step-model').style.display = 'block';
|
||||
}
|
||||
|
||||
// ── Client-side confirm password check ───────────────────────────
|
||||
document.getElementById('password-form').addEventListener('submit', e => {
|
||||
@@ -243,6 +312,15 @@
|
||||
}
|
||||
});
|
||||
|
||||
// ── Skip model setup — navigate to user home ─────────────────────
|
||||
document.getElementById('skip-model-link')?.addEventListener('click', e => {
|
||||
e.preventDefault();
|
||||
// Ask server for skip target (the cx_setup_persona cookie has the path)
|
||||
fetch('/setup/model/skip', { method: 'POST', credentials: 'same-origin' })
|
||||
.then(r => { if (r.redirected) location.href = r.url; else location.href = '/'; })
|
||||
.catch(() => { location.href = '/'; });
|
||||
});
|
||||
|
||||
// ── Auto-generate persona slug from display name ─────────────────
|
||||
document.getElementById('display_name').addEventListener('input', function() {
|
||||
const slugField = document.getElementById('persona_name');
|
||||
|
||||
Reference in New Issue
Block a user