openvibe 0.58.3 → 0.60.0

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 (66) hide show
  1. package/CHANGELOG.md +50 -3019
  2. package/README.md +267 -98
  3. package/dist/core/agent-modes.d.ts +16 -0
  4. package/dist/core/agent-modes.d.ts.map +1 -0
  5. package/dist/core/agent-modes.js +88 -0
  6. package/dist/core/agent-modes.js.map +1 -0
  7. package/dist/core/agent-session.d.ts +26 -0
  8. package/dist/core/agent-session.d.ts.map +1 -1
  9. package/dist/core/agent-session.js +84 -1
  10. package/dist/core/agent-session.js.map +1 -1
  11. package/dist/core/compaction/compaction.d.ts.map +1 -1
  12. package/dist/core/compaction/compaction.js +1 -1
  13. package/dist/core/compaction/compaction.js.map +1 -1
  14. package/dist/core/context-architecture.d.ts +12 -0
  15. package/dist/core/context-architecture.d.ts.map +1 -0
  16. package/dist/core/context-architecture.js +14 -0
  17. package/dist/core/context-architecture.js.map +1 -0
  18. package/dist/core/context-manager.d.ts +162 -0
  19. package/dist/core/context-manager.d.ts.map +1 -0
  20. package/dist/core/context-manager.js +311 -0
  21. package/dist/core/context-manager.js.map +1 -0
  22. package/dist/core/context-provider-interface.d.ts +134 -0
  23. package/dist/core/context-provider-interface.d.ts.map +1 -0
  24. package/dist/core/context-provider-interface.js +6 -0
  25. package/dist/core/context-provider-interface.js.map +1 -0
  26. package/dist/core/context-provider-registry.d.ts +78 -0
  27. package/dist/core/context-provider-registry.d.ts.map +1 -0
  28. package/dist/core/context-provider-registry.js +164 -0
  29. package/dist/core/context-provider-registry.js.map +1 -0
  30. package/dist/core/index.d.ts +2 -0
  31. package/dist/core/index.d.ts.map +1 -1
  32. package/dist/core/index.js +9 -0
  33. package/dist/core/index.js.map +1 -1
  34. package/dist/core/large-context-provider.d.ts +87 -0
  35. package/dist/core/large-context-provider.d.ts.map +1 -0
  36. package/dist/core/large-context-provider.js +391 -0
  37. package/dist/core/large-context-provider.js.map +1 -0
  38. package/dist/core/skills.d.ts.map +1 -1
  39. package/dist/core/skills.js +52 -5
  40. package/dist/core/skills.js.map +1 -1
  41. package/dist/core/slash-commands.d.ts.map +1 -1
  42. package/dist/core/slash-commands.js +1 -0
  43. package/dist/core/slash-commands.js.map +1 -1
  44. package/dist/core/system-prompt.d.ts +6 -4
  45. package/dist/core/system-prompt.d.ts.map +1 -1
  46. package/dist/core/system-prompt.js +129 -63
  47. package/dist/core/system-prompt.js.map +1 -1
  48. package/dist/index.d.ts +1 -0
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +2 -0
  51. package/dist/index.js.map +1 -1
  52. package/dist/modes/interactive/components/skills-selector.d.ts +13 -0
  53. package/dist/modes/interactive/components/skills-selector.d.ts.map +1 -0
  54. package/dist/modes/interactive/components/skills-selector.js +49 -0
  55. package/dist/modes/interactive/components/skills-selector.js.map +1 -0
  56. package/dist/modes/interactive/interactive-mode.d.ts +2 -2
  57. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  58. package/dist/modes/interactive/interactive-mode.js +44 -37
  59. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  60. package/docs/system-prompt-template.md +176 -0
  61. package/examples/skills/README.md +93 -0
  62. package/examples/skills/api-design/SKILL.md +80 -0
  63. package/examples/skills/code-review/SKILL.md +68 -0
  64. package/examples/skills/git-workflow/SKILL.md +108 -0
  65. package/examples/skills/testing/SKILL.md +94 -0
  66. package/package.json +2 -2
package/README.md CHANGED
@@ -1,159 +1,328 @@
1
1
  # OpenVibe
2
2
 
3
- OpenVibe 是一个专业的 AI 编程助手,为开发者提供智能的代码编辑、文件管理和项目协作功能。
3
+ [**中文文档**](./README_CN.md) | English
4
4
 
5
- ## 安装
5
+ OpenVibe is a professional AI coding assistant that provides intelligent code editing, file management, and project collaboration features for developers.
6
+
7
+ ## Installation
6
8
 
7
9
  ```bash
8
10
  npm install -g openvibe
9
11
  ```
