wave-agent-sdk 0.18.7 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/builtin/skills/settings/ENV.md +0 -1
  2. package/builtin/skills/settings/HOOKS.md +10 -0
  3. package/builtin/skills/settings/MODELS.md +37 -0
  4. package/builtin/skills/settings/SKILLS.md +6 -4
  5. package/dist/agent.d.ts.map +1 -1
  6. package/dist/agent.js +12 -5
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -0
  10. package/dist/managers/aiManager.d.ts.map +1 -1
  11. package/dist/managers/aiManager.js +20 -4
  12. package/dist/managers/mcpManager.d.ts.map +1 -1
  13. package/dist/managers/mcpManager.js +7 -2
  14. package/dist/managers/messageManager.d.ts +3 -5
  15. package/dist/managers/messageManager.d.ts.map +1 -1
  16. package/dist/managers/messageManager.js +17 -77
  17. package/dist/managers/skillManager.d.ts +1 -0
  18. package/dist/managers/skillManager.d.ts.map +1 -1
  19. package/dist/managers/skillManager.js +11 -2
  20. package/dist/prompts/index.d.ts +3 -2
  21. package/dist/prompts/index.d.ts.map +1 -1
  22. package/dist/prompts/index.js +5 -1
  23. package/dist/services/aiService.d.ts.map +1 -1
  24. package/dist/services/aiService.js +13 -9
  25. package/dist/services/configurationService.d.ts.map +1 -1
  26. package/dist/services/configurationService.js +22 -9
  27. package/dist/services/hook.d.ts.map +1 -1
  28. package/dist/services/hook.js +6 -0
  29. package/dist/services/initializationService.d.ts.map +1 -1
  30. package/dist/services/initializationService.js +1 -1
  31. package/dist/services/interactionService.js +1 -1
  32. package/dist/services/reversionService.d.ts +5 -1
  33. package/dist/services/reversionService.d.ts.map +1 -1
  34. package/dist/services/reversionService.js +50 -22
  35. package/dist/services/session.d.ts +4 -13
  36. package/dist/services/session.d.ts.map +1 -1
  37. package/dist/services/session.js +59 -215
  38. package/dist/telemetry/sessionTracing.d.ts +14 -4
  39. package/dist/telemetry/sessionTracing.d.ts.map +1 -1
  40. package/dist/telemetry/sessionTracing.js +134 -8
  41. package/dist/tools/bashTool.d.ts.map +1 -1
  42. package/dist/tools/bashTool.js +16 -1
  43. package/dist/types/config.d.ts +7 -0
  44. package/dist/types/config.d.ts.map +1 -1
  45. package/dist/types/hooks.d.ts +1 -0
  46. package/dist/types/hooks.d.ts.map +1 -1
  47. package/dist/types/messaging.d.ts +0 -1
  48. package/dist/types/messaging.d.ts.map +1 -1
  49. package/dist/types/skills.d.ts +1 -0
  50. package/dist/types/skills.d.ts.map +1 -1
  51. package/dist/types/telemetry.d.ts +14 -1
  52. package/dist/types/telemetry.d.ts.map +1 -1
  53. package/dist/utils/atomicWrite.d.ts +15 -0
  54. package/dist/utils/atomicWrite.d.ts.map +1 -0
  55. package/dist/utils/atomicWrite.js +59 -0
  56. package/dist/utils/cacheControlUtils.d.ts +3 -15
  57. package/dist/utils/cacheControlUtils.d.ts.map +1 -1
  58. package/dist/utils/cacheControlUtils.js +4 -35
  59. package/dist/utils/containerSetup.d.ts.map +1 -1
  60. package/dist/utils/containerSetup.js +5 -1
  61. package/dist/utils/convertMessagesForAPI.d.ts +9 -1
  62. package/dist/utils/convertMessagesForAPI.d.ts.map +1 -1
  63. package/dist/utils/convertMessagesForAPI.js +74 -55
  64. package/dist/utils/mcpUtils.d.ts.map +1 -1
  65. package/dist/utils/mcpUtils.js +2 -1
  66. package/dist/utils/modelCapabilities.d.ts +22 -0
  67. package/dist/utils/modelCapabilities.d.ts.map +1 -0
  68. package/dist/utils/modelCapabilities.js +24 -0
  69. package/dist/utils/skillParser.d.ts.map +1 -1
  70. package/dist/utils/skillParser.js +3 -1
  71. package/package.json +1 -1
  72. package/src/agent.ts +11 -5
  73. package/src/index.ts +1 -0
  74. package/src/managers/aiManager.ts +22 -2
  75. package/src/managers/mcpManager.ts +8 -2
  76. package/src/managers/messageManager.ts +22 -104
  77. package/src/managers/skillManager.ts +16 -2
  78. package/src/prompts/index.ts +6 -1
  79. package/src/services/aiService.ts +12 -5
  80. package/src/services/configurationService.ts +24 -24
  81. package/src/services/hook.ts +7 -0
  82. package/src/services/initializationService.ts +1 -3
  83. package/src/services/interactionService.ts +1 -1
  84. package/src/services/reversionService.ts +50 -27
  85. package/src/services/session.ts +63 -262
  86. package/src/telemetry/sessionTracing.ts +167 -12
  87. package/src/tools/bashTool.ts +23 -1
  88. package/src/types/config.ts +8 -0
  89. package/src/types/hooks.ts +1 -0
  90. package/src/types/messaging.ts +0 -1
  91. package/src/types/skills.ts +1 -0
  92. package/src/types/telemetry.ts +17 -1
  93. package/src/utils/atomicWrite.ts +61 -0
  94. package/src/utils/cacheControlUtils.ts +5 -38
  95. package/src/utils/containerSetup.ts +5 -1
  96. package/src/utils/convertMessagesForAPI.ts +87 -57
  97. package/src/utils/mcpUtils.ts +2 -1
  98. package/src/utils/modelCapabilities.ts +30 -0
  99. package/src/utils/skillParser.ts +3 -1
