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.
- package/dist/agents/cli-agent.js +2 -1
- package/dist/agents/cli-agent.js.map +1 -1
- package/dist/agents/drivers/claude.d.ts +15 -2
- package/dist/agents/drivers/claude.js +89 -8
- package/dist/agents/drivers/claude.js.map +1 -1
- package/dist/agents/live-agent.js +2 -1
- package/dist/agents/live-agent.js.map +1 -1
- package/dist/agents/runtime.d.ts +5 -1
- package/dist/agents/runtime.js +7 -1
- package/dist/agents/runtime.js.map +1 -1
- package/dist/agents/sessions/claude.js +27 -1
- package/dist/agents/sessions/claude.js.map +1 -1
- package/dist/agents/sessions/codex-api.js +2 -0
- package/dist/agents/sessions/codex-api.js.map +1 -1
- package/dist/agents/sessions/codex.js +7 -0
- package/dist/agents/sessions/codex.js.map +1 -1
- package/dist/agents/sessions/group.d.ts +9 -2
- package/dist/agents/sessions/group.js +37 -2
- package/dist/agents/sessions/group.js.map +1 -1
- package/dist/agents/sessions/hooks.d.ts +10 -0
- package/dist/agents/sessions/hooks.js +24 -3
- package/dist/agents/sessions/hooks.js.map +1 -1
- package/dist/agents/sessions/index.d.ts +4 -1
- package/dist/agents/sessions/index.js +28 -4
- package/dist/agents/sessions/index.js.map +1 -1
- package/dist/agents/sessions/limits.d.ts +39 -0
- package/dist/agents/sessions/limits.js +279 -0
- package/dist/agents/sessions/limits.js.map +1 -0
- package/dist/agents/sessions/tools.js +3 -2
- package/dist/agents/sessions/tools.js.map +1 -1
- package/dist/agents/sessions/topics.d.ts +86 -0
- package/dist/agents/sessions/topics.js +242 -0
- package/dist/agents/sessions/topics.js.map +1 -0
- package/dist/agents/sessions/types.d.ts +14 -0
- package/dist/agents.d.ts +2 -2
- package/dist/agents.js +1 -1
- package/dist/agents.js.map +1 -1
- package/dist/cli/args.d.ts +39 -0
- package/dist/cli/args.js +86 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/main.d.ts +1 -1
- package/dist/cli/main.js +276 -5
- package/dist/cli/main.js.map +1 -1
- package/dist/ui/index.js +108 -104
- package/dist/ui/web-client.js +21 -16
- package/docs/CHANGELOG.md +13 -0
- package/docs/agents.md +61 -15
- package/docs/cli.md +66 -4
- package/package.json +1 -1
package/dist/cli/main.d.ts
CHANGED
|
@@ -94,6 +94,6 @@ export declare const EXIT_OK = 0;
|
|
|
94
94
|
export declare const EXIT_FAILED = 1;
|
|
95
95
|
export declare const EXIT_USAGE = 2;
|
|
96
96
|
export declare const EXIT_ABORTED = 130;
|
|
97
|
-
export declare const helpText = "genaicode: run the coding-agent CLIs installed on this machine behind one interface.\n\nUsage:\n genaicode Chat with an agent in this terminal (same as \"chat\")\n genaicode chat [options] Chat with an agent in this terminal\n genaicode tower [chat options] Open the waiting queue and chat about sessions across projects\n genaicode ui [options] Chat with an agent in the browser (local server)\n genaicode agents [--json] List supported agents and whether each is installed\n genaicode sessions [options] List the sessions agents keep on this machine, by project\n genaicode sessions send <id> <text> Send a prompt to a waiting local session in its own agent\n genaicode sessions doctor Check that the agents' session stores still read as expected\n genaicode sessions mcp Serve the session index to an agent as MCP tools (stdio)\n genaicode sessions approve|deny <q> Answer a question a session asks (see \"hooks install --answer\")\n genaicode sessions archive <id...> Put sessions away (--stale: all left for 2 days or more)\n genaicode hooks [install|uninstall] Have agents report what their sessions do (default: status)\n genaicode notify [on|off|test] Desktop notification when a session asks for approval\n genaicode run [options] <prompt...> Run one task (reads the prompt from stdin if omitted)\n genaicode embed [options] [request] Have an agent add genaicode to the project here\n genaicode acp [options] Serve the Agent Client Protocol on stdin/stdout\n genaicode install [options] Install \"genaicode\" as a command that updates itself\n genaicode update [options] Update the installed genaicode command\n\nInstall options (macOS, Linux; same as scripts/install.sh):\n --version <v> Install this version (default: the one running, e.g. via npx)\n --bin-dir <dir> Where the command goes (default: ~/.local/bin)\n --force Replace a \"genaicode\" there that the installer did not write\n\nUpdate options (for the command scripts/install.sh installs; npx and npm -g update through npm):\n --check Only say whether a newer version is out\n --version <v> Install this version instead of the latest\n --auto on|off Check daily and update in the background (default: on)\n\nSessions options:\n -a, --agent <name> Only this agent's sessions\n --cloud Also Cursor Cloud Agents (needs CURSOR_API_KEY)\n -w, --waiting Only sessions waiting for you (approvals first), each with the\n command that continues it; the last 7 days unless --since says\n -C, --cwd <dir> Only sessions in this directory or below it\n --since <age> Only sessions active in the last 90m, 12h, 7d, 2w...\n -n, --limit <n> At most this many sessions, newest first (default 30)\n --json One JSON object per session\n --watch With --waiting --json: stay open and print {\"sessions\":[...]} as one\n line whenever what waits changes (--exit-with-stdin: until stdin closes)\n --archived Also the sessions put away with \"sessions archive\"\n\n Each line ends with the session id: continue it with\n \"genaicode chat -a <agent> -C <dir> -r <id>\".\n\n \"sessions send <id> <prompt>\" streams the reply. It also reads the prompt from stdin.\n --detach returns when the agent starts; -a chooses the agent's store. --sandbox takes\n read-only, workspace-write or unrestricted. Without it the driver uses its own defaults.\n\n \"sessions archive <id...>\" hides sessions you will not come back to; \"sessions archive --stale\"\n (--older 5d, -a) does it for every one waiting for you or left half way for 2 days or more.\n The agents' own files stay as they are, and a session with any news comes back by itself;\n \"sessions unarchive <id...>\" brings one back. Kept in ~/.genaicode/archived.json.\n\n \"sessions doctor\" (-a, --since, --json, --api) checks each store: how many sessions it lists, how\n many have a prompt and a directory, whether the newest conversations open, and whether the\n agent's CLI is newer than the one the reader was checked with. It prints counts, never what\n was said, and exits 1 when a store reads differently than expected. With --api it also asks\n the agents that can be asked (Codex's app server) and compares; that starts the agent's own\n process, which keeps its state and logs in its home.\n\n \"sessions mcp\" (-a) serves sessions_projects, sessions_list, sessions_read and sessions_waiting\n on stdio. Any agent can use them to find open sessions and see which ones need your attention:\n \"claude mcp add sessions -- npx genaicode sessions mcp\". The agent you give it to reads what\n the other agents' sessions said. \"genaicode chat --sessions\" gives the same tools to the chat.\n In that chat, /waiting [project] refreshes the queue and /read <id> previews a conversation.\n\nHooks options:\n -a, --agent <name> Only this agent (claude, codex, gemini, copilot, cursor); default: all installed\n --answer With \"install\" (Claude Code): questions can also be answered here\n\n \"hooks install\" adds a hook to the agent's own user settings (~/.claude/settings.json,\n ~/.codex/hooks.json, ~/.gemini/settings.json, ~/.cursor/hooks.json,\n ~/.copilot/hooks/genaicode.json; Codex asks you to trust it under /hooks). The agent then tells genaicode\n when a session works, asks for approval or has finished its turn, so \"sessions\" and the\n browser's Sessions view show which ones need you. \"hooks uninstall\" takes it out again.\n\n \"hooks install --answer\" also holds each approval question of Claude Code open for up to 9\n minutes: Claude Code shows its dialog as always, and \"sessions --waiting\" or the browser's\n Sessions view can answer it too (\"sessions approve <q>\", \"sessions deny <q> -m <why>\").\n Whichever answer comes first counts.\n\nNotify options:\n --done With \"on\": also when a session finishes its turn\n\n \"notify on\" has the hooks show a desktop notification (macOS Notification Center, notify-send\n on Linux) when a session asks for approval: the agent, the project's directory name and the\n tool, nothing of what was said. It needs \"genaicode hooks install\". \"notify test\" shows one now.\n\nChat and UI options:\n -a, --agent <name> Agent to start with (default: the first installed one; with --pack, the lead)\n --pack [lead:list] Start a pack: omit the value to use all installed agents, or name them\n explicitly, e.g. claude:codex,gemini. Follow its tasks in the chat; in\n the tower, Ctrl+G opens approvals and proposed session messages\n --max-parallel <n> Delegated tasks that can run at once with --pack (default: 4)\n -C, --cwd <dir> Directory the agent works in (default: current directory)\n -m, --model <id> Model id passed to the agent CLI\n --effort <level> Reasoning effort, in the agent's own vocabulary\n -r, --resume <id> Continue this agent session\n --from <id> Take over a session of any agent in this directory (ids: \"genaicode\n sessions\"): its own agent resumes it, another one gets a handoff\n -y, --yes Approve every permission request the agent asks for\n --web (chat) Also open the session in the browser\n --port <n> Port for the browser UI, on 127.0.0.1 (default: a free port)\n --no-open (ui) Print the link instead of opening a browser\n --exit-with-stdin (ui) Stop when stdin closes, for apps that start the server\n --mcp <name=url> Give the agent this MCP server (streamable HTTP); repeatable.\n Only agents with MCP support (claude, codex, copilot, antigravity) take it\n --no-artifacts Do not give the agent the publish_artifact tool (pages, images and\n documents it shows in the chat)\n --sessions Give the agent read access to the session index. Ask what needs your\n attention across agents with sessions_waiting\n --max-tokens <n> Token budget for the whole session; prompts stop starting once it is used\n --max-cost <usd> Cost budget for the whole session, for agents that report cost\n --fallback <agents> Agents to switch to when the current one runs out (quota, sign-in,\n missing CLI, crash), e.g. --fallback codex,gemini. /fallback changes it\n\n Each prompt after the first continues the agent's session (claude, codex, cursor,\n opencode, copilot, antigravity). Prompts sent while the agent works wait in a queue. Type /help in\n the chat for commands. The terminal and the browser can show one session: /web in the\n chat opens it in the browser, and Enter in \"genaicode ui\" brings it into the terminal.\n\nRun options:\n -a, --agent <name> Agent to use (default: the first installed one, see \"agents\")\n -C, --cwd <dir> Directory the agent works in (default: current directory)\n -m, --model <id> Model id passed to the agent CLI\n --effort <level> Reasoning effort, in the agent's own vocabulary\n --max-turns <n> Turn limit, where the agent supports one\n -r, --resume <id> Continue the agent session with this id (printed after each run)\n --from <id> Continue a session of another agent: the agent gets a recap of it and\n the transcript to read (ids: \"genaicode sessions\")\n --timeout <sec> Stop the agent after this many seconds\n --verify <command> Shell command that checks the work; on failure its output goes\n back to the agent for another attempt\n --max-repairs <n> Repair attempts after a failed check (default 2)\n --max-tokens <n> Stop the agent past this many tokens (repairs included)\n --max-cost <usd> Stop the agent past this cost in US dollars, for agents that report cost\n --fallback <agents> Agents to run the task on when the agent runs out (quota, sign-in,\n missing CLI, crash), in order, e.g. --fallback codex,gemini\n --json Print agent events as JSON lines instead of text\n\nEmbed options:\n --print Print the agent's instructions instead of starting one\n --ui Follow the agent in the browser instead of this terminal\n -a, -C, -m, --effort, -y, --port, --no-open: as for chat and ui\n\n The agent reads the project and chooses how to wire genaicode in; [request] steers it,\n e.g. \"only the dev panel\". Without a terminal it runs headless like \"run\". The\n instructions also ship as a Claude Code skill: docs/skills/genaicode-embed/SKILL.md.\n\nACP options:\n -a, -m, --effort, -y: as for chat (the host can change agent, effort and approvals)\n\n For editors and other apps that speak ACP (https://agentclientprotocol.com): the app\n starts \"genaicode acp\", opens sessions in its own directories and sends prompts.\n\nThe agent uses its own login, billing, and permission defaults. GenAIcode adds no agent\nloop or sandbox of its own, and no prompts but embed's instructions.\nLibrary API: https://github.com/gtanczyk/genaicode#readme\n\nLooking for the legacy 1.x coding agent?\n Run it: npx genaicode@1\n Source: https://github.com/gtanczyk/genaicode/tree/1.x\n";
|
|
97
|
+
export declare const helpText = "genaicode: run the coding-agent CLIs installed on this machine behind one interface.\n\nUsage:\n genaicode Chat with an agent in this terminal (same as \"chat\")\n genaicode chat [options] Chat with an agent in this terminal\n genaicode tower [chat options] Open the waiting queue and chat about sessions across projects\n genaicode ui [options] Chat with an agent in the browser (local server)\n genaicode agents [--json] List supported agents and whether each is installed\n genaicode sessions [options] List the sessions agents keep on this machine, by project\n genaicode sessions send <id> <text> Send a prompt to a waiting local session in its own agent\n genaicode sessions doctor Check that the agents' session stores still read as expected\n genaicode sessions mcp Serve the session index to an agent as MCP tools (stdio)\n genaicode sessions approve|deny <q> Answer a question a session asks (see \"hooks install --answer\")\n genaicode sessions archive <id...> Put sessions away (--stale: all left for 2 days or more)\n genaicode hooks [install|uninstall] Have agents report what their sessions do (default: status)\n genaicode limits [--json] How much of each agent's plan is used, as last seen\n genaicode topics [refresh] Your sessions as pieces of work, across agents and directories\n genaicode notify [on|off|test] Desktop notification when a session asks for approval\n genaicode run [options] <prompt...> Run one task (reads the prompt from stdin if omitted)\n genaicode embed [options] [request] Have an agent add genaicode to the project here\n genaicode acp [options] Serve the Agent Client Protocol on stdin/stdout\n genaicode install [options] Install \"genaicode\" as a command that updates itself\n genaicode update [options] Update the installed genaicode command\n\nInstall options (macOS, Linux; same as scripts/install.sh):\n --version <v> Install this version (default: the one running, e.g. via npx)\n --bin-dir <dir> Where the command goes (default: ~/.local/bin)\n --force Replace a \"genaicode\" there that the installer did not write\n\nUpdate options (for the command scripts/install.sh installs; npx and npm -g update through npm):\n --check Only say whether a newer version is out\n --version <v> Install this version instead of the latest\n --auto on|off Check daily and update in the background (default: on)\n\nSessions options:\n -a, --agent <name> Only this agent's sessions\n --cloud Also Cursor Cloud Agents (needs CURSOR_API_KEY)\n -w, --waiting Only sessions waiting for you (approvals first), each with the\n command that continues it; the last 7 days unless --since says\n -C, --cwd <dir> Only sessions in this directory or below it\n --since <age> Only sessions active in the last 90m, 12h, 7d, 2w...\n -n, --limit <n> At most this many sessions, newest first (default 30)\n --json One JSON object per session\n --watch With --waiting --json: stay open and print {\"sessions\":[...]} as one\n line whenever what waits changes (--exit-with-stdin: until stdin closes)\n --archived Also the sessions put away with \"sessions archive\"\n --automated Also the sessions nobody typed into (scheduled tasks, headless runs)\n\n Each line ends with the session id: continue it with\n \"genaicode chat -a <agent> -C <dir> -r <id>\".\n\n \"sessions send <id> <prompt>\" streams the reply. It also reads the prompt from stdin.\n --detach returns when the agent starts; -a chooses the agent's store. --sandbox takes\n read-only, workspace-write or unrestricted. Without it the driver uses its own defaults.\n\n \"sessions archive <id...>\" hides sessions you will not come back to; \"sessions archive --stale\"\n (--older 5d, -a) does it for every one waiting for you or left half way for 2 days or more.\n The agents' own files stay as they are, and a session with any news comes back by itself;\n \"sessions unarchive <id...>\" brings one back. Kept in ~/.genaicode/archived.json.\n\n \"sessions doctor\" (-a, --since, --json, --api) checks each store: how many sessions it lists, how\n many have a prompt and a directory, whether the newest conversations open, and whether the\n agent's CLI is newer than the one the reader was checked with. It prints counts, never what\n was said, and exits 1 when a store reads differently than expected. With --api it also asks\n the agents that can be asked (Codex's app server) and compares; that starts the agent's own\n process, which keeps its state and logs in its home.\n\n \"sessions mcp\" (-a) serves sessions_projects, sessions_list, sessions_read and sessions_waiting\n on stdio. Any agent can use them to find open sessions and see which ones need your attention:\n \"claude mcp add sessions -- npx genaicode sessions mcp\". The agent you give it to reads what\n the other agents' sessions said. \"genaicode chat --sessions\" gives the same tools to the chat.\n In that chat, /waiting [project] refreshes the queue and /read <id> previews a conversation.\n\nTopics:\n genaicode topics [--json] [--since 30d] The topics, what asks for you first\n genaicode topics show <topic> The sessions of one (by id, name or part of it)\n genaicode topics refresh [-a <agent>] [-m <model>]\n Have an agent sort the sessions no topic has yet\n genaicode topics rename <topic> <name>\n genaicode topics merge <topic> <into>\n genaicode topics move <session id...> --to <topic or new name> | --out\n\n A topic is one piece of work, whichever agents and directories its sessions were in. Nothing is\n sorted until you run \"topics refresh\": it gives an agent one line per unsorted session (agent,\n directory, title or prompts) and keeps the answer in ~/.genaicode/topics.json. Only new sessions\n are sorted the next time, and what you renamed, merged or moved stays.\n\nHooks options:\n -a, --agent <name> Only this agent (claude, codex, gemini, copilot, cursor); default: all installed\n --answer With \"install\" (Claude Code): questions can also be answered here\n\n \"hooks install\" adds a hook to the agent's own user settings (~/.claude/settings.json,\n ~/.codex/hooks.json, ~/.gemini/settings.json, ~/.cursor/hooks.json,\n ~/.copilot/hooks/genaicode.json; Codex asks you to trust it under /hooks). The agent then tells genaicode\n when a session works, asks for approval or has finished its turn, so \"sessions\" and the\n browser's Sessions view show which ones need you. \"hooks uninstall\" takes it out again.\n\n \"hooks install --answer\" also holds each approval question of Claude Code open for up to 9\n minutes: Claude Code shows its dialog as always, and \"sessions --waiting\" or the browser's\n Sessions view can answer it too (\"sessions approve <q>\", \"sessions deny <q> -m <why>\").\n Whichever answer comes first counts.\n\nLimits:\n \"limits\" shows how much of each agent's plan is used, in the plan's own measure: the share of\n each window (5h, 7d...) and when it resets, with the age of the reading. Nothing is asked of\n the agents for it: genaicode keeps what they report when they run through it, reads what Codex\n notes in its own sessions, and what Claude Code gives its status line. For that last one, set\n \"genaicode hooks install\" makes \"genaicode limits record\" Claude Code's status line, unless you\n have one of your own: then have yours pass its input on to that command.\n\nNotify options:\n --done With \"on\": also when a session finishes its turn\n\n \"notify on\" has the hooks show a desktop notification (macOS Notification Center, notify-send\n on Linux) when a session asks for approval: the agent, the project's directory name and the\n tool, nothing of what was said. It needs \"genaicode hooks install\". \"notify test\" shows one now.\n\nChat and UI options:\n -a, --agent <name> Agent to start with (default: the first installed one; with --pack, the lead)\n --pack [lead:list] Start a pack: omit the value to use all installed agents, or name them\n explicitly, e.g. claude:codex,gemini. Follow its tasks in the chat; in\n the tower, Ctrl+G opens approvals and proposed session messages\n --max-parallel <n> Delegated tasks that can run at once with --pack (default: 4)\n -C, --cwd <dir> Directory the agent works in (default: current directory)\n -m, --model <id> Model id passed to the agent CLI\n --effort <level> Reasoning effort, in the agent's own vocabulary\n -r, --resume <id> Continue this agent session\n --from <id> Take over a session of any agent in this directory (ids: \"genaicode\n sessions\"): its own agent resumes it, another one gets a handoff\n -y, --yes Approve every permission request the agent asks for\n --web (chat) Also open the session in the browser\n --port <n> Port for the browser UI, on 127.0.0.1 (default: a free port)\n --no-open (ui) Print the link instead of opening a browser\n --exit-with-stdin (ui) Stop when stdin closes, for apps that start the server\n --mcp <name=url> Give the agent this MCP server (streamable HTTP); repeatable.\n Only agents with MCP support (claude, codex, copilot, antigravity) take it\n --no-artifacts Do not give the agent the publish_artifact tool (pages, images and\n documents it shows in the chat)\n --sessions Give the agent read access to the session index. Ask what needs your\n attention across agents with sessions_waiting\n --max-tokens <n> Token budget for the whole session; prompts stop starting once it is used\n --max-cost <usd> Cost budget for the whole session, for agents that report cost\n --fallback <agents> Agents to switch to when the current one runs out (quota, sign-in,\n missing CLI, crash), e.g. --fallback codex,gemini. /fallback changes it\n\n Each prompt after the first continues the agent's session (claude, codex, cursor,\n opencode, copilot, antigravity). Prompts sent while the agent works wait in a queue. Type /help in\n the chat for commands. The terminal and the browser can show one session: /web in the\n chat opens it in the browser, and Enter in \"genaicode ui\" brings it into the terminal.\n\nRun options:\n -a, --agent <name> Agent to use (default: the first installed one, see \"agents\")\n -C, --cwd <dir> Directory the agent works in (default: current directory)\n -m, --model <id> Model id passed to the agent CLI\n --effort <level> Reasoning effort, in the agent's own vocabulary\n --max-turns <n> Turn limit, where the agent supports one\n -r, --resume <id> Continue the agent session with this id (printed after each run)\n --from <id> Continue a session of another agent: the agent gets a recap of it and\n the transcript to read (ids: \"genaicode sessions\")\n --timeout <sec> Stop the agent after this many seconds\n --verify <command> Shell command that checks the work; on failure its output goes\n back to the agent for another attempt\n --max-repairs <n> Repair attempts after a failed check (default 2)\n --max-tokens <n> Stop the agent past this many tokens (repairs included)\n --max-cost <usd> Stop the agent past this cost in US dollars, for agents that report cost\n --fallback <agents> Agents to run the task on when the agent runs out (quota, sign-in,\n missing CLI, crash), in order, e.g. --fallback codex,gemini\n --json Print agent events as JSON lines instead of text\n\nEmbed options:\n --print Print the agent's instructions instead of starting one\n --ui Follow the agent in the browser instead of this terminal\n -a, -C, -m, --effort, -y, --port, --no-open: as for chat and ui\n\n The agent reads the project and chooses how to wire genaicode in; [request] steers it,\n e.g. \"only the dev panel\". Without a terminal it runs headless like \"run\". The\n instructions also ship as a Claude Code skill: docs/skills/genaicode-embed/SKILL.md.\n\nACP options:\n -a, -m, --effort, -y: as for chat (the host can change agent, effort and approvals)\n\n For editors and other apps that speak ACP (https://agentclientprotocol.com): the app\n starts \"genaicode acp\", opens sessions in its own directories and sends prompts.\n\nThe agent uses its own login, billing, and permission defaults. GenAIcode adds no agent\nloop or sandbox of its own, and no prompts but embed's instructions.\nLibrary API: https://github.com/gtanczyk/genaicode#readme\n\nLooking for the legacy 1.x coding agent?\n Run it: npx genaicode@1\n Source: https://github.com/gtanczyk/genaicode/tree/1.x\n";
|
|
98
98
|
/** Run the CLI and return its exit code. */
|
|
99
99
|
export declare function main(cli: CliEnvironment): Promise<number>;
|
package/dist/cli/main.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { promises as fs } from 'node:fs';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
4
5
|
import { dirname, join, resolve } from 'node:path';
|
|
5
6
|
import { detectAgents } from '../agents/discovery.js';
|
|
6
7
|
import { withFallback } from '../agents/failover.js';
|
|
@@ -21,6 +22,8 @@ import { ANSWER_AGENTS } from '../agents/sessions/hooks.js';
|
|
|
21
22
|
import { archiveSessions, readArchive, STALE_MS, staleSessions } from '../agents/sessions/archive.js';
|
|
22
23
|
import { startLocalMcpServer } from '../agents/mcp-server.js';
|
|
23
24
|
import { notifyFile, readNotify, sendNotice, writeNotify, } from '../agents/sessions/notify.js';
|
|
25
|
+
import { describeKnownLimits, knownLimits, recordLimits, shortLimit, statusLineLimits, } from '../agents/sessions/limits.js';
|
|
26
|
+
import { findTopic, mergeTopics, moveSessions, readTopics, renameTopic, sortedTopics, summarizeTopics, topicNamed, TOPICS_BATCH, topicsPrompt, unsortedSessions, withTopicsRun, writeTopics, } from '../agents/sessions/topics.js';
|
|
24
27
|
import { HANDOFF_DIR, handoffPreamble, writeHandoff } from '../agents/handoff.js';
|
|
25
28
|
import { isWithin, oneLine } from '../agents/sessions/files.js';
|
|
26
29
|
import { serveAcp } from '../acp/server.js';
|
|
@@ -47,6 +50,8 @@ Usage:
|
|
|
47
50
|
genaicode sessions approve|deny <q> Answer a question a session asks (see "hooks install --answer")
|
|
48
51
|
genaicode sessions archive <id...> Put sessions away (--stale: all left for 2 days or more)
|
|
49
52
|
genaicode hooks [install|uninstall] Have agents report what their sessions do (default: status)
|
|
53
|
+
genaicode limits [--json] How much of each agent's plan is used, as last seen
|
|
54
|
+
genaicode topics [refresh] Your sessions as pieces of work, across agents and directories
|
|
50
55
|
genaicode notify [on|off|test] Desktop notification when a session asks for approval
|
|
51
56
|
genaicode run [options] <prompt...> Run one task (reads the prompt from stdin if omitted)
|
|
52
57
|
genaicode embed [options] [request] Have an agent add genaicode to the project here
|
|
@@ -76,6 +81,7 @@ Sessions options:
|
|
|
76
81
|
--watch With --waiting --json: stay open and print {"sessions":[...]} as one
|
|
77
82
|
line whenever what waits changes (--exit-with-stdin: until stdin closes)
|
|
78
83
|
--archived Also the sessions put away with "sessions archive"
|
|
84
|
+
--automated Also the sessions nobody typed into (scheduled tasks, headless runs)
|
|
79
85
|
|
|
80
86
|
Each line ends with the session id: continue it with
|
|
81
87
|
"genaicode chat -a <agent> -C <dir> -r <id>".
|
|
@@ -102,6 +108,20 @@ Sessions options:
|
|
|
102
108
|
the other agents' sessions said. "genaicode chat --sessions" gives the same tools to the chat.
|
|
103
109
|
In that chat, /waiting [project] refreshes the queue and /read <id> previews a conversation.
|
|
104
110
|
|
|
111
|
+
Topics:
|
|
112
|
+
genaicode topics [--json] [--since 30d] The topics, what asks for you first
|
|
113
|
+
genaicode topics show <topic> The sessions of one (by id, name or part of it)
|
|
114
|
+
genaicode topics refresh [-a <agent>] [-m <model>]
|
|
115
|
+
Have an agent sort the sessions no topic has yet
|
|
116
|
+
genaicode topics rename <topic> <name>
|
|
117
|
+
genaicode topics merge <topic> <into>
|
|
118
|
+
genaicode topics move <session id...> --to <topic or new name> | --out
|
|
119
|
+
|
|
120
|
+
A topic is one piece of work, whichever agents and directories its sessions were in. Nothing is
|
|
121
|
+
sorted until you run "topics refresh": it gives an agent one line per unsorted session (agent,
|
|
122
|
+
directory, title or prompts) and keeps the answer in ~/.genaicode/topics.json. Only new sessions
|
|
123
|
+
are sorted the next time, and what you renamed, merged or moved stays.
|
|
124
|
+
|
|
105
125
|
Hooks options:
|
|
106
126
|
-a, --agent <name> Only this agent (claude, codex, gemini, copilot, cursor); default: all installed
|
|
107
127
|
--answer With "install" (Claude Code): questions can also be answered here
|
|
@@ -117,6 +137,14 @@ Hooks options:
|
|
|
117
137
|
Sessions view can answer it too ("sessions approve <q>", "sessions deny <q> -m <why>").
|
|
118
138
|
Whichever answer comes first counts.
|
|
119
139
|
|
|
140
|
+
Limits:
|
|
141
|
+
"limits" shows how much of each agent's plan is used, in the plan's own measure: the share of
|
|
142
|
+
each window (5h, 7d...) and when it resets, with the age of the reading. Nothing is asked of
|
|
143
|
+
the agents for it: genaicode keeps what they report when they run through it, reads what Codex
|
|
144
|
+
notes in its own sessions, and what Claude Code gives its status line. For that last one, set
|
|
145
|
+
"genaicode hooks install" makes "genaicode limits record" Claude Code's status line, unless you
|
|
146
|
+
have one of your own: then have yours pass its input on to that command.
|
|
147
|
+
|
|
120
148
|
Notify options:
|
|
121
149
|
--done With "on": also when a session finishes its turn
|
|
122
150
|
|
|
@@ -251,6 +279,10 @@ function dispatch(cli, command, agents, updater) {
|
|
|
251
279
|
return manageHooks(cli, command, updater);
|
|
252
280
|
case 'notify':
|
|
253
281
|
return manageNotify(cli, command);
|
|
282
|
+
case 'limits':
|
|
283
|
+
return showLimits(cli, command);
|
|
284
|
+
case 'topics':
|
|
285
|
+
return manageTopics(cli, agents, command);
|
|
254
286
|
case 'answer':
|
|
255
287
|
return answerQuestion(cli, command);
|
|
256
288
|
case 'archive':
|
|
@@ -577,6 +609,14 @@ function loadBundledUi() {
|
|
|
577
609
|
}
|
|
578
610
|
const STATE_MARK = { active: '●', waiting: '○', unfinished: '◌', approval: '◆' };
|
|
579
611
|
const WAITING_SINCE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
612
|
+
/** How a waiting session's last words are introduced, by what they ask (`SessionInfo.ending`). */
|
|
613
|
+
const ENDING_SAYS = {
|
|
614
|
+
question: 'asks',
|
|
615
|
+
command: 'wants you to run',
|
|
616
|
+
offer: 'offers',
|
|
617
|
+
unreported: 'could not report back',
|
|
618
|
+
none: 'said',
|
|
619
|
+
};
|
|
580
620
|
/** `sessions --waiting`: one line per session that waits for you, approvals first, with the command that continues it. */
|
|
581
621
|
function showWaiting(cli, sessions, now, sinceMs, questions = []) {
|
|
582
622
|
const period = sinceMs === undefined ? '' : ` in the last ${ago(sinceMs)}`;
|
|
@@ -585,7 +625,8 @@ function showWaiting(cli, sessions, now, sinceMs, questions = []) {
|
|
|
585
625
|
return EXIT_OK;
|
|
586
626
|
}
|
|
587
627
|
const asks = sessions.filter((session) => session.waitingFor === 'approval').length;
|
|
588
|
-
|
|
628
|
+
const wants = sessions.filter((session) => session.waitingFor !== 'approval' && session.ending).length;
|
|
629
|
+
cli.stdout.write(`${sessions.length} session${sessions.length === 1 ? '' : 's'} wait${sessions.length === 1 ? 's' : ''} for you${period}${asks ? `, ${asks} for approval` : ''}${wants ? `, ${wants} ask${wants === 1 ? 's' : ''} you something` : ''}:\n`);
|
|
589
630
|
for (const session of sessions) {
|
|
590
631
|
const place = session.cwd ?? session.repository ?? '';
|
|
591
632
|
const project = place.split(/[\\/]/).filter(Boolean).pop() ?? place;
|
|
@@ -594,7 +635,7 @@ function showWaiting(cli, sessions, now, sinceMs, questions = []) {
|
|
|
594
635
|
const what = session.waitingFor === 'approval'
|
|
595
636
|
? `asks to use ${session.waitingTool ?? 'a tool'}`
|
|
596
637
|
: session.lastReply
|
|
597
|
-
?
|
|
638
|
+
? `${ENDING_SAYS[session.ending ?? 'none']}: ${oneLine(session.lastReply, 80)}`
|
|
598
639
|
: 'your turn';
|
|
599
640
|
const resume = resumeCommand(session);
|
|
600
641
|
const commands = (session.waitingCommands ?? []).map(({ tool, command }) => ` ? ${tool}: ${command}\n`).join('');
|
|
@@ -603,7 +644,7 @@ function showWaiting(cli, sessions, now, sinceMs, questions = []) {
|
|
|
603
644
|
.map((ask) => ` ? ${ask.tool ?? 'a tool'}${ask.preview ? `: ${oneLine(ask.preview, 100)}` : ''}\n` +
|
|
604
645
|
` genaicode sessions approve ${ask.id} (or: sessions deny ${ask.id} -m <why>)\n`)
|
|
605
646
|
.join('');
|
|
606
|
-
cli.stdout.write(`\n${session.waitingFor === 'approval' ? '◆' : '○'} ${project || '(no directory)'} ${session.agent} ${ago(now - session.updatedAt)} ago\n ${text}\n ${what}\n${commands}${open}${resume ? ` ${resume}\n` : ''}`);
|
|
647
|
+
cli.stdout.write(`\n${session.waitingFor === 'approval' ? '◆' : session.ending ? '●' : '○'} ${project || '(no directory)'} ${session.agent} ${ago(now - session.updatedAt)} ago\n ${text}\n ${what}\n${commands}${open}${resume ? ` ${resume}\n` : ''}`);
|
|
607
648
|
}
|
|
608
649
|
return EXIT_OK;
|
|
609
650
|
}
|
|
@@ -618,6 +659,222 @@ async function answerQuestion(cli, command) {
|
|
|
618
659
|
cli.stdout.write(`${command.behavior === 'allow' ? 'Approved' : 'Denied'}.\n`);
|
|
619
660
|
return EXIT_OK;
|
|
620
661
|
}
|
|
662
|
+
/**
|
|
663
|
+
* `limits`: how much of each agent's plan is used, as last seen, in the plan's own measure (share
|
|
664
|
+
* of a window), never dollars. `limits record` is for Claude Code's status line: it keeps the
|
|
665
|
+
* limits in the input and prints them as the line.
|
|
666
|
+
*/
|
|
667
|
+
async function showLimits(cli, command) {
|
|
668
|
+
if (command.action === 'record') {
|
|
669
|
+
let input;
|
|
670
|
+
try {
|
|
671
|
+
input = JSON.parse((await cli.readStdin()) ?? '');
|
|
672
|
+
}
|
|
673
|
+
catch {
|
|
674
|
+
// Not a status line input: nothing to keep, and nothing to say in a status line.
|
|
675
|
+
return EXIT_OK;
|
|
676
|
+
}
|
|
677
|
+
const limits = statusLineLimits(input);
|
|
678
|
+
recordLimits('claude', limits, cli.env);
|
|
679
|
+
if (limits.length)
|
|
680
|
+
cli.stdout.write(`${limits.map(shortLimit).join(' · ')}\n`);
|
|
681
|
+
return EXIT_OK;
|
|
682
|
+
}
|
|
683
|
+
const limits = await knownLimits(cli.env);
|
|
684
|
+
if (command.json) {
|
|
685
|
+
cli.stdout.write(`${JSON.stringify({ limits })}\n`);
|
|
686
|
+
return EXIT_OK;
|
|
687
|
+
}
|
|
688
|
+
if (!limits.length) {
|
|
689
|
+
cli.stdout.write("No limits known yet. They are kept when an agent runs through genaicode, read from Codex's own\n" +
|
|
690
|
+
'sessions, and from Claude Code\'s status line once it runs "genaicode limits record".\n');
|
|
691
|
+
return EXIT_OK;
|
|
692
|
+
}
|
|
693
|
+
cli.stdout.write(`${describeKnownLimits(limits).join('\n')}\n`);
|
|
694
|
+
return EXIT_OK;
|
|
695
|
+
}
|
|
696
|
+
/** `topics` looks this far back unless told otherwise. */
|
|
697
|
+
const TOPICS_SINCE_MS = 30 * 24 * 3600_000;
|
|
698
|
+
/** What a sorting run asks for when no model is named: sorting titles needs no large one. */
|
|
699
|
+
const SORTING_MODEL = { claude: 'haiku' };
|
|
700
|
+
/**
|
|
701
|
+
* `topics`: the sessions of every agent as pieces of work. An agent sorts them only when asked
|
|
702
|
+
* (`refresh`, the sessions no topic has yet); what it decided is kept and yours to correct.
|
|
703
|
+
*/
|
|
704
|
+
async function manageTopics(cli, agents, command) {
|
|
705
|
+
const sources = agentSessionSources(agents);
|
|
706
|
+
const query = { env: cli.env, ...(cli.signal ? { signal: cli.signal } : {}) };
|
|
707
|
+
const store = await readTopics(cli.env);
|
|
708
|
+
const named = (text) => {
|
|
709
|
+
const topic = findTopic(store, text);
|
|
710
|
+
if (!topic)
|
|
711
|
+
cli.stderr.write(`No one topic "${text}". "genaicode topics" lists them, with their ids.\n`);
|
|
712
|
+
return topic;
|
|
713
|
+
};
|
|
714
|
+
const count = (n) => `${n} session${n === 1 ? '' : 's'}`;
|
|
715
|
+
if (command.action === 'rename') {
|
|
716
|
+
const topic = named(command.topic);
|
|
717
|
+
if (!topic)
|
|
718
|
+
return EXIT_FAILED;
|
|
719
|
+
await writeTopics(renameTopic(store, topic, command.name), cli.env);
|
|
720
|
+
cli.stdout.write(`${topic.id} is now "${oneLine(command.name, 80)}".\n`);
|
|
721
|
+
return EXIT_OK;
|
|
722
|
+
}
|
|
723
|
+
if (command.action === 'merge') {
|
|
724
|
+
const from = named(command.from);
|
|
725
|
+
const into = from && named(command.into);
|
|
726
|
+
if (!from || !into)
|
|
727
|
+
return EXIT_FAILED;
|
|
728
|
+
if (from.id === into.id) {
|
|
729
|
+
cli.stderr.write('Those are the same topic.\n');
|
|
730
|
+
return EXIT_USAGE;
|
|
731
|
+
}
|
|
732
|
+
await writeTopics(mergeTopics(store, from, into), cli.env);
|
|
733
|
+
cli.stdout.write(`"${from.name}" is now part of "${into.name}".\n`);
|
|
734
|
+
return EXIT_OK;
|
|
735
|
+
}
|
|
736
|
+
if (command.action === 'move') {
|
|
737
|
+
const found = [];
|
|
738
|
+
for (const id of command.ids) {
|
|
739
|
+
let match;
|
|
740
|
+
try {
|
|
741
|
+
match = (await findSession(sources, id, query))?.session;
|
|
742
|
+
}
|
|
743
|
+
catch (error) {
|
|
744
|
+
cli.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
745
|
+
return EXIT_USAGE;
|
|
746
|
+
}
|
|
747
|
+
if (!match) {
|
|
748
|
+
cli.stderr.write(`No session "${id}". Ids are at the end of each line of "genaicode topics show <topic>".\n`);
|
|
749
|
+
return EXIT_FAILED;
|
|
750
|
+
}
|
|
751
|
+
found.push(match);
|
|
752
|
+
}
|
|
753
|
+
const next = { ...store, topics: [...store.topics] };
|
|
754
|
+
const topic = command.to === undefined ? undefined : (findTopic(next, command.to) ?? topicNamed(next, command.to));
|
|
755
|
+
await writeTopics(moveSessions(next, found, topic), cli.env);
|
|
756
|
+
cli.stdout.write(topic ? `${count(found.length)} now in "${topic.name}".\n` : `${count(found.length)} out of any topic.\n`);
|
|
757
|
+
return EXIT_OK;
|
|
758
|
+
}
|
|
759
|
+
const now = Date.now();
|
|
760
|
+
const listing = await listSessions(sources, { ...query, since: now - (command.sinceMs ?? TOPICS_SINCE_MS) });
|
|
761
|
+
for (const error of listing.errors)
|
|
762
|
+
cli.stderr.write(`${error.source}: ${error.message}\n`);
|
|
763
|
+
const period = ago(command.sinceMs ?? TOPICS_SINCE_MS);
|
|
764
|
+
if (command.action === 'refresh') {
|
|
765
|
+
const todo = unsortedSessions(listing.sessions, store);
|
|
766
|
+
if (!todo.length) {
|
|
767
|
+
cli.stdout.write(`Every session of the last ${period} has a topic.\n`);
|
|
768
|
+
return EXIT_OK;
|
|
769
|
+
}
|
|
770
|
+
const agent = pickAgent(cli, agents, command.agent);
|
|
771
|
+
if (!agent)
|
|
772
|
+
return EXIT_USAGE;
|
|
773
|
+
const model = command.model ?? SORTING_MODEL[agent.name];
|
|
774
|
+
cli.stderr.write(`Sorting ${count(todo.length)} with ${agent.name}${model ? ` (${model})` : ''}...\n`);
|
|
775
|
+
// An empty directory: the agent has nothing to read there, and is told to read nothing.
|
|
776
|
+
const cwd = await fs.mkdtemp(join(tmpdir(), 'genaicode-topics-'));
|
|
777
|
+
let current = store;
|
|
778
|
+
let placed = 0;
|
|
779
|
+
try {
|
|
780
|
+
for (let at = 0; at < todo.length; at += TOPICS_BATCH) {
|
|
781
|
+
const batch = todo.slice(at, at + TOPICS_BATCH);
|
|
782
|
+
const run = agent.run({
|
|
783
|
+
prompt: topicsPrompt(batch, current),
|
|
784
|
+
cwd,
|
|
785
|
+
env: cli.env,
|
|
786
|
+
...(model ? { model } : {}),
|
|
787
|
+
...(cli.signal ? { signal: cli.signal } : {}),
|
|
788
|
+
});
|
|
789
|
+
let said = '';
|
|
790
|
+
for await (const event of run)
|
|
791
|
+
if (event.type === 'message')
|
|
792
|
+
said += `${event.text}\n`;
|
|
793
|
+
const result = await run.result;
|
|
794
|
+
// The run's own session is noted first, so no later refresh takes it for one of yours.
|
|
795
|
+
const own = result.sessionId && agent.sessions ? `${agent.sessions.name}:${result.sessionId}` : undefined;
|
|
796
|
+
if (own)
|
|
797
|
+
await writeTopics(withTopicsRun(await readTopics(cli.env), own), cli.env);
|
|
798
|
+
if (!result.ok) {
|
|
799
|
+
cli.stderr.write(`${describeResult(agent.name, result)}\n`);
|
|
800
|
+
return result.status === 'aborted' ? EXIT_ABORTED : EXIT_FAILED;
|
|
801
|
+
}
|
|
802
|
+
// The answer is read against what is kept now: topics may have been corrected meanwhile, and
|
|
803
|
+
// a new topic gets an id that is free there.
|
|
804
|
+
const sorted = sortedTopics(result.text ?? said, batch, await readTopics(cli.env));
|
|
805
|
+
if (!sorted.placed) {
|
|
806
|
+
cli.stderr.write(`${agent.name} gave no topics that could be read. Nothing more was sorted.\n`);
|
|
807
|
+
return EXIT_FAILED;
|
|
808
|
+
}
|
|
809
|
+
current = sorted.store;
|
|
810
|
+
await writeTopics(current, cli.env);
|
|
811
|
+
placed += sorted.placed;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
finally {
|
|
815
|
+
await fs.rm(cwd, { recursive: true, force: true }).catch(() => undefined);
|
|
816
|
+
if (placed)
|
|
817
|
+
cli.stdout.write(`Sorted ${count(placed)} into ${current.topics.length} topic${current.topics.length === 1 ? '' : 's'}. See them with "genaicode topics".\n`);
|
|
818
|
+
}
|
|
819
|
+
return EXIT_OK;
|
|
820
|
+
}
|
|
821
|
+
const { topics, unsorted } = summarizeTopics(listing.sessions, store);
|
|
822
|
+
if (command.topic !== undefined) {
|
|
823
|
+
const topic = named(command.topic);
|
|
824
|
+
if (!topic)
|
|
825
|
+
return EXIT_FAILED;
|
|
826
|
+
const sessions = topics.find((one) => one.id === topic.id)?.sessions ?? [];
|
|
827
|
+
if (command.json) {
|
|
828
|
+
for (const session of sessions)
|
|
829
|
+
cli.stdout.write(`${JSON.stringify(session)}\n`);
|
|
830
|
+
return EXIT_OK;
|
|
831
|
+
}
|
|
832
|
+
cli.stdout.write(`${topic.name} (${topic.id}): ${count(sessions.length)} in the last ${period}\n`);
|
|
833
|
+
for (const session of sessions) {
|
|
834
|
+
const label = session.title ?? session.lastPrompt ?? session.firstPrompt ?? '(no prompt)';
|
|
835
|
+
const mark = session.state === 'active' ? '▶' : session.ending || session.waitingFor === 'approval' ? '●' : ' ';
|
|
836
|
+
cli.stdout.write(`${mark} ${session.agent} ${ago(now - session.updatedAt)} ago ${oneLine(label, 70)} ${session.id}\n`);
|
|
837
|
+
}
|
|
838
|
+
return EXIT_OK;
|
|
839
|
+
}
|
|
840
|
+
if (command.json) {
|
|
841
|
+
cli.stdout.write(`${JSON.stringify({
|
|
842
|
+
topics: topics.map(({ sessions, ...topic }) => ({
|
|
843
|
+
...topic,
|
|
844
|
+
sessions: sessions.map(({ source, id, agent, updatedAt, state }) => ({
|
|
845
|
+
source,
|
|
846
|
+
id,
|
|
847
|
+
agent,
|
|
848
|
+
updatedAt,
|
|
849
|
+
state,
|
|
850
|
+
})),
|
|
851
|
+
})),
|
|
852
|
+
unsorted: unsorted.length,
|
|
853
|
+
})}\n`);
|
|
854
|
+
return EXIT_OK;
|
|
855
|
+
}
|
|
856
|
+
if (!topics.length) {
|
|
857
|
+
cli.stdout.write(unsorted.length
|
|
858
|
+
? `No topics yet. "genaicode topics refresh" has an agent sort the ${count(unsorted.length)} of the last ${period}.\n`
|
|
859
|
+
: `No sessions in the last ${period}.\n`);
|
|
860
|
+
return EXIT_OK;
|
|
861
|
+
}
|
|
862
|
+
const width = Math.min(32, Math.max(...topics.map((topic) => topic.name.length)));
|
|
863
|
+
for (const topic of topics) {
|
|
864
|
+
const agentsOf = Object.entries(topic.agents)
|
|
865
|
+
.sort((a, b) => b[1] - a[1])
|
|
866
|
+
.map(([name, n]) => `${name} ${n}`)
|
|
867
|
+
.join(', ');
|
|
868
|
+
const state = [topic.asking ? `${topic.asking} ask you` : '', topic.active ? `${topic.active} working` : '']
|
|
869
|
+
.filter(Boolean)
|
|
870
|
+
.join(', ');
|
|
871
|
+
cli.stdout.write(`${topic.asking ? '●' : topic.active ? '▶' : ' '} ${oneLine(topic.name, width).padEnd(width)} ${topic.id.padEnd(4)} ${agentsOf} ${ago(now - topic.updatedAt)} ago${state ? ` ${state}` : ''}${topic.projects.length ? ` ${topic.projects.slice(0, 2).join(', ')}` : ''}\n`);
|
|
872
|
+
}
|
|
873
|
+
if (unsorted.length) {
|
|
874
|
+
cli.stdout.write(`${count(unsorted.length)} not sorted yet: "genaicode topics refresh" sorts them.\n`);
|
|
875
|
+
}
|
|
876
|
+
return EXIT_OK;
|
|
877
|
+
}
|
|
621
878
|
async function manageNotify(cli, command) {
|
|
622
879
|
const describe = (settings) => settings.approval ? `on: when a session asks for approval${settings.done ? ' or finishes its turn' : ''}` : 'off';
|
|
623
880
|
if (command.action === 'test') {
|
|
@@ -677,6 +934,11 @@ async function manageHooks(cli, command, updater) {
|
|
|
677
934
|
cli.stdout.write(` --answer: not for ${agent}, its approvals stay in ${agent}.\n`);
|
|
678
935
|
if (agent === 'codex')
|
|
679
936
|
cli.stdout.write(' Codex runs it once you trust it: open Codex and use /hooks.\n');
|
|
937
|
+
if (status.statusLine === 'genaicode')
|
|
938
|
+
cli.stdout.write(' Its status line keeps your plan limits for "genaicode limits".\n');
|
|
939
|
+
if (status.statusLine === 'other')
|
|
940
|
+
cli.stdout.write(' Your own status line stays. For "genaicode limits" to know Claude Code\'s plan limits, have it\n' +
|
|
941
|
+
' pass its input on to "genaicode limits record".\n');
|
|
680
942
|
}
|
|
681
943
|
else if (command.action === 'uninstall') {
|
|
682
944
|
const removed = await uninstallHooks(agent, hookOptions);
|
|
@@ -689,7 +951,8 @@ async function manageHooks(cli, command, updater) {
|
|
|
689
951
|
: status.events.length
|
|
690
952
|
? 'installed by another genaicode or incomplete: run "genaicode hooks install"'
|
|
691
953
|
: 'not installed';
|
|
692
|
-
|
|
954
|
+
const line = status.statusLine === 'genaicode' ? ', status line keeps limits' : '';
|
|
955
|
+
cli.stdout.write(`${agent}: ${state}${status.answer ? ', answers from here' : ''}${line} ${status.file}\n`);
|
|
693
956
|
}
|
|
694
957
|
}
|
|
695
958
|
catch (error) {
|
|
@@ -742,6 +1005,7 @@ async function watchWaiting(cli, exitWithStdin, look, withAsks) {
|
|
|
742
1005
|
let last;
|
|
743
1006
|
let said = '';
|
|
744
1007
|
let sessions = [];
|
|
1008
|
+
let limits = [];
|
|
745
1009
|
let mark;
|
|
746
1010
|
let since = 0;
|
|
747
1011
|
try {
|
|
@@ -756,6 +1020,9 @@ async function watchWaiting(cli, exitWithStdin, look, withAsks) {
|
|
|
756
1020
|
if (stop.signal.aborted)
|
|
757
1021
|
break;
|
|
758
1022
|
({ sessions, questions } = full);
|
|
1023
|
+
limits = await knownLimits(cli.env);
|
|
1024
|
+
if (stop.signal.aborted)
|
|
1025
|
+
break;
|
|
759
1026
|
// The mark from before the read: what a hook wrote meanwhile brings the next look.
|
|
760
1027
|
mark = now;
|
|
761
1028
|
since = 0;
|
|
@@ -765,7 +1032,10 @@ async function watchWaiting(cli, exitWithStdin, look, withAsks) {
|
|
|
765
1032
|
cli.stderr.write(trouble);
|
|
766
1033
|
said = trouble;
|
|
767
1034
|
}
|
|
768
|
-
const line = JSON.stringify({
|
|
1035
|
+
const line = JSON.stringify({
|
|
1036
|
+
sessions: sessions.map((session) => withAsks(session, questions)),
|
|
1037
|
+
...(limits.length ? { limits } : {}),
|
|
1038
|
+
});
|
|
769
1039
|
if (line !== last)
|
|
770
1040
|
cli.stdout.write(`${line}\n`);
|
|
771
1041
|
last = line;
|
|
@@ -812,6 +1082,7 @@ async function showSessions(cli, agents, command) {
|
|
|
812
1082
|
const listing = await listSessions(sources, {
|
|
813
1083
|
...(command.waiting ? {} : { limit: command.limit + extra }),
|
|
814
1084
|
env: cli.env,
|
|
1085
|
+
...(command.automated ? { automated: true } : {}),
|
|
815
1086
|
...(command.cwd !== undefined ? { cwd: resolve(cli.cwd, command.cwd) } : {}),
|
|
816
1087
|
...(sinceMs !== undefined ? { since: now - sinceMs } : {}),
|
|
817
1088
|
...(cli.signal ? { signal: cli.signal } : {}),
|