10
12
 
11
- ## 快速开始
13
+ ## Quick Start
12
14
 
13
- ### 首次配置
15
+ ### Initial Configuration
14
16
 
15
- 运行 OpenVibe 后,系统将引导你完成初始配置:
17
+ After running OpenVibe, the system will guide you through the initial setup:
16
18
 
17
19
  ```bash
18
20
  openvibe
19
21
  ```
20
22
 
21
- 你需要提供:
22
- - **API 地址**: 你的 AI 服务接口地址
23
- - **API 密钥**: 访问 AI 服务的密钥
24
- - **模型名称**: 使用的 AI 模型名称
23
+ You will need to provide:
24
+ - **API URL**: Your AI service endpoint address
25
+ - **API Key**: The key to access the AI service
26
+ - **Model Name**: The AI model name to use
25
27
 
26
- ### 基本用法
28
+ ### Basic Usage
27
29
 
28
30
  ```bash
29
- # 启动交互式会话
31
+ # Start an interactive session
30
32
  openvibe
31
33
 
32
- # 直接执行指令
33
- openvibe "分析当前项目的代码结构"
34
+ # Execute a command directly
35
+ openvibe "Analyze the code structure of the current project"
34
36
 
35
- # 处理文件
36
- openvibe -f src/main.ts "优化这段代码"
37
+ # Process files
38
+ openvibe -f src/main.ts "Optimize this code"
37
39
  ```
38
40
 
39
- ## 核心功能
40
-
41
- - **智能代码编辑**: 基于 AI 的代码分析、重构和生成
42
- - **文件操作工具**: read、write、edit、bash、grep、find 等
43
- - **会话管理**: 保存和恢复对话历史
44
- - **扩展系统**: 自定义功能扩展
45
- - **交互式终端界面**: 直观的 TUI 操作体验
46
-
47
- ## 配置说明
48
-
49
- 配置文件位于 `~/.openvibe/config.json`:
50
-
51
- ```json
52
- {
53
- "apiUrl": "https://api.example.com/v1/chat/completions",
54
- "apiKey": "your-api-key",
55
- "model": "your-model-name"
56
- }
57
- ```
58
-
59
- ## 命令行选项
60
-
61
- ```
62
- Usage: openvibe [options] [prompt]
41
+ ## Core Features
42
+
43
+ ### Built-in Tools
44
+
45
+ OpenVibe includes the following built-in tools:
46
+
47
+ | Tool | Description |
48
+ |------|-------------|
49
+ | `read` | Read file contents (supports text and images) |
50
+ | `write` | Write content to files (creates or overwrites) |
51
+ | `edit` | Edit files with precise text replacement |
52
+ | `bash` | Execute shell commands |
53
+ | `grep` | Search file contents with regex support |
54
+ | `find` | Find files by name pattern |
55
+ | `ls` | List directory contents |
56
+ | `truncate` | Truncate large outputs |
57
+
58
+ ### Slash Commands
59
+
60
+ OpenVibe provides powerful slash commands for session management:
61
+
62
+ | Command | Description |
63
+ |---------|-------------|
64
+ | `/settings` | Open settings menu |
65
+ | `/export` | Export session to HTML file |
66
+ | `/share` | Share session as a secret GitHub gist |
67
+ | `/copy` | Copy last agent message to clipboard |
68
+ | `/name` | Set session display name |
69
+ | `/session` | Show session info and stats |
70
+ | `/changelog` | Show changelog entries |
71
+ | `/hotkeys` | Show all keyboard shortcuts |
72
+ | `/fork` | Create a new fork from a previous message |
73
+ | `/tree` | Navigate session tree (switch branches) |
74
+ | `/new` | Start a new session |
75
+ | `/compact` | Manually compact the session context |
76
+ | `/resume` | Resume a different session |
77
+ | `/reload` | Reload extensions, skills, prompts, and themes |
78
+ | `/skills` | Browse and invoke available skills |
79
+ | `/think` | Set thinking level (off/minimal/low/medium/high/xhigh) |
80
+ | `/quit` | Quit OpenVibe |
81
+
82
+ ### Session Management
83
+
84
+ - **Auto-save**: Sessions are automatically saved in JSONL format
85
+ - **Resume**: Continue previous conversations anytime
86
+ - **Fork**: Create branches from any point in the conversation
87
+ - **Tree Navigation**: Navigate and switch between conversation branches
88
+ - **History**: View and manage all historical sessions
89
+
90
+ ### Context Compaction
91
+
92
+ Automatically compresses conversation history to save tokens:
93
+ - **Auto-compaction**: Triggers when context overflows
94
+ - **Manual compaction**: Use `/compact` command
95
+ - **Smart summarization**: Preserves important information
96
+ - **Token budget management**: Configurable reserve and keep tokens
97
+
98
+ ### Skills System
99
+
100
+ Skills are specialized knowledge files that provide expert guidance:
101
+ - Load domain-specific expertise
102
+ - Support for user, project, and path-scoped skills
103
+ - Markdown format with frontmatter
104
+ - Compatible with Claude skills directory
105
+
106
+ **Supported Skill Directories:**
107
+
108
+ | Location | Type | Priority |
109
+ |----------|------|----------|
110
+ | `~/.openvibe/skills/` | Global | High |
111
+ | `~/.agents/skills/` | Global (Agent Skills standard) | Medium |
112
+ | `~/.claude/skills/` | Global (Claude compatible) | Medium |
113
+ | `~/.codex/skills/` | Global (Codex compatible) | Medium |
114
+ | `.openvibe/skills/` | Project | High |
115
+ | `.agents/skills/` | Project | Medium |
116
+ | `.claude/skills/` | Project | Medium |
117
+
118
+ **Usage:**
119
+ ```bash
120
+ # List and select skills interactively
121
+ /skills
63
122
 
