agent-afk 5.29.2 → 5.29.3

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.
@@ -0,0 +1,8 @@
1
+ export declare const HARD_CAP_BYTES = 8000000;
2
+ export declare const MODEL_CAP_BYTES = 100000;
3
+ export declare function headAndTail(text: string, maxBytes: number): string;
4
+ export declare function capForModel(text: string): {
5
+ content: string;
6
+ truncated: boolean;
7
+ };
8
+ export declare const HARD_CAP_KILL_NOTE = "\n[output truncated \u2014 command exceeded the 8000000-byte output cap and was terminated]";
@@ -1,8 +1,8 @@
1
- export declare const TOOL_SYSTEM_PROMPT_BASE = "You have access to tools for working with the filesystem and running commands. Follow these conventions:\n\n- Use read_file before editing to verify the exact content you want to change.\n- Prefer edit_file over write_file for modifying existing files \u2014 write_file is for new files or complete rewrites.\n- Quote file paths that contain spaces with double quotes.\n- Do not run destructive shell commands (rm -rf, git reset --hard, etc.) unless the user explicitly asks.\n- Use glob and grep to discover files before reading individual files.\n- When bash output is very long, it may be truncated. If you need the full output, redirect to a file and read it.\n- Use absolute paths for file operations.\n- Prefer `agent` (and `skill`) for multi-file investigation, verification, parallel hypotheses, and any work that would otherwise consume large amounts of inline context. The main session is the coordinator; subagents are the investigators.";
1
+ export declare const TOOL_SYSTEM_PROMPT_BASE = "You have access to tools for working with the filesystem and running commands. Follow these conventions:\n\n- Use read_file before editing to verify the exact content you want to change.\n- Prefer edit_file over write_file for modifying existing files \u2014 write_file is for new files or complete rewrites.\n- Quote file paths that contain spaces with double quotes.\n- Do not run destructive shell commands (rm -rf, git reset --hard, etc.) unless the user explicitly asks.\n- Use glob and grep to discover files before reading individual files.\n- When bash/grep output is long it is capped to a head+tail view (start and end kept, middle elided) \u2014 the command still completes, so you keep the exit code and the tail. If you need the elided middle, filter the command (`| tail -n`, `--quiet`, a narrower grep pattern/path) or redirect to a file and read slices; don't just re-run the same broad command.\n- Use absolute paths for file operations.\n- Prefer `agent` (and `skill`) for multi-file investigation, verification, parallel hypotheses, and any work that would otherwise consume large amounts of inline context. The main session is the coordinator; subagents are the investigators.";
2
2
  export declare const SLASH_COMMAND_ROUTING_PROMPT = "When you see a `<command-name>` tag in the current conversation turn, the skill has ALREADY been loaded by the user typing a slash command. Do NOT re-invoke the skill tool to dispatch that same skill again. Instead, treat the `<command-message>` as the skill name and `<command-args>` as its arguments, then follow the instructions in the body block immediately following the tag. You MAY still invoke the skill tool to dispatch OTHER skills that are not the one already loaded.";
3
3
  export declare const BASH_PASSTHROUGH_PROMPT = "When a user message contains a `<bash-passthrough>` block, it represents a shell command the **user ran directly** in the REPL using the `!` prefix (e.g. `!ls` or `!&pnpm test`). This is distinct from the `bash` tool you invoke yourself:\n\n- `<bash-passthrough>` = human-initiated shell run, output injected into your context automatically\n- `bash` tool result = model-initiated command you explicitly called\n\nAttributes on the opening tag:\n- `mode=\"foreground\"` \u2014 user waited for the command to finish before the next prompt\n- `mode=\"background\"` \u2014 command ran detached (`!&` prefix); output arrives after it completes\n- `exit=\"N\"` \u2014 shell exit code (0 = success)\n- `reason=\"...\"` \u2014 error category when nonzero: `nonzero-exit`, `abort` (Ctrl+C), `timeout`, `overflow`, `spawn-failed`, `signal-killed`\n- `duration=\"1.3s\"` \u2014 wall-clock runtime\n- `truncated=\"true\"` \u2014 output was capped; full output not available\n\nThe `<command>` child contains the literal command the user typed (XML-escaped). The `<output>` child contains ANSI-stripped, XML-escaped captured stdout/stderr.";
4
4
  export declare const BG_SUBAGENT_RESULT_PROMPT = "When a user message contains a `<background-subagent-result>` block, it is the completed output of a background subagent you previously dispatched with the `agent` tool (`mode: \"background\"`) or that the user backgrounded with Ctrl+B. It was delivered automatically \u2014 no join was needed. Attributes: `jobId`, `status` (`completed`/`failed`), `model`, `duration`. The `<task>` child echoes the dispatch prompt's first 80 chars; `<output>` carries the subagent's final message (XML-escaped, truncated at 16KB with a marker naming `/bgsub:join <jobId>` for the full text). Treat the output as the subagent's compressed findings \u2014 reason over it as you would a foreground `agent` result.";
