agenthall 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Volkan Tağal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,120 @@
1
- # Temporary Holding Version
1
+ <p align="center"><img src="public/logo.svg" width="96" alt="Agent Hall logo"></p>
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <h1 align="center">Agent Hall</h1>
4
+
5
+ <p align="center">A local virtual office for your Claude Code agents. You are the boss.</p>
6
+
7
+ Every project folder is a room, every agent sits at a desk, and you can see at a glance who is working, who is waiting for your approval and who is out in the garden. Click an agent to open its real terminal.
8
+
9
+ ![The office: rooms per project, a park, a car park and the road](docs/city.png)
10
+
11
+ ```bash
12
+ npx agenthall
13
+ ```
14
+
15
+ ## What you get
16
+
17
+ ### Run a team of agents
18
+
19
+ - **Rooms and desks.** Each project folder is a room. Agents sit at desks by seniority, with the team lead up front. Click an empty chair to hire someone for that desk.
20
+ - **Live terminals.** Click an agent to open its terminal: a real Claude Code session in the project folder. Watch it work, type to it, or send a quick message.
21
+ - **A worktree per agent.** New hires work in their own git worktree and branch (`office/<name>`), so agents in the same repo never overwrite each other's files. When an agent leaves, its worktree is removed if nothing is uncommitted; the branch stays.
22
+ - **Approval queue.** The "waiting" count in the top bar opens every pending permission request with the full command or edit. Approve or decline it right there.
23
+ - **Task board.** Each room's whiteboard holds cards. An idle agent in the room takes the next card; the card is done when that turn ends. A card in an empty room calls someone in.
24
+ - **Meetings.** Click the lobby, pick two to six idle agents and a topic. They gather round the table, give their views, answer each other, and the chair writes a summary with decisions and action items.
25
+ - **Colleagues talk.** Every agent has an `office` command: `office who` lists colleagues and `office send "<name>" "<message>"` reaches another agent's terminal. You can also send an agent to visit a colleague, or announce something to a room or the whole office.
26
+ - **Other AI tools.** Buildings can run Cursor Agent, Codex CLI, Gemini CLI, Aider, OpenCode or any command next to Claude Code.
27
+ - **Your own sessions too.** `claude` sessions you started in your own terminals show up in the room of their folder. Follow them live, or continue one inside the office.
28
+
29
+ ![Inside a room: the lead up front, an agent waiting for approval](docs/room.png)
30
+
31
+ ### Keep an eye on things
32
+
33
+ - **Stuck agents.** An agent on the same step for 10 minutes, or making the same call four times in a turn, gets a warning sign over its desk. A Stop button interrupts the turn.
34
+ - **Conflicts.** When two agents change the same file within 30 minutes, a red line joins them and their panels say which file. "Tell them" asks the agents to coordinate.
35
+ - **Tokens and cost.** Today's tokens per agent and in total, with an estimate of what the same work would cost at API list prices.
36
+ - **End-of-day report.** What every session did on a day: tasks, commits, pull requests, files changed, the last word and the cost. Copies as Markdown.
37
+ - **Workday.** Agents idle for a while go home (their conversation is kept and resumed later). Set an end of the workday and everyone goes home once their work is done.
38
+
39
+ ![The approval queue](docs/approvals.png)
40
+
41
+ ### Have some fun
42
+
43
+ - Finished tasks earn XP, levels and confetti; praise and 1:1s lift morale; a leaderboard crowns the employee of the month and you collect badges as the boss.
44
+ - Idle agents take a break in the park: smoke, coffee, a swim in the pond. Bored ones walk up and ask for work, and sulk if ignored.
45
+ - Everyone commutes by car, motorbike, bicycle or bus, parks in front of the building and goes home the same way. Fired agents storm off in their own car (now and then into a lamppost).
46
+ - Day and night follow your clock: at night only rooms with someone at work have their lights on.
47
+ - Click a room to zoom in; ✕ or Esc takes you back to the city.
48
+ - While everyone is working, the boss's sports car waits at the curb for a quick driving game.
49
+
50
+ The interface speaks English and Turkish. Everything runs on your machine: the server listens on `127.0.0.1` only and rejects cross-site requests.
51
+
52
+ ## Requirements
53
+
54
+ - Node.js 18 or newer
55
+ - [Claude Code](https://docs.claude.com/en/docs/claude-code) installed and logged in (`claude` on your PATH)
56
+
57
+ Works on macOS, Linux and Windows (prebuilt terminal binaries, no compiler needed).
58
+
59
+ ## Install and run
60
+
61
+ Run it straight from npm:
62
+
63
+ ```bash
64
+ npx agenthall # opens http://127.0.0.1:4321
65
+ ```
66
+
67
+ or install the `agenthall` command:
68
+
69
+ ```bash
70
+ npm install -g agenthall
71
+ agenthall # start the office
72
+ agenthall doctor # check Node, Claude Code, its config and permissions
73
+ agenthall status # list rooms and agents from the terminal
74
+ agenthall add ~/code/my-app # add a project folder as a room
75
+ agenthall --help
76
+ ```
77
+
78
+ From a checkout of this repository:
79
+
80
+ ```bash
81
+ git clone https://github.com/volkantagal-g/agenthall.git
82
+ cd agenthall && npm install && npm start
83
+ ```
84
+
85
+ ### Options
86
+
87
+ Command line: `--port <n>`, `--no-open`, `--home <dir>`, `--garden <min>`, `--bored <min>`, `--ask <min>`. Workday rules (going home when idle, end of the workday, calling someone in for a board card) are set in the app under ⏰.
88
+
89
+ | Environment variable | Default | Meaning |
90
+ | --- | --- | --- |
91
+ | `PORT` | `4321` | Port to listen on |
92
+ | `AGENT_OFFICE_HOME` | `~/.agent-office` | Where rooms, agents and per-agent hook settings are stored |
93
+ | `AGENT_OFFICE_NO_OPEN` | unset | Set to skip opening the browser |
94
+ | `AGENT_OFFICE_GARDEN_MIN` | `5` | Idle minutes at the desk before going to the garden |
95
+ | `AGENT_OFFICE_BORED_MIN` | `15` | Idle minutes before an agent asks for work |
96
+ | `AGENT_OFFICE_ASK_MIN` | `720` | Minimum minutes between an agent's requests |
97
+ | `AGENT_OFFICE_ASK_WINDOW_MIN` | `10` | Minutes an asking agent waits at the front |
98
+ | `AGENT_OFFICE_STUCK_MIN` | `10` | Minutes on one step before an agent counts as stuck |
99
+
100
+ ## How it works
101
+
102
+ - Each agent runs `claude` in a pseudo-terminal, in its worktree or the project folder, with `--session-id` (or `--resume` after a restart), `--append-system-prompt` (name, role, project) and a `--settings` file that adds hooks.
103
+ - The hooks (`SessionStart`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `Notification`, `Stop`) call `hook-relay.js`, which reports to the local server. That is how the office knows who is working, waiting or idle, which files are being edited and when a step takes too long.
104
+ - Approvals from the queue are answered by pressing the matching key in the agent's terminal. Announcements, board cards, meetings and messages are typed into the terminal; while an agent is busy, Claude Code queues them.
105
+ - Sessions you started yourself are found in `~/.claude/sessions/<pid>.json`; their transcripts in `~/.claude/projects` feed the live view, the day report and the token counts.
106
+ - Worktrees live under `.claude/worktrees/` inside the repo (like Claude Code's own), so the folder trust carries over; the folder is kept out of `git status` through the repo's local `.git/info/exclude`.
107
+ - When the office is closed, agents go home. "Start the workday" brings them back with their previous sessions.
108
+
109
+ ## Developing
110
+
111
+ Running from a git checkout turns on hot reload (force it with `AGENT_OFFICE_DEV=1`, turn it off with `AGENT_OFFICE_DEV=0`):
112
+
113
+ - edits under `public/` reload open browsers (CSS is swapped in place), keeping the camera and the open panel;
114
+ - edits to `server.js` or `hook-relay.js` restart the server once no office agent is in the middle of a task; agents that were running are resumed. A syntax error cancels the restart and shows a warning.
115
+
116
+ Translations live in `public/i18n.js`.
117
+
118
+ ## License
119
+
120
+ [MIT](LICENSE)
@@ -0,0 +1,287 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // agenthall CLI: start the local office, open it, inspect it, add rooms.
5
+
6
+ const { exec, execFileSync, fork } = require('child_process');
7
+ const fs = require('fs');
8
+ const os = require('os');
9
+ const path = require('path');
10
+ const http = require('http');
11
+ const pkg = require('../package.json');
12
+ const I18N = require('../public/i18n.js');
13
+
14
+ const HELP = `
15
+ 🏛 Agent Hall ${pkg.version} — a local office for your Claude Code agents
16
+
17
+ Usage
18
+ agenthall [start] Start the office and open it in the browser
19
+ agenthall open Open the running office in the browser
20
+ agenthall status List rooms and agents of the running office
21
+ agenthall add <folder> Add a project folder as a room (default: current folder)
22
+ agenthall doctor Check that everything needed is installed
23
+ agenthall help | --version
24
+
25
+ Options
26
+ --port <n> Port to use (default 4321, or $PORT)
27
+ --no-open Do not open the browser on start
28
+ --home <dir> Where office data is kept (default ~/.agent-office)
29
+ --garden <min> Minutes an idle agent stays at its desk before the garden (default 5)
30
+ --bored <min> Minutes an idle agent waits before asking for work (default 15)
31
+ --ask <min> Minutes between its requests (default 720 = 12 hours, twice a day)
32
+ --name <name> Room name for "add"
33
+
34
+ Examples
35
+ npx ${pkg.name}
36
+ npm install -g ${pkg.name} && agenthall
37
+ agenthall --port 5000
38
+ cd ~/code/my-app && agenthall add
39
+ `;
40
+
41
+ // ---------------------------------------------------------------- args
42
+
43
+ function parseArgs(argv) {
44
+ const out = { _: [] };
45
+ for (let i = 0; i < argv.length; i++) {
46
+ const a = argv[i];
47
+ if (a === '--no-open') out.open = false;
48
+ else if (a === '-v' || a === '--version') out.version = true;
49
+ else if (a === '-h' || a === '--help') out.help = true;
50
+ else if (a.startsWith('--')) {
51
+ const [k, v] = a.slice(2).split('=');
52
+ out[k] = v !== undefined ? v : argv[++i];
53
+ } else out._.push(a);
54
+ }
55
+ return out;
56
+ }
57
+
58
+ const args = parseArgs(process.argv.slice(2));
59
+ const command = args.help ? 'help' : args.version ? 'version' : args._[0] || 'start';
60
+ const port = Number(args.port || process.env.PORT) || 4321;
61
+ const base = `http://127.0.0.1:${port}`;
62
+
63
+ // ---------------------------------------------------------------- helpers
64
+
65
+ const c = {
66
+ bold: (s) => `\x1b[1m${s}\x1b[0m`,
67
+ dim: (s) => `\x1b[2m${s}\x1b[0m`,
68
+ green: (s) => `\x1b[32m${s}\x1b[0m`,
69
+ red: (s) => `\x1b[31m${s}\x1b[0m`,
70
+ yellow: (s) => `\x1b[33m${s}\x1b[0m`,
71
+ };
72
+
73
+ function request(method, urlPath, body) {
74
+ return new Promise((resolve, reject) => {
75
+ const data = body ? JSON.stringify(body) : null;
76
+ const req = http.request(
77
+ `${base}${urlPath}`,
78
+ {
79
+ method,
80
+ timeout: 3000,
81
+ headers: {
82
+ Host: `127.0.0.1:${port}`,
83
+ Origin: base,
84
+ ...(data ? { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) } : {}),
85
+ },
86
+ },
87
+ (res) => {
88
+ let raw = '';
89
+ res.on('data', (d) => (raw += d));
90
+ res.on('end', () => {
91
+ let json = {};
92
+ try {
93
+ json = raw ? JSON.parse(raw) : {};
94
+ } catch {
95
+ /* not json */
96
+ }
97
+ if (res.statusCode >= 400) reject(new Error(json.error || `HTTP ${res.statusCode}`));
98
+ else resolve(json);
99
+ });
100
+ }
101
+ );
102
+ req.on('timeout', () => req.destroy(new Error('timeout')));
103
+ req.on('error', reject);
104
+ if (data) req.write(data);
105
+ req.end();
106
+ });
107
+ }
108
+
109
+ const isRunning = () => request('GET', '/api/state').then(() => true, () => false);
110
+
111
+ function openBrowser(url) {
112
+ const cmd = process.platform === 'darwin' ? `open "${url}"` : process.platform === 'win32' ? `start "" "${url}"` : `xdg-open "${url}"`;
113
+ exec(cmd, () => {});
114
+ }
115
+
116
+ function notRunning() {
117
+ console.error(c.red(` The office is not running on port ${port}.`) + `\n Start it with: ${c.bold('agenthall')}\n`);
118
+ process.exit(1);
119
+ }
120
+
121
+ // ---------------------------------------------------------------- commands
122
+
123
+ async function start() {
124
+ if (await isRunning()) {
125
+ console.log(`\n 🏢 The office is already open at ${c.bold(base)}\n`);
126
+ if (args.open !== false) openBrowser(base);
127
+ return;
128
+ }
129
+ process.env.PORT = String(port);
130
+ if (args.home) process.env.AGENT_OFFICE_HOME = path.resolve(args.home);
131
+ if (args.garden) process.env.AGENT_OFFICE_GARDEN_MIN = String(args.garden);
132
+ if (args.bored) process.env.AGENT_OFFICE_BORED_MIN = String(args.bored);
133
+ if (args.ask) process.env.AGENT_OFFICE_ASK_MIN = String(args.ask);
134
+ // The server runs in a child process so it can restart itself on code
135
+ // changes (exit code 75) while this process keeps the terminal.
136
+ let first = true;
137
+ let child = null;
138
+ const run = () => {
139
+ child = fork(path.join(__dirname, '..', 'server.js'), [], { stdio: 'inherit' });
140
+ child.on('message', (m) => {
141
+ if (m.t !== 'ready') return;
142
+ if (first) {
143
+ console.log(`\n 🏛 ${c.bold('Agent Hall')} is open at ${c.bold(m.url)}`);
144
+ console.log(c.dim(` local only — press Ctrl+C to close the office (agents go home)${m.dev ? '\n hot reload is on: code changes apply by themselves' : ''}\n`));
145
+ if (args.open !== false && !process.env.AGENT_OFFICE_NO_OPEN) openBrowser(m.url);
146
+ first = false;
147
+ } else {
148
+ console.log(c.dim(` ↻ office reloaded (${new Date().toLocaleTimeString()})`));
149
+ }
150
+ });
151
+ child.on('exit', (code, signal) => {
152
+ if (code === 75) return run();
153
+ process.exit(code ?? (signal ? 1 : 0));
154
+ });
155
+ };
156
+ const stop = () => {
157
+ if (child && child.connected) child.kill('SIGTERM');
158
+ else process.exit(0);
159
+ };
160
+ process.on('SIGINT', stop);
161
+ process.on('SIGTERM', stop);
162
+ run();
163
+ }
164
+
165
+ async function open() {
166
+ if (!(await isRunning())) notRunning();
167
+ openBrowser(base);
168
+ }
169
+
170
+ const STATUS_ICON = { working: '💻', waiting: '⚠️ ', idle: '☕', starting: '🚶', offline: '🏠' };
171
+
172
+ async function status() {
173
+ let s;
174
+ try {
175
+ s = await request('GET', '/api/state');
176
+ } catch {
177
+ notRunning();
178
+ }
179
+ console.log(`\n 🏛 ${c.bold('Agent Hall')} ${c.dim(base)}\n`);
180
+ if (!s.projects.length) console.log(c.dim(' No rooms yet. Add one with: agenthall add <folder>\n'));
181
+ for (const p of s.projects) {
182
+ console.log(` ${c.bold(p.name)}${p.auto ? c.dim(' (temporary)') : ''} ${c.dim(p.path)}`);
183
+ const agents = s.agents.filter((a) => a.projectId === p.id);
184
+ if (!agents.length) console.log(c.dim(' — empty —'));
185
+ for (const a of agents) {
186
+ const role = I18N.translate('en', 'role.' + a.role);
187
+ const lv = a.game ? ` Lv${a.game.level}` : '';
188
+ const kind = a.subagent ? ' ↳' : a.external ? ' 🖥' : '';
189
+ const task = a.tool || a.task || '';
190
+ console.log(` ${STATUS_ICON[a.status] || '•'} ${a.name}${kind} ${c.dim(`· ${role}${lv}`)}${task ? c.dim(` — ${task.replace(/\s+/g, ' ').slice(0, 70)}`) : ''}`);
191
+ }
192
+ console.log('');
193
+ }
194
+ }
195
+
196
+ async function add() {
197
+ const folder = path.resolve(args._[1] || process.cwd());
198
+ if (!(await isRunning())) notRunning();
199
+ try {
200
+ const p = await request('POST', '/api/projects', { path: folder, name: args.name || '' });
201
+ console.log(`\n ${c.green('✓')} Room ${c.bold(p.name)} added for ${folder}\n`);
202
+ } catch (e) {
203
+ console.error(`\n ${c.red('✗')} ${e.message}\n`);
204
+ process.exit(1);
205
+ }
206
+ }
207
+
208
+ async function doctor() {
209
+ let ok = true;
210
+ const line = (good, label, detail = '') => {
211
+ if (!good) ok = false;
212
+ console.log(` ${good ? c.green('✓') : c.red('✗')} ${label}${detail ? c.dim(' ' + detail) : ''}`);
213
+ };
214
+ const warn = (label, detail = '') => console.log(` ${c.yellow('!')} ${label}${detail ? c.dim(' ' + detail) : ''}`);
215
+ console.log(`\n 🩺 ${c.bold('Agent Hall doctor')}\n`);
216
+
217
+ const major = Number(process.versions.node.split('.')[0]);
218
+ line(major >= 18, `Node.js ${process.versions.node}`, major >= 18 ? '' : 'Node 18 or newer is required');
219
+
220
+ try {
221
+ require('@lydell/node-pty');
222
+ line(true, 'Terminal support (node-pty)');
223
+ } catch (e) {
224
+ line(false, 'Terminal support (node-pty)', e.message.split('\n')[0]);
225
+ }
226
+
227
+ try {
228
+ const shell = process.env.SHELL || '/bin/bash';
229
+ const v =
230
+ process.platform === 'win32'
231
+ ? execFileSync('cmd.exe', ['/c', 'claude', '--version'], { encoding: 'utf8', timeout: 15000 })
232
+ : execFileSync(shell, ['-ilc', 'claude --version'], { encoding: 'utf8', timeout: 15000, stdio: ['ignore', 'pipe', 'ignore'] });
233
+ line(true, 'Claude Code', v.trim().split('\n').pop());
234
+ } catch {
235
+ line(false, 'Claude Code', 'not found — install it: https://docs.claude.com/en/docs/claude-code');
236
+ }
237
+
238
+ // An unreadable ~/.claude.json (left owned by root after `sudo claude`) makes
239
+ // every agent start with the first-run setup and ask to log in again.
240
+ const claudeConfig = path.join(process.env.CLAUDE_CONFIG_DIR || os.homedir(), '.claude.json');
241
+ try {
242
+ fs.accessSync(claudeConfig, fs.constants.R_OK | fs.constants.W_OK);
243
+ line(true, 'Claude Code config is readable', claudeConfig);
244
+ } catch (e) {
245
+ if (e.code === 'ENOENT') warn('No Claude Code config yet', 'run `claude` once and log in');
246
+ else line(false, `Claude Code config is not readable (${e.code})`, `quit any sudo Claude, then: sudo chown -R $USER ${claudeConfig} ~/.claude`);
247
+ }
248
+
249
+ const sessions = path.join(os.homedir(), '.claude', 'sessions');
250
+ if (fs.existsSync(sessions)) line(true, 'Sessions started in your own terminals can be shown', sessions);
251
+ else warn('No ~/.claude/sessions yet', 'outside sessions appear once you use Claude Code');
252
+
253
+ const home = path.resolve(args.home || process.env.AGENT_OFFICE_HOME || path.join(os.homedir(), '.agent-office'));
254
+ try {
255
+ fs.mkdirSync(home, { recursive: true });
256
+ fs.accessSync(home, fs.constants.W_OK);
257
+ line(true, 'Office data folder is writable', home);
258
+ } catch (e) {
259
+ line(false, 'Office data folder is not writable', `${home} (${e.code})`);
260
+ }
261
+
262
+ if (await isRunning()) warn(`An office is already running on port ${port}`, base);
263
+ else line(true, `Port ${port} is free`);
264
+
265
+ console.log(ok ? `\n ${c.green('All good.')} Start with: ${c.bold('agenthall')}\n` : `\n ${c.red('Fix the items above, then run agenthall again.')}\n`);
266
+ process.exit(ok ? 0 : 1);
267
+ }
268
+
269
+ const commands = {
270
+ start,
271
+ open,
272
+ status,
273
+ add,
274
+ doctor,
275
+ help: () => console.log(HELP),
276
+ version: () => console.log(pkg.version),
277
+ };
278
+
279
+ if (!commands[command]) {
280
+ console.error(c.red(`\n Unknown command: ${command}`));
281
+ console.log(HELP);
282
+ process.exit(1);
283
+ }
284
+ Promise.resolve(commands[command]()).catch((e) => {
285
+ console.error(c.red(`\n ${e.message}\n`));
286
+ process.exit(1);
287
+ });
package/hook-relay.js ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // Invoked by Claude Code hooks: forwards the hook payload to the office server.
5
+ // Never blocks or fails the agent, whatever happens.
6
+
7
+ const http = require('http');
8
+
9
+ const [port, agentId, event, token] = process.argv.slice(2);
10
+ let input = '';
11
+ process.stdin.setEncoding('utf8');
12
+ process.stdin.on('data', (c) => (input += c));
13
+ process.stdin.on('end', () => {
14
+ const req = http.request(
15
+ {
16
+ host: '127.0.0.1',
17
+ port,
18
+ method: 'POST',
19
+ path: `/api/hook/${encodeURIComponent(agentId)}/${encodeURIComponent(event)}`,
20
+ headers: { 'Content-Type': 'application/json', 'X-Agent-Office-Token': token, Host: `127.0.0.1:${port}` },
21
+ timeout: 1500,
22
+ },
23
+ (res) => {
24
+ res.resume();
25
+ res.on('end', () => process.exit(0));
26
+ }
27
+ );
28
+ req.on('error', () => process.exit(0));
29
+ req.on('timeout', () => {
30
+ req.destroy();
31
+ process.exit(0);
32
+ });
33
+ req.end(input || '{}');
34
+ });
35
+ setTimeout(() => process.exit(0), 3000);
package/office-cli.js ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // `office` command available inside every agent's terminal: lets agents in
5
+ // both buildings find each other and exchange messages through the office.
6
+ // office who list colleagues
7
+ // office send "<name>" <message> send a message to a colleague
8
+
9
+ const http = require('http');
10
+
11
+ const { AGENT_OFFICE_PORT: port, AGENT_OFFICE_TOKEN: token, AGENT_OFFICE_AGENT: me } = process.env;
12
+ const [cmd, ...rest] = process.argv.slice(2);
13
+
14
+ function call(method, path, body) {
15
+ return new Promise((resolve, reject) => {
16
+ const data = body ? JSON.stringify(body) : null;
17
+ const req = http.request(
18
+ {
19
+ host: '127.0.0.1',
20
+ port,
21
+ method,
22
+ path,
23
+ timeout: 5000,
24
+ headers: {
25
+ Host: `127.0.0.1:${port}`,
26
+ 'X-Agent-Office-Token': token,
27
+ ...(data ? { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) } : {}),
28
+ },
29
+ },
30
+ (res) => {
31
+ let raw = '';
32
+ res.on('data', (d) => (raw += d));
33
+ res.on('end', () => {
34
+ let json = {};
35
+ try {
36
+ json = JSON.parse(raw);
37
+ } catch {
38
+ /* not json */
39
+ }
40
+ if (res.statusCode >= 400) reject(new Error(json.error || `HTTP ${res.statusCode}`));
41
+ else resolve(json);
42
+ });
43
+ }
44
+ );
45
+ req.on('timeout', () => req.destroy(new Error('timeout')));
46
+ req.on('error', reject);
47
+ if (data) req.write(data);
48
+ req.end();
49
+ });
50
+ }
51
+
52
+ async function main() {
53
+ if (!port || !token || !me) {
54
+ console.error('office: this command only works inside an Agent Hall terminal.');
55
+ process.exit(1);
56
+ }
57
+ if (cmd === 'who') {
58
+ const { agents } = await call('GET', `/api/office/who?me=${encodeURIComponent(me)}`);
59
+ for (const a of agents) {
60
+ const reach = a.reachable ? '' : ' (cannot receive messages)';
61
+ console.log(`${a.you ? '*' : '-'} ${a.name} — ${a.role}, ${a.tool}, ${a.building} building, room "${a.room}", ${a.status}${reach}`);
62
+ }
63
+ return;
64
+ }
65
+ if (cmd === 'send') {
66
+ const [to, ...words] = rest;
67
+ const text = words.join(' ').trim();
68
+ if (!to || !text) {
69
+ console.error('usage: office send "<name>" <message>');
70
+ process.exit(1);
71
+ }
72
+ const r = await call('POST', '/api/office/send', { from: me, to, text });
73
+ console.log(`Message delivered to ${r.to}.`);
74
+ return;
75
+ }
76
+ console.log('usage:\n office who list your colleagues in both buildings\n office send "<name>" <message> send a message to a colleague');
77
+ }
78
+
79
+ main().catch((e) => {
80
+ console.error(`office: ${e.message}`);
81
+ process.exit(1);
82
+ });
package/package.json CHANGED
@@ -1,6 +1,54 @@
1
1
  {
2
2
  "name": "agenthall",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Agent Hall: a local virtual office for your Claude Code agents. Rooms per project, live terminals, an approval queue, a task board, a git worktree per agent, and a little city to watch them work in.",
5
+ "keywords": [
6
+ "claude",
7
+ "claude-code",
8
+ "agents",
9
+ "ai",
10
+ "office",
11
+ "dashboard",
12
+ "terminal",
13
+ "worktree",
14
+ "git",
15
+ "approval",
16
+ "task-board",
17
+ "claude-code-agents",
18
+ "multi-agent",
19
+ "agent-dashboard",
20
+ "virtual-office",
21
+ "worktrees"
22
+ ],
23
+ "license": "MIT",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/volkantagal-g/agenthall.git"
27
+ },
28
+ "homepage": "https://github.com/volkantagal-g/agenthall#readme",
29
+ "bin": {
30
+ "agenthall": "bin/agent-office.js"
31
+ },
32
+ "main": "server.js",
33
+ "files": [
34
+ "bin/",
35
+ "public/",
36
+ "server.js",
37
+ "hook-relay.js",
38
+ "office-cli.js",
39
+ "README.md",
40
+ "LICENSE"
41
+ ],
42
+ "scripts": {
43
+ "start": "node bin/agent-office.js"
44
+ },
45
+ "engines": {
46
+ "node": ">=18"
47
+ },
48
+ "dependencies": {
49
+ "@lydell/node-pty": "^1.2.0-beta.18",
50
+ "@xterm/addon-fit": "^0.10.0",
51
+ "@xterm/xterm": "^5.5.0",
52
+ "ws": "^8.18.0"
53
+ }
54
+ }