wave-agent-sdk 0.11.0 → 0.11.1
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/builtin/skills/init/SKILL.md +26 -0
- package/builtin/skills/settings/ENV.md +64 -0
- package/{src/builtin-skills → builtin/skills}/settings/HOOKS.md +12 -0
- package/builtin/skills/settings/MCP.md +55 -0
- package/builtin/skills/settings/MEMORY_RULES.md +60 -0
- package/{src/builtin-skills → builtin/skills}/settings/SKILL.md +22 -15
- package/builtin/skills/settings/SKILLS.md +63 -0
- package/builtin/skills/settings/SUBAGENTS.md +60 -0
- package/builtin/subagents/bash.md +18 -0
- package/builtin/subagents/explore.md +42 -0
- package/builtin/subagents/general-purpose.md +20 -0
- package/builtin/subagents/plan.md +55 -0
- package/dist/managers/slashCommandManager.d.ts.map +1 -1
- package/dist/managers/slashCommandManager.js +0 -16
- package/dist/prompts/index.d.ts +0 -5
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +1 -136
- package/dist/utils/configPaths.d.ts +4 -0
- package/dist/utils/configPaths.d.ts.map +1 -1
- package/dist/utils/configPaths.js +11 -9
- package/dist/utils/fileSearch.d.ts.map +1 -1
- package/dist/utils/fileSearch.js +7 -1
- package/dist/utils/subagentParser.d.ts.map +1 -1
- package/dist/utils/subagentParser.js +14 -4
- package/package.json +3 -2
- package/src/managers/slashCommandManager.ts +0 -19
- package/src/prompts/index.ts +0 -144
- package/src/utils/configPaths.ts +12 -10
- package/src/utils/fileSearch.ts +7 -1
- package/src/utils/subagentParser.ts +16 -6
- package/dist/builtin-skills/builtin-skills/loop/parsing.ts +0 -159
- package/dist/builtin-skills/builtin-skills/settings/HOOKS.md +0 -82
- package/dist/builtin-skills/builtin-skills/settings/SKILL.md +0 -86
- package/dist/builtin-skills/loop/parsing.d.ts +0 -13
- package/dist/builtin-skills/loop/parsing.d.ts.map +0 -1
- package/dist/builtin-skills/loop/parsing.js +0 -125
- package/dist/utils/builtinSubagents.d.ts +0 -7
- package/dist/utils/builtinSubagents.d.ts.map +0 -1
- package/dist/utils/builtinSubagents.js +0 -94
- package/src/builtin-skills/loop/SKILL.md +0 -53
- package/src/builtin-skills/loop/parsing.ts +0 -159
- package/src/utils/builtinSubagents.ts +0 -122
- /package/{dist/builtin-skills/builtin-skills → builtin/skills}/loop/SKILL.md +0 -0
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
export interface ParsedLoop {
|
|
2
|
-
interval: string;
|
|
3
|
-
prompt: string;
|
|
4
|
-
originalInterval?: string;
|
|
5
|
-
roundedTo?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function parseLoopInput(
|
|
9
|
-
input: string,
|
|
10
|
-
defaultInterval: string = "10m",
|
|
11
|
-
): ParsedLoop {
|
|
12
|
-
const trimmedInput = input.trim();
|
|
13
|
-
if (!trimmedInput) {
|
|
14
|
-
return { interval: defaultInterval, prompt: "" };
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// 1. Leading token: ^\d+[smhd]$
|
|
18
|
-
const tokens = trimmedInput.split(/\s+/);
|
|
19
|
-
if (tokens[0].match(/^\d+[smhd]$/)) {
|
|
20
|
-
const interval = tokens[0];
|
|
21
|
-
const prompt = tokens.slice(1).join(" ");
|
|
22
|
-
return { interval, prompt };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// 2. Trailing "every" clause: every <N><unit> or every <N> <unit-word>
|
|
26
|
-
// Units: s, m, h, d, second(s), minute(s), hour(s), day(s)
|
|
27
|
-
const everyRegex =
|
|
28
|
-
/\s+every\s+(\d+)\s*(s|m|h|d|seconds?|minutes?|hours?|days?)$/i;
|
|
29
|
-
const match = trimmedInput.match(everyRegex);
|
|
30
|
-
if (match) {
|
|
31
|
-
const n = match[1];
|
|
32
|
-
const unitWord = match[2].toLowerCase();
|
|
33
|
-
const unit = unitWord[0];
|
|
34
|
-
const interval = `${n}${unit}`;
|
|
35
|
-
const prompt = trimmedInput.substring(0, match.index).trim();
|
|
36
|
-
return { interval, prompt };
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// 3. Default
|
|
40
|
-
return { interval: defaultInterval, prompt: trimmedInput };
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const CLEAN_MINUTES = [1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30];
|
|
44
|
-
const CLEAN_HOURS = [1, 2, 3, 4, 6, 8, 12];
|
|
45
|
-
|
|
46
|
-
function getNearestClean(value: number, cleanValues: number[]): number {
|
|
47
|
-
let nearest = cleanValues[0];
|
|
48
|
-
let minDiff = Math.abs(value - nearest);
|
|
49
|
-
for (const clean of cleanValues) {
|
|
50
|
-
const diff = Math.abs(value - clean);
|
|
51
|
-
if (diff < minDiff) {
|
|
52
|
-
minDiff = diff;
|
|
53
|
-
nearest = clean;
|
|
54
|
-
} else if (diff === minDiff) {
|
|
55
|
-
// If equal diff, prefer the larger one? Or smaller?
|
|
56
|
-
// Let's prefer the larger one to be less frequent
|
|
57
|
-
if (clean > nearest) {
|
|
58
|
-
nearest = clean;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return nearest;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function intervalToCron(interval: string): {
|
|
66
|
-
cron: string;
|
|
67
|
-
roundedTo?: string;
|
|
68
|
-
cadence: string;
|
|
69
|
-
} {
|
|
70
|
-
const match = interval.match(/^(\d+)([smhd])$/);
|
|
71
|
-
if (!match) {
|
|
72
|
-
throw new Error(`Invalid interval format: ${interval}`);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
let n = parseInt(match[1], 10);
|
|
76
|
-
const unit = match[2];
|
|
77
|
-
let roundedTo: string | undefined;
|
|
78
|
-
|
|
79
|
-
if (unit === "s") {
|
|
80
|
-
const minutes = Math.ceil(n / 60);
|
|
81
|
-
const result = intervalToCron(`${minutes}m`);
|
|
82
|
-
return {
|
|
83
|
-
...result,
|
|
84
|
-
roundedTo:
|
|
85
|
-
result.roundedTo || (minutes * 60 !== n ? `${minutes}m` : undefined),
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (unit === "m") {
|
|
90
|
-
if (n >= 60) {
|
|
91
|
-
const hours = Math.round(n / 60);
|
|
92
|
-
const result = intervalToCron(`${hours}h`);
|
|
93
|
-
return {
|
|
94
|
-
...result,
|
|
95
|
-
roundedTo:
|
|
96
|
-
result.roundedTo || (hours * 60 !== n ? `${hours}h` : undefined),
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (!CLEAN_MINUTES.includes(n)) {
|
|
101
|
-
const nearest = getNearestClean(n, CLEAN_MINUTES);
|
|
102
|
-
roundedTo = `${nearest}m`;
|
|
103
|
-
n = nearest;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// For minutes, we use */N. Thundering herd is less of an issue for high frequency,
|
|
107
|
-
// but we could still offset it. However, the spec says "random minute for approximate requests like 'hourly'".
|
|
108
|
-
// So for minutes, we'll stick to */N.
|
|
109
|
-
return {
|
|
110
|
-
cron: `*/${n} * * * *`,
|
|
111
|
-
roundedTo,
|
|
112
|
-
cadence: `every ${n} minute${n > 1 ? "s" : ""}`,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (unit === "h") {
|
|
117
|
-
if (n > 23) {
|
|
118
|
-
const days = Math.round(n / 24);
|
|
119
|
-
const result = intervalToCron(`${days}d`);
|
|
120
|
-
return {
|
|
121
|
-
...result,
|
|
122
|
-
roundedTo:
|
|
123
|
-
result.roundedTo || (days * 24 !== n ? `${days}d` : undefined),
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (!CLEAN_HOURS.includes(n)) {
|
|
128
|
-
const nearest = getNearestClean(n, CLEAN_HOURS);
|
|
129
|
-
roundedTo = `${nearest}h`;
|
|
130
|
-
n = nearest;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Thundering herd prevention: pick a random minute
|
|
134
|
-
const randomMinute = Math.floor(Math.random() * 60);
|
|
135
|
-
return {
|
|
136
|
-
cron: `${randomMinute} */${n} * * *`,
|
|
137
|
-
roundedTo,
|
|
138
|
-
cadence: `every ${n} hour${n > 1 ? "s" : ""}`,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (unit === "d") {
|
|
143
|
-
if (![1, 2, 3, 4, 5, 6, 7, 10, 14, 30].includes(n)) {
|
|
144
|
-
// For days, we don't have a strict "clean" list in spec, but let's use some common ones if needed.
|
|
145
|
-
// Actually, cron supports any */N for days.
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Thundering herd prevention: pick a random minute and hour
|
|
149
|
-
const randomMinute = Math.floor(Math.random() * 60);
|
|
150
|
-
const randomHour = Math.floor(Math.random() * 24);
|
|
151
|
-
return {
|
|
152
|
-
cron: `${randomMinute} ${randomHour} */${n} * *`,
|
|
153
|
-
roundedTo,
|
|
154
|
-
cadence: `every ${n} day${n > 1 ? "s" : ""}`,
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
throw new Error(`Unsupported unit: ${unit}`);
|
|
159
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BASH_SUBAGENT_TYPE,
|
|
3
|
-
EXPLORE_SUBAGENT_TYPE,
|
|
4
|
-
PLAN_SUBAGENT_TYPE,
|
|
5
|
-
GENERAL_PURPOSE_SUBAGENT_TYPE,
|
|
6
|
-
} from "../constants/subagents.js";
|
|
7
|
-
import {
|
|
8
|
-
BASH_SUBAGENT_SYSTEM_PROMPT,
|
|
9
|
-
GENERAL_PURPOSE_SYSTEM_PROMPT,
|
|
10
|
-
PLAN_SUBAGENT_SYSTEM_PROMPT,
|
|
11
|
-
EXPLORE_SUBAGENT_SYSTEM_PROMPT,
|
|
12
|
-
} from "../prompts/index.js";
|
|
13
|
-
import {
|
|
14
|
-
BASH_TOOL_NAME,
|
|
15
|
-
GLOB_TOOL_NAME,
|
|
16
|
-
GREP_TOOL_NAME,
|
|
17
|
-
READ_TOOL_NAME,
|
|
18
|
-
LSP_TOOL_NAME,
|
|
19
|
-
} from "../constants/tools.js";
|
|
20
|
-
import type { SubagentConfiguration } from "./subagentParser.js";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Get all built-in subagent configurations
|
|
24
|
-
* Built-in subagents have priority 3 (lowest) and can be overridden by user/project configs
|
|
25
|
-
*/
|
|
26
|
-
export function getBuiltinSubagents(): SubagentConfiguration[] {
|
|
27
|
-
return [
|
|
28
|
-
createBashSubagent(),
|
|
29
|
-
createExploreSubagent(),
|
|
30
|
-
createGeneralPurposeSubagent(),
|
|
31
|
-
createPlanSubagent(),
|
|
32
|
-
// Add more built-in subagents here as needed
|
|
33
|
-
];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Create the Bash built-in subagent configuration
|
|
38
|
-
* Specialized for executing bash commands and git operations
|
|
39
|
-
*/
|
|
40
|
-
function createBashSubagent(): SubagentConfiguration {
|
|
41
|
-
return {
|
|
42
|
-
name: BASH_SUBAGENT_TYPE,
|
|
43
|
-
description:
|
|
44
|
-
"Command execution specialist for running bash commands. Use this for git operations, command execution, and other terminal tasks.",
|
|
45
|
-
systemPrompt: BASH_SUBAGENT_SYSTEM_PROMPT,
|
|
46
|
-
tools: [BASH_TOOL_NAME],
|
|
47
|
-
model: "inherit",
|
|
48
|
-
filePath: `<builtin:${BASH_SUBAGENT_TYPE}>`,
|
|
49
|
-
scope: "builtin",
|
|
50
|
-
priority: 3,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Create the General-Purpose built-in subagent configuration
|
|
56
|
-
* Specialized for multi-step research and implementation tasks
|
|
57
|
-
*/
|
|
58
|
-
function createGeneralPurposeSubagent(): SubagentConfiguration {
|
|
59
|
-
return {
|
|
60
|
-
name: GENERAL_PURPOSE_SUBAGENT_TYPE,
|
|
61
|
-
description:
|
|
62
|
-
"General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you.",
|
|
63
|
-
systemPrompt: GENERAL_PURPOSE_SYSTEM_PROMPT,
|
|
64
|
-
filePath: `<builtin:${GENERAL_PURPOSE_SUBAGENT_TYPE}>`,
|
|
65
|
-
scope: "builtin",
|
|
66
|
-
priority: 3,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Create the Explore built-in subagent configuration
|
|
72
|
-
* Specialized for codebase exploration and file search tasks
|
|
73
|
-
*/
|
|
74
|
-
function createExploreSubagent(): SubagentConfiguration {
|
|
75
|
-
// Define allowed tools for read-only operations
|
|
76
|
-
const allowedTools = [
|
|
77
|
-
GLOB_TOOL_NAME,
|
|
78
|
-
GREP_TOOL_NAME,
|
|
79
|
-
READ_TOOL_NAME,
|
|
80
|
-
BASH_TOOL_NAME,
|
|
81
|
-
LSP_TOOL_NAME,
|
|
82
|
-
];
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
name: EXPLORE_SUBAGENT_TYPE,
|
|
86
|
-
description:
|
|
87
|
-
'Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. "src/components/**/*.tsx"), search code for keywords (eg. "API endpoints"), or answer questions about the codebase (eg. "how do API endpoints work?"). When calling this agent, specify the desired thoroughness level: "quick" for basic searches, "medium" for moderate exploration, or "very thorough" for comprehensive analysis across multiple locations and naming conventions.',
|
|
88
|
-
systemPrompt: EXPLORE_SUBAGENT_SYSTEM_PROMPT,
|
|
89
|
-
tools: allowedTools,
|
|
90
|
-
model: "fastModel", // Special value that will use parent's fastModel
|
|
91
|
-
filePath: `<builtin:${EXPLORE_SUBAGENT_TYPE}>`,
|
|
92
|
-
scope: "builtin",
|
|
93
|
-
priority: 3, // Lowest priority - can be overridden by user configs
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Create the Plan built-in subagent configuration
|
|
99
|
-
* Specialized for designing implementation plans and exploring codebases in read-only mode
|
|
100
|
-
*/
|
|
101
|
-
function createPlanSubagent(): SubagentConfiguration {
|
|
102
|
-
// Define allowed tools for read-only operations
|
|
103
|
-
const allowedTools = [
|
|
104
|
-
GLOB_TOOL_NAME,
|
|
105
|
-
GREP_TOOL_NAME,
|
|
106
|
-
READ_TOOL_NAME,
|
|
107
|
-
BASH_TOOL_NAME,
|
|
108
|
-
LSP_TOOL_NAME,
|
|
109
|
-
];
|
|
110
|
-
|
|
111
|
-
return {
|
|
112
|
-
name: PLAN_SUBAGENT_TYPE,
|
|
113
|
-
description:
|
|
114
|
-
"Software architect agent for designing implementation plans. Use this when you need to plan the implementation strategy for a task. Returns step-by-step plans, identifies critical files, and considers architectural trade-offs.",
|
|
115
|
-
systemPrompt: PLAN_SUBAGENT_SYSTEM_PROMPT,
|
|
116
|
-
tools: allowedTools,
|
|
117
|
-
model: "inherit", // Uses parent agent's model
|
|
118
|
-
filePath: `<builtin:${PLAN_SUBAGENT_TYPE}>`,
|
|
119
|
-
scope: "builtin",
|
|
120
|
-
priority: 3, // Lowest priority - can be overridden by user configs
|
|
121
|
-
};
|
|
122
|
-
}
|
|
File without changes
|