5fe5d51b1b
AI Proxy (was AI Router): - server/lib/ai-proxies.js, proxy-apply.js, routes/ai-proxies.js mounted at /api/ai-proxies and the old /api/ai-routers; `router` still accepted on the start routes; profiles move to <CLAUDE_HOME>/agenthub-proxies/ - dashboard_runs.router renamed in place to proxy: an older build on the same DB fails on that column, so dev and prod sharing one DB update together - a proxy's baseUrl stored as its root (a typed /v1 made /v1/v1/messages); Test probes Claude /v1/messages and Codex /v1/responses - Settings → AI Proxy (/settings/ai-router redirects), ProxyPicker Updates: - every tab reloads onto the new UI build when its WebSocket reconnects to a server of another version (lib/newBuildReload.ts, once per version) - Update now stops waiting on a plugin chain that failed or pulled nothing (the old server never goes down), and reloads as soon as a new version answers Also: - a pane whose command exits at once says so (EPANEEXITED) instead of "Command failed: tmux set-option … mouse on" - the pane drag preview draws where the pane actually lands
65 lines
1.9 KiB
JavaScript
65 lines
1.9 KiB
JavaScript
/**
|
|
* @file Verifies db.js renames `dashboard_runs.router` (before the AI Router →
|
|
* AI Proxy rename) to `proxy` in place, keeping each run's value, so a resume
|
|
* still goes back to the proxy its session last ran on.
|
|
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
|
|
*/
|
|
|
|
const { describe, it, before, after } = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
const path = require("path");
|
|
const fs = require("fs");
|
|
const os = require("os");
|
|
const Database = require("better-sqlite3");
|
|
|
|
let TEST_DB;
|
|
|
|
before(() => {
|
|
TEST_DB = path.join(os.tmpdir(), `dashboard-runs-router-${Date.now()}-${process.pid}.db`);
|
|
process.env.DASHBOARD_DB_PATH = TEST_DB;
|
|
const raw = new Database(TEST_DB);
|
|
raw.exec(`
|
|
CREATE TABLE dashboard_runs (
|
|
id TEXT PRIMARY KEY,
|
|
session_id TEXT,
|
|
mode TEXT,
|
|
cwd TEXT NOT NULL,
|
|
model TEXT,
|
|
permission_mode TEXT,
|
|
effort TEXT,
|
|
resume_session_id TEXT,
|
|
prompt_preview TEXT,
|
|
status TEXT NOT NULL,
|
|
exit_code INTEGER,
|
|
started_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
|
|
ended_at TEXT,
|
|
router TEXT
|
|
);
|
|
`);
|
|
raw
|
|
.prepare(
|
|
"INSERT INTO dashboard_runs (id, session_id, cwd, status, router) VALUES (?, ?, ?, ?, ?)"
|
|
)
|
|
.run("agenthub-lane-1", "sess-1", "/tmp/x", "completed", "9router");
|
|
raw.close();
|
|
});
|
|
|
|
after(() => {
|
|
for (const suffix of ["", "-wal", "-shm", "-migrate.lock"]) {
|
|
fs.rmSync(TEST_DB + suffix, { force: true });
|
|
}
|
|
});
|
|
|
|
describe("dashboard_runs.router → proxy", () => {
|
|
it("renames the column and keeps the value", () => {
|
|
const { db } = require("../db");
|
|
const cols = db
|
|
.prepare("PRAGMA table_info(dashboard_runs)")
|
|
.all()
|
|
.map((c) => c.name);
|
|
assert.ok(cols.includes("proxy"));
|
|
assert.ok(!cols.includes("router"));
|
|
assert.equal(require("../lib/dashboard-runs").proxyForSession("sess-1"), "9router");
|
|
});
|
|
});
|