Modules/Taskboard/server/subrouter/token.mjs
Шурупов Илья Викторович 18a418495c Add Taskboard: node-graph task board backed by an MCP task server
The board edits the agent task database through the Python MCP server, which
now lives in this module (Taskboard/server). Code is versioned here; the data
(tasks.db and per-task session workspaces) stays in AGENTS_DATA_DIR, by default
~/agents/manager, decided only in server/paths.py.

UI:
- Tasks are graph nodes; parent/child and dependency links map to set_parent
  and dependencies. Dropping a link on empty space creates a connected task.
- Inspector edits title, description, status, priority, model, effort,
  permission mode and colour.
- Edits stay local until Save (Ctrl+S, File > Save); the status bar shows the
  unsaved count. Unsaved work is the difference between the board and the last
  server board (BoardSnapshot), saved atomically with save_board.
- Server changes merge in on a one-second poll without touching unsaved edits;
  the same field changed on both sides becomes a keep-mine/use-theirs conflict.
- Sessions: start, stop, restart with new settings (keeping or dropping the
  conversation), open in a terminal, send messages; a node badge shows the
  live session state.

Server:
- Headless Claude Code sessions, one tmux session per task, with state from
  hooks and the exit reason recorded; manual or auto permission modes.
- save_board, edit_task conflict checks, field history, get_board and
  revision polling, session tools, task workspaces with report conventions.
2026-10-21 17:55:30 +03:00

19 lines
675 B
JavaScript

import { adapters, loadAccounts, updateAccount } from "@subrouter/cli";
const provider = "anthropic";
const file = await loadAccounts();
const pool = file.providers?.[provider];
const account = pool?.accounts?.[pool.activeIndex ?? 0];
if (!account) {
process.stderr.write("subrouter has no anthropic account; run: npx @subrouter/cli login anthropic\n");
process.exit(1);
}
const match = { ...account };
const persist = (update) => updateAccount({ provider, match, update });
const token = await adapters.anthropic.getApiKey({ account, persist });
if (token instanceof Error) {
process.stderr.write(`${token.message}\n`);
process.exit(1);
}
process.stdout.write(token);