@clawzone/clawzone 1.4.10 → 1.4.11

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 (2) hide show
  1. package/index.ts +9 -9
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -152,10 +152,10 @@ export default {
152
152
  return { content: [{ type: "text", text: JSON.stringify({ status: "your_turn", match_id: matchId, turn: matchState.turn, state: matchState.agentView, available_actions: matchState.availableActions }) }] };
153
153
  }
154
154
 
155
- // Status is "waiting" — do a single short wait (10s) in case your_turn is about to arrive.
155
+ // Status is "waiting" — do a single short wait (5s) in case your_turn is about to arrive.
156
156
  // If nothing arrives, return waiting immediately so the agent stays responsive.
157
157
  // For turn-based games (e.g. Connect Four), the agent should set up a cron to poll.
158
- const resolution = await state.waitForTurnResolution(matchId, 10_000);
158
+ const resolution = await state.waitForTurnResolution(matchId, 5_000);
159
159
 
160
160
  if (resolution.type === "your_turn") {
161
161
  return { content: [{ type: "text", text: JSON.stringify({ status: "your_turn", match_id: resolution.match_id, turn: resolution.turn, state: resolution.state, available_actions: resolution.available_actions }) }] };
@@ -173,7 +173,7 @@ export default {
173
173
  match_id: matchId,
174
174
  turn: matchState.turn,
175
175
  message: "Opponent hasn't moved yet (turn-based game or slow opponent). Set up a cron to poll.",
176
- cron_hint: `openclaw cron add --name "clawzone-turn-${matchId}" --every "10s" --session main --wake now --system-event "CLAWZONE_TURN_POLL match_id=${matchId} — Call clawzone_status. If your_turn: delete this cron, call clawzone_action. If finished/cancelled: delete cron, report result. If waiting: go idle."`,
176
+ cron_hint: `openclaw cron add --name "clawzone-turn-${matchId}" --every "5s" --session main --wake now --system-event "CLAWZONE_TURN_POLL match_id=${matchId} — Call clawzone_status. If your_turn: delete this cron, call clawzone_action. If finished/cancelled: delete cron, report result. If waiting: go idle."`,
177
177
  }) }] };
178
178
  },
179
179
  });
@@ -218,7 +218,7 @@ export default {
218
218
  }
219
219
 
220
220
  // Start waiting BEFORE sending so we don't miss fast responses
221
- const resolutionPromise = state.waitForTurnResolution(matchId, 30_000);
221
+ const resolutionPromise = state.waitForTurnResolution(matchId, 15_000);
222
222
 
223
223
  // Send via WebSocket for lowest latency
224
224
  if (wsClient?.isConnected()) {
@@ -250,10 +250,10 @@ export default {
250
250
  }
251
251
  }
252
252
 
253
- // Hybrid wait: try WebSocket for 60s (fast path), then bail to cron.
254
- // Two 30s intervals with a race-condition check between them.
255
- const WAIT_INTERVAL = 30_000;
256
- const MAX_TOTAL_WAIT = 60_000;
253
+ // Hybrid wait: try WebSocket for 30s (fast path), then bail to cron.
254
+ // Two 15s intervals with a race-condition check between them.
255
+ const WAIT_INTERVAL = 15_000;
256
+ const MAX_TOTAL_WAIT = 30_000;
257
257
  let totalWaited = 0;
258
258
 
259
259
  // First wait uses the promise we set up before sending
@@ -363,7 +363,7 @@ export default {
363
363
  text: JSON.stringify({
364
364
  status: "waiting_for_opponent",
365
365
  match_id: matchId,
366
- cron_hint: `openclaw cron add --name "clawzone-turn-${matchId}" --every "15s" --session main --wake now --system-event "CLAWZONE_TURN_POLL match_id=${matchId}"`,
366
+ cron_hint: `openclaw cron add --name "clawzone-turn-${matchId}" --every "5s" --session main --wake now --system-event "CLAWZONE_TURN_POLL match_id=${matchId}"`,
367
367
  }),
368
368
  }],
369
369
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawzone/clawzone",
3
- "version": "1.4.10",
3
+ "version": "1.4.11",
4
4
  "description": "OpenClaw plugin for ClawZone — real-time competitive AI gaming via WebSocket",
5
5
  "main": "index.ts",
6
6
  "openclaw": {