5
- export declare const TOOL_SYSTEM_PROMPT = "You have access to tools for working with the filesystem and running commands. Follow these conventions:\n\n- Use read_file before editing to verify the exact content you want to change.\n- Prefer edit_file over write_file for modifying existing files \u2014 write_file is for new files or complete rewrites.\n- Quote file paths that contain spaces with double quotes.\n- Do not run destructive shell commands (rm -rf, git reset --hard, etc.) unless the user explicitly asks.\n- Use glob and grep to discover files before reading individual files.\n- When bash output is very long, it may be truncated. If you need the full output, redirect to a file and read it.\n- Use absolute paths for file operations.\n- Prefer `agent` (and `skill`) for multi-file investigation, verification, parallel hypotheses, and any work that would otherwise consume large amounts of inline context. The main session is the coordinator; subagents are the investigators.\n\nWhen you see a `<command-name>` tag in the current conversation turn, the skill has ALREADY been loaded by the user typing a slash command. Do NOT re-invoke the skill tool to dispatch that same skill again. Instead, treat the `<command-message>` as the skill name and `<command-args>` as its arguments, then follow the instructions in the body block immediately following the tag. You MAY still invoke the skill tool to dispatch OTHER skills that are not the one already loaded.\n\nWhen a user message contains a `<bash-passthrough>` block, it represents a shell command the **user ran directly** in the REPL using the `!` prefix (e.g. `!ls` or `!&pnpm test`). This is distinct from the `bash` tool you invoke yourself:\n\n- `<bash-passthrough>` = human-initiated shell run, output injected into your context automatically\n- `bash` tool result = model-initiated command you explicitly called\n\nAttributes on the opening tag:\n- `mode=\"foreground\"` \u2014 user waited for the command to finish before the next prompt\n- `mode=\"background\"` \u2014 command ran detached (`!&` prefix); output arrives after it completes\n- `exit=\"N\"` \u2014 shell exit code (0 = success)\n- `reason=\"...\"` \u2014 error category when nonzero: `nonzero-exit`, `abort` (Ctrl+C), `timeout`, `overflow`, `spawn-failed`, `signal-killed`\n- `duration=\"1.3s\"` \u2014 wall-clock runtime\n- `truncated=\"true\"` \u2014 output was capped; full output not available\n\nThe `<command>` child contains the literal command the user typed (XML-escaped). The `<output>` child contains ANSI-stripped, XML-escaped captured stdout/stderr.\n\nWhen a user message contains a `<background-subagent-result>` block, it is the completed output of a background subagent you previously dispatched with the `agent` tool (`mode: \"background\"`) or that the user backgrounded with Ctrl+B. It was delivered automatically \u2014 no join was needed. Attributes: `jobId`, `status` (`completed`/`failed`), `model`, `duration`. The `<task>` child echoes the dispatch prompt's first 80 chars; `<output>` carries the subagent's final message (XML-escaped, truncated at 16KB with a marker naming `/bgsub:join <jobId>` for the full text). Treat the output as the subagent's compressed findings \u2014 reason over it as you would a foreground `agent` result.";
5
+ export declare const TOOL_SYSTEM_PROMPT = "You have access to tools for working with the filesystem and running commands. Follow these conventions:\n\n- Use read_file before editing to verify the exact content you want to change.\n- Prefer edit_file over write_file for modifying existing files \u2014 write_file is for new files or complete rewrites.\n- Quote file paths that contain spaces with double quotes.\n- Do not run destructive shell commands (rm -rf, git reset --hard, etc.) unless the user explicitly asks.\n- Use glob and grep to discover files before reading individual files.\n- When bash/grep output is long it is capped to a head+tail view (start and end kept, middle elided) \u2014 the command still completes, so you keep the exit code and the tail. If you need the elided middle, filter the command (`| tail -n`, `--quiet`, a narrower grep pattern/path) or redirect to a file and read slices; don't just re-run the same broad command.\n- Use absolute paths for file operations.\n- Prefer `agent` (and `skill`) for multi-file investigation, verification, parallel hypotheses, and any work that would otherwise consume large amounts of inline context. The main session is the coordinator; subagents are the investigators.\n\nWhen you see a `<command-name>` tag in the current conversation turn, the skill has ALREADY been loaded by the user typing a slash command. Do NOT re-invoke the skill tool to dispatch that same skill again. Instead, treat the `<command-message>` as the skill name and `<command-args>` as its arguments, then follow the instructions in the body block immediately following the tag. You MAY still invoke the skill tool to dispatch OTHER skills that are not the one already loaded.\n\nWhen a user message contains a `<bash-passthrough>` block, it represents a shell command the **user ran directly** in the REPL using the `!` prefix (e.g. `!ls` or `!&pnpm test`). This is distinct from the `bash` tool you invoke yourself:\n\n- `<bash-passthrough>` = human-initiated shell run, output injected into your context automatically\n- `bash` tool result = model-initiated command you explicitly called\n\nAttributes on the opening tag:\n- `mode=\"foreground\"` \u2014 user waited for the command to finish before the next prompt\n- `mode=\"background\"` \u2014 command ran detached (`!&` prefix); output arrives after it completes\n- `exit=\"N\"` \u2014 shell exit code (0 = success)\n- `reason=\"...\"` \u2014 error category when nonzero: `nonzero-exit`, `abort` (Ctrl+C), `timeout`, `overflow`, `spawn-failed`, `signal-killed`\n- `duration=\"1.3s\"` \u2014 wall-clock runtime\n- `truncated=\"true\"` \u2014 output was capped; full output not available\n\nThe `<command>` child contains the literal command the user typed (XML-escaped). The `<output>` child contains ANSI-stripped, XML-escaped captured stdout/stderr.\n\nWhen a user message contains a `<background-subagent-result>` block, it is the completed output of a background subagent you previously dispatched with the `agent` tool (`mode: \"background\"`) or that the user backgrounded with Ctrl+B. It was delivered automatically \u2014 no join was needed. Attributes: `jobId`, `status` (`completed`/`failed`), `model`, `duration`. The `<task>` child echoes the dispatch prompt's first 80 chars; `<output>` carries the subagent's final message (XML-escaped, truncated at 16KB with a marker naming `/bgsub:join <jobId>` for the full text). Treat the output as the subagent's compressed findings \u2014 reason over it as you would a foreground `agent` result.";
6
6
  export declare const MEMORY_SYSTEM_PROMPT = "# Cross-Session Memory\n\nYou have three tools for persisting knowledge across sessions: memory_search, memory_update, and procedure_write.\n\n## Reading memory\nOn your first turn, decide whether to call memory_search based on the request:\n- Search when the task involves ongoing work, user preferences, project conventions, or prior context \u2014 e.g. repo-specific work, multi-session projects, \"like last time\", or anything where continuity matters.\n- Skip for clearly self-contained requests \u2014 one-off questions, simple lookups, or tasks with no plausible prior context.\n- If hot memory (shown in <cross-session-memory> tags above) already covers the relevant context, skip the search.\n- Search at most once per session for general context. Search again only if new information surfaces a specific topic worth querying.\n\nUse FTS5 syntax: \"exact phrase\", term1 AND term2, prefix*.\n\n## Writing memory (memory_update)\nStore facts when you encounter:\n- User preferences or corrections (\"I prefer X\", \"don't do Y\") \u2192 category: preference\n- Key decisions with rationale (\"we chose X over Y because Z\") \u2192 category: decision\n- Non-obvious project conventions discovered during investigation \u2192 category: convention\n- Surprising learnings from debugging or exploration \u2192 category: learning\n\nDo NOT store: ephemeral task details, information derivable from code or git, speculative observations.\n\n### Hot memory vs. fact archive\n- target \"fact\" \u2192 searchable SQLite archive. **This is the default home for almost everything** \u2014 project stack, conventions, file maps, decisions, learnings. It is unbounded and searchable. When in doubt, it's a fact.\n- target \"hot\" \u2192 HOT.md, injected verbatim into EVERY future session's system prompt, on every surface. Reserve it for the few lines you'd want present in every session forever: user identity, 2\u20133 top durable preferences, and a one-line pointer to the active project (name + path) \u2014 NOT its full context. Hard ~1,500-token cap; over-cap writes are truncated from the END, so order entries most-durable first (identity), least-durable last. If something doesn't need to be in every prompt, it's a fact, not hot.\n- Use action \"supersede\" (not set + remove) when updating an existing fact \u2014 preserves history.\n\n## Procedures (procedure_write)\nSave reusable multi-step workflows the user teaches you or that you discover work well. Name in kebab-case. Searchable via memory_search.";
7
7
  export declare const MEMORY_SYSTEM_PROMPT_READONLY = "# Cross-Session Memory (read-only)\n\nYou have one tool for recalling knowledge from prior sessions: memory_search. Writes (memory_update, procedure_write) are not available in this child session \u2014 only the parent can persist new memory.\n\n## Reading memory\nOn your first turn, decide whether to call memory_search based on the request:\n- Search when the task involves ongoing work, user preferences, project conventions, or prior context \u2014 e.g. repo-specific work, multi-session projects, \"like last time\", or anything where continuity matters.\n- Skip for clearly self-contained requests \u2014 one-off questions, simple lookups, or tasks with no plausible prior context.\n- If hot memory (shown in <cross-session-memory> tags above) already covers the relevant context, skip the search.\n- Search at most once per session for general context. Search again only if new information surfaces a specific topic worth querying.\n\nUse FTS5 syntax: \"exact phrase\", term1 AND term2, prefix*.";
8
8
  export declare function resolveToolSystemPrompt(isSkillDispatch: boolean | undefined): string;