genaicode 2.36.0 → 2.37.1

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.
Files changed (59) hide show
  1. package/dist/agents/mcp-server.d.ts +2 -0
  2. package/dist/agents/mcp-server.js +6 -2
  3. package/dist/agents/mcp-server.js.map +1 -1
  4. package/dist/agents/mcp-tools.d.ts +1 -0
  5. package/dist/agents/mcp-tools.js +4 -1
  6. package/dist/agents/mcp-tools.js.map +1 -1
  7. package/dist/agents/sessions/answer.d.ts +53 -0
  8. package/dist/agents/sessions/answer.js +225 -0
  9. package/dist/agents/sessions/answer.js.map +1 -0
  10. package/dist/agents/sessions/archive.d.ts +26 -0
  11. package/dist/agents/sessions/archive.js +71 -0
  12. package/dist/agents/sessions/archive.js.map +1 -0
  13. package/dist/agents/sessions/files.js +2 -1
  14. package/dist/agents/sessions/files.js.map +1 -1
  15. package/dist/agents/sessions/group.d.ts +12 -0
  16. package/dist/agents/sessions/group.js +22 -0
  17. package/dist/agents/sessions/group.js.map +1 -1
  18. package/dist/agents/sessions/hook-input.d.ts +17 -0
  19. package/dist/agents/sessions/hook-input.js +110 -0
  20. package/dist/agents/sessions/hook-input.js.map +1 -0
  21. package/dist/agents/sessions/hooks.d.ts +19 -4
  22. package/dist/agents/sessions/hooks.js +113 -29
  23. package/dist/agents/sessions/hooks.js.map +1 -1
  24. package/dist/agents/sessions/index.d.ts +11 -4
  25. package/dist/agents/sessions/index.js +12 -5
  26. package/dist/agents/sessions/index.js.map +1 -1
  27. package/dist/agents/sessions/live.d.ts +6 -0
  28. package/dist/agents/sessions/live.js +14 -2
  29. package/dist/agents/sessions/live.js.map +1 -1
  30. package/dist/agents/sessions/notify.d.ts +34 -0
  31. package/dist/agents/sessions/notify.js +87 -0
  32. package/dist/agents/sessions/notify.js.map +1 -0
  33. package/dist/agents/sessions/tools.d.ts +7 -0
  34. package/dist/agents/sessions/tools.js +11 -2
  35. package/dist/agents/sessions/tools.js.map +1 -1
  36. package/dist/agents/sessions/types.d.ts +7 -0
  37. package/dist/agents.d.ts +2 -2
  38. package/dist/agents.js +1 -1
  39. package/dist/agents.js.map +1 -1
  40. package/dist/cli/args.d.ts +28 -0
  41. package/dist/cli/args.js +85 -6
  42. package/dist/cli/args.js.map +1 -1
  43. package/dist/cli/hook.d.ts +13 -1
  44. package/dist/cli/hook.js +54 -8
  45. package/dist/cli/hook.js.map +1 -1
  46. package/dist/cli/main.d.ts +4 -1
  47. package/dist/cli/main.js +215 -20
  48. package/dist/cli/main.js.map +1 -1
  49. package/dist/cli.js +15 -2
  50. package/dist/cli.js.map +1 -1
  51. package/dist/ui/index.js +96 -85
  52. package/dist/ui/sessions.d.ts +10 -2
  53. package/dist/ui/sessions.js +16 -1
  54. package/dist/ui/sessions.js.map +1 -1
  55. package/dist/ui/web-client.js +15 -15
  56. package/docs/CHANGELOG.md +20 -0
  57. package/docs/agents.md +79 -7
  58. package/docs/cli.md +15 -1
  59. package/package.json +1 -1
package/docs/CHANGELOG.md CHANGED
@@ -8,6 +8,26 @@ fails. Merging to master refreshes the `release` PR; merging that publishes to n
8
8
 
9
9
  ## Unreleased
10
10
 
