genaicode 2.43.0 → 2.44.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.
Files changed (49) hide show
  1. package/dist/agents/cli-agent.js +2 -1
  2. package/dist/agents/cli-agent.js.map +1 -1
  3. package/dist/agents/drivers/claude.d.ts +15 -2
  4. package/dist/agents/drivers/claude.js +89 -8
  5. package/dist/agents/drivers/claude.js.map +1 -1
  6. package/dist/agents/live-agent.js +2 -1
  7. package/dist/agents/live-agent.js.map +1 -1
  8. package/dist/agents/runtime.d.ts +5 -1
  9. package/dist/agents/runtime.js +7 -1
  10. package/dist/agents/runtime.js.map +1 -1
  11. package/dist/agents/sessions/claude.js +27 -1
  12. package/dist/agents/sessions/claude.js.map +1 -1
  13. package/dist/agents/sessions/codex-api.js +2 -0
  14. package/dist/agents/sessions/codex-api.js.map +1 -1
  15. package/dist/agents/sessions/codex.js +7 -0
  16. package/dist/agents/sessions/codex.js.map +1 -1
  17. package/dist/agents/sessions/group.d.ts +9 -2
  18. package/dist/agents/sessions/group.js +37 -2
  19. package/dist/agents/sessions/group.js.map +1 -1
  20. package/dist/agents/sessions/hooks.d.ts +10 -0
  21. package/dist/agents/sessions/hooks.js +24 -3
  22. package/dist/agents/sessions/hooks.js.map +1 -1
  23. package/dist/agents/sessions/index.d.ts +4 -1
  24. package/dist/agents/sessions/index.js +28 -4
  25. package/dist/agents/sessions/index.js.map +1 -1
  26. package/dist/agents/sessions/limits.d.ts +39 -0
  27. package/dist/agents/sessions/limits.js +279 -0
  28. package/dist/agents/sessions/limits.js.map +1 -0
  29. package/dist/agents/sessions/tools.js +3 -2
  30. package/dist/agents/sessions/tools.js.map +1 -1
  31. package/dist/agents/sessions/topics.d.ts +86 -0
  32. package/dist/agents/sessions/topics.js +242 -0
  33. package/dist/agents/sessions/topics.js.map +1 -0
  34. package/dist/agents/sessions/types.d.ts +14 -0
  35. package/dist/agents.d.ts +2 -2
  36. package/dist/agents.js +1 -1
  37. package/dist/agents.js.map +1 -1
  38. package/dist/cli/args.d.ts +39 -0
  39. package/dist/cli/args.js +86 -0
  40. package/dist/cli/args.js.map +1 -1
  41. package/dist/cli/main.d.ts +1 -1
  42. package/dist/cli/main.js +276 -5
  43. package/dist/cli/main.js.map +1 -1
  44. package/dist/ui/index.js +108 -104
  45. package/dist/ui/web-client.js +21 -16
  46. package/docs/CHANGELOG.md +13 -0
  47. package/docs/agents.md +61 -15
  48. package/docs/cli.md +66 -4
  49. package/package.json +1 -1
package/docs/CHANGELOG.md CHANGED
@@ -8,6 +8,19 @@ fails. Merging to master refreshes the `release` PR; merging that publishes to n
8
8
 
9
9
  ## Unreleased
10
10
 
