feat(agent): add auto-backgrounding and process management (#17)
* feat(agent): add auto-backgrounding to exec tool - Add yieldMs parameter to exec tool (default 5s) - commands that don't complete within this time automatically run in background - Create shared process-registry.ts for unified process management - Refactor process.ts to use shared registry - Add --debug CLI flag for session message logging - Signal isolation: backgrounded processes ignore abort signals Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(session): preserve tool_use/tool_result pairs during compaction Previously, session compaction simply kept the last N messages, which could break tool_use/tool_result pairs if the cut point fell between them. This caused "tool_call_id is not found" errors from the API. Now compaction finds a safe cut point that starts from either: - A user message without tool_result - An assistant message whose tool_use is needed by the next tool_result Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(session): use Kimi as default model for summary compaction - Auto-detect MOONSHOT_API_KEY from environment - Use moonshot-v1-128k (cheaper than k2-thinking) - Fall back to tokens mode if API key not available Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: add rule to never use git commit --amend Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: clarify git amend rule for immediate fixes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
e2e8cc15d6
commit
5931e8f84e
9 changed files with 289 additions and 81 deletions
|
|
@ -9,6 +9,7 @@ type CliOptions = {
|
|||
thinking?: string | undefined;
|
||||
cwd?: string | undefined;
|
||||
session?: string | undefined;
|
||||
debug?: boolean | undefined;
|
||||
help?: boolean | undefined;
|
||||
};
|
||||
|
||||
|
|
@ -24,6 +25,7 @@ function printUsage() {
|
|||
console.log(" --thinking LEVEL Thinking level");
|
||||
console.log(" --cwd DIR Working directory for commands");
|
||||
console.log(" --session ID Session ID for conversation persistence");
|
||||
console.log(" --debug Enable debug logging");
|
||||
console.log(" --help, -h Show this help");
|
||||
}
|
||||
|
||||
|
|
@ -67,6 +69,10 @@ function parseArgs(argv: string[]) {
|
|||
opts.session = args.shift();
|
||||
continue;
|
||||
}
|
||||
if (arg === "--debug") {
|
||||
opts.debug = true;
|
||||
continue;
|
||||
}
|
||||
if (arg === "--") {
|
||||
promptParts.push(...args);
|
||||
break;
|
||||
|
|
@ -110,6 +116,7 @@ async function main() {
|
|||
thinkingLevel: opts.thinking as any,
|
||||
cwd: opts.cwd,
|
||||
sessionId: opts.session,
|
||||
debug: opts.debug,
|
||||
});
|
||||
|
||||
// If it's a newly created session, notify user of sessionId
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue