wave-agent-sdk 0.0.7 → 0.0.8

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 (172) hide show
  1. package/dist/agent.d.ts +32 -20
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +202 -20
  4. package/dist/constants/events.d.ts +28 -0
  5. package/dist/constants/events.d.ts.map +1 -0
  6. package/dist/constants/events.js +27 -0
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +2 -0
  10. package/dist/managers/aiManager.d.ts +34 -1
  11. package/dist/managers/aiManager.d.ts.map +1 -1
  12. package/dist/managers/aiManager.js +243 -128
  13. package/dist/managers/backgroundBashManager.d.ts.map +1 -1
  14. package/dist/managers/backgroundBashManager.js +7 -6
  15. package/dist/managers/hookManager.d.ts +9 -4
  16. package/dist/managers/hookManager.d.ts.map +1 -1
  17. package/dist/managers/hookManager.js +62 -30
  18. package/dist/managers/liveConfigManager.d.ts +58 -0
  19. package/dist/managers/liveConfigManager.d.ts.map +1 -0
  20. package/dist/managers/liveConfigManager.js +160 -0
  21. package/dist/managers/messageManager.d.ts +38 -13
  22. package/dist/managers/messageManager.d.ts.map +1 -1
  23. package/dist/managers/messageManager.js +163 -30
  24. package/dist/managers/slashCommandManager.d.ts.map +1 -1
  25. package/dist/managers/slashCommandManager.js +4 -1
  26. package/dist/managers/subagentManager.d.ts +51 -0
  27. package/dist/managers/subagentManager.d.ts.map +1 -1
  28. package/dist/managers/subagentManager.js +189 -18
  29. package/dist/services/aiService.d.ts +13 -5
  30. package/dist/services/aiService.d.ts.map +1 -1
  31. package/dist/services/aiService.js +350 -74
  32. package/dist/services/configurationWatcher.d.ts +120 -0
  33. package/dist/services/configurationWatcher.d.ts.map +1 -0
  34. package/dist/services/configurationWatcher.js +439 -0
  35. package/dist/services/fileWatcher.d.ts +69 -0
  36. package/dist/services/fileWatcher.d.ts.map +1 -0
  37. package/dist/services/fileWatcher.js +213 -0
  38. package/dist/services/hook.d.ts +91 -9
  39. package/dist/services/hook.d.ts.map +1 -1
  40. package/dist/services/hook.js +393 -43
  41. package/dist/services/jsonlHandler.d.ts +62 -0
  42. package/dist/services/jsonlHandler.d.ts.map +1 -0
  43. package/dist/services/jsonlHandler.js +257 -0
  44. package/dist/services/memory.d.ts +9 -0
  45. package/dist/services/memory.d.ts.map +1 -1
  46. package/dist/services/memory.js +81 -12
  47. package/dist/services/memoryStore.d.ts +81 -0
  48. package/dist/services/memoryStore.d.ts.map +1 -0
  49. package/dist/services/memoryStore.js +200 -0
  50. package/dist/services/session.d.ts +64 -49
  51. package/dist/services/session.d.ts.map +1 -1
  52. package/dist/services/session.js +310 -132
  53. package/dist/tools/bashTool.d.ts.map +1 -1
  54. package/dist/tools/bashTool.js +5 -4
  55. package/dist/tools/deleteFileTool.d.ts.map +1 -1
  56. package/dist/tools/deleteFileTool.js +2 -1
  57. package/dist/tools/editTool.d.ts.map +1 -1
  58. package/dist/tools/editTool.js +3 -2
  59. package/dist/tools/multiEditTool.d.ts.map +1 -1
  60. package/dist/tools/multiEditTool.js +4 -3
  61. package/dist/tools/readTool.d.ts.map +1 -1
  62. package/dist/tools/readTool.js +2 -1
  63. package/dist/tools/writeTool.d.ts.map +1 -1
  64. package/dist/tools/writeTool.js +5 -6
  65. package/dist/types/commands.d.ts +4 -0
  66. package/dist/types/commands.d.ts.map +1 -1
  67. package/dist/types/core.d.ts +35 -0
  68. package/dist/types/core.d.ts.map +1 -1
  69. package/dist/types/environment.d.ts +42 -0
  70. package/dist/types/environment.d.ts.map +1 -0
  71. package/dist/types/environment.js +21 -0
  72. package/dist/types/hooks.d.ts +8 -2
  73. package/dist/types/hooks.d.ts.map +1 -1
  74. package/dist/types/hooks.js +8 -2
  75. package/dist/types/index.d.ts +2 -0
  76. package/dist/types/index.d.ts.map +1 -1
  77. package/dist/types/index.js +2 -0
  78. package/dist/types/memoryStore.d.ts +82 -0
  79. package/dist/types/memoryStore.d.ts.map +1 -0
  80. package/dist/types/memoryStore.js +7 -0
  81. package/dist/types/messaging.d.ts +14 -2
  82. package/dist/types/messaging.d.ts.map +1 -1
  83. package/dist/types/session.d.ts +20 -0
  84. package/dist/types/session.d.ts.map +1 -0
  85. package/dist/types/session.js +7 -0
  86. package/dist/utils/bashHistory.d.ts.map +1 -1
  87. package/dist/utils/bashHistory.js +27 -26
  88. package/dist/utils/cacheControlUtils.d.ts +121 -0
  89. package/dist/utils/cacheControlUtils.d.ts.map +1 -0
  90. package/dist/utils/cacheControlUtils.js +367 -0
  91. package/dist/utils/commandPathResolver.d.ts +52 -0
  92. package/dist/utils/commandPathResolver.d.ts.map +1 -0
  93. package/dist/utils/commandPathResolver.js +145 -0
  94. package/dist/utils/configPaths.d.ts +85 -0
  95. package/dist/utils/configPaths.d.ts.map +1 -0
  96. package/dist/utils/configPaths.js +121 -0
  97. package/dist/utils/configResolver.d.ts +37 -10
  98. package/dist/utils/configResolver.d.ts.map +1 -1
  99. package/dist/utils/configResolver.js +127 -23
  100. package/dist/utils/constants.d.ts +1 -1
  101. package/dist/utils/constants.js +1 -1
  102. package/dist/utils/convertMessagesForAPI.d.ts.map +1 -1
  103. package/dist/utils/convertMessagesForAPI.js +7 -5
  104. package/dist/utils/customCommands.d.ts.map +1 -1
  105. package/dist/utils/customCommands.js +66 -21
  106. package/dist/utils/fileUtils.d.ts +15 -0
  107. package/dist/utils/fileUtils.d.ts.map +1 -0
  108. package/dist/utils/fileUtils.js +61 -0
  109. package/dist/utils/globalLogger.d.ts +102 -0
  110. package/dist/utils/globalLogger.d.ts.map +1 -0
  111. package/dist/utils/globalLogger.js +136 -0
  112. package/dist/utils/mcpUtils.d.ts.map +1 -1
  113. package/dist/utils/mcpUtils.js +25 -3
  114. package/dist/utils/messageOperations.d.ts +20 -8
  115. package/dist/utils/messageOperations.d.ts.map +1 -1
  116. package/dist/utils/messageOperations.js +25 -16
  117. package/dist/utils/pathEncoder.d.ts +104 -0
  118. package/dist/utils/pathEncoder.d.ts.map +1 -0
  119. package/dist/utils/pathEncoder.js +272 -0
  120. package/dist/utils/subagentParser.d.ts.map +1 -1
  121. package/dist/utils/subagentParser.js +2 -1
  122. package/dist/utils/tokenCalculation.d.ts +26 -0
  123. package/dist/utils/tokenCalculation.d.ts.map +1 -0
  124. package/dist/utils/tokenCalculation.js +36 -0
  125. package/package.json +6 -3
  126. package/src/agent.ts +298 -34
  127. package/src/constants/events.ts +38 -0
  128. package/src/index.ts +2 -0
  129. package/src/managers/aiManager.ts +323 -170
  130. package/src/managers/backgroundBashManager.ts +7 -6
  131. package/src/managers/hookManager.ts +83 -40
  132. package/src/managers/liveConfigManager.ts +248 -0
  133. package/src/managers/messageManager.ts +230 -63
  134. package/src/managers/slashCommandManager.ts +4 -1
  135. package/src/managers/subagentManager.ts +283 -21
  136. package/src/services/aiService.ts +474 -83
  137. package/src/services/configurationWatcher.ts +622 -0
  138. package/src/services/fileWatcher.ts +301 -0
  139. package/src/services/hook.ts +538 -47
  140. package/src/services/jsonlHandler.ts +319 -0
  141. package/src/services/memory.ts +92 -12
  142. package/src/services/memoryStore.ts +279 -0
  143. package/src/services/session.ts +381 -157
  144. package/src/tools/bashTool.ts +5 -4
  145. package/src/tools/deleteFileTool.ts +2 -1
  146. package/src/tools/editTool.ts +3 -2
  147. package/src/tools/multiEditTool.ts +4 -3
  148. package/src/tools/readTool.ts +2 -1
  149. package/src/tools/writeTool.ts +7 -6
  150. package/src/types/commands.ts +6 -0
  151. package/src/types/core.ts +44 -0
  152. package/src/types/environment.ts +60 -0
  153. package/src/types/hooks.ts +21 -8
  154. package/src/types/index.ts +2 -0
  155. package/src/types/memoryStore.ts +94 -0
  156. package/src/types/messaging.ts +14 -2
  157. package/src/types/session.ts +25 -0
  158. package/src/utils/bashHistory.ts +27 -27
  159. package/src/utils/cacheControlUtils.ts +540 -0
  160. package/src/utils/commandPathResolver.ts +189 -0
  161. package/src/utils/configPaths.ts +163 -0
  162. package/src/utils/configResolver.ts +182 -22
  163. package/src/utils/constants.ts +1 -1
  164. package/src/utils/convertMessagesForAPI.ts +7 -5
  165. package/src/utils/customCommands.ts +90 -22
  166. package/src/utils/fileUtils.ts +65 -0
  167. package/src/utils/globalLogger.ts +145 -0
  168. package/src/utils/mcpUtils.ts +34 -3
  169. package/src/utils/messageOperations.ts +42 -20
  170. package/src/utils/pathEncoder.ts +379 -0
  171. package/src/utils/subagentParser.ts +2 -1
  172. package/src/utils/tokenCalculation.ts +43 -0
