wave-agent-sdk 0.6.4 → 0.7.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 (174) hide show
  1. package/dist/agent.d.ts +8 -0
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +49 -240
  4. package/dist/constants/tools.d.ts +0 -2
  5. package/dist/constants/tools.d.ts.map +1 -1
  6. package/dist/constants/tools.js +0 -2
  7. package/dist/core/plugin.d.ts +86 -0
  8. package/dist/core/plugin.d.ts.map +1 -0
  9. package/dist/core/plugin.js +164 -0
  10. package/dist/index.d.ts +1 -4
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -5
  13. package/dist/managers/MemoryRuleManager.d.ts +3 -1
  14. package/dist/managers/MemoryRuleManager.d.ts.map +1 -1
  15. package/dist/managers/MemoryRuleManager.js +2 -1
  16. package/dist/managers/aiManager.d.ts +13 -23
  17. package/dist/managers/aiManager.d.ts.map +1 -1
  18. package/dist/managers/aiManager.js +59 -32
  19. package/dist/managers/backgroundTaskManager.d.ts +3 -1
  20. package/dist/managers/backgroundTaskManager.d.ts.map +1 -1
  21. package/dist/managers/backgroundTaskManager.js +2 -1
  22. package/dist/managers/bashManager.d.ts +4 -4
  23. package/dist/managers/bashManager.d.ts.map +1 -1
  24. package/dist/managers/bashManager.js +5 -2
  25. package/dist/managers/foregroundTaskManager.d.ts +3 -0
  26. package/dist/managers/foregroundTaskManager.d.ts.map +1 -1
  27. package/dist/managers/foregroundTaskManager.js +2 -1
  28. package/dist/managers/hookManager.d.ts +3 -3
  29. package/dist/managers/hookManager.d.ts.map +1 -1
  30. package/dist/managers/hookManager.js +20 -19
  31. package/dist/managers/liveConfigManager.d.ts +6 -13
  32. package/dist/managers/liveConfigManager.d.ts.map +1 -1
  33. package/dist/managers/liveConfigManager.js +50 -45
  34. package/dist/managers/lspManager.d.ts +4 -5
  35. package/dist/managers/lspManager.d.ts.map +1 -1
  36. package/dist/managers/lspManager.js +13 -12
  37. package/dist/managers/mcpManager.d.ts +3 -2
  38. package/dist/managers/mcpManager.d.ts.map +1 -1
  39. package/dist/managers/mcpManager.js +16 -15
  40. package/dist/managers/messageManager.d.ts +5 -7
  41. package/dist/managers/messageManager.d.ts.map +1 -1
  42. package/dist/managers/messageManager.js +12 -7
  43. package/dist/managers/permissionManager.d.ts +6 -4
  44. package/dist/managers/permissionManager.d.ts.map +1 -1
  45. package/dist/managers/permissionManager.js +39 -63
  46. package/dist/managers/planManager.d.ts +4 -6
  47. package/dist/managers/planManager.d.ts.map +1 -1
  48. package/dist/managers/planManager.js +18 -4
  49. package/dist/managers/pluginManager.d.ts +10 -22
  50. package/dist/managers/pluginManager.d.ts.map +1 -1
  51. package/dist/managers/pluginManager.js +27 -14
  52. package/dist/managers/reversionManager.d.ts +4 -3
  53. package/dist/managers/reversionManager.d.ts.map +1 -1
  54. package/dist/managers/reversionManager.js +5 -2
  55. package/dist/managers/skillManager.d.ts +3 -2
  56. package/dist/managers/skillManager.d.ts.map +1 -1
  57. package/dist/managers/skillManager.js +15 -14
  58. package/dist/managers/slashCommandManager.d.ts +9 -16
  59. package/dist/managers/slashCommandManager.d.ts.map +1 -1
  60. package/dist/managers/slashCommandManager.js +21 -10
  61. package/dist/managers/subagentManager.d.ts +7 -17
  62. package/dist/managers/subagentManager.d.ts.map +1 -1
  63. package/dist/managers/subagentManager.js +41 -34
  64. package/dist/managers/toolManager.d.ts +15 -38
  65. package/dist/managers/toolManager.d.ts.map +1 -1
  66. package/dist/managers/toolManager.js +66 -56
  67. package/dist/prompts/index.d.ts +6 -3
  68. package/dist/prompts/index.d.ts.map +1 -1
  69. package/dist/prompts/index.js +8 -16
  70. package/dist/services/MarketplaceService.d.ts.map +1 -1
  71. package/dist/services/MarketplaceService.js +13 -0
  72. package/dist/services/aiService.d.ts +4 -0
  73. package/dist/services/aiService.d.ts.map +1 -1
  74. package/dist/services/aiService.js +47 -7
  75. package/dist/services/configurationService.d.ts.map +1 -1
  76. package/dist/services/configurationService.js +30 -11
  77. package/dist/services/taskManager.d.ts +3 -1
  78. package/dist/services/taskManager.d.ts.map +1 -1
  79. package/dist/services/taskManager.js +2 -1
  80. package/dist/tools/bashTool.js +2 -2
  81. package/dist/tools/editTool.d.ts.map +1 -1
  82. package/dist/tools/editTool.js +9 -1
  83. package/dist/tools/readTool.d.ts.map +1 -1
  84. package/dist/tools/readTool.js +2 -2
  85. package/dist/tools/skillTool.d.ts +2 -4
  86. package/dist/tools/skillTool.d.ts.map +1 -1
  87. package/dist/tools/skillTool.js +61 -61
  88. package/dist/tools/taskOutputTool.js +1 -1
  89. package/dist/tools/taskTool.d.ts +2 -4
  90. package/dist/tools/taskTool.d.ts.map +1 -1
  91. package/dist/tools/taskTool.js +192 -187
  92. package/dist/tools/types.d.ts +11 -1
  93. package/dist/tools/types.d.ts.map +1 -1
  94. package/dist/tools/writeTool.d.ts.map +1 -1
  95. package/dist/tools/writeTool.js +4 -2
  96. package/dist/types/marketplace.d.ts +8 -0
  97. package/dist/types/marketplace.d.ts.map +1 -1
  98. package/dist/types/permissions.d.ts +1 -1
  99. package/dist/types/permissions.d.ts.map +1 -1
  100. package/dist/types/permissions.js +1 -3
  101. package/dist/types/skills.d.ts +0 -2
  102. package/dist/types/skills.d.ts.map +1 -1
  103. package/dist/types/tools.d.ts +0 -15
  104. package/dist/types/tools.d.ts.map +1 -1
  105. package/dist/utils/container.d.ts +31 -0
  106. package/dist/utils/container.d.ts.map +1 -0
  107. package/dist/utils/container.js +79 -0
  108. package/dist/utils/containerSetup.d.ts +26 -0
  109. package/dist/utils/containerSetup.d.ts.map +1 -0
  110. package/dist/utils/containerSetup.js +165 -0
  111. package/dist/utils/editUtils.d.ts +0 -3
  112. package/dist/utils/editUtils.d.ts.map +1 -1
  113. package/dist/utils/editUtils.js +4 -3
  114. package/dist/utils/hookMatcher.d.ts +1 -1
  115. package/dist/utils/hookMatcher.d.ts.map +1 -1
  116. package/dist/utils/hookMatcher.js +2 -2
  117. package/dist/utils/openaiClient.js +2 -2
  118. package/dist/utils/stringUtils.d.ts +6 -0
  119. package/dist/utils/stringUtils.d.ts.map +1 -1
  120. package/dist/utils/stringUtils.js +8 -0
  121. package/package.json +1 -1
  122. package/src/agent.ts +60 -282
  123. package/src/constants/tools.ts +0 -2
  124. package/src/core/plugin.ts +224 -0
  125. package/src/index.ts +1 -6
  126. package/src/managers/MemoryRuleManager.ts +6 -1
  127. package/src/managers/aiManager.ts +83 -58
  128. package/src/managers/backgroundTaskManager.ts +5 -1
  129. package/src/managers/bashManager.ts +9 -4
  130. package/src/managers/foregroundTaskManager.ts +3 -0
  131. package/src/managers/hookManager.ts +21 -23
  132. package/src/managers/liveConfigManager.ts +57 -53
  133. package/src/managers/lspManager.ts +14 -19
  134. package/src/managers/mcpManager.ts +20 -20
  135. package/src/managers/messageManager.ts +19 -12
  136. package/src/managers/permissionManager.ts +45 -70
  137. package/src/managers/planManager.ts +26 -7
  138. package/src/managers/pluginManager.ts +37 -33
  139. package/src/managers/reversionManager.ts +5 -3
  140. package/src/managers/skillManager.ts +19 -20
  141. package/src/managers/slashCommandManager.ts +30 -25
  142. package/src/managers/subagentManager.ts +53 -53
  143. package/src/managers/toolManager.ts +91 -90
  144. package/src/prompts/index.ts +12 -24
  145. package/src/services/MarketplaceService.ts +13 -0
  146. package/src/services/aiService.ts +61 -15
  147. package/src/services/configurationService.ts +34 -13
  148. package/src/services/taskManager.ts +5 -1
  149. package/src/tools/bashTool.ts +2 -2
  150. package/src/tools/editTool.ts +9 -1
  151. package/src/tools/readTool.ts +2 -2
  152. package/src/tools/skillTool.ts +75 -71
  153. package/src/tools/taskOutputTool.ts +1 -1
  154. package/src/tools/taskTool.ts +224 -225
  155. package/src/tools/types.ts +12 -1
  156. package/src/tools/writeTool.ts +4 -2
  157. package/src/types/marketplace.ts +9 -0
  158. package/src/types/permissions.ts +0 -4
  159. package/src/types/skills.ts +0 -3
  160. package/src/types/tools.ts +0 -17
  161. package/src/utils/container.ts +92 -0
  162. package/src/utils/containerSetup.ts +256 -0
  163. package/src/utils/editUtils.ts +4 -3
  164. package/src/utils/hookMatcher.ts +2 -2
  165. package/src/utils/openaiClient.ts +2 -2
  166. package/src/utils/stringUtils.ts +9 -0
  167. package/dist/tools/deleteFileTool.d.ts +0 -6
  168. package/dist/tools/deleteFileTool.d.ts.map +0 -1
  169. package/dist/tools/deleteFileTool.js +0 -100
  170. package/dist/tools/multiEditTool.d.ts +0 -6
  171. package/dist/tools/multiEditTool.d.ts.map +0 -1
  172. package/dist/tools/multiEditTool.js +0 -246
  173. package/src/tools/deleteFileTool.ts +0 -127
  174. package/src/tools/multiEditTool.ts +0 -306
