wave-agent-sdk 0.0.5 → 0.0.7

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.
Files changed (145) hide show
  1. package/dist/agent.d.ts +3 -6
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +24 -21
  4. package/dist/index.d.ts +3 -2
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +3 -3
  7. package/dist/managers/aiManager.d.ts +4 -2
  8. package/dist/managers/aiManager.d.ts.map +1 -1
  9. package/dist/managers/aiManager.js +91 -53
  10. package/dist/managers/backgroundBashManager.d.ts +1 -1
  11. package/dist/managers/backgroundBashManager.d.ts.map +1 -1
  12. package/dist/{hooks/manager.d.ts → managers/hookManager.d.ts} +27 -16
  13. package/dist/managers/hookManager.d.ts.map +1 -0
  14. package/dist/{hooks/manager.js → managers/hookManager.js} +112 -17
  15. package/dist/managers/mcpManager.d.ts +1 -1
  16. package/dist/managers/mcpManager.d.ts.map +1 -1
  17. package/dist/managers/messageManager.d.ts +20 -15
  18. package/dist/managers/messageManager.d.ts.map +1 -1
  19. package/dist/managers/messageManager.js +19 -25
  20. package/dist/managers/skillManager.d.ts +1 -1
  21. package/dist/managers/skillManager.d.ts.map +1 -1
  22. package/dist/managers/slashCommandManager.d.ts +1 -1
  23. package/dist/managers/slashCommandManager.d.ts.map +1 -1
  24. package/dist/managers/slashCommandManager.js +5 -2
  25. package/dist/managers/subagentManager.d.ts +7 -12
  26. package/dist/managers/subagentManager.d.ts.map +1 -1
  27. package/dist/managers/subagentManager.js +40 -46
  28. package/dist/managers/toolManager.d.ts +1 -1
  29. package/dist/managers/toolManager.d.ts.map +1 -1
  30. package/dist/services/aiService.d.ts +1 -1
  31. package/dist/services/aiService.d.ts.map +1 -1
  32. package/dist/services/aiService.js +8 -1
  33. package/dist/services/hook.d.ts +56 -0
  34. package/dist/services/hook.d.ts.map +1 -0
  35. package/dist/services/hook.js +276 -0
  36. package/dist/services/session.d.ts +1 -1
  37. package/dist/services/session.d.ts.map +1 -1
  38. package/dist/services/session.js +5 -4
  39. package/dist/tools/taskTool.d.ts.map +1 -1
  40. package/dist/tools/taskTool.js +7 -3
  41. package/dist/tools/todoWriteTool.d.ts.map +1 -1
  42. package/dist/tools/todoWriteTool.js +3 -10
  43. package/dist/types/commands.d.ts +24 -0
  44. package/dist/types/commands.d.ts.map +1 -0
  45. package/dist/types/commands.js +5 -0
  46. package/dist/types/config.d.ts +13 -0
  47. package/dist/types/config.d.ts.map +1 -0
  48. package/dist/types/config.js +5 -0
  49. package/dist/types/core.d.ts +38 -0
  50. package/dist/types/core.d.ts.map +1 -0
  51. package/dist/{types.js → types/core.js} +4 -13
  52. package/dist/{hooks/types.d.ts → types/hooks.d.ts} +2 -1
  53. package/dist/types/hooks.d.ts.map +1 -0
  54. package/dist/types/index.d.ts +20 -0
  55. package/dist/types/index.d.ts.map +1 -0
  56. package/dist/types/index.js +21 -0
  57. package/dist/types/mcp.d.ts +28 -0
  58. package/dist/types/mcp.d.ts.map +1 -0
  59. package/dist/types/mcp.js +5 -0
  60. package/dist/types/messaging.d.ts +80 -0
  61. package/dist/types/messaging.d.ts.map +1 -0
  62. package/dist/types/messaging.js +9 -0
  63. package/dist/types/processes.d.ts +17 -0
  64. package/dist/types/processes.d.ts.map +1 -0
  65. package/dist/types/processes.js +5 -0
  66. package/dist/types/skills.d.ts +78 -0
  67. package/dist/types/skills.d.ts.map +1 -0
  68. package/dist/types/skills.js +17 -0
  69. package/dist/utils/configResolver.d.ts +1 -1
  70. package/dist/utils/configResolver.d.ts.map +1 -1
  71. package/dist/utils/configResolver.js +1 -1
  72. package/dist/utils/configValidator.d.ts +1 -1
  73. package/dist/utils/configValidator.d.ts.map +1 -1
  74. package/dist/utils/configValidator.js +1 -1
  75. package/dist/utils/convertMessagesForAPI.d.ts +1 -1
  76. package/dist/utils/convertMessagesForAPI.d.ts.map +1 -1
  77. package/dist/utils/convertMessagesForAPI.js +1 -8
  78. package/dist/utils/customCommands.d.ts +1 -1
  79. package/dist/utils/customCommands.d.ts.map +1 -1
  80. package/dist/{hooks/matcher.d.ts → utils/hookMatcher.d.ts} +2 -7
  81. package/dist/utils/hookMatcher.d.ts.map +1 -0
  82. package/dist/utils/markdownParser.d.ts +1 -1
  83. package/dist/utils/markdownParser.d.ts.map +1 -1
  84. package/dist/utils/mcpUtils.d.ts +1 -1
  85. package/dist/utils/mcpUtils.d.ts.map +1 -1
  86. package/dist/utils/messageOperations.d.ts +14 -21
  87. package/dist/utils/messageOperations.d.ts.map +1 -1
  88. package/dist/utils/messageOperations.js +37 -20
  89. package/dist/utils/skillParser.d.ts +1 -1
  90. package/dist/utils/skillParser.d.ts.map +1 -1
  91. package/package.json +1 -1
  92. package/src/agent.ts +49 -43
  93. package/src/index.ts +3 -4
  94. package/src/managers/aiManager.ts +241 -160
  95. package/src/managers/backgroundBashManager.ts +1 -1
  96. package/src/{hooks/manager.ts → managers/hookManager.ts} +168 -56
  97. package/src/managers/mcpManager.ts +1 -1
  98. package/src/managers/messageManager.ts +44 -44
  99. package/src/managers/skillManager.ts +1 -1
  100. package/src/managers/slashCommandManager.ts +10 -7
  101. package/src/managers/subagentManager.ts +47 -54
  102. package/src/managers/toolManager.ts +1 -1
  103. package/src/services/aiService.ts +9 -2
  104. package/src/services/hook.ts +360 -0
  105. package/src/services/session.ts +6 -7
  106. package/src/tools/taskTool.ts +13 -5
  107. package/src/tools/todoWriteTool.ts +3 -11
  108. package/src/types/commands.ts +26 -0
  109. package/src/types/config.ts +14 -0
  110. package/src/types/core.ts +49 -0
  111. package/src/{hooks/types.ts → types/hooks.ts} +1 -0
  112. package/src/types/index.ts +23 -0
  113. package/src/types/mcp.ts +31 -0
  114. package/src/types/messaging.ts +102 -0
  115. package/src/types/processes.ts +18 -0
  116. package/src/types/skills.ts +91 -0
  117. package/src/utils/configResolver.ts +1 -1
  118. package/src/utils/configValidator.ts +5 -1
  119. package/src/utils/convertMessagesForAPI.ts +2 -10
  120. package/src/utils/customCommands.ts +1 -1
  121. package/src/{hooks/matcher.ts → utils/hookMatcher.ts} +1 -12
  122. package/src/utils/markdownParser.ts +1 -1
  123. package/src/utils/mcpUtils.ts +1 -1
  124. package/src/utils/messageOperations.ts +56 -42
  125. package/src/utils/skillParser.ts +1 -1
  126. package/dist/hooks/executor.d.ts +0 -56
  127. package/dist/hooks/executor.d.ts.map +0 -1
  128. package/dist/hooks/executor.js +0 -312
  129. package/dist/hooks/index.d.ts +0 -17
  130. package/dist/hooks/index.d.ts.map +0 -1
  131. package/dist/hooks/index.js +0 -14
  132. package/dist/hooks/manager.d.ts.map +0 -1
  133. package/dist/hooks/matcher.d.ts.map +0 -1
  134. package/dist/hooks/settings.d.ts +0 -46
  135. package/dist/hooks/settings.d.ts.map +0 -1
  136. package/dist/hooks/settings.js +0 -100
  137. package/dist/hooks/types.d.ts.map +0 -1
  138. package/dist/types.d.ts +0 -288
  139. package/dist/types.d.ts.map +0 -1
  140. package/src/hooks/executor.ts +0 -440
  141. package/src/hooks/index.ts +0 -52
  142. package/src/hooks/settings.ts +0 -129
  143. package/src/types.ts +0 -357
  144. /package/dist/{hooks/types.js → types/hooks.js} +0 -0
  145. /package/dist/{hooks/matcher.js → utils/hookMatcher.js} +0 -0
