feat: v2.5.12 — plan and quota for every AI tool, Grok Build and Kimi Code, Quit AgentHub (#65)

Usage panel (status bar):
- every account shows its plan (Claude subscriptionType, Codex
  chatgpt_plan_type, Cursor membershipType, Grok subscriptionTier)
- new quota rows: Cursor CLI (cursor.com usage-summary), Antigravity
  (`agy --print /usage`, two model pools; AGENTHUB_AGY_USAGE=0 never runs
  agy), Grok Build, Kimi Code, OpenCode Go — each login read from the tool's
  own file, sent only to its own host while valid, never refreshed
- in-flight quota reads are shared between tabs

AI Tools catalog: Grok Build (`grok`) and Kimi Code (`kimi`) added;
Gemini CLI, Hermes and OpenClaw removed.

Also: Quit AgentHub (#65, `agenthub stop`), status-area icon, Add to Chat
on an editor selection, Settings in three groups, JetBrains-style Changes
panel (ticked files/hunks, ignore, blame, file history), terminal font.

--no-verify: :3000 is taken by another dev server (lane-detect tests);
both suites run by hand — server 2636/2639 (the 3 are :3000), client
1131/1131.
This commit is contained in:
2026-10-08 12:22:14 +07:00
parent 6ef9a5d4b7
commit a9c71cd905
133 changed files with 8007 additions and 1830 deletions
+93
View File
@@ -49,6 +49,35 @@ const err = (description) => ({
content: { "application/json": { schema: { $ref: "#/components/schemas/ErrorResponse" } } },
});
// The Users page's account changes: every body carries the admin's own
// password again (`currentPassword`).
const userBody = {
"application/json": {
schema: { type: "object", properties: { user: { $ref: "#/components/schemas/AuthUser" } } },
},
};
const idParam = { name: "id", in: "path", required: true, schema: { type: "integer" } };
const changeBody = (properties, required = []) => ({
required: true,
content: {
"application/json": {
schema: {
type: "object",
required: [...required, "currentPassword"],
properties: { ...properties, currentPassword: { type: "string" } },
},
},
},
});
const changeResponses = {
200: { description: "Changed", content: userBody },
400: err("EBADPASSWORD / EBADROLE / EBADFIELD"),
403: err("EREAUTH (own password wrong) / EREADONLY / EADMIN / ELOCALMODE"),
404: err("ENOUSER / ENOLANE"),
409: err("ESELF — your own role or disable"),
429: err("ETOOMANY — 10 wrong passwords in 15 minutes"),
};
const paths = {
"/api/users": {
get: {
@@ -95,6 +124,70 @@ const paths = {
403: err("EADMIN — a member"),
},
},
post: {
tags: ["Auth"],
operationId: "createServerUser",
summary:
"Admin: add an account. Needs the admin's own password again (currentPassword); audited",
requestBody: {
required: true,
content: {
"application/json": {
schema: {
type: "object",
required: ["username", "password", "currentPassword"],
properties: {
username: { type: "string" },
password: { type: "string", minLength: 8 },
role: { type: "string", enum: ["admin", "analyst", "member"], default: "member" },
currentPassword: { type: "string" },
},
},
},
},
},
responses: {
201: { description: "Created", content: userBody },
400: err("EBADUSER / EBADPASSWORD / EBADROLE"),
403: err("EREAUTH (own password wrong) / EREADONLY / EADMIN / ELOCALMODE"),
409: err("EEXISTS"),
429: err("ETOOMANY — 10 wrong passwords in 15 minutes"),
},
},
},
"/api/users/{id}": {
patch: {
tags: ["Auth"],
operationId: "updateServerUser",
summary:
"Admin: change a role and/or disable (ending every login) or enable. Never your own (ESELF)",
parameters: [idParam],
requestBody: changeBody({
role: { type: "string", enum: ["admin", "analyst", "member"] },
disabled: { type: "boolean" },
}),
responses: changeResponses,
},
},
"/api/users/{id}/password": {
post: {
tags: ["Auth"],
operationId: "resetServerUserPassword",
summary: "Admin: a new password for that user; every login of theirs ends",
parameters: [idParam],
requestBody: changeBody({ password: { type: "string", minLength: 8 } }, ["password"]),
responses: changeResponses,
},
},
"/api/users/{id}/workspaces": {
post: {
tags: ["Auth"],
operationId: "assignServerUserWorkspace",
summary: "Admin: make that user the owner of a workspace (lane)",
parameters: [idParam],
requestBody: changeBody({ laneId: { type: "integer" } }, ["laneId"]),
responses: changeResponses,
},
},
"/api/users/audit": {
get: {
+40 -1
View File
@@ -595,6 +595,28 @@ const paths = {
},
},
},
"/api/lanes/{id}/git/blame": {
get: {
tags: ["Lanes"],
summary: "Annotate: each line's last commit",
description:
"`git blame --porcelain` of the working-tree file, for the Changes panel's Annotate gutter. Same lexical lane guard and secret refusal as /git/file, capped at 1 MB. A line nobody committed yet is null. An untracked file (no history) answers {available:false}. Read-only, no same-origin guard.",
operationId: "blameLaneFile",
parameters: [
{ name: "id", in: "path", required: true, schema: { type: "integer" } },
{ name: "path", in: "query", required: true, schema: { type: "string" } },
],
responses: {
200: {
description:
"{available, path, commits: {<sha>: {short, author, date, summary}}, lines: [<sha>|null]}.",
},
400: { description: "EBADPATH, ENOFILE or ETOOBIG." },
403: { description: "ESECRET." },
404: { description: "Lane not found." },
},
},
},
"/api/lanes/{id}/git/raw": {
get: {
tags: ["Lanes"],
@@ -742,6 +764,7 @@ const paths = {
"revert",
"undo-commit",
"amend",
"ignore",
],
},
},
@@ -782,13 +805,29 @@ const paths = {
paths: {
type: "array",
items: { type: "string" },
description: "stage, unstage, discard; each must be a path git reports changed.",
description:
"stage, unstage, discard, ignore (untracked only, else 400 ETRACKED; appends an anchored line to the workspace's .gitignore); each must be a path git reports changed. commit and amend: commit exactly these files' working-tree content (`git commit --only`), an untracked one included, leaving every other change — staged or not — uncommitted; a conflicted one is 409 ECONFLICTS. amend with an empty list rewords only (a message is then required, else 400 ENOCHANGES).",
},
path: {
type: "string",
description:
"stage-hunk, discard-hunk; a path git reports changed (not untracked).",
},
hunks: {
type: "object",
additionalProperties: {
type: "array",
items: {
type: "object",
properties: {
hunk: { type: "string" },
blocks: { type: "array", items: { type: "integer" } },
},
},
},
description:
"commit, amend (optional): the hunk-level commit — per tracked, non-renamed path, only these change blocks of these hunks (`@@` lines as the diff at `context` returned them). Built in a temporary index from git's own fresh diff and committed from it; the real index entries of the committed paths are then reset to the new HEAD, the rest of a partial file left as an unstaged change. A hunk no longer in the diff is 409 EHUNKGONE, an untracked path 400 EUNTRACKED, a bad shape 400 EBADPATH.",
},
hunk: {
type: "string",
description:
+56
View File
@@ -6,6 +6,8 @@
* - PUT /api/settings/claude-home (Settings)
* - GET /api/settings/autostart (Settings)
* - PUT /api/settings/autostart (Settings)
* - GET /api/settings/tray (Settings)
* - PUT /api/settings/tray (Settings)
* - GET /api/workflows/runs (Workflows)
* - GET /api/workflows/runs/{runId} (Workflows)
* - GET /api/remote-sources (Remote Sources)
@@ -1064,6 +1066,60 @@ const paths = {
};
})(),
"/api/settings/tray": (() => {
const status = {
description: "Status-area icon state",
content: {
"application/json": {
schema: {
type: "object",
required: ["available", "enabled", "running"],
properties: {
available: {
type: "boolean",
description: "False in server mode, or on Linux with no graphical session",
},
enabled: { type: "boolean", description: "On by default" },
running: { type: "boolean", description: "The icon process is heartbeating" },
},
},
},
},
};
return {
get: {
tags: ["Settings"],
summary: "Whether AgentHub's icon shows in the OS status area",
operationId: "getTray",
responses: { 200: status },
},
put: {
tags: ["Settings"],
summary: "Show or hide the status-area icon",
description:
"Clears or writes `<data dir>/runtime/tray-off` and starts or stops the icon process. Never touches the server. Same-origin only.",
operationId: "setTray",
requestBody: {
required: true,
content: {
"application/json": {
schema: {
type: "object",
required: ["enabled"],
properties: { enabled: { type: "boolean" } },
},
},
},
},
responses: {
200: { ...status, description: "The new state" },
400: { description: "EBADVALUE: `enabled` is not a boolean" },
403: { description: "EBADORIGIN: another site asked" },
},
},
};
})(),
"/api/settings/codex-hooks": (() => {
const status = {
description: "Where AgentHub's Codex hooks stand",