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/permissions.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Permission system types for Wave Agent SDK
|
|
3
|
-
* Dependencies: None
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
AskUserQuestion,
|
|
8
|
-
AskUserQuestionInput,
|
|
9
|
-
AskUserQuestionOption,
|
|
10
|
-
} from "./tools.js";
|
|
11
|
-
import {
|
|
12
|
-
EDIT_TOOL_NAME,
|
|
13
|
-
BASH_TOOL_NAME,
|
|
14
|
-
WRITE_TOOL_NAME,
|
|
15
|
-
ENTER_PLAN_MODE_TOOL_NAME,
|
|
16
|
-
EXIT_PLAN_MODE_TOOL_NAME,
|
|
17
|
-
ASK_USER_QUESTION_TOOL_NAME,
|
|
18
|
-
} from "../constants/tools.js";
|
|
19
|
-
|
|
20
|
-
/** Permission mode configuration */
|
|
21
|
-
export type PermissionMode =
|
|
22
|
-
| "default"
|
|
23
|
-
| "bypassPermissions"
|
|
24
|
-
| "acceptEdits"
|
|
25
|
-
| "plan"
|
|
26
|
-
| "dontAsk";
|
|
27
|
-
|
|
28
|
-
/** Result of a permission check */
|
|
29
|
-
export interface PermissionDecision {
|
|
30
|
-
/** Whether to allow or deny the operation */
|
|
31
|
-
behavior: "allow" | "deny";
|
|
32
|
-
/** Optional message explaining the decision (required for deny) */
|
|
33
|
-
message?: string;
|
|
34
|
-
/** Signal to change the session's permission mode */
|
|
35
|
-
newPermissionMode?: PermissionMode;
|
|
36
|
-
/** Signal to persist a new allowed rule */
|
|
37
|
-
newPermissionRule?: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** Callback function for custom permission logic */
|
|
41
|
-
export type PermissionCallback = (
|
|
42
|
-
context: ToolPermissionContext,
|
|
43
|
-
) => Promise<PermissionDecision>;
|
|
44
|
-
|
|
45
|
-
/** Internal context passed to PermissionManager */
|
|
46
|
-
export interface ToolPermissionContext {
|
|
47
|
-
/** Name of the tool being executed */
|
|
48
|
-
toolName: string;
|
|
49
|
-
/** Current permission mode */
|
|
50
|
-
permissionMode: PermissionMode;
|
|
51
|
-
/** Custom permission callback if provided */
|
|
52
|
-
canUseToolCallback?: PermissionCallback;
|
|
53
|
-
/** Tool input parameters for better context */
|
|
54
|
-
toolInput?: Record<string, unknown>;
|
|
55
|
-
/** Suggested prefix for bash commands */
|
|
56
|
-
suggestedPrefix?: string;
|
|
57
|
-
/** Whether to hide the persistent permission option (e.g., "Don't ask again") in the UI */
|
|
58
|
-
hidePersistentOption?: boolean;
|
|
59
|
-
/** The ID of the tool call that triggered this permission request */
|
|
60
|
-
toolCallId?: string;
|
|
61
|
-
/** The content of the plan being exited from */
|
|
62
|
-
planContent?: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/** List of tools that require permission checks in default mode */
|
|
66
|
-
export const RESTRICTED_TOOLS = [
|
|
67
|
-
EDIT_TOOL_NAME,
|
|
68
|
-
BASH_TOOL_NAME,
|
|
69
|
-
WRITE_TOOL_NAME,
|
|
70
|
-
ENTER_PLAN_MODE_TOOL_NAME,
|
|
71
|
-
EXIT_PLAN_MODE_TOOL_NAME,
|
|
72
|
-
ASK_USER_QUESTION_TOOL_NAME,
|
|
73
|
-
] as const;
|
|
74
|
-
|
|
75
|
-
/** Type for restricted tool names */
|
|
76
|
-
export type RestrictedTool = (typeof RESTRICTED_TOOLS)[number];
|
|
77
|
-
|
|
78
|
-
export const OPERATION_CANCELLED_BY_USER = "Operation cancelled by user";
|
|
79
|
-
|
|
80
|
-
export type { AskUserQuestion, AskUserQuestionInput, AskUserQuestionOption };
|
package/src/types/plugins.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { CustomSlashCommand } from "./commands.js";
|
|
2
|
-
import { Skill } from "./skills.js";
|
|
3
|
-
import { LspConfig } from "./lsp.js";
|
|
4
|
-
import { McpConfig } from "./mcp.js";
|
|
5
|
-
import { PartialHookConfiguration } from "./configuration.js";
|
|
6
|
-
import { SubagentConfiguration } from "../utils/subagentParser.js";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Plugin manifest structure (.wave-plugin/plugin.json)
|
|
10
|
-
*/
|
|
11
|
-
export interface PluginManifest {
|
|
12
|
-
name: string;
|
|
13
|
-
description: string;
|
|
14
|
-
version: string;
|
|
15
|
-
author?: {
|
|
16
|
-
name: string;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Plugin configuration in AgentOptions or wave.settings.json
|
|
22
|
-
*/
|
|
23
|
-
export interface PluginConfig {
|
|
24
|
-
type: "local";
|
|
25
|
-
path: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Represents a loaded plugin in the system
|
|
30
|
-
*/
|
|
31
|
-
export interface Plugin extends PluginManifest {
|
|
32
|
-
path: string;
|
|
33
|
-
commands: CustomSlashCommand[];
|
|
34
|
-
skills: Skill[];
|
|
35
|
-
agents: SubagentConfiguration[];
|
|
36
|
-
lspConfig?: LspConfig;
|
|
37
|
-
mcpConfig?: McpConfig;
|
|
38
|
-
hooksConfig?: PartialHookConfiguration;
|
|
39
|
-
}
|
package/src/types/processes.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Background process and shell management types
|
|
3
|
-
* Dependencies: None
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { ChildProcess } from "child_process";
|
|
7
|
-
|
|
8
|
-
export type BackgroundTaskStatus =
|
|
9
|
-
| "running"
|
|
10
|
-
| "completed"
|
|
11
|
-
| "failed"
|
|
12
|
-
| "killed";
|
|
13
|
-
export type BackgroundTaskType = "shell" | "subagent" | "workflow";
|
|
14
|
-
|
|
15
|
-
export interface BackgroundTaskBase {
|
|
16
|
-
id: string;
|
|
17
|
-
type: BackgroundTaskType;
|
|
18
|
-
status: BackgroundTaskStatus;
|
|
19
|
-
startTime: number;
|
|
20
|
-
endTime?: number;
|
|
21
|
-
command?: string; // for shell
|
|
22
|
-
description?: string; // for subagent
|
|
23
|
-
stdout: string;
|
|
24
|
-
stderr: string;
|
|
25
|
-
exitCode?: number;
|
|
26
|
-
runtime?: number;
|
|
27
|
-
/**
|
|
28
|
-
* Optional callback to be executed when the task is stopped.
|
|
29
|
-
* This allows tasks to define their own cleanup/abortion logic.
|
|
30
|
-
*/
|
|
31
|
-
onStop?: () => void | Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Optional subagent ID associated with this task.
|
|
34
|
-
* Used for cleanup when the task is stopped.
|
|
35
|
-
*/
|
|
36
|
-
subagentId?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Optional path to the real-time output log file.
|
|
39
|
-
*/
|
|
40
|
-
outputPath?: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface BackgroundShell extends BackgroundTaskBase {
|
|
44
|
-
type: "shell";
|
|
45
|
-
process: ChildProcess;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface BackgroundSubagent extends BackgroundTaskBase {
|
|
49
|
-
type: "subagent";
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface BackgroundWorkflow extends BackgroundTaskBase {
|
|
53
|
-
type: "workflow";
|
|
54
|
-
runId: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export type BackgroundTask =
|
|
58
|
-
| BackgroundShell
|
|
59
|
-
| BackgroundSubagent
|
|
60
|
-
| BackgroundWorkflow;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Serializable summary of a BackgroundTask, used for notifications where the
|
|
64
|
-
* full stdout/stderr and non-serializable process/onStop fields must be
|
|
65
|
-
* stripped to control payload size. Output is fetched on demand via
|
|
66
|
-
* getBackgroundTaskOutput.
|
|
67
|
-
*/
|
|
68
|
-
export interface BackgroundTaskSummary {
|
|
69
|
-
id: string;
|
|
70
|
-
type: BackgroundTaskType;
|
|
71
|
-
status: BackgroundTaskStatus;
|
|
72
|
-
startTime: number;
|
|
73
|
-
endTime?: number;
|
|
74
|
-
command?: string;
|
|
75
|
-
description?: string;
|
|
76
|
-
exitCode?: number;
|
|
77
|
-
runtime?: number;
|
|
78
|
-
outputPath?: string;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/** Output snapshot returned by getBackgroundTaskOutput. */
|
|
82
|
-
export interface BackgroundTaskOutput {
|
|
83
|
-
stdout: string;
|
|
84
|
-
stderr: string;
|
|
85
|
-
status: BackgroundTaskStatus;
|
|
86
|
-
outputPath?: string;
|
|
87
|
-
type: BackgroundTaskType;
|
|
88
|
-
exitCode?: number;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface ForegroundTask {
|
|
92
|
-
id: string;
|
|
93
|
-
backgroundHandler: () => Promise<void>;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface IForegroundTaskManager {
|
|
97
|
-
registerForegroundTask(task: ForegroundTask): void;
|
|
98
|
-
unregisterForegroundTask(id: string): void;
|
|
99
|
-
}
|
package/src/types/reversion.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents the state of a file before an agent operation.
|
|
3
|
-
*/
|
|
4
|
-
export interface FileSnapshot {
|
|
5
|
-
/** The ID of the message/turn this snapshot is associated with. */
|
|
6
|
-
messageId: string;
|
|
7
|
-
/** Absolute path to the file. */
|
|
8
|
-
filePath: string;
|
|
9
|
-
/** Path to the stored snapshot file. */
|
|
10
|
-
snapshotPath?: string;
|
|
11
|
-
/** When the snapshot was taken. */
|
|
12
|
-
timestamp: number;
|
|
13
|
-
/** The operation that triggered this snapshot. */
|
|
14
|
-
operation: "create" | "modify" | "delete";
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* A point in the conversation history that can be reverted to.
|
|
19
|
-
*/
|
|
20
|
-
export interface Checkpoint {
|
|
21
|
-
/** The index of the user message in the history. */
|
|
22
|
-
index: number;
|
|
23
|
-
/** The unique ID of the user message. */
|
|
24
|
-
messageId: string;
|
|
25
|
-
/** A short snippet of the message content for the UI. */
|
|
26
|
-
preview: string;
|
|
27
|
-
/** When the message was sent. */
|
|
28
|
-
timestamp: number;
|
|
29
|
-
}
|
package/src/types/session.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session management types for project-based organization with JSONL format
|
|
3
|
-
* Dependencies: Core messaging types
|
|
4
|
-
*
|
|
5
|
-
* SIMPLIFIED: Removed unused interfaces to focus on core functionality
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// Session filename structure for simple filename-based metadata
|
|
9
|
-
export interface SessionFilename {
|
|
10
|
-
sessionId: string;
|
|
11
|
-
sessionType: "main" | "subagent";
|
|
12
|
-
}
|
package/src/types/skills.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill system types and constants
|
|
3
|
-
* Dependencies: Core (Logger)
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface SkillMetadata {
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
type: "personal" | "project" | "builtin";
|
|
10
|
-
skillPath: string;
|
|
11
|
-
allowedTools?: string[];
|
|
12
|
-
context?: "fork";
|
|
13
|
-
agent?: string;
|
|
14
|
-
model?: string;
|
|
15
|
-
disableModelInvocation?: boolean;
|
|
16
|
-
userInvocable?: boolean;
|
|
17
|
-
pluginName?: string;
|
|
18
|
-
pluginRoot?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface Skill extends SkillMetadata {
|
|
22
|
-
content: string;
|
|
23
|
-
frontmatter: SkillFrontmatter;
|
|
24
|
-
isValid: boolean;
|
|
25
|
-
errors: string[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface SkillFrontmatter {
|
|
29
|
-
name: string;
|
|
30
|
-
description: string;
|
|
31
|
-
"allowed-tools"?: string | string[];
|
|
32
|
-
context?: "fork";
|
|
33
|
-
agent?: string;
|
|
34
|
-
model?: string;
|
|
35
|
-
"disable-model-invocation"?: boolean | string;
|
|
36
|
-
"user-invocable"?: boolean | string;
|
|
37
|
-
[key: string]: unknown;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface SkillCollection {
|
|
41
|
-
type: "personal" | "project" | "builtin";
|
|
42
|
-
basePath: string;
|
|
43
|
-
skills: Map<string, SkillMetadata>;
|
|
44
|
-
errors: SkillError[];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface SkillError {
|
|
48
|
-
skillPath: string;
|
|
49
|
-
message: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface SkillValidationResult {
|
|
53
|
-
isValid: boolean;
|
|
54
|
-
skill?: Skill;
|
|
55
|
-
errors: string[];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface SkillDiscoveryResult {
|
|
59
|
-
personalSkills: Map<string, SkillMetadata>;
|
|
60
|
-
projectSkills: Map<string, SkillMetadata>;
|
|
61
|
-
builtinSkills: Map<string, SkillMetadata>;
|
|
62
|
-
errors: SkillError[];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface SkillInvocationContext {
|
|
66
|
-
skillName: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface SkillToolArgs {
|
|
70
|
-
skill_name: string;
|
|
71
|
-
args?: string;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface SkillManagerOptions {
|
|
75
|
-
personalSkillsPath?: string;
|
|
76
|
-
personalClaudeSkillsPath?: string;
|
|
77
|
-
personalAgentsSkillsPath?: string;
|
|
78
|
-
scanTimeout?: number;
|
|
79
|
-
workdir?: string;
|
|
80
|
-
watch?: boolean;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export interface ParsedSkillFile {
|
|
84
|
-
frontmatter: SkillFrontmatter;
|
|
85
|
-
content: string;
|
|
86
|
-
skillMetadata: SkillMetadata;
|
|
87
|
-
validationErrors: string[];
|
|
88
|
-
isValid: boolean;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface SkillParseOptions {
|
|
92
|
-
validateMetadata?: boolean;
|
|
93
|
-
basePath?: string;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export const SKILL_DEFAULTS = {
|
|
97
|
-
PERSONAL_SKILLS_DIR: ".wave/skills",
|
|
98
|
-
PROJECT_SKILLS_DIR: ".wave/skills",
|
|
99
|
-
SKILL_FILE_NAME: "SKILL.md",
|
|
100
|
-
MAX_NAME_LENGTH: 64,
|
|
101
|
-
MAX_DESCRIPTION_LENGTH: 1024,
|
|
102
|
-
MIN_DESCRIPTION_LENGTH: 1,
|
|
103
|
-
NAME_PATTERN: /^[a-z0-9-]+$/,
|
|
104
|
-
MAX_METADATA_CACHE: 1000,
|
|
105
|
-
MAX_CONTENT_CACHE: 100,
|
|
106
|
-
SCAN_TIMEOUT: 5000,
|
|
107
|
-
LOAD_TIMEOUT: 2000,
|
|
108
|
-
} as const;
|
package/src/types/tasks.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type TaskStatus = "pending" | "in_progress" | "completed" | "deleted";
|
|
2
|
-
|
|
3
|
-
export interface Task {
|
|
4
|
-
id: string;
|
|
5
|
-
subject: string;
|
|
6
|
-
description: string;
|
|
7
|
-
status: TaskStatus;
|
|
8
|
-
activeForm?: string;
|
|
9
|
-
owner?: string;
|
|
10
|
-
blocks: string[];
|
|
11
|
-
blockedBy: string[];
|
|
12
|
-
metadata: Record<string, unknown>;
|
|
13
|
-
}
|
package/src/types/telemetry.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenTelemetry Integration Types
|
|
3
|
-
*
|
|
4
|
-
* Type definitions for Wave's OpenTelemetry instrumentation module.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/** Exporter target for telemetry signals */
|
|
8
|
-
export type ExporterTarget = "jsonl" | "otlp";
|
|
9
|
-
|
|
10
|
-
/** OTLP transport protocol */
|
|
11
|
-
export type OTLPProtocol = "http/protobuf" | "http/json" | "grpc";
|
|
12
|
-
|
|
13
|
-
/** Resolved telemetry configuration */
|
|
14
|
-
export interface TelemetryConfig {
|
|
15
|
-
/** Master switch for telemetry */
|
|
16
|
-
enabled: boolean;
|
|
17
|
-
/** Trace export target */
|
|
18
|
-
tracesExporter?: ExporterTarget;
|
|
19
|
-
/** Log export target */
|
|
20
|
-
logsExporter?: ExporterTarget;
|
|
21
|
-
/** OTLP collector URL */
|
|
22
|
-
endpoint?: string;
|
|
23
|
-
/** OTLP transport protocol */
|
|
24
|
-
protocol?: OTLPProtocol;
|
|
25
|
-
/** Auth/custom headers */
|
|
26
|
-
headers?: Record<string, string>;
|
|
27
|
-
/** Include prompt text in events */
|
|
28
|
-
logUserPrompts: boolean;
|
|
29
|
-
/** Include tool I/O in events */
|
|
30
|
-
logToolContent: boolean;
|
|
31
|
-
/** Max flush time on exit (default 2000) */
|
|
32
|
-
shutdownTimeoutMs: number;
|
|
33
|
-
/** Stale span eviction TTL (default 1800000 = 30min) */
|
|
34
|
-
spanTtlMs: number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Metadata for LLM request spans */
|
|
38
|
-
export interface LLMRequestMetadata {
|
|
39
|
-
/** Model identifier */
|
|
40
|
-
model: string;
|
|
41
|
-
/** Scope context */
|
|
42
|
-
context?: "interaction" | "standalone";
|
|
43
|
-
/** Prompt tokens consumed */
|
|
44
|
-
inputTokens?: number;
|
|
45
|
-
/** Completion tokens generated */
|
|
46
|
-
outputTokens?: number;
|
|
47
|
-
/** Cache hit tokens */
|
|
48
|
-
cacheReadTokens?: number;
|
|
49
|
-
/** Cache write tokens */
|
|
50
|
-
cacheCreationTokens?: number;
|
|
51
|
-
/** Time to first token (ms) */
|
|
52
|
-
ttftMs?: number;
|
|
53
|
-
/** Time to last token / total duration (ms) */
|
|
54
|
-
ttltMs?: number;
|
|
55
|
-
/** Request succeeded */
|
|
56
|
-
success: boolean;
|
|
57
|
-
/** Error message if failed */
|
|
58
|
-
error?: string;
|
|
59
|
-
/** Response included tool calls */
|
|
60
|
-
hasToolCall?: boolean;
|
|
61
|
-
/** Model text output (recorded when logToolContent is true) */
|
|
62
|
-
modelOutput?: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/** Input context for an LLM request span (content capture gated by logToolContent) */
|
|
66
|
-
export interface LLMRequestInput {
|
|
67
|
-
/** Scope context */
|
|
68
|
-
context?: "interaction" | "standalone";
|
|
69
|
-
/** System prompt string (when available) */
|
|
70
|
-
systemPrompt?: string;
|
|
71
|
-
/** Messages array sent to the API */
|
|
72
|
-
inputMessages?: unknown[];
|
|
73
|
-
/** Tool schemas JSON string */
|
|
74
|
-
toolsSchema?: string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** Metadata for tool execution spans */
|
|
78
|
-
export interface ToolMetadata {
|
|
79
|
-
/** Tool execution succeeded */
|
|
80
|
-
success: boolean;
|
|
81
|
-
/** Error message if failed */
|
|
82
|
-
error?: string;
|
|
83
|
-
/** Execution time (ms) */
|
|
84
|
-
durationMs: number;
|
|
85
|
-
/** Tool output content (recorded when logToolContent is true) */
|
|
86
|
-
output?: string;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/** Event names for OTel structured logging */
|
|
90
|
-
export type OTelEventName =
|
|
91
|
-
| "session_start"
|
|
92
|
-
| "session_end"
|
|
93
|
-
| "user_prompt"
|
|
94
|
-
| "tool_decision"
|
|
95
|
-
| "compaction"
|
|
96
|
-
| "error"
|
|
97
|
-
| "system_prompt"
|
|
98
|
-
| "tool_schema";
|
package/src/types/tools.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool parameter types for edit and write operations
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Input types for AskUserQuestion tool
|
|
7
|
-
*/
|
|
8
|
-
export interface AskUserQuestionOption {
|
|
9
|
-
label: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface AskUserQuestion {
|
|
14
|
-
question: string;
|
|
15
|
-
header: string;
|
|
16
|
-
options: AskUserQuestionOption[];
|
|
17
|
-
multiSelect?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface AskUserQuestionInput {
|
|
21
|
-
questions: AskUserQuestion[];
|
|
22
|
-
answers?: Record<string, string>;
|
|
23
|
-
metadata?: {
|
|
24
|
-
source?: string;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Parameters for the Write tool
|
|
30
|
-
*/
|
|
31
|
-
export interface WriteToolParameters {
|
|
32
|
-
file_path: string;
|
|
33
|
-
content: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Parameters for the Edit tool
|
|
38
|
-
*/
|
|
39
|
-
export interface EditToolParameters {
|
|
40
|
-
file_path: string;
|
|
41
|
-
old_string: string;
|
|
42
|
-
new_string: string;
|
|
43
|
-
replace_all?: boolean;
|
|
44
|
-
}
|
package/src/types/workflow.ts
DELETED
package/src/utils/abortUtils.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilities for safe AbortSignal listener management to prevent memory leaks
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Safely adds a one-time abort listener that automatically cleans up after firing
|
|
7
|
-
* @param signal - The AbortSignal to listen to
|
|
8
|
-
* @param callback - The function to call when aborted
|
|
9
|
-
* @returns A cleanup function to manually remove the listener if needed
|
|
10
|
-
*/
|
|
11
|
-
export function addOnceAbortListener(
|
|
12
|
-
signal: AbortSignal,
|
|
13
|
-
callback: () => void,
|
|
14
|
-
): () => void {
|
|
15
|
-
if (signal.aborted) {
|
|
16
|
-
// Signal already aborted, call immediately
|
|
17
|
-
callback();
|
|
18
|
-
return () => {}; // No cleanup needed
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const handler = () => {
|
|
22
|
-
callback();
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// Use { once: true } to automatically remove listener after first call
|
|
26
|
-
signal.addEventListener("abort", handler, { once: true });
|
|
27
|
-
|
|
28
|
-
// Return cleanup function for manual removal if needed
|
|
29
|
-
return () => {
|
|
30
|
-
signal.removeEventListener("abort", handler);
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Creates a Promise that rejects when the AbortSignal is aborted
|
|
36
|
-
* Uses once-only listener to prevent accumulation
|
|
37
|
-
* @param signal - The AbortSignal to listen to
|
|
38
|
-
* @param errorMessage - Optional custom error message
|
|
39
|
-
* @returns Promise that rejects on abort
|
|
40
|
-
*/
|
|
41
|
-
export function createAbortPromise(
|
|
42
|
-
signal: AbortSignal,
|
|
43
|
-
errorMessage: string = "Operation was aborted",
|
|
44
|
-
): Promise<never> {
|
|
45
|
-
return new Promise<never>((_, reject) => {
|
|
46
|
-
if (signal.aborted) {
|
|
47
|
-
reject(new Error(errorMessage));
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Use once-only listener to prevent accumulation
|
|
52
|
-
signal.addEventListener(
|
|
53
|
-
"abort",
|
|
54
|
-
() => {
|
|
55
|
-
reject(new Error(errorMessage));
|
|
56
|
-
},
|
|
57
|
-
{ once: true },
|
|
58
|
-
);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Wrapper that manages abort signal listeners with automatic cleanup
|
|
64
|
-
* @param signal - The AbortSignal to manage
|
|
65
|
-
* @param operation - Function that sets up listeners and returns cleanup
|
|
66
|
-
* @returns Promise that resolves with the operation result
|
|
67
|
-
*/
|
|
68
|
-
export async function withAbortCleanup<T>(
|
|
69
|
-
signal: AbortSignal,
|
|
70
|
-
operation: (signal: AbortSignal) => Promise<T>,
|
|
71
|
-
): Promise<T> {
|
|
72
|
-
// Track all cleanup functions
|
|
73
|
-
const cleanups: (() => void)[] = [];
|
|
74
|
-
|
|
75
|
-
try {
|
|
76
|
-
const result = await operation(signal);
|
|
77
|
-
return result;
|
|
78
|
-
} finally {
|
|
79
|
-
// Clean up all listeners
|
|
80
|
-
cleanups.forEach((cleanup) => cleanup());
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Consolidates multiple abort listeners into a single listener
|
|
86
|
-
* Useful when multiple handlers need to respond to the same abort signal
|
|
87
|
-
* @param signal - The AbortSignal to listen to
|
|
88
|
-
* @param callbacks - Array of functions to call when aborted
|
|
89
|
-
* @returns Cleanup function to remove the consolidated listener
|
|
90
|
-
*/
|
|
91
|
-
export function addConsolidatedAbortListener(
|
|
92
|
-
signal: AbortSignal,
|
|
93
|
-
callbacks: (() => void)[],
|
|
94
|
-
): () => void {
|
|
95
|
-
if (signal.aborted) {
|
|
96
|
-
// Signal already aborted, call all callbacks immediately
|
|
97
|
-
callbacks.forEach((cb) => cb());
|
|
98
|
-
return () => {}; // No cleanup needed
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const handler = () => {
|
|
102
|
-
callbacks.forEach((cb) => {
|
|
103
|
-
try {
|
|
104
|
-
cb();
|
|
105
|
-
} catch (error) {
|
|
106
|
-
console.error("Error in abort callback:", error);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// Use { once: true } to automatically remove listener after first call
|
|
112
|
-
signal.addEventListener("abort", handler, { once: true });
|
|
113
|
-
|
|
114
|
-
// Return cleanup function for manual removal if needed
|
|
115
|
-
return () => {
|
|
116
|
-
signal.removeEventListener("abort", handler);
|
|
117
|
-
};
|
|
118
|
-
}
|