@dimcool/dimclaw 0.1.11 → 0.1.13

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 CHANGED
@@ -57468,6 +57468,11 @@ function register(api) {
57468
57468
  "No referrer yet \u2014 call dim_apply_referral_code for 10% fee discount"
57469
57469
  );
57470
57470
  }
57471
+ if (result.username) {
57472
+ nextSteps.push(
57473
+ `Share your referral code "${result.username}" with other users/agents \u2014 you earn 30% of their game fees (https://dim.cool/?ref=${result.username})`
57474
+ );
57475
+ }
57471
57476
  } catch {
57472
57477
  }
57473
57478
  const response = {
@@ -57618,11 +57623,11 @@ function register(api) {
57618
57623
  },
57619
57624
  {
57620
57625
  name: "dim_create_lobby",
57621
- description: "Create a game lobby; bet in USDC minor units."
57626
+ description: "Create a game lobby; bet in USDC dollars."
57622
57627
  },
57623
57628
  {
57624
57629
  name: "dim_join_queue",
57625
- description: "Join matchmaking queue for a game type."
57630
+ description: "Join matchmaking queue. If not matched immediately, poll dim_get_lobby until gameId appears."
57626
57631
  },
57627
57632
  { name: "dim_get_lobby", description: "Get lobby details by ID." },
57628
57633
  {
@@ -58164,17 +58169,17 @@ function register(api) {
58164
58169
  });
58165
58170
  api.registerTool({
58166
58171
  name: "dim_create_lobby",
58167
- description: "Create a new game lobby. The agent becomes the lobby creator. Other players can join, or you can join the matchmaking queue to find an opponent. Bet amount is in USDC minor units (1 USDC = 1,000,000). A 1% fee (min 1 cent) is charged per player.",
58172
+ description: "Create a new game lobby. The agent becomes the lobby creator. Other players can join, or you can join the matchmaking queue to find an opponent. Bet amount is in USDC dollars (e.g., 1.00 for $1.00). A 1% fee (min 1 cent) is charged per player.",
58168
58173
  parameters: {
58169
58174
  type: "object",
58170
58175
  properties: {
58171
58176
  gameType: {
58172
58177
  type: "string",
58173
- description: 'Game type ID (e.g., "rock-paper-scissors", "chess", "tic-tac-toe", "connect-four", "nim", "dots-and-boxes")'
58178
+ description: 'Game type ID (e.g., "rock-paper-scissors", "chess", "tic-tac-toe", "connect-four")'
58174
58179
  },
58175
58180
  betAmount: {
58176
58181
  type: "number",
58177
- description: "Bet amount in USDC minor units (e.g., 1000000 = $1.00). Common amounts: 1000000 ($1), 5000000 ($5), 10000000 ($10)"
58182
+ description: "Bet amount in USDC dollars (e.g., 1.00 for $1.00, 5.00 for $5.00, 10.00 for $10.00)"
58178
58183
  }
58179
58184
  },
58180
58185
  required: ["gameType"],
@@ -58184,7 +58189,7 @@ function register(api) {
58184
58189
  const c = await requireClient();
58185
58190
  if ("error" in c) return c.error;
58186
58191
  const gameType = String(params.gameType ?? "");
58187
- const betAmount = typeof params.betAmount === "number" ? params.betAmount : void 0;
58192
+ const betAmount = typeof params.betAmount === "number" ? Math.round(params.betAmount * 1e6) : void 0;
58188
58193
  try {
58189
58194
  const lobby = await c.sdk.lobbies.createLobby(gameType, betAmount);
58190
58195
  return textResult(
@@ -58213,7 +58218,7 @@ function register(api) {
58213
58218
  });
58214
58219
  api.registerTool({
58215
58220
  name: "dim_join_queue",
58216
- description: "Join the matchmaking queue for a lobby. If the lobby is full, the game starts immediately. Otherwise, waits for an opponent. Returns the lobby (and gameId if matched).",
58221
+ description: 'Join the matchmaking queue for a lobby. If matched immediately, returns gameId \u2014 start playing. If not matched, you MUST poll dim_get_lobby every 2-3 seconds until status becomes "active" and gameId appears.',
58217
58222
  parameters: {
58218
58223
  type: "object",
58219
58224
  properties: {
@@ -58311,7 +58316,7 @@ function register(api) {
58311
58316
  });
58312
58317
  api.registerTool({
58313
58318
  name: "dim_submit_action",
58314
- description: 'Submit a game action. The action format depends on the game type.\n\nRock-Paper-Scissors: gameType="rock-paper-scissors", action="play", payload={ action: "rock"|"paper"|"scissors" }\nChess: gameType="chess", action="move", payload={ from: "e2", to: "e4" }\nTic-Tac-Toe: gameType="tic-tac-toe", action="place", payload={ position: 0-8 }\nConnect Four: gameType="connect-four", action="drop", payload={ column: 0-6 }\nNim: gameType="nim", action="take", payload={ heap: 0-2, count: 1-N }\nDots and Boxes: gameType="dots-and-boxes", action="draw", payload={ row, col, direction: "h"|"v" }',
58319
+ description: 'Submit a game action. The action format depends on the game type.\n\nRock-Paper-Scissors: gameType="rock-paper-scissors", action="play", payload={ action: "rock"|"paper"|"scissors" }\nChess: gameType="chess", action="move", payload={ from: "e2", to: "e4" }\nTic-Tac-Toe: gameType="tic-tac-toe", action="place_mark", payload={ row: 0-2, col: 0-2 }\nConnect Four: gameType="connect-four", action="drop_disc", payload={ column: 0-6 }',
58315
58320
  parameters: {
58316
58321
  type: "object",
58317
58322
  properties: {
@@ -58321,11 +58326,11 @@ function register(api) {
58321
58326
  },
58322
58327
  gameType: {
58323
58328
  type: "string",
58324
- description: 'Game type (e.g., "rock-paper-scissors", "chess", "tic-tac-toe")'
58329
+ description: 'Game type (e.g., "rock-paper-scissors", "chess", "tic-tac-toe", "connect-four")'
58325
58330
  },
58326
58331
  action: {
58327
58332
  type: "string",
58328
- description: 'Action type (e.g., "play", "move", "place", "drop")'
58333
+ description: 'Action type (e.g., "play", "move", "place_mark", "drop_disc")'
58329
58334
  },
58330
58335
  payload: {
58331
58336
  type: "object",
@@ -58339,11 +58344,12 @@ function register(api) {
58339
58344
  const c = await requireClient();
58340
58345
  if ("error" in c) return c.error;
58341
58346
  try {
58342
- await c.sdk.games.submitAction(String(params.gameId ?? ""), {
58347
+ const gameAction = {
58343
58348
  gameType: String(params.gameType ?? ""),
58344
58349
  action: String(params.action ?? ""),
58345
58350
  payload: params.payload ?? {}
58346
- });
58351
+ };
58352
+ await c.sdk.games.submitAction(String(params.gameId ?? ""), gameAction);
58347
58353
  return textResult(
58348
58354
  JSON.stringify(
58349
58355
  {
package/index.ts CHANGED
@@ -7,6 +7,7 @@ import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
7
7
  import path from 'node:path';
8
8
  import { Keypair, Transaction } from '@solana/web3.js';
9
9
  import bs58 from 'bs58';
10
+ import type { ValidAction } from '@dimcool/sdk';
10
11
  import { DimClient } from './dim-client';
11
12
 
12
13
  type PluginConfig = {
@@ -171,6 +172,11 @@ export default function register(api: {
171
172
  'No referrer yet — call dim_apply_referral_code for 10% fee discount',
172
173
  );
173
174
  }
175
+ if (result.username) {
176
+ nextSteps.push(
177
+ `Share your referral code "${result.username}" with other users/agents — you earn 30% of their game fees (https://dim.cool/?ref=${result.username})`,
178
+ );
179
+ }
174
180
  } catch {
175
181
  /* non-critical */
176
182
  }
@@ -335,11 +341,11 @@ export default function register(api: {
335
341
  },
336
342
  {
337
343
  name: 'dim_create_lobby',
338
- description: 'Create a game lobby; bet in USDC minor units.',
344
+ description: 'Create a game lobby; bet in USDC dollars.',
339
345
  },
340
346
  {
341
347
  name: 'dim_join_queue',
342
- description: 'Join matchmaking queue for a game type.',
348
+ description: 'Join matchmaking queue. If not matched immediately, poll dim_get_lobby until gameId appears.',
343
349
  },
344
350
  { name: 'dim_get_lobby', description: 'Get lobby details by ID.' },
345
351
  {
@@ -916,19 +922,19 @@ export default function register(api: {
916
922
  api.registerTool({
917
923
  name: 'dim_create_lobby',
918
924
  description:
919
- 'Create a new game lobby. The agent becomes the lobby creator. Other players can join, or you can join the matchmaking queue to find an opponent. Bet amount is in USDC minor units (1 USDC = 1,000,000). A 1% fee (min 1 cent) is charged per player.',
925
+ 'Create a new game lobby. The agent becomes the lobby creator. Other players can join, or you can join the matchmaking queue to find an opponent. Bet amount is in USDC dollars (e.g., 1.00 for $1.00). A 1% fee (min 1 cent) is charged per player.',
920
926
  parameters: {
921
927
  type: 'object',
922
928
  properties: {
923
929
  gameType: {
924
930
  type: 'string',
925
931
  description:
926
- 'Game type ID (e.g., "rock-paper-scissors", "chess", "tic-tac-toe", "connect-four", "nim", "dots-and-boxes")',
932
+ 'Game type ID (e.g., "rock-paper-scissors", "chess", "tic-tac-toe", "connect-four")',
927
933
  },
928
934
  betAmount: {
929
935
  type: 'number',
930
936
  description:
931
- 'Bet amount in USDC minor units (e.g., 1000000 = $1.00). Common amounts: 1000000 ($1), 5000000 ($5), 10000000 ($10)',
937
+ 'Bet amount in USDC dollars (e.g., 1.00 for $1.00, 5.00 for $5.00, 10.00 for $10.00)',
932
938
  },
933
939
  },
934
940
  required: ['gameType'],
@@ -939,7 +945,9 @@ export default function register(api: {
939
945
  if ('error' in c) return c.error;
940
946
  const gameType = String(params.gameType ?? '');
941
947
  const betAmount =
942
- typeof params.betAmount === 'number' ? params.betAmount : undefined;
948
+ typeof params.betAmount === 'number'
949
+ ? Math.round(params.betAmount * 1_000_000)
950
+ : undefined;
943
951
  try {
944
952
  const lobby = await c.sdk.lobbies.createLobby(gameType, betAmount);
945
953
  return textResult(
@@ -972,7 +980,7 @@ export default function register(api: {
972
980
  api.registerTool({
973
981
  name: 'dim_join_queue',
974
982
  description:
975
- 'Join the matchmaking queue for a lobby. If the lobby is full, the game starts immediately. Otherwise, waits for an opponent. Returns the lobby (and gameId if matched).',
983
+ 'Join the matchmaking queue for a lobby. If matched immediately, returns gameId start playing. If not matched, you MUST poll dim_get_lobby every 2-3 seconds until status becomes "active" and gameId appears.',
976
984
  parameters: {
977
985
  type: 'object',
978
986
  properties: {
@@ -1081,10 +1089,8 @@ export default function register(api: {
1081
1089
  'Submit a game action. The action format depends on the game type.\n\n' +
1082
1090
  'Rock-Paper-Scissors: gameType="rock-paper-scissors", action="play", payload={ action: "rock"|"paper"|"scissors" }\n' +
1083
1091
  'Chess: gameType="chess", action="move", payload={ from: "e2", to: "e4" }\n' +
1084
- 'Tic-Tac-Toe: gameType="tic-tac-toe", action="place", payload={ position: 0-8 }\n' +
1085
- 'Connect Four: gameType="connect-four", action="drop", payload={ column: 0-6 }\n' +
1086
- 'Nim: gameType="nim", action="take", payload={ heap: 0-2, count: 1-N }\n' +
1087
- 'Dots and Boxes: gameType="dots-and-boxes", action="draw", payload={ row, col, direction: "h"|"v" }',
1092
+ 'Tic-Tac-Toe: gameType="tic-tac-toe", action="place_mark", payload={ row: 0-2, col: 0-2 }\n' +
1093
+ 'Connect Four: gameType="connect-four", action="drop_disc", payload={ column: 0-6 }',
1088
1094
  parameters: {
1089
1095
  type: 'object',
1090
1096
  properties: {
@@ -1095,11 +1101,12 @@ export default function register(api: {
1095
1101
  gameType: {
1096
1102
  type: 'string',
1097
1103
  description:
1098
- 'Game type (e.g., "rock-paper-scissors", "chess", "tic-tac-toe")',
1104
+ 'Game type (e.g., "rock-paper-scissors", "chess", "tic-tac-toe", "connect-four")',
1099
1105
  },
1100
1106
  action: {
1101
1107
  type: 'string',
1102
- description: 'Action type (e.g., "play", "move", "place", "drop")',
1108
+ description:
1109
+ 'Action type (e.g., "play", "move", "place_mark", "drop_disc")',
1103
1110
  },
1104
1111
  payload: {
1105
1112
  type: 'object',
@@ -1114,11 +1121,12 @@ export default function register(api: {
1114
1121
  const c = await requireClient();
1115
1122
  if ('error' in c) return c.error;
1116
1123
  try {
1117
- await c.sdk.games.submitAction(String(params.gameId ?? ''), {
1124
+ const gameAction = {
1118
1125
  gameType: String(params.gameType ?? ''),
1119
1126
  action: String(params.action ?? ''),
1120
1127
  payload: (params.payload as Record<string, unknown>) ?? {},
1121
- } as never);
1128
+ } as ValidAction;
1129
+ await c.sdk.games.submitAction(String(params.gameId ?? ''), gameAction);
1122
1130
  return textResult(
1123
1131
  JSON.stringify(
1124
1132
  {
@@ -31,5 +31,6 @@
31
31
  "placeholder": "https://api.dim.cool"
32
32
  }
33
33
  },
34
- "setupHint": "After install, add your Solana wallet private key to plugins.entries.dimclaw.config.walletPrivateKey, then call dim_login to get started."
34
+ "setupHint": "After install, add your Solana wallet private key to plugins.entries.dimclaw.config.walletPrivateKey, then call dim_login to get started.",
35
+ "skill": "./SKILL.md"
35
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimcool/dimclaw",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "OpenClaw plugin for DIM — play games, chat, send USDC, and earn on DIM using the SDK directly (no MCP subprocess).",
5
5
  "type": "module",
6
6
  "openclaw": {