@@ -1,6 +1,5 @@
1
- import type { MessageManager } from "./messageManager.js";
1
+ import { Container } from "../utils/container.js";
2
2
  export interface BashManagerOptions {
3
- messageManager: MessageManager;
4
3
  workdir: string;
5
4
  }
6
5
  export interface CommandExecutionResult {
@@ -8,11 +7,12 @@ export interface CommandExecutionResult {
8
7
  output: string;
9
8
  }
10
9
  export declare class BashManager {
10
+ private container;
11
11
  private workdir;
12
- private messageManager;
13
12
  isCommandRunning: boolean;
14
13
  private currentProcess;
15
- constructor(options: BashManagerOptions);
14
+ constructor(container: Container, options: BashManagerOptions);
15
+ private get messageManager();
16
16
  private setCommandRunning;
17
17
  executeCommand(command: string): Promise<number>;
18
18
  abortCommand(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"bashManager.d.ts","sourceRoot":"","sources":["../../src/managers/bashManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,cAAc,CAAiB;IAChC,gBAAgB,UAAS;IAChC,OAAO,CAAC,cAAc,CAA6B;gBAEvC,OAAO,EAAE,kBAAkB;IAKvC,OAAO,CAAC,iBAAiB;IAIZ,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAyDtD,YAAY,IAAI,IAAI;CAO5B"}
1
+ {"version":3,"file":"bashManager.d.ts","sourceRoot":"","sources":["../../src/managers/bashManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,WAAW;IAMpB,OAAO,CAAC,SAAS;IALnB,OAAO,CAAC,OAAO,CAAS;IACjB,gBAAgB,UAAS;IAChC,OAAO,CAAC,cAAc,CAA6B;gBAGzC,SAAS,EAAE,SAAS,EAC5B,OAAO,EAAE,kBAAkB;IAK7B,OAAO,KAAK,cAAc,GAEzB;IAED,OAAO,CAAC,iBAAiB;IAIZ,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAyDtD,YAAY,IAAI,IAAI;CAO5B"}
@@ -1,10 +1,13 @@
1
1
  import { spawn } from "child_process";
2
2
  export class BashManager {
3
- constructor(options) {
3
+ constructor(container, options) {
4
+ this.container = container;
4
5
  this.isCommandRunning = false;
5
6
  this.currentProcess = null;
6
7
  this.workdir = options.workdir;
7
- this.messageManager = options.messageManager;
8
+ }
9
+ get messageManager() {
10
+ return this.container.get("MessageManager");
8
11
  }
9
12
  setCommandRunning(isRunning) {
10
13
  this.isCommandRunning = isRunning;
@@ -1,6 +1,9 @@
1
1
  import { ForegroundTask, IForegroundTaskManager } from "../types/processes.js";
2
+ import { Container } from "../utils/container.js";
2
3
  export declare class ForegroundTaskManager implements IForegroundTaskManager {
4
+ private container;
3
5
  private activeForegroundTasks;
6
+ constructor(container: Container);
4
7
  registerForegroundTask(task: ForegroundTask): void;
5
8
  unregisterForegroundTask(id: string): void;
6
9
  backgroundCurrentTask(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"foregroundTaskManager.d.ts","sourceRoot":"","sources":["../../src/managers/foregroundTaskManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,qBAAa,qBAAsB,YAAW,sBAAsB;IAClE,OAAO,CAAC,qBAAqB,CAAwB;IAE9C,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAIlD,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAMpC,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5C,cAAc,IAAI,OAAO;CAGjC"}
1
+ {"version":3,"file":"foregroundTaskManager.d.ts","sourceRoot":"","sources":["../../src/managers/foregroundTaskManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,qBAAsB,YAAW,sBAAsB;IAGtD,OAAO,CAAC,SAAS;IAF7B,OAAO,CAAC,qBAAqB,CAAwB;gBAEjC,SAAS,EAAE,SAAS;IAEjC,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAIlD,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAMpC,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5C,cAAc,IAAI,OAAO;CAGjC"}
@@ -1,5 +1,6 @@
1
1
  export class ForegroundTaskManager {
2
- constructor() {
2
+ constructor(container) {
3
+ this.container = container;
3
4
  this.activeForegroundTasks = [];
4
5
  }
5
6
  registerForegroundTask(task) {
@@ -7,14 +7,14 @@
7
7
  import { type HookEvent, type HookExecutionContext, type ExtendedHookExecutionContext, type HookExecutionResult, type HookValidationResult } from "../types/hooks.js";
8
8
  import type { WaveConfiguration, PartialHookConfiguration } from "../types/configuration.js";
9
9
  import { HookMatcher } from "../utils/hookMatcher.js";
10
- import type { Logger } from "../types/index.js";
11
10
  import type { MessageManager } from "./messageManager.js";
11
+ import { Container } from "../utils/container.js";
12
12
  export declare class HookManager {
13
+ private container;
13
14
  private configuration;
14
15
  private readonly matcher;
15
- private readonly logger?;
16
16
  private readonly workdir;
17
- constructor(workdir: string, matcher?: HookMatcher, logger?: Logger);
17
+ constructor(container: Container, workdir: string, matcher?: HookMatcher);
18
18
  /**
19
19
  * Load and merge hook configurations from user and project settings
20
20
  * Project settings take precedence over user settings
@@ -1 +1 @@
1
- {"version":3,"file":"hookManager.d.ts","sourceRoot":"","sources":["../../src/managers/hookManager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,SAAS,EAEd,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAI1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,qBAAa,WAAW;IACtB,OAAO,CAAC,aAAa,CAAuC;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAG/B,OAAO,EAAE,MAAM,EACf,OAAO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, isValidHookEvent, isValidHookEventConfig, } fro
8
8
  import { HookMatcher } from "../utils/hookMatcher.js";
9
9
  import { executeCommand, isCommandSafe } from "../services/hook.js";
10
10
  import { MessageSource } from "../types/index.js";
11
+ import { logger } from "../utils/globalLogger.js";
11
12
  export class HookManager {
12
- constructor(workdir, matcher = new HookMatcher(), logger) {
13
+ constructor(container, workdir, matcher = new HookMatcher()) {
14
+ this.container = container;
13
15
  this.workdir = workdir;
14
16
  this.matcher = matcher;
15
- this.logger = logger;
16
17
  }
17
18
  /**
18
19
  * Load and merge hook configurations from user and project settings
@@ -41,7 +42,7 @@ export class HookManager {
41
42
  */
42
43
  loadConfigurationFromWaveConfig(waveConfig) {
43
44
  try {
44
- this.logger?.debug(`[HookManager] Loading hooks configuration from pre-loaded config...`);
45
+ logger?.debug(`[HookManager] Loading hooks configuration from pre-loaded config...`);
45
46
  this.configuration = waveConfig?.hooks || undefined;
46
47
  // Validate the loaded configuration if it exists
47
48
  if (waveConfig?.hooks) {
@@ -50,7 +51,7 @@ export class HookManager {
50
51
  throw new HookConfigurationError("provided configuration", validation.errors);
51
52
  }
52
53
  }
53
- this.logger?.debug(`[HookManager] Hooks configuration loaded successfully with ${Object.keys(waveConfig?.hooks || {}).length} event types`);
54
+ logger?.debug(`[HookManager] Hooks configuration loaded successfully with ${Object.keys(waveConfig?.hooks || {}).length} event types`);
54
55
  }
55
56
  catch (error) {
56
57
  // If loading fails, start with undefined configuration (no hooks)
@@ -60,7 +61,7 @@ export class HookManager {
60
61
  throw error;
61
62
  }
62
63
  else {
63
- this.logger?.warn(`[HookManager] Failed to load configuration, continuing with no hooks: ${error.message}`);
64
+ logger?.warn(`[HookManager] Failed to load configuration, continuing with no hooks: ${error.message}`);
64
65
  }
65
66
  }
66
67
  }
@@ -71,7 +72,7 @@ export class HookManager {
71
72
  // Validate execution context
72
73
  const contextValidation = this.validateExecutionContext(event, context);
73
74
  if (!contextValidation.valid) {
74
- this.logger?.error(`[HookManager] Invalid execution context for ${event}: ${contextValidation.errors.join(", ")}`);
75
+ logger?.error(`[HookManager] Invalid execution context for ${event}: ${contextValidation.errors.join(", ")}`);
75
76
  return [
76
77
  {
77
78
  success: false,
@@ -82,38 +83,38 @@ export class HookManager {
82
83
  ];
83
84
  }
84
85
  if (!this.configuration) {
85
- this.logger?.debug(`[HookManager] No configuration loaded, skipping ${event} hooks`);
86
+ logger?.debug(`[HookManager] No configuration loaded, skipping ${event} hooks`);
86
87
  return [];
87
88
  }
88
89
  const eventConfigs = this.configuration[event];
89
90
  if (!eventConfigs || eventConfigs.length === 0) {
90
- this.logger?.debug(`[HookManager] No hooks configured for ${event} event`);
91
+ logger?.debug(`[HookManager] No hooks configured for ${event} event`);
91
92
  return [];
92
93
  }
93
- this.logger?.debug(`[HookManager] Starting ${event} hook execution with ${eventConfigs.length} configurations`);
94
+ logger?.debug(`[HookManager] Starting ${event} hook execution with ${eventConfigs.length} configurations`);
94
95
  const results = [];
95
96
  const startTime = Date.now();
96
97
  for (let configIndex = 0; configIndex < eventConfigs.length; configIndex++) {
97
98
  const config = eventConfigs[configIndex];
98
99
  // Check if this config applies to the current context
99
100
  if (!this.configApplies(config, event, context.toolName)) {
100
- this.logger?.debug(`[HookManager] Skipping configuration ${configIndex + 1}: matcher '${config.matcher}' does not match tool '${context.toolName}'`);
101
+ logger?.debug(`[HookManager] Skipping configuration ${configIndex + 1}: matcher '${config.matcher}' does not match tool '${context.toolName}'`);
101
102
  continue;
102
103
  }
103
- this.logger?.debug(`[HookManager] Executing configuration ${configIndex + 1} with ${config.hooks.length} commands (matcher: ${config.matcher || "any"})`);
104
+ logger?.debug(`[HookManager] Executing configuration ${configIndex + 1} with ${config.hooks.length} commands (matcher: ${config.matcher || "any"})`);
104
105
  // Execute all commands for this configuration
105
106
  for (let commandIndex = 0; commandIndex < config.hooks.length; commandIndex++) {
106
107
  const hookCommand = config.hooks[commandIndex];
107
108
  try {
108
- this.logger?.debug(`[HookManager] Executing command ${commandIndex + 1}/${config.hooks.length} in configuration ${configIndex + 1}`);
109
+ logger?.debug(`[HookManager] Executing command ${commandIndex + 1}/${config.hooks.length} in configuration ${configIndex + 1}`);
109
110
  const result = await executeCommand(hookCommand.command, context, undefined);
110
111
  results.push(result);
111
112
  // Report individual command result
112
113
  if (result.success) {
113
- this.logger?.debug(`[HookManager] Command ${commandIndex + 1} completed successfully in ${result.duration}ms`);
114
+ logger?.debug(`[HookManager] Command ${commandIndex + 1} completed successfully in ${result.duration}ms`);
114
115
  }
115
116
  else {
116
- this.logger?.debug(`[HookManager] Command ${commandIndex + 1} failed in ${result.duration}ms (exit code: ${result.exitCode}, timed out: ${result.timedOut})`);
117
+ logger?.debug(`[HookManager] Command ${commandIndex + 1} failed in ${result.duration}ms (exit code: ${result.exitCode}, timed out: ${result.timedOut})`);
117
118
  }
118
119
  // Continue with next command even if this one fails
119
120
  // This allows for non-critical hooks to fail without stopping the workflow
@@ -121,7 +122,7 @@ export class HookManager {
121
122
  catch (error) {
122
123
  // This should be rare as executor handles most errors
123
124
  const errorMessage = error instanceof Error ? error.message : "Unknown execution error";
124
- this.logger?.error(`[HookManager] Unexpected error in command ${commandIndex + 1}: ${errorMessage}`);
125
+ logger?.error(`[HookManager] Unexpected error in command ${commandIndex + 1}: ${errorMessage}`);
125
126
  results.push({
126
127
  success: false,
127
128
  stderr: errorMessage,
@@ -134,7 +135,7 @@ export class HookManager {
134
135
  // Generate execution summary
135
136
  const totalDuration = Date.now() - startTime;
136
137
  const summary = this.generateExecutionSummary(event, results, totalDuration);
137
- this.logger?.debug(`[HookManager] ${event} execution summary: ${summary}`);
138
+ logger?.debug(`[HookManager] ${event} execution summary: ${summary}`);
138
139
  return results;
139
140
  }
140
141
  /**
@@ -367,7 +368,7 @@ export class HookManager {
367
368
  }
368
369
  // Warn about event mismatch but don't fail validation
369
370
  if (context.event !== event) {
370
- this.logger?.warn(`[HookManager] Context event '${context.event}' does not match requested event '${event}'`);
371
+ logger?.warn(`[HookManager] Context event '${context.event}' does not match requested event '${event}'`);
371
372
  }
372
373
  // Validate project directory
373
374
  if (!context.projectDir || typeof context.projectDir !== "string") {
@@ -389,7 +390,7 @@ export class HookManager {
389
390
  event === "Notification" ||
390
391
  event === "SubagentStop") &&
391
392
  context.toolName !== undefined) {
392
- this.logger?.warn(`[HookManager] ${event} event has unexpected toolName in context: ${context.toolName}`);
393
+ logger?.warn(`[HookManager] ${event} event has unexpected toolName in context: ${context.toolName}`);
393
394
  }
394
395
  return {
395
396
  valid: errors.length === 0,
@@ -537,6 +538,6 @@ export class HookManager {
537
538
  this.configuration = {};
538
539
  }
539
540
  this.mergeHooksConfiguration(this.configuration, hooks);
540
- this.logger?.debug(`Registered plugin hooks. Total event types: ${Object.keys(this.configuration).length}`);
541
+ logger?.debug(`Registered plugin hooks. Total event types: ${Object.keys(this.configuration).length}`);
541
542
  }
542
543
  }
@@ -6,25 +6,15 @@
6
6
  * - Configuration file watching for settings.json files
7
7
  * - Coordination between file watchers and configuration updates
8
8
  */
9
- import type { Logger } from "../types/index.js";
10
- import type { HookManager } from "./hookManager.js";
11
- import type { PermissionManager } from "./permissionManager.js";
12
- import { ConfigurationService } from "../services/configurationService.js";
9
+ import { Container } from "../utils/container.js";
13
10
  import type { WaveConfiguration } from "../types/configuration.js";
14
11
  export interface LiveConfigManagerOptions {
15
12
  workdir: string;
16
- logger?: Logger;
17
- hookManager?: HookManager;
18
- permissionManager?: PermissionManager;
19
- configurationService?: ConfigurationService;
20
13
  }
21
14
  export declare class LiveConfigManager {
15
+ private container;
22
16
  private readonly workdir;
23
- private readonly logger?;
24
- private readonly hookManager?;
25
- private readonly permissionManager?;
26
17
  private isInitialized;
27
- private readonly configurationService;
28
18
  private currentConfiguration;
29
19
  private lastValidConfiguration;
30
20
  private fileWatcher;
@@ -32,7 +22,10 @@ export declare class LiveConfigManager {
32
22
  private projectConfigPaths?;
33
23
  private isWatching;
34
24
  private reloadInProgress;
35
- constructor(options: LiveConfigManagerOptions);
25
+ constructor(container: Container, options: LiveConfigManagerOptions);
26
+ private get hookManager();
27
+ private get permissionManager();
28
+ private get configurationService();
36
29
  /**
37
30
  * Initialize configuration watching
38
31
  * Maps to FR-004: System MUST watch settings.json files
@@ -1 +1 @@
1
- {"version":3,"file":"liveConfigManager.d.ts","sourceRoot":"","sources":["../../src/managers/liveConfigManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAOhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAOhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAG3E,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC7C;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAoB;IACvD,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAuB;IAG5D,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,sBAAsB,CAAkC;IAGhE,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,eAAe,CAAC,CAAW;IACnC,OAAO,CAAC,kBAAkB,CAAC,CAAW;IACtC,OAAO,CAAC,UA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BAAgB,CAAkB;gBAGhC,SAAS,EAAE,SAAS,EAC5B,OAAO,EAAE,wBAAwB;IAOnC,OAAO,KAAK,WAAW,GAEtB;IAED,OAAO,KAAK,iBAAiB,GAE5B;IAED,OAAO,KAAK,oBAAoB,GAE/B;IAED;;;;OAIG;YACW,kBAAkB;IA6DhC;;OAEG;IACH,uBAAuB,IAAI,iBAAiB,GAAG,IAAI;IAInD;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBjC;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAyB/B;;;OAGG;YACW,mBAAmB;IAwNjC;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAK1C;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;OAEG;IACH,gBAAgB;;;;;;;;;;;;IAgBhB,OAAO,CAAC,sBAAsB;YAMhB,gBAAgB;IA8C9B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA4F7B,OAAO,CAAC,aAAa;IAuDrB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;CAQ9B"}
@@ -10,10 +10,11 @@ import { existsSync } from "fs";
10
10
  import { FileWatcherService, } from "../services/fileWatcher.js";
11
11
  import { getProjectConfigPaths, getUserConfigPaths, } from "../utils/configPaths.js";
12
12
  import { isValidHookEvent, isValidHookEventConfig } from "../types/hooks.js";
13
- import { ConfigurationService } from "../services/configurationService.js";
14
13
  import { ensureGlobalGitIgnore } from "../utils/fileUtils.js";
14
+ import { logger } from "../utils/globalLogger.js";
15
15
  export class LiveConfigManager {
16
- constructor(options) {
16
+ constructor(container, options) {
17
+ this.container = container;
17
18
  this.isInitialized = false;
18
19
  // Configuration state
19
20
  this.currentConfiguration = null;
@@ -21,14 +22,18 @@ export class LiveConfigManager {
21
22
  this.isWatching = false;
22
23
  this.reloadInProgress = false;
23
24
  this.workdir = options.workdir;
24
- this.logger = options.logger;
25
- this.hookManager = options.hookManager;
26
- this.permissionManager = options.permissionManager;
27
- this.configurationService =
28
- options.configurationService || new ConfigurationService();
29
- this.fileWatcher = new FileWatcherService(this.logger);
25
+ this.fileWatcher = new FileWatcherService(logger);
30
26
  this.setupFileWatcherEvents();
31
27
  }
28
+ get hookManager() {
29
+ return this.container.get("HookManager");
30
+ }
31
+ get permissionManager() {
32
+ return this.container.get("PermissionManager");
33
+ }
34
+ get configurationService() {
35
+ return this.container.get("ConfigurationService");
36
+ }
32
37
  /**
33
38
  * Initialize configuration watching
34
39
  * Maps to FR-004: System MUST watch settings.json files
@@ -36,7 +41,7 @@ export class LiveConfigManager {
36
41
  */
37
42
  async initializeWatching(userPaths, projectPaths) {
38
43
  try {
39
- this.logger?.debug("Live Config: Initializing configuration watching...");
44
+ logger?.debug("Live Config: Initializing configuration watching...");
40
45
  this.userConfigPaths = userPaths;
41
46
  this.projectConfigPaths = projectPaths;
42
47
  // Load initial configuration
@@ -44,11 +49,11 @@ export class LiveConfigManager {
44
49
  // Start watching user configs that exist
45
50
  for (const userPath of userPaths) {
46
51
  if (existsSync(userPath)) {
47
- this.logger?.debug(`Live Config: Starting to watch user config: ${userPath}`);
52
+ logger?.debug(`Live Config: Starting to watch user config: ${userPath}`);
48
53
  await this.fileWatcher.watchFile(userPath, (event) => this.handleFileChange(event, "user"));
49
54
  }
50
55
  else {
51
- this.logger?.debug(`Live Config: User config file does not exist: ${userPath}`);
56
+ logger?.debug(`Live Config: User config file does not exist: ${userPath}`);
52
57
  }
53
58
  }
54
59
  // Start watching project configs that exist
@@ -58,20 +63,20 @@ export class LiveConfigManager {
58
63
  if (projectPath.endsWith("settings.local.json")) {
59
64
  await ensureGlobalGitIgnore("**/.wave/settings.local.json");
60
65
  }
61
- this.logger?.debug(`Live Config: Starting to watch project config: ${projectPath}`);
66
+ logger?.debug(`Live Config: Starting to watch project config: ${projectPath}`);
62
67
  await this.fileWatcher.watchFile(projectPath, (event) => this.handleFileChange(event, "project"));
63
68
  }
64
69
  else {
65
- this.logger?.debug(`Live Config: Project config file does not exist: ${projectPath}`);
70
+ logger?.debug(`Live Config: Project config file does not exist: ${projectPath}`);
66
71
  }
67
72
  }
68
73
  }
69
74
  this.isWatching = true;
70
- this.logger?.debug("Live Config: Configuration watching initialized successfully");
75
+ logger?.debug("Live Config: Configuration watching initialized successfully");
71
76
  }
72
77
  catch (error) {
73
78
  const errorMessage = `Failed to initialize configuration watching: ${error.message}`;
74
- this.logger?.error(`Live Config: ${errorMessage}`);
79
+ logger?.error(`Live Config: ${errorMessage}`);
75
80
  throw new Error(errorMessage);
76
81
  }
77
82
  }
@@ -86,7 +91,7 @@ export class LiveConfigManager {
86
91
  */
87
92
  async initialize() {
88
93
  if (this.isInitialized) {
89
- this.logger?.debug("Already initialized");
94
+ logger?.debug("Already initialized");
90
95
  return;
91
96
  }
92
97
  try {
@@ -95,10 +100,10 @@ export class LiveConfigManager {
95
100
  // Initialize configuration watching
96
101
  await this.initializeWatching(userPaths, projectPaths);
97
102
  this.isInitialized = true;
98
- this.logger?.debug("Live configuration management initialized with file watching");
103
+ logger?.debug("Live configuration management initialized with file watching");
99
104
  }
100
105
  catch (error) {
101
- this.logger?.error(`Failed to initialize: ${error.message}`);
106
+ logger?.error(`Failed to initialize: ${error.message}`);
102
107
  throw error;
103
108
  }
104
109
  }
@@ -110,7 +115,7 @@ export class LiveConfigManager {
110
115
  return;
111
116
  }
112
117
  try {
113
- this.logger?.debug("Live Config: Shutting down configuration manager...");
118
+ logger?.debug("Live Config: Shutting down configuration manager...");
114
119
  this.isWatching = false;
115
120
  // Cleanup file watcher
116
121
  await this.fileWatcher.cleanup();
@@ -118,10 +123,10 @@ export class LiveConfigManager {
118
123
  this.currentConfiguration = null;
119
124
  this.lastValidConfiguration = null;
120
125
  this.isInitialized = false;
121
- this.logger?.debug("Live configuration management shutdown completed");
126
+ logger?.debug("Live configuration management shutdown completed");
122
127
  }
123
128
  catch (error) {
124
- this.logger?.error(`Error during shutdown: ${error.message}`);
129
+ logger?.error(`Error during shutdown: ${error.message}`);
125
130
  throw error;
126
131
  }
127
132
  }
@@ -131,26 +136,26 @@ export class LiveConfigManager {
131
136
  */
132
137
  async reloadConfiguration() {
133
138
  if (this.reloadInProgress) {
134
- this.logger?.debug("Live Config: Reload already in progress, skipping");
139
+ logger?.debug("Live Config: Reload already in progress, skipping");
135
140
  return this.currentConfiguration || {};
136
141
  }
137
142
  this.reloadInProgress = true;
138
143
  try {
139
- this.logger?.debug("Live Config: Reloading configuration from files...");
144
+ logger?.debug("Live Config: Reloading configuration from files...");
140
145
  // Load merged configuration using ConfigurationService
141
146
  const loadResult = await this.configurationService.loadMergedConfiguration(this.workdir);
142
147
  const newConfig = loadResult.configuration;
143
148
  // Check for errors during loading
144
149
  if (!loadResult.success) {
145
150
  const errorMessage = loadResult.error || "Configuration loading failed with unknown error";
146
- this.logger?.error(`Live Config: Configuration loading failed: ${errorMessage}`);
151
+ logger?.error(`Live Config: Configuration loading failed: ${errorMessage}`);
147
152
  // Log warnings if any
148
153
  if (loadResult.warnings && loadResult.warnings.length > 0) {
149
- this.logger?.warn(`Live Config: Configuration warnings: ${loadResult.warnings.join("; ")}`);
154
+ logger?.warn(`Live Config: Configuration warnings: ${loadResult.warnings.join("; ")}`);
150
155
  }
151
156
  // Use fallback configuration if available
152
157
  if (this.lastValidConfiguration) {
153
- this.logger?.debug("Live Config: Using previous valid configuration due to loading errors");
158
+ logger?.debug("Live Config: Using previous valid configuration due to loading errors");
154
159
  this.currentConfiguration = this.lastValidConfiguration;
155
160
  // Apply environment variables to configuration service if configured
156
161
  if (this.lastValidConfiguration.env) {
@@ -163,35 +168,35 @@ export class LiveConfigManager {
163
168
  return this.currentConfiguration;
164
169
  }
165
170
  else {
166
- this.logger?.warn("Live Config: No previous valid configuration available, using empty config");
171
+ logger?.warn("Live Config: No previous valid configuration available, using empty config");
167
172
  this.currentConfiguration = {};
168
173
  return this.currentConfiguration;
169
174
  }
170
175
  }
171
176
  // Log success with detailed information
172
177
  if (newConfig) {
173
- this.logger?.debug(`Live Config: Configuration loaded successfully from ${loadResult.sourcePath || "merged sources"}`);
178
+ logger?.debug(`Live Config: Configuration loaded successfully from ${loadResult.sourcePath || "merged sources"}`);
174
179
  // Log detailed configuration info
175
180
  const hookCount = Object.keys(newConfig.hooks || {}).length;
176
181
  const envCount = Object.keys(newConfig.env || {}).length;
177
- this.logger?.debug(`Live Config: Loaded ${hookCount} hook events and ${envCount} environment variables`);
182
+ logger?.debug(`Live Config: Loaded ${hookCount} hook events and ${envCount} environment variables`);
178
183
  }
179
184
  else {
180
- this.logger?.debug("Live Config: No configuration found (using empty configuration)");
185
+ logger?.debug("Live Config: No configuration found (using empty configuration)");
181
186
  }
182
187
  // Log warnings from successful loading
183
188
  if (loadResult.warnings && loadResult.warnings.length > 0) {
184
- this.logger?.warn(`Live Config: Configuration warnings: ${loadResult.warnings.join("; ")}`);
189
+ logger?.warn(`Live Config: Configuration warnings: ${loadResult.warnings.join("; ")}`);
185
190
  }
186
191
  // Validate new configuration if it exists
187
192
  if (newConfig) {
188
193
  const validation = this.validateConfiguration(newConfig);
189
194
  if (!validation.valid) {
190
195
  const errorMessage = `Configuration validation failed: ${validation.errors.join(", ")}`;
191
- this.logger?.error(`Live Config: ${errorMessage}`);
196
+ logger?.error(`Live Config: ${errorMessage}`);
192
197
  // Use previous valid configuration for error recovery
193
198
  if (this.lastValidConfiguration) {
194
- this.logger?.debug("Live Config: Using previous valid configuration due to validation errors");
199
+ logger?.debug("Live Config: Using previous valid configuration due to validation errors");
195
200
  this.currentConfiguration = this.lastValidConfiguration;
196
201
  // Apply environment variables to configuration service if configured
197
202
  if (this.lastValidConfiguration.env) {
@@ -204,7 +209,7 @@ export class LiveConfigManager {
204
209
  return this.currentConfiguration;
205
210
  }
206
211
  else {
207
- this.logger?.warn("Live Config: No previous valid configuration available, using empty config");
212
+ logger?.warn("Live Config: No previous valid configuration available, using empty config");
208
213
  this.currentConfiguration = {};
209
214
  return this.currentConfiguration;
210
215
  }
@@ -217,7 +222,7 @@ export class LiveConfigManager {
217
222
  // Save as last valid configuration if it's valid and not empty
218
223
  if (newConfig && (newConfig.hooks || newConfig.env)) {
219
224
  this.lastValidConfiguration = { ...newConfig };
220
- this.logger?.debug("Live Config: Saved current configuration as last valid backup");
225
+ logger?.debug("Live Config: Saved current configuration as last valid backup");
221
226
  }
222
227
  // Note: Environment variables are already applied by loadMergedConfiguration()
223
228
  // No need to set them again here as currentConfiguration === newConfig
@@ -240,15 +245,15 @@ export class LiveConfigManager {
240
245
  this.permissionManager.updateAdditionalDirectories(this.currentConfiguration.permissions.additionalDirectories);
241
246
  }
242
247
  }
243
- this.logger?.debug(`Live Config: Configuration reload completed successfully with ${Object.keys(newConfig?.hooks || {}).length} event types and ${Object.keys(newConfig?.env || {}).length} environment variables`);
248
+ logger?.debug(`Live Config: Configuration reload completed successfully with ${Object.keys(newConfig?.hooks || {}).length} event types and ${Object.keys(newConfig?.env || {}).length} environment variables`);
244
249
  return this.currentConfiguration;
245
250
  }
246
251
  catch (error) {
247
252
  const errorMessage = `Configuration reload failed with exception: ${error.message}`;
248
- this.logger?.error(`Live Config: ${errorMessage}`);
253
+ logger?.error(`Live Config: ${errorMessage}`);
249
254
  // Use previous valid configuration for error recovery
250
255
  if (this.lastValidConfiguration) {
251
- this.logger?.debug("Live Config: Using previous valid configuration due to reload exception");
256
+ logger?.debug("Live Config: Using previous valid configuration due to reload exception");
252
257
  this.currentConfiguration = this.lastValidConfiguration;
253
258
  // Apply environment variables to configuration service if configured
254
259
  if (this.lastValidConfiguration.env) {
@@ -260,7 +265,7 @@ export class LiveConfigManager {
260
265
  }
261
266
  }
262
267
  else {
263
- this.logger?.warn("Live Config: No previous valid configuration available, using empty config");
268
+ logger?.warn("Live Config: No previous valid configuration available, using empty config");
264
269
  this.currentConfiguration = {};
265
270
  }
266
271
  return this.currentConfiguration;
@@ -273,7 +278,7 @@ export class LiveConfigManager {
273
278
  * Reload configuration from files (public method)
274
279
  */
275
280
  async reload() {
276
- this.logger?.debug("Manually reloading configuration...");
281
+ logger?.debug("Manually reloading configuration...");
277
282
  return await this.reloadConfiguration();
278
283
  }
279
284
  /**
@@ -302,22 +307,22 @@ export class LiveConfigManager {
302
307
  }
303
308
  setupFileWatcherEvents() {
304
309
  this.fileWatcher.on("watcherError", (error) => {
305
- this.logger?.error(`Live Config: File watcher error: ${error.message}`);
310
+ logger?.error(`Live Config: File watcher error: ${error.message}`);
306
311
  });
307
312
  }
308
313
  async handleFileChange(event, source) {
309
- this.logger?.debug(`Live Config: File ${event.type} detected for ${source} config: ${event.path}`);
314
+ logger?.debug(`Live Config: File ${event.type} detected for ${source} config: ${event.path}`);
310
315
  try {
311
316
  // Handle file deletion
312
317
  if (event.type === "delete") {
313
- this.logger?.debug(`Live Config: ${source} config file deleted: ${event.path}`);
318
+ logger?.debug(`Live Config: ${source} config file deleted: ${event.path}`);
314
319
  // Reload configuration without the deleted file
315
320
  await this.reloadConfiguration();
316
321
  return;
317
322
  }
318
323
  // Handle file creation or modification
319
324
  if (event.type === "change" || event.type === "create") {
320
- this.logger?.debug(`Live Config: ${source} config file ${event.type}: ${event.path}`);
325
+ logger?.debug(`Live Config: ${source} config file ${event.type}: ${event.path}`);
321
326
  if (source === "project" &&
322
327
  event.path.endsWith("settings.local.json") &&
323
328
  event.type === "create") {
@@ -330,7 +335,7 @@ export class LiveConfigManager {
330
335
  }
331
336
  }
332
337
  catch (error) {
333
- this.logger?.error(`Live Config: Error handling file change for ${source} config: ${error.message}`);
338
+ logger?.error(`Live Config: Error handling file change for ${source} config: ${error.message}`);
334
339
  }
335
340
  }
336
341
  /**
@@ -1,5 +1,6 @@
1
1
  import { ChildProcess } from "child_process";
2
- import { Logger, LspServerConfig, ILspManager } from "../types/index.js";
2
+ import { LspServerConfig, ILspManager } from "../types/index.js";
3
+ import { Container } from "../utils/container.js";
3
4
  interface LspProcess {
4
5
  process: ChildProcess;
5
6
  config: LspServerConfig;
@@ -13,13 +14,11 @@ interface LspProcess {
13
14
  openedFiles: Set<string>;
14
15
  }
15
16
  export declare class LspManager implements ILspManager {
17
+ private container;
16
18
  private processes;
17
19
  private workdir;
18
- private logger?;
19
20
  private config;
20
- constructor(options?: {
21
- logger?: Logger;
22
- });
21
+ constructor(container: Container);
23
22
  initialize(workdir: string): Promise<void>;
24
23
  registerServer(language: string, config: LspServerConfig): void;
25
24
  private loadConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"lspManager.d.ts","sourceRoot":"","sources":["../../src/managers/lspManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAS,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,MAAM,EAEN,eAAe,EACf,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAI3B,UAAU,UAAU;IAClB,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,GAAG,CAClB,MAAM,EACN;QAAE,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;QAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;KAAE,CAC1E,CAAC;IACF,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC1B;AAED,qBAAa,UAAW,YAAW,WAAW;IAC5C,OAAO,CAAC,SAAS,CAAsC;IACvD,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,MAAM,CAAiB;gBAEnB,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO;IAIvC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhD,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI;YAKjD,UAAU;IAclB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