@clawlabz/clawarena 0.2.6 → 0.2.7
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/index.ts +26 -20
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare function setTimeout(fn: () => void, ms: number): unknown
|
|
|
5
5
|
declare function clearTimeout(id: unknown): void
|
|
6
6
|
declare function fetch(url: string, init?: Record<string, unknown>): Promise<{ status: number; text: () => Promise<string>; headers: Headers }>
|
|
7
7
|
|
|
8
|
-
const VERSION = '0.2.
|
|
8
|
+
const VERSION = '0.2.7'
|
|
9
9
|
const PLUGIN_ID = 'clawarena'
|
|
10
10
|
const DEFAULT_BASE_URL = 'https://arena.clawlabz.xyz'
|
|
11
11
|
const DEFAULT_HEARTBEAT_SECONDS = 20
|
|
@@ -33,6 +33,7 @@ interface CliCommandChain {
|
|
|
33
33
|
option: (flags: string, desc: string) => CliCommandChain
|
|
34
34
|
action: (handler: (...args: unknown[]) => void) => CliCommandChain
|
|
35
35
|
command: (name: string) => CliCommandChain
|
|
36
|
+
allowExcessArguments: (allow: boolean) => CliCommandChain
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
interface CliProgram {
|
|
@@ -968,29 +969,34 @@ export default function register(api: OpenClawApi) {
|
|
|
968
969
|
|
|
969
970
|
api.registerCli?.(({ program }) => {
|
|
970
971
|
|
|
972
|
+
// Helper: configure a command with allowExcessArguments for robustness
|
|
973
|
+
function cmd(parent: CliCommandChain | CliProgram, name: string) {
|
|
974
|
+
return parent.command(name).allowExcessArguments(true)
|
|
975
|
+
}
|
|
976
|
+
|
|
971
977
|
// ── Space format: `openclaw clawarena <sub>` ──
|
|
972
|
-
const arenaGroup = program
|
|
973
|
-
arenaGroup
|
|
974
|
-
arenaGroup
|
|
975
|
-
arenaGroup
|
|
976
|
-
arenaGroup
|
|
977
|
-
arenaGroup
|
|
978
|
-
arenaGroup
|
|
979
|
-
arenaGroup
|
|
980
|
-
arenaGroup
|
|
981
|
-
arenaGroup
|
|
978
|
+
const arenaGroup = cmd(program, 'clawarena').description('ClawArena agent management')
|
|
979
|
+
cmd(arenaGroup, 'create').description('Create a new agent').argument('[name]', 'Agent name').action(handleCreate)
|
|
980
|
+
cmd(arenaGroup, 'connect').description('Connect with existing API key').argument('[api-key]', 'API key').action(handleConnect)
|
|
981
|
+
cmd(arenaGroup, 'ls').description('Show agent info').action(handleLs)
|
|
982
|
+
cmd(arenaGroup, 'status').description('Show runner status').action(handleStatus)
|
|
983
|
+
cmd(arenaGroup, 'start').description('Start runner').action(handleStart)
|
|
984
|
+
cmd(arenaGroup, 'stop').description('Stop runner').action(handleStop)
|
|
985
|
+
cmd(arenaGroup, 'pause').description('Pause matchmaking').action(handlePause)
|
|
986
|
+
cmd(arenaGroup, 'resume').description('Resume matchmaking').action(handleResume)
|
|
987
|
+
cmd(arenaGroup, 'modes').description('Set preferred game modes').argument('[modes]', 'Comma-separated modes').action(handleModes)
|
|
982
988
|
|
|
983
989
|
// ── Colon format: `openclaw clawarena:ls` (backward compat) ──
|
|
984
990
|
for (const prefix of ['clawarena', 'clawarena-openclaw']) {
|
|
985
|
-
program
|
|
986
|
-
program
|
|
987
|
-
program
|
|
988
|
-
program
|
|
989
|
-
program
|
|
990
|
-
program
|
|
991
|
-
program
|
|
992
|
-
program
|
|
993
|
-
program
|
|
991
|
+
cmd(program, `${prefix}:create`).description('Create a new agent').argument('[name]', 'Agent name').action(handleCreate)
|
|
992
|
+
cmd(program, `${prefix}:connect`).description('Connect with existing API key').argument('[api-key]', 'API key').action(handleConnect)
|
|
993
|
+
cmd(program, `${prefix}:ls`).description('Show agent info').action(handleLs)
|
|
994
|
+
cmd(program, `${prefix}:status`).description('Show runner status').action(handleStatus)
|
|
995
|
+
cmd(program, `${prefix}:start`).description('Start runner').action(handleStart)
|
|
996
|
+
cmd(program, `${prefix}:stop`).description('Stop runner').action(handleStop)
|
|
997
|
+
cmd(program, `${prefix}:pause`).description('Pause matchmaking').action(handlePause)
|
|
998
|
+
cmd(program, `${prefix}:resume`).description('Resume matchmaking').action(handleResume)
|
|
999
|
+
cmd(program, `${prefix}:modes`).description('Set preferred game modes').argument('[modes]', 'Comma-separated modes').action(handleModes)
|
|
994
1000
|
}
|
|
995
1001
|
|
|
996
1002
|
}, { commands: CLI_COMMANDS })
|
package/openclaw.plugin.json
CHANGED