@@ -0,0 +1,102 @@
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
+ role: "user" | "assistant";
15
+ blocks: MessageBlock[];
16
+ usage?: Usage; // Usage data for this message's AI operation (assistant messages only)
17
+ }
18
+
19
+ export type MessageBlock =
20
+ | TextBlock
21
+ | ErrorBlock
22
+ | ToolBlock
23
+ | ImageBlock
24
+ | DiffBlock
25
+ | CommandOutputBlock
26
+ | CompressBlock
27
+ | MemoryBlock
28
+ | SubagentBlock;
29
+
30
+ export interface TextBlock {
31
+ type: "text";
32
+ content: string;
33
+ customCommandContent?: string;
34
+ source?: MessageSource;
35
+ }
36
+
37
+ export interface ErrorBlock {
38
+ type: "error";
39
+ content: string;
40
+ }
41
+
42
+ export interface ToolBlock {
43
+ type: "tool";
44
+ parameters?: string;
45
+ result?: string;
46
+ shortResult?: string; // Add shortResult field
47
+ images?: Array<{
48
+ // Add image data support
49
+ data: string; // Base64 encoded image data
50
+ mediaType?: string; // Media type of the image
51
+ }>;
52
+ id?: string;
53
+ name?: string;
54
+ isRunning?: boolean; // Mark if tool is actually executing
55
+ success?: boolean;
56
+ error?: string | Error;
57
+ compactParams?: string; // Compact parameter display
58
+ }
59
+
60
+ export interface ImageBlock {
61
+ type: "image";
62
+ imageUrls?: string[];
63
+ }
64
+
65
+ export interface DiffBlock {
66
+ type: "diff";
67
+ path: string;
68
+ diffResult: Array<{
69
+ value: string;
70
+ added?: boolean;
71
+ removed?: boolean;
72
+ }>;
73
+ }
74
+
75
+ export interface CommandOutputBlock {
76
+ type: "command_output";
77
+ command: string;
78
+ output: string;
79
+ isRunning: boolean;
80
+ exitCode: number | null;
81
+ }
82
+
83
+ export interface CompressBlock {
84
+ type: "compress";
85
+ content: string;
86
+ }
87
+
88
+ export interface MemoryBlock {
89
+ type: "memory";
90
+ content: string;
91
+ isSuccess: boolean;
92
+ memoryType?: "project" | "user"; // Memory type
93
+ storagePath?: string; // Storage path text
94
+ }
95
+
96
+ export interface SubagentBlock {
97
+ type: "subagent";
98
+ subagentId: string;
99
+ subagentName: string;
100
+ status: "active" | "completed" | "error" | "aborted";
101
+ messages: Message[];
102
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Background process and shell management types
3
+ * Dependencies: None
4
+ */
5
+
6
+ import type { ChildProcess } from "child_process";
7
+
8
+ export interface BackgroundShell {
9
+ id: string;
10
+ process: ChildProcess;
11
+ command: string;
12
+ startTime: number;
13
+ status: "running" | "completed" | "killed";
14
+ stdout: string;
15
+ stderr: string;
16
+ exitCode?: number;
17
+ runtime?: number;
18
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Skill system types and constants
3
+ * Dependencies: Core (Logger)
4
+ */
5
+
6
+ import type { Logger } from "./core.js";
7
+
8
+ export interface SkillMetadata {
9
+ name: string;
10
+ description: string;
11
+ type: "personal" | "project";
12
+ skillPath: string;
13
+ }
14
+
15
+ export interface Skill extends SkillMetadata {
16
+ content: string;
17
+ frontmatter: SkillFrontmatter;
18
+ isValid: boolean;
19
+ errors: string[];
20
+ }
21
+
22
+ export interface SkillFrontmatter {
23
+ name: string;
24
+ description: string;
25
+ [key: string]: unknown;
26
+ }
27
+
28
+ export interface SkillCollection {
29
+ type: "personal" | "project";
30
+ basePath: string;
31
+ skills: Map<string, SkillMetadata>;
32
+ errors: SkillError[];
33
+ }
34
+
35
+ export interface SkillError {
36
+ skillPath: string;
37
+ message: string;
38
+ }
39
+
40
+ export interface SkillValidationResult {
41
+ isValid: boolean;
42
+ skill?: Skill;
43
+ errors: string[];
44
+ }
45
+
46
+ export interface SkillDiscoveryResult {
47
+ personalSkills: Map<string, SkillMetadata>;
48
+ projectSkills: Map<string, SkillMetadata>;
49
+ errors: SkillError[];
50
+ }
51
+
52
+ export interface SkillInvocationContext {
53
+ skillName: string;
54
+ }
55
+
56
+ export interface SkillToolArgs {
57
+ skill_name: string;
58
+ }
59
+
60
+ export interface SkillManagerOptions {
61
+ personalSkillsPath?: string;
62
+ scanTimeout?: number;
63
+ logger?: Logger;
64
+ }
65
+
66
+ export interface ParsedSkillFile {
67
+ frontmatter: SkillFrontmatter;
68
+ content: string;
69
+ skillMetadata: SkillMetadata;
70
+ validationErrors: string[];
71
+ isValid: boolean;
72
+ }
73
+
74
+ export interface SkillParseOptions {
75
+ validateMetadata?: boolean;
76
+ basePath?: string;
77
+ }
78
+
79
+ export const SKILL_DEFAULTS = {
80
+ PERSONAL_SKILLS_DIR: ".wave/skills",
81
+ PROJECT_SKILLS_DIR: ".wave/skills",
82
+ SKILL_FILE_NAME: "SKILL.md",
83
+ MAX_NAME_LENGTH: 64,
84
+ MAX_DESCRIPTION_LENGTH: 1024,
85
+ MIN_DESCRIPTION_LENGTH: 1,
86
+ NAME_PATTERN: /^[a-z0-9-]+$/,
87
+ MAX_METADATA_CACHE: 1000,
88
+ MAX_CONTENT_CACHE: 100,
89
+ SCAN_TIMEOUT: 5000,
90
+ LOAD_TIMEOUT: 2000,
91
+ } as const;
@@ -8,7 +8,7 @@ import {
8
8
  ModelConfig,
9
9
  ConfigurationError,
10
10
  CONFIG_ERRORS,
11
- } from "../types.js";
11
+ } from "../types/index.js";
12
12
 
13
13
  export class ConfigResolver {
14
14
  /**
@@ -3,7 +3,11 @@
3
3
  * Validates configuration values for correctness and security
4
4
  */
5
5
 
6
- import { GatewayConfig, ConfigurationError, CONFIG_ERRORS } from "../types.js";
6
+ import {
7
+ GatewayConfig,
8
+ ConfigurationError,
9
+ CONFIG_ERRORS,
10
+ } from "../types/index.js";
7
11
 
8
12
  export class ConfigValidator {
9
13
  /**
@@ -1,4 +1,4 @@
1
- import type { Message } from "../types.js";
1
+ import type { Message } from "../types/index.js";
2
2
  import { convertImageToBase64 } from "./messageOperations.js";
3
3
  import { ChatCompletionMessageToolCall } from "openai/resources";
4
4
  import { stripAnsiColors } from "./stringUtils.js";
@@ -176,15 +176,7 @@ export function convertMessagesForAPI(
176
176
  if (block.type === "text" && block.content) {
177
177
  contentParts.push({
178
178
  type: "text",
179
- text: block.content,
180
- });
181
- }
182
-
183
- // Handle custom command blocks - pass full content as text to AI
184
- if (block.type === "custom_command" && block.content) {
185
- contentParts.push({
186
- type: "text",
187
- text: block.content,
179
+ text: block.customCommandContent || block.content,
188
180
  });
189
181
  }
190
182
 
@@ -1,7 +1,7 @@
1
1
  import { existsSync, readdirSync } from "fs";
2
2
  import { join, extname, basename } from "path";
3
3
  import { homedir } from "os";
4
- import type { CustomSlashCommand } from "../types.js";
4
+ import type { CustomSlashCommand } from "../types/index.js";
5
5
  import { parseMarkdownFile } from "./markdownParser.js";
6
6
 
7
7
  /**
@@ -7,18 +7,7 @@
7
7
 
8
8
  import { minimatch } from "minimatch";
9
9
 
10
- export interface IHookMatcher {
11
- // Test if pattern matches tool name
12
- matches(pattern: string, toolName: string): boolean;
13
-
14
- // Validate pattern syntax
15
- isValidPattern(pattern: string): boolean;
16
-
17
- // Get pattern type for optimization
18
- getPatternType(pattern: string): "exact" | "glob" | "regex" | "alternatives";
19
- }
20
-
21
- export class HookMatcher implements IHookMatcher {
10
+ export class HookMatcher {
22
11
  /**
23
12
  * Test if pattern matches tool name
24
13
  * Supports multiple matching strategies:
@@ -1,5 +1,5 @@
1
1
  import { readFileSync } from "fs";
2
- import type { CustomSlashCommandConfig } from "../types.js";
2
+ import type { CustomSlashCommandConfig } from "../types/index.js";
3
3
 
4
4
  interface ParsedMarkdownFile {
5
5
  content: string;
@@ -1,6 +1,6 @@
1
1
  import { ChatCompletionFunctionTool } from "openai/resources.js";
2
2
  import type { ToolPlugin, ToolResult, ToolContext } from "../tools/types.js";
3
- import type { McpTool, McpServerStatus } from "../types.js";
3
+ import type { McpTool, McpServerStatus } from "../types/index.js";
4
4
 
5
5
  /**
6
6
  * Convert MCP tool to OpenAI function tool format
@@ -1,19 +1,19 @@
1
- import type { Message, Usage } from "../types.js";
1
+ import type { Message, Usage, MessageSource } from "../types/index.js";
2
2
  import { readFileSync } from "fs";
3
3
  import { extname } from "path";
4
4
  import { ChatCompletionMessageFunctionToolCall } from "openai/resources.js";
5
5
 
6
- // Parameter interfaces for message operations
7
- export interface AddUserMessageParams {
8
- messages: Message[];
6
+ // Base user message parameters interface
7
+ export interface UserMessageParams {
9
8
  content: string;
10
9
  images?: Array<{ path: string; mimeType: string }>;
11
- customCommandBlock?: {
12
- type: "custom_command";
13
- commandName: string;
14
- content: string;
15
- originalInput?: string;
16
- };
10
+ customCommandContent?: string;
11
+ source?: MessageSource;
12
+ }
13
+
14
+ // Parameter interfaces for message operations
15
+ export interface AddUserMessageParams extends UserMessageParams {
16
+ messages: Message[];
17
17
  }
18
18
 
19
19
  export interface UpdateToolBlockParams {
@@ -31,17 +31,10 @@ export interface UpdateToolBlockParams {
31
31
  }
32
32
 
33
33
  // Agent specific interfaces (without messages parameter)
34
- export interface AgentToolBlockUpdateParams {
35
- toolId: string;
36
- args?: string;
37
- result?: string;
38
- success?: boolean;
39
- error?: string;
40
- isRunning?: boolean;
41
- name?: string;
42
- shortResult?: string;
43
- compactParams?: string;
44
- }
34
+ export type AgentToolBlockUpdateParams = Omit<
35
+ UpdateToolBlockParams,
36
+ "messages"
37
+ >;
45
38
 
46
39
  export interface AddDiffBlockParams {
47
40
  messages: Message[];
@@ -145,16 +138,19 @@ export const addUserMessageToMessages = ({
145
138
  messages,
146
139
  content,
147
140
  images,
148
- customCommandBlock,
141
+ customCommandContent,
142
+ source,
149
143
  }: AddUserMessageParams): Message[] => {
150
144
  const blocks: Message["blocks"] = [];
151
145
 
152
- // If there's a custom command block, use it instead of text content
153
- if (customCommandBlock) {
154
- blocks.push(customCommandBlock);
155
- } else {
156
- blocks.push({ type: "text", content });
157
- }
146
+ // Create text block with optional customCommandContent and source
147
+ const textBlock = {
148
+ type: "text" as const,
149
+ content,
150
+ ...(customCommandContent && { customCommandContent }),
151
+ ...(source && { source }),
152
+ };
153
+ blocks.push(textBlock);
158
154
 
159
155
  // If there are images, add image block
160
156
  if (images && images.length > 0) {
@@ -294,24 +290,23 @@ export const addErrorBlockToMessage = ({
294
290
  error,
295
291
  }: AddErrorBlockParams): Message[] => {
296
292
  const newMessages = [...messages];
297
- // Find the last assistant message
298
- let assistantMessageFound = false;
299
- for (let i = newMessages.length - 1; i >= 0; i--) {
300
- if (newMessages[i].role === "assistant") {
301
- newMessages[i].blocks = [
302
- ...newMessages[i].blocks,
293
+
294
+ // Check if the last message is an assistant message
295
+ const lastMessage = newMessages[newMessages.length - 1];
296
+ if (lastMessage && lastMessage.role === "assistant") {
297
+ // Create a new message object with the error block added
298
+ newMessages[newMessages.length - 1] = {
299
+ ...lastMessage,
300
+ blocks: [
301
+ ...lastMessage.blocks,
303
302
  {
304
303
  type: "error",
305
304
  content: error,
306
305
  },
307
- ];
308
- assistantMessageFound = true;
309
- break;
310
- }
311
- }
312
-
313
- // If no assistant message found, create a new assistant message with only error block
314
- if (!assistantMessageFound) {
306
+ ],
307
+ };
308
+ } else {
309
+ // If the last message is not an assistant message, create a new assistant message
315
310
  newMessages.push({
316
311
  role: "assistant",
317
312
  blocks: [
@@ -586,3 +581,22 @@ export const updateSubagentBlockInMessage = (
586
581
 
587
582
  return newMessages;
588
583
  };
584
+
585
+ /**
586
+ * Removes the last user message from the messages array
587
+ * Used for hook error handling when the user prompt needs to be erased
588
+ */
589
+ export const removeLastUserMessage = (messages: Message[]): Message[] => {
590
+ const newMessages = [...messages];
591
+
592
+ // Find the index of the last user message
593
+ for (let i = newMessages.length - 1; i >= 0; i--) {
594
+ if (newMessages[i].role === "user") {
595
+ // Remove the user message at index i
596
+ newMessages.splice(i, 1);
597
+ break;
598
+ }
599
+ }
600
+
601
+ return newMessages;
602
+ };
@@ -5,7 +5,7 @@ import type {
5
5
  SkillParseOptions,
6
6
  SkillFrontmatter,
7
7
  SkillMetadata,
8
- } from "../types.js";
8
+ } from "../types/index.js";
9
9
 
10
10
  /**
11
11
  * Parse a SKILL.md file and validate its contents
@@ -1,56 +0,0 @@
1
- /**
2
- * Hook Command Executor
3
- *
4
- * Handles the execution of hook commands in isolated processes with proper
5
- * timeout handling, environment variable injection, and cross-platform support.
6
- */
7
- import { type HookExecutionContext, type HookExecutionResult, type HookExecutionOptions, type ExtendedHookExecutionContext } from "./types.js";
8
- import type { Logger } from "../types.js";
9
- export interface IHookExecutor {
10
- executeCommand(command: string, context: HookExecutionContext | ExtendedHookExecutionContext, options?: HookExecutionOptions): Promise<HookExecutionResult>;
11
- executeCommands(commands: string[], context: HookExecutionContext | ExtendedHookExecutionContext, options?: HookExecutionOptions): Promise<HookExecutionResult[]>;
12
- isCommandSafe(command: string): boolean;
13
- }
14
- export declare class HookExecutor implements IHookExecutor {
15
- private readonly defaultTimeout;
16
- private readonly maxTimeout;
17
- private readonly logger?;
18
- private readonly skipExecution;
19
- constructor(logger?: Logger, options?: {
20
- skipExecution?: boolean;
21
- });
22
- /**
23
- * Execute a single hook command in an isolated process
24
- */
25
- executeCommand(command: string, context: HookExecutionContext | ExtendedHookExecutionContext, options?: HookExecutionOptions): Promise<HookExecutionResult>;
26
- /**
27
- * Execute multiple commands in sequence
28
- * Stops on first failure unless configured otherwise
29
- */
30
- executeCommands(commands: string[], context: HookExecutionContext | ExtendedHookExecutionContext, options?: HookExecutionOptions): Promise<HookExecutionResult[]>;
31
- /**
32
- * Validate command safety to prevent injection attacks
33
- */
34
- isCommandSafe(command: string): boolean;
35
- /**
36
- * Build environment variables for hook execution
37
- */
38
- private buildEnvironment;
39
- /**
40
- * Resolve environment variables in command string
41
- */
42
- private resolveEnvironmentVariables;
43
- /**
44
- * Get process statistics for monitoring
45
- */
46
- getExecutionStats(): {
47
- platform: NodeJS.Platform;
48
- defaultTimeout: number;
49
- maxTimeout: number;
50
- };
51
- /**
52
- * Test if the executor can run commands on this platform
53
- */
54
- isSupported(): boolean;
55
- }
56
- //# sourceMappingURL=executor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/hooks/executor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAGlC,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAyC1C,MAAM,WAAW,aAAa;IAE5B,cAAc,CACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAGhC,eAAe,CACb,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAGlC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CACzC;AAED,qBAAa,YAAa,YAAW,aAAa;IAChD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAU;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;gBAE5B,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE;IASlE;;OAEG;IACG,cAAc,CAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,mBAAmB,CAAC;IAmM/B;;;OAGG;IACG,eAAe,CACnB,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAmDjC;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAwBvC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAqBnC;;OAEG;IACH,iBAAiB,IAAI;QACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;QAC1B,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;KACpB;IAQD;;OAEG;IACH,WAAW,IAAI,OAAO;CAQvB"}