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.
- package/dist/agent.d.ts +3 -6
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +24 -21
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/managers/aiManager.d.ts +4 -2
- package/dist/managers/aiManager.d.ts.map +1 -1
- package/dist/managers/aiManager.js +91 -53
- package/dist/managers/backgroundBashManager.d.ts +1 -1
- package/dist/managers/backgroundBashManager.d.ts.map +1 -1
- package/dist/{hooks/manager.d.ts → managers/hookManager.d.ts} +27 -16
- package/dist/managers/hookManager.d.ts.map +1 -0
- package/dist/{hooks/manager.js → managers/hookManager.js} +112 -17
- package/dist/managers/mcpManager.d.ts +1 -1
- package/dist/managers/mcpManager.d.ts.map +1 -1
- package/dist/managers/messageManager.d.ts +20 -15
- package/dist/managers/messageManager.d.ts.map +1 -1
- package/dist/managers/messageManager.js +19 -25
- package/dist/managers/skillManager.d.ts +1 -1
- package/dist/managers/skillManager.d.ts.map +1 -1
- package/dist/managers/slashCommandManager.d.ts +1 -1
- package/dist/managers/slashCommandManager.d.ts.map +1 -1
- package/dist/managers/slashCommandManager.js +5 -2
- package/dist/managers/subagentManager.d.ts +7 -12
- package/dist/managers/subagentManager.d.ts.map +1 -1
- package/dist/managers/subagentManager.js +40 -46
- package/dist/managers/toolManager.d.ts +1 -1
- package/dist/managers/toolManager.d.ts.map +1 -1
- package/dist/services/aiService.d.ts +1 -1
- package/dist/services/aiService.d.ts.map +1 -1
- package/dist/services/aiService.js +8 -1
- package/dist/services/hook.d.ts +56 -0
- package/dist/services/hook.d.ts.map +1 -0
- package/dist/services/hook.js +276 -0
- package/dist/services/session.d.ts +1 -1
- package/dist/services/session.d.ts.map +1 -1
- package/dist/services/session.js +5 -4
- package/dist/tools/taskTool.d.ts.map +1 -1
- package/dist/tools/taskTool.js +7 -3
- package/dist/tools/todoWriteTool.d.ts.map +1 -1
- package/dist/tools/todoWriteTool.js +3 -10
- package/dist/types/commands.d.ts +24 -0
- package/dist/types/commands.d.ts.map +1 -0
- package/dist/types/commands.js +5 -0
- package/dist/types/config.d.ts +13 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +5 -0
- package/dist/types/core.d.ts +38 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/{types.js → types/core.js} +4 -13
- package/dist/{hooks/types.d.ts → types/hooks.d.ts} +2 -1
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/index.d.ts +20 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +21 -0
- package/dist/types/mcp.d.ts +28 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +5 -0
- package/dist/types/messaging.d.ts +80 -0
- package/dist/types/messaging.d.ts.map +1 -0
- package/dist/types/messaging.js +9 -0
- package/dist/types/processes.d.ts +17 -0
- package/dist/types/processes.d.ts.map +1 -0
- package/dist/types/processes.js +5 -0
- package/dist/types/skills.d.ts +78 -0
- package/dist/types/skills.d.ts.map +1 -0
- package/dist/types/skills.js +17 -0
- package/dist/utils/configResolver.d.ts +1 -1
- package/dist/utils/configResolver.d.ts.map +1 -1
- package/dist/utils/configResolver.js +1 -1
- package/dist/utils/configValidator.d.ts +1 -1
- package/dist/utils/configValidator.d.ts.map +1 -1
- package/dist/utils/configValidator.js +1 -1
- package/dist/utils/convertMessagesForAPI.d.ts +1 -1
- package/dist/utils/convertMessagesForAPI.d.ts.map +1 -1
- package/dist/utils/convertMessagesForAPI.js +1 -8
- package/dist/utils/customCommands.d.ts +1 -1
- package/dist/utils/customCommands.d.ts.map +1 -1
- package/dist/{hooks/matcher.d.ts → utils/hookMatcher.d.ts} +2 -7
- package/dist/utils/hookMatcher.d.ts.map +1 -0
- package/dist/utils/markdownParser.d.ts +1 -1
- package/dist/utils/markdownParser.d.ts.map +1 -1
- package/dist/utils/mcpUtils.d.ts +1 -1
- package/dist/utils/mcpUtils.d.ts.map +1 -1
- package/dist/utils/messageOperations.d.ts +14 -21
- package/dist/utils/messageOperations.d.ts.map +1 -1
- package/dist/utils/messageOperations.js +37 -20
- package/dist/utils/skillParser.d.ts +1 -1
- package/dist/utils/skillParser.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/agent.ts +49 -43
- package/src/index.ts +3 -4
- package/src/managers/aiManager.ts +241 -160
- package/src/managers/backgroundBashManager.ts +1 -1
- package/src/{hooks/manager.ts → managers/hookManager.ts} +168 -56
- package/src/managers/mcpManager.ts +1 -1
- package/src/managers/messageManager.ts +44 -44
- package/src/managers/skillManager.ts +1 -1
- package/src/managers/slashCommandManager.ts +10 -7
- package/src/managers/subagentManager.ts +47 -54
- package/src/managers/toolManager.ts +1 -1
- package/src/services/aiService.ts +9 -2
- package/src/services/hook.ts +360 -0
- package/src/services/session.ts +6 -7
- package/src/tools/taskTool.ts +13 -5
- package/src/tools/todoWriteTool.ts +3 -11
- package/src/types/commands.ts +26 -0
- package/src/types/config.ts +14 -0
- package/src/types/core.ts +49 -0
- package/src/{hooks/types.ts → types/hooks.ts} +1 -0
- package/src/types/index.ts +23 -0
- package/src/types/mcp.ts +31 -0
- package/src/types/messaging.ts +102 -0
- package/src/types/processes.ts +18 -0
- package/src/types/skills.ts +91 -0
- package/src/utils/configResolver.ts +1 -1
- package/src/utils/configValidator.ts +5 -1
- package/src/utils/convertMessagesForAPI.ts +2 -10
- package/src/utils/customCommands.ts +1 -1
- package/src/{hooks/matcher.ts → utils/hookMatcher.ts} +1 -12
- package/src/utils/markdownParser.ts +1 -1
- package/src/utils/mcpUtils.ts +1 -1
- package/src/utils/messageOperations.ts +56 -42
- package/src/utils/skillParser.ts +1 -1
- package/dist/hooks/executor.d.ts +0 -56
- package/dist/hooks/executor.d.ts.map +0 -1
- package/dist/hooks/executor.js +0 -312
- package/dist/hooks/index.d.ts +0 -17
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -14
- package/dist/hooks/manager.d.ts.map +0 -1
- package/dist/hooks/matcher.d.ts.map +0 -1
- package/dist/hooks/settings.d.ts +0 -46
- package/dist/hooks/settings.d.ts.map +0 -1
- package/dist/hooks/settings.js +0 -100
- package/dist/hooks/types.d.ts.map +0 -1
- package/dist/types.d.ts +0 -288
- package/dist/types.d.ts.map +0 -1
- package/src/hooks/executor.ts +0 -440
- package/src/hooks/index.ts +0 -52
- package/src/hooks/settings.ts +0 -129
- package/src/types.ts +0 -357
- /package/dist/{hooks/types.js → types/hooks.js} +0 -0
- /package/dist/{hooks/matcher.js → utils/hookMatcher.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ToolContext, ToolPlugin, ToolResult } from "../tools/types.js";
|
|
2
2
|
import { McpManager } from "./mcpManager.js";
|
|
3
3
|
import { ChatCompletionFunctionTool } from "openai/resources.js";
|
|
4
|
-
import type { Logger } from "../types.js";
|
|
4
|
+
import type { Logger } from "../types/index.js";
|
|
5
5
|
import type { SubagentManager } from "./subagentManager.js";
|
|
6
6
|
import type { SkillManager } from "./skillManager.js";
|
|
7
7
|
export interface ToolManagerOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolManager.d.ts","sourceRoot":"","sources":["../../src/managers/toolManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAc7E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"toolManager.d.ts","sourceRoot":"","sources":["../../src/managers/toolManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAc7E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,cAAM,WAAW;IACf,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,MAAM,CAAC,CAAS;gBAEZ,OAAO,EAAE,kBAAkB;IAKvC;;OAEG;IACI,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAIvC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,sBAAsB,CAAC,IAAI,CAAC,EAAE;QACnC,eAAe,CAAC,EAAE,eAAe,CAAC;QAClC,YAAY,CAAC,EAAE,YAAY,CAAC;KAC7B,GAAG,IAAI;IAgCF,OAAO,CACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC;IA2BtB,IAAI,IAAI,UAAU,EAAE;IAMpB,cAAc,IAAI,0BAA0B,EAAE;CAO/C;AAGD,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChatCompletionMessageToolCall } from "openai/resources";
|
|
2
2
|
import { ChatCompletionMessageParam, ChatCompletionFunctionTool } from "openai/resources.js";
|
|
3
|
-
import type { GatewayConfig, ModelConfig } from "../types.js";
|
|
3
|
+
import type { GatewayConfig, ModelConfig } from "../types/index.js";
|
|
4
4
|
export interface CallAgentOptions {
|
|
5
5
|
gatewayConfig: GatewayConfig;
|
|
6
6
|
modelConfig: ModelConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aiService.d.ts","sourceRoot":"","sources":["../../src/services/aiService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAEL,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"aiService.d.ts","sourceRoot":"","sources":["../../src/services/aiService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAEL,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA4DpE,MAAM,WAAW,gBAAgB;IAE/B,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,WAAW,CAAC;IAGzB,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,0BAA0B,EAAE,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,6BAA6B,EAAE,CAAC;IAC7C,KAAK,CAAC,EAAE;QACN,aAAa,EAAE,MAAM,CAAC;QACtB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,wBAAsB,SAAS,CAC7B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,CAoH1B;AAED,MAAM,WAAW,uBAAuB;IAEtC,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,WAAW,CAAC;IAGzB,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IACvC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE;QACN,aAAa,EAAE,MAAM,CAAC;QACtB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAuGjC"}
|
|
@@ -53,7 +53,14 @@ export async function callAgent(options) {
|
|
|
53
53
|
});
|
|
54
54
|
// Build system prompt content
|
|
55
55
|
let systemContent = systemPrompt ||
|
|
56
|
-
`You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user
|
|
56
|
+
`You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
|
|
57
|
+
|
|
58
|
+
# Tool usage policy
|
|
59
|
+
- When doing file search, prefer to use the Task tool in order to reduce context usage.
|
|
60
|
+
- You should proactively use the Task tool with specialized agents when the task at hand matches the agent's description.
|
|
61
|
+
- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run "git status" and "git diff", send a single message with two tool calls to run the calls in parallel.
|
|
62
|
+
|
|
63
|
+
`;
|
|
57
64
|
// Always add environment information
|
|
58
65
|
systemContent += `
|
|
59
66
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook Services
|
|
3
|
+
*
|
|
4
|
+
* Consolidated hook services providing both execution and configuration functionality.
|
|
5
|
+
* Combines hook command execution and settings management into a single module.
|
|
6
|
+
*/
|
|
7
|
+
import { type HookExecutionContext, type HookExecutionResult, type HookExecutionOptions, type ExtendedHookExecutionContext, type PartialHookConfiguration } from "../types/hooks.js";
|
|
8
|
+
/**
|
|
9
|
+
* Execute a single hook command
|
|
10
|
+
*/
|
|
11
|
+
export declare function executeCommand(command: string, context: HookExecutionContext | ExtendedHookExecutionContext, options?: HookExecutionOptions): Promise<HookExecutionResult>;
|
|
12
|
+
/**
|
|
13
|
+
* Execute multiple commands in sequence
|
|
14
|
+
*/
|
|
15
|
+
export declare function executeCommands(commands: string[], context: HookExecutionContext | ExtendedHookExecutionContext, options?: HookExecutionOptions): Promise<HookExecutionResult[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Validate command safety (basic checks)
|
|
18
|
+
*/
|
|
19
|
+
export declare function isCommandSafe(command: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Get the user-specific hooks configuration file path
|
|
22
|
+
*/
|
|
23
|
+
export declare function getUserHooksConfigPath(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Get the project-specific hooks configuration file path
|
|
26
|
+
*/
|
|
27
|
+
export declare function getProjectHooksConfigPath(workdir: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Load hooks configuration from a JSON file
|
|
30
|
+
*/
|
|
31
|
+
export declare function loadHooksConfigFromFile(filePath: string): PartialHookConfiguration | null;
|
|
32
|
+
/**
|
|
33
|
+
* Load user-specific hooks configuration
|
|
34
|
+
*/
|
|
35
|
+
export declare function loadUserHooksConfig(): PartialHookConfiguration | null;
|
|
36
|
+
/**
|
|
37
|
+
* Load project-specific hooks configuration
|
|
38
|
+
*/
|
|
39
|
+
export declare function loadProjectHooksConfig(workdir: string): PartialHookConfiguration | null;
|
|
40
|
+
/**
|
|
41
|
+
* Load and merge hooks configuration from both user and project sources
|
|
42
|
+
*/
|
|
43
|
+
export declare function loadMergedHooksConfig(workdir: string): PartialHookConfiguration | null;
|
|
44
|
+
/**
|
|
45
|
+
* Check if hooks configuration exists (user or project)
|
|
46
|
+
*/
|
|
47
|
+
export declare function hasHooksConfiguration(workdir: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get hooks configuration information for debugging
|
|
50
|
+
*/
|
|
51
|
+
export declare function getHooksConfigurationInfo(workdir: string): {
|
|
52
|
+
hasUser: boolean;
|
|
53
|
+
hasProject: boolean;
|
|
54
|
+
paths: string[];
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/services/hook.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAGjC,KAAK,wBAAwB,EAG9B,MAAM,mBAAmB,CAAC;AA6C3B;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CAiH9B;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,EAAE,oBAAoB,GAAG,4BAA4B,EAC5D,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAchC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAsBtD;AAMD;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,GACf,wBAAwB,GAAG,IAAI,CAcjC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,wBAAwB,GAAG,IAAI,CAErE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,GACd,wBAAwB,GAAG,IAAI,CAEjC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,GACd,wBAAwB,GAAG,IAAI,CAiCjC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAK9D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG;IAC1D,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CASA"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook Services
|
|
3
|
+
*
|
|
4
|
+
* Consolidated hook services providing both execution and configuration functionality.
|
|
5
|
+
* Combines hook command execution and settings management into a single module.
|
|
6
|
+
*/
|
|
7
|
+
import { spawn } from "child_process";
|
|
8
|
+
import { existsSync, readFileSync } from "fs";
|
|
9
|
+
import { join } from "path";
|
|
10
|
+
import { homedir } from "os";
|
|
11
|
+
import { getSessionFilePath, isValidHookEvent, } from "../types/hooks.js";
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// Hook Execution Functions
|
|
14
|
+
// =============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Build JSON input data for hook stdin
|
|
17
|
+
*/
|
|
18
|
+
function buildHookJsonInput(context) {
|
|
19
|
+
const jsonInput = {
|
|
20
|
+
session_id: context.sessionId || "unknown",
|
|
21
|
+
transcript_path: context.transcriptPath ||
|
|
22
|
+
(context.sessionId ? getSessionFilePath(context.sessionId) : ""),
|
|
23
|
+
cwd: context.cwd || context.projectDir,
|
|
24
|
+
hook_event_name: context.event,
|
|
25
|
+
};
|
|
26
|
+
// Add optional fields based on event type
|
|
27
|
+
if (context.event === "PreToolUse" || context.event === "PostToolUse") {
|
|
28
|
+
if (context.toolName) {
|
|
29
|
+
jsonInput.tool_name = context.toolName;
|
|
30
|
+
}
|
|
31
|
+
if (context.toolInput !== undefined) {
|
|
32
|
+
jsonInput.tool_input = context.toolInput;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (context.event === "PostToolUse" && context.toolResponse !== undefined) {
|
|
36
|
+
jsonInput.tool_response = context.toolResponse;
|
|
37
|
+
}
|
|
38
|
+
if (context.event === "UserPromptSubmit" &&
|
|
39
|
+
context.userPrompt !== undefined) {
|
|
40
|
+
jsonInput.user_prompt = context.userPrompt;
|
|
41
|
+
}
|
|
42
|
+
return jsonInput;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Execute a single hook command
|
|
46
|
+
*/
|
|
47
|
+
export async function executeCommand(command, context, options) {
|
|
48
|
+
const defaultTimeout = 10000; // 10 seconds
|
|
49
|
+
const maxTimeout = 300000; // 5 minutes
|
|
50
|
+
const skipExecution = process.env.NODE_ENV === "test" &&
|
|
51
|
+
process.env.TEST_HOOK_EXECUTION !== "true";
|
|
52
|
+
const startTime = Date.now();
|
|
53
|
+
const timeout = Math.min(options?.timeout ?? defaultTimeout, maxTimeout);
|
|
54
|
+
// Return mock result if execution is skipped
|
|
55
|
+
if (skipExecution) {
|
|
56
|
+
return {
|
|
57
|
+
success: true,
|
|
58
|
+
exitCode: 0,
|
|
59
|
+
stdout: "",
|
|
60
|
+
stderr: "",
|
|
61
|
+
duration: 0,
|
|
62
|
+
timedOut: false,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return new Promise((resolve) => {
|
|
66
|
+
let stdout = "";
|
|
67
|
+
let stderr = "";
|
|
68
|
+
let timedOut = false;
|
|
69
|
+
// Parse command for shell execution
|
|
70
|
+
const isWindows = process.platform === "win32";
|
|
71
|
+
const shell = isWindows ? "cmd.exe" : "/bin/sh";
|
|
72
|
+
const shellFlag = isWindows ? "/c" : "-c";
|
|
73
|
+
const childProcess = spawn(shell, [shellFlag, command], {
|
|
74
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
75
|
+
cwd: context.projectDir,
|
|
76
|
+
env: {
|
|
77
|
+
...process.env,
|
|
78
|
+
HOOK_EVENT: context.event,
|
|
79
|
+
HOOK_TOOL_NAME: context.toolName || "",
|
|
80
|
+
HOOK_PROJECT_DIR: context.projectDir,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
// Set up timeout
|
|
84
|
+
const timeoutHandle = setTimeout(() => {
|
|
85
|
+
timedOut = true;
|
|
86
|
+
childProcess.kill("SIGTERM");
|
|
87
|
+
// Force kill after additional delay
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
if (!childProcess.killed) {
|
|
90
|
+
childProcess.kill("SIGKILL");
|
|
91
|
+
}
|
|
92
|
+
}, 2000);
|
|
93
|
+
}, timeout);
|
|
94
|
+
// Handle stdout
|
|
95
|
+
if (childProcess.stdout) {
|
|
96
|
+
childProcess.stdout.on("data", (data) => {
|
|
97
|
+
stdout += data.toString();
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// Handle stderr
|
|
101
|
+
if (childProcess.stderr) {
|
|
102
|
+
childProcess.stderr.on("data", (data) => {
|
|
103
|
+
stderr += data.toString();
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// Send JSON input to stdin if we have extended context
|
|
107
|
+
if (childProcess.stdin && "sessionId" in context) {
|
|
108
|
+
try {
|
|
109
|
+
const jsonInput = buildHookJsonInput(context);
|
|
110
|
+
childProcess.stdin.write(JSON.stringify(jsonInput, null, 2));
|
|
111
|
+
childProcess.stdin.end();
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
// Continue execution even if JSON input fails
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else if (childProcess.stdin) {
|
|
118
|
+
childProcess.stdin.end();
|
|
119
|
+
}
|
|
120
|
+
// Handle process completion
|
|
121
|
+
childProcess.on("close", (code) => {
|
|
122
|
+
clearTimeout(timeoutHandle);
|
|
123
|
+
const duration = Date.now() - startTime;
|
|
124
|
+
resolve({
|
|
125
|
+
success: !timedOut && (code === 0 || code === null),
|
|
126
|
+
exitCode: code || 0,
|
|
127
|
+
stdout: stdout.trim(),
|
|
128
|
+
stderr: stderr.trim(),
|
|
129
|
+
duration,
|
|
130
|
+
timedOut,
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
// Handle process errors
|
|
134
|
+
childProcess.on("error", (error) => {
|
|
135
|
+
clearTimeout(timeoutHandle);
|
|
136
|
+
const duration = Date.now() - startTime;
|
|
137
|
+
resolve({
|
|
138
|
+
success: false,
|
|
139
|
+
exitCode: 1,
|
|
140
|
+
stdout: stdout.trim(),
|
|
141
|
+
stderr: error.message,
|
|
142
|
+
duration,
|
|
143
|
+
timedOut,
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Execute multiple commands in sequence
|
|
150
|
+
*/
|
|
151
|
+
export async function executeCommands(commands, context, options) {
|
|
152
|
+
const results = [];
|
|
153
|
+
for (const command of commands) {
|
|
154
|
+
const result = await executeCommand(command, context, options);
|
|
155
|
+
results.push(result);
|
|
156
|
+
// Stop on first failure unless continueOnFailure is set
|
|
157
|
+
if (!result.success && !options?.continueOnFailure) {
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return results;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Validate command safety (basic checks)
|
|
165
|
+
*/
|
|
166
|
+
export function isCommandSafe(command) {
|
|
167
|
+
const trimmed = command.trim();
|
|
168
|
+
// Empty commands are safe (no-op)
|
|
169
|
+
if (!trimmed) {
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
// Check for obviously dangerous patterns
|
|
173
|
+
const dangerousPatterns = [
|
|
174
|
+
/rm\s+-rf\s+\//, // rm -rf /
|
|
175
|
+
/sudo\s+rm/, // sudo rm
|
|
176
|
+
/>\s*\/dev\/sd[a-z]/, // writing to disk devices
|
|
177
|
+
/dd\s+if=.*of=\/dev/, // dd to devices
|
|
178
|
+
/mkfs/, // filesystem creation
|
|
179
|
+
/fdisk/, // disk partitioning
|
|
180
|
+
/format\s+[a-z]:/, // Windows format command
|
|
181
|
+
];
|
|
182
|
+
return !dangerousPatterns.some((pattern) => pattern.test(trimmed.toLowerCase()));
|
|
183
|
+
}
|
|
184
|
+
// =============================================================================
|
|
185
|
+
// Hook Settings Functions
|
|
186
|
+
// =============================================================================
|
|
187
|
+
/**
|
|
188
|
+
* Get the user-specific hooks configuration file path
|
|
189
|
+
*/
|
|
190
|
+
export function getUserHooksConfigPath() {
|
|
191
|
+
return join(homedir(), ".wave", "settings.json");
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get the project-specific hooks configuration file path
|
|
195
|
+
*/
|
|
196
|
+
export function getProjectHooksConfigPath(workdir) {
|
|
197
|
+
return join(workdir, ".wave", "settings.json");
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Load hooks configuration from a JSON file
|
|
201
|
+
*/
|
|
202
|
+
export function loadHooksConfigFromFile(filePath) {
|
|
203
|
+
if (!existsSync(filePath)) {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
const content = readFileSync(filePath, "utf-8");
|
|
207
|
+
const config = JSON.parse(content);
|
|
208
|
+
// Validate basic structure
|
|
209
|
+
if (!config || typeof config !== "object" || !config.hooks) {
|
|
210
|
+
throw new Error(`Invalid hooks configuration structure in ${filePath}`);
|
|
211
|
+
}
|
|
212
|
+
return config.hooks;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Load user-specific hooks configuration
|
|
216
|
+
*/
|
|
217
|
+
export function loadUserHooksConfig() {
|
|
218
|
+
return loadHooksConfigFromFile(getUserHooksConfigPath());
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Load project-specific hooks configuration
|
|
222
|
+
*/
|
|
223
|
+
export function loadProjectHooksConfig(workdir) {
|
|
224
|
+
return loadHooksConfigFromFile(getProjectHooksConfigPath(workdir));
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Load and merge hooks configuration from both user and project sources
|
|
228
|
+
*/
|
|
229
|
+
export function loadMergedHooksConfig(workdir) {
|
|
230
|
+
const userConfig = loadUserHooksConfig();
|
|
231
|
+
const projectConfig = loadProjectHooksConfig(workdir);
|
|
232
|
+
// No configuration found
|
|
233
|
+
if (!userConfig && !projectConfig) {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
// Only one configuration found
|
|
237
|
+
if (!userConfig)
|
|
238
|
+
return projectConfig;
|
|
239
|
+
if (!projectConfig)
|
|
240
|
+
return userConfig;
|
|
241
|
+
// Merge configurations (project overrides user)
|
|
242
|
+
const merged = {};
|
|
243
|
+
// Combine all hook events
|
|
244
|
+
const allEvents = new Set([
|
|
245
|
+
...Object.keys(userConfig),
|
|
246
|
+
...Object.keys(projectConfig),
|
|
247
|
+
]);
|
|
248
|
+
for (const event of allEvents) {
|
|
249
|
+
if (!isValidHookEvent(event))
|
|
250
|
+
continue;
|
|
251
|
+
const userEventConfigs = userConfig[event] || [];
|
|
252
|
+
const projectEventConfigs = projectConfig[event] || [];
|
|
253
|
+
// Project configurations take precedence
|
|
254
|
+
merged[event] = [...userEventConfigs, ...projectEventConfigs];
|
|
255
|
+
}
|
|
256
|
+
return merged;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Check if hooks configuration exists (user or project)
|
|
260
|
+
*/
|
|
261
|
+
export function hasHooksConfiguration(workdir) {
|
|
262
|
+
return (existsSync(getUserHooksConfigPath()) ||
|
|
263
|
+
existsSync(getProjectHooksConfigPath(workdir)));
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Get hooks configuration information for debugging
|
|
267
|
+
*/
|
|
268
|
+
export function getHooksConfigurationInfo(workdir) {
|
|
269
|
+
const userPath = getUserHooksConfigPath();
|
|
270
|
+
const projectPath = getProjectHooksConfigPath(workdir);
|
|
271
|
+
return {
|
|
272
|
+
hasUser: existsSync(userPath),
|
|
273
|
+
hasProject: existsSync(projectPath),
|
|
274
|
+
paths: [userPath, projectPath],
|
|
275
|
+
};
|
|
276
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/services/session.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/services/session.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAOD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;GAGG;AACH,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GAClB,OAAO,CAAC,OAAO,CAAC,CASlB"}
|
package/dist/services/session.js
CHANGED
|
@@ -169,8 +169,8 @@ export async function listSessions(workdir, includeAllWorkdirs = false, sessionD
|
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
catch {
|
|
172
|
-
//
|
|
173
|
-
|
|
172
|
+
// Skip corrupted session files and continue processing others
|
|
173
|
+
continue;
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
return sessions.sort((a, b) => new Date(b.lastActiveAt).getTime() - new Date(a.lastActiveAt).getTime());
|
|
@@ -224,8 +224,9 @@ export async function cleanupExpiredSessions(workdir, sessionDir) {
|
|
|
224
224
|
await deleteSession(session.id, sessionDir);
|
|
225
225
|
deletedCount++;
|
|
226
226
|
}
|
|
227
|
-
catch
|
|
228
|
-
|
|
227
|
+
catch {
|
|
228
|
+
// Skip failed deletions and continue processing other sessions
|
|
229
|
+
continue;
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
232
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskTool.d.ts","sourceRoot":"","sources":["../../src/tools/taskTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"taskTool.d.ts","sourceRoot":"","sources":["../../src/tools/taskTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA2B,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE;;;GAGG;AACH,wBAAgB,cAAc,CAAC,eAAe,EAAE,eAAe,GAAG,UAAU,CAgI3E"}
|
package/dist/tools/taskTool.js
CHANGED
|
@@ -39,7 +39,7 @@ ${subagentList || "No subagents configured"}`;
|
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
|
-
execute: async (args) => {
|
|
42
|
+
execute: async (args, context) => {
|
|
43
43
|
// Input validation
|
|
44
44
|
const description = args.description;
|
|
45
45
|
const prompt = args.prompt;
|
|
@@ -83,8 +83,12 @@ ${subagentList || "No subagents configured"}`;
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
// Create subagent instance and execute task
|
|
86
|
-
const instance = await subagentManager.createInstance(configuration,
|
|
87
|
-
|
|
86
|
+
const instance = await subagentManager.createInstance(configuration, {
|
|
87
|
+
description,
|
|
88
|
+
prompt,
|
|
89
|
+
subagent_type,
|
|
90
|
+
});
|
|
91
|
+
const response = await subagentManager.executeTask(instance, prompt, context.abortSignal);
|
|
88
92
|
return {
|
|
89
93
|
success: true,
|
|
90
94
|
content: response,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"todoWriteTool.d.ts","sourceRoot":"","sources":["../../src/tools/todoWriteTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,YAAY,CAAC;AAQzD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"todoWriteTool.d.ts","sourceRoot":"","sources":["../../src/tools/todoWriteTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,YAAY,CAAC;AAQzD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,UAoN3B,CAAC"}
|
|
@@ -173,16 +173,9 @@ When in doubt, use this tool. Being proactive with task management demonstrates
|
|
|
173
173
|
in_progress: "[>]",
|
|
174
174
|
completed: "[x]",
|
|
175
175
|
};
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
shortResult += `\n${symbols.in_progress} ${inProgress[0].content}`;
|
|
180
|
-
}
|
|
181
|
-
if (pending.length > 0) {
|
|
182
|
-
shortResult += `\n${symbols.pending} ${pending[0].content}`;
|
|
183
|
-
if (pending.length > 1) {
|
|
184
|
-
shortResult += ` +${pending.length - 1}`;
|
|
185
|
-
}
|
|
176
|
+
// Show all todos in the shortResult
|
|
177
|
+
for (const todo of todos) {
|
|
178
|
+
shortResult += `\n${symbols[todo.status]} ${todo.content}`;
|
|
186
179
|
}
|
|
187
180
|
}
|
|
188
181
|
return {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slash command and custom command types
|
|
3
|
+
* Dependencies: None
|
|
4
|
+
*/
|
|
5
|
+
export interface SlashCommand {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
handler: (args?: string) => Promise<void> | void;
|
|
10
|
+
}
|
|
11
|
+
export interface CustomSlashCommandConfig {
|
|
12
|
+
allowedTools?: string[];
|
|
13
|
+
model?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CustomSlashCommand {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
filePath: string;
|
|
21
|
+
content: string;
|
|
22
|
+
config?: CustomSlashCommandConfig;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/types/commands.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAClD;AAED,MAAM,WAAW,wBAAwB;IACvC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,wBAAwB,CAAC;CACnC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent and service configuration types
|
|
3
|
+
* Dependencies: None
|
|
4
|
+
*/
|
|
5
|
+
export interface GatewayConfig {
|
|
6
|
+
apiKey: string;
|
|
7
|
+
baseURL: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ModelConfig {
|
|
10
|
+
agentModel: string;
|
|
11
|
+
fastModel: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core foundational types used across multiple domains
|
|
3
|
+
* Dependencies: None (foundation layer)
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Logger interface definition
|
|
7
|
+
* Compatible with OpenAI package Logger interface
|
|
8
|
+
*/
|
|
9
|
+
export interface Logger {
|
|
10
|
+
error: (...args: unknown[]) => void;
|
|
11
|
+
warn: (...args: unknown[]) => void;
|
|
12
|
+
info: (...args: unknown[]) => void;
|
|
13
|
+
debug: (...args: unknown[]) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Usage statistics for AI operations
|
|
17
|
+
* Extends OpenAI's Usage format with additional tracking fields
|
|
18
|
+
*/
|
|
19
|
+
export interface Usage {
|
|
20
|
+
prompt_tokens: number;
|
|
21
|
+
completion_tokens: number;
|
|
22
|
+
total_tokens: number;
|
|
23
|
+
model?: string;
|
|
24
|
+
operation_type?: "agent" | "compress";
|
|
25
|
+
}
|
|
26
|
+
export declare class ConfigurationError extends Error {
|
|
27
|
+
readonly field: string;
|
|
28
|
+
readonly provided?: unknown | undefined;
|
|
29
|
+
constructor(message: string, field: string, provided?: unknown | undefined);
|
|
30
|
+
}
|
|
31
|
+
export declare const CONFIG_ERRORS: {
|
|
32
|
+
readonly MISSING_API_KEY: "Gateway configuration requires apiKey. Provide via constructor or AIGW_TOKEN environment variable.";
|
|
33
|
+
readonly MISSING_BASE_URL: "Gateway configuration requires baseURL. Provide via constructor or AIGW_URL environment variable.";
|
|
34
|
+
readonly INVALID_TOKEN_LIMIT: "Token limit must be a positive integer.";
|
|
35
|
+
readonly EMPTY_API_KEY: "API key cannot be empty string.";
|
|
36
|
+
readonly EMPTY_BASE_URL: "Base URL cannot be empty string.";
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;CACvC;AAED,qBAAa,kBAAmB,SAAQ,KAAK;aAGzB,KAAK,EAAE,MAAM;aACb,QAAQ,CAAC,EAAE,OAAO;gBAFlC,OAAO,EAAE,MAAM,EACC,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,OAAO,YAAA;CAKrC;AAGD,eAAO,MAAM,aAAa;;;;;;CAQhB,CAAC"}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
MAX_NAME_LENGTH: 64,
|
|
6
|
-
MAX_DESCRIPTION_LENGTH: 1024,
|
|
7
|
-
MIN_DESCRIPTION_LENGTH: 1,
|
|
8
|
-
NAME_PATTERN: /^[a-z0-9-]+$/,
|
|
9
|
-
MAX_METADATA_CACHE: 1000,
|
|
10
|
-
MAX_CONTENT_CACHE: 100,
|
|
11
|
-
SCAN_TIMEOUT: 5000,
|
|
12
|
-
LOAD_TIMEOUT: 2000,
|
|
13
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Core foundational types used across multiple domains
|
|
3
|
+
* Dependencies: None (foundation layer)
|
|
4
|
+
*/
|
|
14
5
|
export class ConfigurationError extends Error {
|
|
15
6
|
constructor(message, field, provided) {
|
|
16
7
|
super(message);
|
|
@@ -36,6 +36,7 @@ export interface HookExecutionResult {
|
|
|
36
36
|
export interface HookExecutionOptions {
|
|
37
37
|
timeout?: number;
|
|
38
38
|
cwd?: string;
|
|
39
|
+
continueOnFailure?: boolean;
|
|
39
40
|
}
|
|
40
41
|
export interface ValidationResult {
|
|
41
42
|
valid: boolean;
|
|
@@ -77,4 +78,4 @@ export interface HookEnvironment {
|
|
|
77
78
|
WAVE_PROJECT_DIR: string;
|
|
78
79
|
[key: string]: string;
|
|
79
80
|
}
|
|
80
|
-
//# sourceMappingURL=
|
|
81
|
+
//# sourceMappingURL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