agent-world 0.11.0 → 0.12.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 +55 -4
- package/dist/cli/commands.d.ts +109 -0
- package/dist/cli/commands.js +2024 -0
- package/dist/cli/display.d.ts +124 -0
- package/dist/cli/display.js +381 -0
- package/dist/cli/hitl.d.ts +33 -0
- package/dist/cli/hitl.js +81 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/stream.d.ts +41 -0
- package/dist/cli/stream.js +222 -0
- package/dist/core/activity-tracker.d.ts +16 -0
- package/dist/core/activity-tracker.d.ts.map +1 -0
- package/dist/core/activity-tracker.js +91 -0
- package/dist/core/activity-tracker.js.map +1 -0
- package/dist/core/ai-commands.d.ts +16 -0
- package/dist/core/ai-commands.d.ts.map +1 -0
- package/dist/core/ai-commands.js +24 -0
- package/dist/core/ai-commands.js.map +1 -0
- package/dist/core/ai-sdk-patch.d.ts +24 -0
- package/dist/core/ai-sdk-patch.d.ts.map +1 -0
- package/dist/core/ai-sdk-patch.js +169 -0
- package/dist/core/ai-sdk-patch.js.map +1 -0
- package/dist/core/anthropic-direct.d.ts +52 -0
- package/dist/core/anthropic-direct.d.ts.map +1 -0
- package/dist/core/anthropic-direct.js +301 -0
- package/dist/core/anthropic-direct.js.map +1 -0
- package/dist/core/approval-cache.d.ts +104 -0
- package/dist/core/approval-cache.d.ts.map +1 -0
- package/dist/core/approval-cache.js +150 -0
- package/dist/core/approval-cache.js.map +1 -0
- package/dist/core/chat-constants.d.ts +20 -0
- package/dist/core/chat-constants.d.ts.map +1 -0
- package/dist/core/chat-constants.js +22 -0
- package/dist/core/chat-constants.js.map +1 -0
- package/dist/core/create-agent-tool.d.ts +66 -0
- package/dist/core/create-agent-tool.d.ts.map +1 -0
- package/dist/core/create-agent-tool.js +212 -0
- package/dist/core/create-agent-tool.js.map +1 -0
- package/dist/core/events/approval-checker.d.ts +61 -0
- package/dist/core/events/approval-checker.d.ts.map +1 -0
- package/dist/core/events/approval-checker.js +226 -0
- package/dist/core/events/approval-checker.js.map +1 -0
- package/dist/core/events/index.d.ts +25 -0
- package/dist/core/events/index.d.ts.map +1 -0
- package/dist/core/events/index.js +30 -0
- package/dist/core/events/index.js.map +1 -0
- package/dist/core/events/memory-manager.d.ts +73 -0
- package/dist/core/events/memory-manager.d.ts.map +1 -0
- package/dist/core/events/memory-manager.js +1218 -0
- package/dist/core/events/memory-manager.js.map +1 -0
- package/dist/core/events/mention-logic.d.ts +39 -0
- package/dist/core/events/mention-logic.d.ts.map +1 -0
- package/dist/core/events/mention-logic.js +163 -0
- package/dist/core/events/mention-logic.js.map +1 -0
- package/dist/core/events/orchestrator.d.ts +69 -0
- package/dist/core/events/orchestrator.d.ts.map +1 -0
- package/dist/core/events/orchestrator.js +883 -0
- package/dist/core/events/orchestrator.js.map +1 -0
- package/dist/core/events/persistence.d.ts +41 -0
- package/dist/core/events/persistence.d.ts.map +1 -0
- package/dist/core/events/persistence.js +296 -0
- package/dist/core/events/persistence.js.map +1 -0
- package/dist/core/events/publishers.d.ts +81 -0
- package/dist/core/events/publishers.d.ts.map +1 -0
- package/dist/core/events/publishers.js +272 -0
- package/dist/core/events/publishers.js.map +1 -0
- package/dist/core/events/subscribers.d.ts +45 -0
- package/dist/core/events/subscribers.d.ts.map +1 -0
- package/dist/core/events/subscribers.js +288 -0
- package/dist/core/events/subscribers.js.map +1 -0
- package/dist/core/events/tool-bridge-logging.d.ts +28 -0
- package/dist/core/events/tool-bridge-logging.d.ts.map +1 -0
- package/dist/core/events/tool-bridge-logging.js +94 -0
- package/dist/core/events/tool-bridge-logging.js.map +1 -0
- package/dist/core/events-metadata.d.ts +72 -0
- package/dist/core/events-metadata.d.ts.map +1 -0
- package/dist/core/events-metadata.js +167 -0
- package/dist/core/events-metadata.js.map +1 -0
- package/dist/core/events.d.ts +186 -0
- package/dist/core/events.d.ts.map +1 -0
- package/dist/core/events.js +1248 -0
- package/dist/core/events.js.map +1 -0
- package/dist/core/export.d.ts +106 -0
- package/dist/core/export.d.ts.map +1 -0
- package/dist/core/export.js +705 -0
- package/dist/core/export.js.map +1 -0
- package/dist/core/file-tools.d.ts +114 -0
- package/dist/core/file-tools.d.ts.map +1 -0
- package/dist/core/file-tools.js +370 -0
- package/dist/core/file-tools.js.map +1 -0
- package/dist/core/google-direct.d.ts +58 -0
- package/dist/core/google-direct.d.ts.map +1 -0
- package/dist/core/google-direct.js +298 -0
- package/dist/core/google-direct.js.map +1 -0
- package/dist/core/hitl.d.ts +54 -0
- package/dist/core/hitl.d.ts.map +1 -0
- package/dist/core/hitl.js +153 -0
- package/dist/core/hitl.js.map +1 -0
- package/dist/core/index.d.ts +59 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +70 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/llm-config.d.ts +128 -0
- package/dist/core/llm-config.d.ts.map +1 -0
- package/dist/core/llm-config.js +164 -0
- package/dist/core/llm-config.js.map +1 -0
- package/dist/core/llm-manager.d.ts +163 -0
- package/dist/core/llm-manager.d.ts.map +1 -0
- package/dist/core/llm-manager.js +669 -0
- package/dist/core/llm-manager.js.map +1 -0
- package/dist/core/load-skill-tool.d.ts +55 -0
- package/dist/core/load-skill-tool.d.ts.map +1 -0
- package/dist/core/load-skill-tool.js +468 -0
- package/dist/core/load-skill-tool.js.map +1 -0
- package/dist/core/logger.d.ts +88 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +358 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/managers.d.ts +131 -0
- package/dist/core/managers.d.ts.map +1 -0
- package/dist/core/managers.js +1223 -0
- package/dist/core/managers.js.map +1 -0
- package/dist/core/mcp-server-registry.d.ts +304 -0
- package/dist/core/mcp-server-registry.d.ts.map +1 -0
- package/dist/core/mcp-server-registry.js +1769 -0
- package/dist/core/mcp-server-registry.js.map +1 -0
- package/dist/core/mcp-tools.d.ts +56 -0
- package/dist/core/mcp-tools.d.ts.map +1 -0
- package/dist/core/mcp-tools.js +186 -0
- package/dist/core/mcp-tools.js.map +1 -0
- package/dist/core/message-prep.d.ts +81 -0
- package/dist/core/message-prep.d.ts.map +1 -0
- package/dist/core/message-prep.js +223 -0
- package/dist/core/message-prep.js.map +1 -0
- package/dist/core/message-processing-control.d.ts +54 -0
- package/dist/core/message-processing-control.d.ts.map +1 -0
- package/dist/core/message-processing-control.js +139 -0
- package/dist/core/message-processing-control.js.map +1 -0
- package/dist/core/openai-direct.d.ts +80 -0
- package/dist/core/openai-direct.d.ts.map +1 -0
- package/dist/core/openai-direct.js +374 -0
- package/dist/core/openai-direct.js.map +1 -0
- package/dist/core/shell-cmd-tool.d.ts +235 -0
- package/dist/core/shell-cmd-tool.d.ts.map +1 -0
- package/dist/core/shell-cmd-tool.js +1157 -0
- package/dist/core/shell-cmd-tool.js.map +1 -0
- package/dist/core/shell-process-registry.d.ts +88 -0
- package/dist/core/shell-process-registry.d.ts.map +1 -0
- package/dist/core/shell-process-registry.js +309 -0
- package/dist/core/shell-process-registry.js.map +1 -0
- package/dist/core/skill-registry.d.ts +75 -0
- package/dist/core/skill-registry.d.ts.map +1 -0
- package/dist/core/skill-registry.js +369 -0
- package/dist/core/skill-registry.js.map +1 -0
- package/dist/core/skill-script-runner.d.ts +89 -0
- package/dist/core/skill-script-runner.d.ts.map +1 -0
- package/dist/core/skill-script-runner.js +274 -0
- package/dist/core/skill-script-runner.js.map +1 -0
- package/dist/core/skill-selector.d.ts +65 -0
- package/dist/core/skill-selector.d.ts.map +1 -0
- package/dist/core/skill-selector.js +190 -0
- package/dist/core/skill-selector.js.map +1 -0
- package/dist/core/skill-settings.d.ts +20 -0
- package/dist/core/skill-settings.d.ts.map +1 -0
- package/dist/core/skill-settings.js +40 -0
- package/dist/core/skill-settings.js.map +1 -0
- package/dist/core/storage/agent-storage.d.ts +134 -0
- package/dist/core/storage/agent-storage.d.ts.map +1 -0
- package/dist/core/storage/agent-storage.js +498 -0
- package/dist/core/storage/agent-storage.js.map +1 -0
- package/dist/core/storage/eventStorage/fileEventStorage.d.ts +100 -0
- package/dist/core/storage/eventStorage/fileEventStorage.d.ts.map +1 -0
- package/dist/core/storage/eventStorage/fileEventStorage.js +494 -0
- package/dist/core/storage/eventStorage/fileEventStorage.js.map +1 -0
- package/dist/core/storage/eventStorage/index.d.ts +31 -0
- package/dist/core/storage/eventStorage/index.d.ts.map +1 -0
- package/dist/core/storage/eventStorage/index.js +31 -0
- package/dist/core/storage/eventStorage/index.js.map +1 -0
- package/dist/core/storage/eventStorage/memoryEventStorage.d.ts +87 -0
- package/dist/core/storage/eventStorage/memoryEventStorage.d.ts.map +1 -0
- package/dist/core/storage/eventStorage/memoryEventStorage.js +244 -0
- package/dist/core/storage/eventStorage/memoryEventStorage.js.map +1 -0
- package/dist/core/storage/eventStorage/sqliteEventStorage.d.ts +45 -0
- package/dist/core/storage/eventStorage/sqliteEventStorage.d.ts.map +1 -0
- package/dist/core/storage/eventStorage/sqliteEventStorage.js +301 -0
- package/dist/core/storage/eventStorage/sqliteEventStorage.js.map +1 -0
- package/dist/core/storage/eventStorage/types.d.ts +142 -0
- package/dist/core/storage/eventStorage/types.d.ts.map +1 -0
- package/dist/core/storage/eventStorage/types.js +43 -0
- package/dist/core/storage/eventStorage/types.js.map +1 -0
- package/dist/core/storage/eventStorage/validation.d.ts +30 -0
- package/dist/core/storage/eventStorage/validation.d.ts.map +1 -0
- package/dist/core/storage/eventStorage/validation.js +68 -0
- package/dist/core/storage/eventStorage/validation.js.map +1 -0
- package/dist/core/storage/legacy-migrations.d.ts +45 -0
- package/dist/core/storage/legacy-migrations.d.ts.map +1 -0
- package/dist/core/storage/legacy-migrations.js +295 -0
- package/dist/core/storage/legacy-migrations.js.map +1 -0
- package/dist/core/storage/memory-storage.d.ts +105 -0
- package/dist/core/storage/memory-storage.d.ts.map +1 -0
- package/dist/core/storage/memory-storage.js +415 -0
- package/dist/core/storage/memory-storage.js.map +1 -0
- package/dist/core/storage/migration-runner.d.ts +96 -0
- package/dist/core/storage/migration-runner.d.ts.map +1 -0
- package/dist/core/storage/migration-runner.js +306 -0
- package/dist/core/storage/migration-runner.js.map +1 -0
- package/dist/core/storage/queue-storage.d.ts +147 -0
- package/dist/core/storage/queue-storage.d.ts.map +1 -0
- package/dist/core/storage/queue-storage.js +290 -0
- package/dist/core/storage/queue-storage.js.map +1 -0
- package/dist/core/storage/skill-storage.d.ts +136 -0
- package/dist/core/storage/skill-storage.d.ts.map +1 -0
- package/dist/core/storage/skill-storage.js +474 -0
- package/dist/core/storage/skill-storage.js.map +1 -0
- package/dist/core/storage/sqlite-schema.d.ts +95 -0
- package/dist/core/storage/sqlite-schema.d.ts.map +1 -0
- package/dist/core/storage/sqlite-schema.js +156 -0
- package/dist/core/storage/sqlite-schema.js.map +1 -0
- package/dist/core/storage/sqlite-storage.d.ts +146 -0
- package/dist/core/storage/sqlite-storage.d.ts.map +1 -0
- package/dist/core/storage/sqlite-storage.js +709 -0
- package/dist/core/storage/sqlite-storage.js.map +1 -0
- package/dist/core/storage/storage-factory.d.ts +61 -0
- package/dist/core/storage/storage-factory.d.ts.map +1 -0
- package/dist/core/storage/storage-factory.js +794 -0
- package/dist/core/storage/storage-factory.js.map +1 -0
- package/dist/core/storage/validation.d.ts +36 -0
- package/dist/core/storage/validation.d.ts.map +1 -0
- package/dist/core/storage/validation.js +79 -0
- package/dist/core/storage/validation.js.map +1 -0
- package/dist/core/storage/world-storage.d.ts +114 -0
- package/dist/core/storage/world-storage.d.ts.map +1 -0
- package/dist/core/storage/world-storage.js +378 -0
- package/dist/core/storage/world-storage.js.map +1 -0
- package/dist/core/subscription.d.ts +43 -0
- package/dist/core/subscription.d.ts.map +1 -0
- package/dist/core/subscription.js +227 -0
- package/dist/core/subscription.js.map +1 -0
- package/dist/core/tool-utils.d.ts +80 -0
- package/dist/core/tool-utils.d.ts.map +1 -0
- package/dist/core/tool-utils.js +273 -0
- package/dist/core/tool-utils.js.map +1 -0
- package/dist/core/types.d.ts +595 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +158 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/utils.d.ts +138 -0
- package/dist/core/utils.d.ts.map +1 -0
- package/dist/core/utils.js +478 -0
- package/dist/core/utils.js.map +1 -0
- package/dist/core/world-class.d.ts +43 -0
- package/dist/core/world-class.d.ts.map +1 -0
- package/dist/core/world-class.js +90 -0
- package/dist/core/world-class.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/public/assets/agent-sprites-DJFgj-zP.png +0 -0
- package/dist/public/assets/border-KHK37r8y.svg +83 -0
- package/dist/public/assets/index-C9kPXL6G.css +1 -0
- package/dist/public/assets/index-DOQEHGWt.js +96 -0
- package/dist/public/index.html +21 -0
- package/dist/server/api.d.ts +2 -0
- package/dist/server/api.js +1124 -0
- package/dist/server/index.d.ts +29 -0
- package/dist/server/sse-handler.d.ts +62 -0
- package/dist/server/sse-handler.js +234 -0
- package/package.json +21 -5
- package/scripts/launch-electron.js +0 -58
package/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Agent World
|
|
2
2
|
|
|
3
|
+
[](https://github.com/yysun/agent-world/releases)
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="electron/assets/icons/agent-world-icon.svg" alt="Agent World Logo" width="120" />
|
|
7
|
+
</p>
|
|
8
|
+
|
|
3
9
|
*Build AI agent teams with just words—no coding required.*
|
|
4
10
|
|
|
5
11
|
## Why Agent World?
|
|
@@ -29,9 +35,28 @@ Paste that prompt. Agents come alive instantly.
|
|
|
29
35
|
- ✅ No Code Required - Agents are defined entirely in natural language
|
|
30
36
|
- ✅ Natural Communication - Agents understand context and conversations
|
|
31
37
|
- ✅ Built-in Rules for Messages - Turn limits to prevent loops
|
|
32
|
-
- ✅
|
|
38
|
+
- ✅ Concurrent Chat Sessions - Isolated `chatId` routing enables parallel conversations
|
|
39
|
+
- ✅ Progressive Agent Skills - Skills are discovered and loaded on demand via `load_skill`
|
|
40
|
+
- ✅ Cross-Client HITL Approval - Option-based approvals in CLI, Web, and Electron
|
|
41
|
+
- ✅ Runtime Controls - Session-scoped send/stop flows and tool lifecycle visibility
|
|
42
|
+
- ✅ Safer Tool Execution - Trusted-CWD and argument-scope guards for `shell_cmd`
|
|
33
43
|
- ✅ Multiple AI Providers - Use different models for different agents
|
|
34
|
-
- ✅
|
|
44
|
+
- ✅ Web + CLI + Electron - Modern interfaces with real-time streaming and status feedback
|
|
45
|
+
|
|
46
|
+
## Latest Highlights (since v0.11.1)
|
|
47
|
+
|
|
48
|
+
- Web app now includes a Settings page, chat-history search, and branch-from-message workflow
|
|
49
|
+
- Built-in `create_agent` tool now supports approval-first creation and inherits world chat defaults
|
|
50
|
+
- File exploration is easier with built-in `read_file`, `list_files` (including recursive mode), and `grep`
|
|
51
|
+
- Electron now supports folder-based world import/export with validation and conflict handling
|
|
52
|
+
- Chat UX is smoother with clearer inline working status, better streaming feedback, and UI refinements
|
|
53
|
+
- Real-time refresh behavior is improved across web and desktop when agents/world data changes
|
|
54
|
+
|
|
55
|
+
## Release Notes
|
|
56
|
+
|
|
57
|
+
- **v0.12.0** - Web settings/search/branching, built-in `create_agent`, new file tools, Electron folder import/export, and chat/status UX improvements
|
|
58
|
+
- **v0.11.0** - Electron desktop workflow, concurrent chat sessions, main-agent routing, progressive skills + HITL, and runtime safety hardening
|
|
59
|
+
- Full history: [CHANGELOG.md](CHANGELOG.md)
|
|
35
60
|
|
|
36
61
|
## What You Can Build
|
|
37
62
|
|
|
@@ -134,6 +159,11 @@ npx agent-world -w default-world "hi"
|
|
|
134
159
|
echo "hi" | npx agent-world -w default-world
|
|
135
160
|
```
|
|
136
161
|
|
|
162
|
+
**Option 3: Electron Desktop App (repo)**
|
|
163
|
+
```bash
|
|
164
|
+
npm run electron:dev
|
|
165
|
+
```
|
|
166
|
+
|
|
137
167
|
## Project Structure
|
|
138
168
|
|
|
139
169
|
See [Project Structure Documentation](project.md)
|
|
@@ -175,12 +205,17 @@ npm run test:watch # Watch mode
|
|
|
175
205
|
### Environment Setup
|
|
176
206
|
|
|
177
207
|
Export your API keys as environment variables
|
|
208
|
+
For Azure OpenAI, all four `AZURE_OPENAI_*` variables are required together.
|
|
178
209
|
|
|
179
210
|
```bash
|
|
180
211
|
# Required if Choose one or more
|
|
181
212
|
export OPENAI_API_KEY="your-key-here"
|
|
182
213
|
export ANTHROPIC_API_KEY="your-key-here"
|
|
183
214
|
export GOOGLE_API_KEY="your-key-here"
|
|
215
|
+
export AZURE_OPENAI_API_KEY="your-key-here"
|
|
216
|
+
export AZURE_OPENAI_RESOURCE_NAME="your-resource-name"
|
|
217
|
+
export AZURE_OPENAI_DEPLOYMENT_NAME="your-deployment-name"
|
|
218
|
+
export AZURE_OPENAI_API_VERSION="2024-10-21-preview"
|
|
184
219
|
|
|
185
220
|
# Default: For local models
|
|
186
221
|
export OLLAMA_BASE_URL="http://localhost:11434"
|
|
@@ -188,6 +223,17 @@ export OLLAMA_BASE_URL="http://localhost:11434"
|
|
|
188
223
|
|
|
189
224
|
Or create a `.env` file in your working directory with:
|
|
190
225
|
|
|
226
|
+
```bash
|
|
227
|
+
OPENAI_API_KEY=your-key-here
|
|
228
|
+
ANTHROPIC_API_KEY=your-key-here
|
|
229
|
+
GOOGLE_API_KEY=your-key-here
|
|
230
|
+
AZURE_OPENAI_API_KEY=your-key-here
|
|
231
|
+
AZURE_OPENAI_RESOURCE_NAME=your-resource-name
|
|
232
|
+
AZURE_OPENAI_DEPLOYMENT_NAME=your-deployment-name
|
|
233
|
+
AZURE_OPENAI_API_VERSION=2024-10-21-preview
|
|
234
|
+
OLLAMA_BASE_URL=http://localhost:11434
|
|
235
|
+
```
|
|
236
|
+
|
|
191
237
|
## Testing
|
|
192
238
|
|
|
193
239
|
**Run all tests:**
|
|
@@ -230,7 +276,7 @@ LOG_EVENTS_AGENT=debug LOG_LLM=debug npm run web:dev
|
|
|
230
276
|
|
|
231
277
|
**For complete logging documentation**, see [Logging Guide](docs/logging-guide.md).
|
|
232
278
|
|
|
233
|
-
##
|
|
279
|
+
## Storage Configuration
|
|
234
280
|
|
|
235
281
|
### World Database Setup
|
|
236
282
|
|
|
@@ -246,6 +292,7 @@ export AGENT_WORLD_DATA_PATH=./data/worlds
|
|
|
246
292
|
|
|
247
293
|
## Learn More
|
|
248
294
|
|
|
295
|
+
- **[Docs Home](docs/docs-home.md)** - Central navigation page for all major documentation
|
|
249
296
|
- **[Building Agents with Just Words](docs/Building%20Agents%20with%20Just%20Words.md)** - Complete guide with examples
|
|
250
297
|
- **[Shell Command Tool (shell_cmd)](docs/shell-cmd-tool.md)** - Built-in tool for executing shell commands
|
|
251
298
|
- **[HITL Approval Flow](docs/hitl-approval-flow.md)** - Option-based approval flow across Core/Electron/Web/CLI
|
|
@@ -260,11 +307,15 @@ Agent World includes built-in tools that are automatically available to all agen
|
|
|
260
307
|
### shell_cmd
|
|
261
308
|
Execute shell commands with full output capture and execution history. Perfect for file operations, system information, and automation tasks.
|
|
262
309
|
|
|
310
|
+
- Enforces trusted working-directory scope from world/tool context
|
|
311
|
+
- Validates command/path arguments to prevent out-of-scope traversal patterns
|
|
312
|
+
- Supports lifecycle tracking and session-scoped cancellation in active runtimes
|
|
313
|
+
|
|
263
314
|
```typescript
|
|
264
315
|
// Available to LLMs as 'shell_cmd' tool
|
|
265
316
|
{
|
|
266
317
|
"command": "ls",
|
|
267
|
-
|
|
318
|
+
"parameters": ["-la", "./"]
|
|
268
319
|
}
|
|
269
320
|
```
|
|
270
321
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Commands Implementation - Direct Core Integration with Space-Separated and Bidirectional Aliases
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - Direct command mapping system with interactive parameter collection
|
|
6
|
+
* - Core function calls without command processing layer
|
|
7
|
+
* - User-friendly messages with technical details for debugging
|
|
8
|
+
* - Automatic world state management and refreshing
|
|
9
|
+
* - Help message generation with command documentation
|
|
10
|
+
* - Dual input handling for commands and messages
|
|
11
|
+
* - World instance isolation and proper cleanup during refresh
|
|
12
|
+
* - Space-separated command aliases for natural command syntax
|
|
13
|
+
* - Bidirectional aliases (e.g., /chat new and /new chat both work)
|
|
14
|
+
* - Backward compatibility with hyphenated aliases
|
|
15
|
+
* - Context-sensitive commands that adapt based on world selection
|
|
16
|
+
* - World data persistence to File Storage or SQLite with folder selection
|
|
17
|
+
*
|
|
18
|
+
* Available Commands:
|
|
19
|
+
* - World: list, show, create, update, delete, select, export, save
|
|
20
|
+
* - Agent: list, show, create, update, delete, clear
|
|
21
|
+
* - Chat: list, create, select, switch, delete, rename, export
|
|
22
|
+
* - System: help, quit, exit
|
|
23
|
+
* - Short Explicit: lsw (list worlds), lsa (list agents)
|
|
24
|
+
*
|
|
25
|
+
* Alias System:
|
|
26
|
+
* - Space-separated format: /new chat, /add agent, /list worlds (preferred)
|
|
27
|
+
* - Bidirectional aliases: /chat new = /new chat, /agent add = /add agent
|
|
28
|
+
* - Backward compatible: /new-chat, /add-agent, /list-worlds (still work)
|
|
29
|
+
* - Context-sensitive: /new creates world, /add creates agent (when world selected)
|
|
30
|
+
* - Explicit aliases like /lsw, /lsa provide unambiguous targeting
|
|
31
|
+
*
|
|
32
|
+
* World Refresh Mechanism:
|
|
33
|
+
* - Commands that modify world state signal refresh requirement via `refreshWorld: true`
|
|
34
|
+
* - CLI properly destroys old world instances and creates fresh ones
|
|
35
|
+
* - Event subscriptions are cleanly transferred to new world instances
|
|
36
|
+
* - Prevents memory leaks and ensures event isolation between old/new worlds
|
|
37
|
+
* - Agent persistence maintained across refresh cycles
|
|
38
|
+
*
|
|
39
|
+
* World Save Feature:
|
|
40
|
+
* - Interactive storage type selection (File or SQLite)
|
|
41
|
+
* - Custom folder path with default option
|
|
42
|
+
* - Saves world, all agents, all chat histories, and all events
|
|
43
|
+
* - Creates target directory if it doesn't exist
|
|
44
|
+
* - Supports migration between storage types
|
|
45
|
+
* - Event history preserved across different storage backends
|
|
46
|
+
*/
|
|
47
|
+
import { World } from '../core/types.js';
|
|
48
|
+
export interface CLIResponse {
|
|
49
|
+
success: boolean;
|
|
50
|
+
message: string;
|
|
51
|
+
data?: any;
|
|
52
|
+
technicalDetails?: string;
|
|
53
|
+
needsWorldRefresh?: boolean;
|
|
54
|
+
refreshWorld?: boolean;
|
|
55
|
+
error?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface CLIContext {
|
|
58
|
+
currentWorldName?: string;
|
|
59
|
+
currentWorld?: World | null;
|
|
60
|
+
}
|
|
61
|
+
export type PromptFunction = (question: string, options?: string[]) => Promise<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Display chat messages in a formatted, readable way
|
|
64
|
+
* Shows sender, timestamp, and content for each message
|
|
65
|
+
* Logic:
|
|
66
|
+
* - HUMAN messages: deduplicate by messageId (they're replicated across all agents)
|
|
67
|
+
* - Agent messages: only show if sender matches agentId (the agent that created it)
|
|
68
|
+
* - System messages: deduplicate by messageId
|
|
69
|
+
*/
|
|
70
|
+
export declare function displayChatMessages(worldId: string, chatId?: string | null): Promise<void>;
|
|
71
|
+
type CLICommandCategory = 'world' | 'agent' | 'chat' | 'system';
|
|
72
|
+
interface CLICommandParameter {
|
|
73
|
+
name: string;
|
|
74
|
+
required: boolean;
|
|
75
|
+
description: string;
|
|
76
|
+
type: 'string' | 'number' | 'boolean';
|
|
77
|
+
options?: string[];
|
|
78
|
+
}
|
|
79
|
+
export interface CLICommandDefinition {
|
|
80
|
+
type: string;
|
|
81
|
+
requiresWorld: boolean;
|
|
82
|
+
description: string;
|
|
83
|
+
usage: string;
|
|
84
|
+
parameters: CLICommandParameter[];
|
|
85
|
+
aliases?: string[];
|
|
86
|
+
category: CLICommandCategory;
|
|
87
|
+
}
|
|
88
|
+
export declare const CLI_COMMAND_MAP: Record<string, CLICommandDefinition>;
|
|
89
|
+
export declare const CLI_COMMAND_ALIASES: Record<string, string>;
|
|
90
|
+
export declare function parseCLICommand(input: string): {
|
|
91
|
+
command: string;
|
|
92
|
+
args: string[];
|
|
93
|
+
commandType: string;
|
|
94
|
+
isValid: boolean;
|
|
95
|
+
error?: string;
|
|
96
|
+
};
|
|
97
|
+
export declare function generateHelpMessage(target?: string): string;
|
|
98
|
+
export declare function checkTargetExists(targetPath: string, storageType: 'file' | 'sqlite', worldId: string): Promise<{
|
|
99
|
+
exists: boolean;
|
|
100
|
+
message: string;
|
|
101
|
+
}>;
|
|
102
|
+
export declare function deleteExistingData(targetPath: string, storageType: 'file' | 'sqlite', worldId: string): Promise<{
|
|
103
|
+
success: boolean;
|
|
104
|
+
error?: string;
|
|
105
|
+
}>;
|
|
106
|
+
export declare function performWorldSave(world: World, storageType: 'file' | 'sqlite', targetPath: string): Promise<CLIResponse>;
|
|
107
|
+
export declare function processCLICommand(input: string, context: CLIContext, promptFn: PromptFunction): Promise<CLIResponse>;
|
|
108
|
+
export declare function processCLIInput(input: string, world: World | null, sender?: string): Promise<CLIResponse>;
|
|
109
|
+
export {};
|