64
- Options:
65
- -f, --file <path> 包含文件路径
66
- -c, --context <path> 添加上下文文件/目录
67
- --no-onboarding 跳过引导配置
68
- -h, --help 显示帮助信息
69
- -v, --version 显示版本号
123
+ # Invoke a specific skill directly
124
+ /skill:code-review
70
125
  ```
71
126
 
72
- ## 工具功能
127
+ ### Prompt Templates
73
128
 
74
- OpenVibe 内置以下工具:
129
+ Create reusable prompt templates:
130
+ - User and project-scoped templates
131
+ - Argument substitution support (`$1`, `$2`, `$ARGUMENTS`)
132
+ - Markdown format with description frontmatter
133
+ - Quick access via `/template-name` syntax
75
134
 
76
- | 工具 | 描述 |
77
- |------|------|
78
- | `read` | 读取文件内容 |
79
- | `write` | 写入文件内容 |
80
- | `edit` | 编辑文件(精确替换) |
81
- | `bash` | 执行 shell 命令 |
82
- | `grep` | 搜索文件内容 |
83
- | `find` | 查找文件 |
84
- | `ls` | 列出目录内容 |
135
+ ### Extension System
85
136
 
86
- ## 交互式快捷键
87
-
88
- 在交互模式下:
89
-
90
- | 快捷键 | 功能 |
91
- |--------|------|
92
- | `Ctrl+C` | 退出程序 |
93
- | `Ctrl+D` | 结束输入 |
94
- | `Ctrl+L` | 清屏 |
95
- | `Tab` | 自动补全 |
96
-
97
- ## 扩展开发
98
-
99
- OpenVibe 支持 TypeScript 扩展,示例:
137
+ Build powerful TypeScript extensions:
100
138
 
101
139
  ```typescript
102
140
  import { defineExtension } from 'openvibe';
103
141
 
