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/hooks.ts
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hooks System Type Definitions
|
|
3
|
-
*
|
|
4
|
-
* Provides comprehensive TypeScript types for the Wave Code hooks system,
|
|
5
|
-
* enabling automated actions at specific workflow points.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export type {
|
|
9
|
-
WaveConfiguration,
|
|
10
|
-
HookConfiguration,
|
|
11
|
-
PartialHookConfiguration,
|
|
12
|
-
HookConfigurationRecord,
|
|
13
|
-
} from "./configuration.js";
|
|
14
|
-
|
|
15
|
-
// Hook event types - trigger points in the AI workflow
|
|
16
|
-
export type HookEvent =
|
|
17
|
-
| "PreToolUse"
|
|
18
|
-
| "PostToolUse"
|
|
19
|
-
| "UserPromptSubmit"
|
|
20
|
-
| "Stop"
|
|
21
|
-
| "SubagentStop"
|
|
22
|
-
| "PermissionRequest"
|
|
23
|
-
| "WorktreeCreate"
|
|
24
|
-
| "WorktreeRemove"
|
|
25
|
-
| "CwdChanged"
|
|
26
|
-
| "SessionStart"
|
|
27
|
-
| "SessionEnd"
|
|
28
|
-
| "PreCompact"
|
|
29
|
-
| "PostCompact";
|
|
30
|
-
|
|
31
|
-
// Individual hook command configuration
|
|
32
|
-
export interface HookCommand {
|
|
33
|
-
type: "command";
|
|
34
|
-
command: string;
|
|
35
|
-
async?: boolean;
|
|
36
|
-
timeout?: number; // seconds
|
|
37
|
-
pluginRoot?: string; // Plugin directory path for plugin-originated hooks
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Hook event configuration with optional pattern matching
|
|
41
|
-
export interface HookEventConfig {
|
|
42
|
-
matcher?: string; // Required for PreToolUse/PostToolUse, omitted for others
|
|
43
|
-
hooks: HookCommand[];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Context passed to hook during execution
|
|
47
|
-
export interface HookExecutionContext {
|
|
48
|
-
event: HookEvent;
|
|
49
|
-
toolName?: string; // Present for PreToolUse/PostToolUse events
|
|
50
|
-
projectDir: string; // Absolute path for $WAVE_PROJECT_DIR
|
|
51
|
-
timestamp: Date;
|
|
52
|
-
worktreeName?: string; // Present for WorktreeCreate
|
|
53
|
-
worktreePath?: string; // Present for WorktreeRemove
|
|
54
|
-
planFilePath?: string; // Present when in plan mode
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Result of hook execution
|
|
58
|
-
export interface HookExecutionResult {
|
|
59
|
-
success: boolean;
|
|
60
|
-
exitCode?: number;
|
|
61
|
-
stdout?: string;
|
|
62
|
-
stderr?: string;
|
|
63
|
-
duration: number; // milliseconds
|
|
64
|
-
timedOut: boolean;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Hook execution options
|
|
68
|
-
export interface HookExecutionOptions {
|
|
69
|
-
timeout?: number; // milliseconds, default 10000
|
|
70
|
-
cwd?: string; // working directory, defaults to projectDir
|
|
71
|
-
continueOnFailure?: boolean; // continue executing remaining hooks on failure
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Validation result for hook configuration
|
|
75
|
-
export interface HookValidationResult {
|
|
76
|
-
valid: boolean;
|
|
77
|
-
errors: string[];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Hook execution errors (non-blocking)
|
|
81
|
-
export class HookExecutionError extends Error {
|
|
82
|
-
constructor(
|
|
83
|
-
public readonly hookCommand: string,
|
|
84
|
-
public readonly originalError: Error,
|
|
85
|
-
public readonly context: HookExecutionContext,
|
|
86
|
-
) {
|
|
87
|
-
super(`Hook execution failed: ${hookCommand} - ${originalError.message}`);
|
|
88
|
-
this.name = "HookExecutionError";
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Configuration validation errors (blocking)
|
|
93
|
-
export class HookConfigurationError extends Error {
|
|
94
|
-
constructor(
|
|
95
|
-
public readonly configPath: string,
|
|
96
|
-
public readonly validationErrors: string[],
|
|
97
|
-
) {
|
|
98
|
-
super(
|
|
99
|
-
`Hook configuration error in ${configPath}: ${validationErrors.join(", ")}`,
|
|
100
|
-
);
|
|
101
|
-
this.name = "HookConfigurationError";
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export type SessionStartSource = "startup" | "resume" | "compact" | "clear";
|
|
106
|
-
|
|
107
|
-
export type SessionEndSource = "exit" | "resume" | "stop" | "compact" | "clear";
|
|
108
|
-
|
|
109
|
-
// Type guards for runtime validation
|
|
110
|
-
export function isValidHookEvent(event: string): event is HookEvent {
|
|
111
|
-
return [
|
|
112
|
-
"PreToolUse",
|
|
113
|
-
"PostToolUse",
|
|
114
|
-
"UserPromptSubmit",
|
|
115
|
-
"Stop",
|
|
116
|
-
"SubagentStop",
|
|
117
|
-
"PermissionRequest",
|
|
118
|
-
"WorktreeCreate",
|
|
119
|
-
"WorktreeRemove",
|
|
120
|
-
"CwdChanged",
|
|
121
|
-
"SessionStart",
|
|
122
|
-
"SessionEnd",
|
|
123
|
-
"PreCompact",
|
|
124
|
-
"PostCompact",
|
|
125
|
-
].includes(event);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export function isValidHookCommand(cmd: unknown): cmd is HookCommand {
|
|
129
|
-
if (
|
|
130
|
-
typeof cmd !== "object" ||
|
|
131
|
-
cmd === null ||
|
|
132
|
-
!("type" in cmd) ||
|
|
133
|
-
cmd.type !== "command" ||
|
|
134
|
-
!("command" in cmd) ||
|
|
135
|
-
typeof cmd.command !== "string" ||
|
|
136
|
-
cmd.command.length === 0
|
|
137
|
-
) {
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const hookCmd = cmd as Record<string, unknown>;
|
|
142
|
-
|
|
143
|
-
if ("async" in hookCmd && typeof hookCmd.async !== "boolean") {
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if ("timeout" in hookCmd && typeof hookCmd.timeout !== "number") {
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if ("pluginRoot" in hookCmd && typeof hookCmd.pluginRoot !== "string") {
|
|
152
|
-
return false;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export function isValidHookEventConfig(
|
|
159
|
-
config: unknown,
|
|
160
|
-
): config is HookEventConfig {
|
|
161
|
-
if (typeof config !== "object" || config === null) return false;
|
|
162
|
-
|
|
163
|
-
const cfg = config as Record<string, unknown>;
|
|
164
|
-
|
|
165
|
-
// Validate hooks array
|
|
166
|
-
if (!Array.isArray(cfg.hooks) || cfg.hooks.length === 0) return false;
|
|
167
|
-
if (!cfg.hooks.every(isValidHookCommand)) return false;
|
|
168
|
-
|
|
169
|
-
// Validate optional matcher
|
|
170
|
-
if ("matcher" in cfg && typeof cfg.matcher !== "string") return false;
|
|
171
|
-
|
|
172
|
-
return true;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// JSON structure passed to hooks via stdin
|
|
176
|
-
export interface HookJsonInput {
|
|
177
|
-
// Required fields for all events
|
|
178
|
-
session_id: string; // Format: "wave_session_{uuid}_{shortId}"
|
|
179
|
-
transcript_path: string; // Format: "~/.wave/sessions/session_{shortId}.json"
|
|
180
|
-
cwd: string; // Absolute path to current working directory
|
|
181
|
-
hook_event_name: HookEvent; // "PreToolUse" | "PostToolUse" | "UserPromptSubmit" | "Stop" | "SubagentStop" | "PermissionRequest" | "WorktreeCreate" | "CwdChanged" | "SessionStart"
|
|
182
|
-
|
|
183
|
-
// Optional fields based on event type
|
|
184
|
-
tool_name?: string; // Present for PreToolUse, PostToolUse, PermissionRequest
|
|
185
|
-
tool_input?: unknown; // Present for PreToolUse, PostToolUse, PermissionRequest
|
|
186
|
-
tool_response?: unknown; // Present for PostToolUse only
|
|
187
|
-
plan_file_path?: string; // Present when in plan mode
|
|
188
|
-
user_prompt?: string; // Present for UserPromptSubmit only
|
|
189
|
-
subagent_type?: string; // Present when hook is executed by a subagent
|
|
190
|
-
name?: string; // Present for WorktreeCreate events
|
|
191
|
-
worktree_path?: string; // Present for WorktreeRemove events
|
|
192
|
-
old_cwd?: string; // Present for CwdChanged events
|
|
193
|
-
new_cwd?: string; // Present for CwdChanged events
|
|
194
|
-
source?: SessionStartSource; // Present for SessionStart events
|
|
195
|
-
agent_type?: string; // Present for SessionStart events
|
|
196
|
-
end_source?: SessionEndSource; // Present for SessionEnd events
|
|
197
|
-
compact_instructions?: string; // Present for PreCompact events
|
|
198
|
-
compact_summary?: string; // Present for PostCompact events
|
|
199
|
-
background_tasks?: BackgroundTaskInfo[]; // Present for Stop events: running background tasks snapshot
|
|
200
|
-
session_crons?: SessionCronInfo[]; // Present for Stop events: session-scoped cron jobs snapshot
|
|
201
|
-
last_assistant_message?: string; // Present for Stop and SubagentStop events: text content of the last assistant message
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Describes one in-flight background task in the Stop hook input.
|
|
205
|
-
// Aligned with Claude Code (v2.1.145+) background_tasks array element schema.
|
|
206
|
-
// Conditional fields are populated based on `type`:
|
|
207
|
-
// - "shell": `command` is set
|
|
208
|
-
// - "subagent": `agent_type` is set
|
|
209
|
-
// - "workflow": `name` is set
|
|
210
|
-
export interface BackgroundTaskInfo {
|
|
211
|
-
id: string;
|
|
212
|
-
type: "shell" | "subagent" | "workflow";
|
|
213
|
-
status: string;
|
|
214
|
-
description: string; // Capped at 1000 chars with "… [+N chars]" marker
|
|
215
|
-
command?: string; // Present only for shell tasks (≤1000 chars)
|
|
216
|
-
agent_type?: string; // Present only for subagent tasks
|
|
217
|
-
name?: string; // Present only for workflow tasks
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// Describes one session-scoped cron job in the Stop hook input.
|
|
221
|
-
// Aligned with Claude Code (v2.1.145+) session_crons array element schema.
|
|
222
|
-
export interface SessionCronInfo {
|
|
223
|
-
id: string;
|
|
224
|
-
schedule: string; // Cron expression
|
|
225
|
-
recurring: boolean;
|
|
226
|
-
prompt: string;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Extended context interface for passing additional data to hook executor
|
|
230
|
-
export interface ExtendedHookExecutionContext extends HookExecutionContext {
|
|
231
|
-
sessionId?: string; // Session identifier for JSON construction
|
|
232
|
-
transcriptPath?: string; // Path to session transcript file
|
|
233
|
-
cwd?: string; // Current working directory
|
|
234
|
-
toolInput?: unknown; // Tool input parameters (PreToolUse/PostToolUse)
|
|
235
|
-
toolResponse?: unknown; // Tool execution result (PostToolUse only)
|
|
236
|
-
env?: Record<string, string>; // Additional environment variables (from configuration)
|
|
237
|
-
userPrompt?: string; // User prompt text (UserPromptSubmit only)
|
|
238
|
-
subagentType?: string; // Subagent type when hook is executed by a subagent
|
|
239
|
-
worktreeName?: string; // Worktree name (WorktreeCreate only)
|
|
240
|
-
oldCwd?: string; // Previous working directory (CwdChanged only)
|
|
241
|
-
newCwd?: string; // New working directory (CwdChanged only)
|
|
242
|
-
source?: SessionStartSource; // Session start source (SessionStart only)
|
|
243
|
-
agentType?: string; // Agent type identifier (SessionStart only)
|
|
244
|
-
endSource?: SessionEndSource; // Session end source (SessionEnd only)
|
|
245
|
-
compactInstructions?: string; // Custom instructions for PreCompact
|
|
246
|
-
compactSummary?: string; // Summary text for PostCompact
|
|
247
|
-
backgroundTasks?: BackgroundTaskInfo[]; // Running background tasks snapshot (Stop only)
|
|
248
|
-
sessionCrons?: SessionCronInfo[]; // Session-scoped cron jobs snapshot (Stop only)
|
|
249
|
-
lastAssistantMessage?: string; // Text content of last assistant message (Stop and SubagentStop only)
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
// Environment variables injected into hook processes
|
|
253
|
-
export interface HookEnvironment {
|
|
254
|
-
WAVE_PROJECT_DIR: string; // Absolute path to project root
|
|
255
|
-
[key: string]: string; // Inherit all parent process environment variables
|
|
256
|
-
}
|
package/src/types/index.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Main type index - Barrel export for backward compatibility
|
|
3
|
-
* Re-exports all domain types for legacy imports
|
|
4
|
-
*
|
|
5
|
-
* Legacy import pattern (continues to work):
|
|
6
|
-
* import { Message, Logger, McpTool } from 'wave-agent-sdk/types';
|
|
7
|
-
*
|
|
8
|
-
* New domain-specific import pattern:
|
|
9
|
-
* import { Message } from 'wave-agent-sdk/types/messaging';
|
|
10
|
-
* import { Logger } from 'wave-agent-sdk/types/core';
|
|
11
|
-
* import { McpTool } from 'wave-agent-sdk/types/mcp';
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
// Core foundational types
|
|
15
|
-
export * from "./core.js";
|
|
16
|
-
|
|
17
|
-
// Domain-specific types
|
|
18
|
-
export * from "./messaging.js";
|
|
19
|
-
export * from "./mcp.js";
|
|
20
|
-
export * from "./processes.js";
|
|
21
|
-
export * from "./commands.js";
|
|
22
|
-
export * from "./skills.js";
|
|
23
|
-
export * from "./config.js";
|
|
24
|
-
export * from "./session.js";
|
|
25
|
-
export * from "./environment.js";
|
|
26
|
-
export * from "./configuration.js"; // New configuration management types
|
|
27
|
-
export * from "./hooks.js";
|
|
28
|
-
export * from "./permissions.js";
|
|
29
|
-
export * from "./tools.js"; // Tool parameter types
|
|
30
|
-
export * from "./fileSearch.js"; // File search types
|
|
31
|
-
export * from "./lsp.js";
|
|
32
|
-
export * from "./plugins.js";
|
|
33
|
-
export * from "./marketplace.js";
|
|
34
|
-
export * from "./memoryRule.js";
|
|
35
|
-
export * from "./history.js";
|
|
36
|
-
export * from "./tasks.js";
|
|
37
|
-
export * from "./agent.js";
|
|
38
|
-
export * from "./cron.js";
|
|
39
|
-
export * from "./telemetry.js";
|
|
40
|
-
export * from "./auth.js";
|
|
41
|
-
export * from "./workflow.js";
|
package/src/types/lsp.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LSP (Language Server Protocol) configuration and communication types
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export interface LspServerConfig {
|
|
6
|
-
command: string;
|
|
7
|
-
args?: string[];
|
|
8
|
-
extensionToLanguage: Record<string, string>;
|
|
9
|
-
transport?: "stdio" | "socket";
|
|
10
|
-
env?: Record<string, string>;
|
|
11
|
-
initializationOptions?: unknown;
|
|
12
|
-
settings?: unknown;
|
|
13
|
-
workspaceFolder?: string;
|
|
14
|
-
startupTimeout?: number;
|
|
15
|
-
shutdownTimeout?: number;
|
|
16
|
-
restartOnCrash?: boolean;
|
|
17
|
-
maxRestarts?: number;
|
|
18
|
-
/** Internal: plugin directory path when the server is registered by a plugin */
|
|
19
|
-
pluginRoot?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface LspConfig {
|
|
23
|
-
[language: string]: LspServerConfig;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface LspPosition {
|
|
27
|
-
line: number;
|
|
28
|
-
character: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface LspRange {
|
|
32
|
-
start: LspPosition;
|
|
33
|
-
end: LspPosition;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface LspLocation {
|
|
37
|
-
uri: string;
|
|
38
|
-
range: LspRange;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface LspLocationLink {
|
|
42
|
-
originSelectionRange?: LspRange;
|
|
43
|
-
targetUri: string;
|
|
44
|
-
targetRange: LspRange;
|
|
45
|
-
targetSelectionRange?: LspRange;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface LspHover {
|
|
49
|
-
contents:
|
|
50
|
-
| string
|
|
51
|
-
| { kind: string; value: string }
|
|
52
|
-
| Array<string | { kind: string; value: string }>;
|
|
53
|
-
range?: LspRange;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface LspSymbolInformation {
|
|
57
|
-
name: string;
|
|
58
|
-
kind: number;
|
|
59
|
-
location: LspLocation;
|
|
60
|
-
containerName?: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface LspDocumentSymbol {
|
|
64
|
-
name: string;
|
|
65
|
-
detail?: string;
|
|
66
|
-
kind: number;
|
|
67
|
-
range: LspRange;
|
|
68
|
-
selectionRange: LspRange;
|
|
69
|
-
children?: LspDocumentSymbol[];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface LspCallHierarchyItem {
|
|
73
|
-
name: string;
|
|
74
|
-
kind: number;
|
|
75
|
-
detail?: string;
|
|
76
|
-
uri: string;
|
|
77
|
-
range: LspRange;
|
|
78
|
-
selectionRange: LspRange;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface LspCallHierarchyIncomingCall {
|
|
82
|
-
from: LspCallHierarchyItem;
|
|
83
|
-
fromRanges: LspRange[];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface LspCallHierarchyOutgoingCall {
|
|
87
|
-
to: LspCallHierarchyItem;
|
|
88
|
-
fromRanges: LspRange[];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface ILspManager {
|
|
92
|
-
execute(args: {
|
|
93
|
-
operation: string;
|
|
94
|
-
filePath: string;
|
|
95
|
-
line: number;
|
|
96
|
-
character: number;
|
|
97
|
-
}): Promise<{ success: boolean; content: string }>;
|
|
98
|
-
}
|
package/src/types/marketplace.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Scope } from "./configuration.js";
|
|
2
|
-
|
|
3
|
-
export interface MarketplaceOwner {
|
|
4
|
-
name: string;
|
|
5
|
-
email?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface MarketplacePluginEntry {
|
|
9
|
-
name: string;
|
|
10
|
-
source: string;
|
|
11
|
-
description: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface MarketplacePluginStatus extends MarketplacePluginEntry {
|
|
15
|
-
marketplace: string;
|
|
16
|
-
installed: boolean;
|
|
17
|
-
version?: string;
|
|
18
|
-
cachePath?: string;
|
|
19
|
-
projectPath?: string;
|
|
20
|
-
scope?: Scope;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface MarketplaceManifest {
|
|
24
|
-
name: string;
|
|
25
|
-
owner: MarketplaceOwner;
|
|
26
|
-
plugins: MarketplacePluginEntry[];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type MarketplaceSource =
|
|
30
|
-
| {
|
|
31
|
-
source: "directory";
|
|
32
|
-
path: string;
|
|
33
|
-
}
|
|
34
|
-
| {
|
|
35
|
-
source: "github";
|
|
36
|
-
repo: string;
|
|
37
|
-
ref?: string;
|
|
38
|
-
}
|
|
39
|
-
| {
|
|
40
|
-
source: "git";
|
|
41
|
-
url: string;
|
|
42
|
-
ref?: string;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export interface KnownMarketplace {
|
|
46
|
-
name: string;
|
|
47
|
-
source: MarketplaceSource;
|
|
48
|
-
isBuiltin?: boolean;
|
|
49
|
-
autoUpdate?: boolean;
|
|
50
|
-
lastUpdated?: string;
|
|
51
|
-
/** The scope where this marketplace was declared (user, project, local, or builtin) */
|
|
52
|
-
declaredScope?: "user" | "project" | "local" | "builtin";
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface KnownMarketplacesRegistry {
|
|
56
|
-
builtinSeeded?: boolean;
|
|
57
|
-
marketplaces: KnownMarketplace[];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface InstalledPlugin {
|
|
61
|
-
name: string;
|
|
62
|
-
marketplace: string;
|
|
63
|
-
version: string;
|
|
64
|
-
cachePath: string;
|
|
65
|
-
scope?: Scope;
|
|
66
|
-
projectPath?: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface InstalledPluginsRegistry {
|
|
70
|
-
plugins: InstalledPlugin[];
|
|
71
|
-
}
|
package/src/types/mcp.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Model Context Protocol types
|
|
3
|
-
* Dependencies: None
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface McpServerConfig {
|
|
7
|
-
type?: "stdio" | "sse" | "http";
|
|
8
|
-
command?: string;
|
|
9
|
-
args?: string[];
|
|
10
|
-
env?: Record<string, string>;
|
|
11
|
-
url?: string;
|
|
12
|
-
headers?: Record<string, string>;
|
|
13
|
-
/** Internal: plugin directory path when the server is registered by a plugin */
|
|
14
|
-
pluginRoot?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface McpConfig {
|
|
18
|
-
mcpServers: Record<string, McpServerConfig>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface McpTool {
|
|
22
|
-
name: string;
|
|
23
|
-
description?: string;
|
|
24
|
-
inputSchema: Record<string, unknown>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface McpServerStatus {
|
|
28
|
-
name: string;
|
|
29
|
-
config: McpServerConfig;
|
|
30
|
-
/** Pre-resolution URL with template variables preserved for safe display */
|
|
31
|
-
originalUrl?: string;
|
|
32
|
-
status:
|
|
33
|
-
| "disconnected"
|
|
34
|
-
| "connected"
|
|
35
|
-
| "connecting"
|
|
36
|
-
| "reconnecting"
|
|
37
|
-
| "error";
|
|
38
|
-
tools?: McpTool[];
|
|
39
|
-
toolCount?: number;
|
|
40
|
-
capabilities?: string[];
|
|
41
|
-
lastConnected?: number;
|
|
42
|
-
error?: string;
|
|
43
|
-
}
|
package/src/types/memoryRule.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Metadata extracted from the YAML frontmatter of a memory rule file.
|
|
3
|
-
*/
|
|
4
|
-
export interface MemoryRuleMetadata {
|
|
5
|
-
/**
|
|
6
|
-
* Glob patterns that determine when this rule is active.
|
|
7
|
-
* If undefined or empty, the rule is always active.
|
|
8
|
-
*/
|
|
9
|
-
paths?: string[];
|
|
10
|
-
/**
|
|
11
|
-
* Optional priority override.
|
|
12
|
-
* Higher numbers take precedence if there are conflicting instructions.
|
|
13
|
-
*/
|
|
14
|
-
priority?: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Represents a single memory rule discovered from the filesystem.
|
|
19
|
-
*/
|
|
20
|
-
export interface MemoryRule {
|
|
21
|
-
/** Unique identifier, typically the relative path from the rules root */
|
|
22
|
-
id: string;
|
|
23
|
-
/** The raw content of the markdown file (excluding frontmatter) */
|
|
24
|
-
content: string;
|
|
25
|
-
/** Metadata parsed from YAML frontmatter */
|
|
26
|
-
metadata: MemoryRuleMetadata;
|
|
27
|
-
/** Source of the rule (project-level or user-level) */
|
|
28
|
-
source: "project" | "user";
|
|
29
|
-
/** Absolute path to the file on disk */
|
|
30
|
-
filePath: string;
|
|
31
|
-
}
|
package/src/types/messaging.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Message and communication block types
|
|
3
|
-
* Dependencies: Core (Usage)
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { Usage } from "./core.js";
|
|
7
|
-
|
|
8
|
-
export enum MessageSource {
|
|
9
|
-
USER = "user",
|
|
10
|
-
HOOK = "hook",
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface Message {
|
|
14
|
-
id: string; // Unique identifier for the message
|
|
15
|
-
role: "user" | "assistant";
|
|
16
|
-
blocks: MessageBlock[];
|
|
17
|
-
timestamp: string; // ISO 8601 timestamp, assigned at creation
|
|
18
|
-
usage?: Usage; // Usage data for this message's AI operation (assistant messages only)
|
|
19
|
-
additionalFields?: Record<string, unknown>; // Additional metadata from AI responses
|
|
20
|
-
isMeta?: boolean; // Whether the message is a meta message (hidden from UI)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type MessageBlock =
|
|
24
|
-
| TextBlock
|
|
25
|
-
| ErrorBlock
|
|
26
|
-
| ToolBlock
|
|
27
|
-
| ImageBlock
|
|
28
|
-
| BangBlock
|
|
29
|
-
| CompactBlock
|
|
30
|
-
| ReasoningBlock
|
|
31
|
-
| FileHistoryBlock
|
|
32
|
-
| TaskNotificationBlock;
|
|
33
|
-
|
|
34
|
-
export interface TextBlock {
|
|
35
|
-
type: "text";
|
|
36
|
-
content: string;
|
|
37
|
-
customCommandContent?: string;
|
|
38
|
-
source?: MessageSource;
|
|
39
|
-
stage?: "streaming" | "end";
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface ErrorBlock {
|
|
43
|
-
type: "error";
|
|
44
|
-
content: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface ToolBlock {
|
|
48
|
-
type: "tool";
|
|
49
|
-
parameters?: string;
|
|
50
|
-
result?: string;
|
|
51
|
-
shortResult?: string; // Add shortResult field
|
|
52
|
-
startLineNumber?: number; // Optional starting line number
|
|
53
|
-
images?: Array<{
|
|
54
|
-
// Add image data support
|
|
55
|
-
data: string; // Base64 encoded image data
|
|
56
|
-
mediaType?: string; // Media type of the image
|
|
57
|
-
}>;
|
|
58
|
-
id?: string;
|
|
59
|
-
name?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Tool execution stage:
|
|
62
|
-
* - 'start': Tool call initiated (from AI service streaming)
|
|
63
|
-
* - 'streaming': Tool parameters being streamed (from AI service)
|
|
64
|
-
* - 'running': Tool execution in progress (from AI manager)
|
|
65
|
-
* - 'end': Tool execution completed (from AI manager)
|
|
66
|
-
*/
|
|
67
|
-
stage: "start" | "streaming" | "running" | "end";
|
|
68
|
-
success?: boolean;
|
|
69
|
-
error?: string | Error;
|
|
70
|
-
compactParams?: string; // Compact parameter display
|
|
71
|
-
parametersChunk?: string; // Incremental parameter updates for streaming
|
|
72
|
-
isManuallyBackgrounded?: boolean; // Whether the tool was manually backgrounded by the user
|
|
73
|
-
timestamp?: number; // Unix ms, set when tool result is finalized (stage="end")
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface ImageBlock {
|
|
77
|
-
type: "image";
|
|
78
|
-
imageUrls?: string[];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface BangBlock {
|
|
82
|
-
type: "bang";
|
|
83
|
-
command: string;
|
|
84
|
-
output: string;
|
|
85
|
-
stage: "running" | "end";
|
|
86
|
-
exitCode: number | null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface CompactBlock {
|
|
90
|
-
type: "compact";
|
|
91
|
-
content: string;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface ReasoningBlock {
|
|
95
|
-
type: "reasoning";
|
|
96
|
-
content: string;
|
|
97
|
-
stage?: "streaming" | "end";
|
|
98
|
-
startTime?: number; // Unix ms, set when the first reasoning content arrives
|
|
99
|
-
endTime?: number; // Unix ms, set when stage transitions to "end"
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export interface FileHistoryBlock {
|
|
103
|
-
type: "file_history";
|
|
104
|
-
snapshots: import("./reversion.js").FileSnapshot[];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export interface TaskNotificationBlock {
|
|
108
|
-
type: "task_notification";
|
|
109
|
-
taskId: string;
|
|
110
|
-
taskType: "shell" | "agent" | "workflow";
|
|
111
|
-
status: "completed" | "failed" | "killed" | "aborted";
|
|
112
|
-
summary: string;
|
|
113
|
-
outputFile?: string;
|
|
114
|
-
}
|