wave-agent-sdk 0.18.6 → 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 (129) 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 +31 -8
  12. package/dist/managers/cronManager.d.ts.map +1 -1
  13. package/dist/managers/cronManager.js +2 -0
  14. package/dist/managers/liveConfigManager.d.ts.map +1 -1
  15. package/dist/managers/liveConfigManager.js +0 -9
  16. package/dist/managers/mcpManager.d.ts.map +1 -1
  17. package/dist/managers/mcpManager.js +13 -3
  18. package/dist/managers/messageManager.d.ts +4 -6
  19. package/dist/managers/messageManager.d.ts.map +1 -1
  20. package/dist/managers/messageManager.js +27 -81
  21. package/dist/managers/skillManager.d.ts +1 -0
  22. package/dist/managers/skillManager.d.ts.map +1 -1
  23. package/dist/managers/skillManager.js +11 -2
  24. package/dist/managers/toolManager.d.ts.map +1 -1
  25. package/dist/managers/toolManager.js +2 -0
  26. package/dist/prompts/index.d.ts +3 -2
  27. package/dist/prompts/index.d.ts.map +1 -1
  28. package/dist/prompts/index.js +5 -1
  29. package/dist/services/aiService.d.ts.map +1 -1
  30. package/dist/services/aiService.js +13 -9
  31. package/dist/services/configurationService.d.ts.map +1 -1
  32. package/dist/services/configurationService.js +24 -9
  33. package/dist/services/hook.d.ts.map +1 -1
  34. package/dist/services/hook.js +6 -0
  35. package/dist/services/initializationService.d.ts.map +1 -1
  36. package/dist/services/initializationService.js +1 -1
  37. package/dist/services/interactionService.js +1 -1
  38. package/dist/services/reversionService.d.ts +5 -1
  39. package/dist/services/reversionService.d.ts.map +1 -1
  40. package/dist/services/reversionService.js +50 -22
  41. package/dist/services/session.d.ts +4 -13
  42. package/dist/services/session.d.ts.map +1 -1
  43. package/dist/services/session.js +59 -215
  44. package/dist/telemetry/sessionTracing.d.ts +31 -20
  45. package/dist/telemetry/sessionTracing.d.ts.map +1 -1
  46. package/dist/telemetry/sessionTracing.js +192 -62
  47. package/dist/tools/bashTool.d.ts.map +1 -1
  48. package/dist/tools/bashTool.js +16 -1
  49. package/dist/tools/readTool.d.ts.map +1 -1
  50. package/dist/tools/readTool.js +6 -7
  51. package/dist/types/config.d.ts +7 -0
  52. package/dist/types/config.d.ts.map +1 -1
  53. package/dist/types/hooks.d.ts +1 -0
  54. package/dist/types/hooks.d.ts.map +1 -1
  55. package/dist/types/messaging.d.ts +0 -1
  56. package/dist/types/messaging.d.ts.map +1 -1
  57. package/dist/types/skills.d.ts +1 -0
  58. package/dist/types/skills.d.ts.map +1 -1
  59. package/dist/types/telemetry.d.ts +16 -1
  60. package/dist/types/telemetry.d.ts.map +1 -1
  61. package/dist/utils/atomicWrite.d.ts +15 -0
  62. package/dist/utils/atomicWrite.d.ts.map +1 -0
  63. package/dist/utils/atomicWrite.js +59 -0
  64. package/dist/utils/cacheControlUtils.d.ts +3 -15
  65. package/dist/utils/cacheControlUtils.d.ts.map +1 -1
  66. package/dist/utils/cacheControlUtils.js +4 -35
  67. package/dist/utils/containerSetup.d.ts.map +1 -1
  68. package/dist/utils/containerSetup.js +5 -1
  69. package/dist/utils/convertMessagesForAPI.d.ts +9 -1
  70. package/dist/utils/convertMessagesForAPI.d.ts.map +1 -1
  71. package/dist/utils/convertMessagesForAPI.js +74 -55
  72. package/dist/utils/fileUtils.d.ts +0 -6
  73. package/dist/utils/fileUtils.d.ts.map +1 -1
  74. package/dist/utils/fileUtils.js +0 -43
  75. package/dist/utils/gitUtils.d.ts +11 -0
  76. package/dist/utils/gitUtils.d.ts.map +1 -1
  77. package/dist/utils/gitUtils.js +51 -0
  78. package/dist/utils/groupMessagesByApiRound.d.ts.map +1 -1
  79. package/dist/utils/groupMessagesByApiRound.js +7 -6
  80. package/dist/utils/mcpUtils.d.ts.map +1 -1
  81. package/dist/utils/mcpUtils.js +2 -1
  82. package/dist/utils/modelCapabilities.d.ts +22 -0
  83. package/dist/utils/modelCapabilities.d.ts.map +1 -0
  84. package/dist/utils/modelCapabilities.js +24 -0
  85. package/dist/utils/skillParser.d.ts.map +1 -1
  86. package/dist/utils/skillParser.js +3 -1
  87. package/dist/utils/tokenEstimate.d.ts +24 -0
  88. package/dist/utils/tokenEstimate.d.ts.map +1 -0
  89. package/dist/utils/tokenEstimate.js +30 -0
  90. package/dist/utils/worktreeUtils.d.ts.map +1 -1
  91. package/dist/utils/worktreeUtils.js +3 -1
  92. package/package.json +1 -1
  93. package/src/agent.ts +11 -5
  94. package/src/index.ts +1 -0
  95. package/src/managers/aiManager.ts +36 -7
  96. package/src/managers/cronManager.ts +2 -0
  97. package/src/managers/liveConfigManager.ts +0 -12
  98. package/src/managers/mcpManager.ts +16 -3
  99. package/src/managers/messageManager.ts +32 -109
  100. package/src/managers/skillManager.ts +16 -2
  101. package/src/managers/toolManager.ts +2 -0
  102. package/src/prompts/index.ts +6 -1
  103. package/src/services/aiService.ts +12 -5
  104. package/src/services/configurationService.ts +26 -24
  105. package/src/services/hook.ts +7 -0
  106. package/src/services/initializationService.ts +1 -3
  107. package/src/services/interactionService.ts +1 -1
  108. package/src/services/reversionService.ts +50 -27
  109. package/src/services/session.ts +63 -262
  110. package/src/telemetry/sessionTracing.ts +225 -73
  111. package/src/tools/bashTool.ts +23 -1
  112. package/src/tools/readTool.ts +6 -12
  113. package/src/types/config.ts +8 -0
  114. package/src/types/hooks.ts +1 -0
  115. package/src/types/messaging.ts +0 -1
  116. package/src/types/skills.ts +1 -0
  117. package/src/types/telemetry.ts +19 -1
  118. package/src/utils/atomicWrite.ts +61 -0
  119. package/src/utils/cacheControlUtils.ts +5 -38
  120. package/src/utils/containerSetup.ts +5 -1
  121. package/src/utils/convertMessagesForAPI.ts +87 -57
  122. package/src/utils/fileUtils.ts +0 -46
  123. package/src/utils/gitUtils.ts +54 -0
  124. package/src/utils/groupMessagesByApiRound.ts +7 -6
  125. package/src/utils/mcpUtils.ts +2 -1
  126. package/src/utils/modelCapabilities.ts +30 -0
  127. package/src/utils/skillParser.ts +3 -1
  128. package/src/utils/tokenEstimate.ts +34 -0
  129. package/src/utils/worktreeUtils.ts +8 -1
