wave-agent-sdk 1.0.9 → 1.0.10

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 (63) hide show
  1. package/dist/builtin/index.d.ts +1 -0
  2. package/dist/builtin/index.js +20 -0
  3. package/dist/builtin/plugins.d.ts +1 -0
  4. package/dist/builtin/plugins.js +225 -0
  5. package/dist/builtin/skills/artifact.d.ts +1 -0
  6. package/dist/builtin/skills/artifact.js +18 -0
  7. package/dist/builtin/skills/code-review.d.ts +1 -0
  8. package/{builtin/skills/code-review/SKILL.md → dist/builtin/skills/code-review.js} +23 -19
  9. package/dist/builtin/skills/deep-research.d.ts +1 -0
  10. package/{builtin/skills/deep-research/SKILL.md → dist/builtin/skills/deep-research.js} +18 -14
  11. package/dist/builtin/skills/init.d.ts +1 -0
  12. package/{builtin/skills/init/SKILL.md → dist/builtin/skills/init.js} +6 -3
  13. package/dist/builtin/skills/loop.d.ts +1 -0
  14. package/dist/builtin/skills/loop.js +83 -0
  15. package/dist/builtin/skills/settings.d.ts +1 -0
  16. package/dist/builtin/skills/settings.js +1224 -0
  17. package/dist/builtin/skills/simplify.d.ts +1 -0
  18. package/{builtin/skills/simplify/SKILL.md → dist/builtin/skills/simplify.js} +7 -3
  19. package/dist/builtin/subagents.d.ts +1 -0
  20. package/dist/builtin/subagents.js +164 -0
  21. package/dist/managers/aiManager.js +18 -1
  22. package/dist/managers/mcpManager.js +1 -1
  23. package/dist/managers/messageManager.d.ts +6 -0
  24. package/dist/managers/messageManager.js +33 -0
  25. package/dist/managers/subagentManager.d.ts +8 -0
  26. package/dist/managers/subagentManager.js +57 -2
  27. package/dist/tools/editTool.js +1 -0
  28. package/dist/tools/readTool.js +6 -3
  29. package/dist/tools/types.d.ts +1 -0
  30. package/dist/tools/writeTool.js +1 -0
  31. package/dist/types/messaging.d.ts +1 -0
  32. package/dist/utils/builtinEmbed.d.ts +21 -0
  33. package/dist/utils/builtinEmbed.js +53 -0
  34. package/dist/utils/configPaths.d.ts +0 -1
  35. package/dist/utils/configPaths.js +5 -26
  36. package/dist/utils/convertMessagesForAPI.js +21 -2
  37. package/dist/utils/messageOperations.d.ts +1 -0
  38. package/dist/utils/toolImagePersistence.d.ts +25 -0
  39. package/dist/utils/toolImagePersistence.js +56 -0
  40. package/package.json +1 -3
  41. package/builtin/plugins/sdd/.wave-plugin/plugin.json +0 -8
  42. package/builtin/plugins/sdd/hooks/hooks.json +0 -14
  43. package/builtin/plugins/sdd/scripts/session-start.js +0 -24
  44. package/builtin/plugins/sdd/scripts/spec-count.js +0 -77
  45. package/builtin/plugins/sdd/skills/specify/SKILL.md +0 -47
  46. package/builtin/plugins/sdd/skills/specify/templates/spec-template.md +0 -47
  47. package/builtin/skills/artifact/SKILL.md +0 -14
  48. package/builtin/skills/loop/SKILL.md +0 -79
  49. package/builtin/skills/settings/ENV.md +0 -78
  50. package/builtin/skills/settings/HOOKS.md +0 -227
  51. package/builtin/skills/settings/MCP.md +0 -137
  52. package/builtin/skills/settings/MEMORY.md +0 -76
  53. package/builtin/skills/settings/MODELS.md +0 -119
  54. package/builtin/skills/settings/PERMISSIONS.md +0 -88
  55. package/builtin/skills/settings/PLUGINS.md +0 -171
  56. package/builtin/skills/settings/SKILL.md +0 -132
  57. package/builtin/skills/settings/SKILLS.md +0 -107
  58. package/builtin/skills/settings/SUBAGENTS.md +0 -77
  59. package/builtin/subagents/bash.md +0 -19
  60. package/builtin/subagents/explore.md +0 -43
  61. package/builtin/subagents/general-purpose.md +0 -20
  62. package/builtin/subagents/plan.md +0 -56
  63. package/builtin/subagents/vision.md +0 -18
