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
@@ -102,10 +102,29 @@ export function convertMessagesForAPI(messages, options) {
102
102
  });
103
103
  }
104
104
  else {
105
- // Non-vision model: replace images with a text placeholder
105
+ // Non-vision model: replace images with a text placeholder and
106
+ // append [Image source: <path>] metadata for MCP images that
107
+ // were persisted to temp files, so the main model can delegate
108
+ // recognition to a vision subagent (which reads the path with
109
+ // the Read tool). Images without a persisted path (e.g. legacy
110
+ // history) fall back to the placeholder only.
111
+ const contentParts = [
112
+ {
113
+ type: "text",
114
+ text: "[Tool returned an image, but the current model does not support image recognition]",
115
+ },
116
+ ];
117
+ toolBlock.images.forEach((image) => {
118
+ if (image.path) {
119
+ contentParts.push({
120
+ type: "text",
121
+ text: `[Image source: ${image.path}]`,
122
+ });
123
+ }
124
+ });
106
125
  imageUserMessages.push({
107
126
  role: "user",
108
- content: "[Tool returned an image, but the current model does not support image recognition]",
127
+ content: contentParts,
109
128
  });
110
129
  }
111
130
  }
@@ -37,6 +37,7 @@ export interface UpdateToolBlockParams {
37
37
  images?: Array<{
38
38
  data: string;
39
39
  mediaType?: string;
40
+ path?: string;
40
41
  }>;
41
42
  compactParams?: string;
42
43
  parametersChunk?: string;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Persistence for MCP tool-returned images.
3
+ *
4
+ * MCP tools can return image content blocks as in-memory base64. When the
5
+ * agent's model does not support vision, the image is written to a temp file
6
+ * so convertMessagesForAPI can attach `[Image source: <path>]` metadata and
7
+ * the main model can delegate recognition to the vision subagent (which reads
8
+ * the path with the Read tool). Vision-capable models keep the inline base64
9
+ * and never write to disk.
10
+ */
11
+ export interface PersistedToolImage {
12
+ data: string;
13
+ mediaType?: string;
14
+ path?: string;
15
+ }
16
+ /**
17
+ * Persist base64 images to temp files under /tmp/wave-mcp-images/.
18
+ * Uses the OS tmpdir for simplicity and automatic OS cleanup (same convention
19
+ * as /tmp/wave-tool-results/). Returns each image unchanged (no path) when the
20
+ * write fails, so the caller degrades to the placeholder-only behavior.
21
+ */
22
+ export declare function persistToolImages(images: Array<{
23
+ data: string;
24
+ mediaType?: string;
25
+ }>): PersistedToolImage[];
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Persistence for MCP tool-returned images.
3
+ *
4
+ * MCP tools can return image content blocks as in-memory base64. When the
5
+ * agent's model does not support vision, the image is written to a temp file
6
+ * so convertMessagesForAPI can attach `[Image source: <path>]` metadata and
7
+ * the main model can delegate recognition to the vision subagent (which reads
8
+ * the path with the Read tool). Vision-capable models keep the inline base64
9
+ * and never write to disk.
10
+ */
11
+ import * as fs from "fs";
12
+ import * as os from "os";
13
+ import * as path from "path";
14
+ import { logger } from "./globalLogger.js";
15
+ const MCP_IMAGES_DIR = path.join(os.tmpdir(), "wave-mcp-images");
16
+ /** Map MCP mimeType to a file extension. Unknown types fall back to .png. */
17
+ const MIME_TO_EXT = {
18
+ "image/png": ".png",
19
+ "image/jpeg": ".jpg",
20
+ "image/webp": ".webp",
21
+ "image/gif": ".gif",
22
+ "image/bmp": ".bmp",
23
+ "image/svg+xml": ".svg",
24
+ "image/avif": ".avif",
25
+ "image/x-icon": ".ico",
26
+ "image/tiff": ".tiff",
27
+ };
28
+ /**
29
+ * Persist base64 images to temp files under /tmp/wave-mcp-images/.
30
+ * Uses the OS tmpdir for simplicity and automatic OS cleanup (same convention
31
+ * as /tmp/wave-tool-results/). Returns each image unchanged (no path) when the
32
+ * write fails, so the caller degrades to the placeholder-only behavior.
33
+ */
34
+ export function persistToolImages(images) {
35
+ return images.map((image) => {
36
+ try {
37
+ fs.mkdirSync(MCP_IMAGES_DIR, { recursive: true });
38
+ // Strip a data: URL prefix if present (MCP spec carries raw base64, but
39
+ // be defensive about dataURL-formatted data).
40
+ let data = image.data;
41
+ if (data.startsWith("data:")) {
42
+ const commaIndex = data.indexOf(",");
43
+ data = commaIndex >= 0 ? data.slice(commaIndex + 1) : data;
44
+ }
45
+ const ext = MIME_TO_EXT[image.mediaType || ""] || ".png";
46
+ const id = `${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
47
+ const filePath = path.join(MCP_IMAGES_DIR, `mcp-image_${id}${ext}`);
48
+ fs.writeFileSync(filePath, Buffer.from(data, "base64"));
49
+ return { ...image, path: filePath };
50
+ }
51
+ catch (error) {
52
+ logger?.error("Failed to persist MCP tool image:", error);
53
+ return image;
54
+ }
55
+ });
56
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wave-agent-sdk",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "SDK for building AI-powered development tools and agents",
5
5
  "keywords": [
6
6
  "ai",
@@ -36,7 +36,6 @@
36
36
  },
37
37
  "files": [
38
38
  "dist",
39
- "builtin",
40
39
  "README.md"
41
40
  ],
42
41
  "dependencies": {
@@ -51,7 +50,6 @@
51
50
  "@vscode/ripgrep": "^1.18.0",
52
51
  "chokidar": "^4.0.3",
53
52
  "cron-parser": "^5.5.0",
54
- "find-up": "^8.0.0",
55
53
  "fuzzysort": "^3.1.0",
56
54
  "glob": "^13.0.0",
57
55
  "lru-cache": "^11.3.5",
@@ -1,8 +0,0 @@
1
- {
2
- "name": "sdd",
3
- "description": "Spec-first workflow: specify skill, SessionStart guidance, and spec-count validation.",
4
- "version": "1.0.0",
5
- "author": {
6
- "name": "Wave Team"
7
- }
8
- }
@@ -1,14 +0,0 @@
1
- {
2
- "hooks": {
3
- "SessionStart": [
4
- {
5
- "hooks": [
6
- {
7
- "type": "command",
8
- "command": "node \"${WAVE_PLUGIN_ROOT}/scripts/session-start.js\""
9
- }
10
- ]
11
- }
12
- ]
13
- }
14
- }
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env node
2
- // SessionStart hook for the sdd built-in plugin.
3
- // Emits the spec-first workflow guidance as additionalContext (JSON form),
4
- // resolving the absolute path to the plugin's spec-count validator so the
5
- // agent can run it from its bash tool (which does not carry WAVE_PLUGIN_ROOT).
6
- import path from "node:path";
7
-
8
- const root =
9
- process.env.WAVE_PLUGIN_ROOT ||
10
- path.dirname(new URL("..", import.meta.url).pathname);
11
- const specCount = `node ${JSON.stringify(path.join(root, "scripts", "spec-count.js"))}`;
12
-
13
- const guidance = [
14
- "Spec-First Workflow(规格优先工作流):",
15
- "- 需求增加或变更时,优先更新 spec:先更新对应规格说明(新增用户故事、验收场景),待用户确认 spec 后再实现代码。spec 是功能设计的权威来源,不是 changelog。",
16
- "- 边界模糊时也先写 spec 草稿请用户确认,不要直接改代码。",
17
- "- 规格编写技能(specify)由 AI 自动触发:对话中涉及新需求或需求变更时主动创建或更新规格文件,不需要用户手动调用(不出现在斜杠命令列表中)。",
18
- `- 新增或修改 spec 后运行校验:${specCount}(自动检测 docs/specs/,否则 specs/,否则退出)。`,
19
- ].join("\n");
20
-
21
- // JSON form → parsed as hookSpecificOutput.additionalContext by the hook manager.
22
- console.log(
23
- JSON.stringify({ hookSpecificOutput: { additionalContext: guidance } }),
24
- );
@@ -1,77 +0,0 @@
1
- #!/usr/bin/env node
2
- // Generic, self-contained spec validator. Counts user stories and acceptance
3
- // scenarios under the project's specs directory and warns on missing sections.
4
- // Detects the specs dir: prefers docs/specs/, else specs/, else exits gracefully.
5
- // No dependency on any project's VitePress/docs-site modules.
6
- import fs from "node:fs";
7
- import path from "node:path";
8
-
9
- function detectSpecsDir() {
10
- for (const dir of ["docs/specs", "specs"]) {
11
- const resolved = path.resolve(process.cwd(), dir);
12
- if (fs.existsSync(resolved)) return resolved;
13
- }
14
- return null;
15
- }
16
-
17
- function walk(dir, out = []) {
18
- for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
19
- const fullPath = path.join(dir, entry.name);
20
- if (entry.isDirectory()) walk(fullPath, out);
21
- else if (entry.isFile() && entry.name.endsWith(".md")) out.push(fullPath);
22
- }
23
- return out;
24
- }
25
-
26
- function countUserStories(content) {
27
- const m = content.match(/^### 用户故事[::]/gm);
28
- return m ? m.length : 0;
29
- }
30
-
31
- function countAcceptanceScenarios(content) {
32
- const m = content.match(/^\d+\.\s+\*\*假设\*\*/gm);
33
- return m ? m.length : 0;
34
- }
35
-
36
- const specsDir = detectSpecsDir();
37
- if (!specsDir) {
38
- console.log("未找到规格目录(docs/specs/ 或 specs/),跳过校验。");
39
- process.exit(0);
40
- }
41
-
42
- const files = walk(specsDir).sort();
43
- const totals = { specs: 0, us: 0, ac: 0 };
44
- const warnings = [];
45
-
46
- // index.md is conventionally a directory listing page, not a spec — skip it.
47
- const specFiles = files.filter(
48
- (fp) => path.basename(fp).toLowerCase() !== "index.md",
49
- );
50
-
51
- for (const fp of specFiles) {
52
- const content = fs.readFileSync(fp, "utf-8");
53
- const usCount = countUserStories(content);
54
- const acCount = countAcceptanceScenarios(content);
55
- const rel = path.relative(process.cwd(), fp);
56
- totals.specs++;
57
- totals.us += usCount;
58
- totals.ac += acCount;
59
- if (!content.match(/^## 用户场景与测试/m))
60
- warnings.push(`${rel}: 缺少 "## 用户场景与测试" 章节`);
61
- if (usCount === 0)
62
- warnings.push(`${rel}: 未找到用户故事(期望 \`### 用户故事:\`)`);
63
- if (acCount === 0)
64
- warnings.push(
65
- `${rel}: 未找到验收场景(期望 \`N. **假设** … **当** … **则** …\`)`,
66
- );
67
- console.log(`${rel} 用户故事: ${usCount} 验收场景: ${acCount}`);
68
- }
69
-
70
- console.log("---");
71
- console.log(
72
- `规格: ${totals.specs} 用户故事: ${totals.us} 验收场景: ${totals.ac}`,
73
- );
74
- if (warnings.length) {
75
- for (const w of warnings) console.warn(`⚠ ${w}`);
76
- console.warn(`⚠ ${warnings.length} 条模板警告——见上方。`);
77
- }
@@ -1,47 +0,0 @@
1
- ---
2
- name: specify
3
- description: 根据自然语言描述创建或更新功能规格说明,生成包含用户故事与验收场景的规格文件。
4
- user-invocable: false
5
- ---
6
-
7
- ## 用户输入
8
-
9
- ```text
10
- $ARGUMENTS
11
- ```
12
-
13
- ## 流程
14
-
15
- 本技能由 AI 在会话中自动触发(不占用手动斜杠命令)。触发时机:用户提出新的需求、修改需求或涉及功能边界时,若对应规格尚未创建或已过期,则主动创建或更新规格说明。$ARGUMENTS 通常为空——需求描述直接来自对话上下文,不要让用户重复。
16
-
17
- 根据对话中的功能描述,执行以下步骤:
18
-
19
- 1. **确定规格文件路径**:
20
- - **确定规格根目录**:优先复用项目中已有的规格目录——若 `docs/specs/` 存在则用之,否则若 `specs/` 存在则用之,否则默认 `specs/`(并在完成报告中说明所选目录,便于用户纠正)。
21
- - **选择分组**:若规格目录下已有分组子目录,沿用其既有分组约定;否则默认扁平结构(直接放在规格根目录下)。
22
- - 根据功能描述生成 2-4 个词的 slug(小写、连字符、保留缩写词),与组内已有文件名不冲突
23
- - 规格文件路径:`<规格根目录>/<分组>/<slug>.md`(无分组时为 `<规格根目录>/<slug>.md`)
24
-
25
- 2. **加载模板** `${WAVE_SKILL_DIR}/templates/spec-template.md`,了解必需章节。
26
-
27
- 3. **编写规格说明**:
28
- - 解析用户描述,提取关键概念:角色、操作、数据、约束
29
- - 对于不明确的部分,根据上下文和行业标准做出合理推断
30
- - 仅在关键决策处标记 `[待澄清:具体问题]`(最多 3 处)
31
- - 填写 frontmatter(`name` 为功能中文名、`description` 为一句话简述、`order` 为控制组内排序的数字)
32
- - 填写「用户场景与测试」章节,包含按优先级排序的用户故事(P1、P2、P3...),每个故事以「作为…,我希望…,以便…」描述,附 `**为什么是这个优先级**` 与 `**独立测试**`(不适用的可省略)
33
- - 为每个用户故事编写可测试的验收场景(**假设** … **当** … **则** …)
34
- - 写入规格文件,替换所有占位符
35
-
36
- 4. **如果存在 `[待澄清]` 标记**(最多 3 处):
37
- - 将每个标记作为问题展示,附带建议答案
38
- - 等待用户回复后更新规格文件
39
-
40
- 5. 报告完成,输出规格文件路径。
41
-
42
- ## 指南
43
-
44
- - 关注用户**需要什麼**和**为什么**,而非如何实现
45
- - 不包含实现细节(不涉及技术栈、API、代码结构)
46
- - 每个验收场景必须可测试、无歧义
47
- - 删除不适用的可选章节(不要留 "N/A")
@@ -1,47 +0,0 @@
1
- ---
2
- name: "[功能名称]"
3
- description: "[一句话简短描述]"
4
- order: [数字,控制组内排序]
5
- ---
6
-
7
- # 功能规格说明:[功能名称]
8
-
9
- **创建日期**:[日期]
10
-
11
- ## 用户场景与测试 *(必填)*
12
-
13
- ### 用户故事:[简要标题](优先级:P1)
14
-
15
- 作为[角色],我希望[操作],以便[价值/目的]。
16
-
17
- **为什么是这个优先级**:[解释其价值以及为何具有此优先级]
18
-
19
- **独立测试**:[描述如何独立测试——例如,"可以通过 [具体操作] 进行完整测试,并交付 [具体价值]"]
20
-
21
- **验收场景**:
22
-
23
- 1. **假设** [初始状态],**当** [操作],**则** [预期结果]
24
- 2. **假设** [初始状态],**当** [操作],**则** [预期结果]
25
-
26
- ---
27
-
28
- ### 用户故事:[简要标题](优先级:P2)
29
-
30
- 作为[角色],我希望[操作],以便[价值/目的]。
31
-
32
- **为什么是这个优先级**:[解释其价值以及为何具有此优先级]
33
-
34
- **独立测试**:[描述如何独立测试]
35
-
36
- **验收场景**:
37
-
38
- 1. **假设** [初始状态],**当** [操作],**则** [预期结果]
39
-
40
- ---
41
-
42
- [根据需要添加更多用户故事,每个都分配优先级]
43
-
44
- ### 边界情况
45
-
46
- - **[问题?]** [答案/处理方式]
47
- - **[问题?]** [答案/处理方式]
@@ -1,14 +0,0 @@
1
- ---
2
- name: artifact
3
- description: Publish a local HTML or Markdown file as a shareable web page
4
- disable-model-invocation: true
5
- ---
6
-
7
- # Artifact: Publish a File as a Shareable Web Page
8
-
9
- Publish a local `.html` or `.md` file as a default-private, shareable web page.
10
-
11
- - If a file path was provided ($ARGUMENTS / $1), use it directly as the `file_path`.
12
- - Otherwise, infer which file to publish from the conversation context; if it is not clear, ask the user which file to publish.
13
-
14
- Call the `Artifact` tool with the resolved `file_path` (and `favicon` if relevant), then report the resulting URL to the user.
@@ -1,79 +0,0 @@
1
- ---
2
- name: loop
3
- description: Run a prompt or slash command on a recurring interval (e.g. /loop 5m /foo, defaults to 10m)
4
- allowed-tools: CronCreate, Skill
5
- user-invocable: true
6
- ---
7
-
8
- # /loop — schedule a recurring prompt
9
-
10
- Parse the input below into `[interval] <prompt…>` and schedule it with CronCreate.
11
-
12
- ## Usage
13
-
14
- ```
15
- /loop [interval] <prompt>
16
-
17
- Run a prompt or slash command on a recurring interval.
18
-
19
- Intervals: Ns, Nm, Nh, Nd (e.g. 5m, 30m, 2h, 1d). Minimum granularity is 1 minute.
20
- If no interval is specified, defaults to 10m.
21
-
22
- Examples:
23
- /loop 5m /babysit-prs
24
- /loop 30m check the deploy
25
- /loop 1h /standup 1
26
- /loop check the deploy (defaults to 10m)
27
- /loop check the deploy every 20m
28
- ```
29
-
30
- ## Parsing (in priority order)
31
-
32
- 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.
33
- 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.
34
- 3. **Default**: otherwise, interval is `10m` and the entire input is the prompt.
35
-
36
- If the resulting prompt is empty, show usage `/loop [interval] <prompt>` and stop — do not call CronCreate.
37
-
38
- Examples:
39
- - `5m /babysit-prs` → interval `5m`, prompt `/babysit-prs` (rule 1)
40
- - `check the deploy every 20m` → interval `20m`, prompt `check the deploy` (rule 2)
41
- - `run tests every 5 minutes` → interval `5m`, prompt `run tests` (rule 2)
42
- - `check the deploy` → interval `10m`, prompt `check the deploy` (rule 3)
43
- - `check every PR` → interval `10m`, prompt `check every PR` (rule 3 — "every" not followed by time)
44
- - `5m` → empty prompt → show usage
45
-
46
- ## Interval → cron
47
-
48
- Supported suffixes: `s` (seconds, rounded up to nearest minute, min 1), `m` (minutes), `h` (hours), `d` (days). Convert:
49
-
50
- | Interval pattern | Cron expression | Notes |
51
- |-----------------------|---------------------|------------------------------------------|
52
- | `Nm` where N ≤ 59 | `*/N * * * *` | every N minutes |
53
- | `Nm` where N ≥ 60 | `0 */H * * *` | round to hours (H = N/60, must divide 24)|
54
- | `Nh` where N ≤ 23 | `0 */N * * *` | every N hours |
55
- | `Nd` | `0 0 */N * *` | every N days at midnight local |
56
- | `Ns` | treat as `ceil(N/60)m` | cron minimum granularity is 1 minute |
57
-
58
- **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.
59
-
60
- ## Avoid the :00 and :30 minute marks
61
-
62
- When the user's request is approximate, pick a minute that is NOT 0 or 30:
63
- - "every morning around 9" → `57 8 * * *` or `3 9 * * *` (not `0 9 * * *`)
64
- - "hourly" → `7 * * * *` (not `0 * * * *`)
65
-
66
- Only use minute 0 or 30 when the user names that exact time and clearly means it ("at 9:00 sharp", "at half past").
67
-
68
- ## Action
69
-
70
- 1. Call CronCreate with:
71
- - `cron`: the expression from the table above
72
- - `prompt`: the parsed prompt from above, verbatim (slash commands are passed through unchanged)
73
- - `recurring`: `true`
74
- 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 CronDelete (include the job ID).
75
- 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.
76
-
77
- ## Input
78
-
79
- $ARGUMENTS
@@ -1,78 +0,0 @@
1
- # Wave Environment Variables Configuration
2
-
3
- Environment variables allow you to customize Wave's behavior, configure AI models, and provide context to hooks and tools. This document provides detailed guidance on how to configure environment variables in `settings.json`.
4
-
5
- ## The `env` Field
6
-
7
- Environment variables are configured in the `env` field of `settings.json`. It is a simple key-value pair of strings.
8
-
9
- ```json
10
- {
11
- "env": {
12
- "WAVE_MODEL": "gemini-3-flash",
13
- "MY_CUSTOM_VAR": "some-value"
14
- }
15
- }
16
- ```
17
-
18
- ## Supported `WAVE_*` Environment Variables
19
-
20
- Wave uses several environment variables to control its core functionality. Variables marked **OS env only** are read from the OS environment (or constructor / stdio `initialize` params) and are **NOT** read from settings.json `env` — set them in your shell, not in the `env` field.
21
-
22
- | Variable | Description | Default |
23
- | :--- | :--- | :--- |
24
- | `WAVE_API_KEY` | API key for the AI gateway. | - |
25
- | `WAVE_BASE_URL` | Base URL for the AI gateway. | - |
26
- | `WAVE_SERVER_URL` | Server URL for SSO authentication. Resolution order: `options.serverUrl` → `process.env.WAVE_SERVER_URL` → default. Unlike other `WAVE_*` vars, a settings.json `env` value is also mirrored to `process.env` so process-level singletons (AuthService) see it without a per-session snapshot. | `https://codechat.codewave.163.com` |
27
- | `WAVE_CUSTOM_HEADERS` | Custom HTTP headers for the AI gateway. Newline-separated `Key: Value` pairs (e.g., `"X-Foo: bar\nAuthorization: Bearer xxx"`). | - |
28
- | `WAVE_MODEL` | The primary AI model to use for the agent. | `gemini-3-flash` |
29
- | `WAVE_FAST_MODEL` | The fast AI model to use for quick tasks. | `gemini-2.5-flash` |
30
- | `WAVE_VISION_MODEL` | Vision-capable model used by the built-in `vision` subagent for image recognition. When set, the built-in `vision` subagent is registered (its frontmatter `model: visionModel` resolves to this value); when unset, the subagent is not loaded. Useful when the main model is fast but non-vision (e.g. DeepSeek). | - (not registered) |
31
- | `WAVE_MAX_INPUT_TOKENS` | Maximum number of input tokens allowed. | `200000` |
32
- | `WAVE_MAX_OUTPUT_TOKENS` | Maximum number of output tokens allowed. | `32000` |
33
- | `WAVE_DISABLE_AUTO_MEMORY` | Set to `1` or `true` to disable the auto-memory feature. | `false` |
34
- | `WAVE_AUTO_MEMORY_FREQUENCY` | Auto memory update frequency. `1` = every turn, `2` = every 2 turns, etc. | `1` |
35
- | `WAVE_TASK_LIST_ID` | Explicitly set the task list ID for the session. | (Session ID) |
36
- | `WAVE_PLUGIN_GIT_TIMEOUT_MS` | Timeout in milliseconds for git operations when installing plugins. **OS env only** (infrastructure). | `300000` |
37
-
38
- ## Configuration Scopes
39
-
40
- Environment variables can be set in different scopes. Wave merges scopes from lowest to highest priority and stores the result in the agent's **per-session environment snapshot**. The snapshot takes priority over OS environment variables but is **NOT written to `process.env`** — this keeps multiple sessions in one `wave --stdio` process from polluting each other.
41
-
42
- Precedence (highest to lowest):
43
-
44
- 1. **Local Scope**: `.wave/settings.local.json` (Local overrides, ignored by git)
45
- 2. **Project Scope**: `.wave/settings.json` (Project-specific settings, shared via git)
46
- 3. **User Scope**: `~/.wave/settings.json` (Global settings for all projects)
47
- 4. **System Environment**: Variables set in your shell (e.g., `export WAVE_API_KEY=...`). Used as a fallback when a key is absent from the settings snapshot.
48
-
49
- > Settings `env` shadows (does not mutate) OS env: a key set in both settings.json `env` and the OS environment resolves to the settings value for that session, while the OS value remains untouched and visible to unrelated processes.
50
-
51
- ## Custom Environment Variables
52
-
53
- You can also define custom environment variables in the `env` field. These variables are stored in the session's environment snapshot and will be available to:
54
-
55
- - **Hooks**: Any shell command executed as a hook will have these variables in its environment (merged on top of OS env).
56
- - **Tools**: Tools like `Bash` will have access to these variables (merged on top of OS env).
57
-
58
- In `wave --stdio` mode one process hosts multiple sessions; each session keeps its own snapshot, so sessions with different `env` do not pollute each other (no "last session wins").
59
-
60
- Example:
61
- ```json
62
- {
63
- "env": {
64
- "PROJECT_NAME": "my-awesome-project",
65
- "DEPLOY_TARGET": "staging"
66
- }
67
- }
68
- ```
69
-
70
- ## Live Reload
71
-
72
- Environment variables configured in `settings.json` support **live reload**. When you modify the `env` field in any `settings.json` file (user, project, or local scope), the changes take effect immediately without requiring a Wave session restart — the session's environment snapshot is refreshed and subsequent resolve calls / subprocess spawns use the new values.
73
-
74
- ## Best Practices
75
-
76
- - **Use Local Overrides for Secrets**: Never commit sensitive information like `WAVE_API_KEY` to `settings.json`. Use `settings.local.json` instead.
77
- - **Standard Naming**: Use uppercase and underscores for environment variable names (e.g., `MY_VARIABLE`).
78
- - **Avoid Overriding System Variables**: Be careful not to override standard system variables like `PATH` or `HOME` unless you have a specific reason to do so.