agent-world 0.7.0 → 0.10.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.
- package/README.md +99 -6
- package/dist/cli/index.js +935 -143
- package/package.json +46 -22
package/README.md
CHANGED
|
@@ -133,6 +133,44 @@ echo "hi" | npx agent-world -w default-world
|
|
|
133
133
|
|
|
134
134
|
See [Project Structure Documentation](project.md)
|
|
135
135
|
|
|
136
|
+
## Development Scripts Convention
|
|
137
|
+
|
|
138
|
+
Agent World follows a consistent naming convention for all npm scripts:
|
|
139
|
+
|
|
140
|
+
| Script Pattern | Description | Example |
|
|
141
|
+
|---------------|-------------|---------|
|
|
142
|
+
| `<module>` | Shorthand for `<module>:start` | `npm run server` |
|
|
143
|
+
| `<module>:start` | Run compiled code from `dist/` | `npm run server:start` |
|
|
144
|
+
| `<module>:dev` | Run with tsx (no build needed) | `npm run server:dev` |
|
|
145
|
+
| `<module>:watch` | Run with tsx in watch mode | `npm run server:watch` |
|
|
146
|
+
|
|
147
|
+
**Available modules:** `server`, `cli`, `ws`, `tui`
|
|
148
|
+
|
|
149
|
+
**Module Dependencies:**
|
|
150
|
+
- `web:dev` / `web:watch` → Depends on `server` (waits for server to be ready)
|
|
151
|
+
- `tui:dev` / `tui:watch` → Depends on `ws` (waits for WebSocket server)
|
|
152
|
+
|
|
153
|
+
**Examples:**
|
|
154
|
+
```bash
|
|
155
|
+
# Production execution (requires build)
|
|
156
|
+
npm run server # Runs: node dist/server/index.js
|
|
157
|
+
npm run cli # Runs: node dist/cli/index.js
|
|
158
|
+
|
|
159
|
+
# Development (no build needed)
|
|
160
|
+
npm run server:dev # Runs: npx tsx server/index.ts
|
|
161
|
+
npm run ws:dev # Runs: npx tsx ws/index.ts
|
|
162
|
+
|
|
163
|
+
# Watch mode (auto-restart on changes)
|
|
164
|
+
npm run server:watch # Runs: npx tsx --watch server/index.ts
|
|
165
|
+
npm run cli:watch # Runs: npx tsx --watch cli/index.ts
|
|
166
|
+
|
|
167
|
+
# With dependencies (auto-start required services)
|
|
168
|
+
npm run web:dev # Waits for server, then starts web
|
|
169
|
+
npm run web:watch # Runs server:watch + web in parallel
|
|
170
|
+
npm run tui:dev # Waits for ws, then starts tui
|
|
171
|
+
npm run tui:watch # Runs ws:watch + tui in parallel
|
|
172
|
+
```
|
|
173
|
+
|
|
136
174
|
### Environment Setup
|
|
137
175
|
|
|
138
176
|
Export your API keys as environment variables
|
|
@@ -149,13 +187,50 @@ export OLLAMA_BASE_URL="http://localhost:11434"
|
|
|
149
187
|
|
|
150
188
|
Or create a `.env` file in your working directory with:
|
|
151
189
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
190
|
+
## Testing
|
|
191
|
+
|
|
192
|
+
**Run all tests:**
|
|
193
|
+
```bash
|
|
194
|
+
npm test # Run all unit tests
|
|
195
|
+
npm run test:watch # Watch mode with hot reload
|
|
196
|
+
npm run test:ui # Visual test UI
|
|
197
|
+
npm run test:coverage # Generate coverage report
|
|
157
198
|
```
|
|
158
199
|
|
|
200
|
+
**Run specific tests:**
|
|
201
|
+
```bash
|
|
202
|
+
npm test -- tests/core/events/ # Test a directory
|
|
203
|
+
npm test -- message-saving # Test files matching pattern
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Integration tests:**
|
|
207
|
+
```bash
|
|
208
|
+
npm run test:integration # Run integration tests with real filesystem
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Agent World uses Vitest for fast, modern testing with native TypeScript support.
|
|
212
|
+
|
|
213
|
+
## Logging and Debugging
|
|
214
|
+
|
|
215
|
+
Agent World uses **scenario-based logging** to help you debug specific issues without noise. Enable only the logs you need for your current task.
|
|
216
|
+
|
|
217
|
+
### Quick Examples
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Database migration issues
|
|
221
|
+
LOG_STORAGE_MIGRATION=info npm run server
|
|
222
|
+
|
|
223
|
+
# MCP server problems
|
|
224
|
+
LOG_MCP=debug npm run server
|
|
225
|
+
|
|
226
|
+
# Agent response debugging
|
|
227
|
+
LOG_EVENTS_AGENT=debug LOG_LLM=debug npm run server
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**For complete logging documentation**, see [Logging Guide](docs/logging-guide.md).
|
|
231
|
+
|
|
232
|
+
## Learn More
|
|
233
|
+
|
|
159
234
|
### World Database Setup
|
|
160
235
|
|
|
161
236
|
The worlds are stored in the SQLite database under the `~/agent-world` directory. You can change the database path by setting the environment variable `AGENT_WORLD_SQLITE_DATABASE`.
|
|
@@ -171,8 +246,27 @@ export AGENT_WORLD_DATA_PATH=./data/worlds
|
|
|
171
246
|
## Learn More
|
|
172
247
|
|
|
173
248
|
- **[Building Agents with Just Words](docs/Building%20Agents%20with%20Just%20Words.md)** - Complete guide with examples
|
|
249
|
+
- **[Shell Command Tool (shell_cmd)](docs/shell-cmd-tool.md)** - Built-in tool for executing shell commands
|
|
250
|
+
- **[Using Core from npm](docs/core-npm-usage.md)** - Integration guide for server and browser apps
|
|
174
251
|
|
|
175
252
|
|
|
253
|
+
## Built-in Tools
|
|
254
|
+
|
|
255
|
+
Agent World includes built-in tools that are automatically available to all agents:
|
|
256
|
+
|
|
257
|
+
### shell_cmd
|
|
258
|
+
Execute shell commands with full output capture and execution history. Perfect for file operations, system information, and automation tasks.
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
// Available to LLMs as 'shell_cmd' tool
|
|
262
|
+
{
|
|
263
|
+
"command": "ls",
|
|
264
|
+
"parameters": ["-la", "/tmp"]
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
See [Shell Command Tool Documentation](docs/shell-cmd-tool.md) for complete details.
|
|
269
|
+
|
|
176
270
|
## Experimental Features
|
|
177
271
|
|
|
178
272
|
- **MCP Support** - *Currently in experiment* - Model Context Protocol integration for tools like search and code execution. e.g.,
|
|
@@ -215,4 +309,3 @@ MIT License - Build amazing things and share them with the world!
|
|
|
215
309
|
|
|
216
310
|
Copyright © 2025 Yiyi Sun
|
|
217
311
|
|
|
218
|
-
|