969b06253c
Part B: Model Pricing, Hook Configuration and CLAUDE_HOME move from Settings → Dashboard to the Claude Code tab's AgentHub sub-tab (ClaudeAgentHubSettings.tsx); CODEX_HOME is editable in Codex → AgentHub. A home that is or contains the OS home is refused (EBADHOME). Settings persistence: dashboard-saved settings go to ~/.config/agenthub/settings.env (AGENTHUB_SETTINGS_FILE), outside the plugin cache an update wipes. Load order: real env > the checkout's .env > that file. The first CLAUDE_HOME change pins DASHBOARD_DATA_DIR so the DB stays put. C1: codex-usage.js reads Codex rollout journals into sessions (new column tool) and token_usage, tracked per file in codex_rollouts; forks deduped by total vector, sub-agent threads folded into the root; pricing-sync also prices OpenAI models; PricingSettings with a vendor filter. C2: codex-hooks.js installs AgentHub's hooks into $CODEX_HOME/hooks.json on a click, through a stable forwarder; Codex trust is never written. The hook route creates tool='codex' sessions and folds sub-agent hooks into the root. D: antigravity-usage.js reads agy's per-conversation SQLite files (tokens from ModelUsageStats) into tool='antigravity' sessions; antigravity-hooks.js installs the named hook `agenthub` (PreInvocation, PostToolUse, Stop — never PreToolUse) into ~/.gemini/config/hooks.json; Settings → Antigravity tab; Gemini pricing. Whole-change review fixes: sameOriginGuard on both home PUTs, routers.missing on a CLAUDE_HOME change, reset-pricing scope, GET /api/sessions?tool=, clear-data covering the new tables, Codex child-thread events moving no status, hooks owning status only while current, EFOREIGN for a forwarder that is not ours, agy quiet window and turn rules, AGENTHUB_SETTINGS_FILE honoured from .env. Docs, OpenAPI and the CLAUDE.md marker updated. Server 2141, client 779.
31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
/**
|
|
* @file SessionToolBadge — names the AI coding CLI that produced a session
|
|
* when it is not Claude Code (`sessions.tool` = `codex`, `antigravity`, …, by
|
|
* its AI Tools label). Renders nothing for a Claude session, so the Sessions
|
|
* list and session header look as before for every Claude row.
|
|
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
|
|
*/
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
import { useAiTools } from "../hooks/useAiTools";
|
|
|
|
/** A chip with the tool's name, or nothing for `claude` / an unset tool. */
|
|
export function SessionToolBadge({ tool }: { tool?: string | null }) {
|
|
if (!tool || tool === "claude") return null;
|
|
return <ToolChip tool={tool} />;
|
|
}
|
|
|
|
// Split out so the catalog hook only mounts for a non-Claude session.
|
|
function ToolChip({ tool }: { tool: string }) {
|
|
const { t } = useTranslation("sessions");
|
|
const { label } = useAiTools();
|
|
return (
|
|
<span
|
|
className="inline-flex items-center text-[10px] font-semibold text-violet-700 dark:text-violet-300 bg-violet-500/10 border border-violet-500/25 px-1.5 py-0.5 rounded-full"
|
|
title={t("toolBadgeTitle", { tool: label(tool) })}
|
|
>
|
|
{label(tool)}
|
|
</span>
|
|
);
|
|
}
|