wave-agent-sdk 0.9.2 → 0.9.3
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/core/session.d.ts +1 -1
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +1 -1
- package/dist/managers/liveConfigManager.d.ts +1 -5
- package/dist/managers/liveConfigManager.d.ts.map +1 -1
- package/dist/managers/liveConfigManager.js +12 -126
- package/dist/managers/permissionManager.d.ts.map +1 -1
- package/dist/managers/permissionManager.js +14 -1
- package/dist/services/configurationService.d.ts +1 -20
- package/dist/services/configurationService.d.ts.map +1 -1
- package/dist/services/configurationService.js +14 -93
- package/dist/tools/exitPlanMode.d.ts.map +1 -1
- package/dist/tools/exitPlanMode.js +7 -0
- package/dist/types/history.d.ts +1 -0
- package/dist/types/history.d.ts.map +1 -1
- package/dist/types/permissions.d.ts +1 -0
- package/dist/types/permissions.d.ts.map +1 -1
- package/dist/types/permissions.js +1 -0
- package/dist/utils/configPaths.d.ts +5 -5
- package/dist/utils/configPaths.js +6 -6
- package/dist/utils/promptHistory.d.ts +9 -3
- package/dist/utils/promptHistory.d.ts.map +1 -1
- package/dist/utils/promptHistory.js +16 -7
- package/package.json +1 -1
- package/src/core/session.ts +1 -0
- package/src/managers/liveConfigManager.ts +20 -163
- package/src/managers/permissionManager.ts +19 -1
- package/src/services/configurationService.ts +14 -116
- package/src/tools/exitPlanMode.ts +7 -0
- package/src/types/history.ts +1 -0
- package/src/types/permissions.ts +2 -0
- package/src/utils/configPaths.ts +6 -6
- package/src/utils/promptHistory.ts +27 -6
package/dist/core/session.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { listSessions, truncateContent, loadSessionFromJsonl, } from "../services/session.js";
|
|
1
|
+
export { listSessions, truncateContent, loadSessionFromJsonl, loadFullMessageThread, } from "../services/session.js";
|
|
2
2
|
export type { SessionMetadata, SessionData } from "../services/session.js";
|
|
3
3
|
//# sourceMappingURL=session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/core/session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,oBAAoB,
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/core/session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/core/session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { listSessions, truncateContent, loadSessionFromJsonl, } from "../services/session.js";
|
|
1
|
+
export { listSessions, truncateContent, loadSessionFromJsonl, loadFullMessageThread, } from "../services/session.js";
|
|
@@ -29,7 +29,7 @@ export declare class LiveConfigManager {
|
|
|
29
29
|
/**
|
|
30
30
|
* Initialize configuration watching
|
|
31
31
|
* Maps to FR-004: System MUST watch settings.json files
|
|
32
|
-
* Supports watching multiple file paths (e.g., settings.local.json and settings.json)
|
|
32
|
+
* Supports watching multiple file paths (e.g., local settings.local.json and settings.json)
|
|
33
33
|
*/
|
|
34
34
|
private initializeWatching;
|
|
35
35
|
/**
|
|
@@ -74,10 +74,6 @@ export declare class LiveConfigManager {
|
|
|
74
74
|
};
|
|
75
75
|
private setupFileWatcherEvents;
|
|
76
76
|
private handleFileChange;
|
|
77
|
-
/**
|
|
78
|
-
* Validate configuration structure and content
|
|
79
|
-
*/
|
|
80
|
-
private validateConfiguration;
|
|
81
77
|
private detectChanges;
|
|
82
78
|
/**
|
|
83
79
|
* Get configuration file paths for user and project settings
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveConfigManager.d.ts","sourceRoot":"","sources":["../../src/managers/liveConfigManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+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;;OAGG;IACH,OAAO,CAAC,qBAAqB;CAU9B"}
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { existsSync } from "fs";
|
|
10
10
|
import { FileWatcherService, } from "../services/fileWatcher.js";
|
|
11
|
-
import {
|
|
12
|
-
import { isValidHookEvent, isValidHookEventConfig } from "../types/hooks.js";
|
|
11
|
+
import { isValidHookEvent } from "../types/hooks.js";
|
|
13
12
|
import { ensureGlobalGitIgnore } from "../utils/fileUtils.js";
|
|
14
13
|
import { logger } from "../utils/globalLogger.js";
|
|
15
14
|
export class LiveConfigManager {
|
|
@@ -37,7 +36,7 @@ export class LiveConfigManager {
|
|
|
37
36
|
/**
|
|
38
37
|
* Initialize configuration watching
|
|
39
38
|
* Maps to FR-004: System MUST watch settings.json files
|
|
40
|
-
* Supports watching multiple file paths (e.g., settings.local.json and settings.json)
|
|
39
|
+
* Supports watching multiple file paths (e.g., local settings.local.json and settings.json)
|
|
41
40
|
*/
|
|
42
41
|
async initializeWatching(userPaths, projectPaths) {
|
|
43
42
|
try {
|
|
@@ -51,7 +50,7 @@ export class LiveConfigManager {
|
|
|
51
50
|
await this.fileWatcher.watchFile(userPath, (event) => this.handleFileChange(event, "user"));
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
|
-
// Start watching
|
|
53
|
+
// Start watching local configs that exist
|
|
55
54
|
if (projectPaths) {
|
|
56
55
|
for (const projectPath of projectPaths) {
|
|
57
56
|
if (existsSync(projectPath)) {
|
|
@@ -160,32 +159,6 @@ export class LiveConfigManager {
|
|
|
160
159
|
if (loadResult.warnings && loadResult.warnings.length > 0) {
|
|
161
160
|
logger?.warn(`Live Config: Configuration warnings: ${loadResult.warnings.join("; ")}`);
|
|
162
161
|
}
|
|
163
|
-
// Validate new configuration if it exists
|
|
164
|
-
if (newConfig) {
|
|
165
|
-
const validation = this.validateConfiguration(newConfig);
|
|
166
|
-
if (!validation.valid) {
|
|
167
|
-
const errorMessage = `Configuration validation failed: ${validation.errors.join(", ")}`;
|
|
168
|
-
logger?.error(`Live Config: ${errorMessage}`);
|
|
169
|
-
// Use previous valid configuration for error recovery
|
|
170
|
-
if (this.lastValidConfiguration) {
|
|
171
|
-
this.currentConfiguration = this.lastValidConfiguration;
|
|
172
|
-
// Apply environment variables to configuration service if configured
|
|
173
|
-
if (this.lastValidConfiguration.env) {
|
|
174
|
-
this.configurationService.setEnvironmentVars(this.lastValidConfiguration.env);
|
|
175
|
-
}
|
|
176
|
-
// Update hook manager if available
|
|
177
|
-
if (this.hookManager) {
|
|
178
|
-
this.hookManager.loadConfigurationFromWaveConfig(this.lastValidConfiguration);
|
|
179
|
-
}
|
|
180
|
-
return this.currentConfiguration;
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
logger?.warn("Live Config: No previous valid configuration available, using empty config");
|
|
184
|
-
this.currentConfiguration = {};
|
|
185
|
-
return this.currentConfiguration;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
162
|
// Detect changes between old and new configuration
|
|
190
163
|
this.detectChanges(this.currentConfiguration, newConfig);
|
|
191
164
|
// Update current configuration
|
|
@@ -202,18 +175,10 @@ export class LiveConfigManager {
|
|
|
202
175
|
}
|
|
203
176
|
// Update permission manager if available
|
|
204
177
|
if (this.permissionManager) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
this.permissionManager.updateAllowedRules(this.currentConfiguration.permissions.allow);
|
|
210
|
-
}
|
|
211
|
-
if (this.currentConfiguration.permissions?.deny) {
|
|
212
|
-
this.permissionManager.updateDeniedRules(this.currentConfiguration.permissions.deny);
|
|
213
|
-
}
|
|
214
|
-
if (this.currentConfiguration.permissions?.additionalDirectories) {
|
|
215
|
-
this.permissionManager.updateAdditionalDirectories(this.currentConfiguration.permissions.additionalDirectories);
|
|
216
|
-
}
|
|
178
|
+
this.permissionManager.updateConfiguredDefaultMode(this.currentConfiguration.permissions?.defaultMode);
|
|
179
|
+
this.permissionManager.updateAllowedRules(this.currentConfiguration.permissions?.allow || []);
|
|
180
|
+
this.permissionManager.updateDeniedRules(this.currentConfiguration.permissions?.deny || []);
|
|
181
|
+
this.permissionManager.updateAdditionalDirectories(this.currentConfiguration.permissions?.additionalDirectories || []);
|
|
217
182
|
}
|
|
218
183
|
return this.currentConfiguration;
|
|
219
184
|
}
|
|
@@ -302,87 +267,6 @@ export class LiveConfigManager {
|
|
|
302
267
|
logger?.error(`Live Config: Error handling file change for ${source} config: ${error.message}`);
|
|
303
268
|
}
|
|
304
269
|
}
|
|
305
|
-
/**
|
|
306
|
-
* Validate configuration structure and content
|
|
307
|
-
*/
|
|
308
|
-
validateConfiguration(config) {
|
|
309
|
-
const errors = [];
|
|
310
|
-
if (!config || typeof config !== "object") {
|
|
311
|
-
return { valid: false, errors: ["Configuration must be an object"] };
|
|
312
|
-
}
|
|
313
|
-
// Validate permissions if present
|
|
314
|
-
if (config.permissions) {
|
|
315
|
-
if (typeof config.permissions !== "object") {
|
|
316
|
-
errors.push("permissions property must be an object");
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
// Validate defaultMode if present
|
|
320
|
-
if (config.permissions.defaultMode !== undefined) {
|
|
321
|
-
const validModes = [
|
|
322
|
-
"default",
|
|
323
|
-
"bypassPermissions",
|
|
324
|
-
"acceptEdits",
|
|
325
|
-
"plan",
|
|
326
|
-
];
|
|
327
|
-
if (!validModes.includes(config.permissions.defaultMode)) {
|
|
328
|
-
errors.push(`Invalid defaultMode: "${config.permissions.defaultMode}". Must be one of: ${validModes.join(", ")}`);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
// Validate allow if present
|
|
332
|
-
if (config.permissions.allow) {
|
|
333
|
-
if (!Array.isArray(config.permissions.allow)) {
|
|
334
|
-
errors.push("permissions.allow must be an array");
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
// Validate hooks if present
|
|
340
|
-
if (config.hooks) {
|
|
341
|
-
if (typeof config.hooks !== "object") {
|
|
342
|
-
errors.push("hooks property must be an object");
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
// Validate each hook event
|
|
346
|
-
for (const [eventName, eventConfigs] of Object.entries(config.hooks)) {
|
|
347
|
-
// Validate event name
|
|
348
|
-
if (!isValidHookEvent(eventName)) {
|
|
349
|
-
errors.push(`Invalid hook event: ${eventName}`);
|
|
350
|
-
continue;
|
|
351
|
-
}
|
|
352
|
-
// Validate event configurations
|
|
353
|
-
if (!Array.isArray(eventConfigs)) {
|
|
354
|
-
errors.push(`Hook event ${eventName} must be an array of configurations`);
|
|
355
|
-
continue;
|
|
356
|
-
}
|
|
357
|
-
eventConfigs.forEach((eventConfig, index) => {
|
|
358
|
-
if (!isValidHookEventConfig(eventConfig)) {
|
|
359
|
-
errors.push(`Invalid hook event configuration at ${eventName}[${index}]`);
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
// Validate environment variables if present
|
|
366
|
-
if (config.env) {
|
|
367
|
-
if (typeof config.env !== "object" || Array.isArray(config.env)) {
|
|
368
|
-
errors.push("env property must be an object");
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
for (const [key, value] of Object.entries(config.env)) {
|
|
372
|
-
if (typeof key !== "string" || key.trim() === "") {
|
|
373
|
-
errors.push(`Invalid environment variable key: ${key}`);
|
|
374
|
-
}
|
|
375
|
-
if (typeof value !== "string") {
|
|
376
|
-
errors.push(`Environment variable ${key} must have a string value`);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
return {
|
|
382
|
-
valid: errors.length === 0,
|
|
383
|
-
errors,
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
270
|
detectChanges(oldConfig, newConfig) {
|
|
387
271
|
const added = [];
|
|
388
272
|
const modified = [];
|
|
@@ -428,8 +312,10 @@ export class LiveConfigManager {
|
|
|
428
312
|
* Returns paths in priority order (local.json first, then .json)
|
|
429
313
|
*/
|
|
430
314
|
getConfigurationPaths() {
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
|
|
315
|
+
const paths = this.configurationService.getConfigurationPaths(this.workdir);
|
|
316
|
+
return {
|
|
317
|
+
userPaths: paths.userPaths,
|
|
318
|
+
projectPaths: paths.projectPaths,
|
|
319
|
+
};
|
|
434
320
|
}
|
|
435
321
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissionManager.d.ts","sourceRoot":"","sources":["../../src/managers/permissionManager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAgBhD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AA8BlD,MAAM,WAAW,wBAAwB;IACvC,uDAAuD;IACvD,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,8DAA8D;IAC9D,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,iBAAiB;IAa1B,OAAO,CAAC,SAAS;IAZnB,OAAO,CAAC,qBAAqB,CAAC,CAAiB;IAC/C,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC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AAO,CAAC,gBAAgB;IAkCxB;;OAEG;IACH,uBAAuB,CAAC,iBAAiB,CAAC,EAAE,cAAc,GAAG,cAAc;IAI3E;;OAEG;IACH,8BAA8B,CAC5B,iBAAiB,CAAC,EAAE,cAAc,GACjC,cAAc;IAejB;;;OAGG;IACG,eAAe,CACnB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,kBAAkB,CAAC;IAyH9B;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI3C;;OAEG;IACH,aAAa,CACX,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,cAAc,EAC9B,QAAQ,CAAC,EAAE,kBAAkB,EAC7B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,qBAAqB;IAgFxB;;OAEG;IACH,OAAO,CAAC,WAAW;
|
|
1
|
+
{"version":3,"file":"permissionManager.d.ts","sourceRoot":"","sources":["../../src/managers/permissionManager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAgBhD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AA8BlD,MAAM,WAAW,wBAAwB;IACvC,uDAAuD;IACvD,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,8DAA8D;IAC9D,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sBAAsB;IACtB,M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SAAS,EAAE,MAAM,GAAG,IAAI;IAW5D;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIpC;;OAEG;IACI,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAItD;;OAEG;IACI,eAAe,IAAI,MAAM,GAAG,SAAS;IAI5C;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAkCxB;;OAEG;IACH,uBAAuB,CAAC,iBAAiB,CAAC,EAAE,cAAc,GAAG,cAAc;IAI3E;;OAEG;IACH,8BAA8B,CAC5B,iBAAiB,CAAC,EAAE,cAAc,GACjC,cAAc;IAejB;;;OAGG;IACG,eAAe,CACnB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,kBAAkB,CAAC;IAyH9B;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI3C;;OAEG;IACH,aAAa,CACX,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,cAAc,EAC9B,QAAQ,CAAC,EAAE,kBAAkB,EAC7B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,qBAAqB;IAgFxB;;OAEG;IACH,OAAO,CAAC,WAAW;IA0EnB;;OAEG;IACH,OAAO,CAAC,eAAe;IAiGvB;;;;;;;OAOG;IACI,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAmFjE;;;OAGG;IACU,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CA4C5D"}
|
|
@@ -436,7 +436,20 @@ export class PermissionManager {
|
|
|
436
436
|
const targetPath = (context.toolInput?.file_path ||
|
|
437
437
|
context.toolInput?.path);
|
|
438
438
|
if (targetPath) {
|
|
439
|
-
|
|
439
|
+
if (minimatch(targetPath, pattern, { dot: true })) {
|
|
440
|
+
return true;
|
|
441
|
+
}
|
|
442
|
+
// If direct match fails, try matching relative path if targetPath is absolute and pattern is relative
|
|
443
|
+
if (path.isAbsolute(targetPath) &&
|
|
444
|
+
!path.isAbsolute(pattern) &&
|
|
445
|
+
this.workdir) {
|
|
446
|
+
const relativePath = path.relative(this.workdir, targetPath);
|
|
447
|
+
// Ensure the path is not outside the workdir (doesn't start with ..)
|
|
448
|
+
if (!relativePath.startsWith("..") &&
|
|
449
|
+
!path.isAbsolute(relativePath)) {
|
|
450
|
+
return minimatch(relativePath, pattern, { dot: true });
|
|
451
|
+
}
|
|
452
|
+
}
|
|
440
453
|
}
|
|
441
454
|
}
|
|
442
455
|
return false;
|
|
@@ -34,10 +34,6 @@ export declare class ConfigurationService {
|
|
|
34
34
|
* Validate configuration file without loading
|
|
35
35
|
*/
|
|
36
36
|
validateConfigurationFile(filePath: string): ValidationResult;
|
|
37
|
-
/**
|
|
38
|
-
* Get currently loaded configuration
|
|
39
|
-
*/
|
|
40
|
-
getCurrentConfiguration(): WaveConfiguration | null;
|
|
41
37
|
/**
|
|
42
38
|
* Set environment variables from configuration
|
|
43
39
|
* This replaces direct process.env modification
|
|
@@ -101,7 +97,7 @@ export declare class ConfigurationService {
|
|
|
101
97
|
*/
|
|
102
98
|
getConfigurationPaths(workdir: string): ConfigurationPaths;
|
|
103
99
|
/**
|
|
104
|
-
* Add a permission rule to the
|
|
100
|
+
* Add a permission rule to the local settings.local.json
|
|
105
101
|
*/
|
|
106
102
|
addAllowedRule(workdir: string, rule: string): Promise<void>;
|
|
107
103
|
/**
|
|
@@ -135,21 +131,6 @@ export declare function mergeEnvironmentConfig(userEnv: Record<string, string> |
|
|
|
135
131
|
* Supports both hooks and environment variables with proper validation
|
|
136
132
|
*/
|
|
137
133
|
export declare function loadWaveConfigFromFile(filePath: string): WaveConfiguration | null;
|
|
138
|
-
/**
|
|
139
|
-
* Load Wave configuration from multiple file paths in priority order
|
|
140
|
-
* Returns the first valid configuration found, or null if none exist
|
|
141
|
-
*/
|
|
142
|
-
export declare function loadWaveConfigFromFiles(filePaths: string[]): WaveConfiguration | null;
|
|
143
|
-
/**
|
|
144
|
-
* Load user-specific Wave configuration
|
|
145
|
-
* Checks .local.json first, then falls back to .json
|
|
146
|
-
*/
|
|
147
|
-
export declare function loadUserWaveConfig(): WaveConfiguration | null;
|
|
148
|
-
/**
|
|
149
|
-
* Load project-specific Wave configuration
|
|
150
|
-
* Checks .local.json first, then falls back to .json
|
|
151
|
-
*/
|
|
152
|
-
export declare function loadProjectWaveConfig(workdir: string): WaveConfiguration | null;
|
|
153
134
|
/**
|
|
154
135
|
* Load and merge Wave configuration from both user and project sources
|
|
155
136
|
* Project configuration takes precedence over user configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurationService.d.ts","sourceRoot":"","sources":["../../src/services/configurationService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EACV,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,EACN,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAE7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,WAAW,EAGX,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAGvC;;;;;GAKG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,GAAG,CAA8B;IACzC,OAAO,CAAC,OAAO,CAAoB;IAEnC;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAMvC;;OAEG;IACG,uBAAuB,CAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"configurationService.d.ts","sourceRoot":"","sources":["../../src/services/configurationService.ts"],"names":[],"m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AO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC9C,OAAO,GAAE,uBAA4B,GACpC,wBAAwB,CAoC1B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,GACf,iBAAiB,GAAG,IAAI,CA4B1B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GACd,iBAAiB,GAAG,IAAI,CAoI1B"}
|
|
@@ -36,41 +36,27 @@ export class ConfigurationService {
|
|
|
36
36
|
*/
|
|
37
37
|
async loadMergedConfiguration(workdir) {
|
|
38
38
|
try {
|
|
39
|
-
const userConfigPaths = getUserConfigPaths();
|
|
40
|
-
const projectConfigPaths = getProjectConfigPaths(workdir);
|
|
41
39
|
// Use the merged configuration function (this loads user and project configs internally)
|
|
42
40
|
const mergedConfig = loadMergedWaveConfig(workdir);
|
|
43
|
-
// Track loading context for better error messages by checking which files exist
|
|
44
|
-
const loadingContext = [];
|
|
45
|
-
const userPath = userConfigPaths.find((path) => existsSync(path));
|
|
46
|
-
if (userPath) {
|
|
47
|
-
loadingContext.push(`user config from ${userPath}`);
|
|
48
|
-
}
|
|
49
|
-
const projectPath = projectConfigPaths.find((path) => existsSync(path));
|
|
50
|
-
if (projectPath) {
|
|
51
|
-
loadingContext.push(`project config from ${projectPath}`);
|
|
52
|
-
}
|
|
53
41
|
if (!mergedConfig) {
|
|
54
|
-
const message = loadingContext.length > 0
|
|
55
|
-
? `No valid configuration found despite attempting to load: ${loadingContext.join(", ")}`
|
|
56
|
-
: "No configuration files found in user or project directories";
|
|
57
42
|
// Still set system environment variables even if no config is found
|
|
58
43
|
const env = { WAVE_PROJECT_DIR: workdir };
|
|
59
44
|
this.setEnvironmentVars(env);
|
|
60
45
|
return {
|
|
61
46
|
configuration: { env },
|
|
62
47
|
success: true, // No config is valid
|
|
63
|
-
warnings: [
|
|
48
|
+
warnings: [
|
|
49
|
+
"No configuration files found in user or project directories",
|
|
50
|
+
],
|
|
64
51
|
};
|
|
65
52
|
}
|
|
66
53
|
// Comprehensive validation
|
|
67
54
|
const validation = this.validateConfiguration(mergedConfig);
|
|
68
55
|
if (!validation.isValid) {
|
|
69
|
-
const sourcePaths = loadingContext.join(" and ");
|
|
70
56
|
return {
|
|
71
57
|
configuration: null,
|
|
72
58
|
success: false,
|
|
73
|
-
error: `Merged configuration validation failed
|
|
59
|
+
error: `Merged configuration validation failed: ${validation.errors.join(", ")}`,
|
|
74
60
|
warnings: validation.warnings,
|
|
75
61
|
};
|
|
76
62
|
}
|
|
@@ -83,11 +69,10 @@ export class ConfigurationService {
|
|
|
83
69
|
};
|
|
84
70
|
this.setEnvironmentVars(env);
|
|
85
71
|
mergedConfig.env = env;
|
|
86
|
-
const sourcePaths = loadingContext.join(" and ");
|
|
87
72
|
return {
|
|
88
73
|
configuration: mergedConfig,
|
|
89
74
|
success: true,
|
|
90
|
-
sourcePath:
|
|
75
|
+
sourcePath: "merged configuration",
|
|
91
76
|
warnings: validation.warnings,
|
|
92
77
|
};
|
|
93
78
|
}
|
|
@@ -260,12 +245,6 @@ export class ConfigurationService {
|
|
|
260
245
|
return result;
|
|
261
246
|
}
|
|
262
247
|
// Utility operations
|
|
263
|
-
/**
|
|
264
|
-
* Get currently loaded configuration
|
|
265
|
-
*/
|
|
266
|
-
getCurrentConfiguration() {
|
|
267
|
-
return this.currentConfiguration;
|
|
268
|
-
}
|
|
269
248
|
/**
|
|
270
249
|
* Set environment variables from configuration
|
|
271
250
|
* This replaces direct process.env modification
|
|
@@ -318,15 +297,6 @@ export class ConfigurationService {
|
|
|
318
297
|
else {
|
|
319
298
|
resolvedBaseURL = this.env.WAVE_BASE_URL || "";
|
|
320
299
|
}
|
|
321
|
-
// If we have a parent configuration, use it as a fallback for API key and base URL
|
|
322
|
-
if (this.currentConfiguration?.env) {
|
|
323
|
-
if (resolvedApiKey === undefined) {
|
|
324
|
-
resolvedApiKey = this.currentConfiguration.env.WAVE_API_KEY;
|
|
325
|
-
}
|
|
326
|
-
if (!resolvedBaseURL) {
|
|
327
|
-
resolvedBaseURL = this.currentConfiguration.env.WAVE_BASE_URL || "";
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
300
|
// Fallback to process.env if still not resolved (for dynamic updates in tests)
|
|
331
301
|
if (resolvedApiKey === undefined) {
|
|
332
302
|
resolvedApiKey = process.env.WAVE_API_KEY;
|
|
@@ -376,16 +346,10 @@ export class ConfigurationService {
|
|
|
376
346
|
const DEFAULT_FAST_MODEL = "gemini-2.5-flash";
|
|
377
347
|
// Resolve agent model: override > options > env (settings.json) > process.env > default
|
|
378
348
|
let resolvedAgentModel = model || this.options.model || this.env.WAVE_MODEL;
|
|
379
|
-
if (!resolvedAgentModel && this.currentConfiguration?.env?.WAVE_MODEL) {
|
|
380
|
-
resolvedAgentModel = this.currentConfiguration.env.WAVE_MODEL;
|
|
381
|
-
}
|
|
382
349
|
resolvedAgentModel =
|
|
383
350
|
resolvedAgentModel || process.env.WAVE_MODEL || DEFAULT_AGENT_MODEL;
|
|
384
351
|
// Resolve fast model: override > options > env (settings.json) > process.env > default
|
|
385
352
|
let resolvedFastModel = fastModel || this.options.fastModel || this.env.WAVE_FAST_MODEL;
|
|
386
|
-
if (!resolvedFastModel && this.currentConfiguration?.env?.WAVE_FAST_MODEL) {
|
|
387
|
-
resolvedFastModel = this.currentConfiguration.env.WAVE_FAST_MODEL;
|
|
388
|
-
}
|
|
389
353
|
resolvedFastModel =
|
|
390
354
|
resolvedFastModel || process.env.WAVE_FAST_MODEL || DEFAULT_FAST_MODEL;
|
|
391
355
|
// Resolve max output tokens
|
|
@@ -502,7 +466,7 @@ export class ConfigurationService {
|
|
|
502
466
|
};
|
|
503
467
|
}
|
|
504
468
|
/**
|
|
505
|
-
* Add a permission rule to the
|
|
469
|
+
* Add a permission rule to the local settings.local.json
|
|
506
470
|
*/
|
|
507
471
|
async addAllowedRule(workdir, rule) {
|
|
508
472
|
const localConfigPath = path.join(workdir, ".wave", "settings.local.json");
|
|
@@ -541,13 +505,13 @@ export class ConfigurationService {
|
|
|
541
505
|
}
|
|
542
506
|
let configPath;
|
|
543
507
|
if (scope === "user") {
|
|
544
|
-
configPath = getUserConfigPaths()[
|
|
508
|
+
configPath = getUserConfigPaths()[0]; // settings.json
|
|
545
509
|
}
|
|
546
510
|
else if (scope === "project") {
|
|
547
511
|
configPath = getProjectConfigPaths(workdir)[1]; // settings.json
|
|
548
512
|
}
|
|
549
513
|
else {
|
|
550
|
-
configPath = getProjectConfigPaths(workdir)[0]; // settings.local.json
|
|
514
|
+
configPath = getProjectConfigPaths(workdir)[0]; // local settings.local.json
|
|
551
515
|
}
|
|
552
516
|
// Ensure directory exists
|
|
553
517
|
const configDir = path.dirname(configPath);
|
|
@@ -579,13 +543,13 @@ export class ConfigurationService {
|
|
|
579
543
|
}
|
|
580
544
|
let configPath;
|
|
581
545
|
if (scope === "user") {
|
|
582
|
-
configPath = getUserConfigPaths()[
|
|
546
|
+
configPath = getUserConfigPaths()[0]; // settings.json
|
|
583
547
|
}
|
|
584
548
|
else if (scope === "project") {
|
|
585
549
|
configPath = getProjectConfigPaths(workdir)[1]; // settings.json
|
|
586
550
|
}
|
|
587
551
|
else {
|
|
588
|
-
configPath = getProjectConfigPaths(workdir)[0]; // settings.local.json
|
|
552
|
+
configPath = getProjectConfigPaths(workdir)[0]; // local settings.local.json
|
|
589
553
|
}
|
|
590
554
|
if (!existsSync(configPath)) {
|
|
591
555
|
return; // Nothing to remove
|
|
@@ -710,21 +674,6 @@ export function loadWaveConfigFromFile(filePath) {
|
|
|
710
674
|
try {
|
|
711
675
|
const content = readFileSync(filePath, "utf-8");
|
|
712
676
|
const config = JSON.parse(content);
|
|
713
|
-
// Validate basic structure
|
|
714
|
-
if (!config || typeof config !== "object") {
|
|
715
|
-
throw new Error(`Invalid configuration structure in ${filePath}`);
|
|
716
|
-
}
|
|
717
|
-
// Validate environment variables if present
|
|
718
|
-
if (config.env !== undefined) {
|
|
719
|
-
const envValidation = validateEnvironmentConfig(config.env, filePath);
|
|
720
|
-
if (!envValidation.isValid) {
|
|
721
|
-
throw new Error(`Environment variable validation failed in ${filePath}: ${envValidation.errors.join(", ")}`);
|
|
722
|
-
}
|
|
723
|
-
// Log warnings if any
|
|
724
|
-
if (envValidation.warnings.length > 0) {
|
|
725
|
-
console.warn(`Environment variable warnings in ${filePath}:\n- ${envValidation.warnings.join("\n- ")}`);
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
677
|
return {
|
|
729
678
|
hooks: config.hooks || undefined,
|
|
730
679
|
env: config.env || undefined,
|
|
@@ -744,48 +693,20 @@ export function loadWaveConfigFromFile(filePath) {
|
|
|
744
693
|
throw error;
|
|
745
694
|
}
|
|
746
695
|
}
|
|
747
|
-
/**
|
|
748
|
-
* Load Wave configuration from multiple file paths in priority order
|
|
749
|
-
* Returns the first valid configuration found, or null if none exist
|
|
750
|
-
*/
|
|
751
|
-
export function loadWaveConfigFromFiles(filePaths) {
|
|
752
|
-
for (const filePath of filePaths) {
|
|
753
|
-
const config = loadWaveConfigFromFile(filePath);
|
|
754
|
-
if (config !== null) {
|
|
755
|
-
return config;
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
return null;
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* Load user-specific Wave configuration
|
|
762
|
-
* Checks .local.json first, then falls back to .json
|
|
763
|
-
*/
|
|
764
|
-
export function loadUserWaveConfig() {
|
|
765
|
-
return loadWaveConfigFromFiles(getUserConfigPaths());
|
|
766
|
-
}
|
|
767
|
-
/**
|
|
768
|
-
* Load project-specific Wave configuration
|
|
769
|
-
* Checks .local.json first, then falls back to .json
|
|
770
|
-
*/
|
|
771
|
-
export function loadProjectWaveConfig(workdir) {
|
|
772
|
-
return loadWaveConfigFromFiles(getProjectConfigPaths(workdir));
|
|
773
|
-
}
|
|
774
696
|
/**
|
|
775
697
|
* Load and merge Wave configuration from both user and project sources
|
|
776
698
|
* Project configuration takes precedence over user configuration
|
|
777
699
|
* Checks .local.json files first, then falls back to .json files
|
|
778
700
|
*/
|
|
779
701
|
export function loadMergedWaveConfig(workdir) {
|
|
780
|
-
const userPaths = getUserConfigPaths(); // [
|
|
702
|
+
const userPaths = getUserConfigPaths(); // [json]
|
|
781
703
|
const projectPaths = getProjectConfigPaths(workdir); // [local, json]
|
|
782
704
|
// Priority order (lowest to highest):
|
|
783
|
-
// user settings.json ->
|
|
705
|
+
// user settings.json -> project settings.json -> local settings.local.json
|
|
784
706
|
const pathsToLoad = [
|
|
785
|
-
userPaths[
|
|
786
|
-
userPaths[0], // user settings.local.json
|
|
707
|
+
userPaths[0], // user settings.json
|
|
787
708
|
projectPaths[1], // project settings.json
|
|
788
|
-
projectPaths[0], //
|
|
709
|
+
projectPaths[0], // local settings.local.json
|
|
789
710
|
];
|
|
790
711
|
const configs = [];
|
|
791
712
|
for (const path of pathsToLoad) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exitPlanMode.d.ts","sourceRoot":"","sources":["../../src/tools/exitPlanMode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"exitPlanMode.d.ts","sourceRoot":"","sources":["../../src/tools/exitPlanMode.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAItE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,UAkH9B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFile } from "fs/promises";
|
|
2
2
|
import { logger } from "../utils/globalLogger.js";
|
|
3
3
|
import { EXIT_PLAN_MODE_TOOL_NAME } from "../constants/tools.js";
|
|
4
|
+
import { OPERATION_CANCELLED_BY_USER } from "../types/permissions.js";
|
|
4
5
|
/**
|
|
5
6
|
* Exit Plan Mode Tool Plugin
|
|
6
7
|
*/
|
|
@@ -75,6 +76,12 @@ Ensure your plan is complete and unambiguous:
|
|
|
75
76
|
const permissionContext = context.permissionManager.createContext(EXIT_PLAN_MODE_TOOL_NAME, context.permissionMode || "plan", context.canUseToolCallback, { plan_content: planContent });
|
|
76
77
|
const permissionResult = await context.permissionManager.checkPermission(permissionContext);
|
|
77
78
|
if (permissionResult.behavior === "deny") {
|
|
79
|
+
if (permissionResult.message === OPERATION_CANCELLED_BY_USER) {
|
|
80
|
+
return {
|
|
81
|
+
success: false,
|
|
82
|
+
content: OPERATION_CANCELLED_BY_USER,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
78
85
|
return {
|
|
79
86
|
success: false,
|
|
80
87
|
content: `Please update your proposal based on the following user feedback: ${permissionResult.message || "Plan rejected by user"}`,
|
package/dist/types/history.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/types/history.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC"}
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/types/history.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC"}
|
|
@@ -39,5 +39,6 @@ export interface ToolPermissionContext {
|
|
|
39
39
|
export declare const RESTRICTED_TOOLS: readonly ["Edit", "Bash", "Write", "ExitPlanMode", "AskUserQuestion"];
|
|
40
40
|
/** Type for restricted tool names */
|
|
41
41
|
export type RestrictedTool = (typeof RESTRICTED_TOOLS)[number];
|
|
42
|
+
export declare const OPERATION_CANCELLED_BY_USER = "Operation cancelled by user";
|
|
42
43
|
export type { AskUserQuestion, AskUserQuestionInput, AskUserQuestionOption };
|
|
43
44
|
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/types/permissions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AASpB,oCAAoC;AACpC,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,mBAAmB,GACnB,aAAa,GACb,MAAM,CAAC;AAEX,mCAAmC;AACnC,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,cAAc,CAAC;IACnC,2CAA2C;IAC3C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yEAAyE;IACzE,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,oDAAoD;AACpD,MAAM,MAAM,kBAAkB,GAAG,CAC/B,OAAO,EAAE,qBAAqB,KAC3B,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEjC,mDAAmD;AACnD,MAAM,WAAW,qBAAqB;IACpC,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,cAAc,EAAE,cAAc,CAAC;IAC/B,6CAA6C;IAC7C,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,O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C,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,yCAAyC;IACzC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2FAA2F;IAC3F,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,mEAAmE;AACnE,eAAO,MAAM,gBAAgB,uEAMnB,CAAC;AAEX,qCAAqC;AACrC,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,2BAA2B,gCAAgC,CAAC;AAEzE,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Configuration Path Utilities
|
|
3
3
|
*
|
|
4
4
|
* Centralized utilities for resolving Wave configuration file paths.
|
|
5
|
-
* Supports both regular settings.json and settings.local.json with proper priority.
|
|
5
|
+
* Supports both regular settings.json and local settings.local.json with proper priority.
|
|
6
6
|
*
|
|
7
7
|
* Priority system:
|
|
8
|
-
* - User configs: ~/.wave/settings.
|
|
9
|
-
* -
|
|
8
|
+
* - User configs: ~/.wave/settings.json
|
|
9
|
+
* - Local configs: {workdir}/.wave/settings.local.json > {workdir}/.wave/settings.json
|
|
10
10
|
* - Project configs override user configs (existing behavior)
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
@@ -21,7 +21,7 @@ export declare function getUserConfigPath(): string;
|
|
|
21
21
|
export declare function getProjectConfigPath(workdir: string): string;
|
|
22
22
|
/**
|
|
23
23
|
* Get the user-specific configuration file paths in priority order
|
|
24
|
-
* Returns array with .
|
|
24
|
+
* Returns array with .json only
|
|
25
25
|
*/
|
|
26
26
|
export declare function getUserConfigPaths(): string[];
|
|
27
27
|
/**
|
|
@@ -29,7 +29,7 @@ export declare function getUserConfigPaths(): string[];
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function getPluginsDir(): string;
|
|
31
31
|
/**
|
|
32
|
-
* Get the
|
|
32
|
+
* Get the local configuration file paths in priority order
|
|
33
33
|
* Returns array with .local.json first, then .json
|
|
34
34
|
*/
|
|
35
35
|
export declare function getProjectConfigPaths(workdir: string): string[];
|