@@ -23,7 +23,7 @@ export const USER_MEMORY_FILE = path.join(DATA_DIRECTORY, "user-memory.md");
23
23
  /**
24
24
  * AI related constants
25
25
  */
26
- export const DEFAULT_TOKEN_LIMIT = 64000; // Default token limit
26
+ export const DEFAULT_TOKEN_LIMIT = 96000; // Default token limit
27
27
  /**
28
28
  * @deprecated These constants are now legacy. Use ModelConfig through Agent constructor instead.
29
29
  * They are maintained for backward compatibility with existing code that might still reference them,
@@ -1 +1 @@
1
- {"version":3,"file":"convertMessagesForAPI.d.ts","sourceRoot":"","sources":["../../src/utils/convertMessagesForAPI.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD,OAAO,EAEL,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AAuB7B;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,OAAO,EAAE,GAClB,0BAA0B,EAAE,CA8L9B"}
1
+ {"version":3,"file":"convertMessagesForAPI.d.ts","sourceRoot":"","sources":["../../src/utils/convertMessagesForAPI.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD,OAAO,EAEL,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AAwB7B;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,OAAO,EAAE,GAClB,0BAA0B,EAAE,CA+L9B"}
@@ -1,5 +1,6 @@
1
1
  import { convertImageToBase64 } from "./messageOperations.js";
2
2
  import { stripAnsiColors } from "./stringUtils.js";
3
+ import { logger } from "./globalLogger.js";
3
4
  /**
4
5
  * Safely handle tool call parameters, ensuring a legal JSON string is returned
5
6
  * @param args Tool call parameters
@@ -14,8 +15,8 @@ function safeToolArguments(args) {
14
15
  JSON.parse(args);
15
16
  return args;
16
17
  }
17
- catch {
18
- // logger.error(`Invalid tool arguments: ${args}`);
18
+ catch (error) {
19
+ logger.error(`Invalid tool arguments: ${args}`, error);
19
20
  // If not valid JSON, return a fallback empty object
20
21
  return "{}";
21
22
  }
@@ -54,8 +55,8 @@ export function convertMessagesForAPI(messages) {
54
55
  const completedToolIds = new Set(); // Record completed tool IDs
55
56
  if (toolBlocks.length > 0) {
56
57
  toolBlocks.forEach((toolBlock) => {
57
- // Only add completed tool blocks (i.e., not running)
58
- if (toolBlock.id && !toolBlock.isRunning) {
58
+ // Only add completed tool blocks (i.e., stage is 'end')
59
+ if (toolBlock.id && toolBlock.stage === "end") {
59
60
  completedToolIds.add(toolBlock.id);
60
61
  // Check for image data
61
62
  if (toolBlock.images && toolBlock.images.length > 0) {
@@ -127,6 +128,7 @@ export function convertMessagesForAPI(messages) {
127
128
  role: "assistant",
128
129
  content,
129
130
  tool_calls,
131
+ ...(message.metadata ? { ...message.metadata } : {}),
130
132
  };
131
133
  recentMessages.unshift(assistantMessage);
132
134
  }
@@ -155,7 +157,7 @@ export function convertMessagesForAPI(messages) {
155
157
  finalImageUrl = convertImageToBase64(imageUrl);
156
158
  }
157
159
  catch (error) {
158
- console.error("Failed to convert image path to base64:", imageUrl, error);
160
+ logger.error("Failed to convert image path to base64:", imageUrl, error);
159
161
  // Skip this image, do not add to content
160
162
  return;
161
163
  }
@@ -1 +1 @@
1
- {"version":3,"file":"customCommands.d.ts","sourceRoot":"","sources":["../../src/utils/customCommands.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AA6CD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAkB7E"}
1
+ {"version":3,"file":"customCommands.d.ts","sourceRoot":"","sources":["../../src/utils/customCommands.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAU5D;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AA0GD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAkB7E"}
@@ -1,7 +1,9 @@
1
- import { existsSync, readdirSync } from "fs";
1
+ import { existsSync, readdirSync, statSync } from "fs";
2
2
  import { join, extname, basename } from "path";
3
3
  import { homedir } from "os";
4
4
  import { parseMarkdownFile } from "./markdownParser.js";
5
+ import { generateCommandId, getCommandSegments, getNamespace, getDepth, } from "./commandPathResolver.js";
6
+ import { logger } from "./globalLogger.js";
5
7
  /**
6
8
  * Get the project-specific commands directory
7
9
  */
