agent-world 0.4.6 → 0.5.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 (3) hide show
  1. package/README.md +4 -51
  2. package/dist/cli/index.js +10 -12
  3. package/package.json +18 -22
package/README.md CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  Traditional AI frameworks force you to write hundreds of lines of code just to make agents talk to each other. Agent World lets you create intelligent agent teams using nothing but plain natural language.
8
8
 
9
+ https://github.com/user-attachments/assets/cc507c95-01a4-4c27-975a-f8f67d8cf0d7
10
+
9
11
  Audio introduction: [Listen here](https://yysun.github.io/agent-world)
10
12
 
11
13
  **Other frameworks:**
@@ -126,58 +128,9 @@ npx agent-world -w default-world "hi"
126
128
  echo "hi" | npx agent-world -w default-world
127
129
  ```
128
130
 
129
- ## Project Structure (npm workspaces)
130
-
131
- This project uses npm workspaces with two main packages:
132
-
133
- - **`core/`** - Reusable agent management library
134
- - World-mediated agent management system
135
- - Event-driven architecture
136
- - LLM provider abstraction
137
- - Cross-platform compatibility (Node.js/Browser)
138
-
139
- - **`next/`** - Next.js web application
140
- - React frontend with Tailwind CSS
141
- - API routes for CRUD operations
142
- - Real-time chat with streaming support
143
- - Modern, minimalistic UI
144
-
145
- ### Cross-workspace imports
146
- ```typescript
147
- // In next/ workspace
148
- import { createWorld, listAgents, publishMessage } from '@agent-world/core';
149
- ```
150
-
151
- ### Web Interface Features
131
+ ## Project Structure
152
132
 
153
- The Next.js workspace provides a modern web interface with:
154
-
155
- - **Home Page**: World selector and creator with clean card-based UI
156
- - **World Page**: Chat interface with agent management sidebar
157
- - Real-time messaging with agents
158
- - Toggle between streaming and non-streaming modes
159
- - Agent creation with custom system prompts
160
- - Responsive design with Tailwind CSS
161
-
162
- ### API Endpoints
163
-
164
- The Next.js workspace exposes REST APIs for integration:
165
-
166
- ```
167
- GET /api/worlds # List all worlds
168
- POST /api/worlds # Create new world
169
- GET /api/worlds/:id # Get world details
170
- PUT /api/worlds/:id # Update world
171
- DELETE /api/worlds/:id # Delete world
172
-
173
- GET /api/worlds/:id/agents # List agents in world
174
- POST /api/worlds/:id/agents # Create new agent
175
- GET /api/worlds/:id/agents/:agentId # Get agent details
176
- PUT /api/worlds/:id/agents/:agentId # Update agent
177
- DELETE /api/worlds/:id/agents/:agentId # Delete agent
178
-
179
- POST /api/worlds/:id/chat # Send message (streaming/non-streaming)
180
- ```
133
+ See [Project Structure Documentation](project.md)
181
134
 
182
135
  ### Environment Setup
183
136
 
package/dist/cli/index.js CHANGED
@@ -39,9 +39,9 @@ import { fileURLToPath } from 'url';
39
39
  import { program } from 'commander';
40
40
  import readline from 'readline';
41
41
  import { listWorlds, subscribeWorld, createCategoryLogger, LLMProvider, enableStreaming, disableStreaming } from '../core/index.js';
42
- import { getDefaultRootPath } from '../core/storage-factory.js';
42
+ import { getDefaultRootPath } from '../core/storage/storage-factory.js';
43
43
  import { processCLIInput } from './commands.js';
44
- import { createStreamingState, handleWorldEventWithStreaming } from './stream.js';
44
+ import { createStreamingState, handleWorldEventWithStreaming, } from './stream.js';
45
45
  import { configureLLMProvider } from '../core/llm-config.js';
46
46
  // Create CLI category logger after logger auto-initialization
47
47
  const logger = createCategoryLogger('cli');
@@ -158,7 +158,6 @@ function printCLIResult(result) {
158
158
  }
159
159
  // Pipeline mode execution with timer-based cleanup
160
160
  async function runPipelineMode(options, messageFromArgs) {
161
- const rootPath = options.root || DEFAULT_ROOT_PATH;
162
161
  disableStreaming();
163
162
  try {
164
163
  let world = null;
@@ -198,7 +197,7 @@ async function runPipelineMode(options, messageFromArgs) {
198
197
  }, delay);
199
198
  };
200
199
  if (options.world) {
201
- worldSubscription = await subscribeWorld(options.world, rootPath, pipelineClient);
200
+ worldSubscription = await subscribeWorld(options.world, pipelineClient);
202
201
  if (!worldSubscription) {
203
202
  console.error(boldRed(`Error: World '${options.world}' not found`));
204
203
  process.exit(1);
@@ -211,7 +210,7 @@ async function runPipelineMode(options, messageFromArgs) {
211
210
  console.error(boldRed('Error: World must be specified to send user messages'));
212
211
  process.exit(1);
213
212
  }
214
- const result = await processCLIInput(options.command, world, rootPath, 'HUMAN');
213
+ const result = await processCLIInput(options.command, world, 'HUMAN');
215
214
  printCLIResult(result);
216
215
  // Only set timer if sending message to world (not for commands)
217
216
  if (!options.command.startsWith('/') && world) {
@@ -234,7 +233,7 @@ async function runPipelineMode(options, messageFromArgs) {
234
233
  console.error(boldRed('Error: World must be specified to send user messages'));
235
234
  process.exit(1);
236
235
  }
237
- const result = await processCLIInput(messageFromArgs, world, rootPath, 'HUMAN');
236
+ const result = await processCLIInput(messageFromArgs, world, 'HUMAN');
238
237
  printCLIResult(result);
239
238
  // Set timer with longer delay for message processing (always needed for messages)
240
239
  setupExitTimer(8000);
@@ -254,7 +253,7 @@ async function runPipelineMode(options, messageFromArgs) {
254
253
  console.error(boldRed('Error: World must be specified to send user messages'));
255
254
  process.exit(1);
256
255
  }
257
- const result = await processCLIInput(input.trim(), world, rootPath, 'HUMAN');
256
+ const result = await processCLIInput(input.trim(), world, 'HUMAN');
258
257
  printCLIResult(result);
259
258
  // Set timer with longer delay for message processing (always needed for stdin messages)
260
259
  setupExitTimer(8000);
@@ -290,7 +289,7 @@ async function handleSubscribe(rootPath, worldName, streaming, globalState, rl)
290
289
  console.log(red(`Error: ${error}`));
291
290
  }
292
291
  };
293
- const subscription = await subscribeWorld(worldName, rootPath, cliClient);
292
+ const subscription = await subscribeWorld(worldName, cliClient);
294
293
  if (!subscription)
295
294
  throw new Error('Failed to load world');
296
295
  return { subscription, world: subscription.world };
@@ -313,7 +312,7 @@ function handleWorldEvent(eventType, eventData, streaming, globalState, rl) {
313
312
  // World discovery and selection
314
313
  async function getAvailableWorldNames(rootPath) {
315
314
  try {
316
- const worldInfos = await listWorlds(rootPath);
315
+ const worldInfos = await listWorlds();
317
316
  return worldInfos.map(info => info.id);
318
317
  }
319
318
  catch (error) {
@@ -469,11 +468,10 @@ async function runInteractiveMode(options) {
469
468
  cleanupWorldSubscription(worldState);
470
469
  rl.close();
471
470
  process.exit(0);
472
- return;
473
471
  }
474
472
  console.log(`\n${boldYellow('● you:')} ${trimmedInput}`);
475
473
  try {
476
- const result = await processCLIInput(trimmedInput, worldState?.world || null, rootPath, 'HUMAN');
474
+ const result = await processCLIInput(trimmedInput, worldState?.world || null, 'HUMAN');
477
475
  // Handle exit commands from result (redundant, but keep for safety)
478
476
  if (result.data?.exit) {
479
477
  if (isExiting)
@@ -487,7 +485,6 @@ async function runInteractiveMode(options) {
487
485
  cleanupWorldSubscription(worldState);
488
486
  rl.close();
489
487
  process.exit(0);
490
- return;
491
488
  }
492
489
  // Handle world selection command
493
490
  if (result.data?.selectWorld) {
@@ -600,6 +597,7 @@ async function runInteractiveMode(options) {
600
597
  if (isExiting)
601
598
  return; // Prevent duplicate cleanup
602
599
  isExiting = true;
600
+ console.log(`\n${boldCyan('Shutting down...')}`);
603
601
  clearPromptTimer(globalState);
604
602
  if (streaming.stopWait)
605
603
  streaming.stopWait();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-world",
3
- "version": "0.4.6",
3
+ "version": "0.5.0",
4
4
  "main": "index.ts",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -16,12 +16,12 @@
16
16
  "start": "node dist/server/index.js",
17
17
  "cli": "npx tsx cli/index.ts",
18
18
  "server": "npx tsx server/index.ts",
19
- "dev-web": "concurrently \"npm run server\" \"cd web && npm run dev\"",
19
+ "dev": "concurrently \"npm run server\" \"cd web && npm run dev\"",
20
20
  "test": "jest --config jest.config.js",
21
21
  "check": "tsc --noEmit",
22
22
  "build": "tsc && cd web && npm run build",
23
23
  "pkill": "pkill -f tsx",
24
- "dev": "cd next && npm run dev"
24
+ "dev-next": "cd next && npm run dev"
25
25
  },
26
26
  "description": "World-mediated agent management system with clean API surface",
27
27
  "keywords": [
@@ -39,47 +39,43 @@
39
39
  "./package.json": "./package.json"
40
40
  },
41
41
  "dependencies": {
42
- "@ai-sdk/anthropic": "^1.2.12",
43
- "@ai-sdk/azure": "^1.3.23",
44
- "@ai-sdk/google": "^1.2.19",
45
- "@ai-sdk/openai": "^1.3.22",
46
- "@ai-sdk/openai-compatible": "^0.2.14",
47
- "@ai-sdk/xai": "^1.2.16",
48
- "@types/terminal-kit": "^2.5.7",
49
- "ai": "^4.3.16",
50
- "chalk": "^4.1.2",
42
+ "@ai-sdk/anthropic": "^2.0.0",
43
+ "@ai-sdk/azure": "^2.0.2",
44
+ "@ai-sdk/google": "^2.0.1",
45
+ "@ai-sdk/openai": "^2.0.2",
46
+ "@ai-sdk/openai-compatible": "^1.0.1",
47
+ "@ai-sdk/xai": "^2.0.1",
48
+ "ai": "^5.0.2",
49
+ "chalk": "^5.5.0",
51
50
  "cors": "^2.8.5",
52
- "dotenv": "^16.5.0",
51
+ "dotenv": "^17.2.1",
53
52
  "enquirer": "^2.4.1",
54
53
  "events": "^3.3.0",
55
54
  "express": "^4.21.2",
55
+ "nanoid": "^5.1.5",
56
56
  "ollama-ai-provider": "^1.2.0",
57
57
  "open": "^10.2.0",
58
58
  "pino": "^9.7.0",
59
59
  "pino-pretty": "^13.0.0",
60
60
  "sqlite3": "^5.1.7",
61
- "tsx": "^4.19.2",
61
+ "tsx": "^4.20.3",
62
62
  "typescript": "^5.8.3",
63
- "uuid": "^11.1.0",
64
- "zod": "^3.25.67"
63
+ "zod": "^3.25.76"
65
64
  },
66
65
  "devDependencies": {
67
- "@types/chalk": "^0.4.31",
68
- "@types/cors": "^2.8.14",
66
+ "@types/chalk": "^2.2.4",
67
+ "@types/cors": "^2.8.19",
69
68
  "@types/express": "^4.17.23",
70
69
  "@types/jest": "^29.5.14",
71
70
  "@types/node": "^20.19.9",
72
71
  "@types/pino": "^7.0.4",
73
- "@types/sqlite3": "^3.1.11",
72
+ "@types/sqlite3": "^5.1.0",
74
73
  "@types/tmp": "^0.2.0",
75
74
  "@types/uuid": "^10.0.0",
76
75
  "@types/ws": "^8.18.1",
77
76
  "commander": "^14.0.0",
78
77
  "concurrently": "^9.1.2",
79
- "esbuild": "^0.21.5",
80
78
  "jest": "^29.5.0",
81
- "nodemon": "^3.1.10",
82
- "tmp": "^0.2.0",
83
79
  "ts-jest": "^29.1.0"
84
80
  },
85
81
  "engines": {