wave-agent-sdk 1.0.4 → 1.0.6
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 +23 -1
- package/dist/agent.js +34 -4
- package/dist/managers/aiManager.d.ts +36 -0
- package/dist/managers/aiManager.js +240 -8
- package/dist/managers/messageManager.d.ts +1 -3
- package/dist/managers/messageManager.js +19 -9
- package/dist/managers/slashCommandManager.js +28 -0
- package/dist/managers/subagentManager.d.ts +0 -2
- package/dist/services/session.js +2 -9
- package/dist/telemetry/instrumentation.d.ts +1 -1
- package/dist/telemetry/instrumentation.js +57 -28
- package/dist/tools/bashTool.js +16 -6
- package/dist/tools/grepTool.js +11 -3
- package/dist/types/index.d.ts +3 -0
- package/dist/types/messaging.d.ts +2 -0
- package/dist/utils/containerSetup.js +0 -3
- package/dist/utils/messageOperations.d.ts +10 -1
- package/dist/utils/messageOperations.js +19 -1
- package/dist/utils/notificationXml.js +5 -0
- package/dist/utils/ripgrep.d.ts +4 -4
- package/dist/utils/ripgrep.js +4 -27
- package/package.json +20 -8
- package/bin/rg +0 -79
- package/dist/managers/forkedAgentManager.d.ts +0 -50
- package/dist/managers/forkedAgentManager.js +0 -130
- package/scripts/install_ripgrep.js +0 -111
- package/scripts/postinstall.js +0 -38
- package/src/agent.ts +0 -1271
- package/src/constants/subagents.ts +0 -4
- package/src/constants/toolLimits.ts +0 -15
- package/src/constants/tools.ts +0 -24
- package/src/core/plugin.ts +0 -237
- package/src/core/session.ts +0 -9
- package/src/index.ts +0 -38
- package/src/managers/MemoryRuleManager.ts +0 -198
- package/src/managers/aiManager.ts +0 -2429
- package/src/managers/backgroundTaskManager.ts +0 -480
- package/src/managers/bangManager.ts +0 -119
- package/src/managers/cronManager.ts +0 -401
- package/src/managers/foregroundTaskManager.ts +0 -30
- package/src/managers/forkedAgentManager.ts +0 -216
- package/src/managers/hookManager.ts +0 -1089
- package/src/managers/liveConfigManager.ts +0 -445
- package/src/managers/lspManager.ts +0 -470
- package/src/managers/mcpManager.ts +0 -1010
- package/src/managers/messageManager.ts +0 -1180
- package/src/managers/messageQueue.ts +0 -157
- package/src/managers/permissionManager.ts +0 -1140
- package/src/managers/planManager.ts +0 -112
- package/src/managers/pluginManager.ts +0 -330
- package/src/managers/pluginScopeManager.ts +0 -124
- package/src/managers/reversionManager.ts +0 -178
- package/src/managers/skillManager.ts +0 -578
- package/src/managers/slashCommandManager.ts +0 -564
- package/src/managers/subagentManager.ts +0 -915
- package/src/managers/toolManager.ts +0 -489
- package/src/managers/workflowManager.ts +0 -493
- package/src/prompts/autoMemory.ts +0 -33
- package/src/prompts/autoMemoryExtraction.ts +0 -146
- package/src/prompts/index.ts +0 -506
- package/src/prompts/planModeReminders.ts +0 -126
- package/src/services/GitService.ts +0 -131
- package/src/services/MarketplaceService.ts +0 -1052
- package/src/services/MemoryRuleService.ts +0 -71
- package/src/services/aiService.ts +0 -919
- package/src/services/authService.ts +0 -565
- package/src/services/autoMemoryService.ts +0 -280
- package/src/services/configurationService.ts +0 -1520
- package/src/services/fileWatcher.ts +0 -319
- package/src/services/hook.ts +0 -348
- package/src/services/initializationService.ts +0 -357
- package/src/services/interactionService.ts +0 -229
- package/src/services/jsonlHandler.ts +0 -295
- package/src/services/memory.ts +0 -234
- package/src/services/pluginLoader.ts +0 -252
- package/src/services/remoteSettingsService.ts +0 -366
- package/src/services/reversionService.ts +0 -122
- package/src/services/session.ts +0 -922
- package/src/services/taskManager.ts +0 -321
- package/src/telemetry/events.ts +0 -65
- package/src/telemetry/instrumentation.ts +0 -499
- package/src/telemetry/sessionTracing.ts +0 -348
- package/src/tools/agentTool.ts +0 -322
- package/src/tools/askUserQuestion.ts +0 -160
- package/src/tools/bashTool.ts +0 -621
- package/src/tools/buildTool.ts +0 -61
- package/src/tools/cronCreateTool.ts +0 -161
- package/src/tools/cronDeleteTool.ts +0 -51
- package/src/tools/cronListTool.ts +0 -47
- package/src/tools/editTool.ts +0 -313
- package/src/tools/enterPlanMode.ts +0 -124
- package/src/tools/enterWorktreeTool.ts +0 -190
- package/src/tools/exitPlanMode.ts +0 -139
- package/src/tools/exitWorktreeTool.ts +0 -236
- package/src/tools/globTool.ts +0 -167
- package/src/tools/grepTool.ts +0 -399
- package/src/tools/lspTool.ts +0 -883
- package/src/tools/readTool.ts +0 -426
- package/src/tools/skillTool.ts +0 -248
- package/src/tools/taskManagementTools.ts +0 -574
- package/src/tools/taskStopTool.ts +0 -78
- package/src/tools/types.ts +0 -137
- package/src/tools/webFetchTool.ts +0 -373
- package/src/tools/workflowTool.ts +0 -205
- package/src/tools/writeTool.ts +0 -267
- package/src/types/agent.ts +0 -128
- package/src/types/auth.ts +0 -19
- package/src/types/commands.ts +0 -30
- package/src/types/config.ts +0 -43
- package/src/types/configuration.ts +0 -168
- package/src/types/core.ts +0 -105
- package/src/types/cron.ts +0 -13
- package/src/types/environment.ts +0 -106
- package/src/types/fileSearch.ts +0 -4
- package/src/types/history.ts +0 -7
- package/src/types/hooks.ts +0 -256
- package/src/types/index.ts +0 -41
- package/src/types/lsp.ts +0 -98
- package/src/types/marketplace.ts +0 -71
- package/src/types/mcp.ts +0 -43
- package/src/types/memoryRule.ts +0 -31
- package/src/types/messaging.ts +0 -114
- package/src/types/permissions.ts +0 -80
- package/src/types/plugins.ts +0 -39
- package/src/types/processes.ts +0 -99
- package/src/types/reversion.ts +0 -29
- package/src/types/session.ts +0 -12
- package/src/types/skills.ts +0 -108
- package/src/types/tasks.ts +0 -13
- package/src/types/telemetry.ts +0 -98
- package/src/types/tools.ts +0 -44
- package/src/types/workflow.ts +0 -6
- package/src/utils/abortUtils.ts +0 -118
- package/src/utils/atomicWrite.ts +0 -61
- package/src/utils/bashParser.ts +0 -899
- package/src/utils/cacheControlUtils.ts +0 -426
- package/src/utils/commandArgumentParser.ts +0 -161
- package/src/utils/commandPathResolver.ts +0 -88
- package/src/utils/configPaths.ts +0 -220
- package/src/utils/configValidator.ts +0 -100
- package/src/utils/constants.ts +0 -39
- package/src/utils/container.ts +0 -92
- package/src/utils/containerSetup.ts +0 -371
- package/src/utils/convertMessagesForAPI.ts +0 -326
- package/src/utils/cronTasks.ts +0 -128
- package/src/utils/cronTasksLock.ts +0 -182
- package/src/utils/cronToHuman.ts +0 -99
- package/src/utils/customCommands.ts +0 -95
- package/src/utils/editUtils.ts +0 -20
- package/src/utils/fileFormat.ts +0 -40
- package/src/utils/fileSearch.ts +0 -151
- package/src/utils/fileUtils.ts +0 -223
- package/src/utils/gitUtils.ts +0 -315
- package/src/utils/globalLogger.ts +0 -128
- package/src/utils/groupMessagesByApiRound.ts +0 -121
- package/src/utils/hookMatcher.ts +0 -176
- package/src/utils/markdownParser.ts +0 -317
- package/src/utils/mcpUtils.ts +0 -138
- package/src/utils/messageOperations.ts +0 -641
- package/src/utils/modelCapabilities.ts +0 -30
- package/src/utils/nameGenerator.ts +0 -99
- package/src/utils/notificationXml.ts +0 -57
- package/src/utils/openaiClient.ts +0 -251
- package/src/utils/parseCronExpression.ts +0 -78
- package/src/utils/path.ts +0 -72
- package/src/utils/pathEncoder.ts +0 -400
- package/src/utils/pathSafety.ts +0 -40
- package/src/utils/promptHistory.ts +0 -168
- package/src/utils/ripgrep.ts +0 -35
- package/src/utils/shellResolver.ts +0 -190
- package/src/utils/skillParser.ts +0 -246
- package/src/utils/stringUtils.ts +0 -156
- package/src/utils/subagentParser.ts +0 -279
- package/src/utils/taskReminder.ts +0 -96
- package/src/utils/tokenCalculation.ts +0 -43
- package/src/utils/tokenEstimate.ts +0 -34
- package/src/utils/toolResultStorage.ts +0 -117
- package/src/utils/worktreeSession.ts +0 -26
- package/src/utils/worktreeUtils.ts +0 -786
- package/src/workflow/budgetTracker.ts +0 -34
- package/src/workflow/concurrencyLimiter.ts +0 -47
- package/src/workflow/journal.ts +0 -95
- package/src/workflow/progressReporter.ts +0 -141
- package/src/workflow/runState.ts +0 -65
- package/src/workflow/scriptRuntime.ts +0 -274
- package/src/workflow/structuredOutput.ts +0 -123
- package/src/workflow/types.ts +0 -101
- package/src/workflow/workflowApis.ts +0 -410
- package/vendor/ripgrep/linux-aarch64/rg +0 -0
- package/vendor/ripgrep/linux-x86_64/rg +0 -0
- package/vendor/ripgrep/macos-aarch64/rg +0 -0
- package/vendor/ripgrep/macos-x86_64/rg +0 -0
- package/vendor/ripgrep/windows-aarch64/rg.exe +0 -0
- package/vendor/ripgrep/windows-x86_64/rg.exe +0 -0
package/src/types/config.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent and service configuration types
|
|
3
|
-
* Dependencies: None
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import OpenAI from "openai";
|
|
7
|
-
import { PermissionMode } from "./permissions.js";
|
|
8
|
-
|
|
9
|
-
export interface GatewayConfig {
|
|
10
|
-
apiKey?: string;
|
|
11
|
-
baseURL?: string;
|
|
12
|
-
defaultHeaders?: Record<string, string>;
|
|
13
|
-
fetchOptions?: OpenAI["fetchOptions"];
|
|
14
|
-
fetch?: OpenAI["fetch"];
|
|
15
|
-
/** Session identifier, sent as the `x-session-id` request header for backend correlation. */
|
|
16
|
-
sessionId?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ModelCapabilities {
|
|
20
|
-
/** Whether the model supports image/vision input. Default: true. */
|
|
21
|
-
vision?: boolean;
|
|
22
|
-
/** Whether the model supports prompt caching (ephemeral cache_control markers). Default: false. */
|
|
23
|
-
promptCaching?: boolean;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface ModelConfig {
|
|
27
|
-
model?: string;
|
|
28
|
-
fastModel?: string;
|
|
29
|
-
maxTokens?: number;
|
|
30
|
-
permissionMode?: PermissionMode;
|
|
31
|
-
capabilities?: ModelCapabilities;
|
|
32
|
-
/** Generation params passed through to the API provider (temperature, thinking, etc.) */
|
|
33
|
-
options?: Record<string, unknown>;
|
|
34
|
-
/** Fast model generation params (resolved from models[fastModel].options) */
|
|
35
|
-
fastModelOptions?: Record<string, unknown>;
|
|
36
|
-
/**
|
|
37
|
-
* Fast-model-only disable-thinking params passed through verbatim
|
|
38
|
-
* (e.g. `{ thinking: { type: "disabled" } }`). Applied only in fast-model
|
|
39
|
-
* scenarios (webFetch content processing, `model: fastModel` subagents),
|
|
40
|
-
* never in the agent loop. `{}` clears the default.
|
|
41
|
-
*/
|
|
42
|
-
disableThinkingOptions?: Record<string, unknown>;
|
|
43
|
-
}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration Management Types
|
|
3
|
-
*
|
|
4
|
-
* Types for centralized configuration loading and validation services.
|
|
5
|
-
* These support the refactored configuration architecture that separates
|
|
6
|
-
* configuration management from hook execution.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { HookEvent, HookEventConfig } from "./hooks.js";
|
|
10
|
-
import type { PermissionMode } from "./permissions.js";
|
|
11
|
-
import type { ModelConfig } from "./config.js";
|
|
12
|
-
import type { MarketplaceSource } from "./marketplace.js";
|
|
13
|
-
import type { TelemetryConfig } from "./telemetry.js";
|
|
14
|
-
|
|
15
|
-
export type Scope = "user" | "project" | "local";
|
|
16
|
-
|
|
17
|
-
export interface MarketplaceConfig {
|
|
18
|
-
source: MarketplaceSource;
|
|
19
|
-
autoUpdate?: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Root configuration structure for all Wave Agent settings including hooks and environment variables
|
|
24
|
-
*/
|
|
25
|
-
export interface WaveConfiguration {
|
|
26
|
-
hooks?: Partial<Record<HookEvent, HookEventConfig[]>>;
|
|
27
|
-
env?: Record<string, string>; // Environment variables key-value pairs
|
|
28
|
-
/** New field for persistent permissions */
|
|
29
|
-
permissions?: {
|
|
30
|
-
allow?: string[];
|
|
31
|
-
deny?: string[];
|
|
32
|
-
permissionMode?: PermissionMode; // Default permission mode for restricted tools
|
|
33
|
-
/**
|
|
34
|
-
* List of directories that are considered part of the Safe Zone.
|
|
35
|
-
* File operations within these directories can be auto-accepted.
|
|
36
|
-
*/
|
|
37
|
-
additionalDirectories?: string[];
|
|
38
|
-
};
|
|
39
|
-
/** New field for scoped plugin management */
|
|
40
|
-
enabledPlugins?: Record<string, boolean>;
|
|
41
|
-
/** Preferred language for agent communication */
|
|
42
|
-
language?: string;
|
|
43
|
-
/** Whether auto-memory is enabled */
|
|
44
|
-
autoMemoryEnabled?: boolean;
|
|
45
|
-
/** Frequency of auto-memory extraction turns */
|
|
46
|
-
autoMemoryFrequency?: number;
|
|
47
|
-
/** Persisted model selection (from /model command) */
|
|
48
|
-
model?: string;
|
|
49
|
-
/** Model-specific configuration overrides */
|
|
50
|
-
models?: Record<string, Partial<ModelConfig>>;
|
|
51
|
-
/** Scoped marketplace declarations */
|
|
52
|
-
marketplaces?: Record<string, MarketplaceConfig>;
|
|
53
|
-
/** OpenTelemetry monitoring configuration */
|
|
54
|
-
monitoring?: {
|
|
55
|
-
telemetry?: Partial<TelemetryConfig>;
|
|
56
|
-
};
|
|
57
|
-
/** Worktree configuration */
|
|
58
|
-
worktree?: {
|
|
59
|
-
/** Base ref for new worktrees: "fresh" (origin/<default-branch>, default) | "head" (local HEAD) */
|
|
60
|
-
baseRef?: "fresh" | "head";
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Legacy alias for backward compatibility - will be deprecated
|
|
66
|
-
*/
|
|
67
|
-
export interface HookConfiguration extends WaveConfiguration {
|
|
68
|
-
hooks: Partial<Record<HookEvent, HookEventConfig[]>>;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Partial hook configuration for loading/merging scenarios
|
|
73
|
-
*/
|
|
74
|
-
export type PartialHookConfiguration = Partial<
|
|
75
|
-
Record<HookEvent, HookEventConfig[]>
|
|
76
|
-
>;
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Direct hook configuration record (for test convenience)
|
|
80
|
-
*/
|
|
81
|
-
export type HookConfigurationRecord = Record<HookEvent, HookEventConfig[]>;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Result of configuration loading operations with detailed status information
|
|
85
|
-
*/
|
|
86
|
-
export interface ConfigurationLoadResult {
|
|
87
|
-
/** The loaded configuration, or null if loading failed */
|
|
88
|
-
configuration: WaveConfiguration | null;
|
|
89
|
-
/** Whether the loading operation was successful */
|
|
90
|
-
success: boolean;
|
|
91
|
-
/** Error message if loading failed */
|
|
92
|
-
error?: string;
|
|
93
|
-
/** Path of the successfully loaded file */
|
|
94
|
-
sourcePath?: string;
|
|
95
|
-
/** Non-critical warnings during loading */
|
|
96
|
-
warnings: string[];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Result of configuration validation operations
|
|
101
|
-
*/
|
|
102
|
-
export interface ValidationResult {
|
|
103
|
-
/** Whether the configuration is valid */
|
|
104
|
-
isValid: boolean;
|
|
105
|
-
/** Critical errors that prevent configuration use */
|
|
106
|
-
errors: string[];
|
|
107
|
-
/** Non-critical warnings about the configuration */
|
|
108
|
-
warnings: string[];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Configuration file paths organized by category
|
|
113
|
-
*/
|
|
114
|
-
export interface ConfigurationPaths {
|
|
115
|
-
/** User-specific configuration file paths in priority order */
|
|
116
|
-
userPaths: string[];
|
|
117
|
-
/** Project-specific configuration file paths in priority order */
|
|
118
|
-
projectPaths: string[];
|
|
119
|
-
/** Builtin configuration file paths */
|
|
120
|
-
builtinPaths: string[];
|
|
121
|
-
/** All configuration paths combined */
|
|
122
|
-
allPaths: string[];
|
|
123
|
-
/** Only the paths that actually exist on the filesystem */
|
|
124
|
-
existingPaths: string[];
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Options for configuring the ConfigurationService
|
|
129
|
-
*/
|
|
130
|
-
export interface ConfigurationServiceOptions {
|
|
131
|
-
/** Working directory for resolving project configurations */
|
|
132
|
-
workdir: string;
|
|
133
|
-
/** Optional logger for configuration operations */
|
|
134
|
-
logger?: Logger;
|
|
135
|
-
/** Whether to enable validation during loading (default: true) */
|
|
136
|
-
enableValidation?: boolean;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Minimal logger interface for configuration services
|
|
141
|
-
*/
|
|
142
|
-
interface Logger {
|
|
143
|
-
error: (...args: unknown[]) => void;
|
|
144
|
-
warn: (...args: unknown[]) => void;
|
|
145
|
-
info: (...args: unknown[]) => void;
|
|
146
|
-
debug: (...args: unknown[]) => void;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export interface RemoteSettingsResponse {
|
|
150
|
-
uuid: string;
|
|
151
|
-
checksum: string;
|
|
152
|
-
settings: WaveConfiguration;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export interface RemoteSettingsCache {
|
|
156
|
-
uuid: string;
|
|
157
|
-
checksum: string;
|
|
158
|
-
settings: WaveConfiguration;
|
|
159
|
-
fetchedAt: string;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export interface RemoteSettingsFetchResult {
|
|
163
|
-
success: boolean;
|
|
164
|
-
settings?: WaveConfiguration | null;
|
|
165
|
-
checksum?: string;
|
|
166
|
-
error?: string;
|
|
167
|
-
notConfigured?: boolean;
|
|
168
|
-
}
|
package/src/types/core.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core foundational types used across multiple domains
|
|
3
|
-
* Dependencies: None (foundation layer)
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { CompletionUsage } from "openai/resources";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Logger interface definition
|
|
10
|
-
* Compatible with OpenAI package Logger interface
|
|
11
|
-
*/
|
|
12
|
-
export interface Logger {
|
|
13
|
-
error: (...args: unknown[]) => void;
|
|
14
|
-
warn: (...args: unknown[]) => void;
|
|
15
|
-
info: (...args: unknown[]) => void;
|
|
16
|
-
debug: (...args: unknown[]) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Usage statistics for AI operations
|
|
21
|
-
* Extends OpenAI's Usage format with additional tracking fields
|
|
22
|
-
*/
|
|
23
|
-
export interface Usage {
|
|
24
|
-
prompt_tokens: number; // Tokens used in prompts
|
|
25
|
-
completion_tokens: number; // Tokens generated in completions
|
|
26
|
-
total_tokens: number; // Sum of prompt + completion tokens
|
|
27
|
-
model?: string; // Model used for the operation (e.g., "gpt-4", "gpt-3.5-turbo")
|
|
28
|
-
operation_type?: "agent" | "compact"; // Type of operation that generated usage
|
|
29
|
-
|
|
30
|
-
// Cache-related tokens (Claude top-level + OpenAI prompt_tokens_details)
|
|
31
|
-
cache_read_input_tokens?: number; // Tokens read from cache (Claude) or cached_tokens (OpenAI prompt_tokens_details)
|
|
32
|
-
cache_creation_input_tokens?: number; // Tokens used to create cache entries
|
|
33
|
-
cache_creation?: {
|
|
34
|
-
ephemeral_5m_input_tokens: number; // Tokens cached for 5 minutes
|
|
35
|
-
ephemeral_1h_input_tokens: number; // Tokens cached for 1 hour
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Enhanced usage metrics including Claude cache information
|
|
41
|
-
* Backward compatible with standard OpenAI CompletionUsage
|
|
42
|
-
*/
|
|
43
|
-
export interface ClaudeUsage extends CompletionUsage {
|
|
44
|
-
// Standard OpenAI usage fields (inherited)
|
|
45
|
-
prompt_tokens: number;
|
|
46
|
-
completion_tokens: number;
|
|
47
|
-
total_tokens: number;
|
|
48
|
-
|
|
49
|
-
// Claude-specific cache extensions
|
|
50
|
-
/**
|
|
51
|
-
* Number of tokens read from existing cache
|
|
52
|
-
* Indicates cost savings from cache hits
|
|
53
|
-
*/
|
|
54
|
-
cache_read_input_tokens?: number;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Number of tokens used to create new cache entries
|
|
58
|
-
* Investment in future cache hits
|
|
59
|
-
*/
|
|
60
|
-
cache_creation_input_tokens?: number;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Detailed breakdown of cache creation by duration
|
|
64
|
-
*/
|
|
65
|
-
cache_creation?: {
|
|
66
|
-
/** Tokens cached for 5 minute duration */
|
|
67
|
-
ephemeral_5m_input_tokens: number;
|
|
68
|
-
/** Tokens cached for 1 hour duration */
|
|
69
|
-
ephemeral_1h_input_tokens: number;
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Represents a diff change for tool parameter-based diff display
|
|
75
|
-
* Contains the old content and new content for comparison
|
|
76
|
-
*/
|
|
77
|
-
export interface Change {
|
|
78
|
-
/** The original content (empty string for additions) */
|
|
79
|
-
oldContent: string;
|
|
80
|
-
/** The new content (empty string for deletions) */
|
|
81
|
-
newContent: string;
|
|
82
|
-
/** Optional starting line number in the original file */
|
|
83
|
-
startLineNumber?: number;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export class ConfigurationError extends Error {
|
|
87
|
-
constructor(
|
|
88
|
-
message: string,
|
|
89
|
-
public readonly field: string,
|
|
90
|
-
public readonly provided?: unknown,
|
|
91
|
-
) {
|
|
92
|
-
super(message);
|
|
93
|
-
this.name = "ConfigurationError";
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Standard error messages
|
|
98
|
-
export const CONFIG_ERRORS = {
|
|
99
|
-
MISSING_MODEL:
|
|
100
|
-
"Agent configuration requires model. Provide via constructor or WAVE_MODEL environment variable.",
|
|
101
|
-
MISSING_FAST_MODEL:
|
|
102
|
-
"Agent configuration requires fastModel. Provide via constructor or WAVE_FAST_MODEL environment variable.",
|
|
103
|
-
INVALID_WAVE_MAX_INPUT_TOKENS: "Token limit must be a positive integer.",
|
|
104
|
-
EMPTY_BASE_URL: "Base URL cannot be empty string.",
|
|
105
|
-
} as const;
|
package/src/types/cron.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface CronJob {
|
|
2
|
-
id: string;
|
|
3
|
-
cron: string;
|
|
4
|
-
prompt: string;
|
|
5
|
-
recurring: boolean;
|
|
6
|
-
createdAt: number;
|
|
7
|
-
nextRun: number;
|
|
8
|
-
periodMs: number;
|
|
9
|
-
/** When true, the job is persisted to .wave/scheduled_tasks.json. */
|
|
10
|
-
durable?: boolean;
|
|
11
|
-
/** Timestamp of the last time a durable recurring job fired. */
|
|
12
|
-
lastFiredAt?: number;
|
|
13
|
-
}
|
package/src/types/environment.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type { Scope } from "./configuration.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Environment Variable System Types
|
|
5
|
-
*
|
|
6
|
-
* Provides comprehensive TypeScript types for environment variable validation,
|
|
7
|
-
* merging, and conflict resolution in the Wave Agent SDK.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Result of environment variable validation
|
|
12
|
-
*/
|
|
13
|
-
export interface EnvironmentValidationResult {
|
|
14
|
-
isValid: boolean;
|
|
15
|
-
errors: string[];
|
|
16
|
-
warnings: string[];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Context containing merged environment variables and conflict information
|
|
21
|
-
*/
|
|
22
|
-
export interface MergedEnvironmentContext {
|
|
23
|
-
userVars: Record<string, string>;
|
|
24
|
-
projectVars: Record<string, string>;
|
|
25
|
-
mergedVars: Record<string, string>;
|
|
26
|
-
conflicts: Array<{
|
|
27
|
-
key: string;
|
|
28
|
-
userValue: string;
|
|
29
|
-
projectValue: string;
|
|
30
|
-
resolvedValue: string;
|
|
31
|
-
}>;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Type guard to check if a value is a valid environment variables object
|
|
36
|
-
*/
|
|
37
|
-
export function isValidEnvironmentVars(
|
|
38
|
-
env: unknown,
|
|
39
|
-
): env is Record<string, string> {
|
|
40
|
-
if (typeof env !== "object" || env === null) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Check if all keys and values are strings
|
|
45
|
-
for (const [key, value] of Object.entries(env)) {
|
|
46
|
-
if (typeof key !== "string" || typeof value !== "string") {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Configuration options for environment merging
|
|
56
|
-
*/
|
|
57
|
-
export interface EnvironmentMergeOptions {
|
|
58
|
-
/** Whether to include warnings for conflicting variables */
|
|
59
|
-
includeConflictWarnings?: boolean;
|
|
60
|
-
/** Whether to validate variable names for common patterns */
|
|
61
|
-
validateVariableNames?: boolean;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Result of environment variable processing operations
|
|
66
|
-
*/
|
|
67
|
-
export interface EnvironmentProcessResult {
|
|
68
|
-
/** The processed environment variables */
|
|
69
|
-
processedVars: Record<string, string>;
|
|
70
|
-
/** Any conflicts that occurred during processing */
|
|
71
|
-
conflicts: EnvironmentConflict[];
|
|
72
|
-
/** Non-critical warnings during processing */
|
|
73
|
-
warnings: string[];
|
|
74
|
-
/** Whether the variables were successfully applied to process.env */
|
|
75
|
-
applied: boolean;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Enhanced environment merge context with conflict details
|
|
80
|
-
*/
|
|
81
|
-
export interface EnvironmentMergeContext {
|
|
82
|
-
/** User-provided environment variables */
|
|
83
|
-
userVars: Record<string, string>;
|
|
84
|
-
/** Project-provided environment variables */
|
|
85
|
-
projectVars: Record<string, string>;
|
|
86
|
-
/** Final merged environment variables */
|
|
87
|
-
mergedVars: Record<string, string>;
|
|
88
|
-
/** Detailed conflict information */
|
|
89
|
-
conflicts: EnvironmentConflict[];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Detailed information about an environment variable conflict
|
|
94
|
-
*/
|
|
95
|
-
export interface EnvironmentConflict {
|
|
96
|
-
/** The environment variable key */
|
|
97
|
-
key: string;
|
|
98
|
-
/** Value from user configuration */
|
|
99
|
-
userValue: string;
|
|
100
|
-
/** Value from project configuration */
|
|
101
|
-
projectValue: string;
|
|
102
|
-
/** Final resolved value (which source won) */
|
|
103
|
-
resolvedValue: string;
|
|
104
|
-
/** Which source provided the final value */
|
|
105
|
-
source: Scope;
|
|
106
|
-
}
|
package/src/types/fileSearch.ts
DELETED