11
+ ## 2.44.0 — 2026-11-21
12
+
13
+ ### Added
14
+
15
+ - `genaicode topics`: your sessions as pieces of work, whichever agents and directories they were in, with what asks for you first. `topics refresh` has an agent sort the sessions no topic has yet (one line per session; kept in `~/.genaicode/topics.json`), and `topics rename|merge|move` correct it. From `genaicode/agents`: `topicsPrompt()`, `sortedTopics()`, `summarizeTopics()`, `readTopics()`, `writeTopics()` (#241)
16
+ - `genaicode sessions` leaves out the sessions nobody typed into (Claude Code's scheduled tasks and notifications, `codex exec` runs; `--automated` or `{ automated: true }` lists them, and they carry `automated: true`), and says what a waiting session's last message asks of you: `SessionInfo.ending` (`question`, `command`, `offer`, `unreported`) from `replyEnding()`. `sessions --waiting`, the session tools and the desktop menu show those right after the approvals (#240)
17
+ - `genaicode limits`: how much of each agent's plan is used (share of each window, when it resets), as last seen and without asking any agent. Runs through genaicode keep what the agents report, Codex's limits are read from its sessions, and `genaicode hooks install` makes `genaicode limits record` Claude Code's status line (unless you have your own), which keeps Claude's. `sessions --waiting --json --watch` carries them as `limits`, and the desktop app's menu shows them (#235)
18
+ - `claude()` inherits `permissions.defaultMode` from Claude Code user settings (`~/.claude/settings.json` / `$CLAUDE_CONFIG_DIR`) or `options.settings` instead of overriding it with `--permission-mode acceptEdits`, keeping `acceptEdits` as the fallback when no default mode is configured (#238)
19
+
20
+ ### Fixed
21
+
22
+ - `genaicode ui` (and `chat --web` / `tower`) strips `?token=` from the browser address bar into origin-isolated `sessionStorage`, sends the token in headers for `/api/events` and commands, and keeps reloads working via a reload-only `HttpOnly` shell cookie (#236)
23
+
11
24
  ## 2.43.0 — 2026-11-21
12
25
 
13
26
  ### Added
package/docs/agents.md CHANGED
@@ -327,6 +327,47 @@ the command that continues it. It looks a week back unless `--since` says otherw
327
327
  browser's Sessions view has the same as a "N wait for you" button; in code,
328
328
  `waitingSessions(sessions)` picks and orders them.
329
329
 
330
+ Not every waiting session asks for something: most just ended. `SessionInfo.ending` says what the
331
+ end of the agent's last message asks, read from its shape by `replyEnding(lastReply)`: `question`
332
+ (it ends on a question), `command` (it ends on a shell code block for you to run), `offer` ("I can
333
+ also...", "let me know") or `unreported` (it says it could not report back to the thread that sent
334
+ it). Those come right after the approvals in `--waiting`, marked `●`, and `sessions_list` says
335
+ `[ends with: question]`. It is a guess from the last 200 characters: a request put as a plain
336
+ statement is not seen.
337
+
338
+ Sessions nobody typed into are left out of every listing: scheduled tasks and notifications in
339
+ Claude Code (every prompt has `origin.kind` other than `human`, or the session opens with a
340
+ scheduled task nobody answered) and `codex exec` runs. They carry `automated: true`;
341
+ `sessions --automated`, or `{ automated: true }` in the query, lists them too.
342
+
343
+ **Topics.** Sessions can be kept as pieces of work that cross agents and directories
344
+ ([`genaicode topics`](cli.md#your-work-as-topics-topics)). An agent of your choice does the
345
+ sorting; genaicode writes the prompt, reads the answer and keeps the result:
346
+
347
+ ```ts
348
+ import {
349
+ listSessions,
350
+ readTopics,
351
+ sortedTopics,
352
+ summarizeTopics,
353
+ topicsPrompt,
354
+ unsortedSessions,
355
+ writeTopics,
356
+ } from 'genaicode/agents';
357
+
358
+ const { sessions } = await listSessions(sources, { since: Date.now() - 30 * 86_400_000 });
359
+ const store = await readTopics();
360
+ const todo = unsortedSessions(sessions, store).slice(0, 120);
361
+ const { text } = await agent.run({ prompt: topicsPrompt(todo, store), cwd: emptyDir }).result;
362
+ const sorted = sortedTopics(text ?? '', todo, store); // { store, placed }
363
+ await writeTopics(sorted.store);
364
+ const { topics, unsorted } = summarizeTopics(sessions, sorted.store); // asking first, then the latest
365
+ ```
366
+
367
+ The prompt holds one line per session (agent, last two directory names, title or first and last
368
+ prompt), quoted as data. `renameTopic()`, `mergeTopics()` and `moveSessions()` correct a store; a
369
+ session that has a topic is never moved by a later answer.
370
+
330
371
  For Copilot and Gemini shell approvals, `waitingCommands` contains the tool name and up to
331
372
  200 characters of each matching command. Genaicode keeps a digest in its private hook record
332
373
  and reads the text on demand from the agent's own local session journal. A session with a
@@ -345,6 +386,11 @@ The command in the settings is the `genaicode` that installed it (`node` and the
345
386
  `cli.js`): install it from a `genaicode` that stays where it is (a project's dependency or a
346
387
  global install), and run `hooks install` again after moving it.
347
388
 
389
+ For Claude Code, `hooks install` also sets `statusLine` in the same settings to `genaicode limits
390
+ record`, which keeps the plan limits Claude Code reports for [`genaicode limits`](cli.md#how-much-of-your-plans-is-used-limits)
391
+ and prints them as the line. A status line you set yourself is never replaced; `hooksStatus()`
392
+ says which it is (`statusLine: 'genaicode' | 'other' | 'none'`).
393
+
348
394
  ### Sending a turn to a session
349
395
 
350
396
  `sendSession()` accepts a user's message for the local session's own driver. It checks the
@@ -703,19 +749,19 @@ Artifacts are agent-written content, so they are handled as untrusted:
703
749
 
704
750
  ## Drivers
705
751
 
706
- | Driver | Command | Mode | Notes |
707
- | --------------------- | -------------- | ---------------------------------------- | ----------------------------------------------------------------------------------------- |
708
- | `claude(options?)` | `claude` | `-p --output-format stream-json` | `permissionMode` defaults to `acceptEdits`; `allowedTools` / `disallowedTools`; approvals |
709
- | `codex(options?)` | `codex` | `exec --json` | `sandbox` defaults to `workspace-write`; effort via `model_reasoning_effort` |
710
- | `muse(options?)` | `muse` | `exec --json --trust-workspace` | `maxTurns` maps to `--max-model-steps` |
711
- | `codexLive(options?)` | `codex` | `app-server` (JSON-RPC) | `steer()`, approvals, MCP. See [Live sessions](#live-sessions-steering-and-approvals) |
712
- | `museLive(options?)` | `muse` | `serve` (JSON-RPC) | `steer()`, approvals. See [Live sessions](#live-sessions-steering-and-approvals) |
713
- | `gemini(options?)` | `gemini` | `--output-format stream-json --prompt=…` | `approvalMode` defaults to `auto_edit`; `--skip-trust` unless `trustWorkspace: false` |
714
- | `cursor(options?)` | `cursor-agent` | `-p --output-format stream-json` | `--force --approve-mcps` by default (`--trust` if `force: false`); `partialOutput` |
715
- | `opencode(options?)` | `opencode` | `run --format json` | `model` is `provider/model`; `effort` maps to `--variant`; `autoApprove` adds `--auto` |
716
- | `copilot(options?)` | `copilot` | `--output-format json --prompt=…` | `--allow-all-tools --no-ask-user` by default; `allowTools` / `denyTools` patterns |
717
- | `vibe(options?)` | `vibe` | `--output streaming --prompt=…` | `agent` defaults to `accept-edits`; `--trust`; `model` via `VIBE_ACTIVE_MODEL` |
718
- | `antigravity(opts?)` | `agy` | `acp` (JSON-RPC) | `steer()`, approvals, MCP, resume; `mode` defaults to `accept-edits`; `--sandbox` |
752
+ | Driver | Command | Mode | Notes |
753
+ | --------------------- | -------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
754
+ | `claude(options?)` | `claude` | `-p --output-format stream-json` | inherits user `permissions.defaultMode` (fallback `acceptEdits`); `allowedTools` / `disallowedTools`; approvals |
755
+ | `codex(options?)` | `codex` | `exec --json` | `sandbox` defaults to `workspace-write`; effort via `model_reasoning_effort` |
756
+ | `muse(options?)` | `muse` | `exec --json --trust-workspace` | `maxTurns` maps to `--max-model-steps` |
757
+ | `codexLive(options?)` | `codex` | `app-server` (JSON-RPC) | `steer()`, approvals, MCP. See [Live sessions](#live-sessions-steering-and-approvals) |
758
+ | `museLive(options?)` | `muse` | `serve` (JSON-RPC) | `steer()`, approvals. See [Live sessions](#live-sessions-steering-and-approvals) |
759
+ | `gemini(options?)` | `gemini` | `--output-format stream-json --prompt=…` | `approvalMode` defaults to `auto_edit`; `--skip-trust` unless `trustWorkspace: false` |
760
+ | `cursor(options?)` | `cursor-agent` | `-p --output-format stream-json` | `--force --approve-mcps` by default (`--trust` if `force: false`); `partialOutput` |
761
+ | `opencode(options?)` | `opencode` | `run --format json` | `model` is `provider/model`; `effort` maps to `--variant`; `autoApprove` adds `--auto` |
762
+ | `copilot(options?)` | `copilot` | `--output-format json --prompt=…` | `--allow-all-tools --no-ask-user` by default; `allowTools` / `denyTools` patterns |
763
+ | `vibe(options?)` | `vibe` | `--output streaming --prompt=…` | `agent` defaults to `accept-edits`; `--trust`; `model` via `VIBE_ACTIVE_MODEL` |
764
+ | `antigravity(opts?)` | `agy` | `acp` (JSON-RPC) | `steer()`, approvals, MCP, resume; `mode` defaults to `accept-edits`; `--sandbox` |
719
765
 
720
766
  Every driver accepts `command` to point at a specific executable. `task.extraArgs` is
721
767
  inserted before the prompt for flags that have no portable field.
@@ -784,8 +830,8 @@ Per agent:
784
830
  - `claude()`: with `onApproval`, the driver serves Claude Code's `--permission-prompt-tool`
785
831
  from a private MCP endpoint on 127.0.0.1 (random port, random bearer token), next to the
786
832
  task's own `mcpServers`, and raises `MCP_TOOL_TIMEOUT` to a day unless `env` sets it. The
787
- permission mode still applies first (`acceptEdits` by default): only what it does not allow
788
- is asked. Approving allows exactly the input Claude asked about (`updatedInput` unchanged).
833
+ permission mode still applies first (the user's `permissions.defaultMode` when set, else
834
+ `acceptEdits`): only what it does not allow is asked. Approving allows exactly the input Claude asked about (`updatedInput` unchanged).
789
835
  - `codexLive()`: runs with approval policy `on-request` when `onApproval` is set (`never`
790
836
  otherwise). Commands and file changes are answered `accept` / `decline`. A permission
791
837
  profile request (`item/permissions/requestApproval`) is asked with `scope: 'turn'`; approving
package/docs/cli.md CHANGED
@@ -101,6 +101,12 @@ must finish first. The check uses the latest store and hook information availabl
101
101
  `npx genaicode notify on` then shows a desktop notification when a session asks for approval
102
102
  (`--done`: also when one finishes its turn; see [notify](agents.md#being-told-notify)).
103
103
 
104
+ `sessions --waiting` puts the sessions whose last message asks you something right after the
105
+ approvals (`●`: a question, a command to run, an offer to go on, or a report that could not be
106
+ sent back), before the ones that just ended. Scheduled tasks and headless runs nobody typed into
107
+ are left out of `sessions`; `--automated` lists them too (see
108
+ [agents](agents.md#which-sessions-need-you-hooks)).
109
+
104
110
  With Copilot or Gemini hooks installed, `sessions --waiting`, the tower's `/waiting` command
105
111
  and the browser's Sessions view show up to 200 characters of a shell command awaiting approval.
106
112
  Refresh the queue to see which commands still need a decision. Answer in the agent that asked.
@@ -117,7 +123,60 @@ asking again and again: `npx genaicode sessions --waiting --json --watch` prints
117
123
  `{"sessions":[...]}` at once and another whenever the waiting sessions or their open questions
118
124
  change. With `--exit-with-stdin` it ends when its stdin closes, so it cannot outlive its parent.
119
125
  It looks every 3 seconds: a question or anything else a hook reports shows at once, a session
120
- that only finished its turn within 15 seconds.
126
+ that only finished its turn within 15 seconds. Once limits are known, the line also carries them
127
+ as `"limits":[...]`.
128
+
129
+ ### How much of your plans is used: `limits`
130
+
131
+ `npx genaicode limits` shows how much of each agent's plan is used, in the plan's own measure: the
132
+ share of each window and when it resets, never dollars.
133
+
134
+ ```
135
+ claude 5h 62% used resets in 2 h 10 min (read 4 min ago)
136
+ 7d 41% used resets in 3 d (read 4 min ago)
137
+ codex 5h 12% used resets in 48 min (read 1 h 5 min ago)
138
+ ```
139
+
140
+ No agent is asked for it, so looking costs nothing. The readings come from three places:
141
+
142
+ - every run through genaicode (`run`, `chat`, `ui`, the library) keeps what the agent reports in
143
+ `~/.genaicode/limits` (`GENAICODE_LIMITS=off` keeps nothing);
144
+ - Codex notes its limits in its own session files, and the newest ones are read;
145
+ - Claude Code gives them to its status line only. `npx genaicode hooks install` makes
146
+ `genaicode limits record` that status line (it prints `5h 62% · 7d 41%`), and `hooks uninstall`
147
+ takes it out again. A status line of your own is left as it is: have it pass its input on to
148
+ `genaicode limits record` as well.
149
+
150
+ A window that has reset since it was read is left out: what is used of it now is not known until
151
+ the agent says so again. `--json` prints `{"limits":[{"agent","window","status","usedPercent","resetsAt","at"}]}`.
152
+
153
+ ### Your work as topics: `topics`
154
+
155
+ A project directory is not a piece of work: one holds many, and one piece of work is often done
156
+ with several agents and from several directories. `npx genaicode topics` shows the sessions of all
157
+ agents as topics, what asks for you first:
158
+
159
+ ```
160
+ ● Pack mode t1 claude 9, codex 3 12m ago 1 ask you src/genaicode
161
+ ▶ Desktop app t2 claude 6 1h ago 1 working src/genaicode, src/site
162
+ YouTube pins t3 codex 2 2d ago src/site
163
+ 14 sessions not sorted yet: "genaicode topics refresh" sorts them.
164
+ ```
165
+
166
+ What belongs together is a matter of what was said, so an agent decides it, and only when you ask:
167
+ `npx genaicode topics refresh` gives an agent one line per session no topic has yet (agent,
168
+ directory, title or first and last prompt; nothing else of the conversation) and keeps its answer
169
+ in `~/.genaicode/topics.json`. The next refresh sorts only the new sessions into the topics there
170
+ are. `-a` picks the agent and `-m` the model (Claude Code sorts with `haiku` unless told
171
+ otherwise); `--since` looks further back than the 30 days it and `topics` cover by default.
172
+
173
+ The result is yours to correct, and corrections stay: `topics rename <topic> <name>`,
174
+ `topics merge <topic> <into>`, `topics move <session id...> --to <topic or new name>` (`--out`
175
+ takes sessions out, to be sorted again). A topic is named by its id, its name, or a part of the
176
+ name only one has. `topics show <topic>` lists its sessions with their ids, and `--json` prints
177
+ `{"topics":[{"id","name","agents","projects","updatedAt","asking","active","sessions":[...]}],"unsorted":n}`.
178
+ A sorting run's own session is left out of every listing, like other
179
+ [sessions nobody typed into](agents.md#sessions-across-agents).
121
180
 
122
181
  `npx genaicode sessions archive --stale` puts away every session left waiting or half way for 2
123
182
  days or more (`sessions archive <id>` for one, `unarchive` to bring it back, `--archived` to list
@@ -261,9 +320,12 @@ An app that starts `genaicode ui` itself can add `--exit-with-stdin` and stop it
261
320
  its stdin, which also reaches the server when a launcher such as npx sits in between.
262
321
 
263
322
  `genaicode ui` listens on the loopback address and prints a link with a random access
264
- token. The page, the event stream and every command need that token; only the bundled
265
- script and the four mascot files (`/app.js`, `/assets/…`) are served without it, since they
266
- hold nothing about your session. Both front ends are bundled into the package and load
323
+ token. Opening it in a browser moves the token into origin-isolated `sessionStorage`, strips
324
+ `?token=` from the address bar, and sets a reload-only `HttpOnly` cookie so refreshing the
325
+ tab still serves the empty shell while every API request and the event stream keep requiring
326
+ the token in the `x-genaicode-token` header; only the bundled script and the four mascot
327
+ files (`/app.js`, `/assets/…`) are served without it, since they hold nothing about your
328
+ session. Both front ends are bundled into the package and load
267
329
  only for these commands; importing `genaicode` or `genaicode/agents` pulls in no UI code.
268
330
  In code, the same conversation is `createAgentSession` from `genaicode/agents` (see
269
331
  [agents.md](agents.md#chat-sessions)); with a live driver (`codexLive`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genaicode",
3
- "version": "2.43.0",
3
+ "version": "2.44.0",
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": {