@dimcool/dimclaw 0.1.11 → 0.1.12
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 +11 -10
- package/index.ts +16 -13
- package/openclaw.plugin.json +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57618,7 +57618,7 @@ function register(api) {
|
|
|
57618
57618
|
},
|
|
57619
57619
|
{
|
|
57620
57620
|
name: "dim_create_lobby",
|
|
57621
|
-
description: "Create a game lobby; bet in USDC
|
|
57621
|
+
description: "Create a game lobby; bet in USDC dollars."
|
|
57622
57622
|
},
|
|
57623
57623
|
{
|
|
57624
57624
|
name: "dim_join_queue",
|
|
@@ -58164,17 +58164,17 @@ function register(api) {
|
|
|
58164
58164
|
});
|
|
58165
58165
|
api.registerTool({
|
|
58166
58166
|
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
|
|
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 dollars (e.g., 1.00 for $1.00). A 1% fee (min 1 cent) is charged per player.",
|
|
58168
58168
|
parameters: {
|
|
58169
58169
|
type: "object",
|
|
58170
58170
|
properties: {
|
|
58171
58171
|
gameType: {
|
|
58172
58172
|
type: "string",
|
|
58173
|
-
description: 'Game type ID (e.g., "rock-paper-scissors", "chess", "tic-tac-toe", "connect-four"
|
|
58173
|
+
description: 'Game type ID (e.g., "rock-paper-scissors", "chess", "tic-tac-toe", "connect-four")'
|
|
58174
58174
|
},
|
|
58175
58175
|
betAmount: {
|
|
58176
58176
|
type: "number",
|
|
58177
|
-
description: "Bet amount in USDC
|
|
58177
|
+
description: "Bet amount in USDC dollars (e.g., 1.00 for $1.00, 5.00 for $5.00, 10.00 for $10.00)"
|
|
58178
58178
|
}
|
|
58179
58179
|
},
|
|
58180
58180
|
required: ["gameType"],
|
|
@@ -58184,7 +58184,7 @@ function register(api) {
|
|
|
58184
58184
|
const c = await requireClient();
|
|
58185
58185
|
if ("error" in c) return c.error;
|
|
58186
58186
|
const gameType = String(params.gameType ?? "");
|
|
58187
|
-
const betAmount = typeof params.betAmount === "number" ? params.betAmount : void 0;
|
|
58187
|
+
const betAmount = typeof params.betAmount === "number" ? Math.round(params.betAmount * 1e6) : void 0;
|
|
58188
58188
|
try {
|
|
58189
58189
|
const lobby = await c.sdk.lobbies.createLobby(gameType, betAmount);
|
|
58190
58190
|
return textResult(
|
|
@@ -58311,7 +58311,7 @@ function register(api) {
|
|
|
58311
58311
|
});
|
|
58312
58312
|
api.registerTool({
|
|
58313
58313
|
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="
|
|
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_mark", payload={ row: 0-2, col: 0-2 }\nConnect Four: gameType="connect-four", action="drop_disc", payload={ column: 0-6 }',
|
|
58315
58315
|
parameters: {
|
|
58316
58316
|
type: "object",
|
|
58317
58317
|
properties: {
|
|
@@ -58321,11 +58321,11 @@ function register(api) {
|
|
|
58321
58321
|
},
|
|
58322
58322
|
gameType: {
|
|
58323
58323
|
type: "string",
|
|
58324
|
-
description: 'Game type (e.g., "rock-paper-scissors", "chess", "tic-tac-toe")'
|
|
58324
|
+
description: 'Game type (e.g., "rock-paper-scissors", "chess", "tic-tac-toe", "connect-four")'
|
|
58325
58325
|
},
|
|
58326
58326
|
action: {
|
|
58327
58327
|
type: "string",
|
|
58328
|
-
description: 'Action type (e.g., "play", "move", "
|
|
58328
|
+
description: 'Action type (e.g., "play", "move", "place_mark", "drop_disc")'
|
|
58329
58329
|
},
|
|
58330
58330
|
payload: {
|
|
58331
58331
|
type: "object",
|
|
@@ -58339,11 +58339,12 @@ function register(api) {
|
|
|
58339
58339
|
const c = await requireClient();
|
|
58340
58340
|
if ("error" in c) return c.error;
|
|
58341
58341
|
try {
|
|
58342
|
-
|
|
58342
|
+
const gameAction = {
|
|
58343
58343
|
gameType: String(params.gameType ?? ""),
|
|
58344
58344
|
action: String(params.action ?? ""),
|
|
58345
58345
|
payload: params.payload ?? {}
|
|
58346
|
-
}
|
|
58346
|
+
};
|
|
58347
|
+
await c.sdk.games.submitAction(String(params.gameId ?? ""), gameAction);
|
|
58347
58348
|
return textResult(
|
|
58348
58349
|
JSON.stringify(
|
|
58349
58350
|
{
|
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 = {
|
|
@@ -335,7 +336,7 @@ export default function register(api: {
|
|
|
335
336
|
},
|
|
336
337
|
{
|
|
337
338
|
name: 'dim_create_lobby',
|
|
338
|
-
description: 'Create a game lobby; bet in USDC
|
|
339
|
+
description: 'Create a game lobby; bet in USDC dollars.',
|
|
339
340
|
},
|
|
340
341
|
{
|
|
341
342
|
name: 'dim_join_queue',
|
|
@@ -916,19 +917,19 @@ export default function register(api: {
|
|
|
916
917
|
api.registerTool({
|
|
917
918
|
name: 'dim_create_lobby',
|
|
918
919
|
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
|
|
920
|
+
'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
921
|
parameters: {
|
|
921
922
|
type: 'object',
|
|
922
923
|
properties: {
|
|
923
924
|
gameType: {
|
|
924
925
|
type: 'string',
|
|
925
926
|
description:
|
|
926
|
-
'Game type ID (e.g., "rock-paper-scissors", "chess", "tic-tac-toe", "connect-four"
|
|
927
|
+
'Game type ID (e.g., "rock-paper-scissors", "chess", "tic-tac-toe", "connect-four")',
|
|
927
928
|
},
|
|
928
929
|
betAmount: {
|
|
929
930
|
type: 'number',
|
|
930
931
|
description:
|
|
931
|
-
'Bet amount in USDC
|
|
932
|
+
'Bet amount in USDC dollars (e.g., 1.00 for $1.00, 5.00 for $5.00, 10.00 for $10.00)',
|
|
932
933
|
},
|
|
933
934
|
},
|
|
934
935
|
required: ['gameType'],
|
|
@@ -939,7 +940,9 @@ export default function register(api: {
|
|
|
939
940
|
if ('error' in c) return c.error;
|
|
940
941
|
const gameType = String(params.gameType ?? '');
|
|
941
942
|
const betAmount =
|
|
942
|
-
typeof params.betAmount === 'number'
|
|
943
|
+
typeof params.betAmount === 'number'
|
|
944
|
+
? Math.round(params.betAmount * 1_000_000)
|
|
945
|
+
: undefined;
|
|
943
946
|
try {
|
|
944
947
|
const lobby = await c.sdk.lobbies.createLobby(gameType, betAmount);
|
|
945
948
|
return textResult(
|
|
@@ -1081,10 +1084,8 @@ export default function register(api: {
|
|
|
1081
1084
|
'Submit a game action. The action format depends on the game type.\n\n' +
|
|
1082
1085
|
'Rock-Paper-Scissors: gameType="rock-paper-scissors", action="play", payload={ action: "rock"|"paper"|"scissors" }\n' +
|
|
1083
1086
|
'Chess: gameType="chess", action="move", payload={ from: "e2", to: "e4" }\n' +
|
|
1084
|
-
'Tic-Tac-Toe: gameType="tic-tac-toe", action="
|
|
1085
|
-
'Connect Four: gameType="connect-four", action="
|
|
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" }',
|
|
1087
|
+
'Tic-Tac-Toe: gameType="tic-tac-toe", action="place_mark", payload={ row: 0-2, col: 0-2 }\n' +
|
|
1088
|
+
'Connect Four: gameType="connect-four", action="drop_disc", payload={ column: 0-6 }',
|
|
1088
1089
|
parameters: {
|
|
1089
1090
|
type: 'object',
|
|
1090
1091
|
properties: {
|
|
@@ -1095,11 +1096,12 @@ export default function register(api: {
|
|
|
1095
1096
|
gameType: {
|
|
1096
1097
|
type: 'string',
|
|
1097
1098
|
description:
|
|
1098
|
-
'Game type (e.g., "rock-paper-scissors", "chess", "tic-tac-toe")',
|
|
1099
|
+
'Game type (e.g., "rock-paper-scissors", "chess", "tic-tac-toe", "connect-four")',
|
|
1099
1100
|
},
|
|
1100
1101
|
action: {
|
|
1101
1102
|
type: 'string',
|
|
1102
|
-
description:
|
|
1103
|
+
description:
|
|
1104
|
+
'Action type (e.g., "play", "move", "place_mark", "drop_disc")',
|
|
1103
1105
|
},
|
|
1104
1106
|
payload: {
|
|
1105
1107
|
type: 'object',
|
|
@@ -1114,11 +1116,12 @@ export default function register(api: {
|
|
|
1114
1116
|
const c = await requireClient();
|
|
1115
1117
|
if ('error' in c) return c.error;
|
|
1116
1118
|
try {
|
|
1117
|
-
|
|
1119
|
+
const gameAction = {
|
|
1118
1120
|
gameType: String(params.gameType ?? ''),
|
|
1119
1121
|
action: String(params.action ?? ''),
|
|
1120
1122
|
payload: (params.payload as Record<string, unknown>) ?? {},
|
|
1121
|
-
} as
|
|
1123
|
+
} as ValidAction;
|
|
1124
|
+
await c.sdk.games.submitAction(String(params.gameId ?? ''), gameAction);
|
|
1122
1125
|
return textResult(
|
|
1123
1126
|
JSON.stringify(
|
|
1124
1127
|
{
|
package/openclaw.plugin.json
CHANGED
|
@@ -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