11
+ ## 2.37.1 — 2026-11-20
12
+
13
+ ### Fixed
14
+
15
+ - Control tower fixes from a run on macOS: `--help` after any command shows the help; `hooks uninstall` removes a hooks file (and Copilot's hooks folder) left with nothing but genaicode's; `hooks install -a <agent>` says when that agent's CLI is not found; sessions with a zero time (Antigravity) no longer show as thousands of days old; `sessions --waiting --json` carries the open questions (`asks`); `hooks status` counts open and ended sessions apart (#211)
16
+
17
+ ## 2.37.0 — 2026-11-20
18
+
19
+ ### Added
20
+
21
+ - What waits for you, across agents: `genaicode sessions --waiting` (`-w`) lists only the sessions whose next move is yours, approvals first, each with what it asks or said and the command that continues it (last 7 days unless `--since`); the browser's Sessions view gets a "N wait for you" button with the same order; `waitingSessions()` in `genaicode/agents` (#206)
22
+ - `genaicode notify on`: with the hooks installed, a desktop notification (macOS Notification Center, `notify-send` on Linux) when a session of Claude Code or Codex asks for approval, once per question; `--done` also when a session finishes its turn; `notify test`, `notify off`. It names the agent, the project and the tool only. In code: `noticeFor()`, `sendNotice()`, `readNotify()`/`writeNotify()` and `recordHook({ onRecord })` (#207)
23
+ - Answer approvals from the tower: `genaicode hooks install --answer` holds each approval question of Claude Code open (up to 9 minutes) while its own dialog shows it, so `genaicode sessions approve <q>` / `sessions deny <q> -m <why>` or the browser's Sessions view (Approve / Deny under the session) can answer too; `sessions --waiting` lists the questions with what the tool would do. In code: `pendingAsks()`, `answerAsk()`, `waitForAnswer()` (#208)
24
+ - `genaicode hooks install` also for Gemini CLI (`~/.gemini/settings.json`), GitHub Copilot CLI (`~/.copilot/hooks/genaicode.json`) and Cursor's CLI (`~/.cursor/hooks.json`): their sessions show as working, waiting or (Copilot, Gemini) asking for approval in `sessions`, `--waiting`, the browser and `notify`. `hookInput()` puts their hooks' input in Claude Code's words (#209)
25
+ - `genaicode sessions archive --stale` (`--older 5d`) puts away the sessions left waiting or half way for days, `sessions archive <id...>` / `unarchive` one by one, `sessions --archived` lists them; the browser's Sessions view has Archive / Unarchive, "Archive N stale" and an Archived filter. Agents' files are untouched (`~/.genaicode/archived.json`) and a session with news comes back by itself. In code: `archived` on `SessionInfo`, `archiveSessions()`, `staleSessions()`, `readArchive()` (#210)
26
+
27
+ ### Fixed
28
+
29
+ - `chat --sessions` and `sessions mcp`: the session index now tells the agent when to use it (MCP `instructions`), so a question like "which sessions are open?" goes to `sessions_list` for every agent instead of the agent's own session listing; `startLocalMcpServer({ instructions })` does the same for your tools (#204)
30
+
11
31
  ## 2.36.0 — 2026-11-19
12
32
 
13
33
  ### Added
package/docs/agents.md CHANGED
@@ -287,36 +287,106 @@ const { sessions } = await listSessions(agentSessionSources(agents), { limit: 50
287
287
  ### Which sessions need you: hooks
288
288
 
289
289
  The stores say what was written, not what the agent is doing right now: a session that asks
290
- "may I run this command?" looks the same as one that is thinking. Claude Code and Codex can say
291
- it themselves through their hooks:
290
+ "may I run this command?" looks the same as one that is thinking. Claude Code, Codex, Gemini
291
+ CLI, GitHub Copilot CLI and Cursor's CLI can say it themselves through their hooks:
292
292
 
293
293
  ```bash
294
- npx genaicode hooks install # for the agents installed here; -a claude or -a codex for one
294
+ npx genaicode hooks install # for the agents installed here; -a claude (codex, gemini...) for one
295
295
  npx genaicode hooks # what is installed
296
296
  npx genaicode hooks uninstall
297
297
  ```
298
298
 
299
299
  `install` adds one command hook to the agent's own user settings (`~/.claude/settings.json`,
300
- `~/.codex/hooks.json`), beside whatever is declared there; Codex runs it once you trust it under
301
- `/hooks`. The hook runs `genaicode hook <agent>` in the background when a session starts, takes a
300
+ `~/.codex/hooks.json`, `~/.gemini/settings.json`, `~/.cursor/hooks.json`; for Copilot a file of
301
+ its own, `~/.copilot/hooks/genaicode.json`), beside whatever is declared there; Codex runs it
302
+ once you trust it under `/hooks`, Copilot from its next start. The hook runs `genaicode hook <agent>` in the background when a session starts, takes a
302
303
  prompt, asks for approval, gets its answer, finishes a turn and ends. It keeps one small file
303
304
  per session in `~/.genaicode/live` with the state, the time, the directory and the name of the
304
305
  tool asked for: nothing of what was said, and nothing leaves the machine.
305
306
 
307
+ What each agent tells differs. Claude Code, Codex and Copilot tell when a session asks for
308
+ approval and which tool; Gemini CLI tells that it asks, not for which tool; Cursor's hooks tell
309
+ of no question at all, so a Cursor session shows as working or waiting for your reply, never as
310
+ asking. Gemini and Cursor wait for their hooks (genaicode's takes a few milliseconds), and Gemini
311
+ shows that a hook runs unless `hooksConfig.notifications` is off.
312
+
306
313
  `listSessions()` puts that over what the stores suggest: `state` is exact, and a `waiting`
307
314
  session has `waitingFor`: `'approval'` (with `waitingTool`, such as `Bash`) or `'reply'`.
308
315
  `genaicode sessions` marks the first with `◆`, and the browser's Sessions view has a filter for
309
316
  them. A record the session's file has since moved past is ignored, so sessions driven without
310
317
  the hook fall back to the stores. `{ live: false }` in the query leaves the reports out.
311
318
 
319
+ `genaicode sessions --waiting` (`-w`) is the inbox: only the sessions whose next move is yours,
320
+ those asking for approval first, each with the tool it asks for or the end of what it said, and
321
+ the command that continues it. It looks a week back unless `--since` says otherwise. The
322
+ browser's Sessions view has the same as a "N wait for you" button; in code,
323
+ `waitingSessions(sessions)` picks and orders them.
324
+
312
325
  In code: `installHooks('claude')`, `hooksStatus()`, `uninstallHooks()`, and `recordHook(agent,
313
326
  input)` with `readLive()` and `withLive(sessions, records)` to do the same for an agent of your
314
- own whose hooks give the same JSON (`session_id`, `hook_event_name`, `cwd`).
327
+ own whose hooks give the same JSON (`session_id`, `hook_event_name`, `cwd`); `hookInput(agent,
328
+ input)` puts Gemini's, Copilot's and Cursor's in those words.
315
329
 
316
330
  The command in the settings is the `genaicode` that installed it (`node` and the path of its
317
331
  `cli.js`): install it from a `genaicode` that stays where it is (a project's dependency or a
318
332
  global install), and run `hooks install` again after moving it.
319
333
 
334
+ ### Being told: `notify`
335
+
336
+ ```bash
337
+ npx genaicode notify on # a desktop notification when a session asks for approval
338
+ npx genaicode notify on --done # ...and when a session finishes its turn
339
+ npx genaicode notify test # show one now
340
+ npx genaicode notify off
341
+ ```
342
+
343
+ The hooks above do it, so `hooks install` comes first. The notification names the agent, the
344
+ project's directory and the tool asked for, nothing of what was said: Notification Center on macOS
345
+ (`osascript`), the desktop's notifications on Linux (`notify-send`). A question is told once,
346
+ however many hooks remind of it. The setting is kept in `~/.genaicode/notify.json`. In code:
347
+ `noticeFor(before, after, settings)` decides, `sendNotice(notice)` shows it, and `recordHook()`
348
+ takes `onRecord(before, after)` to do the same for an agent of your own.
349
+
350
+ ### Answering from the tower: `hooks install --answer`
351
+
352
+ ```bash
353
+ npx genaicode hooks install --answer # Claude Code: questions can be answered from here too
354
+ npx genaicode sessions --waiting # each question with what the tool would do
355
+ npx genaicode sessions approve 3f9a0c1d2e4b
356
+ npx genaicode sessions deny 3f9a0c1d2e4b -m "use the staging database"
357
+ ```
358
+
359
+ With `--answer`, Claude Code's `PermissionRequest` gets one more hook, one Claude Code waits
360
+ for: it holds the question open for up to 9 minutes in `~/.genaicode/asks/` (readable by you only)
361
+ with the tool and a line of what it would do (the command, the file, the address). Claude Code
362
+ shows its own dialog meanwhile, as always; whichever answer comes first counts. Answered in
363
+ Claude Code, the hook sees the tool run (or Claude Code ends it) and lets go; nothing answered,
364
+ it lets go after 9 minutes and the dialog stays. The browser's Sessions view shows the same
365
+ questions under their session with Approve and Deny. A denial tells the agent why, if you say.
366
+
367
+ Codex is left out: it shows its prompt only after the hook is done, so a hook that waits would
368
+ hold it back. No MCP tool answers questions: an agent cannot approve another agent's tool. In
369
+ code: `pendingAsks()`, `answerAsk(id, { behavior: 'allow' })`, and `waitForAnswer(agent, input)`
370
+ for a hook of your own.
371
+
372
+ ### Putting sessions away: `sessions archive`
373
+
374
+ ```bash
375
+ npx genaicode sessions archive --stale # every one waiting or left half way for 2 days or more
376
+ npx genaicode sessions archive --stale --older 5d -a codex
377
+ npx genaicode sessions archive 9f6a3318 # these ones
378
+ npx genaicode sessions unarchive 9f6a3318
379
+ npx genaicode sessions --archived # list them too
380
+ ```
381
+
382
+ Archiving hides a session from `sessions`, `--waiting` and the browser's Sessions view (which has
383
+ Archive and Unarchive on each row, "Archive N stale", and an Archived filter). The agents' own
384
+ files are not touched: genaicode notes the session and when in `~/.genaicode/archived.json`, and a
385
+ session with any news after that (a prompt, a hook's report) is back by itself. A session an agent
386
+ works in, or one in the cloud, is never stale. In code: `listSessions()` marks archived sessions
387
+ `archived: true` and `waitingSessions()` leaves them out; `archiveSessions(sessions, archived)`,
388
+ `staleSessions(sessions, olderThanMs)` and `readArchive()`.
389
+
320
390
  ### When an agent changes its store: `sessions doctor`
321
391
 
322
392
  No agent promises how it keeps its sessions, so an update of its CLI can change the store, and a
@@ -386,7 +456,9 @@ a tool, known once the [hooks](#which-sessions-need-you-hooks) are installed). T
386
456
  the local stores. They are off unless you ask for them, because the agent that has them reads what
387
457
  your other agents' sessions said, and that text goes to its model like anything else it reads;
388
458
  treat what it finds there as content, not as instructions. `sessions mcp -a codex` serves one
389
- agent's sessions only.
459
+ agent's sessions only. The server also tells the agent when to use the tools (MCP `instructions`,
460
+ `SESSION_TOOLS_INSTRUCTIONS`), so "which sessions are open?" goes to the index and not to the
461
+ agent's own session list; pass `instructions` to `startLocalMcpServer()` for the same in code.
390
462
 
391
463
  ```ts
392
464
  import { agentSessionSources, claude, codex, sessionTools, startLocalMcpServer } from 'genaicode/agents';
package/docs/cli.md CHANGED
@@ -63,6 +63,7 @@ npx genaicode sessions # what every agent has going on, by
63
63
  npx genaicode sessions --since 7d -C ../api # last week, one project
64
64
  npx genaicode sessions -a codex --json # one JSON object per session
65
65
  npx genaicode sessions --cloud # also Cursor Cloud Agents (CURSOR_API_KEY)
66
+ npx genaicode sessions --waiting # only what waits for you, approvals first
66
67
  ```
67
68
 
68
69
  It reads the stores the agents keep on this machine (Claude Code, Codex, Copilot, Cursor, Gemini
@@ -70,10 +71,23 @@ CLI, Antigravity, Muse and Vibe) and changes nothing. SQLite-backed stores (Code
70
71
  Antigravity, Cursor's model lookup and Copilot's `session-store.db` fallback) need Node 22.5 or
71
72
  newer (`node:sqlite`); the other stores work on Node 20+.
72
73
  `●` is a session an agent is working in now, `○` one that waits for you, `◌` one that stopped
73
- half way. After `npx genaicode hooks install`, Claude Code and Codex report what their sessions
74
+ half way. After `npx genaicode hooks install`, Claude Code, Codex, Gemini, Copilot and Cursor report what their sessions
74
75
  do, and `◆` marks one that asks for approval (see [hooks](agents.md#which-sessions-need-you-hooks)). Each line ends with the session id; `genaicode chat -a <agent> -C <dir> -r <id>`
75
76
  continues it (see [sessions](agents.md#sessions-across-agents)).
76
77
 
78
+ `npx genaicode notify on` then shows a desktop notification when a session asks for approval
79
+ (`--done`: also when one finishes its turn; see [notify](agents.md#being-told-notify)).
80
+
81
+ With `hooks install --answer`, Claude Code's approval questions can also be answered from here:
82
+ `sessions --waiting` lists them, `sessions approve <q>` / `sessions deny <q> -m <why>` answer, and
83
+ the browser's Sessions view has Approve and Deny (see
84
+ [answering](agents.md#answering-from-the-tower-hooks-install---answer)).
85
+
86
+ `npx genaicode sessions archive --stale` puts away every session left waiting or half way for 2
87
+ days or more (`sessions archive <id>` for one, `unarchive` to bring it back, `--archived` to list
88
+ them); the agents' files stay as they are (see
89
+ [archive](agents.md#putting-sessions-away-sessions-archive)).
90
+
77
91
  `npx genaicode sessions doctor` checks that those stores still read as expected after an agent
78
92
  updates: counts per store, never content, exit code 1 when one looks broken (see
79
93
  [sessions doctor](agents.md#when-an-agent-changes-its-store-sessions-doctor)).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genaicode",
3
- "version": "2.36.0",
3
+ "version": "2.37.1",
4
4
  "description": "Drive the coding-agent CLIs you already have (Claude Code, Codex, Copilot, Cursor, Gemini, opencode...) behind one API and one CLI, plus a thin provider-neutral LLM layer.",
5
5
  "author": "Grzegorz Tańczyk",
6
6
  "repository": {