wave-agent-sdk 0.16.8 → 0.16.10
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.map +1 -1
- package/dist/agent.js +3 -0
- package/dist/constants/tools.d.ts +0 -1
- package/dist/constants/tools.d.ts.map +1 -1
- package/dist/constants/tools.js +0 -1
- package/dist/managers/aiManager.d.ts +0 -8
- package/dist/managers/aiManager.d.ts.map +1 -1
- package/dist/managers/aiManager.js +0 -45
- package/dist/managers/mcpManager.d.ts +5 -0
- package/dist/managers/mcpManager.d.ts.map +1 -1
- package/dist/managers/mcpManager.js +107 -12
- package/dist/managers/toolManager.d.ts +0 -6
- package/dist/managers/toolManager.d.ts.map +1 -1
- package/dist/managers/toolManager.js +1 -28
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +1 -12
- package/dist/services/authService.d.ts +10 -0
- package/dist/services/authService.d.ts.map +1 -1
- package/dist/services/authService.js +45 -0
- package/dist/services/configurationService.d.ts +1 -0
- package/dist/services/configurationService.d.ts.map +1 -1
- package/dist/services/configurationService.js +48 -15
- package/dist/services/initializationService.d.ts.map +1 -1
- package/dist/services/initializationService.js +11 -0
- package/dist/services/pluginLoader.d.ts.map +1 -1
- package/dist/services/pluginLoader.js +2 -2
- package/dist/services/remoteSettingsService.d.ts +21 -0
- package/dist/services/remoteSettingsService.d.ts.map +1 -0
- package/dist/services/remoteSettingsService.js +279 -0
- package/dist/telemetry/instrumentation.d.ts +5 -2
- package/dist/telemetry/instrumentation.d.ts.map +1 -1
- package/dist/telemetry/instrumentation.js +8 -4
- package/dist/tools/buildTool.d.ts +0 -2
- package/dist/tools/buildTool.d.ts.map +1 -1
- package/dist/tools/buildTool.js +0 -2
- package/dist/tools/cronCreateTool.d.ts.map +1 -1
- package/dist/tools/cronCreateTool.js +0 -1
- package/dist/tools/cronDeleteTool.d.ts.map +1 -1
- package/dist/tools/cronDeleteTool.js +0 -1
- package/dist/tools/cronListTool.d.ts.map +1 -1
- package/dist/tools/cronListTool.js +0 -1
- package/dist/tools/enterWorktreeTool.d.ts.map +1 -1
- package/dist/tools/enterWorktreeTool.js +0 -1
- package/dist/tools/exitWorktreeTool.d.ts.map +1 -1
- package/dist/tools/exitWorktreeTool.js +0 -1
- package/dist/tools/taskManagementTools.d.ts.map +1 -1
- package/dist/tools/taskManagementTools.js +0 -4
- package/dist/tools/types.d.ts +0 -15
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/webFetchTool.d.ts.map +1 -1
- package/dist/tools/webFetchTool.js +0 -1
- package/dist/types/configuration.d.ts +20 -0
- package/dist/types/configuration.d.ts.map +1 -1
- package/dist/types/mcp.d.ts +3 -1
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/utils/containerSetup.d.ts.map +1 -1
- package/dist/utils/containerSetup.js +10 -0
- package/dist/utils/mcpUtils.d.ts.map +1 -1
- package/dist/utils/mcpUtils.js +0 -1
- package/dist/utils/openaiClient.d.ts.map +1 -1
- package/dist/utils/openaiClient.js +4 -2
- package/package.json +1 -1
- package/src/agent.ts +3 -0
- package/src/constants/tools.ts +0 -1
- package/src/managers/aiManager.ts +0 -48
- package/src/managers/mcpManager.ts +122 -16
- package/src/managers/toolManager.ts +1 -32
- package/src/prompts/index.ts +0 -13
- package/src/services/authService.ts +56 -0
- package/src/services/configurationService.ts +56 -19
- package/src/services/initializationService.ts +13 -0
- package/src/services/pluginLoader.ts +2 -2
- package/src/services/remoteSettingsService.ts +314 -0
- package/src/telemetry/instrumentation.ts +12 -4
- package/src/tools/buildTool.ts +0 -4
- package/src/tools/cronCreateTool.ts +0 -1
- package/src/tools/cronDeleteTool.ts +0 -1
- package/src/tools/cronListTool.ts +0 -1
- package/src/tools/enterWorktreeTool.ts +0 -1
- package/src/tools/exitWorktreeTool.ts +0 -1
- package/src/tools/taskManagementTools.ts +0 -4
- package/src/tools/types.ts +0 -15
- package/src/tools/webFetchTool.ts +0 -1
- package/src/types/configuration.ts +23 -0
- package/src/types/mcp.ts +8 -1
- package/src/utils/containerSetup.ts +10 -0
- package/src/utils/mcpUtils.ts +0 -1
- package/src/utils/openaiClient.ts +5 -2
- package/dist/tools/toolSearchTool.d.ts +0 -15
- package/dist/tools/toolSearchTool.d.ts.map +0 -1
- package/dist/tools/toolSearchTool.js +0 -200
- package/dist/utils/isDeferredTool.d.ts +0 -19
- package/dist/utils/isDeferredTool.d.ts.map +0 -1
- package/dist/utils/isDeferredTool.js +0 -31
- package/src/tools/toolSearchTool.ts +0 -245
- package/src/utils/isDeferredTool.ts +0 -36
|
@@ -14,6 +14,7 @@ import { isValidEnvironmentVars, } from "../types/environment.js";
|
|
|
14
14
|
import { ConfigurationError, CONFIG_ERRORS, } from "../types/index.js";
|
|
15
15
|
import { DEFAULT_WAVE_MAX_INPUT_TOKENS, DEFAULT_WAVE_MAX_OUTPUT_TOKENS, } from "../utils/constants.js";
|
|
16
16
|
import { parseCustomHeaders } from "../utils/stringUtils.js";
|
|
17
|
+
import { getRemoteSettingsSync, mergeRemoteSettings, } from "./remoteSettingsService.js";
|
|
17
18
|
/**
|
|
18
19
|
* Default ConfigurationService implementation
|
|
19
20
|
*
|
|
@@ -62,17 +63,22 @@ export class ConfigurationService {
|
|
|
62
63
|
warnings: validation.warnings,
|
|
63
64
|
};
|
|
64
65
|
}
|
|
66
|
+
// Merge remote settings (highest priority: Remote > Local > Project > User)
|
|
67
|
+
const remoteSettings = getRemoteSettingsSync();
|
|
68
|
+
const finalConfig = remoteSettings
|
|
69
|
+
? mergeRemoteSettings(mergedConfig, remoteSettings)
|
|
70
|
+
: mergedConfig;
|
|
65
71
|
// Success case
|
|
66
|
-
this.currentConfiguration =
|
|
72
|
+
this.currentConfiguration = finalConfig;
|
|
67
73
|
// Set environment variables from merged config and inject system variables
|
|
68
74
|
const env = {
|
|
69
|
-
...(
|
|
75
|
+
...(finalConfig.env || {}),
|
|
70
76
|
WAVE_PROJECT_DIR: workdir,
|
|
71
77
|
};
|
|
72
78
|
this.setEnvironmentVars(env);
|
|
73
|
-
|
|
79
|
+
finalConfig.env = env;
|
|
74
80
|
return {
|
|
75
|
-
configuration:
|
|
81
|
+
configuration: finalConfig,
|
|
76
82
|
success: true,
|
|
77
83
|
sourcePath: "merged configuration",
|
|
78
84
|
warnings: validation.warnings,
|
|
@@ -367,7 +373,7 @@ export class ConfigurationService {
|
|
|
367
373
|
resolvedBaseURL = undefined;
|
|
368
374
|
}
|
|
369
375
|
// Resolve custom headers from environment: env (settings.json) > process.env
|
|
370
|
-
const envCustomHeaders = process.env.WAVE_CUSTOM_HEADERS ||
|
|
376
|
+
const envCustomHeaders = process.env.WAVE_CUSTOM_HEADERS || "";
|
|
371
377
|
const parsedEnvHeaders = parseCustomHeaders(envCustomHeaders);
|
|
372
378
|
// Merge headers: env headers < options < override
|
|
373
379
|
const resolvedHeaders = {
|
|
@@ -393,16 +399,13 @@ export class ConfigurationService {
|
|
|
393
399
|
* @returns Resolved model configuration with defaults
|
|
394
400
|
*/
|
|
395
401
|
resolveModelConfig(model, fastModel, maxTokens, permissionMode) {
|
|
396
|
-
// Resolve agent model: override > options > env (settings.json
|
|
402
|
+
// Resolve agent model: override > options > process.env (includes settings.json env)
|
|
397
403
|
const resolvedAgentModel = model ||
|
|
398
404
|
this.options.model ||
|
|
399
405
|
process.env.WAVE_MODEL ||
|
|
400
|
-
|
|
401
|
-
// Resolve fast model: override > options > env (settings.json
|
|
402
|
-
const resolvedFastModel = fastModel ||
|
|
403
|
-
this.options.fastModel ||
|
|
404
|
-
process.env.WAVE_FAST_MODEL ||
|
|
405
|
-
process.env.WAVE_FAST_MODEL;
|
|
406
|
+
this.currentConfiguration?.model;
|
|
407
|
+
// Resolve fast model: override > options > process.env (includes settings.json env)
|
|
408
|
+
const resolvedFastModel = fastModel || this.options.fastModel || process.env.WAVE_FAST_MODEL;
|
|
406
409
|
// Validate required fields
|
|
407
410
|
if (!resolvedAgentModel) {
|
|
408
411
|
throw new ConfigurationError(CONFIG_ERRORS.MISSING_MODEL, "model", {
|
|
@@ -450,7 +453,7 @@ export class ConfigurationService {
|
|
|
450
453
|
return this.options.maxInputTokens;
|
|
451
454
|
}
|
|
452
455
|
// Try env (settings.json) first, then process.env
|
|
453
|
-
const envMaxInputTokens = process.env.WAVE_MAX_INPUT_TOKENS
|
|
456
|
+
const envMaxInputTokens = process.env.WAVE_MAX_INPUT_TOKENS;
|
|
454
457
|
if (envMaxInputTokens) {
|
|
455
458
|
const parsed = parseInt(envMaxInputTokens, 10);
|
|
456
459
|
if (!isNaN(parsed)) {
|
|
@@ -538,7 +541,7 @@ export class ConfigurationService {
|
|
|
538
541
|
return this.options.maxTokens;
|
|
539
542
|
}
|
|
540
543
|
// Try env (settings.json) first, then process.env
|
|
541
|
-
const envMaxOutputTokens = process.env.WAVE_MAX_OUTPUT_TOKENS
|
|
544
|
+
const envMaxOutputTokens = process.env.WAVE_MAX_OUTPUT_TOKENS;
|
|
542
545
|
if (envMaxOutputTokens) {
|
|
543
546
|
const parsed = parseInt(envMaxOutputTokens, 10);
|
|
544
547
|
if (!isNaN(parsed) && parsed > 0) {
|
|
@@ -553,6 +556,26 @@ export class ConfigurationService {
|
|
|
553
556
|
*/
|
|
554
557
|
setModel(model) {
|
|
555
558
|
this.options.model = model;
|
|
559
|
+
this.persistModelToSettings(model);
|
|
560
|
+
}
|
|
561
|
+
async persistModelToSettings(model) {
|
|
562
|
+
const configPath = getUserConfigPaths()[0]; // ~/.wave/settings.json
|
|
563
|
+
const configDir = path.dirname(configPath);
|
|
564
|
+
if (!existsSync(configDir)) {
|
|
565
|
+
await fs.mkdir(configDir, { recursive: true });
|
|
566
|
+
}
|
|
567
|
+
let config = {};
|
|
568
|
+
if (existsSync(configPath)) {
|
|
569
|
+
try {
|
|
570
|
+
const content = await fs.readFile(configPath, "utf-8");
|
|
571
|
+
config = JSON.parse(content);
|
|
572
|
+
}
|
|
573
|
+
catch {
|
|
574
|
+
// Start fresh if corrupted
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
config.model = model;
|
|
578
|
+
await fs.writeFile(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
556
579
|
}
|
|
557
580
|
/**
|
|
558
581
|
* Get all configured models from settings.json and environment
|
|
@@ -560,10 +583,14 @@ export class ConfigurationService {
|
|
|
560
583
|
getConfiguredModels() {
|
|
561
584
|
const models = new Set();
|
|
562
585
|
// Add current model from options or environment
|
|
563
|
-
const currentModel = this.options.model || process.env.WAVE_MODEL
|
|
586
|
+
const currentModel = this.options.model || process.env.WAVE_MODEL;
|
|
564
587
|
if (currentModel) {
|
|
565
588
|
models.add(currentModel);
|
|
566
589
|
}
|
|
590
|
+
// Persisted model from settings (includes remote-merged)
|
|
591
|
+
if (this.currentConfiguration?.model) {
|
|
592
|
+
models.add(this.currentConfiguration.model);
|
|
593
|
+
}
|
|
567
594
|
// Add models from merged configuration
|
|
568
595
|
if (this.currentConfiguration?.models) {
|
|
569
596
|
Object.keys(this.currentConfiguration.models).forEach((model) => {
|
|
@@ -900,6 +927,7 @@ export function loadWaveConfigFromFile(filePath) {
|
|
|
900
927
|
permissions: config.permissions || undefined,
|
|
901
928
|
enabledPlugins: config.enabledPlugins || undefined,
|
|
902
929
|
language: config.language || undefined,
|
|
930
|
+
model: config.model || undefined,
|
|
903
931
|
autoMemoryEnabled: config.autoMemoryEnabled !== undefined
|
|
904
932
|
? config.autoMemoryEnabled
|
|
905
933
|
: undefined,
|
|
@@ -1013,6 +1041,10 @@ export function loadMergedWaveConfig(workdir) {
|
|
|
1013
1041
|
if (config.language !== undefined) {
|
|
1014
1042
|
mergedConfig.language = config.language;
|
|
1015
1043
|
}
|
|
1044
|
+
// Merge model (last one wins)
|
|
1045
|
+
if (config.model !== undefined) {
|
|
1046
|
+
mergedConfig.model = config.model;
|
|
1047
|
+
}
|
|
1016
1048
|
// Merge autoMemoryEnabled (last one wins)
|
|
1017
1049
|
if (config.autoMemoryEnabled !== undefined) {
|
|
1018
1050
|
mergedConfig.autoMemoryEnabled = config.autoMemoryEnabled;
|
|
@@ -1055,6 +1087,7 @@ export function loadMergedWaveConfig(workdir) {
|
|
|
1055
1087
|
? mergedConfig.enabledPlugins
|
|
1056
1088
|
: undefined,
|
|
1057
1089
|
language: mergedConfig.language,
|
|
1090
|
+
model: mergedConfig.model,
|
|
1058
1091
|
autoMemoryEnabled: mergedConfig.autoMemoryEnabled,
|
|
1059
1092
|
marketplaces: mergedConfig.marketplaces &&
|
|
1060
1093
|
Object.keys(mergedConfig.marketplaces).length > 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializationService.d.ts","sourceRoot":"","sources":["../../src/services/initializationService.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,OAAO,EACP,MAAM,EACN,YAAY,EACZ,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"initializationService.d.ts","sourceRoot":"","sources":["../../src/services/initializationService.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,OAAO,EACP,MAAM,EACN,YAAY,EACZ,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,YAAY,CAAC;IAC3B,eAAe,EAAE,eAAe,CAAC;IACjC,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,YAAY,CAAC;IACtB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;IACxB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,WAAW,EAAE,WAAW,CAAC;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,WAAW,EAAE,WAAW,CAAC;IACzB,wBAAwB,EAAE,MAAM,IAAI,CAAC;CACtC;AAED,qBAAa,qBAAqB;WACZ,UAAU,CAC5B,OAAO,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE;QACR,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;KACtB,GACA,OAAO,CAAC,IAAI,CAAC;CAiSjB"}
|
|
@@ -2,6 +2,7 @@ import { handleSessionRestoration } from "./session.js";
|
|
|
2
2
|
import { setGlobalLogger } from "../utils/globalLogger.js";
|
|
3
3
|
import { LspManager } from "../managers/lspManager.js";
|
|
4
4
|
import { USER_MEMORY_FILE } from "../utils/constants.js";
|
|
5
|
+
import { remoteSettingsService } from "./remoteSettingsService.js";
|
|
5
6
|
export class InitializationService {
|
|
6
7
|
static async initialize(context, options) {
|
|
7
8
|
const { skillManager, subagentManager, container, toolManager, pluginManager, options: agentOptions, slashCommandManager, logger, mcpManager, workdir, lspManager, configurationService, hookManager, messageManager, memoryRuleManager, liveConfigManager, taskManager, resolveAndValidateConfig, } = context;
|
|
@@ -162,6 +163,16 @@ export class InitializationService {
|
|
|
162
163
|
logger?.error("Failed to initialize live configuration reload:", error);
|
|
163
164
|
// Don't throw error to prevent app startup failure - continue without live reload
|
|
164
165
|
}
|
|
166
|
+
// Initialize remote settings (fetch server-managed config)
|
|
167
|
+
try {
|
|
168
|
+
const phaseStart = performance.now();
|
|
169
|
+
await remoteSettingsService.initialize();
|
|
170
|
+
logger?.debug(`Initialization Phase [Remote Settings] took ${(performance.now() - phaseStart).toFixed(2)}ms`);
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
logger?.error("Failed to initialize remote settings:", error);
|
|
174
|
+
// Don't throw error to prevent app startup failure - continue without remote settings
|
|
175
|
+
}
|
|
165
176
|
// Memory is lazy-cached on first getCombinedMemoryContent call
|
|
166
177
|
// No explicit loading needed during initialization
|
|
167
178
|
// Handle session restoration or set provided messages
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginLoader.d.ts","sourceRoot":"","sources":["../../src/services/pluginLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,SAAS,EACT,wBAAwB,EACzB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"pluginLoader.d.ts","sourceRoot":"","sources":["../../src/services/pluginLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,SAAS,EACT,wBAAwB,EACzB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,4BAA4B,CAAC;AAGpC,qBAAa,YAAY;IACvB;;;OAGG;WACU,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA6CtE;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAK7D;;;OAGG;WACU,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAuC7D;;OAEG;WACU,aAAa,CACxB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAUjC;;OAEG;WACU,aAAa,CACxB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAWjC;;OAEG;WACU,eAAe,CAC1B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;IAgBhD;;OAEG;WACU,UAAU,CACrB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,qBAAqB,EAAE,CAAC;IA2BnC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;CAgBhC"}
|
|
@@ -3,7 +3,6 @@ import * as path from "path";
|
|
|
3
3
|
import { scanCommandsDirectory } from "../utils/customCommands.js";
|
|
4
4
|
import { parseSkillFile } from "../utils/skillParser.js";
|
|
5
5
|
import { parseAgentFile, } from "../utils/subagentParser.js";
|
|
6
|
-
import { resolveMcpConfig } from "../managers/mcpManager.js";
|
|
7
6
|
import { logger } from "../utils/globalLogger.js";
|
|
8
7
|
export class PluginLoader {
|
|
9
8
|
/**
|
|
@@ -112,7 +111,8 @@ export class PluginLoader {
|
|
|
112
111
|
const mcpPath = path.join(pluginPath, ".mcp.json");
|
|
113
112
|
try {
|
|
114
113
|
const content = await fs.readFile(mcpPath, "utf-8");
|
|
115
|
-
|
|
114
|
+
// Return raw config — let McpManager resolve templates and capture originalUrl
|
|
115
|
+
return JSON.parse(content);
|
|
116
116
|
}
|
|
117
117
|
catch {
|
|
118
118
|
return undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RemoteSettingsFetchResult } from "../types/configuration.js";
|
|
2
|
+
import type { WaveConfiguration } from "../types/configuration.js";
|
|
3
|
+
export declare function initialize(): void;
|
|
4
|
+
export declare function getRemoteSettingsSync(): WaveConfiguration | null;
|
|
5
|
+
export declare function refresh(): Promise<RemoteSettingsFetchResult>;
|
|
6
|
+
export declare function clear(): void;
|
|
7
|
+
export declare function shutdown(): void;
|
|
8
|
+
export declare function mergeRemoteSettings(localMerged: WaveConfiguration, remote: WaveConfiguration): WaveConfiguration;
|
|
9
|
+
/**
|
|
10
|
+
* Singleton object for consumers that prefer a namespace-style import.
|
|
11
|
+
* Usage: import { remoteSettingsService } from "./remoteSettingsService.js"
|
|
12
|
+
*/
|
|
13
|
+
export declare const remoteSettingsService: {
|
|
14
|
+
readonly initialize: typeof initialize;
|
|
15
|
+
readonly getRemoteSettingsSync: typeof getRemoteSettingsSync;
|
|
16
|
+
readonly refresh: typeof refresh;
|
|
17
|
+
readonly clear: typeof clear;
|
|
18
|
+
readonly shutdown: typeof shutdown;
|
|
19
|
+
readonly mergeRemoteSettings: typeof mergeRemoteSettings;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=remoteSettingsService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteSettingsService.d.ts","sourceRoot":"","sources":["../../src/services/remoteSettingsService.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,yBAAyB,EAE1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AA0JnE,wBAAgB,UAAU,IAAI,IAAI,CASjC;AAED,wBAAgB,qBAAqB,IAAI,iBAAiB,GAAG,IAAI,CAEhE;AAED,wBAAsB,OAAO,IAAI,OAAO,CAAC,yBAAyB,CAAC,CAKlE;AAED,wBAAgB,KAAK,IAAI,IAAI,CAO5B;AAED,wBAAgB,QAAQ,IAAI,IAAI,CAK/B;AAqCD,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,iBAAiB,EAC9B,MAAM,EAAE,iBAAiB,GACxB,iBAAiB,CA4DnB;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;CAOxB,CAAC"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { authService } from "./authService.js";
|
|
5
|
+
import { logger } from "../utils/globalLogger.js";
|
|
6
|
+
const CACHE_FILE = path.join(homedir(), ".wave", "remote-settings.json");
|
|
7
|
+
const POLLING_INTERVAL_MS = 60 * 60 * 1000; // 60 minutes
|
|
8
|
+
const FETCH_TIMEOUT_MS = 10000;
|
|
9
|
+
let _cachedSettings = null;
|
|
10
|
+
let _pollingTimer = null;
|
|
11
|
+
function loadCacheFromDisk() {
|
|
12
|
+
try {
|
|
13
|
+
if (!fs.existsSync(CACHE_FILE)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const raw = fs.readFileSync(CACHE_FILE, "utf-8");
|
|
17
|
+
const parsed = JSON.parse(raw);
|
|
18
|
+
_cachedSettings = parsed;
|
|
19
|
+
logger.debug("remoteSettings: loaded cache from disk", {
|
|
20
|
+
checksum: parsed.checksum,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
logger.debug("remoteSettings: failed to load cache from disk", { err });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function writeCacheToDisk() {
|
|
28
|
+
if (!_cachedSettings) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const dir = path.dirname(CACHE_FILE);
|
|
33
|
+
if (!fs.existsSync(dir)) {
|
|
34
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
35
|
+
}
|
|
36
|
+
fs.writeFileSync(CACHE_FILE, JSON.stringify(_cachedSettings, null, 2), {
|
|
37
|
+
mode: 0o600,
|
|
38
|
+
});
|
|
39
|
+
logger.debug("remoteSettings: wrote cache to disk", {
|
|
40
|
+
checksum: _cachedSettings.checksum,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
logger.debug("remoteSettings: failed to write cache to disk", { err });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function removeCacheFromDisk() {
|
|
48
|
+
try {
|
|
49
|
+
if (fs.existsSync(CACHE_FILE)) {
|
|
50
|
+
fs.unlinkSync(CACHE_FILE);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
logger.debug("remoteSettings: failed to remove cache file", { err });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async function fetchRemoteSettings() {
|
|
58
|
+
if (!authService.isSSOAuthenticated()) {
|
|
59
|
+
logger.debug("remoteSettings: skipping fetch — not SSO authenticated");
|
|
60
|
+
return { success: false, error: "Not SSO authenticated" };
|
|
61
|
+
}
|
|
62
|
+
const token = authService.getSSOToken();
|
|
63
|
+
const serverUrl = authService.getServerUrl();
|
|
64
|
+
if (!token || !serverUrl) {
|
|
65
|
+
return { success: false, error: "Missing SSO token or server URL" };
|
|
66
|
+
}
|
|
67
|
+
const headers = {
|
|
68
|
+
Authorization: `Bearer ${token}`,
|
|
69
|
+
};
|
|
70
|
+
if (_cachedSettings?.checksum) {
|
|
71
|
+
headers["If-None-Match"] = _cachedSettings.checksum;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const response = await fetch(`${serverUrl}/api/wave/settings`, {
|
|
75
|
+
method: "GET",
|
|
76
|
+
headers,
|
|
77
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
|
|
78
|
+
});
|
|
79
|
+
if (response.status === 304) {
|
|
80
|
+
logger.debug("remoteSettings: 304 unchanged", {
|
|
81
|
+
checksum: _cachedSettings?.checksum,
|
|
82
|
+
});
|
|
83
|
+
return {
|
|
84
|
+
success: true,
|
|
85
|
+
settings: _cachedSettings.settings,
|
|
86
|
+
checksum: _cachedSettings.checksum,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (response.status === 404) {
|
|
90
|
+
logger.debug("remoteSettings: 404 not configured — clearing stale cache");
|
|
91
|
+
_cachedSettings = null;
|
|
92
|
+
removeCacheFromDisk();
|
|
93
|
+
return { success: true, notConfigured: true, settings: null };
|
|
94
|
+
}
|
|
95
|
+
if (!response.ok) {
|
|
96
|
+
const body = await response.text().catch(() => "");
|
|
97
|
+
logger.debug("remoteSettings: fetch failed", {
|
|
98
|
+
status: response.status,
|
|
99
|
+
body: body.slice(0, 200),
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
success: false,
|
|
103
|
+
error: `HTTP ${response.status}`,
|
|
104
|
+
settings: _cachedSettings?.settings ?? null,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const data = (await response.json());
|
|
108
|
+
_cachedSettings = {
|
|
109
|
+
uuid: data.uuid,
|
|
110
|
+
checksum: data.checksum,
|
|
111
|
+
settings: data.settings,
|
|
112
|
+
fetchedAt: new Date().toISOString(),
|
|
113
|
+
};
|
|
114
|
+
writeCacheToDisk();
|
|
115
|
+
logger.debug("remoteSettings: fetched new settings", {
|
|
116
|
+
checksum: data.checksum,
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
success: true,
|
|
120
|
+
settings: data.settings,
|
|
121
|
+
checksum: data.checksum,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
logger.debug("remoteSettings: network error, using cache", { err });
|
|
126
|
+
return {
|
|
127
|
+
success: false,
|
|
128
|
+
error: err instanceof Error ? err.message : String(err),
|
|
129
|
+
settings: _cachedSettings?.settings ?? null,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function startPolling() {
|
|
134
|
+
if (_pollingTimer) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
_pollingTimer = setInterval(async () => {
|
|
138
|
+
try {
|
|
139
|
+
await fetchRemoteSettings();
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
logger.debug("remoteSettings: polling fetch error", { err });
|
|
143
|
+
}
|
|
144
|
+
}, POLLING_INTERVAL_MS);
|
|
145
|
+
_pollingTimer.unref();
|
|
146
|
+
}
|
|
147
|
+
export function initialize() {
|
|
148
|
+
loadCacheFromDisk();
|
|
149
|
+
// Fire-and-forget the initial fetch, then start background polling
|
|
150
|
+
fetchRemoteSettings()
|
|
151
|
+
.then(() => startPolling())
|
|
152
|
+
.catch((err) => {
|
|
153
|
+
logger.debug("remoteSettings: initial fetch failed", { err });
|
|
154
|
+
startPolling();
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
export function getRemoteSettingsSync() {
|
|
158
|
+
return _cachedSettings?.settings ?? null;
|
|
159
|
+
}
|
|
160
|
+
export async function refresh() {
|
|
161
|
+
// Clear in-memory so we force a fresh fetch
|
|
162
|
+
_cachedSettings = null;
|
|
163
|
+
removeCacheFromDisk();
|
|
164
|
+
return fetchRemoteSettings();
|
|
165
|
+
}
|
|
166
|
+
export function clear() {
|
|
167
|
+
_cachedSettings = null;
|
|
168
|
+
removeCacheFromDisk();
|
|
169
|
+
if (_pollingTimer) {
|
|
170
|
+
clearInterval(_pollingTimer);
|
|
171
|
+
_pollingTimer = null;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
export function shutdown() {
|
|
175
|
+
if (_pollingTimer) {
|
|
176
|
+
clearInterval(_pollingTimer);
|
|
177
|
+
_pollingTimer = null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function dedupe(arr) {
|
|
181
|
+
return [...new Set(arr)];
|
|
182
|
+
}
|
|
183
|
+
function mergeHooks(local, remote) {
|
|
184
|
+
if (!remote && !local) {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
if (!remote) {
|
|
188
|
+
return local;
|
|
189
|
+
}
|
|
190
|
+
if (!local) {
|
|
191
|
+
return remote;
|
|
192
|
+
}
|
|
193
|
+
const merged = { ...local };
|
|
194
|
+
for (const [event, remoteHooks] of Object.entries(remote)) {
|
|
195
|
+
const localHooks = merged[event] ?? [];
|
|
196
|
+
// Concatenate + dedupe by JSON serialization
|
|
197
|
+
const combined = [...localHooks, ...(remoteHooks ?? [])];
|
|
198
|
+
const seen = new Set();
|
|
199
|
+
merged[event] = combined.filter((h) => {
|
|
200
|
+
const key = JSON.stringify(h);
|
|
201
|
+
if (seen.has(key)) {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
seen.add(key);
|
|
205
|
+
return true;
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
return merged;
|
|
209
|
+
}
|
|
210
|
+
export function mergeRemoteSettings(localMerged, remote) {
|
|
211
|
+
const result = { ...localMerged };
|
|
212
|
+
// env: merge by key, remote wins per-key
|
|
213
|
+
if (remote.env || localMerged.env) {
|
|
214
|
+
result.env = { ...localMerged.env, ...remote.env };
|
|
215
|
+
}
|
|
216
|
+
// permissions
|
|
217
|
+
if (remote.permissions || localMerged.permissions) {
|
|
218
|
+
const lp = localMerged.permissions ?? {};
|
|
219
|
+
const rp = remote.permissions ?? {};
|
|
220
|
+
result.permissions = {
|
|
221
|
+
// allow: concatenate + dedupe
|
|
222
|
+
allow: lp.allow || rp.allow
|
|
223
|
+
? dedupe([...(lp.allow ?? []), ...(rp.allow ?? [])])
|
|
224
|
+
: undefined,
|
|
225
|
+
// deny: concatenate + dedupe
|
|
226
|
+
deny: lp.deny || rp.deny
|
|
227
|
+
? dedupe([...(lp.deny ?? []), ...(rp.deny ?? [])])
|
|
228
|
+
: undefined,
|
|
229
|
+
// permissionMode: remote wins (scalar)
|
|
230
|
+
permissionMode: rp.permissionMode ?? lp.permissionMode,
|
|
231
|
+
// additionalDirectories: concatenate + dedupe
|
|
232
|
+
additionalDirectories: lp.additionalDirectories || rp.additionalDirectories
|
|
233
|
+
? dedupe([
|
|
234
|
+
...(lp.additionalDirectories ?? []),
|
|
235
|
+
...(rp.additionalDirectories ?? []),
|
|
236
|
+
])
|
|
237
|
+
: undefined,
|
|
238
|
+
};
|
|
239
|
+
// Clean up undefined keys
|
|
240
|
+
if (!result.permissions.allow)
|
|
241
|
+
delete result.permissions.allow;
|
|
242
|
+
if (!result.permissions.deny)
|
|
243
|
+
delete result.permissions.deny;
|
|
244
|
+
if (!result.permissions.permissionMode)
|
|
245
|
+
delete result.permissions.permissionMode;
|
|
246
|
+
if (!result.permissions.additionalDirectories)
|
|
247
|
+
delete result.permissions.additionalDirectories;
|
|
248
|
+
}
|
|
249
|
+
// hooks: concatenate per-event
|
|
250
|
+
result.hooks = mergeHooks(localMerged.hooks, remote.hooks);
|
|
251
|
+
// Scalar / last-write-wins fields: remote wins
|
|
252
|
+
if (remote.language !== undefined)
|
|
253
|
+
result.language = remote.language;
|
|
254
|
+
if (remote.model !== undefined)
|
|
255
|
+
result.model = remote.model;
|
|
256
|
+
if (remote.autoMemoryEnabled !== undefined)
|
|
257
|
+
result.autoMemoryEnabled = remote.autoMemoryEnabled;
|
|
258
|
+
if (remote.autoMemoryFrequency !== undefined)
|
|
259
|
+
result.autoMemoryFrequency = remote.autoMemoryFrequency;
|
|
260
|
+
if (remote.models !== undefined)
|
|
261
|
+
result.models = remote.models;
|
|
262
|
+
if (remote.marketplaces !== undefined)
|
|
263
|
+
result.marketplaces = remote.marketplaces;
|
|
264
|
+
if (remote.enabledPlugins !== undefined)
|
|
265
|
+
result.enabledPlugins = remote.enabledPlugins;
|
|
266
|
+
return result;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Singleton object for consumers that prefer a namespace-style import.
|
|
270
|
+
* Usage: import { remoteSettingsService } from "./remoteSettingsService.js"
|
|
271
|
+
*/
|
|
272
|
+
export const remoteSettingsService = {
|
|
273
|
+
initialize,
|
|
274
|
+
getRemoteSettingsSync,
|
|
275
|
+
refresh,
|
|
276
|
+
clear,
|
|
277
|
+
shutdown,
|
|
278
|
+
mergeRemoteSettings,
|
|
279
|
+
};
|
|
@@ -63,8 +63,11 @@ export declare function getCurrentConfig(): TelemetryConfig | undefined;
|
|
|
63
63
|
export declare function isInitialized(): boolean;
|
|
64
64
|
export { JsonlSpanExporter, JsonlLogExporter };
|
|
65
65
|
/**
|
|
66
|
-
* Get telemetry attributes
|
|
67
|
-
*
|
|
66
|
+
* Get telemetry attributes for the current session.
|
|
67
|
+
*
|
|
68
|
+
* Priority:
|
|
69
|
+
* 1. SSO authenticated → server-provided user.id + user.email
|
|
70
|
+
* 2. Not authenticated → persistent anonymous ID from ~/.wave/config.json
|
|
68
71
|
*/
|
|
69
72
|
export declare function getTelemetryAttributes(): Record<string, string>;
|
|
70
73
|
//# sourceMappingURL=instrumentation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../src/telemetry/instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../src/telemetry/instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AA8JjC;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,cAAc,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GACxC,eAAe,CAmBjB;AAwCD;;GAEG;AACH,cAAM,iBAAkB,YAAW,YAAY;IAC7C,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,CAAC,EAAE,MAAM;IAI7B,MAAM,CACJ,KAAK,EAAE,YAAY,EAAE,EACrB,cAAc,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,GACjD,IAAI;IAwBP,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B;AAED;;GAEG;AACH,cAAM,gBAAiB,YAAW,iBAAiB;IACjD,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,CAAC,EAAE,MAAM;IAI7B,MAAM,CACJ,IAAI,EAAE,iBAAiB,EAAE,EACzB,cAAc,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,GACjD,IAAI;IAuBP,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CA8Ef;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAuBvD;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,cAAc,oBAAoB,CAAC,GAAG,SAAS,CAE5E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,GAAG,SAAS,CAE9D;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAGD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;AAE/C;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgB/D"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { logger } from "../utils/globalLogger.js";
|
|
8
8
|
import * as fs from "node:fs";
|
|
9
|
-
import { AuthService } from "../services/authService.js";
|
|
9
|
+
import { AuthService, getOrCreateAnonymousId, } from "../services/authService.js";
|
|
10
10
|
// Lazy-loaded OTEL modules — only imported when telemetry is initialized
|
|
11
11
|
let sdkNode;
|
|
12
12
|
let api;
|
|
@@ -371,8 +371,11 @@ export function isInitialized() {
|
|
|
371
371
|
// Export JSONL exporters for testing
|
|
372
372
|
export { JsonlSpanExporter, JsonlLogExporter };
|
|
373
373
|
/**
|
|
374
|
-
* Get telemetry attributes
|
|
375
|
-
*
|
|
374
|
+
* Get telemetry attributes for the current session.
|
|
375
|
+
*
|
|
376
|
+
* Priority:
|
|
377
|
+
* 1. SSO authenticated → server-provided user.id + user.email
|
|
378
|
+
* 2. Not authenticated → persistent anonymous ID from ~/.wave/config.json
|
|
376
379
|
*/
|
|
377
380
|
export function getTelemetryAttributes() {
|
|
378
381
|
try {
|
|
@@ -388,5 +391,6 @@ export function getTelemetryAttributes() {
|
|
|
388
391
|
catch {
|
|
389
392
|
// AuthService not available or not authenticated
|
|
390
393
|
}
|
|
391
|
-
|
|
394
|
+
// Fallback to anonymous ID
|
|
395
|
+
return { "user.id": getOrCreateAnonymousId() };
|
|
392
396
|
}
|
|
@@ -14,8 +14,6 @@ export interface ToolDef {
|
|
|
14
14
|
isSubagent?: boolean;
|
|
15
15
|
}) => string);
|
|
16
16
|
formatCompactParams?: (params: Record<string, unknown>, context: ToolContext) => string;
|
|
17
|
-
shouldDefer?: boolean;
|
|
18
|
-
alwaysLoad?: boolean;
|
|
19
17
|
additionalProperties?: boolean;
|
|
20
18
|
}
|
|
21
19
|
export declare function buildTool(def: ToolDef): ToolPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildTool.d.ts","sourceRoot":"","sources":["../../src/tools/buildTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,CACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,WAAW,KACjB,OAAO,CAAC,UAAU,CAAC,CAAC;IACzB,MAAM,CAAC,EACH,MAAM,GACN,CAAC,CAAC,IAAI,CAAC,EAAE;QACP,kBAAkB,CAAC,EAAE,qBAAqB,EAAE,CAAC;QAC7C,eAAe,CAAC,EAAE,aAAa,EAAE,CAAC;QAClC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,KAAK,MAAM,CAAC,CAAC;IAClB,mBAAmB,CAAC,EAAE,CACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,WAAW,KACjB,MAAM,CAAC;IACZ,
|
|
1
|
+
{"version":3,"file":"buildTool.d.ts","sourceRoot":"","sources":["../../src/tools/buildTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,CACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,WAAW,KACjB,OAAO,CAAC,UAAU,CAAC,CAAC;IACzB,MAAM,CAAC,EACH,MAAM,GACN,CAAC,CAAC,IAAI,CAAC,EAAE;QACP,kBAAkB,CAAC,EAAE,qBAAqB,EAAE,CAAC;QAC7C,eAAe,CAAC,EAAE,aAAa,EAAE,CAAC;QAClC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,KAAK,MAAM,CAAC,CAAC;IAClB,mBAAmB,CAAC,EAAE,CACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,WAAW,KACjB,MAAM,CAAC;IACZ,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CA+BlD"}
|
package/dist/tools/buildTool.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cronCreateTool.d.ts","sourceRoot":"","sources":["../../src/tools/cronCreateTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAgDjE,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"cronCreateTool.d.ts","sourceRoot":"","sources":["../../src/tools/cronCreateTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAgDjE,eAAO,MAAM,cAAc,EAAE,UAgH5B,CAAC"}
|
|
@@ -43,7 +43,6 @@ Recurring tasks auto-expire after ${DEFAULT_MAX_AGE_DAYS} days — they fire one
|
|
|
43
43
|
Returns a job ID you can pass to CronDelete.`;
|
|
44
44
|
export const cronCreateTool = {
|
|
45
45
|
name: CRON_CREATE_TOOL_NAME,
|
|
46
|
-
shouldDefer: true,
|
|
47
46
|
config: {
|
|
48
47
|
type: "function",
|
|
49
48
|
function: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cronDeleteTool.d.ts","sourceRoot":"","sources":["../../src/tools/cronDeleteTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAOjE,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"cronDeleteTool.d.ts","sourceRoot":"","sources":["../../src/tools/cronDeleteTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAOjE,eAAO,MAAM,cAAc,EAAE,UA2C5B,CAAC"}
|
|
@@ -3,7 +3,6 @@ const CRON_DELETE_DESCRIPTION = "Cancel a scheduled cron job by ID";
|
|
|
3
3
|
const CRON_DELETE_PROMPT = `Cancel a cron job previously scheduled with CronCreate. Removes it from both the in-memory session store and durable file storage (if applicable).`;
|
|
4
4
|
export const cronDeleteTool = {
|
|
5
5
|
name: CRON_DELETE_TOOL_NAME,
|
|
6
|
-
shouldDefer: true,
|
|
7
6
|
config: {
|
|
8
7
|
type: "function",
|
|
9
8
|
function: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cronListTool.d.ts","sourceRoot":"","sources":["../../src/tools/cronListTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAOjE,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"cronListTool.d.ts","sourceRoot":"","sources":["../../src/tools/cronListTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAOjE,eAAO,MAAM,YAAY,EAAE,UAuC1B,CAAC"}
|
|
@@ -3,7 +3,6 @@ const CRON_LIST_DESCRIPTION = "List scheduled cron jobs";
|
|
|
3
3
|
const CRON_LIST_PROMPT = `List all cron jobs scheduled via CronCreate in this session.`;
|
|
4
4
|
export const cronListTool = {
|
|
5
5
|
name: CRON_LIST_TOOL_NAME,
|
|
6
|
-
shouldDefer: true,
|
|
7
6
|
config: {
|
|
8
7
|
type: "function",
|
|
9
8
|
function: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enterWorktreeTool.d.ts","sourceRoot":"","sources":["../../src/tools/enterWorktreeTool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAetE,eAAO,MAAM,0BAA0B,qxCA0BtC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"enterWorktreeTool.d.ts","sourceRoot":"","sources":["../../src/tools/enterWorktreeTool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AAetE,eAAO,MAAM,0BAA0B,qxCA0BtC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,UAqI/B,CAAC"}
|