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.
- package/dist/agent.d.ts +32 -20
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +202 -20
- package/dist/constants/events.d.ts +28 -0
- package/dist/constants/events.d.ts.map +1 -0
- package/dist/constants/events.js +27 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/managers/aiManager.d.ts +34 -1
- package/dist/managers/aiManager.d.ts.map +1 -1
- package/dist/managers/aiManager.js +243 -128
- package/dist/managers/backgroundBashManager.d.ts.map +1 -1
- package/dist/managers/backgroundBashManager.js +7 -6
- package/dist/managers/hookManager.d.ts +9 -4
- package/dist/managers/hookManager.d.ts.map +1 -1
- package/dist/managers/hookManager.js +62 -30
- package/dist/managers/liveConfigManager.d.ts +58 -0
- package/dist/managers/liveConfigManager.d.ts.map +1 -0
- package/dist/managers/liveConfigManager.js +160 -0
- package/dist/managers/messageManager.d.ts +38 -13
- package/dist/managers/messageManager.d.ts.map +1 -1
- package/dist/managers/messageManager.js +163 -30
- package/dist/managers/slashCommandManager.d.ts.map +1 -1
- package/dist/managers/slashCommandManager.js +4 -1
- package/dist/managers/subagentManager.d.ts +51 -0
- package/dist/managers/subagentManager.d.ts.map +1 -1
- package/dist/managers/subagentManager.js +189 -18
- package/dist/services/aiService.d.ts +13 -5
- package/dist/services/aiService.d.ts.map +1 -1
- package/dist/services/aiService.js +350 -74
- package/dist/services/configurationWatcher.d.ts +120 -0
- package/dist/services/configurationWatcher.d.ts.map +1 -0
- package/dist/services/configurationWatcher.js +439 -0
- package/dist/services/fileWatcher.d.ts +69 -0
- package/dist/services/fileWatcher.d.ts.map +1 -0
- package/dist/services/fileWatcher.js +213 -0
- package/dist/services/hook.d.ts +91 -9
- package/dist/services/hook.d.ts.map +1 -1
- package/dist/services/hook.js +393 -43
- package/dist/services/jsonlHandler.d.ts +62 -0
- package/dist/services/jsonlHandler.d.ts.map +1 -0
- package/dist/services/jsonlHandler.js +257 -0
- package/dist/services/memory.d.ts +9 -0
- package/dist/services/memory.d.ts.map +1 -1
- package/dist/services/memory.js +81 -12
- package/dist/services/memoryStore.d.ts +81 -0
- package/dist/services/memoryStore.d.ts.map +1 -0
- package/dist/services/memoryStore.js +200 -0
- package/dist/services/session.d.ts +64 -49
- package/dist/services/session.d.ts.map +1 -1
- package/dist/services/session.js +310 -132
- package/dist/tools/bashTool.d.ts.map +1 -1
- package/dist/tools/bashTool.js +5 -4
- package/dist/tools/deleteFileTool.d.ts.map +1 -1
- package/dist/tools/deleteFileTool.js +2 -1
- package/dist/tools/editTool.d.ts.map +1 -1
- package/dist/tools/editTool.js +3 -2
- package/dist/tools/multiEditTool.d.ts.map +1 -1
- package/dist/tools/multiEditTool.js +4 -3
- package/dist/tools/readTool.d.ts.map +1 -1
- package/dist/tools/readTool.js +2 -1
- package/dist/tools/writeTool.d.ts.map +1 -1
- package/dist/tools/writeTool.js +5 -6
- package/dist/types/commands.d.ts +4 -0
- package/dist/types/commands.d.ts.map +1 -1
- package/dist/types/core.d.ts +35 -0
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/environment.d.ts +42 -0
- package/dist/types/environment.d.ts.map +1 -0
- package/dist/types/environment.js +21 -0
- package/dist/types/hooks.d.ts +8 -2
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/hooks.js +8 -2
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/memoryStore.d.ts +82 -0
- package/dist/types/memoryStore.d.ts.map +1 -0
- package/dist/types/memoryStore.js +7 -0
- package/dist/types/messaging.d.ts +14 -2
- package/dist/types/messaging.d.ts.map +1 -1
- package/dist/types/session.d.ts +20 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/session.js +7 -0
- package/dist/utils/bashHistory.d.ts.map +1 -1
- package/dist/utils/bashHistory.js +27 -26
- package/dist/utils/cacheControlUtils.d.ts +121 -0
- package/dist/utils/cacheControlUtils.d.ts.map +1 -0
- package/dist/utils/cacheControlUtils.js +367 -0
- package/dist/utils/commandPathResolver.d.ts +52 -0
- package/dist/utils/commandPathResolver.d.ts.map +1 -0
- package/dist/utils/commandPathResolver.js +145 -0
- package/dist/utils/configPaths.d.ts +85 -0
- package/dist/utils/configPaths.d.ts.map +1 -0
- package/dist/utils/configPaths.js +121 -0
- package/dist/utils/configResolver.d.ts +37 -10
- package/dist/utils/configResolver.d.ts.map +1 -1
- package/dist/utils/configResolver.js +127 -23
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/convertMessagesForAPI.d.ts.map +1 -1
- package/dist/utils/convertMessagesForAPI.js +7 -5
- package/dist/utils/customCommands.d.ts.map +1 -1
- package/dist/utils/customCommands.js +66 -21
- package/dist/utils/fileUtils.d.ts +15 -0
- package/dist/utils/fileUtils.d.ts.map +1 -0
- package/dist/utils/fileUtils.js +61 -0
- package/dist/utils/globalLogger.d.ts +102 -0
- package/dist/utils/globalLogger.d.ts.map +1 -0
- package/dist/utils/globalLogger.js +136 -0
- package/dist/utils/mcpUtils.d.ts.map +1 -1
- package/dist/utils/mcpUtils.js +25 -3
- package/dist/utils/messageOperations.d.ts +20 -8
- package/dist/utils/messageOperations.d.ts.map +1 -1
- package/dist/utils/messageOperations.js +25 -16
- package/dist/utils/pathEncoder.d.ts +104 -0
- package/dist/utils/pathEncoder.d.ts.map +1 -0
- package/dist/utils/pathEncoder.js +272 -0
- package/dist/utils/subagentParser.d.ts.map +1 -1
- package/dist/utils/subagentParser.js +2 -1
- package/dist/utils/tokenCalculation.d.ts +26 -0
- package/dist/utils/tokenCalculation.d.ts.map +1 -0
- package/dist/utils/tokenCalculation.js +36 -0
- package/package.json +6 -3
- package/src/agent.ts +298 -34
- package/src/constants/events.ts +38 -0
- package/src/index.ts +2 -0
- package/src/managers/aiManager.ts +323 -170
- package/src/managers/backgroundBashManager.ts +7 -6
- package/src/managers/hookManager.ts +83 -40
- package/src/managers/liveConfigManager.ts +248 -0
- package/src/managers/messageManager.ts +230 -63
- package/src/managers/slashCommandManager.ts +4 -1
- package/src/managers/subagentManager.ts +283 -21
- package/src/services/aiService.ts +474 -83
- package/src/services/configurationWatcher.ts +622 -0
- package/src/services/fileWatcher.ts +301 -0
- package/src/services/hook.ts +538 -47
- package/src/services/jsonlHandler.ts +319 -0
- package/src/services/memory.ts +92 -12
- package/src/services/memoryStore.ts +279 -0
- package/src/services/session.ts +381 -157
- package/src/tools/bashTool.ts +5 -4
- package/src/tools/deleteFileTool.ts +2 -1
- package/src/tools/editTool.ts +3 -2
- package/src/tools/multiEditTool.ts +4 -3
- package/src/tools/readTool.ts +2 -1
- package/src/tools/writeTool.ts +7 -6
- package/src/types/commands.ts +6 -0
- package/src/types/core.ts +44 -0
- package/src/types/environment.ts +60 -0
- package/src/types/hooks.ts +21 -8
- package/src/types/index.ts +2 -0
- package/src/types/memoryStore.ts +94 -0
- package/src/types/messaging.ts +14 -2
- package/src/types/session.ts +25 -0
- package/src/utils/bashHistory.ts +27 -27
- package/src/utils/cacheControlUtils.ts +540 -0
- package/src/utils/commandPathResolver.ts +189 -0
- package/src/utils/configPaths.ts +163 -0
- package/src/utils/configResolver.ts +182 -22
- package/src/utils/constants.ts +1 -1
- package/src/utils/convertMessagesForAPI.ts +7 -5
- package/src/utils/customCommands.ts +90 -22
- package/src/utils/fileUtils.ts +65 -0
- package/src/utils/globalLogger.ts +145 -0
- package/src/utils/mcpUtils.ts +34 -3
- package/src/utils/messageOperations.ts +42 -20
- package/src/utils/pathEncoder.ts +379 -0
- package/src/utils/subagentParser.ts +2 -1
- package/src/utils/tokenCalculation.ts +43 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Watcher Service
|
|
3
|
+
*
|
|
4
|
+
* Provides robust cross-platform file watching using Chokidar library.
|
|
5
|
+
* Handles file watching with debouncing, error recovery, and graceful fallbacks.
|
|
6
|
+
*/
|
|
7
|
+
import * as chokidar from "chokidar";
|
|
8
|
+
import { EventEmitter } from "events";
|
|
9
|
+
import { FILE_WATCHER_EVENTS } from "../constants/events.js";
|
|
10
|
+
export class FileWatcherService extends EventEmitter {
|
|
11
|
+
constructor(logger, config) {
|
|
12
|
+
super();
|
|
13
|
+
this.watchers = new Map();
|
|
14
|
+
this.globalWatcher = null;
|
|
15
|
+
this.logger = logger;
|
|
16
|
+
this.defaultConfig = {
|
|
17
|
+
stabilityThreshold: 300,
|
|
18
|
+
pollInterval: 100,
|
|
19
|
+
maxRetries: 3,
|
|
20
|
+
fallbackPolling: false,
|
|
21
|
+
ignoreTempFiles: true,
|
|
22
|
+
...config,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Start watching a file
|
|
27
|
+
* Maps to FR-010: Handle file deletion, creation, and modification
|
|
28
|
+
*/
|
|
29
|
+
async watchFile(path, callback) {
|
|
30
|
+
try {
|
|
31
|
+
if (this.watchers.has(path)) {
|
|
32
|
+
// Add callback to existing watcher
|
|
33
|
+
const entry = this.watchers.get(path);
|
|
34
|
+
entry.callbacks.add(callback);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// Create new watcher entry
|
|
38
|
+
const entry = {
|
|
39
|
+
path,
|
|
40
|
+
watcher: null,
|
|
41
|
+
isActive: false,
|
|
42
|
+
lastEvent: Date.now(),
|
|
43
|
+
errorCount: 0,
|
|
44
|
+
lastError: undefined,
|
|
45
|
+
callbacks: new Set([callback]),
|
|
46
|
+
config: { ...this.defaultConfig },
|
|
47
|
+
};
|
|
48
|
+
this.watchers.set(path, entry);
|
|
49
|
+
await this.initializeWatcher(entry);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
this.logger?.error(`Live Config: Failed to watch file ${path}: ${error.message}`);
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Stop watching a file
|
|
58
|
+
* Resource cleanup
|
|
59
|
+
*/
|
|
60
|
+
async unwatchFile(path) {
|
|
61
|
+
const entry = this.watchers.get(path);
|
|
62
|
+
if (!entry)
|
|
63
|
+
return;
|
|
64
|
+
try {
|
|
65
|
+
if (entry.watcher) {
|
|
66
|
+
entry.watcher.unwatch(path);
|
|
67
|
+
}
|
|
68
|
+
this.watchers.delete(path);
|
|
69
|
+
this.logger?.info(`Live Config: Stopped watching file: ${path}`);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
this.logger?.warn(`Live Config: Error unwatching file ${path}: ${error.message}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get watcher status
|
|
77
|
+
* Maps to FR-012: Handle watcher initialization failures
|
|
78
|
+
*/
|
|
79
|
+
getWatcherStatus(path) {
|
|
80
|
+
const entry = this.watchers.get(path);
|
|
81
|
+
if (!entry)
|
|
82
|
+
return null;
|
|
83
|
+
return {
|
|
84
|
+
isActive: entry.isActive,
|
|
85
|
+
path: entry.path,
|
|
86
|
+
method: entry.errorCount > 0
|
|
87
|
+
? "failed"
|
|
88
|
+
: entry.config.fallbackPolling
|
|
89
|
+
? "polling"
|
|
90
|
+
: "native",
|
|
91
|
+
errorCount: entry.errorCount,
|
|
92
|
+
lastError: entry.lastError,
|
|
93
|
+
lastEvent: entry.lastEvent > 0
|
|
94
|
+
? {
|
|
95
|
+
type: FILE_WATCHER_EVENTS.CHANGE,
|
|
96
|
+
path: entry.path,
|
|
97
|
+
timestamp: entry.lastEvent,
|
|
98
|
+
}
|
|
99
|
+
: undefined,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get all watcher statuses
|
|
104
|
+
* For monitoring and debugging
|
|
105
|
+
*/
|
|
106
|
+
getAllWatcherStatuses() {
|
|
107
|
+
return Array.from(this.watchers.keys())
|
|
108
|
+
.map((path) => this.getWatcherStatus(path))
|
|
109
|
+
.filter((status) => status !== null);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Configure watcher behavior
|
|
113
|
+
* Runtime configuration updates
|
|
114
|
+
*/
|
|
115
|
+
updateConfig(config) {
|
|
116
|
+
this.defaultConfig = { ...this.defaultConfig, ...config };
|
|
117
|
+
// Update existing watchers with new config
|
|
118
|
+
for (const entry of this.watchers.values()) {
|
|
119
|
+
entry.config = { ...entry.config, ...config };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Cleanup all watchers
|
|
124
|
+
*/
|
|
125
|
+
async cleanup() {
|
|
126
|
+
const paths = Array.from(this.watchers.keys());
|
|
127
|
+
await Promise.all(paths.map((path) => this.unwatchFile(path)));
|
|
128
|
+
if (this.globalWatcher) {
|
|
129
|
+
await this.globalWatcher.close();
|
|
130
|
+
this.globalWatcher = null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async initializeWatcher(entry) {
|
|
134
|
+
try {
|
|
135
|
+
// Initialize global watcher if needed
|
|
136
|
+
if (!this.globalWatcher) {
|
|
137
|
+
this.globalWatcher = chokidar.watch([], {
|
|
138
|
+
persistent: true,
|
|
139
|
+
ignoreInitial: true,
|
|
140
|
+
awaitWriteFinish: {
|
|
141
|
+
stabilityThreshold: entry.config.stabilityThreshold,
|
|
142
|
+
pollInterval: entry.config.pollInterval,
|
|
143
|
+
},
|
|
144
|
+
usePolling: entry.config.fallbackPolling,
|
|
145
|
+
interval: entry.config.pollInterval,
|
|
146
|
+
});
|
|
147
|
+
this.setupGlobalWatcherEvents();
|
|
148
|
+
}
|
|
149
|
+
// Add path to global watcher
|
|
150
|
+
this.globalWatcher.add(entry.path);
|
|
151
|
+
entry.watcher = this.globalWatcher;
|
|
152
|
+
entry.isActive = true;
|
|
153
|
+
entry.errorCount = 0;
|
|
154
|
+
this.logger?.info(`Live Config: Started watching file: ${entry.path}`);
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
entry.errorCount++;
|
|
158
|
+
entry.isActive = false;
|
|
159
|
+
entry.lastError = error.message;
|
|
160
|
+
this.logger?.error(`Live Config: Failed to initialize watcher for ${entry.path}: ${error.message}`);
|
|
161
|
+
// Try fallback polling if not already using it
|
|
162
|
+
if (!entry.config.fallbackPolling &&
|
|
163
|
+
entry.errorCount < entry.config.maxRetries) {
|
|
164
|
+
this.logger?.info(`Live Config: Attempting polling fallback for ${entry.path}`);
|
|
165
|
+
entry.config.fallbackPolling = true;
|
|
166
|
+
await this.initializeWatcher(entry);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
setupGlobalWatcherEvents() {
|
|
174
|
+
if (!this.globalWatcher)
|
|
175
|
+
return;
|
|
176
|
+
this.globalWatcher.on(FILE_WATCHER_EVENTS.CHANGE, (filePath, stats) => {
|
|
177
|
+
this.handleFileEvent(FILE_WATCHER_EVENTS.CHANGE, filePath, stats);
|
|
178
|
+
});
|
|
179
|
+
this.globalWatcher.on("add", (filePath, stats) => {
|
|
180
|
+
this.handleFileEvent(FILE_WATCHER_EVENTS.CREATE, filePath, stats);
|
|
181
|
+
});
|
|
182
|
+
this.globalWatcher.on("unlink", (filePath) => {
|
|
183
|
+
this.handleFileEvent(FILE_WATCHER_EVENTS.DELETE, filePath);
|
|
184
|
+
});
|
|
185
|
+
this.globalWatcher.on("error", (err) => {
|
|
186
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
187
|
+
this.logger?.error(`Live Config: File watcher error: ${error.message}`);
|
|
188
|
+
this.emit("watcherError", error);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
handleFileEvent(type, filePath, stats) {
|
|
192
|
+
const entry = this.watchers.get(filePath);
|
|
193
|
+
if (!entry)
|
|
194
|
+
return;
|
|
195
|
+
const event = {
|
|
196
|
+
type,
|
|
197
|
+
path: filePath,
|
|
198
|
+
timestamp: Date.now(),
|
|
199
|
+
size: stats?.size,
|
|
200
|
+
};
|
|
201
|
+
entry.lastEvent = event.timestamp;
|
|
202
|
+
// Notify all callbacks for this file
|
|
203
|
+
for (const callback of entry.callbacks) {
|
|
204
|
+
try {
|
|
205
|
+
callback(event);
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
this.logger?.error(`Live Config: Error in file watch callback for ${filePath}: ${error.message}`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
this.logger?.debug(`Live Config: File ${type} event for ${filePath}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
package/dist/services/hook.d.ts
CHANGED
|
@@ -4,53 +4,135 @@
|
|
|
4
4
|
* Consolidated hook services providing both execution and configuration functionality.
|
|
5
5
|
* Combines hook command execution and settings management into a single module.
|
|
6
6
|
*/
|
|
7
|
-
import { type HookExecutionContext, type HookExecutionResult, type HookExecutionOptions, type ExtendedHookExecutionContext, type PartialHookConfiguration } from "../types/hooks.js";
|
|
7
|
+
import { type HookExecutionContext, type HookExecutionResult, type HookExecutionOptions, type ExtendedHookExecutionContext, type WaveConfiguration, type PartialHookConfiguration } from "../types/hooks.js";
|
|
8
|
+
import { type EnvironmentValidationResult, type MergedEnvironmentContext, type EnvironmentMergeOptions } from "../types/environment.js";
|
|
8
9
|
/**
|
|
9
10
|
* Execute a single hook command
|
|
10
11
|
*/
|
|
11
|
-
export declare function executeCommand(command: string, context: HookExecutionContext | ExtendedHookExecutionContext, options?: HookExecutionOptions): Promise<HookExecutionResult>;
|
|
12
|
+
export declare function executeCommand(command: string, context: HookExecutionContext | ExtendedHookExecutionContext, options?: HookExecutionOptions, additionalEnvVars?: Record<string, string>): Promise<HookExecutionResult>;
|
|
12
13
|
/**
|
|
13
14
|
* Execute multiple commands in sequence
|
|
14
15
|
*/
|
|
15
|
-
export declare function executeCommands(commands: string[], context: HookExecutionContext | ExtendedHookExecutionContext, options?: HookExecutionOptions): Promise<HookExecutionResult[]>;
|
|
16
|
+
export declare function executeCommands(commands: string[], context: HookExecutionContext | ExtendedHookExecutionContext, options?: HookExecutionOptions, additionalEnvVars?: Record<string, string>): Promise<HookExecutionResult[]>;
|
|
16
17
|
/**
|
|
17
18
|
* Validate command safety (basic checks)
|
|
18
19
|
*/
|
|
19
20
|
export declare function isCommandSafe(command: string): boolean;
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
+
* Validate environment variable configuration
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateEnvironmentConfig(env: unknown, configPath?: string): EnvironmentValidationResult;
|
|
25
|
+
/**
|
|
26
|
+
* Merge environment configurations with project taking precedence over user
|
|
27
|
+
*/
|
|
28
|
+
export declare function mergeEnvironmentConfig(userEnv: Record<string, string> | undefined, projectEnv: Record<string, string> | undefined, options?: EnvironmentMergeOptions): MergedEnvironmentContext;
|
|
29
|
+
/**
|
|
30
|
+
* Get the user-specific hooks configuration file path (legacy function)
|
|
31
|
+
* @deprecated Use getUserConfigPaths() from configPaths.ts for better priority support
|
|
22
32
|
*/
|
|
23
33
|
export declare function getUserHooksConfigPath(): string;
|
|
24
34
|
/**
|
|
25
|
-
* Get the project-specific hooks configuration file path
|
|
35
|
+
* Get the project-specific hooks configuration file path (legacy function)
|
|
36
|
+
* @deprecated Use getProjectConfigPaths() from configPaths.ts for better priority support
|
|
26
37
|
*/
|
|
27
38
|
export declare function getProjectHooksConfigPath(workdir: string): string;
|
|
28
39
|
/**
|
|
29
|
-
*
|
|
40
|
+
* Get the user-specific hooks configuration file paths in priority order
|
|
41
|
+
* @deprecated Use getUserConfigPaths() from configPaths.ts directly
|
|
42
|
+
*/
|
|
43
|
+
export declare function getUserHooksConfigPaths(): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Get the project-specific hooks configuration file paths in priority order
|
|
46
|
+
* @deprecated Use getProjectConfigPaths() from configPaths.ts directly
|
|
47
|
+
*/
|
|
48
|
+
export declare function getProjectHooksConfigPaths(workdir: string): string[];
|
|
49
|
+
/**
|
|
50
|
+
* Load Wave configuration from a JSON file with graceful fallback
|
|
51
|
+
* This version is optimized for live reload scenarios where invalid config should not crash the system
|
|
52
|
+
*/
|
|
53
|
+
export declare function loadWaveConfigFromFileWithFallback(filePath: string, previousValidConfig?: WaveConfiguration | null): {
|
|
54
|
+
config: WaveConfiguration | null;
|
|
55
|
+
error?: string;
|
|
56
|
+
usedFallback: boolean;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Load Wave configuration from multiple file paths in priority order
|
|
60
|
+
* Returns the first valid configuration found, or null if none exist
|
|
61
|
+
*/
|
|
62
|
+
export declare function loadWaveConfigFromFiles(filePaths: string[]): WaveConfiguration | null;
|
|
63
|
+
/**
|
|
64
|
+
* Load Wave configuration from multiple file paths with graceful fallback
|
|
65
|
+
* Returns the first valid configuration found with fallback support
|
|
66
|
+
*/
|
|
67
|
+
export declare function loadWaveConfigFromFilesWithFallback(filePaths: string[], previousValidConfig?: WaveConfiguration | null): {
|
|
68
|
+
config: WaveConfiguration | null;
|
|
69
|
+
error?: string;
|
|
70
|
+
usedFallback: boolean;
|
|
71
|
+
usedPath?: string;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Load and merge Wave configuration with graceful fallback for live reload
|
|
75
|
+
* Provides error recovery by falling back to previous valid configuration
|
|
76
|
+
*/
|
|
77
|
+
export declare function loadMergedWaveConfigWithFallback(workdir: string, previousValidConfig?: WaveConfiguration | null): {
|
|
78
|
+
config: WaveConfiguration | null;
|
|
79
|
+
errors: string[];
|
|
80
|
+
usedFallback: boolean;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Load Wave configuration from a JSON file
|
|
84
|
+
* Supports both hooks and environment variables with proper validation
|
|
85
|
+
*/
|
|
86
|
+
export declare function loadWaveConfigFromFile(filePath: string): WaveConfiguration | null;
|
|
87
|
+
/**
|
|
88
|
+
* Load hooks configuration from a JSON file (legacy function)
|
|
30
89
|
*/
|
|
31
90
|
export declare function loadHooksConfigFromFile(filePath: string): PartialHookConfiguration | null;
|
|
32
91
|
/**
|
|
33
|
-
* Load user-specific
|
|
92
|
+
* Load user-specific Wave configuration
|
|
93
|
+
* Checks .local.json first, then falls back to .json
|
|
94
|
+
*/
|
|
95
|
+
export declare function loadUserWaveConfig(): WaveConfiguration | null;
|
|
96
|
+
/**
|
|
97
|
+
* Load project-specific Wave configuration
|
|
98
|
+
* Checks .local.json first, then falls back to .json
|
|
99
|
+
*/
|
|
100
|
+
export declare function loadProjectWaveConfig(workdir: string): WaveConfiguration | null;
|
|
101
|
+
/**
|
|
102
|
+
* Load user-specific hooks configuration (legacy function)
|
|
34
103
|
*/
|
|
35
104
|
export declare function loadUserHooksConfig(): PartialHookConfiguration | null;
|
|
36
105
|
/**
|
|
37
|
-
* Load project-specific hooks configuration
|
|
106
|
+
* Load project-specific hooks configuration (legacy function)
|
|
38
107
|
*/
|
|
39
108
|
export declare function loadProjectHooksConfig(workdir: string): PartialHookConfiguration | null;
|
|
40
109
|
/**
|
|
41
|
-
* Load and merge
|
|
110
|
+
* Load and merge Wave configuration from both user and project sources
|
|
111
|
+
* Project configuration takes precedence over user configuration
|
|
112
|
+
* Checks .local.json files first, then falls back to .json files
|
|
113
|
+
*/
|
|
114
|
+
export declare function loadMergedWaveConfig(workdir: string): WaveConfiguration | null;
|
|
115
|
+
/**
|
|
116
|
+
* Load and merge hooks configuration from both user and project sources (legacy function)
|
|
42
117
|
*/
|
|
43
118
|
export declare function loadMergedHooksConfig(workdir: string): PartialHookConfiguration | null;
|
|
44
119
|
/**
|
|
45
120
|
* Check if hooks configuration exists (user or project)
|
|
121
|
+
* Checks both .local.json and .json variants
|
|
122
|
+
* @deprecated Use hasAnyConfig() from configPaths.ts for better functionality
|
|
46
123
|
*/
|
|
47
124
|
export declare function hasHooksConfiguration(workdir: string): boolean;
|
|
48
125
|
/**
|
|
49
126
|
* Get hooks configuration information for debugging
|
|
127
|
+
* Includes both .local.json and .json variants
|
|
128
|
+
* @deprecated Use getConfigurationInfo() from configPaths.ts for better functionality
|
|
50
129
|
*/
|
|
51
130
|
export declare function getHooksConfigurationInfo(workdir: string): {
|
|
52
131
|
hasUser: boolean;
|
|
53
132
|
hasProject: boolean;
|
|
54
133
|
paths: string[];
|
|
134
|
+
userPaths: string[];
|
|
135
|
+
projectPaths: string[];
|
|
136
|
+
existingPaths: string[];
|
|
55
137
|
};
|
|
56
138
|
//# sourceMappingURL=hook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/services/hook.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/services/hook.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAEjC,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAG9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAE7B,MAAM,yBAAyB,CAAC;AAkDjC;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,EAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACzC,OAAO,CAAC,mBAAmB,CAAC,CAkH9B;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,EAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACzC,OAAO,CAAC,mBAAmB,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