@@ -3,6 +3,7 @@ import { getLastApiRounds } from "../utils/groupMessagesByApiRound.js";
3
3
  import { join, isAbsolute, relative } from "path";
4
4
  import { appendMessages, createSession, generateSessionId, SESSION_DIR, } from "../services/session.js";
5
5
  import { pathEncoder } from "../utils/pathEncoder.js";
6
+ import { estimateTokens } from "../utils/tokenEstimate.js";
6
7
  import { READ_TOOL_NAME } from "../constants/tools.js";
7
8
  import { logger } from "../utils/globalLogger.js";
8
9
  export class MessageManager {
@@ -14,7 +15,6 @@ export class MessageManager {
14
15
  this.invokedSkills = new Map(); // Track invoked skill names
15
16
  this._usages = [];
16
17
  this.sessionId = generateSessionId();
17
- this.rootSessionId = this.sessionId;
18
18
  this.messages = [];
19
19
  this.latestTotalTokens = 0;
20
20
  this.workdir = options.workdir;
@@ -43,10 +43,7 @@ export class MessageManager {
43
43
  return this.sessionId;
44
44
  }
45
45
  getRootSessionId() {
46
- return this.rootSessionId;
47
- }
48
- getParentSessionId() {
49
- return this.parentSessionId;
46
+ return this.sessionId;
50
47
  }
51
48
  getMessages() {
52
49
  return [...this.messages];
@@ -203,7 +200,7 @@ export class MessageManager {
203
200
  await this.createSessionIfNeeded();
204
201
  }
205
202
  // Use JSONL format for new sessions
206
- await appendMessages(this.sessionId, unsavedMessages, this.workdir, this.sessionType, this.rootSessionId, this.parentSessionId);
203
+ await appendMessages(this.sessionId, unsavedMessages, this.workdir, this.sessionType);
207
204
  // Update the saved message count
208
205
  this.savedMessageCount = this.messages.length;
209
206
  }
@@ -223,7 +220,6 @@ export class MessageManager {
223
220
  clearMessages() {
224
221
  this.setMessages([]);
225
222
  const newSessionId = generateSessionId();
226
- this.rootSessionId = newSessionId;
227
223
  this.setSessionId(newSessionId);
228
224
  this.setlatestTotalTokens(0);
229
225
  this.savedMessageCount = 0; // Reset saved message count
@@ -237,8 +233,6 @@ export class MessageManager {
237
233
  // Initialize state from session data
238
234
  initializeFromSession(sessionData) {
239
235
  this.setSessionId(sessionData.id);
240
- this.rootSessionId = sessionData.rootSessionId || sessionData.id;
241
- this.parentSessionId = sessionData.parentSessionId;
242
236
  this.setMessages([...sessionData.messages]);
243
237
  this.setlatestTotalTokens(sessionData.metadata.latestTotalTokens);
244
238
  // Rebuild loadedRuleIds from persisted meta messages (session restore)
@@ -356,9 +350,10 @@ export class MessageManager {
356
350
  }
357
351
  }
358
352
  /**
359
- * Compact messages and update session, delete compacted messages, only keep compacted messages and last 3 messages
353
+ * Compact messages and update session append compact message to same file (append-only).
354
+ * After compaction, in-memory messages are [compactMessage, ...lastThreeMessages].
360
355
  */
361
- compactMessagesAndUpdateSession(compactedContent, usage) {
356
+ async compactMessagesAndUpdateSession(compactedContent, usage) {
362
357
  // Get last 2 API rounds to preserve (structurally safe boundary)
363
358
  const lastThreeMessages = getLastApiRounds(this.messages, 2);
364
359
  // Create compacted message
@@ -369,20 +364,19 @@ export class MessageManager {
369
364
  {
370
365
  type: "compact",
371
366
  content: compactedContent,
372
- sessionId: this.sessionId,
373
367
  },
374
368
  ],
375
369
  timestamp: new Date().toISOString(),
376
370
  ...(usage && { usage }),
377
371
  };
378
- // Build new message array: keep the compacted message and last 3 messages
372
+ // Build new message array: keep the compacted message and last messages
379
373
  const newMessages = [compactMessage, ...lastThreeMessages];
380
- // Update sessionId and parentSessionId
381
- const oldSessionId = this.sessionId;
382
- this.setSessionId(generateSessionId());
383
- this.parentSessionId = oldSessionId;
384
- // Set new message list
374
+ // APPEND to the same session file (append-only, like Claude Code)
375
+ const { appendMessages } = await import("../services/session.js");
376
+ await appendMessages(this.sessionId, newMessages, this.workdir, this.sessionType);
377
+ // Update in-memory state
385
378
  this.setMessages(newMessages);
379
+ this.savedMessageCount = newMessages.length;
386
380
  // Clear and rebuild loaded rule IDs from remaining meta messages
387
381
  this.clearLoadedRuleIds();
388
382
  this.rebuildLoadedRuleIds();
@@ -628,75 +622,22 @@ export class MessageManager {
628
622
  * @param reversionManager - Optional ReversionManager to handle file rollbacks.
629
623
  */
630
624
  async truncateHistory(index, reversionManager) {
631
- const { messages, sessionIds } = await this.getFullMessageThread();
625
+ const { messages } = await this.getFullMessageThread();
632
626
  if (index < 0 || index >= messages.length) {
633
627
  throw new Error(`Invalid message index: ${index}`);
634
628
  }
635
- // Find which session the index belongs to
636
- let targetSessionId = this.sessionId;
637
- let targetIndexInSession = index;
638
- // We need to be careful here because loadFullMessageThread might have removed "compact" blocks
639
- // Let's re-calculate based on the actual messages returned.
640
- // Actually, it's easier to just load sessions one by one again or keep track of counts.
641
- // For simplicity, let's assume we want to truncate the WHOLE thread.
642
- // If the index is in a previous session, we need to:
643
- // 1. Load that session.
644
- // 2. Truncate it.
645
- // 3. Make it the current session.
646
- // 4. Delete/Invalidate subsequent sessions.
647
- // To correctly map 'index' to a session, we need to know the message count of each session
648
- // as they appear in the concatenated 'messages' array.
649
- let remainingIndex = index;
650
- const { loadSessionFromJsonl } = await import("../services/session.js");
651
- for (const sid of sessionIds) {
652
- const sessionData = await loadSessionFromJsonl(sid, this.workdir);
653
- if (!sessionData)
654
- continue;
655
- const sessionMessages = sessionData.messages;
656
- // If this is not the first session in the thread, it might have a compact block at the start
657
- // that was removed in getFullMessageThread.
658
- const hasCompactBlock = sessionMessages[0]?.blocks.some((b) => b.type === "compact");
659
- const effectiveMessages = hasCompactBlock && sid !== sessionIds[0]
660
- ? sessionMessages.slice(1)
661
- : sessionMessages;
662
- if (remainingIndex < effectiveMessages.length) {
663
- targetSessionId = sid;
664
- targetIndexInSession = hasCompactBlock
665
- ? remainingIndex + 1
666
- : remainingIndex;
667
- break;
668
- }
669
- remainingIndex -= effectiveMessages.length;
670
- }
671
- // Load the target session to perform truncation
672
- const targetSessionData = await loadSessionFromJsonl(targetSessionId, this.workdir);
673
- if (!targetSessionData)
674
- throw new Error(`Target session ${targetSessionId} not found`);
675
- // Identify messages to be removed (from the whole thread)
629
+ const newMessages = messages.slice(0, index);
676
630
  const messagesToRemove = messages.slice(index);
677
631
  const messageIdsToRemove = messagesToRemove
678
632
  .map((m) => m.id)
679
633
  .filter((id) => !!id);
680
- // Revert file changes if manager is provided
681
634
  if (reversionManager && messageIdsToRemove.length > 0) {
682
635
  await reversionManager.revertTo(messageIdsToRemove, messages);
683
636
  }
684
- // Truncate messages in the target session
685
- const newMessagesInSession = targetSessionData.messages.slice(0, targetIndexInSession);
686
- // Update target session file
687
- this.sessionId = targetSessionId;
688
- this.rootSessionId = targetSessionData.rootSessionId || targetSessionId;
689
- this.parentSessionId = targetSessionData.parentSessionId;
690
- this.transcriptPath = this.computeTranscriptPath();
691
- await this.rewriteSessionFile(newMessagesInSession);
692
- // Update in-memory messages to the truncated session messages
693
- // We do NOT include ancestor messages here to avoid exceeding context limits.
694
- // The 'compact' block at the start of the session (if any) already summarizes them.
695
- this.setMessages(newMessagesInSession);
696
- // Update saved message count
697
- this.savedMessageCount = newMessagesInSession.length;
698
- // Notify session ID change if it changed
699
- this.callbacks.onSessionIdChange?.(this.sessionId);
637
+ // Rewrite file with truncated messages
638
+ await this.rewriteSessionFile(newMessages);
639
+ this.setMessages(newMessages);
640
+ this.savedMessageCount = newMessages.length;
700
641
  }
701
642
  /**
702
643
  * Rewrite the session file with the current messages.
@@ -746,7 +687,7 @@ export class MessageManager {
746
687
  /**
747
688
  * Get recent file read contents, sorted by timestamp (newest first).
748
689
  * @param maxFiles - Maximum number of files to return
749
- * @param maxTokensPerFile - Maximum tokens per file (~4 chars/token)
690
+ * @param maxTokensPerFile - Maximum tokens per file (CJK-aware estimation)
750
691
  * @returns Array of { path, content } sorted by recency
751
692
  */
752
693
  getRecentFileReads(maxFiles = 5, maxTokensPerFile = 5000) {
@@ -755,9 +696,14 @@ export class MessageManager {
755
696
  .slice(0, maxFiles);
756
697
  const result = [];
757
698
  for (const [path, { content }] of sorted) {
758
- const truncated = content.length > maxTokensPerFile * 4
759
- ? content.slice(0, maxTokensPerFile * 4)
760
- : content;
699
+ const tokenCount = estimateTokens(content);
700
+ let truncated = content;
701
+ if (tokenCount > maxTokensPerFile) {
702
+ // Truncate proportionally to fit within the token budget
703
+ const ratio = maxTokensPerFile / tokenCount;
704
+ const cutIndex = Math.floor(content.length * ratio);
705
+ truncated = content.slice(0, cutIndex);
706
+ }
761
707
  result.push({ path, content: truncated });
762
708
  }
763
709
  return result;
@@ -8,6 +8,7 @@ export declare class SkillManager extends EventEmitter {
8
8
  private container;
9
9
  private personalSkillsPath;
10
10
  private personalClaudeSkillsPath;
11
+ private personalAgentsSkillsPath;
11
12
  private scanTimeout;
12
13
  private workdir;
13
14
  private skillMetadata;
@@ -1 +1 @@
1
- {"version":3,"file":"skillManager.d.ts","sourceRoot":"","sources":["../../src/managers/skillManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,KAAK,EAGL,aAAa,EACb,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAU3B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD;;GAEG;AACH,qBAAa,YAAa,SAAQ,YAAY;IAe1C,OAAO,CAAC,SAAS;IAdnB,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,wBAAwB,CAAS;IACzC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,aAAa,CAAoC;IACzD,OAAO,CAAC,YAAY,CAA4B;IAChD,OAAO,CAAC,mBAAmB,CAAoC;IAC/D,OAA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AS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAgBzD;;OAEG;YACW,cAAc;IA4C5B;;OAEG;YACW,uBAAuB;YA0BvB,aAAa;YAiBb,gBAAgB;IAsD9B;;OAEG;YACW,oBAAoB;IA4BlC;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC;QAC/C,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,sBAAsB,CAAC;QACjC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;KACzB,CAAC;IA8BF;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAC5C;QACE,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,KAAK,CAAC;KACd,GACD;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,SAAS,CAAA;KAAE,CACzC;IA6BD;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAkC3B;;OAEG;YACW,yBAAyB;IAWvC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAc7B;;OAEG;IACH,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI;CA8BhE"}
@@ -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 +1 @@
1
- {"version":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AG,IAAI;IAa9D;;OAEG;IACI,oBAAoB,IAAI,iBAAiB,GAAG,SAAS;IAI5D;;OAEG;IACI,cAAc,IACjB,OAAO,4BAA4B,EAAE,WAAW,GAChD,SAAS;CAKd;AAGD,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -198,6 +198,7 @@ class ToolManager {
198
198
  endToolSpan({
199
199
  success: result.success,
200
200
  durationMs: Date.now() - toolStartTime,
201
+ output: result.content,
201
202
  });
202
203
  return result;
203
204
  }
@@ -222,6 +223,7 @@ class ToolManager {
222
223
  endToolSpan({
223
224
  success: result.success,
224
225
  durationMs: Date.now() - toolStartTime,
226
+ output: result.content,
225
227
  });
226
228
  return result;
227
229
  }
@@ -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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AAoB,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,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,0BAA0B,EAAE,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EACP,MAAM,GACN,MAAM,GACN,UAAU,GACV;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IAGrD,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE;QAC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,MAAM,CAAC;QAC1B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,wBAAsB,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CA4FjE;AAED,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IACvC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE;QACN,aAAa,EAAE,MAAM,CAAC;QACtB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,kBAAkB,CAAC,CA+F7B"}
@@ -2,7 +2,8 @@ import { OpenAIClient } 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,wB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EACf,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC;IAmChB;;OAEG;IACG,mBAAmB,CACvB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAmChB;;OAEG;IACH,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAKjE;;;OAGG;IACH,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI;CAGnE;AAKD;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,OAAO,EACZ,UAAU,CAAC,EAAE,MAAM,GAClB,2BAA2B,CAsD7B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC9C,OAAO,GAAE,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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AC,IAAI,CAAC;IA+BhB;;OAEG;IACG,mBAAmB,CACvB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IA+BhB;;OAEG;IACH,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAKjE;;;OAGG;IACH,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI;CAGnE;AAKD;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,OAAO,EACZ,UAAU,CAAC,EAAE,MAAM,GAClB,2BAA2B,CAsD7B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC9C,OAAO,GAAE,uBAA4B,GACpC,wBAAwB,CAoC1B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,GACf,iBAAiB,GAAG,IAAI,CA4C1B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GACd,iBAAiB,GAAG,IAAI,CA0K1B"}
@@ -15,6 +15,8 @@ import { DEFAULT_WAVE_MAX_INPUT_TOKENS, DEFAULT_WAVE_MAX_OUTPUT_TOKENS, } from "
15
15
  import { parseCustomHeaders } from "../utils/stringUtils.js";
16
16
  import { getRemoteSettingsSync, mergeRemoteSettings, } from "./remoteSettingsService.js";
17
17
  import { createAuthAwareFetch } from "./authService.js";
18
+ import { ensureWaveRuntimeFilesExcluded } from "../utils/gitUtils.js";
19
+ import { atomicWriteFile } from "../utils/atomicWrite.js";
18
20
  /**
19
21
  * Default ConfigurationService implementation
20
22
  *
@@ -424,11 +426,12 @@ export class ConfigurationService {
424
426
  const fastModelConfigSource = resolvedFastModel &&
425
427
  this.currentConfiguration?.models?.[resolvedFastModel];
426
428
  if (fastModelConfigSource) {
427
- 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;
428
430
  void _fm;
429
431
  void _ffm;
430
432
  void _fmt;
431
433
  void _fpm;
434
+ void _fcap;
432
435
  baseConfig.fastModelConfig = fastHyperparams;
433
436
  }
434
437
  // Merge model-specific settings from configuration
@@ -580,7 +583,7 @@ export class ConfigurationService {
580
583
  }
581
584
  }
582
585
  config.model = model;
583
- await fs.writeFile(configPath, JSON.stringify(config, null, 2), "utf-8");
586
+ await atomicWriteFile(configPath, JSON.stringify(config, null, 2));
584
587
  }
585
588
  /**
586
589
  * Get all configured models from settings.json and environment
@@ -631,6 +634,7 @@ export class ConfigurationService {
631
634
  const localConfigPath = path.join(workdir, ".wave", "settings.local.json");
632
635
  // Ensure .wave directory exists
633
636
  const waveDir = path.join(workdir, ".wave");
637
+ ensureWaveRuntimeFilesExcluded(workdir);
634
638
  if (!existsSync(waveDir)) {
635
639
  await fs.mkdir(waveDir, { recursive: true });
636
640
  }
@@ -652,7 +656,7 @@ export class ConfigurationService {
652
656
  }
653
657
  if (!config.permissions.allow.includes(rule)) {
654
658
  config.permissions.allow.push(rule);
655
- await fs.writeFile(localConfigPath, JSON.stringify(config, null, 2), "utf-8");
659
+ await atomicWriteFile(localConfigPath, JSON.stringify(config, null, 2));
656
660
  }
657
661
  }
658
662
  /**
@@ -691,7 +695,7 @@ export class ConfigurationService {
691
695
  config.enabledPlugins = {};
692
696
  }
693
697
  config.enabledPlugins[pluginId] = enabled;
694
- await fs.writeFile(configPath, JSON.stringify(config, null, 2), "utf-8");
698
+ await atomicWriteFile(configPath, JSON.stringify(config, null, 2));
695
699
  }
696
700
  /**
697
701
  * Get merged marketplaces from all scopes
@@ -752,7 +756,7 @@ export class ConfigurationService {
752
756
  fileConfig.marketplaces = {};
753
757
  }
754
758
  fileConfig.marketplaces[name] = config;
755
- await fs.writeFile(configPath, JSON.stringify(fileConfig, null, 2), "utf-8");
759
+ await atomicWriteFile(configPath, JSON.stringify(fileConfig, null, 2));
756
760
  }
757
761
  /**
758
762
  * Remove a marketplace from the specified scope
@@ -779,7 +783,7 @@ export class ConfigurationService {
779
783
  const fileConfig = JSON.parse(content);
780
784
  if (fileConfig.marketplaces && name in fileConfig.marketplaces) {
781
785
  delete fileConfig.marketplaces[name];
782
- await fs.writeFile(configPath, JSON.stringify(fileConfig, null, 2), "utf-8");
786
+ await atomicWriteFile(configPath, JSON.stringify(fileConfig, null, 2));
783
787
  }
784
788
  }
785
789
  catch {
@@ -811,7 +815,7 @@ export class ConfigurationService {
811
815
  const config = JSON.parse(content);
812
816
  if (config.enabledPlugins && pluginId in config.enabledPlugins) {
813
817
  delete config.enabledPlugins[pluginId];
814
- await fs.writeFile(configPath, JSON.stringify(config, null, 2), "utf-8");
818
+ await atomicWriteFile(configPath, JSON.stringify(config, null, 2));
815
819
  }
816
820
  }
817
821
  catch {
@@ -925,6 +929,13 @@ export function loadWaveConfigFromFile(filePath) {
925
929
  }
926
930
  try {
927
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
+ }
928
939
  const config = JSON.parse(content);
929
940
  return {
930
941
  hooks: config.hooks || undefined,
@@ -942,9 +953,13 @@ export function loadWaveConfigFromFile(filePath) {
942
953
  }
943
954
  catch (error) {
944
955
  if (error instanceof SyntaxError) {
945
- 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;
946
961
  }
947
- // Re-throw validation errors and other errors as-is
962
+ // Re-throw other errors as-is
948
963
  throw error;
949
964
  }
950
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) {