@clawlabz/clawarena 0.2.4 → 0.2.5

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 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.4'
8
+ const VERSION = '0.2.5'
9
9
  const PLUGIN_ID = 'clawarena'
10
10
  const DEFAULT_BASE_URL = 'https://arena.clawlabz.xyz'
11
11
  const DEFAULT_HEARTBEAT_SECONDS = 20
@@ -907,20 +907,45 @@ export default function register(api: OpenClawApi) {
907
907
  .command(`${prefix}:status`)
908
908
  .description('Show runner status')
909
909
  .action(async () => {
910
- const payload = buildStatusPayload()
911
910
  try {
912
- const creds = await loadCredentials()
913
- if (creds?.apiKey) {
914
- const cfg = getConfig(api)
915
- const [runtimeRes, queueRes] = await Promise.all([
916
- requestArena(cfg.baseUrl, creds.apiKey, 'GET', '/api/agents/runtime', { expectedStatuses: [200] }).catch(() => null),
917
- requestArena(cfg.baseUrl, creds.apiKey, 'GET', '/api/queue/status', { expectedStatuses: [200] }).catch(() => null),
911
+ const agents = await loadAllAgents()
912
+ if (agents.length === 0) {
913
+ process.stdout.write(`${JSON.stringify({ ok: false, error: 'No agent. Run clawarena:create first.' }, null, 2)}\n`)
914
+ return
915
+ }
916
+
917
+ const cfg = getConfig(api)
918
+ const results: Record<string, unknown>[] = []
919
+
920
+ for (const agent of agents) {
921
+ const baseUrl = agent.baseUrl || cfg.baseUrl
922
+ const [meRes, runtimeRes, queueRes] = await Promise.all([
923
+ requestArena(baseUrl, agent.apiKey, 'GET', '/api/agents/me', { expectedStatuses: [200] }).catch(() => null),
924
+ requestArena(baseUrl, agent.apiKey, 'GET', '/api/agents/runtime', { expectedStatuses: [200] }).catch(() => null),
925
+ requestArena(baseUrl, agent.apiKey, 'GET', '/api/queue/status', { expectedStatuses: [200] }).catch(() => null),
918
926
  ])
919
- if (runtimeRes) (payload as Record<string, unknown>).serverRuntime = runtimeRes.data
920
- if (queueRes) (payload as Record<string, unknown>).serverQueue = queueRes.data
927
+
928
+ const localRunner = runners.get(agent.agentId)
929
+ results.push({
930
+ agentId: agent.agentId,
931
+ name: meRes?.data?.name || agent.name,
932
+ rating: meRes?.data?.rating ?? null,
933
+ runtime: runtimeRes?.data || null,
934
+ queue: queueRes?.data || null,
935
+ localRunner: localRunner ? localRunner.status : 'not_in_this_process',
936
+ baseUrl,
937
+ })
921
938
  }
922
- } catch { /* ignore */ }
923
- process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`)
939
+
940
+ process.stdout.write(`${JSON.stringify({
941
+ ok: true,
942
+ plugin: PLUGIN_ID,
943
+ version: VERSION,
944
+ agents: results,
945
+ }, null, 2)}\n`)
946
+ } catch (err: unknown) {
947
+ process.stdout.write(`status error: ${(err as Error).message}\n`)
948
+ }
924
949
  })
925
950
  }
926
951
 
@@ -2,7 +2,7 @@
2
2
  "id": "clawarena",
3
3
  "name": "ClawArena OpenClaw",
4
4
  "description": "Connect OpenClaw agents to ClawArena — auto-queue, auto-play, always online.",
5
- "version": "0.2.4",
5
+ "version": "0.2.5",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawlabz/clawarena",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Official ClawArena plugin for OpenClaw Gateway.",
5
5
  "type": "module",
6
6
  "license": "MIT",