@@ -0,0 +1 @@
1
+ export declare const BUILTIN_CONTENT: Record<string, string>;
@@ -0,0 +1,20 @@
1
+ import { artifactSkill } from "./skills/artifact.js";
2
+ import { code_reviewSkill } from "./skills/code-review.js";
3
+ import { deep_researchSkill } from "./skills/deep-research.js";
4
+ import { initSkill } from "./skills/init.js";
5
+ import { loopSkill } from "./skills/loop.js";
6
+ import { simplifySkill } from "./skills/simplify.js";
7
+ import { settingsSkills } from "./skills/settings.js";
8
+ import { subagents } from "./subagents.js";
9
+ import { sddPlugin } from "./plugins.js";
10
+ export const BUILTIN_CONTENT = {
11
+ ...artifactSkill,
12
+ ...code_reviewSkill,
13
+ ...deep_researchSkill,
14
+ ...initSkill,
15
+ ...loopSkill,
16
+ ...simplifySkill,
17
+ ...settingsSkills,
18
+ ...subagents,
19
+ ...sddPlugin,
20
+ };
@@ -0,0 +1 @@
1
+ export declare const sddPlugin: Record<string, string>;
@@ -0,0 +1,225 @@
1
+ export const sddPlugin = {
2
+ "plugins/sdd/.wave-plugin/plugin.json": `{
3
+ "name": "sdd",
4
+ "description": "Spec-first workflow: specify skill, SessionStart guidance, and spec-count validation.",
5
+ "version": "1.0.0",
6
+ "author": {
7
+ "name": "Wave Team"
8
+ }
9
+ }
10
+ `,
11
+ "plugins/sdd/hooks/hooks.json": `{
12
+ "hooks": {
13
+ "SessionStart": [
14
+ {
15
+ "hooks": [
16
+ {
17
+ "type": "command",
18
+ "command": "node \\"\${WAVE_PLUGIN_ROOT}/scripts/session-start.js\\""
19
+ }
20
+ ]
21
+ }
22
+ ]
23
+ }
24
+ }
25
+ `,
26
+ "plugins/sdd/scripts/session-start.js": `#!/usr/bin/env node
27
+ // SessionStart hook for the sdd built-in plugin.
28
+ // Emits the spec-first workflow guidance as additionalContext (JSON form),
29
+ // resolving the absolute path to the plugin's spec-count validator so the
30
+ // agent can run it from its bash tool (which does not carry WAVE_PLUGIN_ROOT).
31
+ import path from "node:path";
32
+
33
+ const root =
34
+ process.env.WAVE_PLUGIN_ROOT ||
35
+ path.dirname(new URL("..", import.meta.url).pathname);
36
+ const specCount = \`node \${JSON.stringify(path.join(root, "scripts", "spec-count.js"))}\`;
37
+
38
+ const guidance = [
39
+ "Spec-First Workflow(规格优先工作流):",
40
+ "- 需求增加或变更时,优先更新 spec:先更新对应规格说明(新增用户故事、验收场景),待用户确认 spec 后再实现代码。spec 是功能设计的权威来源,不是 changelog。",
41
+ "- 边界模糊时也先写 spec 草稿请用户确认,不要直接改代码。",
42
+ "- 规格编写技能(specify)由 AI 自动触发:对话中涉及新需求或需求变更时主动创建或更新规格文件,不需要用户手动调用(不出现在斜杠命令列表中)。",
43
+ \`- 新增或修改 spec 后运行校验:\${specCount}(自动检测 docs/specs/,否则 specs/,否则退出)。\`,
44
+ ].join("\\n");
45
+
46
+ // JSON form → parsed as hookSpecificOutput.additionalContext by the hook manager.
47
+ console.log(
48
+ JSON.stringify({ hookSpecificOutput: { additionalContext: guidance } }),
49
+ );
50
+ `,
51
+ "plugins/sdd/scripts/spec-count.js": `#!/usr/bin/env node
52
+ // Generic, self-contained spec validator. Counts user stories and acceptance
53
+ // scenarios under the project's specs directory and warns on missing sections.
54
+ // Detects the specs dir: prefers docs/specs/, else specs/, else exits gracefully.
55
+ // No dependency on any project's VitePress/docs-site modules.
56
+ import fs from "node:fs";
57
+ import path from "node:path";
58
+
59
+ function detectSpecsDir() {
60
+ for (const dir of ["docs/specs", "specs"]) {
61
+ const resolved = path.resolve(process.cwd(), dir);
62
+ if (fs.existsSync(resolved)) return resolved;
63
+ }
64
+ return null;
65
+ }
66
+
67
+ function walk(dir, out = []) {
68
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
69
+ const fullPath = path.join(dir, entry.name);
70
+ if (entry.isDirectory()) walk(fullPath, out);
71
+ else if (entry.isFile() && entry.name.endsWith(".md")) out.push(fullPath);
72
+ }
73
+ return out;
74
+ }
75
+
76
+ function countUserStories(content) {
77
+ const m = content.match(/^### 用户故事[::]/gm);
78
+ return m ? m.length : 0;
79
+ }
80
+
81
+ function countAcceptanceScenarios(content) {
82
+ const m = content.match(/^\\d+\\.\\s+\\*\\*假设\\*\\*/gm);
83
+ return m ? m.length : 0;
84
+ }
85
+
86
+ const specsDir = detectSpecsDir();
87
+ if (!specsDir) {
88
+ console.log("未找到规格目录(docs/specs/ 或 specs/),跳过校验。");
89
+ process.exit(0);
90
+ }
91
+
92
+ const files = walk(specsDir).sort();
93
+ const totals = { specs: 0, us: 0, ac: 0 };
94
+ const warnings = [];
95
+
96
+ // index.md is conventionally a directory listing page, not a spec — skip it.
97
+ const specFiles = files.filter(
98
+ (fp) => path.basename(fp).toLowerCase() !== "index.md",
99
+ );
100
+
101
+ for (const fp of specFiles) {
102
+ const content = fs.readFileSync(fp, "utf-8");
103
+ const usCount = countUserStories(content);
104
+ const acCount = countAcceptanceScenarios(content);
105
+ const rel = path.relative(process.cwd(), fp);
106
+ totals.specs++;
107
+ totals.us += usCount;
108
+ totals.ac += acCount;
109
+ if (!content.match(/^## 用户场景与测试/m))
110
+ warnings.push(\`\${rel}: 缺少 "## 用户场景与测试" 章节\`);
111
+ if (usCount === 0)
112
+ warnings.push(\`\${rel}: 未找到用户故事(期望 \\\`### 用户故事:\\\`)\`);
113
+ if (acCount === 0)
114
+ warnings.push(
115
+ \`\${rel}: 未找到验收场景(期望 \\\`N. **假设** … **当** … **则** …\\\`)\`,
116
+ );
117
+ console.log(\`\${rel} 用户故事: \${usCount} 验收场景: \${acCount}\`);
118
+ }
119
+
120
+ console.log("---");
121
+ console.log(
122
+ \`规格: \${totals.specs} 用户故事: \${totals.us} 验收场景: \${totals.ac}\`,
123
+ );
124
+ if (warnings.length) {
125
+ for (const w of warnings) console.warn(\`⚠ \${w}\`);
126
+ console.warn(\`⚠ \${warnings.length} 条模板警告——见上方。\`);
127
+ }
128
+ `,
129
+ "plugins/sdd/skills/specify/SKILL.md": `---
130
+ name: specify
131
+ description: 根据自然语言描述创建或更新功能规格说明,生成包含用户故事与验收场景的规格文件。
132
+ user-invocable: false
133
+ ---
134
+
135
+ ## 用户输入
136
+
137
+ \`\`\`text
138
+ $ARGUMENTS
139
+ \`\`\`
140
+
141
+ ## 流程
142
+
143
+ 本技能由 AI 在会话中自动触发(不占用手动斜杠命令)。触发时机:用户提出新的需求、修改需求或涉及功能边界时,若对应规格尚未创建或已过期,则主动创建或更新规格说明。$ARGUMENTS 通常为空——需求描述直接来自对话上下文,不要让用户重复。
144
+
145
+ 根据对话中的功能描述,执行以下步骤:
146
+
147
+ 1. **确定规格文件路径**:
148
+ - **确定规格根目录**:优先复用项目中已有的规格目录——若 \`docs/specs/\` 存在则用之,否则若 \`specs/\` 存在则用之,否则默认 \`specs/\`(并在完成报告中说明所选目录,便于用户纠正)。
149
+ - **选择分组**:若规格目录下已有分组子目录,沿用其既有分组约定;否则默认扁平结构(直接放在规格根目录下)。
150
+ - 根据功能描述生成 2-4 个词的 slug(小写、连字符、保留缩写词),与组内已有文件名不冲突
151
+ - 规格文件路径:\`<规格根目录>/<分组>/<slug>.md\`(无分组时为 \`<规格根目录>/<slug>.md\`)
152
+
153
+ 2. **加载模板** \`\${WAVE_SKILL_DIR}/templates/spec-template.md\`,了解必需章节。
154
+
155
+ 3. **编写规格说明**:
156
+ - 解析用户描述,提取关键概念:角色、操作、数据、约束
157
+ - 对于不明确的部分,根据上下文和行业标准做出合理推断
158
+ - 仅在关键决策处标记 \`[待澄清:具体问题]\`(最多 3 处)
159
+ - 填写 frontmatter(\`name\` 为功能中文名、\`description\` 为一句话简述、\`order\` 为控制组内排序的数字)
160
+ - 填写「用户场景与测试」章节,包含按优先级排序的用户故事(P1、P2、P3...),每个故事以「作为…,我希望…,以便…」描述,附 \`**为什么是这个优先级**\` 与 \`**独立测试**\`(不适用的可省略)
161
+ - 为每个用户故事编写可测试的验收场景(**假设** … **当** … **则** …)
162
+ - 写入规格文件,替换所有占位符
163
+
164
+ 4. **如果存在 \`[待澄清]\` 标记**(最多 3 处):
165
+ - 将每个标记作为问题展示,附带建议答案
166
+ - 等待用户回复后更新规格文件
167
+
168
+ 5. 报告完成,输出规格文件路径。
169
+
170
+ ## 指南
171
+
172
+ - 关注用户**需要什麼**和**为什么**,而非如何实现
173
+ - 不包含实现细节(不涉及技术栈、API、代码结构)
174
+ - 每个验收场景必须可测试、无歧义
175
+ - 删除不适用的可选章节(不要留 "N/A")
176
+ `,
177
+ "plugins/sdd/skills/specify/templates/spec-template.md": `---
178
+ name: "[功能名称]"
179
+ description: "[一句话简短描述]"
180
+ order: [数字,控制组内排序]
181
+ ---
182
+
183
+ # 功能规格说明:[功能名称]
184
+
185
+ **创建日期**:[日期]
186
+
187
+ ## 用户场景与测试 *(必填)*
188
+
189
+ ### 用户故事:[简要标题](优先级:P1)
190
+
191
+ 作为[角色],我希望[操作],以便[价值/目的]。
192
+
193
+ **为什么是这个优先级**:[解释其价值以及为何具有此优先级]
194
+
195
+ **独立测试**:[描述如何独立测试——例如,"可以通过 [具体操作] 进行完整测试,并交付 [具体价值]"]
196
+
197
+ **验收场景**:
198
+
199
+ 1. **假设** [初始状态],**当** [操作],**则** [预期结果]
200
+ 2. **假设** [初始状态],**当** [操作],**则** [预期结果]
201
+
202
+ ---
203
+
204
+ ### 用户故事:[简要标题](优先级:P2)
205
+
206
+ 作为[角色],我希望[操作],以便[价值/目的]。
207
+
208
+ **为什么是这个优先级**:[解释其价值以及为何具有此优先级]
209
+
210
+ **独立测试**:[描述如何独立测试]
211
+
212
+ **验收场景**:
213
+
214
+ 1. **假设** [初始状态],**当** [操作],**则** [预期结果]
215
+
216
+ ---
217
+
218
+ [根据需要添加更多用户故事,每个都分配优先级]
219
+
220
+ ### 边界情况
221
+
222
+ - **[问题?]** [答案/处理方式]
223
+ - **[问题?]** [答案/处理方式]
224
+ `,
225
+ };
@@ -0,0 +1 @@
1
+ export declare const artifactSkill: Record<string, string>;
@@ -0,0 +1,18 @@
1
+ import { ARTIFACT_TOOL_NAME } from "../../constants/tools.js";
2
+ export const artifactSkill = {
3
+ "skills/artifact/SKILL.md": `---
4
+ name: artifact
5
+ description: Publish a local HTML or Markdown file as a shareable web page
6
+ disable-model-invocation: true
7
+ ---
8
+
9
+ # Artifact: Publish a File as a Shareable Web Page
10
+
11
+ Publish a local \`.html\` or \`.md\` file as a default-private, shareable web page.
12
+
13
+ - If a file path was provided ($ARGUMENTS / $1), use it directly as the \`file_path\`.
14
+ - Otherwise, infer which file to publish from the conversation context; if it is not clear, ask the user which file to publish.
15
+
16
+ Call the \`${ARTIFACT_TOOL_NAME}\` tool with the resolved \`file_path\` (and \`favicon\` if relevant), then report the resulting URL to the user.
17
+ `,
18
+ };
@@ -0,0 +1 @@
1
+ export declare const code_reviewSkill: Record<string, string>;
@@ -1,7 +1,9 @@
1
- ---
1
+ import { AGENT_TOOL_NAME, BASH_TOOL_NAME, GLOB_TOOL_NAME, GREP_TOOL_NAME, READ_TOOL_NAME, } from "../../constants/tools.js";
2
+ export const code_reviewSkill = {
3
+ "skills/code-review/SKILL.md": `---
2
4
  name: code-review
3
5
  description: Review the current diff for correctness bugs and reuse/simplification/efficiency cleanups at the given effort level (low/medium: fewer, high-confidence findings; high/max: broader coverage, may include lower-confidence findings)
4
- allowed-tools: Bash(git diff:*), Bash(git status:*), Bash(git log:*), Bash(git show:*), Bash(git blame:*), Bash(git remote:*), Bash(command -v:*), Bash(gh pr comment:*), Bash(gh pr view:*), Bash(glab mr note:*), Bash(glab mr view:*), Read, Glob, Grep, Agent
6
+ allowed-tools: ${BASH_TOOL_NAME}(git diff:*), ${BASH_TOOL_NAME}(git status:*), ${BASH_TOOL_NAME}(git log:*), ${BASH_TOOL_NAME}(git show:*), ${BASH_TOOL_NAME}(git blame:*), ${BASH_TOOL_NAME}(git remote:*), ${BASH_TOOL_NAME}(command -v:*), ${BASH_TOOL_NAME}(gh pr comment:*), ${BASH_TOOL_NAME}(gh pr view:*), ${BASH_TOOL_NAME}(glab mr note:*), ${BASH_TOOL_NAME}(glab mr view:*), ${READ_TOOL_NAME}, ${GLOB_TOOL_NAME}, ${GREP_TOOL_NAME}, ${AGENT_TOOL_NAME}
5
7
  disable-model-invocation: true
6
8
  ---
7
9
 
@@ -13,25 +15,25 @@ Review the current branch's changes for correctness bugs and quality issues.
13
15
 
14
16
  First, collect the diff and metadata:
15
17
 
16
- ```
18
+ \`\`\`
17
19
  GIT STATUS:
18
- !`git status`
20
+ !\`git status\`
19
21
 
20
22
  FILES MODIFIED:
21
- !`git diff --name-only $(git merge-base HEAD main)...HEAD 2>/dev/null || git diff --name-only HEAD~1...HEAD`
23
+ !\`git diff --name-only $(git merge-base HEAD main)...HEAD 2>/dev/null || git diff --name-only HEAD~1...HEAD\`
22
24
 
23
25
  COMMITS:
24
- !`git log --no-decorate $(git merge-base HEAD main 2>/dev/null || echo HEAD~1)...HEAD`
26
+ !\`git log --no-decorate $(git merge-base HEAD main 2>/dev/null || echo HEAD~1)...HEAD\`
25
27
 
26
28
  DIFF CONTENT:
27
- !`git diff $(git merge-base HEAD main 2>/dev/null || echo HEAD~1)...HEAD`
28
- ```
29
+ !\`git diff $(git merge-base HEAD main 2>/dev/null || echo HEAD~1)...HEAD\`
30
+ \`\`\`
29
31
 
30
32
  If there are no changes, stop and tell the user.
31
33
 
32
34
  ## Phase 2: Determine Effort Level
33
35
 
34
- Parse `$ARGUMENTS` for an effort level:
36
+ Parse \`$ARGUMENTS\` for an effort level:
35
37
  - **low**: Launch 2 agents, confidence threshold 90 (only near-certain findings)
36
38
  - **medium** (default): Launch 3 agents, confidence threshold 80
37
39
  - **high**: Launch 4 agents, confidence threshold 70
@@ -39,7 +41,7 @@ Parse `$ARGUMENTS` for an effort level:
39
41
 
40
42
  ## Phase 3: Launch Review Agents in Parallel
41
43
 
42
- Use the Agent tool to launch all agents concurrently in a single message. Pass each agent the full diff so it has the complete context.
44
+ Use the ${AGENT_TOOL_NAME} tool to launch all agents concurrently in a single message. Pass each agent the full diff so it has the complete context.
43
45
 
44
46
  ### Agent 1: Bug Scanner (all effort levels)
45
47
 
@@ -63,7 +65,7 @@ Review the changes for efficiency: unnecessary work, missed concurrency, hot-pat
63
65
 
64
66
  ## Phase 4: Confidence Scoring
65
67
 
66
- For each issue found in Phase 3, launch a parallel Agent to independently score the issue. The scoring agent receives the PR diff, the issue description, and the list of AGENTS.md files (if any). It returns a confidence score from 0-100.
68
+ For each issue found in Phase 3, launch a parallel ${AGENT_TOOL_NAME} to independently score the issue. The scoring agent receives the PR diff, the issue description, and the list of AGENTS.md files (if any). It returns a confidence score from 0-100.
67
69
 
68
70
  Give the scoring agent this rubric verbatim:
69
71
 
@@ -79,18 +81,18 @@ Give the scoring agent this rubric verbatim:
79
81
  2. If no issues remain, say so and stop — do not post anything.
80
82
  3. Otherwise, detect the platform and CLI availability:
81
83
 
82
- ```
84
+ \`\`\`
83
85
  REMOTE URL:
84
- !`git remote get-url origin 2>/dev/null || echo "no-remote"`
86
+ !\`git remote get-url origin 2>/dev/null || echo "no-remote"\`
85
87
 
86
88
  GH CLI:
87
- !`command -v gh 2>/dev/null || echo "not-installed"`
89
+ !\`command -v gh 2>/dev/null || echo "not-installed"\`
88
90
 
89
91
  GLAB CLI:
90
- !`command -v glab 2>/dev/null || echo "not-installed"`
91
- ```
92
+ !\`command -v glab 2>/dev/null || echo "not-installed"\`
93
+ \`\`\`
92
94
 
93
- 4. **Post as comment** (preferred): If the remote URL contains `github` and `gh` is installed, check if a PR exists for the current branch (`gh pr view --json number`), then post the review as a comment: `gh pr comment --body "<review content>"`. If the remote URL contains `gitlab` and `glab` is installed, check if an MR exists for the current branch (`glab mr view`), then post the review as a note: `glab mr note --message "<review content>"`.
95
+ 4. **Post as comment** (preferred): If the remote URL contains \`github\` and \`gh\` is installed, check if a PR exists for the current branch (\`gh pr view --json number\`), then post the review as a comment: \`gh pr comment --body "<review content>"\`. If the remote URL contains \`gitlab\` and \`glab\` is installed, check if an MR exists for the current branch (\`glab mr view\`), then post the review as a note: \`glab mr note --message "<review content>"\`.
94
96
  5. **Output directly** (fallback): If no CLI is installed, no PR/MR exists, or the platform is unrecognized, output the findings directly instead.
95
97
 
96
98
  Whether posting or outputting, use this format:
@@ -103,11 +105,11 @@ Found N issues:
103
105
 
104
106
  1. <brief description of bug> (AGENTS.md says "<...>")
105
107
 
106
- `<file>:<line range>`
108
+ \`<file>:<line range>\`
107
109
 
108
110
  2. <brief description of bug> (bug due to <file and code snippet>)
109
111
 
110
- `<file>:<line range>`
112
+ \`<file>:<line range>\`
111
113
 
112
114
  ---
113
115
 
@@ -135,3 +137,5 @@ Examples of false positives to exclude:
135
137
  ## Input
136
138
 
137
139
  $ARGUMENTS
140
+ `,
141
+ };
@@ -0,0 +1 @@
1
+ export declare const deep_researchSkill: Record<string, string>;
@@ -1,4 +1,6 @@
1
- ---
1
+ import { WORKFLOW_TOOL_NAME } from "../../constants/tools.js";
2
+ export const deep_researchSkill = {
3
+ "skills/deep-research/SKILL.md": `---
2
4
  name: deep-research
3
5
  description: Deep research harness — fan-out web searches, fetch sources, adversarially verify claims, synthesize a cited report
4
6
  context: fork
@@ -8,9 +10,9 @@ Deep research harness — fan-out web searches, fetch sources, adversarially ver
8
10
 
9
11
  BEFORE invoking the workflow, check if the question is specific enough to research directly — if underspecified (e.g., "what car to buy" without budget/use-case/region), ask 2-3 clarifying questions to narrow scope. Then pass the refined question as args, weaving the answers in.
10
12
 
11
- 1. Call the Workflow tool with the following script, passing the user's question as the `args` parameter:
13
+ 1. Call the ${WORKFLOW_TOOL_NAME} tool with the following script, passing the user's question as the \`args\` parameter:
12
14
 
13
- ```
15
+ \`\`\`
14
16
  export const meta = {
15
17
  name: 'deep-research',
16
18
  description: 'Deep research harness — fan-out web searches, fetch sources, adversarially verify claims, synthesize a cited report',
@@ -27,12 +29,12 @@ const question = args
27
29
 
28
30
  phase('Scope')
29
31
  const angles = await agent(
30
- 'Decompose this research question into exactly 5 distinct search angles that together provide comprehensive coverage: "' + question + '"\n\nReturn a JSON array of 5 short angle labels. Example: ["overview and background", "technical details and specifications", "recent developments and news", "alternative perspectives and criticisms", "practical implications and case studies"]',
32
+ 'Decompose this research question into exactly 5 distinct search angles that together provide comprehensive coverage: "' + question + '"\\n\\nReturn a JSON array of 5 short angle labels. Example: ["overview and background", "technical details and specifications", "recent developments and news", "alternative perspectives and criticisms", "practical implications and case studies"]',
31
33
  { label: 'scope', phase: 'Scope' }
32
34
  )
33
35
  const angleList = (() => {
34
36
  try {
35
- const match = String(angles).match(/\[[\s\S]*\]/)
37
+ const match = String(angles).match(/\\[[\\s\\S]*\\]/)
36
38
  return match ? JSON.parse(match[0]) : ['overview', 'technical details', 'recent developments', 'alternative perspectives', 'practical implications']
37
39
  } catch { return ['overview', 'technical details', 'recent developments', 'alternative perspectives', 'practical implications'] }
38
40
  })()
@@ -48,8 +50,8 @@ const searches = await parallel(angleList.map(angle => () =>
48
50
  phase('Fetch')
49
51
  const allUrls = searches.filter(Boolean).flatMap(r => {
50
52
  if (typeof r !== 'string') return []
51
- return r.split('\n').filter(l => l.trim().startsWith('http') || l.trim().startsWith('- http'))
52
- }).map(u => u.replace(/^-\s*/, '').trim())
53
+ return r.split('\\n').filter(l => l.trim().startsWith('http') || l.trim().startsWith('- http'))
54
+ }).map(u => u.replace(/^-\\s*/, '').trim())
53
55
  const sources = [...new Set(allUrls)].slice(0, 15)
54
56
  const fetched = await pipeline(sources.length > 0 ? sources : ['No specific URLs found — synthesize from search results'], source =>
55
57
  agent('Fetch and extract key falsifiable claims from: ' + source + '. For each claim, note the source URL and whether it is supported by evidence. Return each claim as a separate bullet.', {
@@ -59,12 +61,12 @@ const fetched = await pipeline(sources.length > 0 ? sources : ['No specific URLs
59
61
  )
60
62
 
61
63
  phase('Verify')
62
- const claimsText = fetched.filter(Boolean).join('\n')
63
- const claimLines = claimsText.split('\n').filter(l => l.trim().startsWith('-') || l.trim().startsWith('•') || l.trim().startsWith('*'))
64
+ const claimsText = fetched.filter(Boolean).join('\\n')
65
+ const claimLines = claimsText.split('\\n').filter(l => l.trim().startsWith('-') || l.trim().startsWith('•') || l.trim().startsWith('*'))
64
66
  const claimsToVerify = claimLines.length > 0 ? claimLines : [claimsText]
65
67
  const verified = await parallel(claimsToVerify.slice(0, 12).map((claim, i) => () =>
66
68
  parallel([0, 1, 2].map(voteIdx => () =>
67
- agent('You are a skeptical fact-checker (vote ' + (voteIdx + 1) + '/3). For the following claim, search for evidence that REFUTES it. Claim: "' + claim + '"\n\nIf you find strong evidence against it, respond REFUTED with the counter-evidence. If the claim holds up, respond CONFIRMED. Be rigorous — only refute if you find direct contradictory evidence.', {
69
+ agent('You are a skeptical fact-checker (vote ' + (voteIdx + 1) + '/3). For the following claim, search for evidence that REFUTES it. Claim: "' + claim + '"\\n\\nIf you find strong evidence against it, respond REFUTED with the counter-evidence. If the claim holds up, respond CONFIRMED. Be rigorous — only refute if you find direct contradictory evidence.', {
68
70
  label: 'verify:claim' + i + ':vote' + voteIdx,
69
71
  phase: 'Verify'
70
72
  })
@@ -77,14 +79,16 @@ const verifiedClaims = verified.flatMap((votes, i) => {
77
79
  })
78
80
 
79
81
  phase('Synthesize')
80
- const confirmedClaims = verifiedClaims.filter(c => c.status === 'confirmed').map(c => c.claim).join('\n')
81
- const contestedClaims = verifiedClaims.filter(c => c.status === 'contested').map(c => c.claim + ' (contested)').join('\n')
82
+ const confirmedClaims = verifiedClaims.filter(c => c.status === 'confirmed').map(c => c.claim).join('\\n')
83
+ const contestedClaims = verifiedClaims.filter(c => c.status === 'contested').map(c => c.claim + ' (contested)').join('\\n')
82
84
  const report = await agent(
83
- 'Synthesize a comprehensive cited report answering: "' + question + '".\n\nConfirmed claims:\n' + (confirmedClaims || 'None') + '\n\nContested claims (include with caveat):\n' + (contestedClaims || 'None') + '\n\nMerge semantic duplicates. Rank findings by confidence level. Include: 1) Executive summary 2) Key findings with citations, ranked by confidence 3) Contested findings (with caveats) 4) Areas of uncertainty 5) Conclusion.',
85
+ 'Synthesize a comprehensive cited report answering: "' + question + '".\\n\\nConfirmed claims:\\n' + (confirmedClaims || 'None') + '\\n\\nContested claims (include with caveat):\\n' + (contestedClaims || 'None') + '\\n\\nMerge semantic duplicates. Rank findings by confidence level. Include: 1) Executive summary 2) Key findings with citations, ranked by confidence 3) Contested findings (with caveats) 4) Areas of uncertainty 5) Conclusion.',
84
86
  { label: 'synthesize', phase: 'Synthesize' }
85
87
  )
86
88
 
87
89
  return report
88
- ```
90
+ \`\`\`
89
91
 
90
92
  2. After the workflow starts, inform the user that deep research is running and they can use /workflows to monitor progress.
93
+ `,
94
+ };
@@ -0,0 +1 @@
1
+ export declare const initSkill: Record<string, string>;
@@ -1,4 +1,5 @@
1
- ---
1
+ export const initSkill = {
2
+ "skills/init/SKILL.md": `---
2
3
  name: init
3
4
  description: Analyze the codebase and create an AGENTS.md file to guide future agents.
4
5
  disable-model-invocation: true
@@ -21,8 +22,10 @@ Usage notes:
21
22
  - Do not make up information such as "Common Development Tasks", "Tips for Development", "Support and Documentation" unless this is expressly included in other files that you read.
22
23
  - Be sure to prefix the file with the following text:
23
24
 
24
- ```
25
+ \`\`\`
25
26
  # AGENTS.md
26
27
 
27
28
  This file provides guidance to Agent when working with code in this repository.
28
- ```
29
+ \`\`\`
30
+ `,
31
+ };
@@ -0,0 +1 @@
1
+ export declare const loopSkill: Record<string, string>;
@@ -0,0 +1,83 @@
1
+ import { CRON_CREATE_TOOL_NAME, CRON_DELETE_TOOL_NAME, SKILL_TOOL_NAME, } from "../../constants/tools.js";
2
+ export const loopSkill = {
3
+ "skills/loop/SKILL.md": `---
4
+ name: loop
5
+ description: Run a prompt or slash command on a recurring interval (e.g. /loop 5m /foo, defaults to 10m)
6
+ allowed-tools: ${CRON_CREATE_TOOL_NAME}, ${SKILL_TOOL_NAME}
7
+ user-invocable: true
8
+ ---
9
+
10
+ # /loop — schedule a recurring prompt
11
+
12
+ Parse the input below into \`[interval] <prompt…>\` and schedule it with ${CRON_CREATE_TOOL_NAME}.
13
+
14
+ ## Usage
15
+
16
+ \`\`\`
17
+ /loop [interval] <prompt>
18
+
19
+ Run a prompt or slash command on a recurring interval.
20
+
21
+ Intervals: Ns, Nm, Nh, Nd (e.g. 5m, 30m, 2h, 1d). Minimum granularity is 1 minute.
22
+ If no interval is specified, defaults to 10m.
23
+
24
+ Examples:
25
+ /loop 5m /babysit-prs
26
+ /loop 30m check the deploy
27
+ /loop 1h /standup 1
28
+ /loop check the deploy (defaults to 10m)
29
+ /loop check the deploy every 20m
30
+ \`\`\`
31
+
32
+ ## Parsing (in priority order)
33
+
34
+ 1. **Leading token**: if the first whitespace-delimited token matches \`^\\d+[smhd]$\` (e.g. \`5m\`, \`2h\`), that's the interval; the rest is the prompt.
35
+ 2. **Trailing "every" clause**: otherwise, if the input ends with \`every <N><unit>\` or \`every <N> <unit-word>\` (e.g. \`every 20m\`, \`every 5 minutes\`, \`every 2 hours\`), extract that as the interval and strip it from the prompt. Only match when what follows "every" is a time expression — \`check every PR\` has no interval.
36
+ 3. **Default**: otherwise, interval is \`10m\` and the entire input is the prompt.
37
+
38
+ If the resulting prompt is empty, show usage \`/loop [interval] <prompt>\` and stop — do not call ${CRON_CREATE_TOOL_NAME}.
39
+
40
+ Examples:
41
+ - \`5m /babysit-prs\` → interval \`5m\`, prompt \`/babysit-prs\` (rule 1)
42
+ - \`check the deploy every 20m\` → interval \`20m\`, prompt \`check the deploy\` (rule 2)
43
+ - \`run tests every 5 minutes\` → interval \`5m\`, prompt \`run tests\` (rule 2)
44
+ - \`check the deploy\` → interval \`10m\`, prompt \`check the deploy\` (rule 3)
45
+ - \`check every PR\` → interval \`10m\`, prompt \`check every PR\` (rule 3 — "every" not followed by time)
46
+ - \`5m\` → empty prompt → show usage
47
+
48
+ ## Interval → cron
49
+
50
+ Supported suffixes: \`s\` (seconds, rounded up to nearest minute, min 1), \`m\` (minutes), \`h\` (hours), \`d\` (days). Convert:
51
+
52
+ | Interval pattern | Cron expression | Notes |
53
+ |-----------------------|---------------------|------------------------------------------|
54
+ | \`Nm\` where N ≤ 59 | \`*/N * * * *\` | every N minutes |
55
+ | \`Nm\` where N ≥ 60 | \`0 */H * * *\` | round to hours (H = N/60, must divide 24)|
56
+ | \`Nh\` where N ≤ 23 | \`0 */N * * *\` | every N hours |
57
+ | \`Nd\` | \`0 0 */N * *\` | every N days at midnight local |
58
+ | \`Ns\` | treat as \`ceil(N/60)m\` | cron minimum granularity is 1 minute |
59
+
60
+ **If the interval doesn't cleanly divide its unit** (e.g. \`7m\` → \`*/7 * * * *\` gives uneven gaps at :56→:00; \`90m\` → 1.5h which cron can't express), pick the nearest clean interval and tell the user what you rounded to before scheduling.
61
+
62
+ ## Avoid the :00 and :30 minute marks
63
+
64
+ When the user's request is approximate, pick a minute that is NOT 0 or 30:
65
+ - "every morning around 9" → \`57 8 * * *\` or \`3 9 * * *\` (not \`0 9 * * *\`)
66
+ - "hourly" → \`7 * * * *\` (not \`0 * * * *\`)
67
+
68
+ Only use minute 0 or 30 when the user names that exact time and clearly means it ("at 9:00 sharp", "at half past").
69
+
70
+ ## Action
71
+
72
+ 1. Call ${CRON_CREATE_TOOL_NAME} with:
73
+ - \`cron\`: the expression from the table above
74
+ - \`prompt\`: the parsed prompt from above, verbatim (slash commands are passed through unchanged)
75
+ - \`recurring\`: \`true\`
76
+ 2. Briefly confirm: what's scheduled, the cron expression, the human-readable cadence, that recurring tasks auto-expire after 7 days, and that they can cancel sooner with ${CRON_DELETE_TOOL_NAME} (include the job ID).
77
+ 3. **Then immediately execute the parsed prompt now** — don't wait for the first cron fire. If it's a slash command, run it directly; otherwise act on it directly.
78
+
79
+ ## Input
80
+
81
+ $ARGUMENTS
82
+ `,
83
+ };
@@ -0,0 +1 @@
1
+ export declare const settingsSkills: Record<string, string>;