wave-agent-sdk 0.12.0 → 0.12.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.
- package/README.md +0 -13
- package/builtin/skills/settings/ENV.md +4 -0
- package/builtin/skills/settings/HOOKS.md +4 -0
- package/builtin/skills/settings/MODELS.md +4 -0
- package/builtin/skills/settings/SKILL.md +5 -1
- package/dist/managers/aiManager.d.ts.map +1 -1
- package/dist/managers/aiManager.js +0 -4
- package/dist/prompts/index.d.ts +11 -3
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +97 -11
- package/dist/services/configurationService.d.ts +1 -1
- package/dist/services/configurationService.d.ts.map +1 -1
- package/dist/services/configurationService.js +26 -15
- package/dist/tools/bashTool.d.ts.map +1 -1
- package/dist/tools/bashTool.js +24 -3
- package/dist/tools/writeTool.d.ts.map +1 -1
- package/dist/tools/writeTool.js +6 -0
- package/dist/types/core.d.ts +2 -0
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/core.js +2 -0
- package/package.json +1 -1
- package/src/managers/aiManager.ts +0 -6
- package/src/prompts/index.ts +111 -9
- package/src/services/configurationService.ts +34 -20
- package/src/tools/bashTool.ts +24 -3
- package/src/tools/writeTool.ts +10 -0
- package/src/types/core.ts +4 -0
package/README.md
CHANGED
|
@@ -14,19 +14,6 @@ npm install wave-agent-sdk
|
|
|
14
14
|
|
|
15
15
|
See [examples](./examples) for usage examples.
|
|
16
16
|
|
|
17
|
-
## Development
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# Install dependencies
|
|
21
|
-
pnpm install
|
|
22
|
-
|
|
23
|
-
# Build
|
|
24
|
-
pnpm build
|
|
25
|
-
|
|
26
|
-
# Test
|
|
27
|
-
pnpm test
|
|
28
|
-
```
|
|
29
|
-
|
|
30
17
|
## License
|
|
31
18
|
|
|
32
19
|
MIT
|
|
@@ -57,6 +57,10 @@ Example:
|
|
|
57
57
|
}
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
## Live Reload
|
|
61
|
+
|
|
62
|
+
Environment variables configured in `settings.json` support **live reload**. When you modify the `env` field in any `settings.json` file (user, project, or local scope), the changes take effect immediately without requiring a Wave session restart.
|
|
63
|
+
|
|
60
64
|
## Best Practices
|
|
61
65
|
|
|
62
66
|
- **Use Local Overrides for Secrets**: Never commit sensitive information like `WAVE_API_KEY` to `settings.json`. Use `settings.local.json` instead.
|
|
@@ -86,6 +86,10 @@ Hooks can communicate status and control Wave's behavior using exit codes:
|
|
|
86
86
|
- `Stop`: Blocks the stop operation and provides `stderr` to the agent.
|
|
87
87
|
- **Other Exits (e.g., Exit 1)**: Non-blocking error. Wave continues execution but shows `stderr` as a warning to the user.
|
|
88
88
|
|
|
89
|
+
## Live Reload
|
|
90
|
+
|
|
91
|
+
Hook configurations support **live reload**. When you modify hooks in `settings.json`, the changes take effect immediately without restarting Wave.
|
|
92
|
+
|
|
89
93
|
## Best Practices
|
|
90
94
|
|
|
91
95
|
- **Keep hooks fast**: Long-running hooks can slow down your workflow unless they are `async`.
|
|
@@ -65,3 +65,7 @@ You can also set the default models Wave uses via environment variables in `sett
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
```
|
|
68
|
+
|
|
69
|
+
## Live Reload
|
|
70
|
+
|
|
71
|
+
Model configurations support **live reload**. When you modify the `models` field or model-related environment variables in `settings.json`, the changes take effect immediately without restarting Wave.
|
|
@@ -11,6 +11,10 @@ This skill helps you manage your Wave configuration and provides guidance on how
|
|
|
11
11
|
|
|
12
12
|
`settings.json` is the central configuration file for Wave. It allows you to customize hooks, environment variables, tool permissions, and more.
|
|
13
13
|
|
|
14
|
+
### Live Reload
|
|
15
|
+
|
|
16
|
+
Changes to `settings.json` take effect immediately without restarting Wave. When you modify any setting, the new configuration is applied to subsequent operations automatically.
|
|
17
|
+
|
|
14
18
|
Wave looks for `settings.json` in three scopes:
|
|
15
19
|
1. **User Scope**: Global settings for all projects. Located at `~/.wave/settings.json`.
|
|
16
20
|
2. **Project Scope**: Settings specific to the current project. Located at `.wave/settings.json` in your project root.
|
|
@@ -35,7 +39,7 @@ For detailed environment variable configuration and available `WAVE_*` variables
|
|
|
35
39
|
```
|
|
36
40
|
|
|
37
41
|
### 3. Permissions
|
|
38
|
-
Manage tool permissions and define the "Safe Zone".
|
|
42
|
+
Manage tool permissions and define the "Safe Zone". Changes to permissions take effect immediately with live reload.
|
|
39
43
|
```json
|
|
40
44
|
{
|
|
41
45
|
"permissions": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aiManager.d.ts","sourceRoot":"","sources":["../../src/managers/aiManager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,KAAK,EAGN,MAAM,mBAAmB,CAAC;AAY3B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKlD,MAAM,WAAW,kBAAkB;IACjC,wBAAwB,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5D,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,SAAS;IAYlB,OAAO,CAAC,SAAS;IAXZ,SAAS,EAAE,OAAO,CAAS;IAClC,OAAO,CAAC,eAAe,CAAgC;IACvD,OAAO,CAAC,mBAAmB,CAAgC;IAC3D,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,YAAY,CAAC,CAAS;I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AAa;IAIjC,cAAc,IAAI,WAAW;IA6B7B,iBAAiB,IAAI,MAAM;IAI3B,WAAW,IAAI,MAAM,GAAG,SAAS;IAIjC,oBAAoB,IAAI,OAAO;IAItC,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,SAAS,CAAqB;IAEtC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAevB,YAAY,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAItC,cAAc,IAAI,IAAI;IAuB7B,OAAO,CAAC,qBAAqB;YAsBf,8BAA8B;IAgFrC,gBAAgB,IAAI,OAAO;IAI3B,gBAAgB,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI;IAOrD,OAAO,KAAK,eAAe,GAE1B;IAED,OAAO,KAAK,YAAY,GAEvB;IAEY,aAAa,CACxB,OAAO,GAAE;QACP,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,oEAAoE;QACpE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,CAAC;KACf,GACL,OAAO,CAAC,IAAI,CAAC;IAgmBhB;;;;OAIG;YACW,gBAAgB;IAiE9B;;;OAGG;YACW,sBAAsB;IA6DpC;;OAEG;YACW,uBAAuB;CAwDtC"}
|
|
@@ -366,10 +366,6 @@ export class AIManager {
|
|
|
366
366
|
logger?.warn("AI response truncated due to length limit. Response headers:", result.response_headers);
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
if (result.response_headers &&
|
|
370
|
-
Object.keys(result.response_headers).length > 0) {
|
|
371
|
-
logger?.debug("AI response headers:", result.response_headers);
|
|
372
|
-
}
|
|
373
369
|
if (result.additionalFields &&
|
|
374
370
|
Object.keys(result.additionalFields).length > 0) {
|
|
375
371
|
this.messageManager.mergeAssistantAdditionalFields(result.additionalFields);
|
package/dist/prompts/index.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { ToolPlugin } from "../tools/types.js";
|
|
2
2
|
import { PermissionMode } from "../types/permissions.js";
|
|
3
3
|
export declare const MAX_PARALLEL_TOOL_CALLS = 3;
|
|
4
|
-
export declare const BASE_SYSTEM_PROMPT = "You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const BASE_SYSTEM_PROMPT = "You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.";
|
|
5
|
+
export declare const DOING_TASKS_PROMPT = "# Doing tasks\n- The user will primarily request you to perform software engineering tasks. These may include solving bugs, adding new functionality, refactoring code, explaining code, and more. When given an unclear or generic instruction, consider it in the context of these software engineering tasks and the current working directory. For example, if the user asks you to change \"methodName\" to snake case, do not reply with just \"method_name\", instead find the method in the code and modify the code.\n- You are highly capable and often allow users to complete ambitious tasks that would otherwise be too complex or take too long. You should defer to user judgement about whether a task is too large to attempt.\n- If you notice the user's request is based on a misconception, or spot a bug adjacent to what they asked about, say so. You're a collaborator, not just an executor\u2014users benefit from your judgment, not just your compliance.\n- In general, do not propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.\n- Do not create files unless they're absolutely necessary for achieving your goal. Generally prefer editing an existing file to creating a new one, as this prevents file bloat and builds on existing work more effectively.\n- If an approach fails, diagnose why before switching tactics\u2014read the error, check your assumptions, try a focused fix. Don't retry the identical action blindly, but don't abandon a viable approach after a single failure either. Escalate to the user with AskUserQuestion only when you're genuinely stuck after investigation, not as a first response to friction.\n- Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it. Prioritize writing safe, secure, and correct code.\n- Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.\n - Don't add features, refactor code, or make \"improvements\" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability. Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.\n - Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code.\n - Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is what the task actually requires\u2014no speculative abstractions, but no half-finished implementations either. Three similar lines of code is better than a premature abstraction.\n- Avoid backwards-compatibility hacks like renaming unused _vars, re-exporting types, adding // removed comments for removed code, etc. If you are certain that something is unused, you can delete it completely.\n- Report outcomes faithfully: if tests fail, say so with the relevant output; if you did not run a verification step, say that rather than implying it succeeded. Never claim \"all tests pass\" when output shows failures, never suppress or simplify failing checks (tests, lints, type errors) to manufacture a green result, and never characterize incomplete or broken work as done. Equally, when a check did pass or a task is complete, state it plainly \u2014 do not hedge confirmed results with unnecessary disclaimers, downgrade finished work to \"partial,\" or re-verify things you already checked. The goal is an accurate report, not a defensive one.\n- Before reporting a task complete, verify it actually works: run the test, execute the script, check the output. Minimum complexity means no gold-plating, not skipping the finish line. If you can't verify (no test exists, can't run the code), say so explicitly rather than claiming success.";
|
|
6
|
+
export declare const EXECUTING_ACTIONS_PROMPT = "# Executing actions with care\n\nCarefully consider the reversibility and blast radius of actions. Generally you can freely take local, reversible actions like editing files or running tests. But for actions that are hard to reverse, affect shared systems beyond your local environment, or could otherwise be risky or destructive, check with the user before proceeding. The cost of pausing to confirm is low, while the cost of an unwanted action (lost work, unintended messages sent, deleted branches) can be very high. For actions like these, consider the context, the action, and user instructions, and by default transparently communicate the action and ask for confirmation before proceeding.\n\nExamples of the kind of risky actions that warrant user confirmation:\n- Destructive operations: deleting files/branches, dropping database tables, killing processes, rm -rf, overwriting uncommitted changes\n- Hard-to-reverse operations: force-pushing (can also overwrite upstream), git reset --hard, amending published commits, removing or downgrading packages/dependencies, modifying CI/CD pipelines\n- Actions visible to others or that affect shared state: pushing code, creating/closing/commenting on PRs or issues, sending messages (Slack, email, GitHub), posting to external services\n\nWhen you encounter an obstacle, do not use destructive actions as a shortcut to simply make it go away. For instance, try to identify root causes and fix underlying issues rather than bypassing safety checks (e.g. --no-verify). If you discover unexpected state like unfamiliar files, branches, or configuration, investigate before deleting or overwriting, as it may represent the user's in-progress work. For example, typically resolve merge conflicts rather than discarding changes. In short: only take risky actions carefully, and when in doubt, ask before acting. Follow both the spirit and letter of these instructions - measure twice, cut once.";
|
|
7
|
+
export declare const TOOL_POLICY = "# Using your tools\n\n- Do NOT use the Bash to run commands when a relevant dedicated tool is provided. Using dedicated tools allows the user to better understand and review your work. This is CRITICAL to assisting the user:\n - To read files use Read instead of cat, head, tail, or sed\n - To edit files use Edit instead of sed or awk\n - To create files use Write instead of cat with heredoc or echo redirection\n - To search for files use Glob instead of find or ls\n - To search the content of files, use Grep instead of grep or rg\n - Reserve using the Bash exclusively for system commands and terminal operations that require shell execution. If you are unsure and there is a relevant dedicated tool, default to using the dedicated tool and only fallback on using the Bash tool for these if it is absolutely necessary.\n- You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency.\n- **Limit**: You MUST NOT call more than 3 tools in parallel in a single response.\n- However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially. For instance, if one operation must complete before another starts, run these operations sequentially instead. Never use placeholders or guess missing parameters in tool calls.\n- If the user specifies that they want you to run tools \"in parallel\", you MUST send a single message with multiple tool use content blocks.";
|
|
8
|
+
/**
|
|
9
|
+
* Reference: /home/liuyiqi/github/claude-code/src/constants/prompts.ts getOutputEfficiencySection
|
|
10
|
+
*/
|
|
11
|
+
export declare const OUTPUT_EFFICIENCY_PROMPT = "# Output efficiency\n\nIMPORTANT: Go straight to the point. Try the simplest approach first without going in circles. Do not overdo it. Be extra concise.\n\nKeep your text output brief and direct. Lead with the answer or action, not the reasoning. Skip filler words, preamble, and unnecessary transitions. Do not restate what the user said \u2014 just do it. When explaining, include only what is necessary for the user to understand.\n\nFocus text output on:\n- Decisions that need the user's input\n- High-level status updates at natural milestones\n- Errors or blockers that change the plan\n\nIf you can say it in one sentence, don't use three. Prefer short, direct sentences over long explanations. This does not apply to code or tool calls.";
|
|
12
|
+
export declare const TONE_AND_STYLE_PROMPT = "# Tone and style\n\n- Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.\n- Your responses should be short and concise.\n- When referencing specific functions or pieces of code include the pattern file_path:line_number to allow the user to easily navigate to the source code location.\n- When referencing GitHub issues or pull requests, use the owner/repo#123 format (e.g. anthropics/claude-code#100) so they render as clickable links.\n- Do not use a colon before tool calls. Your tool calls may not be shown directly in the output, so text like \"Let me read the file:\" followed by a read tool call should just be \"Let me read the file.\" with a period.";
|
|
6
13
|
export declare function buildPlanModePrompt(planFilePath: string, planExists: boolean, isSubagent?: boolean): string;
|
|
7
|
-
export declare const DEFAULT_SYSTEM_PROMPT = "You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user
|
|
14
|
+
export declare const DEFAULT_SYSTEM_PROMPT = "You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.";
|
|
8
15
|
export declare const COMPRESS_MESSAGES_SYSTEM_PROMPT = "You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:\n1. Task Overview\nThe user's core request and success criteria\nAny clarifications or constraints they specified\n2. Current State\nWhat has been completed so far\nFiles created, modified, or analyzed (with paths if relevant)\nKey outputs or artifacts produced\n3. Important Discoveries\nTechnical constraints or requirements uncovered\nDecisions made and their rationale\nErrors encountered and how they were resolved\nWhat approaches were tried that didn't work (and why)\n4. Next Steps\nSpecific actions needed to complete the task\nAny blockers or open questions to resolve\nPriority order if multiple steps remain\n5. Context to Preserve\nUser preferences or style requirements\nDomain-specific details that aren't obvious\nAny promises made to the user\nBe concise but complete\u2014err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.\nWrap your summary in <summary></summary> tags.";
|
|
9
16
|
export declare const WEB_CONTENT_SYSTEM_PROMPT = "You are a helpful assistant that extracts information from web content. The content is provided in Markdown format.";
|
|
10
17
|
export declare const BTW_SYSTEM_PROMPT = "You are a helpful assistant. Answer the user's side question based on the conversation history. \nDo NOT say things like \"Let me try...\", \"I'll now...\", \"Let me check...\", or promise to take any action. \nIf you don't know the answer, say so - do not offer to look it up or investigate. \nSimply answer the question with the information you have.";
|
|
@@ -23,4 +30,5 @@ export declare function buildSystemPrompt(basePrompt: string | undefined, tools:
|
|
|
23
30
|
};
|
|
24
31
|
permissionMode?: PermissionMode;
|
|
25
32
|
}): string;
|
|
33
|
+
export declare function enhanceSystemPromptWithEnvDetails(existingSystemPrompt: string, workdir: string): string;
|
|
26
34
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAiBzD,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,eAAO,MAAM,kBAAkB,oKAAoK,CAAC;AAEpM,eAAO,MAAM,kBAAkB,opIAcqQ,CAAC;AAErS,eAAO,MAAM,wBAAwB,25DASqmB,CAAC;AAE3oB,eAAO,MAAM,WAAW,knDAYqH,CAAC;AAE9I;;GAEG;AACH,eAAO,MAAM,wBAAwB,+uBAWiH,CAAC;AAEvJ,eAAO,MAAM,qBAAqB,6sBAMuL,CAAC;AAE1N,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,UAAU,GAAE,OAAe,GAC1B,MAAM,CAmFR;AAED,eAAO,MAAM,qBAAqB,oKAAqB,CAAC;AAExD,eAAO,MAAM,+BAA+B,20CAsBG,CAAC;AAEhD,eAAO,MAAM,yBAAyB,wHAAwH,CAAC;AAC/J,eAAO,MAAM,iBAAiB,qWAG4B,CAAC;AAE3D,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE;QACT,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,UAAU,CAAC,EAAE;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,cAAc,CAAC,EAAE,cAAc,CAAC;CAC5B,GACL,MAAM,CA8DR;AAED,wBAAgB,iCAAiC,CAC/C,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM,GACd,MAAM,CAgCR"}
|
package/dist/prompts/index.js
CHANGED
|
@@ -2,25 +2,69 @@ import * as os from "node:os";
|
|
|
2
2
|
import { isGitRepository } from "../utils/gitUtils.js";
|
|
3
3
|
import { buildAutoMemoryPrompt } from "./autoMemory.js";
|
|
4
4
|
import { EXPLORE_SUBAGENT_TYPE, PLAN_SUBAGENT_TYPE, } from "../constants/subagents.js";
|
|
5
|
-
import { ASK_USER_QUESTION_TOOL_NAME, EDIT_TOOL_NAME, WRITE_TOOL_NAME, EXIT_PLAN_MODE_TOOL_NAME, AGENT_TOOL_NAME, } from "../constants/tools.js";
|
|
5
|
+
import { ASK_USER_QUESTION_TOOL_NAME, EDIT_TOOL_NAME, WRITE_TOOL_NAME, EXIT_PLAN_MODE_TOOL_NAME, AGENT_TOOL_NAME, BASH_TOOL_NAME, READ_TOOL_NAME, GLOB_TOOL_NAME, GREP_TOOL_NAME, } from "../constants/tools.js";
|
|
6
6
|
export const MAX_PARALLEL_TOOL_CALLS = 3;
|
|
7
|
-
export const BASE_SYSTEM_PROMPT = `You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
7
|
+
export const BASE_SYSTEM_PROMPT = `You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.`;
|
|
8
|
+
export const DOING_TASKS_PROMPT = `# Doing tasks
|
|
9
|
+
- The user will primarily request you to perform software engineering tasks. These may include solving bugs, adding new functionality, refactoring code, explaining code, and more. When given an unclear or generic instruction, consider it in the context of these software engineering tasks and the current working directory. For example, if the user asks you to change "methodName" to snake case, do not reply with just "method_name", instead find the method in the code and modify the code.
|
|
10
|
+
- You are highly capable and often allow users to complete ambitious tasks that would otherwise be too complex or take too long. You should defer to user judgement about whether a task is too large to attempt.
|
|
11
|
+
- If you notice the user's request is based on a misconception, or spot a bug adjacent to what they asked about, say so. You're a collaborator, not just an executor—users benefit from your judgment, not just your compliance.
|
|
12
|
+
- In general, do not propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.
|
|
13
|
+
- Do not create files unless they're absolutely necessary for achieving your goal. Generally prefer editing an existing file to creating a new one, as this prevents file bloat and builds on existing work more effectively.
|
|
14
|
+
- If an approach fails, diagnose why before switching tactics—read the error, check your assumptions, try a focused fix. Don't retry the identical action blindly, but don't abandon a viable approach after a single failure either. Escalate to the user with ${ASK_USER_QUESTION_TOOL_NAME} only when you're genuinely stuck after investigation, not as a first response to friction.
|
|
15
|
+
- Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it. Prioritize writing safe, secure, and correct code.
|
|
13
16
|
- Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.
|
|
14
17
|
- Don't add features, refactor code, or make "improvements" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability. Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.
|
|
15
18
|
- Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code.
|
|
16
|
-
- Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is the
|
|
17
|
-
- Avoid backwards-compatibility hacks like renaming unused
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
- Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is what the task actually requires—no speculative abstractions, but no half-finished implementations either. Three similar lines of code is better than a premature abstraction.
|
|
20
|
+
- Avoid backwards-compatibility hacks like renaming unused _vars, re-exporting types, adding // removed comments for removed code, etc. If you are certain that something is unused, you can delete it completely.
|
|
21
|
+
- Report outcomes faithfully: if tests fail, say so with the relevant output; if you did not run a verification step, say that rather than implying it succeeded. Never claim "all tests pass" when output shows failures, never suppress or simplify failing checks (tests, lints, type errors) to manufacture a green result, and never characterize incomplete or broken work as done. Equally, when a check did pass or a task is complete, state it plainly — do not hedge confirmed results with unnecessary disclaimers, downgrade finished work to "partial," or re-verify things you already checked. The goal is an accurate report, not a defensive one.
|
|
22
|
+
- Before reporting a task complete, verify it actually works: run the test, execute the script, check the output. Minimum complexity means no gold-plating, not skipping the finish line. If you can't verify (no test exists, can't run the code), say so explicitly rather than claiming success.`;
|
|
23
|
+
export const EXECUTING_ACTIONS_PROMPT = `# Executing actions with care
|
|
24
|
+
|
|
25
|
+
Carefully consider the reversibility and blast radius of actions. Generally you can freely take local, reversible actions like editing files or running tests. But for actions that are hard to reverse, affect shared systems beyond your local environment, or could otherwise be risky or destructive, check with the user before proceeding. The cost of pausing to confirm is low, while the cost of an unwanted action (lost work, unintended messages sent, deleted branches) can be very high. For actions like these, consider the context, the action, and user instructions, and by default transparently communicate the action and ask for confirmation before proceeding.
|
|
26
|
+
|
|
27
|
+
Examples of the kind of risky actions that warrant user confirmation:
|
|
28
|
+
- Destructive operations: deleting files/branches, dropping database tables, killing processes, rm -rf, overwriting uncommitted changes
|
|
29
|
+
- Hard-to-reverse operations: force-pushing (can also overwrite upstream), git reset --hard, amending published commits, removing or downgrading packages/dependencies, modifying CI/CD pipelines
|
|
30
|
+
- Actions visible to others or that affect shared state: pushing code, creating/closing/commenting on PRs or issues, sending messages (Slack, email, GitHub), posting to external services
|
|
31
|
+
|
|
32
|
+
When you encounter an obstacle, do not use destructive actions as a shortcut to simply make it go away. For instance, try to identify root causes and fix underlying issues rather than bypassing safety checks (e.g. --no-verify). If you discover unexpected state like unfamiliar files, branches, or configuration, investigate before deleting or overwriting, as it may represent the user's in-progress work. For example, typically resolve merge conflicts rather than discarding changes. In short: only take risky actions carefully, and when in doubt, ask before acting. Follow both the spirit and letter of these instructions - measure twice, cut once.`;
|
|
33
|
+
export const TOOL_POLICY = `# Using your tools
|
|
34
|
+
|
|
35
|
+
- Do NOT use the ${BASH_TOOL_NAME} to run commands when a relevant dedicated tool is provided. Using dedicated tools allows the user to better understand and review your work. This is CRITICAL to assisting the user:
|
|
36
|
+
- To read files use ${READ_TOOL_NAME} instead of cat, head, tail, or sed
|
|
37
|
+
- To edit files use ${EDIT_TOOL_NAME} instead of sed or awk
|
|
38
|
+
- To create files use ${WRITE_TOOL_NAME} instead of cat with heredoc or echo redirection
|
|
39
|
+
- To search for files use ${GLOB_TOOL_NAME} instead of find or ls
|
|
40
|
+
- To search the content of files, use ${GREP_TOOL_NAME} instead of grep or rg
|
|
41
|
+
- Reserve using the ${BASH_TOOL_NAME} exclusively for system commands and terminal operations that require shell execution. If you are unsure and there is a relevant dedicated tool, default to using the dedicated tool and only fallback on using the ${BASH_TOOL_NAME} tool for these if it is absolutely necessary.
|
|
20
42
|
- You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency.
|
|
21
43
|
- **Limit**: You MUST NOT call more than ${MAX_PARALLEL_TOOL_CALLS} tools in parallel in a single response.
|
|
22
44
|
- However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially. For instance, if one operation must complete before another starts, run these operations sequentially instead. Never use placeholders or guess missing parameters in tool calls.
|
|
23
45
|
- If the user specifies that they want you to run tools "in parallel", you MUST send a single message with multiple tool use content blocks.`;
|
|
46
|
+
/**
|
|
47
|
+
* Reference: /home/liuyiqi/github/claude-code/src/constants/prompts.ts getOutputEfficiencySection
|
|
48
|
+
*/
|
|
49
|
+
export const OUTPUT_EFFICIENCY_PROMPT = `# Output efficiency
|
|
50
|
+
|
|
51
|
+
IMPORTANT: Go straight to the point. Try the simplest approach first without going in circles. Do not overdo it. Be extra concise.
|
|
52
|
+
|
|
53
|
+
Keep your text output brief and direct. Lead with the answer or action, not the reasoning. Skip filler words, preamble, and unnecessary transitions. Do not restate what the user said — just do it. When explaining, include only what is necessary for the user to understand.
|
|
54
|
+
|
|
55
|
+
Focus text output on:
|
|
56
|
+
- Decisions that need the user's input
|
|
57
|
+
- High-level status updates at natural milestones
|
|
58
|
+
- Errors or blockers that change the plan
|
|
59
|
+
|
|
60
|
+
If you can say it in one sentence, don't use three. Prefer short, direct sentences over long explanations. This does not apply to code or tool calls.`;
|
|
61
|
+
export const TONE_AND_STYLE_PROMPT = `# Tone and style
|
|
62
|
+
|
|
63
|
+
- Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.
|
|
64
|
+
- Your responses should be short and concise.
|
|
65
|
+
- When referencing specific functions or pieces of code include the pattern file_path:line_number to allow the user to easily navigate to the source code location.
|
|
66
|
+
- When referencing GitHub issues or pull requests, use the owner/repo#123 format (e.g. anthropics/claude-code#100) so they render as clickable links.
|
|
67
|
+
- Do not use a colon before tool calls. Your tool calls may not be shown directly in the output, so text like "Let me read the file:" followed by a read tool call should just be "Let me read the file." with a period.`;
|
|
24
68
|
export function buildPlanModePrompt(planFilePath, planExists, isSubagent = false) {
|
|
25
69
|
const planFileInfo = planExists
|
|
26
70
|
? `A plan file already exists at ${planFilePath}. You can read it and make incremental edits using the ${EDIT_TOOL_NAME} tool if you need to.`
|
|
@@ -134,9 +178,13 @@ If you don't know the answer, say so - do not offer to look it up or investigate
|
|
|
134
178
|
Simply answer the question with the information you have.`;
|
|
135
179
|
export function buildSystemPrompt(basePrompt, tools, options = {}) {
|
|
136
180
|
let prompt = basePrompt || DEFAULT_SYSTEM_PROMPT;
|
|
181
|
+
prompt += `\n\n${DOING_TASKS_PROMPT}`;
|
|
182
|
+
prompt += `\n\n${EXECUTING_ACTIONS_PROMPT}`;
|
|
137
183
|
if (tools.length > 0) {
|
|
138
184
|
prompt += `\n\n${TOOL_POLICY}`;
|
|
139
185
|
}
|
|
186
|
+
prompt += `\n\n${OUTPUT_EFFICIENCY_PROMPT}`;
|
|
187
|
+
prompt += `\n\n${TONE_AND_STYLE_PROMPT}`;
|
|
140
188
|
if (options.permissionMode === "dontAsk") {
|
|
141
189
|
prompt += `\n\n# Permission Mode\nThe user has selected the 'dontAsk' permission mode. In this mode, any restricted tool call that does not match a pre-approved rule in 'permissions.allow' or 'temporaryRules' will be automatically denied without prompting the user. You will receive a 'Permission denied' error for such calls. This is intended to prevent interruptions for untrusted tools while allowing pre-approved ones to run seamlessly.`;
|
|
142
190
|
}
|
|
@@ -151,6 +199,12 @@ export function buildSystemPrompt(basePrompt, tools, options = {}) {
|
|
|
151
199
|
const platform = os.platform();
|
|
152
200
|
const osVersion = `${os.type()} ${os.release()}`;
|
|
153
201
|
const today = new Date().toISOString().split("T")[0];
|
|
202
|
+
const shell = process.env.SHELL || "unknown";
|
|
203
|
+
const shellName = shell.includes("zsh")
|
|
204
|
+
? "zsh"
|
|
205
|
+
: shell.includes("bash")
|
|
206
|
+
? "bash"
|
|
207
|
+
: shell;
|
|
154
208
|
prompt += `
|
|
155
209
|
|
|
156
210
|
Here is useful information about the environment you are running in:
|
|
@@ -158,6 +212,7 @@ Here is useful information about the environment you are running in:
|
|
|
158
212
|
Working directory: ${options.workdir}
|
|
159
213
|
Is directory a git repo: ${isGitRepo}
|
|
160
214
|
Platform: ${platform}
|
|
215
|
+
Shell: ${shellName}
|
|
161
216
|
OS Version: ${osVersion}
|
|
162
217
|
Today's date: ${today}
|
|
163
218
|
</env>
|
|
@@ -174,3 +229,34 @@ Today's date: ${today}
|
|
|
174
229
|
}
|
|
175
230
|
return prompt;
|
|
176
231
|
}
|
|
232
|
+
export function enhanceSystemPromptWithEnvDetails(existingSystemPrompt, workdir) {
|
|
233
|
+
const isGitRepo = isGitRepository(workdir);
|
|
234
|
+
const platform = os.platform();
|
|
235
|
+
const osVersion = `${os.type()} ${os.release()}`;
|
|
236
|
+
const today = new Date().toISOString().split("T")[0];
|
|
237
|
+
const shell = process.env.SHELL || "unknown";
|
|
238
|
+
const shellName = shell.includes("zsh")
|
|
239
|
+
? "zsh"
|
|
240
|
+
: shell.includes("bash")
|
|
241
|
+
? "bash"
|
|
242
|
+
: shell;
|
|
243
|
+
const notes = `Notes:
|
|
244
|
+
- Agent threads always have their cwd reset between bash calls, as a result please only use absolute file paths.
|
|
245
|
+
- In your final response, share file paths (always absolute, never relative) that are relevant to the task. Include code snippets only when the exact text is load-bearing (e.g., a bug you found, a function signature the caller asked for) — do not recap code you merely read.
|
|
246
|
+
- For clear communication with the user the assistant MUST avoid using emojis.
|
|
247
|
+
- Do not use a colon before tool calls. Text like "Let me read the file:" followed by a read tool call should just be "Let me read the file." with a period.`;
|
|
248
|
+
return `${existingSystemPrompt}
|
|
249
|
+
|
|
250
|
+
${notes}
|
|
251
|
+
|
|
252
|
+
Here is useful information about the environment you are running in:
|
|
253
|
+
<env>
|
|
254
|
+
Working directory: ${workdir}
|
|
255
|
+
Is directory a git repo: ${isGitRepo}
|
|
256
|
+
Platform: ${platform}
|
|
257
|
+
Shell: ${shellName}
|
|
258
|
+
OS Version: ${osVersion}
|
|
259
|
+
Today's date: ${today}
|
|
260
|
+
</env>
|
|
261
|
+
`;
|
|
262
|
+
}
|
|
@@ -97,7 +97,7 @@ export declare class ConfigurationService {
|
|
|
97
97
|
*/
|
|
98
98
|
setModel(model: string): void;
|
|
99
99
|
/**
|
|
100
|
-
* Get all configured models from settings.json and
|
|
100
|
+
* Get all configured models from settings.json and environment
|
|
101
101
|
*/
|
|
102
102
|
getConfiguredModels(): string[];
|
|
103
103
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurationService.d.ts","sourceRoot":"","sources":["../../src/services/configurationService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,EACN,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAE7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,WAAW,EAGX,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAGvC;;;;;GAKG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,GAAG,CAA8B;IACzC,OAAO,CAAC,OAAO,CAAoB;IAEnC;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAMvC;;OAEG;IACG,uBAAuB,CAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC;IA4DnC;;OAEG;IACH,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,gBAAgB;IAqKlE;;OAEG;IACH,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB;IAwC7D;;;OAGG;IACH,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAIrD;;OAEG;IACH,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAQ5C;;;;;;;;;;OAUG;IACH,oBAAoB,CAClB,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,YAAY,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,EAC5C,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,GAC7B,aAAa;IAqEhB;;;;;;;;OAQG;IACH,kBAAkB,CAChB,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,cAAc,GAC9B,WAAW;
|
|
1
|
+
{"version":3,"file":"configurationService.d.ts","sourceRoot":"","sources":["../../src/services/configurationService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,EACN,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAE7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,WAAW,EAGX,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAGvC;;;;;G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ED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GACd,iBAAiB,GAAG,IAAI,CAoJ1B"}
|
|
@@ -356,17 +356,31 @@ export class ConfigurationService {
|
|
|
356
356
|
* @returns Resolved model configuration with defaults
|
|
357
357
|
*/
|
|
358
358
|
resolveModelConfig(model, fastModel, maxTokens, permissionMode) {
|
|
359
|
-
//
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
359
|
+
// Resolve agent model: override > options > env (settings.json) > process.env
|
|
360
|
+
const resolvedAgentModel = model ||
|
|
361
|
+
this.options.model ||
|
|
362
|
+
this.env.WAVE_MODEL ||
|
|
363
|
+
process.env.WAVE_MODEL;
|
|
364
|
+
// Resolve fast model: override > options > env (settings.json) > process.env
|
|
365
|
+
const resolvedFastModel = fastModel ||
|
|
366
|
+
this.options.fastModel ||
|
|
367
|
+
this.env.WAVE_FAST_MODEL ||
|
|
368
|
+
process.env.WAVE_FAST_MODEL;
|
|
369
|
+
// Validate required fields
|
|
370
|
+
if (!resolvedAgentModel) {
|
|
371
|
+
throw new ConfigurationError(CONFIG_ERRORS.MISSING_MODEL, "model", {
|
|
372
|
+
constructor: model,
|
|
373
|
+
environment: process.env.WAVE_MODEL,
|
|
374
|
+
settings: this.env.WAVE_MODEL,
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
if (!resolvedFastModel) {
|
|
378
|
+
throw new ConfigurationError(CONFIG_ERRORS.MISSING_FAST_MODEL, "fastModel", {
|
|
379
|
+
constructor: fastModel,
|
|
380
|
+
environment: process.env.WAVE_FAST_MODEL,
|
|
381
|
+
settings: this.env.WAVE_FAST_MODEL,
|
|
382
|
+
});
|
|
383
|
+
}
|
|
370
384
|
// Resolve max output tokens
|
|
371
385
|
const resolvedMaxTokens = this.resolveMaxOutputTokens(maxTokens);
|
|
372
386
|
const baseConfig = {
|
|
@@ -483,13 +497,10 @@ export class ConfigurationService {
|
|
|
483
497
|
this.options.model = model;
|
|
484
498
|
}
|
|
485
499
|
/**
|
|
486
|
-
* Get all configured models from settings.json and
|
|
500
|
+
* Get all configured models from settings.json and environment
|
|
487
501
|
*/
|
|
488
502
|
getConfiguredModels() {
|
|
489
|
-
const DEFAULT_AGENT_MODEL = "gemini-3-flash";
|
|
490
503
|
const models = new Set();
|
|
491
|
-
// Add default model
|
|
492
|
-
models.add(DEFAULT_AGENT_MODEL);
|
|
493
504
|
// Add current model from options or environment
|
|
494
505
|
const currentModel = this.options.model || this.env.WAVE_MODEL || process.env.WAVE_MODEL;
|
|
495
506
|
if (currentModel) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bashTool.d.ts","sourceRoot":"","sources":["../../src/tools/bashTool.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAsDtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"bashTool.d.ts","sourceRoot":"","sources":["../../src/tools/bashTool.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAsDtE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAgbtB,CAAC"}
|
package/dist/tools/bashTool.js
CHANGED
|
@@ -104,8 +104,8 @@ Usage notes:
|
|
|
104
104
|
- You can use the \`run_in_background\` parameter to run the command in the background, which allows you to continue working while the command runs. You can monitor the output using the ${READ_TOOL_NAME} tool as it becomes available. You do not need to use '&' at the end of the command when using this parameter.
|
|
105
105
|
- Avoid using ${BASH_TOOL_NAME} with the \`find\`, \`sed\`, \`awk\`, or \`echo\` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated tools for these commands:
|
|
106
106
|
- File search: Use ${GLOB_TOOL_NAME} (NOT find or ls)
|
|
107
|
-
- Content search: Use ${GREP_TOOL_NAME}
|
|
108
|
-
- Read files: Use ${READ_TOOL_NAME}
|
|
107
|
+
- Content search: Use ${GREP_TOOL_NAME} (NOT grep or rg)
|
|
108
|
+
- Read files: Use ${READ_TOOL_NAME} (NOT cat/head/tail)
|
|
109
109
|
- Edit files: Use ${EDIT_TOOL_NAME} (NOT sed/awk)
|
|
110
110
|
- Write files: Use ${WRITE_TOOL_NAME} (NOT echo >/cat <<EOF)
|
|
111
111
|
- Communication: Output text directly (NOT echo/printf)
|
|
@@ -123,7 +123,28 @@ Usage notes:
|
|
|
123
123
|
</bad-example>
|
|
124
124
|
|
|
125
125
|
- Reserve bash tools exclusively for actual system commands and terminal operations that require shell execution. NEVER use bash echo or other command-line tools to communicate thoughts, explanations, or instructions to the user. Output all communication directly in your response text instead.
|
|
126
|
-
- When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run "git status" and "git diff", send a single message with two tool calls in parallel
|
|
126
|
+
- When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run "git status" and "git diff", send a single message with two tool calls in parallel.
|
|
127
|
+
|
|
128
|
+
# Git operations
|
|
129
|
+
Git Safety Protocol:
|
|
130
|
+
- NEVER update the git config
|
|
131
|
+
- NEVER run destructive git commands (push --force, reset --hard, checkout ., restore ., clean -f, branch -D) unless the user explicitly requests these actions. Taking unauthorized destructive actions is unhelpful and can result in lost work, so it's best to ONLY run these commands when given direct instructions
|
|
132
|
+
- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
|
|
133
|
+
- NEVER run force push to main/master, warn the user if they request it
|
|
134
|
+
- CRITICAL: Always create NEW commits rather than amending, unless the user explicitly requests a git amend. When a pre-commit hook fails, the commit did NOT happen — so --amend would modify the PREVIOUS commit, which may result in destroying work or losing previous changes. Instead, after hook failure, fix the issue, re-stage, and create a NEW commit
|
|
135
|
+
- When staging files, prefer adding specific files by name rather than using "git add -A" or "git add .", which can accidentally include sensitive files (.env, credentials) or large binaries
|
|
136
|
+
- NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive
|
|
137
|
+
- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
|
|
138
|
+
|
|
139
|
+
Use the gh command via the Bash tool for GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed.
|
|
140
|
+
|
|
141
|
+
# Avoid unnecessary sleep commands
|
|
142
|
+
- Do not sleep between commands that can run immediately — just run them.
|
|
143
|
+
- If your command is long running and you would like to be notified when it finishes — use \`run_in_background\`. No sleep needed.
|
|
144
|
+
- Do not retry failing commands in a sleep loop — diagnose the root cause.
|
|
145
|
+
- If waiting for a background task you started with \`run_in_background\`, you will be notified when it completes — do not poll.
|
|
146
|
+
- If you must poll an external process, use a check command (e.g. \`gh run view\`) rather than sleeping first.
|
|
147
|
+
- If you must sleep, keep the duration short (1-5 seconds) to avoid blocking the user.`,
|
|
127
148
|
execute: async (args, context) => {
|
|
128
149
|
const command = args.command;
|
|
129
150
|
const runInBackground = args.run_in_background;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeTool.d.ts","sourceRoot":"","sources":["../../src/tools/writeTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAItE;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"writeTool.d.ts","sourceRoot":"","sources":["../../src/tools/writeTool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAItE;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,UAiNvB,CAAC"}
|
package/dist/tools/writeTool.js
CHANGED
|
@@ -117,6 +117,12 @@ Usage:
|
|
|
117
117
|
// Record snapshot for reversion
|
|
118
118
|
let snapshotId;
|
|
119
119
|
if (context.reversionManager && context.messageId) {
|
|
120
|
+
// Log memory usage before large operations if in debug mode
|
|
121
|
+
if (process.env.LOG_LEVEL === "DEBUG") {
|
|
122
|
+
const usage = process.memoryUsage();
|
|
123
|
+
logger.debug(`[Memory Before Write] RSS: ${Math.round(usage.rss / 1024 / 1024)}MB, ` +
|
|
124
|
+
`Heap: ${Math.round(usage.heapUsed / 1024 / 1024)}/${Math.round(usage.heapTotal / 1024 / 1024)}MB`, { filePath, contentLength: content.length });
|
|
125
|
+
}
|
|
120
126
|
snapshotId = await context.reversionManager.recordSnapshot(context.messageId, resolvedPath, isExistingFile ? "modify" : "create");
|
|
121
127
|
}
|
|
122
128
|
// Write file
|
package/dist/types/core.d.ts
CHANGED
|
@@ -77,6 +77,8 @@ export declare class ConfigurationError extends Error {
|
|
|
77
77
|
}
|
|
78
78
|
export declare const CONFIG_ERRORS: {
|
|
79
79
|
readonly MISSING_BASE_URL: "Gateway configuration requires baseURL. Provide via constructor or WAVE_BASE_URL environment variable.";
|
|
80
|
+
readonly MISSING_MODEL: "Agent configuration requires model. Provide via constructor or WAVE_MODEL environment variable.";
|
|
81
|
+
readonly MISSING_FAST_MODEL: "Agent configuration requires fastModel. Provide via constructor or WAVE_FAST_MODEL environment variable.";
|
|
80
82
|
readonly INVALID_WAVE_MAX_INPUT_TOKENS: "Token limit must be a positive integer.";
|
|
81
83
|
readonly EMPTY_BASE_URL: "Base URL cannot be empty string.";
|
|
82
84
|
};
|
package/dist/types/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,IA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;IAEjC;;;OAGG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IAErC;;OAEG;IACH,cAAc,CAAC,EAAE;QACf,0CAA0C;QAC1C,yBAAyB,EAAE,MAAM,CAAC;QAClC,wCAAwC;QACxC,yBAAyB,EAAE,MAAM,CAAC;KACnC,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;aAGzB,KAAK,EAAE,MAAM;aACb,QAAQ,CAAC,EAAE,OAAO;gBAFlC,OAAO,EAAE,MAAM,EACC,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,OAAO,YAAA;CAKrC;AAGD,eAAO,MAAM,aAAa;;;;;;CAShB,CAAC"}
|
package/dist/types/core.js
CHANGED
|
@@ -13,6 +13,8 @@ export class ConfigurationError extends Error {
|
|
|
13
13
|
// Standard error messages
|
|
14
14
|
export const CONFIG_ERRORS = {
|
|
15
15
|
MISSING_BASE_URL: "Gateway configuration requires baseURL. Provide via constructor or WAVE_BASE_URL environment variable.",
|
|
16
|
+
MISSING_MODEL: "Agent configuration requires model. Provide via constructor or WAVE_MODEL environment variable.",
|
|
17
|
+
MISSING_FAST_MODEL: "Agent configuration requires fastModel. Provide via constructor or WAVE_FAST_MODEL environment variable.",
|
|
16
18
|
INVALID_WAVE_MAX_INPUT_TOKENS: "Token limit must be a positive integer.",
|
|
17
19
|
EMPTY_BASE_URL: "Base URL cannot be empty string.",
|
|
18
20
|
};
|
package/package.json
CHANGED
|
@@ -531,12 +531,6 @@ export class AIManager {
|
|
|
531
531
|
);
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
|
-
if (
|
|
535
|
-
result.response_headers &&
|
|
536
|
-
Object.keys(result.response_headers).length > 0
|
|
537
|
-
) {
|
|
538
|
-
logger?.debug("AI response headers:", result.response_headers);
|
|
539
|
-
}
|
|
540
534
|
|
|
541
535
|
if (
|
|
542
536
|
result.additionalFields &&
|
package/src/prompts/index.ts
CHANGED
|
@@ -13,29 +13,81 @@ import {
|
|
|
13
13
|
WRITE_TOOL_NAME,
|
|
14
14
|
EXIT_PLAN_MODE_TOOL_NAME,
|
|
15
15
|
AGENT_TOOL_NAME,
|
|
16
|
+
BASH_TOOL_NAME,
|
|
17
|
+
READ_TOOL_NAME,
|
|
18
|
+
GLOB_TOOL_NAME,
|
|
19
|
+
GREP_TOOL_NAME,
|
|
16
20
|
} from "../constants/tools.js";
|
|
17
21
|
|
|
18
22
|
export const MAX_PARALLEL_TOOL_CALLS = 3;
|
|
19
23
|
|
|
20
|
-
export const BASE_SYSTEM_PROMPT = `You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user
|
|
24
|
+
export const BASE_SYSTEM_PROMPT = `You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.`;
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
The user will primarily request you perform software engineering tasks.
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
+
export const DOING_TASKS_PROMPT = `# Doing tasks
|
|
27
|
+
- The user will primarily request you to perform software engineering tasks. These may include solving bugs, adding new functionality, refactoring code, explaining code, and more. When given an unclear or generic instruction, consider it in the context of these software engineering tasks and the current working directory. For example, if the user asks you to change "methodName" to snake case, do not reply with just "method_name", instead find the method in the code and modify the code.
|
|
28
|
+
- You are highly capable and often allow users to complete ambitious tasks that would otherwise be too complex or take too long. You should defer to user judgement about whether a task is too large to attempt.
|
|
29
|
+
- If you notice the user's request is based on a misconception, or spot a bug adjacent to what they asked about, say so. You're a collaborator, not just an executor—users benefit from your judgment, not just your compliance.
|
|
30
|
+
- In general, do not propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.
|
|
31
|
+
- Do not create files unless they're absolutely necessary for achieving your goal. Generally prefer editing an existing file to creating a new one, as this prevents file bloat and builds on existing work more effectively.
|
|
32
|
+
- If an approach fails, diagnose why before switching tactics—read the error, check your assumptions, try a focused fix. Don't retry the identical action blindly, but don't abandon a viable approach after a single failure either. Escalate to the user with ${ASK_USER_QUESTION_TOOL_NAME} only when you're genuinely stuck after investigation, not as a first response to friction.
|
|
33
|
+
- Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it. Prioritize writing safe, secure, and correct code.
|
|
26
34
|
- Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.
|
|
27
35
|
- Don't add features, refactor code, or make "improvements" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability. Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.
|
|
28
36
|
- Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code.
|
|
29
|
-
- Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is the
|
|
30
|
-
- Avoid backwards-compatibility hacks like renaming unused
|
|
37
|
+
- Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is what the task actually requires—no speculative abstractions, but no half-finished implementations either. Three similar lines of code is better than a premature abstraction.
|
|
38
|
+
- Avoid backwards-compatibility hacks like renaming unused _vars, re-exporting types, adding // removed comments for removed code, etc. If you are certain that something is unused, you can delete it completely.
|
|
39
|
+
- Report outcomes faithfully: if tests fail, say so with the relevant output; if you did not run a verification step, say that rather than implying it succeeded. Never claim "all tests pass" when output shows failures, never suppress or simplify failing checks (tests, lints, type errors) to manufacture a green result, and never characterize incomplete or broken work as done. Equally, when a check did pass or a task is complete, state it plainly — do not hedge confirmed results with unnecessary disclaimers, downgrade finished work to "partial," or re-verify things you already checked. The goal is an accurate report, not a defensive one.
|
|
40
|
+
- Before reporting a task complete, verify it actually works: run the test, execute the script, check the output. Minimum complexity means no gold-plating, not skipping the finish line. If you can't verify (no test exists, can't run the code), say so explicitly rather than claiming success.`;
|
|
31
41
|
|
|
32
|
-
export const
|
|
33
|
-
|
|
42
|
+
export const EXECUTING_ACTIONS_PROMPT = `# Executing actions with care
|
|
43
|
+
|
|
44
|
+
Carefully consider the reversibility and blast radius of actions. Generally you can freely take local, reversible actions like editing files or running tests. But for actions that are hard to reverse, affect shared systems beyond your local environment, or could otherwise be risky or destructive, check with the user before proceeding. The cost of pausing to confirm is low, while the cost of an unwanted action (lost work, unintended messages sent, deleted branches) can be very high. For actions like these, consider the context, the action, and user instructions, and by default transparently communicate the action and ask for confirmation before proceeding.
|
|
45
|
+
|
|
46
|
+
Examples of the kind of risky actions that warrant user confirmation:
|
|
47
|
+
- Destructive operations: deleting files/branches, dropping database tables, killing processes, rm -rf, overwriting uncommitted changes
|
|
48
|
+
- Hard-to-reverse operations: force-pushing (can also overwrite upstream), git reset --hard, amending published commits, removing or downgrading packages/dependencies, modifying CI/CD pipelines
|
|
49
|
+
- Actions visible to others or that affect shared state: pushing code, creating/closing/commenting on PRs or issues, sending messages (Slack, email, GitHub), posting to external services
|
|
50
|
+
|
|
51
|
+
When you encounter an obstacle, do not use destructive actions as a shortcut to simply make it go away. For instance, try to identify root causes and fix underlying issues rather than bypassing safety checks (e.g. --no-verify). If you discover unexpected state like unfamiliar files, branches, or configuration, investigate before deleting or overwriting, as it may represent the user's in-progress work. For example, typically resolve merge conflicts rather than discarding changes. In short: only take risky actions carefully, and when in doubt, ask before acting. Follow both the spirit and letter of these instructions - measure twice, cut once.`;
|
|
52
|
+
|
|
53
|
+
export const TOOL_POLICY = `# Using your tools
|
|
54
|
+
|
|
55
|
+
- Do NOT use the ${BASH_TOOL_NAME} to run commands when a relevant dedicated tool is provided. Using dedicated tools allows the user to better understand and review your work. This is CRITICAL to assisting the user:
|
|
56
|
+
- To read files use ${READ_TOOL_NAME} instead of cat, head, tail, or sed
|
|
57
|
+
- To edit files use ${EDIT_TOOL_NAME} instead of sed or awk
|
|
58
|
+
- To create files use ${WRITE_TOOL_NAME} instead of cat with heredoc or echo redirection
|
|
59
|
+
- To search for files use ${GLOB_TOOL_NAME} instead of find or ls
|
|
60
|
+
- To search the content of files, use ${GREP_TOOL_NAME} instead of grep or rg
|
|
61
|
+
- Reserve using the ${BASH_TOOL_NAME} exclusively for system commands and terminal operations that require shell execution. If you are unsure and there is a relevant dedicated tool, default to using the dedicated tool and only fallback on using the ${BASH_TOOL_NAME} tool for these if it is absolutely necessary.
|
|
34
62
|
- You can call multiple tools in a single response. If you intend to call multiple tools and there are no dependencies between them, make all independent tool calls in parallel. Maximize use of parallel tool calls where possible to increase efficiency.
|
|
35
63
|
- **Limit**: You MUST NOT call more than ${MAX_PARALLEL_TOOL_CALLS} tools in parallel in a single response.
|
|
36
64
|
- However, if some tool calls depend on previous calls to inform dependent values, do NOT call these tools in parallel and instead call them sequentially. For instance, if one operation must complete before another starts, run these operations sequentially instead. Never use placeholders or guess missing parameters in tool calls.
|
|
37
65
|
- If the user specifies that they want you to run tools "in parallel", you MUST send a single message with multiple tool use content blocks.`;
|
|
38
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Reference: /home/liuyiqi/github/claude-code/src/constants/prompts.ts getOutputEfficiencySection
|
|
69
|
+
*/
|
|
70
|
+
export const OUTPUT_EFFICIENCY_PROMPT = `# Output efficiency
|
|
71
|
+
|
|
72
|
+
IMPORTANT: Go straight to the point. Try the simplest approach first without going in circles. Do not overdo it. Be extra concise.
|
|
73
|
+
|
|
74
|
+
Keep your text output brief and direct. Lead with the answer or action, not the reasoning. Skip filler words, preamble, and unnecessary transitions. Do not restate what the user said — just do it. When explaining, include only what is necessary for the user to understand.
|
|
75
|
+
|
|
76
|
+
Focus text output on:
|
|
77
|
+
- Decisions that need the user's input
|
|
78
|
+
- High-level status updates at natural milestones
|
|
79
|
+
- Errors or blockers that change the plan
|
|
80
|
+
|
|
81
|
+
If you can say it in one sentence, don't use three. Prefer short, direct sentences over long explanations. This does not apply to code or tool calls.`;
|
|
82
|
+
|
|
83
|
+
export const TONE_AND_STYLE_PROMPT = `# Tone and style
|
|
84
|
+
|
|
85
|
+
- Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.
|
|
86
|
+
- Your responses should be short and concise.
|
|
87
|
+
- When referencing specific functions or pieces of code include the pattern file_path:line_number to allow the user to easily navigate to the source code location.
|
|
88
|
+
- When referencing GitHub issues or pull requests, use the owner/repo#123 format (e.g. anthropics/claude-code#100) so they render as clickable links.
|
|
89
|
+
- Do not use a colon before tool calls. Your tool calls may not be shown directly in the output, so text like "Let me read the file:" followed by a read tool call should just be "Let me read the file." with a period.`;
|
|
90
|
+
|
|
39
91
|
export function buildPlanModePrompt(
|
|
40
92
|
planFilePath: string,
|
|
41
93
|
planExists: boolean,
|
|
@@ -177,10 +229,16 @@ export function buildSystemPrompt(
|
|
|
177
229
|
} = {},
|
|
178
230
|
): string {
|
|
179
231
|
let prompt = basePrompt || DEFAULT_SYSTEM_PROMPT;
|
|
232
|
+
prompt += `\n\n${DOING_TASKS_PROMPT}`;
|
|
233
|
+
prompt += `\n\n${EXECUTING_ACTIONS_PROMPT}`;
|
|
234
|
+
|
|
180
235
|
if (tools.length > 0) {
|
|
181
236
|
prompt += `\n\n${TOOL_POLICY}`;
|
|
182
237
|
}
|
|
183
238
|
|
|
239
|
+
prompt += `\n\n${OUTPUT_EFFICIENCY_PROMPT}`;
|
|
240
|
+
prompt += `\n\n${TONE_AND_STYLE_PROMPT}`;
|
|
241
|
+
|
|
184
242
|
if (options.permissionMode === "dontAsk") {
|
|
185
243
|
prompt += `\n\n# Permission Mode\nThe user has selected the 'dontAsk' permission mode. In this mode, any restricted tool call that does not match a pre-approved rule in 'permissions.allow' or 'temporaryRules' will be automatically denied without prompting the user. You will receive a 'Permission denied' error for such calls. This is intended to prevent interruptions for untrusted tools while allowing pre-approved ones to run seamlessly.`;
|
|
186
244
|
}
|
|
@@ -198,6 +256,12 @@ export function buildSystemPrompt(
|
|
|
198
256
|
const platform = os.platform();
|
|
199
257
|
const osVersion = `${os.type()} ${os.release()}`;
|
|
200
258
|
const today = new Date().toISOString().split("T")[0];
|
|
259
|
+
const shell = process.env.SHELL || "unknown";
|
|
260
|
+
const shellName = shell.includes("zsh")
|
|
261
|
+
? "zsh"
|
|
262
|
+
: shell.includes("bash")
|
|
263
|
+
? "bash"
|
|
264
|
+
: shell;
|
|
201
265
|
|
|
202
266
|
prompt += `
|
|
203
267
|
|
|
@@ -206,6 +270,7 @@ Here is useful information about the environment you are running in:
|
|
|
206
270
|
Working directory: ${options.workdir}
|
|
207
271
|
Is directory a git repo: ${isGitRepo}
|
|
208
272
|
Platform: ${platform}
|
|
273
|
+
Shell: ${shellName}
|
|
209
274
|
OS Version: ${osVersion}
|
|
210
275
|
Today's date: ${today}
|
|
211
276
|
</env>
|
|
@@ -225,3 +290,40 @@ Today's date: ${today}
|
|
|
225
290
|
|
|
226
291
|
return prompt;
|
|
227
292
|
}
|
|
293
|
+
|
|
294
|
+
export function enhanceSystemPromptWithEnvDetails(
|
|
295
|
+
existingSystemPrompt: string,
|
|
296
|
+
workdir: string,
|
|
297
|
+
): string {
|
|
298
|
+
const isGitRepo = isGitRepository(workdir);
|
|
299
|
+
const platform = os.platform();
|
|
300
|
+
const osVersion = `${os.type()} ${os.release()}`;
|
|
301
|
+
const today = new Date().toISOString().split("T")[0];
|
|
302
|
+
const shell = process.env.SHELL || "unknown";
|
|
303
|
+
const shellName = shell.includes("zsh")
|
|
304
|
+
? "zsh"
|
|
305
|
+
: shell.includes("bash")
|
|
306
|
+
? "bash"
|
|
307
|
+
: shell;
|
|
308
|
+
|
|
309
|
+
const notes = `Notes:
|
|
310
|
+
- Agent threads always have their cwd reset between bash calls, as a result please only use absolute file paths.
|
|
311
|
+
- In your final response, share file paths (always absolute, never relative) that are relevant to the task. Include code snippets only when the exact text is load-bearing (e.g., a bug you found, a function signature the caller asked for) — do not recap code you merely read.
|
|
312
|
+
- For clear communication with the user the assistant MUST avoid using emojis.
|
|
313
|
+
- Do not use a colon before tool calls. Text like "Let me read the file:" followed by a read tool call should just be "Let me read the file." with a period.`;
|
|
314
|
+
|
|
315
|
+
return `${existingSystemPrompt}
|
|
316
|
+
|
|
317
|
+
${notes}
|
|
318
|
+
|
|
319
|
+
Here is useful information about the environment you are running in:
|
|
320
|
+
<env>
|
|
321
|
+
Working directory: ${workdir}
|
|
322
|
+
Is directory a git repo: ${isGitRepo}
|
|
323
|
+
Platform: ${platform}
|
|
324
|
+
Shell: ${shellName}
|
|
325
|
+
OS Version: ${osVersion}
|
|
326
|
+
Today's date: ${today}
|
|
327
|
+
</env>
|
|
328
|
+
`;
|
|
329
|
+
}
|
|
@@ -458,22 +458,40 @@ export class ConfigurationService {
|
|
|
458
458
|
maxTokens?: number,
|
|
459
459
|
permissionMode?: PermissionMode,
|
|
460
460
|
): ModelConfig {
|
|
461
|
-
//
|
|
462
|
-
const
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
461
|
+
// Resolve agent model: override > options > env (settings.json) > process.env
|
|
462
|
+
const resolvedAgentModel =
|
|
463
|
+
model ||
|
|
464
|
+
this.options.model ||
|
|
465
|
+
this.env.WAVE_MODEL ||
|
|
466
|
+
process.env.WAVE_MODEL;
|
|
467
|
+
|
|
468
|
+
// Resolve fast model: override > options > env (settings.json) > process.env
|
|
469
|
+
const resolvedFastModel =
|
|
470
|
+
fastModel ||
|
|
471
|
+
this.options.fastModel ||
|
|
472
|
+
this.env.WAVE_FAST_MODEL ||
|
|
473
|
+
process.env.WAVE_FAST_MODEL;
|
|
474
|
+
|
|
475
|
+
// Validate required fields
|
|
476
|
+
if (!resolvedAgentModel) {
|
|
477
|
+
throw new ConfigurationError(CONFIG_ERRORS.MISSING_MODEL, "model", {
|
|
478
|
+
constructor: model,
|
|
479
|
+
environment: process.env.WAVE_MODEL,
|
|
480
|
+
settings: this.env.WAVE_MODEL,
|
|
481
|
+
});
|
|
482
|
+
}
|
|
474
483
|
|
|
475
|
-
resolvedFastModel
|
|
476
|
-
|
|
484
|
+
if (!resolvedFastModel) {
|
|
485
|
+
throw new ConfigurationError(
|
|
486
|
+
CONFIG_ERRORS.MISSING_FAST_MODEL,
|
|
487
|
+
"fastModel",
|
|
488
|
+
{
|
|
489
|
+
constructor: fastModel,
|
|
490
|
+
environment: process.env.WAVE_FAST_MODEL,
|
|
491
|
+
settings: this.env.WAVE_FAST_MODEL,
|
|
492
|
+
},
|
|
493
|
+
);
|
|
494
|
+
}
|
|
477
495
|
|
|
478
496
|
// Resolve max output tokens
|
|
479
497
|
const resolvedMaxTokens = this.resolveMaxOutputTokens(maxTokens);
|
|
@@ -616,15 +634,11 @@ export class ConfigurationService {
|
|
|
616
634
|
}
|
|
617
635
|
|
|
618
636
|
/**
|
|
619
|
-
* Get all configured models from settings.json and
|
|
637
|
+
* Get all configured models from settings.json and environment
|
|
620
638
|
*/
|
|
621
639
|
getConfiguredModels(): string[] {
|
|
622
|
-
const DEFAULT_AGENT_MODEL = "gemini-3-flash";
|
|
623
640
|
const models = new Set<string>();
|
|
624
641
|
|
|
625
|
-
// Add default model
|
|
626
|
-
models.add(DEFAULT_AGENT_MODEL);
|
|
627
|
-
|
|
628
642
|
// Add current model from options or environment
|
|
629
643
|
const currentModel =
|
|
630
644
|
this.options.model || this.env.WAVE_MODEL || process.env.WAVE_MODEL;
|
package/src/tools/bashTool.ts
CHANGED
|
@@ -122,8 +122,8 @@ Usage notes:
|
|
|
122
122
|
- You can use the \`run_in_background\` parameter to run the command in the background, which allows you to continue working while the command runs. You can monitor the output using the ${READ_TOOL_NAME} tool as it becomes available. You do not need to use '&' at the end of the command when using this parameter.
|
|
123
123
|
- Avoid using ${BASH_TOOL_NAME} with the \`find\`, \`sed\`, \`awk\`, or \`echo\` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated tools for these commands:
|
|
124
124
|
- File search: Use ${GLOB_TOOL_NAME} (NOT find or ls)
|
|
125
|
-
- Content search: Use ${GREP_TOOL_NAME}
|
|
126
|
-
- Read files: Use ${READ_TOOL_NAME}
|
|
125
|
+
- Content search: Use ${GREP_TOOL_NAME} (NOT grep or rg)
|
|
126
|
+
- Read files: Use ${READ_TOOL_NAME} (NOT cat/head/tail)
|
|
127
127
|
- Edit files: Use ${EDIT_TOOL_NAME} (NOT sed/awk)
|
|
128
128
|
- Write files: Use ${WRITE_TOOL_NAME} (NOT echo >/cat <<EOF)
|
|
129
129
|
- Communication: Output text directly (NOT echo/printf)
|
|
@@ -141,7 +141,28 @@ Usage notes:
|
|
|
141
141
|
</bad-example>
|
|
142
142
|
|
|
143
143
|
- Reserve bash tools exclusively for actual system commands and terminal operations that require shell execution. NEVER use bash echo or other command-line tools to communicate thoughts, explanations, or instructions to the user. Output all communication directly in your response text instead.
|
|
144
|
-
- When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run "git status" and "git diff", send a single message with two tool calls in parallel
|
|
144
|
+
- When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run "git status" and "git diff", send a single message with two tool calls in parallel.
|
|
145
|
+
|
|
146
|
+
# Git operations
|
|
147
|
+
Git Safety Protocol:
|
|
148
|
+
- NEVER update the git config
|
|
149
|
+
- NEVER run destructive git commands (push --force, reset --hard, checkout ., restore ., clean -f, branch -D) unless the user explicitly requests these actions. Taking unauthorized destructive actions is unhelpful and can result in lost work, so it's best to ONLY run these commands when given direct instructions
|
|
150
|
+
- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
|
|
151
|
+
- NEVER run force push to main/master, warn the user if they request it
|
|
152
|
+
- CRITICAL: Always create NEW commits rather than amending, unless the user explicitly requests a git amend. When a pre-commit hook fails, the commit did NOT happen — so --amend would modify the PREVIOUS commit, which may result in destroying work or losing previous changes. Instead, after hook failure, fix the issue, re-stage, and create a NEW commit
|
|
153
|
+
- When staging files, prefer adding specific files by name rather than using "git add -A" or "git add .", which can accidentally include sensitive files (.env, credentials) or large binaries
|
|
154
|
+
- NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive
|
|
155
|
+
- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
|
|
156
|
+
|
|
157
|
+
Use the gh command via the Bash tool for GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed.
|
|
158
|
+
|
|
159
|
+
# Avoid unnecessary sleep commands
|
|
160
|
+
- Do not sleep between commands that can run immediately — just run them.
|
|
161
|
+
- If your command is long running and you would like to be notified when it finishes — use \`run_in_background\`. No sleep needed.
|
|
162
|
+
- Do not retry failing commands in a sleep loop — diagnose the root cause.
|
|
163
|
+
- If waiting for a background task you started with \`run_in_background\`, you will be notified when it completes — do not poll.
|
|
164
|
+
- If you must poll an external process, use a check command (e.g. \`gh run view\`) rather than sleeping first.
|
|
165
|
+
- If you must sleep, keep the duration short (1-5 seconds) to avoid blocking the user.`,
|
|
145
166
|
execute: async (
|
|
146
167
|
args: Record<string, unknown>,
|
|
147
168
|
context: ToolContext,
|
package/src/tools/writeTool.ts
CHANGED
|
@@ -142,6 +142,16 @@ Usage:
|
|
|
142
142
|
// Record snapshot for reversion
|
|
143
143
|
let snapshotId: string | undefined;
|
|
144
144
|
if (context.reversionManager && context.messageId) {
|
|
145
|
+
// Log memory usage before large operations if in debug mode
|
|
146
|
+
if (process.env.LOG_LEVEL === "DEBUG") {
|
|
147
|
+
const usage = process.memoryUsage();
|
|
148
|
+
logger.debug(
|
|
149
|
+
`[Memory Before Write] RSS: ${Math.round(usage.rss / 1024 / 1024)}MB, ` +
|
|
150
|
+
`Heap: ${Math.round(usage.heapUsed / 1024 / 1024)}/${Math.round(usage.heapTotal / 1024 / 1024)}MB`,
|
|
151
|
+
{ filePath, contentLength: content.length },
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
145
155
|
snapshotId = await context.reversionManager.recordSnapshot(
|
|
146
156
|
context.messageId,
|
|
147
157
|
resolvedPath,
|
package/src/types/core.ts
CHANGED
|
@@ -98,6 +98,10 @@ export class ConfigurationError extends Error {
|
|
|
98
98
|
export const CONFIG_ERRORS = {
|
|
99
99
|
MISSING_BASE_URL:
|
|
100
100
|
"Gateway configuration requires baseURL. Provide via constructor or WAVE_BASE_URL environment variable.",
|
|
101
|
+
MISSING_MODEL:
|
|
102
|
+
"Agent configuration requires model. Provide via constructor or WAVE_MODEL environment variable.",
|
|
103
|
+
MISSING_FAST_MODEL:
|
|
104
|
+
"Agent configuration requires fastModel. Provide via constructor or WAVE_FAST_MODEL environment variable.",
|
|
101
105
|
INVALID_WAVE_MAX_INPUT_TOKENS: "Token limit must be a positive integer.",
|
|
102
106
|
EMPTY_BASE_URL: "Base URL cannot be empty string.",
|
|
103
107
|
} as const;
|