@@ -25,6 +25,8 @@ export class SkillManager extends EventEmitter {
25
25
  options.personalSkillsPath || join(homedir(), ".wave", "skills");
26
26
  this.personalClaudeSkillsPath =
27
27
  options.personalClaudeSkillsPath || join(homedir(), ".claude", "skills");
28
+ this.personalAgentsSkillsPath =
29
+ options.personalAgentsSkillsPath || join(homedir(), ".agents", "skills");
28
30
  this.scanTimeout = options.scanTimeout || 5000;
29
31
  this.workdir = options.workdir || process.cwd();
30
32
  this.watchEnabled = options.watch ?? false;
@@ -92,8 +94,10 @@ export class SkillManager extends EventEmitter {
92
94
  const pathsToWatch = [
93
95
  this.personalSkillsPath,
94
96
  this.personalClaudeSkillsPath,
97
+ this.personalAgentsSkillsPath,
95
98
  join(this.workdir, ".wave", "skills"),
96
99
  join(this.workdir, ".claude", "skills"),
100
+ join(this.workdir, ".agents", "skills"),
97
101
  ];
98
102
  logger?.debug(`Setting up skill watcher for: ${pathsToWatch.join(", ")}`);
99
103
  for (const pathToWatch of pathsToWatch) {
@@ -167,18 +171,21 @@ export class SkillManager extends EventEmitter {
167
171
  */
168
172
  async discoverSkills() {
169
173
  const builtinCollection = await this.discoverSkillCollection(getBuiltinSkillsDir(), "builtin");
174
+ const personalAgentsCollection = await this.discoverSkillCollection(this.personalAgentsSkillsPath, "personal");
170
175
  const personalClaudeCollection = await this.discoverSkillCollection(this.personalClaudeSkillsPath, "personal");
171
176
  const personalCollection = await this.discoverSkillCollection(this.personalSkillsPath, "personal");
172
177
  const projectCollection = await this.discoverSkillCollection(this.workdir, "project");
173
178
  return {
174
179
  builtinSkills: builtinCollection.skills,
175
180
  personalSkills: new Map([
176
- ...personalClaudeCollection.skills,
181
+ ...personalAgentsCollection.skills, // lowest priority
182
+ ...personalClaudeCollection.skills, // overrides .agents
177
183
  ...personalCollection.skills, // .wave overrides .claude
178
184
  ]),
179
185
  projectSkills: projectCollection.skills,
180
186
  errors: [
181
187
  ...builtinCollection.errors,
188
+ ...personalAgentsCollection.errors,
182
189
  ...personalClaudeCollection.errors,
183
190
  ...personalCollection.errors,
184
191
  ...projectCollection.errors,
@@ -196,9 +203,11 @@ export class SkillManager extends EventEmitter {
196
203
  errors: [],
197
204
  };
198
205
  if (type === "project") {
199
- // Scan .claude/skills first, then .wave/skills (wave overrides)
206
+ // Scan .agents/skills first, then .claude/skills, then .wave/skills (wave overrides)
207
+ const agentsPath = join(basePath, ".agents", "skills");
200
208
  const claudePath = join(basePath, ".claude", "skills");
201
209
  const wavePath = join(basePath, ".wave", "skills");
210
+ await this.scanSkillPath(agentsPath, collection);
202
211
  await this.scanSkillPath(claudePath, collection);
203
212
  await this.scanSkillPath(wavePath, collection);
204
213
  }
@@ -1,5 +1,6 @@
1
1
  import { ToolPlugin } from "../tools/types.js";
2
- 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.";
2
+ export declare const BASE_SYSTEM_PROMPT = "You are a coding agent developed by NetEase that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.";
3
+ export declare const MODEL_IDENTITY_PROMPT = "# Model identity\n\nIf asked about your model, model version, underlying architecture, or product name, identify yourself simply as a coding agent developed by NetEase. Do not reveal the specific model ID, model family, model provider, or product name. Do not mention or hint at any of these details.";
3
4
  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.";
4
5
  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.";
5
6
  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 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- 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.";
@@ -9,7 +10,7 @@ export declare const TOOL_POLICY = "# Using your tools\n\n- Do NOT use the Bash
9
10
  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.";
10
11
  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.";
11
12
  export declare function buildPlanModePrompt(planFilePath: string, planExists: boolean, isSubagent?: boolean): string;
12
- 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.";
13
+ export declare const DEFAULT_SYSTEM_PROMPT = "You are a coding agent developed by NetEase that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.";
13
14
  /**
14
15
  * A block of the system prompt with cacheability metadata.
15
16
  * Static blocks (cacheable: true) get cache_control markers for Claude models.
@@ -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;AAoB/C,eAAO,MAAM,kBAAkB,oKAAoK,CAAC;AAEpM,eAAO,MAAM,kBAAkB,opIAcqQ,CAAC;AAErS,eAAO,MAAM,wBAAwB,25DASqmB,CAAC;AAE3oB,eAAO,MAAM,WAAW,ihDAWqH,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;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,8BAA8B,44DA8CI,CAAC;AAEhD,eAAO,MAAM,yBAAyB,wHAAwH,CA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AO,CAAC;CACpB;AAED,eAAO,MAAM,8BAA8B,44DA8CI,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,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACE,GACL,iBAAiB,EAAE,CA+DrB;AAED,wBAAgB,iCAAiC,CAC/C,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM,EACf,eAAe,CAAC,EAAE,MAAM,GACvB,MAAM,CAkCR"}
@@ -4,7 +4,10 @@ import { getCurrentWorktreeSession } from "../utils/worktreeSession.js";
4
4
  import { buildAutoMemoryPrompt } from "./autoMemory.js";
5
5
  import { EXPLORE_SUBAGENT_TYPE, PLAN_SUBAGENT_TYPE, } from "../constants/subagents.js";
6
6
  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";
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.`;
7
+ export const BASE_SYSTEM_PROMPT = `You are a coding agent developed by NetEase that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.`;
8
+ export const MODEL_IDENTITY_PROMPT = `# Model identity
9
+
10
+ If asked about your model, model version, underlying architecture, or product name, identify yourself simply as a coding agent developed by NetEase. Do not reveal the specific model ID, model family, model provider, or product name. Do not mention or hint at any of these details.`;
8
11
  export const DOING_TASKS_PROMPT = `# Doing tasks
9
12
  - 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
13
  - 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.
@@ -209,6 +212,7 @@ export function buildSystemPrompt(basePrompt, tools, options = {}) {
209
212
  }
210
213
  staticText += `\n\n${OUTPUT_EFFICIENCY_PROMPT}`;
211
214
  staticText += `\n\n${TONE_AND_STYLE_PROMPT}`;
215
+ staticText += `\n\n${MODEL_IDENTITY_PROMPT}`;
212
216
  const blocks = [{ text: staticText, cacheable: true }];
213
217
  // --- Dynamic block (not cacheable) ---
214
218
  let dynamicText = "";
@@ -1 +1 @@
1
- {"version":3,"file":"aiService.d.ts","sourceRoot":"","sources":["../../src/services/aiService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAGL,0BAA0B,EAC1B,0BAA0B,EAE3B,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EAIL,KAAK,WAAW,EAEjB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAuD7B;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AA6DD,MAAM,WAAW,gBAAgB;IAE/B,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,WAAW,CAAC;IAGzB,QAAQ,EAAE,0BAA0B,EAAE,CA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Client } from "../utils/openaiClient.js";
2
2
  import { logger } from "../utils/globalLogger.js";
3
3
  import { addOnceAbortListener } from "../utils/abortUtils.js";
4
4
  import { ConfigurationError, CONFIG_ERRORS } from "../types/index.js";
5
- import { transformMessagesForExplicitCache, supportsPromptCaching, extendUsageWithCacheMetrics, } from "../utils/cacheControlUtils.js";
5
+ import { transformMessagesForExplicitCache, extendUsageWithCacheMetrics, } from "../utils/cacheControlUtils.js";
6
+ import { supportsPromptCaching } from "../utils/modelCapabilities.js";
6
7
  import * as os from "os";
7
8
  import * as fs from "fs";
8
9
  import * as path from "path";
@@ -102,12 +103,11 @@ export async function callAgent(options) {
102
103
  fetch: gatewayConfig.fetch,
103
104
  });
104
105
  // Determine model early (needed for system prompt construction)
105
- const currentModel = model || modelConfig.model;
106
106
  const resolvedMaxTokens = options.maxTokens ?? modelConfig.maxTokens;
107
107
  // Build system message content
108
108
  let systemMessage;
109
109
  if (Array.isArray(systemPrompt)) {
110
- if (supportsPromptCaching(currentModel)) {
110
+ if (supportsPromptCaching(modelConfig.capabilities)) {
111
111
  // For Claude models, map blocks to content parts with cache_control on cacheable blocks
112
112
  const contentParts = systemPrompt.map((block) => {
113
113
  const part = {
@@ -141,15 +141,16 @@ export async function callAgent(options) {
141
141
  // ChatCompletionMessageParam[] is already in OpenAI format, add system prompt to the beginning
142
142
  openaiMessages = [systemMessage, ...messages];
143
143
  processedTools = tools;
144
- if (supportsPromptCaching(currentModel)) {
145
- openaiMessages = transformMessagesForExplicitCache(openaiMessages, currentModel);
144
+ if (supportsPromptCaching(modelConfig.capabilities)) {
145
+ openaiMessages = transformMessagesForExplicitCache(openaiMessages, modelConfig.capabilities);
146
146
  }
147
147
  // Get model configuration - use injected modelConfig with optional override
148
- const { model: _model, fastModel: _fastModel, maxTokens: _maxTokens, permissionMode: _permissionMode, ...extraParams } = modelConfig;
148
+ const { model: _model, fastModel: _fastModel, maxTokens: _maxTokens, permissionMode: _permissionMode, capabilities: _capabilities, ...extraParams } = modelConfig;
149
149
  void _model;
150
150
  void _fastModel;
151
151
  void _maxTokens;
152
152
  void _permissionMode;
153
+ void _capabilities;
153
154
  const openaiModelConfig = getModelConfig(model || modelConfig.model, {
154
155
  max_tokens: resolvedMaxTokens,
155
156
  ...extraParams,
@@ -522,11 +523,12 @@ export async function compactMessages(options) {
522
523
  fetch: gatewayConfig.fetch,
523
524
  });
524
525
  // Get model configuration - use injected agent model
525
- const { model: _model, fastModel: _fastModel, maxTokens: _maxTokens, permissionMode: _permissionMode, fastModelConfig: _fastModelConfig, ...extraParams } = modelConfig;
526
+ const { model: _model, fastModel: _fastModel, maxTokens: _maxTokens, permissionMode: _permissionMode, capabilities: _capabilities, fastModelConfig: _fastModelConfig, ...extraParams } = modelConfig;
526
527
  void _model;
527
528
  void _fastModel;
528
529
  void _maxTokens;
529
530
  void _permissionMode;
531
+ void _capabilities;
530
532
  // When a fast model override is provided, use the fast model's hyperparams
531
533
  // (if configured); otherwise fall back to the agent model's extraParams.
532
534
  const activeExtraParams = options.model
@@ -599,11 +601,12 @@ export async function processWebContent(options) {
599
601
  fetch: gatewayConfig.fetch,
600
602
  });
601
603
  // Get model configuration - use injected agent model
602
- const { model: _model, fastModel: _fastModel, maxTokens: _maxTokens, permissionMode: _permissionMode, fastModelConfig: _fastModelConfig, ...extraParams } = modelConfig;
604
+ const { model: _model, fastModel: _fastModel, maxTokens: _maxTokens, permissionMode: _permissionMode, capabilities: _capabilities, fastModelConfig: _fastModelConfig, ...extraParams } = modelConfig;
603
605
  void _model;
604
606
  void _fastModel;
605
607
  void _maxTokens;
606
608
  void _permissionMode;
609
+ void _capabilities;
607
610
  // When a fast model override is provided, use the fast model's hyperparams
608
611
  // (if configured); otherwise fall back to the agent model's extraParams.
609
612
  const activeExtraParams = options.model
@@ -673,11 +676,12 @@ export async function btw(options) {
673
676
  fetch: gatewayConfig.fetch,
674
677
  });
675
678
  // Get model configuration - use injected agent model
676
- const { model: _model, fastModel: _fastModel, maxTokens: _maxTokens, permissionMode: _permissionMode, ...extraParams } = modelConfig;
679
+ const { model: _model, fastModel: _fastModel, maxTokens: _maxTokens, permissionMode: _permissionMode, capabilities: _capabilities, ...extraParams } = modelConfig;
677
680
  void _model;
678
681
  void _fastModel;
679
682
  void _maxTokens;
680
683
  void _permissionMode;
684
+ void _capabilities;
681
685
  const openaiModelConfig = getModelConfig(options.model || modelConfig.model, {
682
686
  temperature: 0.1,
683
687
  max_tokens: 4096,
@@ -1 +1 @@
1
- {"version":3,"file":"configurationService.d.ts","sourceRoot":"","sources":["../../src/services/configurationService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,EACL,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAE7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AASvC;;;;;GAKG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,kBAAkB,CAAqB;IAE/C;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAMvC;;OAEG;IACG,uBAAuB,CAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC;IAkEnC;;OAEG;IACH,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,gBAAgB;IAkLlE;;OAEG;IACH,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB;IAwC7D;;;OAGG;IACH,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAA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AAE,uBAA4B,GACpC,wBAAwB,CAoC1B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,GACf,iBAAiB,GAAG,IAAI,CA+B1B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GACd,iBAAiB,GAAG,IAAI,CA0K1B"}
1
+ {"version":3,"file":"configurationService.d.ts","sourceRoot":"","sources":["../../src/services/configurationService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,EACL,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAE7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAUvC;;;;;GAKG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,kBAAkB,CAAqB;IAE/C;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAMvC;;OAEG;IACG,uBAAuB,CAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC;IAkEnC;;OAEG;IACH,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,GAAG,gBAAgB;IAkLlE;;OAEG;IACH,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB;IAwC7D;;;OAGG;IACH,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAcrD;;OAEG;IACH,OAAO,CAAC,YA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AgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,GACf,iBAAiB,GAAG,IAAI,CA4C1B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GACd,iBAAiB,GAAG,IAAI,CA0K1B"}
@@ -16,6 +16,7 @@ import { parseCustomHeaders } from "../utils/stringUtils.js";
16
16
  import { getRemoteSettingsSync, mergeRemoteSettings, } from "./remoteSettingsService.js";
17
17
  import { createAuthAwareFetch } from "./authService.js";
18
18
  import { ensureWaveRuntimeFilesExcluded } from "../utils/gitUtils.js";
19
+ import { atomicWriteFile } from "../utils/atomicWrite.js";
19
20
  /**
20
21
  * Default ConfigurationService implementation
21
22
  *
@@ -425,11 +426,12 @@ export class ConfigurationService {
425
426
  const fastModelConfigSource = resolvedFastModel &&
426
427
  this.currentConfiguration?.models?.[resolvedFastModel];
427
428
  if (fastModelConfigSource) {
428
- const { model: _fm, fastModel: _ffm, maxTokens: _fmt, permissionMode: _fpm, ...fastHyperparams } = fastModelConfigSource;
429
+ const { model: _fm, fastModel: _ffm, maxTokens: _fmt, permissionMode: _fpm, capabilities: _fcap, ...fastHyperparams } = fastModelConfigSource;
429
430
  void _fm;
430
431
  void _ffm;
431
432
  void _fmt;
432
433
  void _fpm;
434
+ void _fcap;
433
435
  baseConfig.fastModelConfig = fastHyperparams;
434
436
  }
435
437
  // Merge model-specific settings from configuration
@@ -581,7 +583,7 @@ export class ConfigurationService {
581
583
  }
582
584
  }
583
585
  config.model = model;
584
- await fs.writeFile(configPath, JSON.stringify(config, null, 2), "utf-8");
586
+ await atomicWriteFile(configPath, JSON.stringify(config, null, 2));
585
587
  }
586
588
  /**
587
589
  * Get all configured models from settings.json and environment
@@ -654,7 +656,7 @@ export class ConfigurationService {
654
656
  }
655
657
  if (!config.permissions.allow.includes(rule)) {
656
658
  config.permissions.allow.push(rule);
657
- await fs.writeFile(localConfigPath, JSON.stringify(config, null, 2), "utf-8");
659
+ await atomicWriteFile(localConfigPath, JSON.stringify(config, null, 2));
658
660
  }
659
661
  }
660
662
  /**
@@ -693,7 +695,7 @@ export class ConfigurationService {
693
695
  config.enabledPlugins = {};
694
696
  }
695
697
  config.enabledPlugins[pluginId] = enabled;
696
- await fs.writeFile(configPath, JSON.stringify(config, null, 2), "utf-8");
698
+ await atomicWriteFile(configPath, JSON.stringify(config, null, 2));
697
699
  }
698
700
  /**
699
701
  * Get merged marketplaces from all scopes
@@ -754,7 +756,7 @@ export class ConfigurationService {
754
756
  fileConfig.marketplaces = {};
755
757
  }
756
758
  fileConfig.marketplaces[name] = config;
757
- await fs.writeFile(configPath, JSON.stringify(fileConfig, null, 2), "utf-8");
759
+ await atomicWriteFile(configPath, JSON.stringify(fileConfig, null, 2));
758
760
  }
759
761
  /**
760
762
  * Remove a marketplace from the specified scope
@@ -781,7 +783,7 @@ export class ConfigurationService {
781
783
  const fileConfig = JSON.parse(content);
782
784
  if (fileConfig.marketplaces && name in fileConfig.marketplaces) {
783
785
  delete fileConfig.marketplaces[name];
784
- await fs.writeFile(configPath, JSON.stringify(fileConfig, null, 2), "utf-8");
786
+ await atomicWriteFile(configPath, JSON.stringify(fileConfig, null, 2));
785
787
  }
786
788
  }
787
789
  catch {
@@ -813,7 +815,7 @@ export class ConfigurationService {
813
815
  const config = JSON.parse(content);
814
816
  if (config.enabledPlugins && pluginId in config.enabledPlugins) {
815
817
  delete config.enabledPlugins[pluginId];
816
- await fs.writeFile(configPath, JSON.stringify(config, null, 2), "utf-8");
818
+ await atomicWriteFile(configPath, JSON.stringify(config, null, 2));
817
819
  }
818
820
  }
819
821
  catch {
@@ -927,6 +929,13 @@ export function loadWaveConfigFromFile(filePath) {
927
929
  }
928
930
  try {
929
931
  const content = readFileSync(filePath, "utf-8");
932
+ // Tolerate empty/whitespace-only files: a concurrent writer may have the
933
+ // file truncated mid-write. Returning null lets callers skip this source
934
+ // instead of crashing (consistent with the "file not found" path).
935
+ if (content.trim() === "") {
936
+ logger.warn(`Empty configuration file (likely mid-write): ${filePath}`);
937
+ return null;
938
+ }
930
939
  const config = JSON.parse(content);
931
940
  return {
932
941
  hooks: config.hooks || undefined,
@@ -944,9 +953,13 @@ export function loadWaveConfigFromFile(filePath) {
944
953
  }
945
954
  catch (error) {
946
955
  if (error instanceof SyntaxError) {
947
- throw new Error(`Invalid JSON syntax in ${filePath}: ${error.message}`);
956
+ // Tolerate corrupt JSON: a concurrent writer may leave the file in a
957
+ // partially-written state. Warn and return null so callers skip this
958
+ // source instead of crashing.
959
+ logger.warn(`Invalid JSON syntax in ${filePath}: ${error.message}`);
960
+ return null;
948
961
  }
949
- // Re-throw validation errors and other errors as-is
962
+ // Re-throw other errors as-is
950
963
  throw error;
951
964
  }
952
965
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/services/hook.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAElC,MAAM,mBAAmB,CAAC;AAgG3B;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CA6I9B;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAchC;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAMhC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAsBtD"}
1
+ {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/services/hook.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAElC,MAAM,mBAAmB,CAAC;AAuG3B;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CA6I9B;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAchC;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAMhC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAsBtD"}
@@ -62,6 +62,12 @@ async function buildHookJsonInput(context) {
62
62
  jsonInput.name = context.worktreeName;
63
63
  }
64
64
  }
65
+ // Add worktree_path field for WorktreeRemove events
66
+ if (context.event === "WorktreeRemove") {
67
+ if (context.worktreePath !== undefined) {
68
+ jsonInput.worktree_path = context.worktreePath;
69
+ }
70
+ }
65
71
  // Add SessionStart-specific fields
66
72
  if (context.event === "SessionStart") {
67
73
  if (context.source !== undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"initializationService.d.ts","sourceRoot":"","sources":["../../src/services/initializationService.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,OAAO,EACP,MAAM,EACN,YAAY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ACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,WAAW,EAAE,WAAW,CAAC;IACzB,wBAAwB,EAAE,MAAM,IAAI,CAAC;CACtC;AAED,qBAAa,qBAAqB;WACZ,UAAU,CAC5B,OAAO,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE;QACR,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;KACtB,GACA,OAAO,CAAC,IAAI,CAAC;CAkSjB"}
1
+ {"version":3,"file":"initializationService.d.ts","sourceRoot":"","sources":["../../src/services/initializationService.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,OAAO,EACP,MAAM,EACN,YAAY,EACZ,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,YAAY,CAAC;IAC3B,eAAe,EAAE,eAAe,CAAC;IACjC,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,YAAY,CAAC;IACtB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;IACxB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,WAAW,EAAE,WAAW,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,WAAW,EAAE,WAAW,CAAC;IACzB,wBAAwB,EAAE,MAAM,IAAI,CAAC;CACtC;AAED,qBAAa,qBAAqB;WACZ,UAAU,CAC5B,OAAO,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE;QACR,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;KACtB,GACA,OAAO,CAAC,IAAI,CAAC;CAgSjB"}
@@ -192,7 +192,7 @@ export class InitializationService {
192
192
  if (sessionToRestore) {
193
193
  messageManager.initializeFromSession(sessionToRestore);
194
194
  // Update task manager with the root session ID to ensure continuity across compactions
195
- taskManager.setTaskListId(sessionToRestore.rootSessionId || sessionToRestore.id);
195
+ taskManager.setTaskListId(sessionToRestore.id);
196
196
  // After session is initialized, load tasks for the session
197
197
  const tasks = await taskManager.listTasks();
198
198
  agentOptions.callbacks?.onTasksChange?.(tasks);
@@ -92,7 +92,7 @@ export class InteractionService {
92
92
  // 6. Initialize session state last
93
93
  messageManager.initializeFromSession(sessionData);
94
94
  // Update task manager with the root session ID to ensure continuity across compactions
95
- taskManager.setTaskListId(sessionData.rootSessionId || sessionData.id);
95
+ taskManager.setTaskListId(sessionData.id);
96
96
  // 7. Load tasks for the restored session
97
97
  const tasks = await taskManager.listTasks();
98
98
  options.callbacks?.onTasksChange?.(tasks);
@@ -5,7 +5,6 @@ export declare class ReversionService {
5
5
  constructor(rootSessionId: string);
6
6
  private getFilePathHash;
7
7
  private getNextVersion;
8
- private updateVersionsFile;
9
8
  /**
10
9
  * Saves a single snapshot to the file history directory.
11
10
  * Returns the snapshot path.
@@ -19,6 +18,11 @@ export declare class ReversionService {
19
18
  * Deletes all snapshots for this session.
20
19
  */
21
20
  deleteSessionHistory(): Promise<void>;
21
+ /**
22
+ * Cleans up session directories older than the given number of days.
23
+ * Skips the current session.
24
+ */
25
+ cleanupOldSessions(days?: number): Promise<void>;
22
26
  private ensureDirectory;
23
27
  }
24
28
  //# sourceMappingURL=reversionService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reversionService.d.ts","sourceRoot":"","sources":["../../src/services/reversionService.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,aAAa,CAAS;gBAElB,aAAa,EAAE,MAAM;IAUjC,OAAO,CAAC,eAAe;YAIT,cAAc;YAad,kBAAkB;IAOhC;;;OAGG;IACG,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAuB3D;;OAEG;IACG,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAWvE;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;YAI7B,eAAe;CAG9B"}
1
+ {"version":3,"file":"reversionService.d.ts","sourceRoot":"","sources":["../../src/services/reversionService.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,aAAa,CAAS;gBAElB,aAAa,EAAE,MAAM;IAUjC,OAAO,CAAC,eAAe;YAIT,cAAc;IAoB5B;;;OAGG;IACG,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAqB3D;;OAEG;IACG,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAWvE;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3C;;;OAGG;IACG,kBAAkB,CAAC,IAAI,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,CAAC;YAwB5C,eAAe;CAG9B"}
@@ -1,41 +1,44 @@
1
- import { readFile, writeFile, mkdir, rm } from "fs/promises";
2
- import { join } from "path";
1
+ import { readFile, writeFile, mkdir, rm, readdir, stat } from "fs/promises";
2
+ import { join, dirname } from "path";
3
3
  import { homedir } from "os";
4
4
  import { createHash } from "crypto";
5
5
  export class ReversionService {
6
6
  constructor(rootSessionId) {
7
- this.rootSessionId = rootSessionId;
8
- this.historyBaseDir = join(homedir(), ".wave", "file-history", rootSessionId || "default");
7
+ this.rootSessionId = rootSessionId || "default";
8
+ this.historyBaseDir = join(homedir(), ".wave", "file-history", this.rootSessionId);
9
9
  }
10
10
  getFilePathHash(filePath) {
11
- return createHash("md5").update(filePath).digest("hex");
11
+ return createHash("sha256").update(filePath).digest("hex").slice(0, 16);
12
12
  }
13
- async getNextVersion(fileHashDir) {
13
+ async getNextVersion(filePath) {
14
+ const hash = this.getFilePathHash(filePath);
15
+ const prefix = `${hash}@v`;
14
16
  try {
15
- const files = await readFile(join(fileHashDir, "versions"), "utf-8");
16
- const versions = files
17
- .split("\n")
18
- .map((v) => parseInt(v, 10))
19
- .filter((v) => !isNaN(v));
20
- return versions.length > 0 ? Math.max(...versions) + 1 : 1;
17
+ const files = await readdir(this.historyBaseDir);
18
+ let maxVersion = 0;
19
+ for (const file of files) {
20
+ if (file.startsWith(prefix)) {
21
+ const v = parseInt(file.slice(prefix.length), 10);
22
+ if (!isNaN(v) && v > maxVersion) {
23
+ maxVersion = v;
24
+ }
25
+ }
26
+ }
27
+ return maxVersion + 1;
21
28
  }
22
29
  catch {
23
30
  return 1;
24
31
  }
25
32
  }
26
- async updateVersionsFile(fileHashDir, version) {
27
- await appendFile(join(fileHashDir, "versions"), `${version}\n`, "utf-8");
28
- }
29
33
  /**
30
34
  * Saves a single snapshot to the file history directory.
31
35
  * Returns the snapshot path.
32
36
  */
33
37
  async saveSnapshot(snapshot) {
34
38
  const fileHash = this.getFilePathHash(snapshot.filePath);
35
- const fileHashDir = join(this.historyBaseDir, fileHash);
36
- await this.ensureDirectory(fileHashDir);
37
- const version = await this.getNextVersion(fileHashDir);
38
- const snapshotPath = join(fileHashDir, `v${version}`);
39
+ await this.ensureDirectory(this.historyBaseDir);
40
+ const version = await this.getNextVersion(snapshot.filePath);
41
+ const snapshotPath = join(this.historyBaseDir, `${fileHash}@v${version}`);
39
42
  const snapshotWithContent = snapshot;
40
43
  if (snapshotWithContent.content !== null) {
41
44
  await writeFile(snapshotPath, snapshotWithContent.content, "utf-8");
@@ -45,7 +48,6 @@ export class ReversionService {
45
48
  // The absence of the file at snapshotPath will indicate it should be deleted on reversion.
46
49
  return ""; // Return empty string to indicate no snapshot file
47
50
  }
48
- await this.updateVersionsFile(fileHashDir, version);
49
51
  return snapshotPath;
50
52
  }
51
53
  /**
@@ -68,9 +70,35 @@ export class ReversionService {
68
70
  async deleteSessionHistory() {
69
71
  await rm(this.historyBaseDir, { recursive: true, force: true });
70
72
  }
73
+ /**
74
+ * Cleans up session directories older than the given number of days.
75
+ * Skips the current session.
76
+ */
77
+ async cleanupOldSessions(days = 30) {
78
+ const threshold = Date.now() - days * 24 * 60 * 60 * 1000;
79
+ const parentDir = dirname(this.historyBaseDir);
80
+ try {
81
+ const entries = await readdir(parentDir);
82
+ await Promise.all(entries.map(async (entry) => {
83
+ if (entry === this.rootSessionId)
84
+ return;
85
+ const dirPath = join(parentDir, entry);
86
+ try {
87
+ const stats = await stat(dirPath);
88
+ if (stats.isDirectory() && stats.mtimeMs < threshold) {
89
+ await rm(dirPath, { recursive: true, force: true });
90
+ }
91
+ }
92
+ catch {
93
+ // ENOENT — concurrently deleted, skip
94
+ }
95
+ }));
96
+ }
97
+ catch {
98
+ // parent dir doesn't exist — nothing to clean
99
+ }
100
+ }
71
101
  async ensureDirectory(dirPath) {
72
102
  await mkdir(dirPath, { recursive: true });
73
103
  }
74
104
  }
75
- // Helper to avoid appendFile import error if not imported
76
- import { appendFile } from "fs/promises";
@@ -17,8 +17,6 @@
17
17
  import type { Message } from "../types/index.js";
18
18
  export interface SessionData {
19
19
  id: string;
20
- rootSessionId?: string;
21
- parentSessionId?: string;
22
20
  messages: Message[];
23
21
  metadata: {
24
22
  workdir: string;
@@ -28,8 +26,6 @@ export interface SessionData {
28
26
  }
29
27
  export interface SessionMetadata {
30
28
  id: string;
31
- rootSessionId?: string;
32
- parentSessionId?: string;
33
29
  sessionType: "main" | "subagent";
34
30
  subagentType?: string;
35
31
  workdir: string;
@@ -38,13 +34,6 @@ export interface SessionMetadata {
38
34
  latestTotalTokens: number;
39
35
  firstMessage?: string;
40
36
  }
41
- export interface SessionIndex {
42
- sessions: Record<string, Omit<SessionMetadata, "id" | "lastActiveAt" | "createdAt"> & {
43
- lastActiveAt: string;
44
- createdAt: string;
45
- }>;
46
- lastUpdated: string;
47
- }
48
37
  /**
49
38
  * Generate a new session ID using Node.js native crypto.randomUUID()
50
39
  * @returns UUID string for session identification
@@ -92,7 +81,7 @@ export declare function createSession(sessionId: string, workdir: string, sessio
92
81
  * @param workdir - Working directory for the session
93
82
  * @param sessionType - Type of session ("main" or "subagent", defaults to "main")
94
83
  */
95
- export declare function appendMessages(sessionId: string, newMessages: Message[], workdir: string, sessionType?: "main" | "subagent", rootSessionId?: string, parentSessionId?: string): Promise<void>;
84
+ export declare function appendMessages(sessionId: string, newMessages: Message[], workdir: string, sessionType?: "main" | "subagent"): Promise<void>;
96
85
  /**
97
86
  * Load session data from JSONL file (new approach)
98
87
  *
@@ -193,7 +182,9 @@ export declare function truncateContent(content: string, maxLength?: number): st
193
182
  */
194
183
  export declare function handleSessionRestoration(restoreSessionId?: string, continueLastSession?: boolean, workdir?: string): Promise<SessionData | undefined>;
195
184
  /**
196
- * Load the full message thread by following parentSessionId links
185
+ * Load the full message thread for a session.
186
+ * With append-only compaction, all messages are in a single file.
187
+ * Returns the active messages (post-compact boundary).
197
188
  * @param currentSessionId - The ID of the current session
198
189
  * @param workdir - Working directory for the session
199
190
  * @returns Promise that resolves to an array of all messages in the thread
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/services/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAOjD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,MAAM,CAAC;QACrB,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE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