agent-world 0.11.1 → 0.12.1
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 +24 -11
- package/bin/agent-world-cli.js +41 -0
- package/bin/agent-world-server.js +40 -0
- package/bin/agent-world.js +53 -0
- 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/index.js +4 -4
- package/dist/cli/stream.d.ts +41 -0
- package/dist/cli/stream.js +222 -0
- package/dist/core/activity-tracker.d.ts +15 -0
- package/dist/core/activity-tracker.d.ts.map +1 -0
- package/dist/core/activity-tracker.js +90 -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 +51 -0
- package/dist/core/anthropic-direct.d.ts.map +1 -0
- package/dist/core/anthropic-direct.js +300 -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 +19 -0
- package/dist/core/chat-constants.d.ts.map +1 -0
- package/dist/core/chat-constants.js +21 -0
- package/dist/core/chat-constants.js.map +1 -0
- package/dist/core/create-agent-tool.d.ts +65 -0
- package/dist/core/create-agent-tool.d.ts.map +1 -0
- package/dist/core/create-agent-tool.js +211 -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 +24 -0
- package/dist/core/events/index.d.ts.map +1 -0
- package/dist/core/events/index.js +29 -0
- package/dist/core/events/index.js.map +1 -0
- package/dist/core/events/memory-manager.d.ts +72 -0
- package/dist/core/events/memory-manager.d.ts.map +1 -0
- package/dist/core/events/memory-manager.js +1217 -0
- package/dist/core/events/memory-manager.js.map +1 -0
- package/dist/core/events/mention-logic.d.ts +38 -0
- package/dist/core/events/mention-logic.d.ts.map +1 -0
- package/dist/core/events/mention-logic.js +162 -0
- package/dist/core/events/mention-logic.js.map +1 -0
- package/dist/core/events/orchestrator.d.ts +68 -0
- package/dist/core/events/orchestrator.d.ts.map +1 -0
- package/dist/core/events/orchestrator.js +882 -0
- package/dist/core/events/orchestrator.js.map +1 -0
- package/dist/core/events/persistence.d.ts +40 -0
- package/dist/core/events/persistence.d.ts.map +1 -0
- package/dist/core/events/persistence.js +295 -0
- package/dist/core/events/persistence.js.map +1 -0
- package/dist/core/events/publishers.d.ts +80 -0
- package/dist/core/events/publishers.d.ts.map +1 -0
- package/dist/core/events/publishers.js +271 -0
- package/dist/core/events/publishers.js.map +1 -0
- package/dist/core/events/subscribers.d.ts +44 -0
- package/dist/core/events/subscribers.d.ts.map +1 -0
- package/dist/core/events/subscribers.js +287 -0
- package/dist/core/events/subscribers.js.map +1 -0
- package/dist/core/events/tool-bridge-logging.d.ts +27 -0
- package/dist/core/events/tool-bridge-logging.d.ts.map +1 -0
- package/dist/core/events/tool-bridge-logging.js +93 -0
- package/dist/core/events/tool-bridge-logging.js.map +1 -0
- package/dist/core/events-metadata.d.ts +71 -0
- package/dist/core/events-metadata.d.ts.map +1 -0
- package/dist/core/events-metadata.js +166 -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 +105 -0
- package/dist/core/export.d.ts.map +1 -0
- package/dist/core/export.js +704 -0
- package/dist/core/export.js.map +1 -0
- package/dist/core/file-tools.d.ts +113 -0
- package/dist/core/file-tools.d.ts.map +1 -0
- package/dist/core/file-tools.js +369 -0
- package/dist/core/file-tools.js.map +1 -0
- package/dist/core/google-direct.d.ts +57 -0
- package/dist/core/google-direct.d.ts.map +1 -0
- package/dist/core/google-direct.js +297 -0
- package/dist/core/google-direct.js.map +1 -0
- package/dist/core/hitl.d.ts +53 -0
- package/dist/core/hitl.d.ts.map +1 -0
- package/dist/core/hitl.js +152 -0
- package/dist/core/hitl.js.map +1 -0
- package/dist/core/index.d.ts +58 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +69 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/llm-config.d.ts +127 -0
- package/dist/core/llm-config.d.ts.map +1 -0
- package/dist/core/llm-config.js +163 -0
- package/dist/core/llm-config.js.map +1 -0
- package/dist/core/llm-manager.d.ts +162 -0
- package/dist/core/llm-manager.d.ts.map +1 -0
- package/dist/core/llm-manager.js +668 -0
- package/dist/core/llm-manager.js.map +1 -0
- package/dist/core/load-skill-tool.d.ts +54 -0
- package/dist/core/load-skill-tool.d.ts.map +1 -0
- package/dist/core/load-skill-tool.js +467 -0
- package/dist/core/load-skill-tool.js.map +1 -0
- package/dist/core/logger.d.ts +87 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +357 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/managers.d.ts +130 -0
- package/dist/core/managers.d.ts.map +1 -0
- package/dist/core/managers.js +1222 -0
- package/dist/core/managers.js.map +1 -0
- package/dist/core/mcp-server-registry.d.ts +303 -0
- package/dist/core/mcp-server-registry.d.ts.map +1 -0
- package/dist/core/mcp-server-registry.js +1768 -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 +80 -0
- package/dist/core/message-prep.d.ts.map +1 -0
- package/dist/core/message-prep.js +222 -0
- package/dist/core/message-prep.js.map +1 -0
- package/dist/core/message-processing-control.d.ts +53 -0
- package/dist/core/message-processing-control.d.ts.map +1 -0
- package/dist/core/message-processing-control.js +138 -0
- package/dist/core/message-processing-control.js.map +1 -0
- package/dist/core/openai-direct.d.ts +79 -0
- package/dist/core/openai-direct.d.ts.map +1 -0
- package/dist/core/openai-direct.js +373 -0
- package/dist/core/openai-direct.js.map +1 -0
- package/dist/core/shell-cmd-tool.d.ts +234 -0
- package/dist/core/shell-cmd-tool.d.ts.map +1 -0
- package/dist/core/shell-cmd-tool.js +1156 -0
- package/dist/core/shell-cmd-tool.js.map +1 -0
- package/dist/core/shell-process-registry.d.ts +87 -0
- package/dist/core/shell-process-registry.d.ts.map +1 -0
- package/dist/core/shell-process-registry.js +308 -0
- package/dist/core/shell-process-registry.js.map +1 -0
- package/dist/core/skill-registry.d.ts +74 -0
- package/dist/core/skill-registry.d.ts.map +1 -0
- package/dist/core/skill-registry.js +368 -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 +19 -0
- package/dist/core/skill-settings.d.ts.map +1 -0
- package/dist/core/skill-settings.js +39 -0
- package/dist/core/skill-settings.js.map +1 -0
- package/dist/core/storage/agent-storage.d.ts +133 -0
- package/dist/core/storage/agent-storage.d.ts.map +1 -0
- package/dist/core/storage/agent-storage.js +497 -0
- package/dist/core/storage/agent-storage.js.map +1 -0
- package/dist/core/storage/eventStorage/fileEventStorage.d.ts +99 -0
- package/dist/core/storage/eventStorage/fileEventStorage.d.ts.map +1 -0
- package/dist/core/storage/eventStorage/fileEventStorage.js +493 -0
- package/dist/core/storage/eventStorage/fileEventStorage.js.map +1 -0
- package/dist/core/storage/eventStorage/index.d.ts +30 -0
- package/dist/core/storage/eventStorage/index.d.ts.map +1 -0
- package/dist/core/storage/eventStorage/index.js +30 -0
- package/dist/core/storage/eventStorage/index.js.map +1 -0
- package/dist/core/storage/eventStorage/memoryEventStorage.d.ts +86 -0
- package/dist/core/storage/eventStorage/memoryEventStorage.d.ts.map +1 -0
- package/dist/core/storage/eventStorage/memoryEventStorage.js +243 -0
- package/dist/core/storage/eventStorage/memoryEventStorage.js.map +1 -0
- package/dist/core/storage/eventStorage/sqliteEventStorage.d.ts +44 -0
- package/dist/core/storage/eventStorage/sqliteEventStorage.d.ts.map +1 -0
- package/dist/core/storage/eventStorage/sqliteEventStorage.js +300 -0
- package/dist/core/storage/eventStorage/sqliteEventStorage.js.map +1 -0
- package/dist/core/storage/eventStorage/types.d.ts +141 -0
- package/dist/core/storage/eventStorage/types.d.ts.map +1 -0
- package/dist/core/storage/eventStorage/types.js +42 -0
- package/dist/core/storage/eventStorage/types.js.map +1 -0
- package/dist/core/storage/eventStorage/validation.d.ts +29 -0
- package/dist/core/storage/eventStorage/validation.d.ts.map +1 -0
- package/dist/core/storage/eventStorage/validation.js +67 -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 +104 -0
- package/dist/core/storage/memory-storage.d.ts.map +1 -0
- package/dist/core/storage/memory-storage.js +414 -0
- package/dist/core/storage/memory-storage.js.map +1 -0
- package/dist/core/storage/migration-runner.d.ts +95 -0
- package/dist/core/storage/migration-runner.d.ts.map +1 -0
- package/dist/core/storage/migration-runner.js +299 -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 +94 -0
- package/dist/core/storage/sqlite-schema.d.ts.map +1 -0
- package/dist/core/storage/sqlite-schema.js +155 -0
- package/dist/core/storage/sqlite-schema.js.map +1 -0
- package/dist/core/storage/sqlite-storage.d.ts +145 -0
- package/dist/core/storage/sqlite-storage.d.ts.map +1 -0
- package/dist/core/storage/sqlite-storage.js +708 -0
- package/dist/core/storage/sqlite-storage.js.map +1 -0
- package/dist/core/storage/storage-factory.d.ts +60 -0
- package/dist/core/storage/storage-factory.d.ts.map +1 -0
- package/dist/core/storage/storage-factory.js +793 -0
- package/dist/core/storage/storage-factory.js.map +1 -0
- package/dist/core/storage/validation.d.ts +35 -0
- package/dist/core/storage/validation.d.ts.map +1 -0
- package/dist/core/storage/validation.js +78 -0
- package/dist/core/storage/validation.js.map +1 -0
- package/dist/core/storage/world-storage.d.ts +113 -0
- package/dist/core/storage/world-storage.d.ts.map +1 -0
- package/dist/core/storage/world-storage.js +377 -0
- package/dist/core/storage/world-storage.js.map +1 -0
- package/dist/core/subscription.d.ts +42 -0
- package/dist/core/subscription.d.ts.map +1 -0
- package/dist/core/subscription.js +226 -0
- package/dist/core/subscription.js.map +1 -0
- package/dist/core/tool-utils.d.ts +79 -0
- package/dist/core/tool-utils.d.ts.map +1 -0
- package/dist/core/tool-utils.js +272 -0
- package/dist/core/tool-utils.js.map +1 -0
- package/dist/core/types.d.ts +594 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +157 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/utils.d.ts +137 -0
- package/dist/core/utils.d.ts.map +1 -0
- package/dist/core/utils.js +477 -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-BO20H4xt.js +96 -0
- package/dist/public/assets/index-ETY7W5_S.css +1 -0
- package/dist/public/index.html +21 -0
- package/dist/server/api.d.ts +2 -0
- package/dist/server/api.js +1152 -0
- package/dist/server/index.d.ts +29 -0
- package/dist/server/index.js +4 -4
- package/dist/server/sse-handler.d.ts +63 -0
- package/dist/server/sse-handler.js +243 -0
- package/migrations/0000_init_base_schema.sql +129 -0
- package/migrations/0001_add_chat_id.sql +12 -0
- package/migrations/0002_add_llm_config.sql +9 -0
- package/migrations/0003_add_current_chat_id.sql +8 -0
- package/migrations/0004_add_mcp_config.sql +8 -0
- package/migrations/0005_add_message_id.sql +12 -0
- package/migrations/0006_add_reply_to_message_id.sql +12 -0
- package/migrations/0007_create_world_chats.sql +35 -0
- package/migrations/0008_create_events_table.sql +78 -0
- package/migrations/0009_add_event_sequences.sql +40 -0
- package/migrations/0010_add_tool_call_fields.sql +27 -0
- package/migrations/0011_add_event_metadata_indexes.sql +79 -0
- package/migrations/0012_add_tool_role.sql +78 -0
- package/migrations/0013_add_world_variables.sql +7 -0
- package/migrations/0014_add_main_agent_and_auto_reply.sql +10 -0
- package/package.json +18 -6
- package/scripts/launch-electron.js +0 -58
package/README.md
CHANGED
|
@@ -43,17 +43,18 @@ Paste that prompt. Agents come alive instantly.
|
|
|
43
43
|
- ✅ Multiple AI Providers - Use different models for different agents
|
|
44
44
|
- ✅ Web + CLI + Electron - Modern interfaces with real-time streaming and status feedback
|
|
45
45
|
|
|
46
|
-
## Latest Highlights (v0.11.
|
|
46
|
+
## Latest Highlights (since v0.11.1)
|
|
47
47
|
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
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
54
|
|
|
55
55
|
## Release Notes
|
|
56
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
|
|
57
58
|
- **v0.11.0** - Electron desktop workflow, concurrent chat sessions, main-agent routing, progressive skills + HITL, and runtime safety hardening
|
|
58
59
|
- Full history: [CHANGELOG.md](CHANGELOG.md)
|
|
59
60
|
|
|
@@ -139,23 +140,26 @@ Each Agent World has a collection of agents that can communicate through a share
|
|
|
139
140
|
|
|
140
141
|
### Quick Start
|
|
141
142
|
|
|
143
|
+
Use npm package invocations (shown below). GitHub shorthand commands such as
|
|
144
|
+
`npx agent-world/agent-world` are not supported entrypoints.
|
|
145
|
+
|
|
142
146
|
**Option 1: Web Interface**
|
|
143
147
|
```bash
|
|
144
|
-
npx agent-world
|
|
148
|
+
npx agent-world@latest
|
|
145
149
|
```
|
|
146
150
|
|
|
147
151
|
**Option 2: CLI Interface**
|
|
148
152
|
1. Interactive Mode
|
|
149
153
|
```bash
|
|
150
|
-
npx agent-world
|
|
154
|
+
npx -p agent-world@latest agent-world-cli
|
|
151
155
|
```
|
|
152
156
|
2. Command Mode
|
|
153
157
|
```bash
|
|
154
|
-
npx agent-world -w default-world "hi"
|
|
158
|
+
npx -p agent-world@latest agent-world-cli -w default-world "hi"
|
|
155
159
|
```
|
|
156
160
|
3. Pipeline Mode
|
|
157
161
|
```bash
|
|
158
|
-
echo "hi" | npx agent-world -w default-world
|
|
162
|
+
echo "hi" | npx -p agent-world@latest agent-world-cli -w default-world
|
|
159
163
|
```
|
|
160
164
|
|
|
161
165
|
**Option 3: Electron Desktop App (repo)**
|
|
@@ -204,12 +208,17 @@ npm run test:watch # Watch mode
|
|
|
204
208
|
### Environment Setup
|
|
205
209
|
|
|
206
210
|
Export your API keys as environment variables
|
|
211
|
+
For Azure OpenAI, all four `AZURE_OPENAI_*` variables are required together.
|
|
207
212
|
|
|
208
213
|
```bash
|
|
209
214
|
# Required if Choose one or more
|
|
210
215
|
export OPENAI_API_KEY="your-key-here"
|
|
211
216
|
export ANTHROPIC_API_KEY="your-key-here"
|
|
212
217
|
export GOOGLE_API_KEY="your-key-here"
|
|
218
|
+
export AZURE_OPENAI_API_KEY="your-key-here"
|
|
219
|
+
export AZURE_OPENAI_RESOURCE_NAME="your-resource-name"
|
|
220
|
+
export AZURE_OPENAI_DEPLOYMENT_NAME="your-deployment-name"
|
|
221
|
+
export AZURE_OPENAI_API_VERSION="2024-10-21-preview"
|
|
213
222
|
|
|
214
223
|
# Default: For local models
|
|
215
224
|
export OLLAMA_BASE_URL="http://localhost:11434"
|
|
@@ -221,6 +230,10 @@ Or create a `.env` file in your working directory with:
|
|
|
221
230
|
OPENAI_API_KEY=your-key-here
|
|
222
231
|
ANTHROPIC_API_KEY=your-key-here
|
|
223
232
|
GOOGLE_API_KEY=your-key-here
|
|
233
|
+
AZURE_OPENAI_API_KEY=your-key-here
|
|
234
|
+
AZURE_OPENAI_RESOURCE_NAME=your-resource-name
|
|
235
|
+
AZURE_OPENAI_DEPLOYMENT_NAME=your-deployment-name
|
|
236
|
+
AZURE_OPENAI_API_VERSION=2024-10-21-preview
|
|
224
237
|
OLLAMA_BASE_URL=http://localhost:11434
|
|
225
238
|
```
|
|
226
239
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Agent World Bin Launcher (CLI entry).
|
|
4
|
+
*
|
|
5
|
+
* Purpose:
|
|
6
|
+
* - Provide a stable npm bin entry for `agent-world-cli`.
|
|
7
|
+
*
|
|
8
|
+
* Key Features:
|
|
9
|
+
* - Performs a Node.js runtime preflight check with a clear user-facing error.
|
|
10
|
+
* - Defers to the published CLI runtime after validation.
|
|
11
|
+
*
|
|
12
|
+
* Notes on Implementation:
|
|
13
|
+
* - Uses dynamic import so the preflight runs before loading modern runtime dependencies.
|
|
14
|
+
*
|
|
15
|
+
* Recent Changes:
|
|
16
|
+
* - 2026-02-19: Added wrapper to avoid silent exits on unsupported Node versions.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const MIN_NODE_MAJOR = 20;
|
|
20
|
+
|
|
21
|
+
function getNodeMajor() {
|
|
22
|
+
const major = Number.parseInt((process.versions.node || '').split('.')[0] || '0', 10);
|
|
23
|
+
return Number.isFinite(major) ? major : 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ensureSupportedNode() {
|
|
27
|
+
const nodeMajor = getNodeMajor();
|
|
28
|
+
if (nodeMajor >= MIN_NODE_MAJOR) return;
|
|
29
|
+
|
|
30
|
+
console.error(`[agent-world-cli] Node.js ${MIN_NODE_MAJOR}+ is required. Detected ${process.version}.`);
|
|
31
|
+
console.error('[agent-world-cli] Please upgrade Node.js and run the command again.');
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
ensureSupportedNode();
|
|
36
|
+
|
|
37
|
+
import('../dist/cli/index.js').catch((error) => {
|
|
38
|
+
console.error('[agent-world-cli] Failed to start CLI:', error);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
});
|
|
41
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Agent World Bin Launcher (server entry).
|
|
4
|
+
*
|
|
5
|
+
* Purpose:
|
|
6
|
+
* - Provide a stable npm bin entry for `agent-world-server`.
|
|
7
|
+
*
|
|
8
|
+
* Key Features:
|
|
9
|
+
* - Performs a Node.js runtime preflight check with a clear user-facing error.
|
|
10
|
+
* - Defers to the published server runtime after validation.
|
|
11
|
+
*
|
|
12
|
+
* Notes on Implementation:
|
|
13
|
+
* - Uses dynamic import so the preflight runs before loading modern runtime dependencies.
|
|
14
|
+
*
|
|
15
|
+
* Recent Changes:
|
|
16
|
+
* - 2026-02-19: Added wrapper to avoid silent exits on unsupported Node versions.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const MIN_NODE_MAJOR = 20;
|
|
20
|
+
|
|
21
|
+
function getNodeMajor() {
|
|
22
|
+
const major = Number.parseInt((process.versions.node || '').split('.')[0] || '0', 10);
|
|
23
|
+
return Number.isFinite(major) ? major : 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ensureSupportedNode() {
|
|
27
|
+
const nodeMajor = getNodeMajor();
|
|
28
|
+
if (nodeMajor >= MIN_NODE_MAJOR) return;
|
|
29
|
+
|
|
30
|
+
console.error(`[agent-world-server] Node.js ${MIN_NODE_MAJOR}+ is required. Detected ${process.version}.`);
|
|
31
|
+
console.error('[agent-world-server] Please upgrade Node.js and run the command again.');
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
ensureSupportedNode();
|
|
36
|
+
|
|
37
|
+
import('../dist/server/index.js').catch((error) => {
|
|
38
|
+
console.error('[agent-world-server] Failed to start server:', error);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Agent World Bin Launcher (default server entry).
|
|
4
|
+
*
|
|
5
|
+
* Purpose:
|
|
6
|
+
* - Provide a stable npm bin entry for `agent-world`.
|
|
7
|
+
*
|
|
8
|
+
* Key Features:
|
|
9
|
+
* - Performs a Node.js runtime preflight check with a clear user-facing error.
|
|
10
|
+
* - Defers to the published server runtime after validation.
|
|
11
|
+
*
|
|
12
|
+
* Notes on Implementation:
|
|
13
|
+
* - Uses dynamic import so the preflight runs before loading modern runtime dependencies.
|
|
14
|
+
*
|
|
15
|
+
* Recent Changes:
|
|
16
|
+
* - 2026-02-19: Added wrapper to avoid silent exits on unsupported Node versions.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const MIN_NODE_MAJOR = 20;
|
|
20
|
+
|
|
21
|
+
function getNodeMajor() {
|
|
22
|
+
const major = Number.parseInt((process.versions.node || '').split('.')[0] || '0', 10);
|
|
23
|
+
return Number.isFinite(major) ? major : 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ensureSupportedNode() {
|
|
27
|
+
const nodeMajor = getNodeMajor();
|
|
28
|
+
if (nodeMajor >= MIN_NODE_MAJOR) return;
|
|
29
|
+
|
|
30
|
+
console.error(`[agent-world] Node.js ${MIN_NODE_MAJOR}+ is required. Detected ${process.version}.`);
|
|
31
|
+
console.error('[agent-world] Please upgrade Node.js and run the command again.');
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
ensureSupportedNode();
|
|
36
|
+
|
|
37
|
+
import('../dist/server/index.js')
|
|
38
|
+
.then(({ startWebServer }) => {
|
|
39
|
+
const port = Number(process.env.PORT) || 0;
|
|
40
|
+
const host = process.env.HOST || '127.0.0.1';
|
|
41
|
+
const shouldOpenBrowser = process.env.AGENT_WORLD_AUTO_OPEN !== 'false';
|
|
42
|
+
|
|
43
|
+
return startWebServer(port, host, {
|
|
44
|
+
openBrowser: shouldOpenBrowser,
|
|
45
|
+
registerProcessHandlers: true,
|
|
46
|
+
}).then(() => {
|
|
47
|
+
console.log('Server started successfully');
|
|
48
|
+
});
|
|
49
|
+
})
|
|
50
|
+
.catch((error) => {
|
|
51
|
+
console.error('[agent-world] Failed to start server:', error);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
});
|
|
@@ -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 {};
|