chore: v2.8.23 — workspace groups, inner repos in Changes (opt-in), sub-agent tokens counted

Workspace groups: named, foldable, ordered sidebar sections kept per
account (agenthub.workspace.groups); a workspace joins one from its menu,
a drop on the header, a drag under a row, or Alt+Up/Down past a group's
edge; headers drag to reorder; a folded header shows its most urgent
state; New workspace in this group; fold/unfold all.

Inner repos: GET /api/lanes/:id/repos + ?repo= on git/fs routes; the
Changes panel shows a parent folder's repos only when Settings -> Git ->
Changes panel turns it on (agenthub.changes.innerRepos, off by default).

Cost: the hook writer adds a session's sub-agent transcripts to its
tokens and hours (server/lib/subagent-usage.js) — a sub-agent on the
session's own model was never counted live (~8% of a week here); an
imported session is re-raised on every pass, so a claude -p run first
seen with an empty transcript no longer stays at $0 (~10%). A one-time
raise-only catch-up (user_version 5) re-reads ~/.claude/projects.

Also: omp install script may redirect to its exact install.redirect URL
(#85, repo-links test exempts it), native paste in the terminal.
This commit is contained in:
2026-10-23 16:41:45 +07:00
parent 65a001dad4
commit c8bc4a95a9
54 changed files with 2521 additions and 112 deletions
+25
View File
@@ -690,6 +690,31 @@ function startBackgroundServices() {
}
}
// One-time (user_version 5) raise of every session's totals to its whole
// transcript plus its sub-agents' (raise only: `exact: false`). Before
// v2.8.23 a live session never counted a sub-agent on its own model, and a
// session imported the moment its file appeared (a `claude -p` run with no
// hooks) kept the usage of that moment, often none — both now counted as
// they happen (server/lib/subagent-usage.js, importSession). Waits for
// marker 4; written only on success, so a crash retries on the next start.
{
const dbModule = require("./db");
if (dbModule.db.pragma("user_version", { simple: true }) === 4) {
const t = setTimeout(() => {
require("../scripts/import-history")
.reconcileTokens(dbModule, { exact: false })
.then((c) => {
console.log(
`Token catch-up: re-read ${c.sessionsTouched} session(s), ${c.modelsWritten} model row(s)`
);
dbModule.db.pragma("user_version = 5");
})
.catch((err) => console.warn("token catch-up failed:", err?.message || err));
}, 15_000);
if (t.unref) t.unref();
}
}
// Per-hour tokens for sessions recorded before `token_usage_hourly`, so the
// daily cost split covers them too. Picks only sessions with no hourly rows,
// so a later start re-reads nothing already done; non-blocking.