Add API tokens, CLI server API and shared core crate

- Personal API tokens (full/read scope, expiry, revoke) and CLI password login
- Cargo workspace: codecraft-core (types, providers, permission rules) shared by
  server and the upcoming terminal client; server re-exports the old paths
- CLI server API: /cli/config, /cli/skill, /cli/tool (server MCP tools),
  /llm/stream model gateway with budgets and usage per user
- Theme/language preferences mirrored to the server; personal memory endpoint
- Statistics: provider and mode tables stacked; CLI usage labelled
- cli/: work in progress (terminal client is being rewritten as a local TUI)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-08 23:18:50 +01:00
1 parent fca1c41087
commit aa1f8cf016
40 files changed
+2454 -814

No files matched your search

+4
View File
@@ -385,6 +385,7 @@ pub async fn run_session(app: Arc<App>, session_id: &str, cancel: CancellationTo
roots: roots.clone(),
sandbox: crate::sandbox::spec_for(&app, session.owner_id.as_deref()),
clean_room,
owner_id: None,
};
let by_name = |n: &str| tools.iter().find(|t| t.name() == n).cloned();
let all_read_only = calls.iter().all(|(_, n, _)| by_name(n).is_some_and(|t| t.read_only()));
@@ -454,6 +455,7 @@ async fn execute_call(
roots: base.roots.clone(),
sandbox: base.sandbox.clone(),
clean_room: base.clean_room,
owner_id: None,
};
// mcp_call is judged (and approved) as the MCP tool it calls.
let call_name = name;
@@ -853,6 +855,7 @@ async fn stream_step(
duration_ms: duration,
cost: req.model.cost(usage),
error,
user_id: None,
};
if let Err(e) = result {
@@ -937,6 +940,7 @@ fn record_side_usage(app: &App, session: &Session, spec: &str, model: &crate::co
duration_ms: 0,
cost: model.cost(usage),
error: false,
user_id: None,
});
}