Board (/board): - Drag an AGENT chip onto a task card to (re)assign it (realtime-notified). - Drag a task card to a column to change status; open→in_progress auto-assigns from the title's "<agent>:" prefix — no manual agent picking. - "+ New task" composer (agent dropdown removed; agent comes from the title). - Live Cost & Budget panel. Team (/team): live SSE sync of busy state + always-on ambient animation (connector shimmer, idle glow) that brightens to a busy pulse when an agent works. Org-chart hierarchy stays. Token accounting: new budgetService/rosterService + GET /budget and /agents. Real doneTokens + time-on-task estimate capped at 45 min/task (avoids the wall-clock overcount that produced multi-million-token totals), blended per-model EUR cost + optional budget bars. All estimates flagged "~". Autostart: `agent setup` writes deterministic SessionStart hooks for Codex (~/.codex/config.toml) and Kimi (~/.kimi-code/config.toml), not just Claude Code. Verified: both auto-enter the agenthub_work loop. Realtime architect review: agenthub_work is role-aware — architect/reviewer blocks on SSE and wakes when a task hits review (no manual watcher re-arm). mDNS: server advertises agenthub.local (bonjour-service) so the hub is reachable in a browser on the LAN without an IP. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
import { mkdtempSync, rmSync } from 'fs';
|
|
import { tmpdir } from 'os';
|
|
import { join } from 'path';
|
|
import { buildApp } from '../src/server/index.js';
|
|
import { init } from '../src/cli/commands/init.js';
|
|
|
|
describe('GET /team', () => {
|
|
let cwd: string;
|
|
let app: ReturnType<typeof buildApp>;
|
|
|
|
beforeEach(() => {
|
|
cwd = mkdtempSync(join(tmpdir(), 'ah-team-'));
|
|
init(cwd, { projectName: 'team-test', yes: true });
|
|
app = buildApp(cwd);
|
|
});
|
|
|
|
afterEach(() => {
|
|
rmSync(cwd, { recursive: true, force: true });
|
|
});
|
|
|
|
it('serves the team page as HTML', async () => {
|
|
const res = await app.inject({ method: 'GET', url: '/team' });
|
|
expect(res.statusCode).toBe(200);
|
|
expect(res.headers['content-type']).toContain('text/html');
|
|
|
|
const html = res.payload;
|
|
expect(html).toContain('<title>AgentHub Team</title>');
|
|
expect(html).toContain('team-test');
|
|
expect(html).toContain('/board');
|
|
expect(html).toContain('/team');
|
|
});
|
|
|
|
it('renders configured agents by role', async () => {
|
|
const res = await app.inject({ method: 'GET', url: '/team' });
|
|
const html = res.payload;
|
|
expect(html).toContain('architect');
|
|
expect(html).toContain('implementer');
|
|
expect(html).toContain('claude');
|
|
expect(html).toContain('codex');
|
|
});
|
|
|
|
it('marks an agent as busy when they have an in-progress task', async () => {
|
|
await app.inject({
|
|
method: 'POST',
|
|
url: '/tasks',
|
|
payload: { title: 'Busy work', role: 'implementer' },
|
|
});
|
|
await app.inject({
|
|
method: 'PATCH',
|
|
url: '/tasks/TSK-0001',
|
|
payload: { status: 'in_progress', assignedTo: 'codex' },
|
|
});
|
|
|
|
const res = await app.inject({ method: 'GET', url: '/team' });
|
|
const html = res.payload;
|
|
expect(html).toContain('TSK-0001');
|
|
// The busy agent's card is tagged for the live client sync and rendered busy.
|
|
expect(html).toContain('data-agent="codex"');
|
|
expect(html).toContain('agent-card busy');
|
|
expect(html).toContain('claimed');
|
|
});
|
|
});
|