genieceo 0.1.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 (87) hide show
  1. package/DEVELOPMENT.md +240 -0
  2. package/LICENSE +21 -0
  3. package/README.md +443 -0
  4. package/config.example.json +28 -0
  5. package/dist/agent/context.d.ts +38 -0
  6. package/dist/agent/context.d.ts.map +1 -0
  7. package/dist/agent/context.js +131 -0
  8. package/dist/agent/context.js.map +1 -0
  9. package/dist/agent/index.d.ts +10 -0
  10. package/dist/agent/index.d.ts.map +1 -0
  11. package/dist/agent/index.js +54 -0
  12. package/dist/agent/index.js.map +1 -0
  13. package/dist/agent/loop.d.ts +40 -0
  14. package/dist/agent/loop.d.ts.map +1 -0
  15. package/dist/agent/loop.js +104 -0
  16. package/dist/agent/loop.js.map +1 -0
  17. package/dist/agent/subagent.d.ts +35 -0
  18. package/dist/agent/subagent.d.ts.map +1 -0
  19. package/dist/agent/subagent.js +96 -0
  20. package/dist/agent/subagent.js.map +1 -0
  21. package/dist/cli/commands/chat.d.ts +8 -0
  22. package/dist/cli/commands/chat.d.ts.map +1 -0
  23. package/dist/cli/commands/chat.js +161 -0
  24. package/dist/cli/commands/chat.js.map +1 -0
  25. package/dist/cli/commands/init.d.ts +6 -0
  26. package/dist/cli/commands/init.d.ts.map +1 -0
  27. package/dist/cli/commands/init.js +56 -0
  28. package/dist/cli/commands/init.js.map +1 -0
  29. package/dist/cli/commands/onboard.d.ts +6 -0
  30. package/dist/cli/commands/onboard.d.ts.map +1 -0
  31. package/dist/cli/commands/onboard.js +277 -0
  32. package/dist/cli/commands/onboard.js.map +1 -0
  33. package/dist/cli/commands/status.d.ts +6 -0
  34. package/dist/cli/commands/status.d.ts.map +1 -0
  35. package/dist/cli/commands/status.js +107 -0
  36. package/dist/cli/commands/status.js.map +1 -0
  37. package/dist/cli/index.d.ts +3 -0
  38. package/dist/cli/index.d.ts.map +1 -0
  39. package/dist/cli/index.js +49 -0
  40. package/dist/cli/index.js.map +1 -0
  41. package/dist/config/manager.d.ts +43 -0
  42. package/dist/config/manager.d.ts.map +1 -0
  43. package/dist/config/manager.js +147 -0
  44. package/dist/config/manager.js.map +1 -0
  45. package/dist/config/schema.d.ts +179 -0
  46. package/dist/config/schema.d.ts.map +1 -0
  47. package/dist/config/schema.js +74 -0
  48. package/dist/config/schema.js.map +1 -0
  49. package/dist/providers/llm.d.ts +46 -0
  50. package/dist/providers/llm.d.ts.map +1 -0
  51. package/dist/providers/llm.js +175 -0
  52. package/dist/providers/llm.js.map +1 -0
  53. package/dist/skills/loader.d.ts +49 -0
  54. package/dist/skills/loader.d.ts.map +1 -0
  55. package/dist/skills/loader.js +218 -0
  56. package/dist/skills/loader.js.map +1 -0
  57. package/dist/tools/base.d.ts +42 -0
  58. package/dist/tools/base.d.ts.map +1 -0
  59. package/dist/tools/base.js +90 -0
  60. package/dist/tools/base.js.map +1 -0
  61. package/dist/tools/filesystem.d.ts +17 -0
  62. package/dist/tools/filesystem.d.ts.map +1 -0
  63. package/dist/tools/filesystem.js +117 -0
  64. package/dist/tools/filesystem.js.map +1 -0
  65. package/dist/tools/shell.d.ts +8 -0
  66. package/dist/tools/shell.d.ts.map +1 -0
  67. package/dist/tools/shell.js +79 -0
  68. package/dist/tools/shell.js.map +1 -0
  69. package/dist/tools/spawn.d.ts +8 -0
  70. package/dist/tools/spawn.d.ts.map +1 -0
  71. package/dist/tools/spawn.js +23 -0
  72. package/dist/tools/spawn.js.map +1 -0
  73. package/dist/tools/web.d.ts +8 -0
  74. package/dist/tools/web.d.ts.map +1 -0
  75. package/dist/tools/web.js +194 -0
  76. package/dist/tools/web.js.map +1 -0
  77. package/dist/types/index.d.ts +51 -0
  78. package/dist/types/index.d.ts.map +1 -0
  79. package/dist/types/index.js +6 -0
  80. package/dist/types/index.js.map +1 -0
  81. package/dist/workspace/manager.d.ts +38 -0
  82. package/dist/workspace/manager.d.ts.map +1 -0
  83. package/dist/workspace/manager.js +140 -0
  84. package/dist/workspace/manager.js.map +1 -0
  85. package/docs/ONBOARDING.md +229 -0
  86. package/docs/WEB_SEARCH.md +365 -0
  87. package/package.json +38 -0
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkspaceManager = void 0;
4
+ exports.getWorkspaceManager = getWorkspaceManager;
5
+ const promises_1 = require("fs/promises");
6
+ const fs_1 = require("fs");
7
+ const path_1 = require("path");
8
+ const os_1 = require("os");
9
+ /**
10
+ * Workspace Manager
11
+ * Handles initialization and management of the workspace directory
12
+ */
13
+ class WorkspaceManager {
14
+ constructor(workspacePath) {
15
+ this.workspacePath = workspacePath || (0, path_1.join)((0, os_1.homedir)(), '.genieceo', 'workspace');
16
+ }
17
+ /**
18
+ * Initialize workspace with directory structure
19
+ */
20
+ async init() {
21
+ try {
22
+ // Create main workspace directory
23
+ if (!(0, fs_1.existsSync)(this.workspacePath)) {
24
+ await (0, promises_1.mkdir)(this.workspacePath, { recursive: true });
25
+ }
26
+ // Create subdirectories
27
+ const subdirs = [
28
+ 'skills',
29
+ 'files',
30
+ ];
31
+ for (const subdir of subdirs) {
32
+ const path = (0, path_1.join)(this.workspacePath, subdir);
33
+ if (!(0, fs_1.existsSync)(path)) {
34
+ await (0, promises_1.mkdir)(path, { recursive: true });
35
+ }
36
+ }
37
+ // Create AGENTS.md if it doesn't exist
38
+ const agentsPath = (0, path_1.join)(this.workspacePath, 'AGENTS.md');
39
+ if (!(0, fs_1.existsSync)(agentsPath)) {
40
+ await (0, promises_1.writeFile)(agentsPath, this.getDefaultAgentsContent());
41
+ }
42
+ }
43
+ catch (error) {
44
+ throw new Error(`Failed to initialize workspace: ${error instanceof Error ? error.message : error}`);
45
+ }
46
+ }
47
+ /**
48
+ * Get workspace root path
49
+ */
50
+ getWorkspacePath() {
51
+ return this.workspacePath;
52
+ }
53
+ /**
54
+ * Get custom skills directory path
55
+ */
56
+ getSkillsPath() {
57
+ return (0, path_1.join)(this.workspacePath, 'skills');
58
+ }
59
+ /**
60
+ * Get working files directory path
61
+ */
62
+ getFilesPath() {
63
+ return (0, path_1.join)(this.workspacePath, 'files');
64
+ }
65
+ /**
66
+ * Get AGENTS.md path
67
+ */
68
+ getAgentsFilePath() {
69
+ return (0, path_1.join)(this.workspacePath, 'AGENTS.md');
70
+ }
71
+ /**
72
+ * Check if workspace is initialized
73
+ */
74
+ async isInitialized() {
75
+ try {
76
+ await (0, promises_1.access)(this.workspacePath);
77
+ await (0, promises_1.access)((0, path_1.join)(this.workspacePath, 'skills'));
78
+ await (0, promises_1.access)((0, path_1.join)(this.workspacePath, 'files'));
79
+ return true;
80
+ }
81
+ catch {
82
+ return false;
83
+ }
84
+ }
85
+ /**
86
+ * Get default AGENTS.md content
87
+ */
88
+ getDefaultAgentsContent() {
89
+ return `# genieceo Agent Configuration
90
+
91
+ ## Identity
92
+
93
+ You are **genieceo**, an AI agent CLI assistant designed to help users with various tasks including:
94
+
95
+ - Reading and writing files
96
+ - Executing shell commands safely
97
+ - Searching the web for information
98
+ - Breaking down complex tasks using subagents
99
+ - Learning new skills through the skill system
100
+
101
+ ## Guidelines
102
+
103
+ 1. **Be helpful and efficient**: Focus on solving the user's problem directly
104
+ 2. **Use tools wisely**: Choose the right tool for each task
105
+ 3. **Safety first**: Never execute dangerous commands without user confirmation
106
+ 4. **Learn and adapt**: Use skills to handle specialized tasks effectively
107
+ 5. **Delegate complex tasks**: Use subagents for independent work that can run in parallel
108
+
109
+ ## Workspace
110
+
111
+ Your workspace is located at: ${this.workspacePath}
112
+
113
+ - \`files/\` - Your working directory for file operations
114
+ - \`skills/\` - Custom skills you can learn
115
+
116
+ ## Capabilities
117
+
118
+ You have access to the following core tools:
119
+
120
+ - **readFile**: Read file contents
121
+ - **writeFile**: Create or overwrite files
122
+ - **listDir**: List directory contents
123
+ - **executeCommand**: Run shell commands (with safety checks)
124
+ - **webSearch**: Search the web using multiple providers (Tavily, Brave, or browser fallback)
125
+ - **spawnSubagent**: Create background agents for complex subtasks
126
+
127
+ Remember: You're here to assist and make the user's work easier. Be proactive, thorough, and clear in your communication.
128
+ `;
129
+ }
130
+ }
131
+ exports.WorkspaceManager = WorkspaceManager;
132
+ // Singleton instance
133
+ let workspaceManagerInstance = null;
134
+ function getWorkspaceManager(workspacePath) {
135
+ if (!workspaceManagerInstance) {
136
+ workspaceManagerInstance = new WorkspaceManager(workspacePath);
137
+ }
138
+ return workspaceManagerInstance;
139
+ }
140
+ //# sourceMappingURL=manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/workspace/manager.ts"],"names":[],"mappings":";;;AA8IA,kDAKC;AAnJD,0CAAuD;AACvD,2BAAgC;AAChC,+BAA4B;AAC5B,2BAA6B;AAE7B;;;GAGG;AAEH,MAAa,gBAAgB;IAG3B,YAAY,aAAsB;QAChC,IAAI,CAAC,aAAa,GAAG,aAAa,IAAI,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IAClF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC;YACH,kCAAkC;YAClC,IAAI,CAAC,IAAA,eAAU,EAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;gBACpC,MAAM,IAAA,gBAAK,EAAC,IAAI,CAAC,aAAa,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YACvD,CAAC;YAED,wBAAwB;YACxB,MAAM,OAAO,GAAG;gBACd,QAAQ;gBACR,OAAO;aACR,CAAC;YAEF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC7B,MAAM,IAAI,GAAG,IAAA,WAAI,EAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;gBAC9C,IAAI,CAAC,IAAA,eAAU,EAAC,IAAI,CAAC,EAAE,CAAC;oBACtB,MAAM,IAAA,gBAAK,EAAC,IAAI,EAAE,EAAE,SAAS,E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AAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;OAEG;IACK,uBAAuB;QAC7B,OAAO;;;;;;;;;;;;;;;;;;;;;;gCAsBqB,IAAI,CAAC,aAAa;;;;;;;;;;;;;;;;;CAiBjD,CAAC;IACA,CAAC;CACF;AA/HD,4CA+HC;AAED,qBAAqB;AACrB,IAAI,wBAAwB,GAA4B,IAAI,CAAC;AAE7D,SAAgB,mBAAmB,CAAC,aAAsB;IACxD,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAC9B,wBAAwB,GAAG,IAAI,gBAAgB,CAAC,aAAa,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
@@ -0,0 +1,229 @@
1
+ # Onboarding Guide
2
+
3
+ The `genieceo onboard` command provides an interactive setup wizard to help you configure your AI agent.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ genieceo onboard
9
+ ```
10
+
11
+ This will guide you through setting up:
12
+ 1. **LLM Provider** - Select and configure your language model provider
13
+ 2. **Health Check** - Verify your LLM setup with a real API call
14
+ 3. **Web Search** - Configure web search capabilities
15
+
16
+ ## Step-by-Step Walkthrough
17
+
18
+ ### Step 1: LLM Configuration
19
+
20
+ The wizard will help you:
21
+
22
+ 1. **Select a Provider**
23
+ - Choose from available providers (OpenAI, Anthropic, Google, etc.)
24
+ - Default: OpenAI
25
+ - Providers are automatically discovered via `@mariozechner/pi-ai`
26
+
27
+ 2. **Enter API Key**
28
+ - Provide your API key for the selected provider
29
+ - If a key already exists, you can press Enter to keep it
30
+ - Keys are stored securely in `~/.genieceo/config.json`
31
+
32
+ 3. **Select a Model**
33
+ - The wizard automatically fetches available models for your provider
34
+ - You can select by number or enter the model ID directly
35
+ - Example models:
36
+ - OpenAI: `gpt-4o`, `gpt-4-turbo`, `gpt-3.5-turbo`
37
+ - Anthropic: `claude-3-5-sonnet-20241022`, `claude-3-opus-20240229`
38
+
39
+ ### Step 2: Health Check
40
+
41
+ The wizard performs a health check to ensure your LLM is configured correctly:
42
+
43
+ 1. **Configuration Validation**
44
+ - Checks that the provider exists
45
+ - Verifies API key format
46
+ - Validates model availability
47
+
48
+ 2. **Test API Call**
49
+ - Makes a simple API request to verify connectivity
50
+ - Shows the response and token usage
51
+ - If the test fails, you'll see a detailed error message
52
+
53
+ Example output:
54
+ ```
55
+ ✓ Configuration validated
56
+ ✓ LLM health check passed
57
+ Response: Hello! I am working correctly.
58
+ Tokens used: 23
59
+ ```
60
+
61
+ ### Step 3: Web Search Configuration
62
+
63
+ Configure web search capabilities:
64
+
65
+ 1. **Select Provider**
66
+ - `auto` (recommended) - Tries providers in order: Tavily → Brave → Browser
67
+ - `tavily` - Use Tavily Search API only
68
+ - `brave` - Use Brave Search API only
69
+ - `browser` - Use free browser-based search (no API key needed)
70
+
71
+ 2. **Configure API Keys**
72
+ - For `auto` mode: Optionally configure Tavily and/or Brave
73
+ - For specific providers: Enter the required API key
74
+ - Browser mode requires no API key
75
+
76
+ #### Getting API Keys
77
+
78
+ **Tavily (Recommended)**
79
+ - Website: https://tavily.com
80
+ - Free tier: 1,000 searches/month
81
+ - Best for: AI agent applications with high-quality results
82
+
83
+ **Brave Search**
84
+ - Website: https://brave.com/search/api
85
+ - Note: Now requires payment
86
+ - Best for: Privacy-focused search
87
+
88
+ **Browser Mode**
89
+ - No API key needed
90
+ - Uses DuckDuckGo HTML search
91
+ - Good enough for most use cases
92
+
93
+ ## Configuration File
94
+
95
+ The onboard command saves your configuration to `~/.genieceo/config.json`:
96
+
97
+ ```json
98
+ {
99
+ "workspace": "~/.genieceo/workspace",
100
+ "model": "openai:gpt-4o",
101
+ "maxIterations": 15,
102
+ "llm": {
103
+ "openai": {
104
+ "apiKey": "sk-proj-..."
105
+ },
106
+ "anthropic": {
107
+ "apiKey": "sk-ant-..."
108
+ }
109
+ },
110
+ "tools": {
111
+ "webSearch": {
112
+ "provider": "auto",
113
+ "tavily": {
114
+ "apiKey": "tvly-..."
115
+ },
116
+ "brave": {
117
+ "apiKey": "BSA..."
118
+ }
119
+ },
120
+ "shell": {
121
+ "timeout": 30000,
122
+ "allowDangerous": false
123
+ }
124
+ }
125
+ }
126
+ ```
127
+
128
+ ## Common Issues
129
+
130
+ ### Issue: "Failed to get model"
131
+
132
+ **Solution:** Check that your API key is correct and has access to the selected model.
133
+
134
+ ### Issue: "LLM health check failed"
135
+
136
+ **Possible causes:**
137
+ - Invalid API key
138
+ - Network connectivity issues
139
+ - Insufficient API credits
140
+ - Rate limiting
141
+
142
+ **Solution:** Verify your API key and check your provider's dashboard for account status.
143
+
144
+ ### Issue: "Could not fetch models for this provider"
145
+
146
+ **Solution:** You can manually enter the model ID. Check your provider's documentation for available models.
147
+
148
+ ### Issue: Web search not working
149
+
150
+ **Solution:**
151
+ - For `auto` mode: Configure at least one API provider (Tavily or Brave)
152
+ - For specific providers: Verify your API key is correct
153
+ - For `browser` mode: Check your internet connection
154
+
155
+ ## Re-running Onboard
156
+
157
+ You can run `genieceo onboard` multiple times to:
158
+ - Switch providers
159
+ - Update API keys
160
+ - Change models
161
+ - Reconfigure web search
162
+
163
+ Existing configuration values will be shown, and you can press Enter to keep them.
164
+
165
+ ## Manual Configuration
166
+
167
+ If you prefer to edit the configuration manually:
168
+
169
+ ```bash
170
+ # Open the config file
171
+ vim ~/.genieceo/config.json
172
+
173
+ # Or use your preferred editor
174
+ code ~/.genieceo/config.json
175
+ ```
176
+
177
+ After manual edits, verify your configuration:
178
+
179
+ ```bash
180
+ genieceo status
181
+ ```
182
+
183
+ ## Next Steps
184
+
185
+ After completing onboarding:
186
+
187
+ ```bash
188
+ # Start a chat
189
+ genieceo chat
190
+
191
+ # Send a single message
192
+ genieceo chat -m "What is 2+2?"
193
+
194
+ # Check status
195
+ genieceo status
196
+ ```
197
+
198
+ ## Security Notes
199
+
200
+ - API keys are stored in plain text in `~/.genieceo/config.json`
201
+ - Ensure proper file permissions: `chmod 600 ~/.genieceo/config.json`
202
+ - Never commit your config file to version control
203
+ - Keep your API keys secure and rotate them regularly
204
+
205
+ ## Troubleshooting
206
+
207
+ ### Enable Debug Mode
208
+
209
+ Set environment variable for detailed logging:
210
+
211
+ ```bash
212
+ DEBUG=genieceo:* genieceo onboard
213
+ ```
214
+
215
+ ### Reset Configuration
216
+
217
+ To start fresh:
218
+
219
+ ```bash
220
+ rm -rf ~/.genieceo
221
+ genieceo init
222
+ genieceo onboard
223
+ ```
224
+
225
+ ## Support
226
+
227
+ For issues or questions:
228
+ - GitHub Issues: https://github.com/yourusername/genieceo/issues
229
+ - Documentation: https://github.com/yourusername/genieceo#readme