@@ -15,39 +17,82 @@ export function getUserCommandsDir() {
15
17
  return join(homedir(), ".wave", "commands");
16
18
  }
17
19
  /**
18
- * Scan a directory for markdown command files
20
+ * Scan a directory for markdown command files with nested directory support
21
+ * @param dirPath - Root commands directory path
22
+ * @param maxDepth - Maximum nesting depth to scan (default: 1)
19
23
  */
20
- function scanCommandsDirectory(dirPath) {
24
+ function scanCommandsDirectory(dirPath, maxDepth = 1) {
21
25
  if (!existsSync(dirPath)) {
22
26
  return [];
23
27
  }
28
+ return scanCommandsDirectoryRecursive(dirPath, dirPath, 0, maxDepth);
29
+ }
30
+ /**
31
+ * Recursively scan directory for commands with depth control
32
+ * @param currentPath - Current directory being scanned
33
+ * @param rootPath - Root commands directory (for relative path calculation)
34
+ * @param currentDepth - Current nesting depth
35
+ * @param maxDepth - Maximum allowed depth
36
+ */
37
+ function scanCommandsDirectoryRecursive(currentPath, rootPath, currentDepth, maxDepth) {
24
38
  const commands = [];
25
39
  try {
26
- const files = readdirSync(dirPath);
27
- for (const file of files) {
28
- if (extname(file) !== ".md") {
29
- continue;
30
- }
31
- const filePath = join(dirPath, file);
32
- const commandName = basename(file, ".md");
40
+ const entries = readdirSync(currentPath);
41
+ for (const entryName of entries) {
42
+ const fullPath = join(currentPath, entryName);
43
+ let isDirectory = false;
44
+ let isFile = false;
33
45
  try {
34
- const { content, config } = parseMarkdownFile(filePath);
35
- commands.push({
36
- id: commandName,
37
- name: commandName,
38
- description: config?.description, // Use description from frontmatter
39
- filePath,
40
- content,
41
- config,
42
- });
46
+ const stats = statSync(fullPath);
47
+ isDirectory = stats.isDirectory();
48
+ isFile = stats.isFile();
43
49
  }
44
50
  catch (error) {
45
- console.warn(`Failed to load custom command from ${filePath}:`, error);
51
+ // Skip entries that cannot be stat'd
52
+ logger.warn(`Cannot access ${fullPath}:`, error);
53
+ continue;
54
+ }
55
+ if (isDirectory) {
56
+ // Skip subdirectories if we're at max depth
57
+ if (currentDepth >= maxDepth) {
58
+ logger.warn(`Skipping directory ${fullPath}: exceeds maximum nesting depth of ${maxDepth}`);
59
+ continue;
60
+ }
61
+ // Recursively scan subdirectory
62
+ const nestedCommands = scanCommandsDirectoryRecursive(fullPath, rootPath, currentDepth + 1, maxDepth);
63
+ commands.push(...nestedCommands);
64
+ }
65
+ else if (isFile && extname(entryName) === ".md") {
66
+ // Process markdown file
67
+ try {
68
+ const commandId = generateCommandId(fullPath, rootPath);
69
+ const segments = getCommandSegments(fullPath, rootPath);
70
+ const namespace = getNamespace(segments);
71
+ const depth = getDepth(segments);
72
+ const { content, config } = parseMarkdownFile(fullPath);
73
+ commands.push({
74
+ id: commandId,
75
+ name: basename(entryName, ".md"),
76
+ description: config?.description,
77
+ filePath: fullPath,
78
+ content,
79
+ config,
80
+ // Nested command metadata
81
+ namespace,
82
+ isNested: depth > 0,
83
+ depth,
84
+ segments,
85
+ });
86
+ }
87
+ catch (error) {
88
+ logger.warn(`Failed to load custom command from ${fullPath}:`, error);
89
+ }
46
90
  }
91
+ // Skip non-markdown files silently
47
92
  }
48
93
  }
49
94
  catch (error) {
50
- console.warn(`Failed to scan commands directory ${dirPath}:`, error);
95
+ logger.warn(`Failed to scan commands directory ${currentPath}:`, error);
51
96
  }
52
97
  return commands;
53
98
  }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Reads the first line of a file efficiently using Node.js readline.
3
+ *
4
+ * @param {string} filePath - The path to the file.
5
+ * @return {Promise<string>} - The first non-empty line of the file, or an empty string otherwise.
6
+ */
7
+ export declare function readFirstLine(filePath: string): Promise<string>;
8
+ /**
9
+ * Reads a file from the end and returns the first non-empty line.
10
+ *
11
+ * @param {string} filePath - The path to the file.
12
+ * @return {Promise<string>} - The last non-empty line of the file, or an empty string if no non-empty lines found.
13
+ */
14
+ export declare function getLastLine(filePath: string): Promise<string>;
15
+ //# sourceMappingURL=fileUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileUtils.d.ts","sourceRoot":"","sources":["../../src/utils/fileUtils.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBrE;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBnE"}
@@ -0,0 +1,61 @@
1
+ import fs from "node:fs";
2
+ /**
3
+ * Reads the first line of a file efficiently using Node.js readline.
4
+ *
5
+ * @param {string} filePath - The path to the file.
6
+ * @return {Promise<string>} - The first non-empty line of the file, or an empty string otherwise.
7
+ */
8
+ export async function readFirstLine(filePath) {
9
+ const { createReadStream } = fs;
10
+ const { createInterface } = await import("node:readline");
11
+ const fileStream = createReadStream(filePath);
12
+ const rl = createInterface({
13
+ input: fileStream,
14
+ crlfDelay: Infinity, // Handle \r\n properly
15
+ });
16
+ try {
17
+ for await (const line of rl) {
18
+ const trimmedLine = line.trim();
19
+ if (trimmedLine.length > 0) {
20
+ return trimmedLine;
21
+ }
22
+ }
23
+ return "";
24
+ }
25
+ catch {
26
+ // If reading fails (e.g., file doesn't exist), return empty string
27
+ return "";
28
+ }
29
+ finally {
30
+ rl.close();
31
+ fileStream.destroy();
32
+ }
33
+ }
34
+ /**
35
+ * Reads a file from the end and returns the first non-empty line.
36
+ *
37
+ * @param {string} filePath - The path to the file.
38
+ * @return {Promise<string>} - The last non-empty line of the file, or an empty string if no non-empty lines found.
39
+ */
40
+ export async function getLastLine(filePath) {
41
+ const { exec } = await import("child_process");
42
+ const { promisify } = await import("util");
43
+ const execAsync = promisify(exec);
44
+ try {
45
+ // Use tail with multiple lines to handle cases where the last line might be empty
46
+ const { stdout } = await execAsync(`tail -n 3 "${filePath}"`);
47
+ const lines = stdout.split(/\r?\n/);
48
+ // Find the first non-empty line working backwards
49
+ for (let i = lines.length - 1; i >= 0; i--) {
50
+ const line = lines[i].trim();
51
+ if (line.length > 0) {
52
+ return line;
53
+ }
54
+ }
55
+ return "";
56
+ }
57
+ catch {
58
+ // If tail fails (e.g., file doesn't exist), return empty string
59
+ return "";
60
+ }
61
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Global Logger Registry for Agent SDK
3
+ *
4
+ * Provides zero-overhead logging access for utility functions and services
5
+ * without requiring parameter passing. Maintains singleton logger instance
6
+ * accessible across all SDK modules.
7
+ *
8
+ * Features:
9
+ * - Zero overhead when no logger configured (single null check)
10
+ * - Thread-safe in Node.js single-threaded environment
11
+ * - Maintains backward compatibility with existing Logger interface
12
+ * - Direct function delegation when configured
13
+ */
14
+ import type { Logger } from "../types/core.js";
15
+ /**
16
+ * Configure the global logger instance used by utility functions and services
17
+ *
18
+ * @param logger - Logger instance implementing the Logger interface, or null to disable logging
19
+ * @returns void
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * import { setGlobalLogger } from './utils/globalLogger.js';
24
+ *
25
+ * // Configure logger
26
+ * setGlobalLogger(myLogger);
27
+ *
28
+ * // Disable logging
29
+ * setGlobalLogger(null);
30
+ * ```
31
+ */
32
+ export declare function setGlobalLogger(logger: Logger | null): void;
33
+ /**
34
+ * Retrieve the current global logger instance
35
+ *
36
+ * @returns Current logger instance or null if unconfigured
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const currentLogger = getGlobalLogger();
41
+ * if (currentLogger) {
42
+ * currentLogger.info('Direct logger access');
43
+ * }
44
+ * ```
45
+ */
46
+ export declare function getGlobalLogger(): Logger | null;
47
+ /**
48
+ * Reset global logger to unconfigured state
49
+ * Equivalent to setGlobalLogger(null)
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * clearGlobalLogger(); // All subsequent logging calls become no-ops
54
+ * ```
55
+ */
56
+ export declare function clearGlobalLogger(): void;
57
+ /**
58
+ * Check if global logger is currently configured
59
+ *
60
+ * @returns true if logger configured, false otherwise
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * if (isLoggerConfigured()) {
65
+ * // Perform expensive logging operation
66
+ * const debugInfo = generateDebugInfo();
67
+ * logger.debug(debugInfo);
68
+ * }
69
+ * ```
70
+ */
71
+ export declare function isLoggerConfigured(): boolean;
72
+ /**
73
+ * Zero-overhead logging interface
74
+ *
75
+ * Performance characteristics:
76
+ * - Unconfigured: Single null check + early return (near-zero cost)
77
+ * - Configured: Null check + function delegation
78
+ * - No object creation or intermediate allocations
79
+ */
80
+ export declare const logger: {
81
+ /**
82
+ * Log debug-level message through global logger
83
+ * No-op when global logger is null (zero overhead)
84
+ */
85
+ readonly debug: (...args: unknown[]) => void;
86
+ /**
87
+ * Log info-level message through global logger
88
+ * No-op when global logger is null (zero overhead)
89
+ */
90
+ readonly info: (...args: unknown[]) => void;
91
+ /**
92
+ * Log warning-level message through global logger
93
+ * No-op when global logger is null (zero overhead)
94
+ */
95
+ readonly warn: (...args: unknown[]) => void;
96
+ /**
97
+ * Log error-level message through global logger
98
+ * No-op when global logger is null (zero overhead)
99
+ */
100
+ readonly error: (...args: unknown[]) => void;
101
+ };
102
+ //# sourceMappingURL=globalLogger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globalLogger.d.ts","sourceRoot":"","sources":["../../src/utils/globalLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAa/C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAE3D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAMD;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM;IACjB;;;OAGG;8BACc,OAAO,EAAE,KAAG,IAAI;IAKjC;;;OAGG;6BACa,OAAO,EAAE,KAAG,IAAI;IAKhC;;;OAGG;6BACa,OAAO,EAAE,KAAG,IAAI;IAKhC;;;OAGG;8BACc,OAAO,EAAE,KAAG,IAAI;CAIzB,CAAC"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Global Logger Registry for Agent SDK
3
+ *
4
+ * Provides zero-overhead logging access for utility functions and services
5
+ * without requiring parameter passing. Maintains singleton logger instance
6
+ * accessible across all SDK modules.
7
+ *
8
+ * Features:
9
+ * - Zero overhead when no logger configured (single null check)
10
+ * - Thread-safe in Node.js single-threaded environment
11
+ * - Maintains backward compatibility with existing Logger interface
12
+ * - Direct function delegation when configured
13
+ */
14
+ /**
15
+ * Module-level storage for the global logger instance
16
+ * null = unconfigured (logging calls are no-ops)
17
+ * Logger = configured (calls are forwarded)
18
+ */
19
+ let globalLogger = null;
20
+ // =============================================================================
21
+ // Registry Management API
22
+ // =============================================================================
23
+ /**
24
+ * Configure the global logger instance used by utility functions and services
25
+ *
26
+ * @param logger - Logger instance implementing the Logger interface, or null to disable logging
27
+ * @returns void
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * import { setGlobalLogger } from './utils/globalLogger.js';
32
+ *
33
+ * // Configure logger
34
+ * setGlobalLogger(myLogger);
35
+ *
36
+ * // Disable logging
37
+ * setGlobalLogger(null);
38
+ * ```
39
+ */
40
+ export function setGlobalLogger(logger) {
41
+ globalLogger = logger;
42
+ }
43
+ /**
44
+ * Retrieve the current global logger instance
45
+ *
46
+ * @returns Current logger instance or null if unconfigured
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const currentLogger = getGlobalLogger();
51
+ * if (currentLogger) {
52
+ * currentLogger.info('Direct logger access');
53
+ * }
54
+ * ```
55
+ */
56
+ export function getGlobalLogger() {
57
+ return globalLogger;
58
+ }
59
+ /**
60
+ * Reset global logger to unconfigured state
61
+ * Equivalent to setGlobalLogger(null)
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * clearGlobalLogger(); // All subsequent logging calls become no-ops
66
+ * ```
67
+ */
68
+ export function clearGlobalLogger() {
69
+ globalLogger = null;
70
+ }
71
+ /**
72
+ * Check if global logger is currently configured
73
+ *
74
+ * @returns true if logger configured, false otherwise
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * if (isLoggerConfigured()) {
79
+ * // Perform expensive logging operation
80
+ * const debugInfo = generateDebugInfo();
81
+ * logger.debug(debugInfo);
82
+ * }
83
+ * ```
84
+ */
85
+ export function isLoggerConfigured() {
86
+ return globalLogger !== null;
87
+ }
88
+ // =============================================================================
89
+ // Zero-Overhead Logging API
90
+ // =============================================================================
91
+ /**
92
+ * Zero-overhead logging interface
93
+ *
94
+ * Performance characteristics:
95
+ * - Unconfigured: Single null check + early return (near-zero cost)
96
+ * - Configured: Null check + function delegation
97
+ * - No object creation or intermediate allocations
98
+ */
99
+ export const logger = {
100
+ /**
101
+ * Log debug-level message through global logger
102
+ * No-op when global logger is null (zero overhead)
103
+ */
104
+ debug: (...args) => {
105
+ if (globalLogger === null)
106
+ return;
107
+ globalLogger.debug(...args);
108
+ },
109
+ /**
110
+ * Log info-level message through global logger
111
+ * No-op when global logger is null (zero overhead)
112
+ */
113
+ info: (...args) => {
114
+ if (globalLogger === null)
115
+ return;
116
+ globalLogger.info(...args);
117
+ },
118
+ /**
119
+ * Log warning-level message through global logger
120
+ * No-op when global logger is null (zero overhead)
121
+ */
122
+ warn: (...args) => {
123
+ if (globalLogger === null)
124
+ return;
125
+ globalLogger.warn(...args);
126
+ },
127
+ /**
128
+ * Log error-level message through global logger
129
+ * No-op when global logger is null (zero overhead)
130
+ */
131
+ error: (...args) => {
132
+ if (globalLogger === null)
133
+ return;
134
+ globalLogger.error(...args);
135
+ },
136
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"mcpUtils.d.ts","sourceRoot":"","sources":["../../src/utils/mcpUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAElE;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,GACjB,0BAA0B,CAa5B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,CACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,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C5B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,eAAe,EAAE,GACzB,eAAe,GAAG,SAAS,CAK7B"}
@@ -1,10 +1,32 @@
1
+ /**
2
+ * Recursively clean schema to remove unsupported fields
3
+ */
4
+ function cleanSchema(schema) {
5
+ if (typeof schema !== "object" || schema === null) {
6
+ return schema;
7
+ }
8
+ if (Array.isArray(schema)) {
9
+ return schema.map(cleanSchema);
10
+ }
11
+ const newSchema = {};
12
+ const obj = schema;
13
+ for (const key in obj) {
14
+ // Remove $schema as OpenAI API doesn't accept it
15
+ // Remove exclusiveMinimum/exclusiveMaximum as some models (e.g. Gemini) don't support them
16
+ if (key === "$schema" ||
17
+ key === "exclusiveMinimum" ||
18
+ key === "exclusiveMaximum") {
19
+ continue;
20
+ }
21
+ newSchema[key] = cleanSchema(obj[key]);
22
+ }
23
+ return newSchema;
24
+ }
1
25
  /**
2
26
  * Convert MCP tool to OpenAI function tool format
3
27
  */
4
28
  export function mcpToolToOpenAITool(mcpTool, serverName) {
5
- // Remove $schema field if it exists, as OpenAI API doesn't accept it
6
- const cleanInputSchema = { ...mcpTool.inputSchema };
7
- delete cleanInputSchema.$schema;
29
+ const cleanInputSchema = cleanSchema(mcpTool.inputSchema);
8
30
  return {
9
31
  type: "function",
10
32
  function: {
@@ -1,4 +1,6 @@
1
- import type { Message, Usage, MessageSource } from "../types/index.js";
1
+ import type { Message, Usage } from "../types/index.js";
2
+ import { MessageSource } from "../types/index.js";
3
+ import type { SubagentConfiguration } from "./subagentParser.js";
2
4
  import { ChatCompletionMessageFunctionToolCall } from "openai/resources.js";
3
5
  export interface UserMessageParams {
4
6
  content: string;
@@ -19,7 +21,14 @@ export interface UpdateToolBlockParams {
19
21
  result?: string;
20
22
  success?: boolean;
21
23
  error?: string;
22
- isRunning?: boolean;
24
+ /**
25
+ * Tool execution stage:
26
+ * - 'start': Tool call initiated during AI streaming
27
+ * - 'streaming': Tool parameters being received incrementally
28
+ * - 'running': Tool execution in progress
29
+ * - 'end': Tool execution completed with final result
30
+ */
31
+ stage: "start" | "streaming" | "running" | "end";
23
32
  name?: string;
24
33
  shortResult?: string;
25
34
  images?: Array<{
@@ -27,6 +36,7 @@ export interface UpdateToolBlockParams {
27
36
  mediaType?: string;
28
37
  }>;
29
38
  compactParams?: string;
39
+ parametersChunk?: string;
30
40
  }
31
41
  export type AgentToolBlockUpdateParams = Omit<UpdateToolBlockParams, "messages">;
32
42
  export interface AddDiffBlockParams {
@@ -65,6 +75,7 @@ export interface CompleteCommandParams {
65
75
  }
66
76
  /**
67
77
  * Extract text content from user messages in the messages array
78
+ * Excludes messages with source HOOK to prevent hook-generated content from entering user history
68
79
  */
69
80
  export declare const extractUserInputHistory: (messages: Message[]) => string[];
70
81
  /**
@@ -74,9 +85,9 @@ export declare const extractUserInputHistory: (messages: Message[]) => string[];
74
85
  */
75
86
  export declare const convertImageToBase64: (imagePath: string) => string;
76
87
  export declare const addUserMessageToMessages: ({ messages, content, images, customCommandContent, source, }: AddUserMessageParams) => Message[];
77
- export declare const addAssistantMessageToMessages: (messages: Message[], content?: string, toolCalls?: ChatCompletionMessageFunctionToolCall[], usage?: Usage) => Message[];
88
+ export declare const addAssistantMessageToMessages: (messages: Message[], content?: string, toolCalls?: ChatCompletionMessageFunctionToolCall[], usage?: Usage, metadata?: Record<string, unknown>) => Message[];
78
89
  export declare const addDiffBlockToMessage: ({ messages, path, diffResult, }: AddDiffBlockParams) => Message[];
79
- export declare const updateToolBlockInMessage: ({ messages, id, parameters, result, success, error, isRunning, name, shortResult, images, compactParams, }: UpdateToolBlockParams) => Message[];
90
+ export declare const updateToolBlockInMessage: ({ messages, id, parameters, result, success, error, stage, name, shortResult, images, compactParams, parametersChunk, }: UpdateToolBlockParams) => Message[];
80
91
  export declare const addErrorBlockToMessage: ({ messages, error, }: AddErrorBlockParams) => Message[];
81
92
  export declare const addMemoryBlockToMessage: ({ messages, content, isSuccess, memoryType, storagePath, }: AddMemoryBlockParams) => Message[];
82
93
  /**
@@ -108,18 +119,19 @@ export interface AddSubagentBlockParams {
108
119
  subagentId: string;
109
120
  subagentName: string;
110
121
  status: "active" | "completed" | "error" | "aborted";
111
- subagentMessages?: Message[];
122
+ sessionId: string;
123
+ configuration: SubagentConfiguration;
112
124
  }
113
125
  export interface UpdateSubagentBlockParams {
114
126
  messages: Message[];
115
127
  subagentId: string;
116
128
  status: "active" | "completed" | "error" | "aborted";
117
- subagentMessages: Message[];
129
+ sessionId?: string;
118
130
  }
119
- export declare const addSubagentBlockToMessage: ({ messages, subagentId, subagentName, status, subagentMessages, }: AddSubagentBlockParams) => Message[];
131
+ export declare const addSubagentBlockToMessage: ({ messages, subagentId, subagentName, status, sessionId, configuration, }: AddSubagentBlockParams) => Message[];
120
132
  export declare const updateSubagentBlockInMessage: (messages: Message[], subagentId: string, updates: Partial<{
121
133
  status: "active" | "completed" | "error" | "aborted";
122
- messages: Message[];
134
+ sessionId: string;
123
135
  }>) => Message[];
124
136
  /**
125
137
  * Removes the last user message from the messages array
@@ -1 +1 @@
1
- {"version":3,"file":"messageOperations.d.ts","sourceRoot":"","sources":["../../src/utils/messageOperations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvE,OAAO,EAAE,qCAAqC,EAAE,MAAM,qBAAqB,CAAC;AAG5E,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAGD,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAA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