@moltium/world-cli 0.1.18 → 0.1.20
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/dist/index.js +39 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -32,6 +32,19 @@ function generateWorldConfig(options) {
|
|
|
32
32
|
tickIntervalMs: 5e3,
|
|
33
33
|
autoStart: false
|
|
34
34
|
},
|
|
35
|
+
orchestration: {
|
|
36
|
+
broadcastOnTick: true,
|
|
37
|
+
tickTimeout: 1e4
|
|
38
|
+
},
|
|
39
|
+
actions: [
|
|
40
|
+
{
|
|
41
|
+
name: "chat",
|
|
42
|
+
description: "Send a message to other agents in the world",
|
|
43
|
+
parameters: {
|
|
44
|
+
message: { type: "string", required: true, description: "The message to send" }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
],
|
|
35
48
|
persistence: {
|
|
36
49
|
type: options.persistenceType,
|
|
37
50
|
...options.persistenceType === "sqlite" && {
|
|
@@ -161,16 +174,37 @@ DB_PATH=${options.dbConfig?.path || "./data/leveldb"}
|
|
|
161
174
|
function generateWorldTemplate(config3) {
|
|
162
175
|
const files = {};
|
|
163
176
|
files["src/index.ts"] = `import { World, startWorldServer } from '@moltium/world-core';
|
|
164
|
-
import type { WorldConfig } from '@moltium/world-core';
|
|
177
|
+
import type { WorldConfig, WorldAction } from '@moltium/world-core';
|
|
165
178
|
import dotenv from 'dotenv';
|
|
166
179
|
import fs from 'fs';
|
|
167
180
|
|
|
168
181
|
dotenv.config();
|
|
169
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Define custom world actions that agents can execute during ticks.
|
|
185
|
+
* These are sent to agents as available options via A2A protocol.
|
|
186
|
+
* Add more actions here to extend what agents can do in your world.
|
|
187
|
+
*/
|
|
188
|
+
const customActions: WorldAction[] = [
|
|
189
|
+
// Example: uncomment and customize
|
|
190
|
+
// {
|
|
191
|
+
// name: 'trade',
|
|
192
|
+
// description: 'Trade items with another agent',
|
|
193
|
+
// parameters: {
|
|
194
|
+
// targetAgent: { type: 'string', required: true, description: 'Agent to trade with' },
|
|
195
|
+
// item: { type: 'string', required: true, description: 'Item to trade' },
|
|
196
|
+
// amount: { type: 'number', required: true, description: 'Amount to trade' },
|
|
197
|
+
// },
|
|
198
|
+
// },
|
|
199
|
+
];
|
|
200
|
+
|
|
170
201
|
async function main() {
|
|
171
202
|
// Load base configuration from JSON
|
|
172
203
|
const config = JSON.parse(fs.readFileSync('./world.config.json', 'utf-8')) as WorldConfig;
|
|
173
204
|
|
|
205
|
+
// Add custom actions to config (merged with any defined in world.config.json)
|
|
206
|
+
config.actions = [...(config.actions || []), ...customActions];
|
|
207
|
+
|
|
174
208
|
// Merge settings from environment variables
|
|
175
209
|
if (config.blockchain) {
|
|
176
210
|
if (process.env.MONAD_RPC_URL) config.blockchain.rpcUrl = process.env.MONAD_RPC_URL;
|
|
@@ -227,6 +261,8 @@ async function main() {
|
|
|
227
261
|
console.log(\`\u{1F30D} \${config.name} is running!\`);
|
|
228
262
|
console.log(\` Server: http://\${config.server?.host ?? 'localhost'}:\${config.server?.port ?? 3000}\`);
|
|
229
263
|
console.log(\` Agents: \${world.getAgents().length}/\${config.admission?.maxAgents ?? 10}\`);
|
|
264
|
+
console.log(\` Actions: \${config.actions?.length ?? 0} world actions registered\`);
|
|
265
|
+
console.log(\` Orchestration: \${config.orchestration?.broadcastOnTick !== false ? 'enabled' : 'disabled'}\`);
|
|
230
266
|
|
|
231
267
|
// Graceful shutdown
|
|
232
268
|
process.on('SIGINT', async () => {
|
|
@@ -564,7 +600,7 @@ var initCommand = new Command("init").description("Initialize a new world projec
|
|
|
564
600
|
"deploy:contracts": "moltium-world deploy"
|
|
565
601
|
},
|
|
566
602
|
dependencies: {
|
|
567
|
-
"@moltium/world-core": "^0.1.
|
|
603
|
+
"@moltium/world-core": "^0.1.19",
|
|
568
604
|
dotenv: "^16.4.0",
|
|
569
605
|
...persistenceAnswers.persistenceType === "sqlite" ? { "better-sqlite3": "^11.0.0" } : {},
|
|
570
606
|
...persistenceAnswers.persistenceType === "redis" ? { "ioredis": "^5.3.0" } : {},
|
|
@@ -983,7 +1019,7 @@ var deployCommand = new Command4("deploy").description("Deploy smart contracts t
|
|
|
983
1019
|
|
|
984
1020
|
// src/index.ts
|
|
985
1021
|
var program = new Command5();
|
|
986
|
-
program.name("moltium-world").description("CLI tool for creating and managing Moltium World SDK projects").version("0.1.
|
|
1022
|
+
program.name("moltium-world").description("CLI tool for creating and managing Moltium World SDK projects").version("0.1.19");
|
|
987
1023
|
program.addCommand(initCommand);
|
|
988
1024
|
program.addCommand(tokenCommand);
|
|
989
1025
|
program.addCommand(startCommand);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moltium/world-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "CLI tool for creating and managing Moltium World SDK projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@moltium/world-core": "^0.1.
|
|
35
|
+
"@moltium/world-core": "^0.1.20",
|
|
36
36
|
"chalk": "^5.3.0",
|
|
37
37
|
"commander": "^12.1.0",
|
|
38
38
|
"dotenv": "^16.4.0",
|