104
142
  export default defineExtension({
105
143
  name: 'my-extension',
106
- setup({ onMessage }) {
144
+ setup({ onMessage, registerTool, registerCommand }) {
145
+ // Subscribe to messages
107
146
  onMessage((message) => {
108
- console.log('收到消息:', message);
147
+ console.log('Received:', message);
148
+ });
149
+
150
+ // Register custom tools
151
+ registerTool({
152
+ name: 'myTool',
153
+ description: 'A custom tool',
154
+ parameters: { ... },
155
+ handler: async (args) => { ... }
156
+ });
157
+
158
+ // Register commands
159
+ registerCommand({
160
+ name: 'myCommand',
161
+ description: 'A custom command',
162
+ handler: async (args) => { ... }
109
163
  });
110
164
  }
111
165
  });
112
166
  ```
113
167
 
114
- ## 历史记录
168
+ Extension capabilities:
169
+ - Register LLM-callable tools
170
+ - Register slash commands and keyboard shortcuts
171
+ - Create custom UI components
172
+ - Subscribe to agent lifecycle events
173
+ - Access session and model information
174
+
175
+ ### Theme System
176
+
177
+ Customize the appearance:
178
+ - Built-in dark and light themes
179
+ - Custom theme support via JSON files
180
+ - Export colors for HTML generation
181
+ - Dynamic theme switching
182
+
183
+ ### Keyboard Shortcuts
184
+
185
+ | Shortcut | Action |
186
+ |----------|--------|
187
+ | `Esc` | Interrupt current operation |
188
+ | `Ctrl+C` | Clear input / Cancel |
189
+ | `Ctrl+D` | Exit |
190
+ | `Ctrl+Z` | Suspend |
191
+ | `Shift+Tab` | Cycle thinking level |
192
+ | `Ctrl+P` | Cycle model forward |
193
+ | `Ctrl+L` | Model selector |
194
+ | `Ctrl+O` | Expand/collapse tools |
195
+ | `Ctrl+T` | Toggle thinking block |
196
+ | `Ctrl+G` | Open external editor |
197
+ | `Alt+Enter` | Queue follow-up message |
198
+ | `Ctrl+V` | Paste image from clipboard |
199
+
200
+ ### HTML Export
201
+
202
+ Export sessions to standalone HTML files:
203
+ - Full conversation history with syntax highlighting
204
+ - Tool execution details
205
+ - Customizable themes
206
+ - Share via GitHub Gist
207
+
208
+ ### Additional Features
209
+
210
+ - **1M Context Window**: Full support for 1 million token context window via provider configuration
211
+ - **Multi-GPU Support**: Distribute workloads across GPUs
212
+ - **Auto Retry**: Automatic retry on API failures with configurable delays
213
+ - **Image Support**: Paste and process images from clipboard
214
+ - **Git Integration**: Display current branch in status bar
215
+ - **RPC Mode**: Remote procedure call support for integration
216
+ - **Onboarding Wizard**: Guided initial setup
217
+ - **Response Acceleration**: Streaming optimizations for faster responses
218
+
219
+ ## Configuration
220
+
221
+ Configuration file located at `~/.openvibe/config.json`:
115
222
 
116
- OpenVibe 自动保存所有会话历史,方便你随时回顾和继续之前的对话。
223
+ ```json
224
+ {
225
+ "apiUrl": "https://api.example.com/v1/chat/completions",
226
+ "apiKey": "your-api-key",
227
+ "model": "your-model-name"
228
+ }
229
+ ```
117
230
 
118
- ### 查看历史
231
+ ### Settings
119
232
 
120
- ```bash
121
- # 列出所有历史会话
122
- openvibe --history
233
+ Global and project-level settings in `~/.openvibe/settings.json`:
123
234
 
124
- # 查看特定会话
125
- openvibe --session <session-id>
235
+ ```json
236
+ {
237
+ "theme": "dark",
238
+ "defaultThinkingLevel": "medium",
239
+ "compaction": {
240
+ "enabled": true,
241
+ "reserveTokens": 16384,
242
+ "keepRecentTokens": 20000
243
+ },
244
+ "retry": {
245
+ "enabled": true,
246
+ "maxRetries": 3
247
+ },
248
+ "enableSkillCommands": true
249
+ }
126
250
  ```
127
251
 
128
- ### 历史文件位置
252
+ ### 1M Context Window Configuration
129
253
 
130
- 历史记录保存在 `~/.openvibe/sessions/` 目录下,每个会话以 JSONL 格式存储。
254
+ OpenVibe supports models with 1 million token context window through an independent **Context Architecture**:
131
255
 
132
- ### 快捷键
256
+ ```typescript
257
+ // Using the Context Architecture API
258
+ import {
259
+ getContextProviderRegistry,
260
+ enhanceModelContext,
261
+ LargeContextProvider
262
+ } from 'openvibe';
263
+
264
+ // Enhance any model with large context
265
+ const enhancedModel = enhanceModelContext(model);
266
+
267
+ // Or register a custom model with 1M context
268
+ const provider = new LargeContextProvider();
269
+ provider.registerCustomModel('my-custom-model', {
270
+ contextWindow: 1000000,
271
+ maxTokens: 65536,
272
+ supportsVision: true
273
+ });
274
+ ```
275
+
276
+ **Supported Models with 1M Context:**
277
+ - Google Gemini 1.5 Pro/Flash
278
+ - Google Gemini 2.0 Flash/Pro
279
+ - Alibaba Qwen-Max
280
+ - Moonshot Kimi (128K)
281
+
282
+ **Architecture Components:**
283
+ - `IContextProvider` - Interface for custom context providers
284
+ - `LargeContextProvider` - Built-in provider with 50+ model definitions
285
+ - `ContextProviderRegistry` - Central registry for managing providers
286
+ - `ContextManager` - Configuration-based alternative API
287
+ ```
288
+
289
+ ## Command Line Options
133
290
 
134
- 在交互模式下管理历史:
291
+ ```
292
+ Usage: openvibe [options] [prompt]
293
+
294
+ Options:
295
+ -f, --file <path> Include file path
296
+ -c, --context <path> Add context file/directory
297
+ --no-onboarding Skip onboarding configuration
298
+ -h, --help Display help information
299
+ -v, --version Display version number
300
+ ```
135
301
 
136
- | 快捷键 | 功能 |
137
- |--------|------|
138
- | `Ctrl+R` | 打开历史会话选择器 |
139
- | `Ctrl+S` | 保存当前会话 |
140
- | `Ctrl+Shift+S` | 重命名当前会话 |
302
+ ## Documentation
141
303
 
142
- - [扩展开发指南](docs/extensions.md)
143
- - [SDK 文档](docs/sdk.md)
144
- - [主题定制](docs/themes.md)
145
- - [快捷键配置](docs/keybindings.md)
304
+ - [Extension Development Guide](docs/extensions.md)
305
+ - [SDK Documentation](docs/sdk.md)
306
+ - [Theme Customization](docs/themes.md)
307
+ - [Keybinding Configuration](docs/keybindings.md)
308
+ - [Skills System](docs/skills.md)
309
+ - [Prompt Templates](docs/prompt-templates.md)
310
+ - [Session Management](docs/session.md)
311
+ - [Context Compaction](docs/compaction.md)
312
+ - [Custom Providers](docs/custom-provider.md)
313
+ - [TUI Components](docs/tui.md)
314
+ - [RPC Integration](docs/rpc.md)
146
315
 
147
- ## 系统要求
316
+ ## System Requirements
148
317
 
149
318
  - Node.js >= 18.0.0
150
319
  - npm >= 9.0.0
151
320
 
152
- ## 许可证
321
+ ## License
153
322
 
154
323
  MIT
155
324
 
156
- ## 相关链接
325
+ ## Links
157
326
 
158
- - [npm ](https://www.npmjs.com/package/openvibe)
159
- - [问题反馈](https://github.com/boxiaolanya2008/openvibe/issues)
327
+ - [npm Package](https://www.npmjs.com/package/openvibe)
328
+ - [Issue Tracker](https://github.com/boxiaolanya2008/openvibe/issues)
@@ -0,0 +1,16 @@
1
+ export type AgentMode = "default" | "plan" | "spec";
2
+ export interface AgentModeConfig {
3
+ name: string;
4
+ description: string;
5
+ systemPromptAddition: string;
6
+ tools: string[];
7
+ thinkingLevel: "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
8
+ }
9
+ export declare const AGENT_MODES: Record<AgentMode, AgentModeConfig>;
10
+ export declare function getAgentModeConfig(mode: AgentMode): AgentModeConfig;
11
+ export declare function getModePromptAddition(mode: AgentMode): string;
12
+ export declare function getModeTools(mode: AgentMode): string[];
13
+ export declare function getModeThinkingLevel(mode: AgentMode): "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
14
+ export declare function getAllModes(): AgentMode[];
15
+ export declare function getClaudeSkillsPath(): string;
16
+ //# sourceMappingURL=agent-modes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-modes.d.ts","sourceRoot":"","sources":["../../src/core/agent-modes.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,EAAE,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;CACvE;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,eAAe,CAkE1D,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,GAAG,eAAe,CAEnE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAE7D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,CAEtD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAE7G;AAED,wBAAgB,WAAW,IAAI,SAAS,EAAE,CAEzC;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C","sourcesContent":["import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nexport type AgentMode = \"default\" | \"plan\" | \"spec\";\n\nexport interface AgentModeConfig {\n\tname: string;\n\tdescription: string;\n\tsystemPromptAddition: string;\n\ttools: string[];\n\tthinkingLevel: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\";\n}\n\nexport const AGENT_MODES: Record<AgentMode, AgentModeConfig> = {\n\tdefault: {\n\t\tname: \"Default\",\n\t\tdescription: \"Standard coding assistant mode with full tool access\",\n\t\tsystemPromptAddition: ``,\n\t\ttools: [\"read\", \"bash\", \"edit\", \"write\", \"grep\", \"find\", \"ls\"],\n\t\tthinkingLevel: \"off\",\n\t},\n\tplan: {\n\t\tname: \"Plan\",\n\t\tdescription: \"Planning mode focused on analysis and design. Read-only tools, high reasoning.\",\n\t\tsystemPromptAddition: `\nYou are in **Planning Mode**. Your role is to analyze, design, and create detailed plans.\n\n**Guidelines for Planning Mode:**\n1. Focus on understanding the problem thoroughly before proposing solutions\n2. Break down complex tasks into manageable steps\n3. Consider edge cases, error handling, and potential issues\n4. Provide clear, actionable implementation plans\n5. Use high-level reasoning to explore multiple approaches\n6. Document dependencies and prerequisites\n7. Identify risks and mitigation strategies\n8. Create clear milestones and deliverables\n\n**Output Format:**\n- Start with a brief problem analysis\n- Present the approach with rationale\n- Provide step-by-step implementation plan\n- Include consideration of alternatives\n- End with a summary of key decisions\n\nYou have read-only access to tools. You cannot modify files directly.\n`,\n\t\ttools: [\"read\", \"bash\", \"grep\", \"find\", \"ls\"],\n\t\tthinkingLevel: \"high\",\n\t},\n\tspec: {\n\t\tname: \"Specification\",\n\t\tdescription: \"Specification mode for creating detailed technical specs. Read-only tools, maximum reasoning.\",\n\t\tsystemPromptAddition: `\nYou are in **Specification Mode**. Your role is to create detailed technical specifications.\n\n**Guidelines for Specification Mode:**\n1. Produce comprehensive technical documentation\n2. Define clear interfaces, data structures, and contracts\n3. Specify behavior, constraints, and invariants\n4. Include error conditions and recovery procedures\n5. Define testing requirements and acceptance criteria\n6. Document performance requirements and constraints\n7. Specify security considerations\n8. Create API contracts and data models\n\n**Output Format:**\n- Overview and objectives\n- Detailed specifications with types and constraints\n- Interface definitions\n- Behavior specifications\n- Error handling specifications\n- Testing requirements\n- Implementation notes\n\nYou have read-only access to tools. You cannot modify files directly.\n`,\n\t\ttools: [\"read\", \"bash\", \"grep\", \"find\", \"ls\"],\n\t\tthinkingLevel: \"xhigh\",\n\t},\n};\n\nexport function getAgentModeConfig(mode: AgentMode): AgentModeConfig {\n\treturn AGENT_MODES[mode];\n}\n\nexport function getModePromptAddition(mode: AgentMode): string {\n\treturn AGENT_MODES[mode].systemPromptAddition;\n}\n\nexport function getModeTools(mode: AgentMode): string[] {\n\treturn AGENT_MODES[mode].tools;\n}\n\nexport function getModeThinkingLevel(mode: AgentMode): \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" {\n\treturn AGENT_MODES[mode].thinkingLevel;\n}\n\nexport function getAllModes(): AgentMode[] {\n\treturn [\"default\", \"plan\", \"spec\"];\n}\n\nexport function getClaudeSkillsPath(): string {\n\treturn join(homedir(), \".claude\", \"skills\");\n}\n"]}
@@ -0,0 +1,88 @@
1
+ import { homedir } from "node:os";
2
+ import { join } from "node:path";
3
+ export const AGENT_MODES = {
4
+ default: {
5
+ name: "Default",
6
+ description: "Standard coding assistant mode with full tool access",
7
+ systemPromptAddition: ``,
8
+ tools: ["read", "bash", "edit", "write", "grep", "find", "ls"],
9
+ thinkingLevel: "off",
10
+ },
11
+ plan: {
12
+ name: "Plan",
13
+ description: "Planning mode focused on analysis and design. Read-only tools, high reasoning.",
14
+ systemPromptAddition: `
15
+ You are in **Planning Mode**. Your role is to analyze, design, and create detailed plans.
16
+
17
+ **Guidelines for Planning Mode:**
18
+ 1. Focus on understanding the problem thoroughly before proposing solutions
19
+ 2. Break down complex tasks into manageable steps
20
+ 3. Consider edge cases, error handling, and potential issues
21
+ 4. Provide clear, actionable implementation plans
22
+ 5. Use high-level reasoning to explore multiple approaches
23
+ 6. Document dependencies and prerequisites
24
+ 7. Identify risks and mitigation strategies
25
+ 8. Create clear milestones and deliverables
26
+
27
+ **Output Format:**
28
+ - Start with a brief problem analysis
29
+ - Present the approach with rationale
30
+ - Provide step-by-step implementation plan
31
+ - Include consideration of alternatives
32
+ - End with a summary of key decisions
33
+
34
+ You have read-only access to tools. You cannot modify files directly.
35
+ `,
36
+ tools: ["read", "bash", "grep", "find", "ls"],
37
+ thinkingLevel: "high",
38
+ },
39
+ spec: {
40
+ name: "Specification",
41
+ description: "Specification mode for creating detailed technical specs. Read-only tools, maximum reasoning.",
42
+ systemPromptAddition: `
43
+ You are in **Specification Mode**. Your role is to create detailed technical specifications.
44
+
45
+ **Guidelines for Specification Mode:**
46
+ 1. Produce comprehensive technical documentation
47
+ 2. Define clear interfaces, data structures, and contracts
48
+ 3. Specify behavior, constraints, and invariants
49
+ 4. Include error conditions and recovery procedures
50
+ 5. Define testing requirements and acceptance criteria
51
+ 6. Document performance requirements and constraints
52
+ 7. Specify security considerations
53
+ 8. Create API contracts and data models
54
+
55
+ **Output Format:**
56
+ - Overview and objectives
57
+ - Detailed specifications with types and constraints
58
+ - Interface definitions
59
+ - Behavior specifications
60
+ - Error handling specifications
61
+ - Testing requirements
62
+ - Implementation notes
63
+
64
+ You have read-only access to tools. You cannot modify files directly.
65
+ `,
66
+ tools: ["read", "bash", "grep", "find", "ls"],
67
+ thinkingLevel: "xhigh",
68
+ },
69
+ };
70
+ export function getAgentModeConfig(mode) {
71
+ return AGENT_MODES[mode];
72
+ }
73
+ export function getModePromptAddition(mode) {
74
+ return AGENT_MODES[mode].systemPromptAddition;
75
+ }
76
+ export function getModeTools(mode) {
77
+ return AGENT_MODES[mode].tools;
78
+ }
79
+ export function getModeThinkingLevel(mode) {
80
+ return AGENT_MODES[mode].thinkingLevel;
81
+ }
82
+ export function getAllModes() {
83
+ return ["default", "plan", "spec"];
84
+ }
85
+ export function getClaudeSkillsPath() {
86
+ return join(homedir(), ".claude", "skills");
87
+ }
88
+ //# sourceMappingURL=agent-modes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-modes.js","sourceRoot":"","sources":["../../src/core/agent-modes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAYjC,MAAM,CAAC,MAAM,WAAW,GAAuC;IAC9D,OAAO,EAAE;QACR,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,sDAAsD;QACnE,oBAAoB,EAAE,EAAE;QACxB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC;QAC9D,aAAa,EAAE,KAAK;KACpB;IACD,IAAI,EAAE;QACL,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,gFAAgF;QAC7F,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;CAqBvB;QACC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC;QAC7C,aAAa,EAAE,MAAM;KACrB;IACD,IAAI,EAAE;QACL,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,+FAA+F;QAC5G,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;CAuBvB;QACC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC;QAC7C,aAAa,EAAE,OAAO;KACtB;CACD,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAAC,IAAe,EAAmB;IACpE,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;AAAA,CACzB;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAe,EAAU;IAC9D,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC;AAAA,CAC9C;AAED,MAAM,UAAU,YAAY,CAAC,IAAe,EAAY;IACvD,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;AAAA,CAC/B;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAe,EAA2D;IAC9G,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC;AAAA,CACvC;AAED,MAAM,UAAU,WAAW,GAAgB;IAC1C,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAAA,CACnC;AAED,MAAM,UAAU,mBAAmB,GAAW;IAC7C,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAAA,CAC5C","sourcesContent":["import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\n\nexport type AgentMode = \"default\" | \"plan\" | \"spec\";\n\nexport interface AgentModeConfig {\n\tname: string;\n\tdescription: string;\n\tsystemPromptAddition: string;\n\ttools: string[];\n\tthinkingLevel: \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\";\n}\n\nexport const AGENT_MODES: Record<AgentMode, AgentModeConfig> = {\n\tdefault: {\n\t\tname: \"Default\",\n\t\tdescription: \"Standard coding assistant mode with full tool access\",\n\t\tsystemPromptAddition: ``,\n\t\ttools: [\"read\", \"bash\", \"edit\", \"write\", \"grep\", \"find\", \"ls\"],\n\t\tthinkingLevel: \"off\",\n\t},\n\tplan: {\n\t\tname: \"Plan\",\n\t\tdescription: \"Planning mode focused on analysis and design. Read-only tools, high reasoning.\",\n\t\tsystemPromptAddition: `\nYou are in **Planning Mode**. Your role is to analyze, design, and create detailed plans.\n\n**Guidelines for Planning Mode:**\n1. Focus on understanding the problem thoroughly before proposing solutions\n2. Break down complex tasks into manageable steps\n3. Consider edge cases, error handling, and potential issues\n4. Provide clear, actionable implementation plans\n5. Use high-level reasoning to explore multiple approaches\n6. Document dependencies and prerequisites\n7. Identify risks and mitigation strategies\n8. Create clear milestones and deliverables\n\n**Output Format:**\n- Start with a brief problem analysis\n- Present the approach with rationale\n- Provide step-by-step implementation plan\n- Include consideration of alternatives\n- End with a summary of key decisions\n\nYou have read-only access to tools. You cannot modify files directly.\n`,\n\t\ttools: [\"read\", \"bash\", \"grep\", \"find\", \"ls\"],\n\t\tthinkingLevel: \"high\",\n\t},\n\tspec: {\n\t\tname: \"Specification\",\n\t\tdescription: \"Specification mode for creating detailed technical specs. Read-only tools, maximum reasoning.\",\n\t\tsystemPromptAddition: `\nYou are in **Specification Mode**. Your role is to create detailed technical specifications.\n\n**Guidelines for Specification Mode:**\n1. Produce comprehensive technical documentation\n2. Define clear interfaces, data structures, and contracts\n3. Specify behavior, constraints, and invariants\n4. Include error conditions and recovery procedures\n5. Define testing requirements and acceptance criteria\n6. Document performance requirements and constraints\n7. Specify security considerations\n8. Create API contracts and data models\n\n**Output Format:**\n- Overview and objectives\n- Detailed specifications with types and constraints\n- Interface definitions\n- Behavior specifications\n- Error handling specifications\n- Testing requirements\n- Implementation notes\n\nYou have read-only access to tools. You cannot modify files directly.\n`,\n\t\ttools: [\"read\", \"bash\", \"grep\", \"find\", \"ls\"],\n\t\tthinkingLevel: \"xhigh\",\n\t},\n};\n\nexport function getAgentModeConfig(mode: AgentMode): AgentModeConfig {\n\treturn AGENT_MODES[mode];\n}\n\nexport function getModePromptAddition(mode: AgentMode): string {\n\treturn AGENT_MODES[mode].systemPromptAddition;\n}\n\nexport function getModeTools(mode: AgentMode): string[] {\n\treturn AGENT_MODES[mode].tools;\n}\n\nexport function getModeThinkingLevel(mode: AgentMode): \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" {\n\treturn AGENT_MODES[mode].thinkingLevel;\n}\n\nexport function getAllModes(): AgentMode[] {\n\treturn [\"default\", \"plan\", \"spec\"];\n}\n\nexport function getClaudeSkillsPath(): string {\n\treturn join(homedir(), \".claude\", \"skills\");\n}\n"]}
@@ -24,6 +24,7 @@ import type { ResourceLoader } from "./resource-loader.js";
24
24
  import type { BranchSummaryEntry, SessionManager } from "./session-manager.js";
25
25
  import type { SettingsManager } from "./settings-manager.js";
26
26
  import type { BashOperations } from "./tools/bash.js";
27
+ import type { AgentMode } from "./agent-modes.js";
27
28
  /** Parsed skill block from a user message */
28
29
  export interface ParsedSkillBlock {
29
30
  name: string;
@@ -84,6 +85,8 @@ export interface AgentSessionConfig {
84
85
  extensionRunnerRef?: {
85
86
  current?: ExtensionRunner;
86
87
  };
88
+ /** Initial agent mode. Default: "default" */
89
+ initialMode?: AgentMode;
87
90
  }
88
91
  export interface ExtensionBindings {
89
92
  uiContext?: ExtensionUIContext;
@@ -170,6 +173,7 @@ export declare class AgentSession {
170
173
  private _toolPromptSnippets;
171
174
  private _toolPromptGuidelines;
172
175
  private _baseSystemPrompt;
176
+ private _mode;
173
177
  constructor(config: AgentSessionConfig);
174
178
  /** Model registry for API key resolution and model discovery */
175
179
  get modelRegistry(): ModelRegistry;
@@ -216,6 +220,28 @@ export declare class AgentSession {
216
220
  get model(): Model<any> | undefined;
217
221
  /** Current thinking level */
218
222
  get thinkingLevel(): ThinkingLevel;
223
+ /** Current agent mode */
224
+ get mode(): AgentMode;
225
+ /**
226
+ * Set agent mode.
227
+ * Updates tools, thinking level, and system prompt based on the mode.
228
+ */
229
+ setMode(mode: AgentMode): void;
230
+ /**
231
+ * Cycle to next agent mode.
232
+ * @returns New mode name
233
+ */
234
+ cycleMode(): AgentMode;
235
+ /**
236
+ * Set the model for the agent.
237
+ * Updates thinking level based on model capabilities.
238
+ */
239
+ setModel(model: Model<any>): Promise<void>;
240
+ /**
241
+ * Cycle to next model in scoped models list.
242
+ * @returns Model cycle result or undefined if no scoped models
243
+ */
244
+ cycleModel(): Promise<ModelCycleResult | undefined>;
219
245
  /** Whether agent is currently streaming a response */
220
246
  get isStreaming(): boolean;
221
247
  /** Current effective system prompt (includes any per-turn extension modifications) */