@dxos/plugin-chess 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef
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/lib/browser/blueprints/index.mjs +14 -0
- package/dist/lib/browser/chunk-H6SON7WG.mjs +28 -0
- package/dist/lib/browser/chunk-H6SON7WG.mjs.map +7 -0
- package/dist/lib/browser/chunk-IN3LZ2OO.mjs +62 -0
- package/dist/lib/browser/chunk-IN3LZ2OO.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-JYP24G6K.mjs +36 -0
- package/dist/lib/browser/chunk-JYP24G6K.mjs.map +7 -0
- package/dist/lib/browser/chunk-OBKYFOJA.mjs +110 -0
- package/dist/lib/browser/chunk-OBKYFOJA.mjs.map +7 -0
- package/dist/lib/browser/create-2ME3FNBX.mjs +24 -0
- package/dist/lib/browser/create-2ME3FNBX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +30 -111
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/move-TTMIPD5J.mjs +36 -0
- package/dist/lib/browser/move-TTMIPD5J.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +19 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/play-GHXPV2T2.mjs +45 -0
- package/dist/lib/browser/play-GHXPV2T2.mjs.map +7 -0
- package/dist/lib/browser/print-RNAGAOM7.mjs +30 -0
- package/dist/lib/browser/print-RNAGAOM7.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +38 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -5
- package/dist/lib/node-esm/blueprints/index.mjs +15 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4C4GPZTA.mjs +29 -0
- package/dist/lib/node-esm/chunk-4C4GPZTA.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-G2EHRXHX.mjs +111 -0
- package/dist/lib/node-esm/chunk-G2EHRXHX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NSFPC4IO.mjs +38 -0
- package/dist/lib/node-esm/chunk-NSFPC4IO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-OHBKSL2Q.mjs +63 -0
- package/dist/lib/node-esm/chunk-OHBKSL2Q.mjs.map +7 -0
- package/dist/lib/node-esm/create-CC2P7GPT.mjs +25 -0
- package/dist/lib/node-esm/create-CC2P7GPT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +30 -111
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/move-CYHXWHHM.mjs +37 -0
- package/dist/lib/node-esm/move-CYHXWHHM.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +20 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/play-KTNK2PBL.mjs +46 -0
- package/dist/lib/node-esm/play-KTNK2PBL.mjs.map +7 -0
- package/dist/lib/node-esm/print-P23VKVNU.mjs +31 -0
- package/dist/lib/node-esm/print-P23VKVNU.mjs.map +7 -0
- package/dist/lib/node-esm/translations.mjs +39 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +3 -5
- package/dist/types/src/ChessPlugin.d.ts +3 -1
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/ChessPlugin.node.d.ts +4 -0
- package/dist/types/src/ChessPlugin.node.d.ts.map +1 -0
- package/dist/types/src/ChessPlugin.test.d.ts +2 -0
- package/dist/types/src/ChessPlugin.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/chess-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +3 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition.d.ts +3 -2
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +5 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/{Chessboard.d.ts → Chessboard/Chessboard.d.ts} +8 -8
- package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +65 -0
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Info.d.ts → Chessboard/Info.d.ts} +5 -6
- package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/index.d.ts +2 -0
- package/dist/types/src/components/Chessboard/index.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/types.d.ts +8 -0
- package/dist/types/src/components/Chessboard/types.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts +6 -0
- package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts +64 -0
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ChessArticle/index.d.ts +2 -0
- package/dist/types/src/containers/ChessArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChessCard/ChessCard.d.ts +6 -0
- package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -0
- package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts +15 -0
- package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ChessCard/index.d.ts +2 -0
- package/dist/types/src/containers/ChessCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +51 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/move.d.ts +5 -0
- package/dist/types/src/operations/move.d.ts.map +1 -0
- package/dist/types/src/operations/play.d.ts +5 -0
- package/dist/types/src/operations/play.d.ts.map +1 -0
- package/dist/types/src/operations/print.d.ts +5 -0
- package/dist/types/src/operations/print.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +40 -22
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts +19 -19
- package/dist/types/src/types/Chess.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +83 -51
- package/src/ChessPlugin.node.ts +45 -0
- package/src/ChessPlugin.test.ts +49 -0
- package/src/ChessPlugin.tsx +43 -53
- package/src/blueprints/chess-blueprint.ts +34 -0
- package/src/blueprints/index.ts +6 -0
- package/src/capabilities/artifact-definition.ts +100 -93
- package/src/capabilities/blueprint-definition.ts +11 -28
- package/src/capabilities/index.ts +9 -6
- package/src/capabilities/node.ts +16 -0
- package/src/capabilities/operation-handler.ts +14 -0
- package/src/capabilities/react-surface.tsx +27 -15
- package/src/components/Chessboard/Chessboard.stories.tsx +94 -0
- package/src/components/{Chessboard.tsx → Chessboard/Chessboard.tsx} +32 -29
- package/src/components/{Info.tsx → Chessboard/Info.tsx} +42 -25
- package/src/components/Chessboard/index.ts +5 -0
- package/src/components/Chessboard/types.ts +18 -0
- package/src/components/index.ts +1 -5
- package/src/containers/ChessArticle/ChessArticle.stories.tsx +53 -0
- package/src/containers/ChessArticle/ChessArticle.tsx +73 -0
- package/src/containers/ChessArticle/index.ts +5 -0
- package/src/containers/ChessCard/ChessCard.stories.tsx +42 -0
- package/src/containers/ChessCard/ChessCard.tsx +22 -0
- package/src/containers/ChessCard/index.ts +5 -0
- package/src/containers/index.ts +8 -0
- package/src/index.ts +6 -4
- package/src/meta.ts +6 -4
- package/src/operations/create.ts +21 -0
- package/src/operations/definitions.ts +109 -0
- package/src/operations/index.ts +16 -0
- package/src/operations/move.ts +36 -0
- package/src/operations/play.ts +45 -0
- package/src/operations/print.ts +28 -0
- package/src/translations.ts +21 -19
- package/src/types/Chess.ts +30 -34
- package/src/types/index.ts +0 -1
- package/dist/lib/browser/ChessboardContainer-JOCAWL5W.mjs +0 -97
- package/dist/lib/browser/ChessboardContainer-JOCAWL5W.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-LC4GNYMG.mjs +0 -11
- package/dist/lib/browser/chunk-2EN3CBLB.mjs +0 -8
- package/dist/lib/browser/chunk-2EN3CBLB.mjs.map +0 -7
- package/dist/lib/browser/chunk-3WEALY7P.mjs +0 -84
- package/dist/lib/browser/chunk-3WEALY7P.mjs.map +0 -7
- package/dist/lib/browser/chunk-4ULSTPL6.mjs +0 -166
- package/dist/lib/browser/chunk-4ULSTPL6.mjs.map +0 -7
- package/dist/lib/browser/chunk-NR4YFUK7.mjs +0 -306
- package/dist/lib/browser/chunk-NR4YFUK7.mjs.map +0 -7
- package/dist/lib/browser/chunk-WSUUPPDK.mjs +0 -26
- package/dist/lib/browser/chunk-WSUUPPDK.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-PMP36Y5B.mjs +0 -25
- package/dist/lib/browser/intent-resolver-PMP36Y5B.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TSLFLTXN.mjs +0 -38
- package/dist/lib/browser/react-surface-TSLFLTXN.mjs.map +0 -7
- package/dist/lib/node-esm/ChessboardContainer-XAVVBRFW.mjs +0 -98
- package/dist/lib/node-esm/ChessboardContainer-XAVVBRFW.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-FBGRWYEW.mjs +0 -12
- package/dist/lib/node-esm/chunk-5C2OYL2B.mjs +0 -27
- package/dist/lib/node-esm/chunk-5C2OYL2B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7PHZFXU5.mjs +0 -10
- package/dist/lib/node-esm/chunk-7PHZFXU5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AR3TI5LX.mjs +0 -167
- package/dist/lib/node-esm/chunk-AR3TI5LX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LMXETYDF.mjs +0 -85
- package/dist/lib/node-esm/chunk-LMXETYDF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VVTQFCUK.mjs +0 -307
- package/dist/lib/node-esm/chunk-VVTQFCUK.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-5P7Y2ZKB.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-5P7Y2ZKB.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-AN4SMEDU.mjs +0 -39
- package/dist/lib/node-esm/react-surface-AN4SMEDU.mjs.map +0 -7
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/Card.stories.d.ts +0 -13
- package/dist/types/src/components/Card.stories.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard.stories.d.ts +0 -44
- package/dist/types/src/components/Chessboard.stories.d.ts.map +0 -1
- package/dist/types/src/components/ChessboardArticle.d.ts +0 -7
- package/dist/types/src/components/ChessboardArticle.d.ts.map +0 -1
- package/dist/types/src/components/ChessboardContainer.d.ts +0 -9
- package/dist/types/src/components/ChessboardContainer.d.ts.map +0 -1
- package/dist/types/src/components/Info.d.ts.map +0 -1
- package/dist/types/src/functions/create.d.ts +0 -14
- package/dist/types/src/functions/create.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -4
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/move.d.ts +0 -8
- package/dist/types/src/functions/move.d.ts.map +0 -1
- package/dist/types/src/functions/play.d.ts +0 -9
- package/dist/types/src/functions/play.d.ts.map +0 -1
- package/dist/types/src/types/ChessAction.d.ts +0 -24
- package/dist/types/src/types/ChessAction.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -22
- package/src/components/Card.stories.tsx +0 -66
- package/src/components/Chessboard.stories.tsx +0 -49
- package/src/components/ChessboardArticle.tsx +0 -69
- package/src/components/ChessboardContainer.tsx +0 -44
- package/src/functions/create.ts +0 -31
- package/src/functions/index.ts +0 -7
- package/src/functions/move.ts +0 -44
- package/src/functions/play.ts +0 -54
- package/src/types/ChessAction.ts +0 -19
- /package/dist/lib/browser/{blueprint-definition-LC4GNYMG.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-FBGRWYEW.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-chess",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.abd8ff62ef",
|
|
4
4
|
"description": "Chess for new plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
10
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#blueprints": "./src/blueprints/index.ts",
|
|
17
|
+
"#capabilities": {
|
|
18
|
+
"browser": "./src/capabilities/index.ts",
|
|
19
|
+
"node": "./src/capabilities/node.ts",
|
|
20
|
+
"default": "./src/capabilities/index.ts"
|
|
21
|
+
},
|
|
22
|
+
"#components": "./src/components/index.ts",
|
|
23
|
+
"#containers": "./src/containers/index.ts",
|
|
24
|
+
"#meta": "./src/meta.ts",
|
|
25
|
+
"#operations": "./src/operations/index.ts",
|
|
26
|
+
"#translations": "./src/translations.ts",
|
|
27
|
+
"#plugin": {
|
|
28
|
+
"browser": "./src/ChessPlugin.tsx",
|
|
29
|
+
"node": "./src/ChessPlugin.node.ts",
|
|
30
|
+
"default": "./src/ChessPlugin.tsx"
|
|
31
|
+
},
|
|
32
|
+
"#types": "./src/types/index.ts"
|
|
33
|
+
},
|
|
11
34
|
"exports": {
|
|
12
35
|
".": {
|
|
13
36
|
"source": "./src/index.ts",
|
|
@@ -15,74 +38,83 @@
|
|
|
15
38
|
"browser": "./dist/lib/browser/index.mjs",
|
|
16
39
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
17
40
|
},
|
|
41
|
+
"./blueprints": {
|
|
42
|
+
"source": "./src/blueprints/index.ts",
|
|
43
|
+
"types": "./dist/types/src/blueprints/index.d.ts",
|
|
44
|
+
"browser": "./dist/lib/browser/blueprints/index.mjs",
|
|
45
|
+
"node": "./dist/lib/node-esm/blueprints/index.mjs"
|
|
46
|
+
},
|
|
47
|
+
"./operations": {
|
|
48
|
+
"source": "./src/operations/index.ts",
|
|
49
|
+
"types": "./dist/types/src/operations/index.d.ts",
|
|
50
|
+
"browser": "./dist/lib/browser/operations/index.mjs",
|
|
51
|
+
"node": "./dist/lib/node-esm/operations/index.mjs"
|
|
52
|
+
},
|
|
53
|
+
"./translations": {
|
|
54
|
+
"source": "./src/translations.ts",
|
|
55
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
56
|
+
"browser": "./dist/lib/browser/translations.mjs",
|
|
57
|
+
"node": "./dist/lib/node-esm/translations.mjs"
|
|
58
|
+
},
|
|
18
59
|
"./types": {
|
|
19
60
|
"source": "./src/types/index.ts",
|
|
20
61
|
"types": "./dist/types/src/types/index.d.ts",
|
|
21
62
|
"browser": "./dist/lib/browser/types/index.mjs",
|
|
22
63
|
"node": "./dist/lib/node-esm/types/index.mjs"
|
|
23
|
-
},
|
|
24
|
-
"./functions": {
|
|
25
|
-
"source": "./src/functions/index.ts",
|
|
26
|
-
"types": "./dist/types/src/functions/index.d.ts",
|
|
27
|
-
"browser": "./dist/lib/browser/functions/index.mjs",
|
|
28
|
-
"node": "./dist/lib/node-esm/functions/index.mjs"
|
|
29
64
|
}
|
|
30
65
|
},
|
|
31
66
|
"types": "dist/types/src/index.d.ts",
|
|
32
|
-
"typesVersions": {
|
|
33
|
-
"*": {
|
|
34
|
-
"types": [
|
|
35
|
-
"dist/types/src/types/index.d.ts"
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
67
|
"files": [
|
|
40
68
|
"dist",
|
|
41
69
|
"src"
|
|
42
70
|
],
|
|
43
71
|
"dependencies": {
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
72
|
+
"@automerge/automerge": "3.2.3",
|
|
73
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
46
74
|
"chess.js": "^1.0.0",
|
|
47
|
-
"effect": "3.
|
|
48
|
-
"@dxos/ai": "0.8.4-main.
|
|
49
|
-
"@dxos/app-
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/echo
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/plugin-
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/react-ui-gameboard": "0.8.4-main.
|
|
64
|
-
"@dxos/react-client": "0.8.4-main.
|
|
65
|
-
"@dxos/react-ui-sfx": "0.8.4-main.
|
|
66
|
-
"@dxos/react-ui-stack": "0.8.4-main.
|
|
67
|
-
"@dxos/schema": "0.8.4-main.
|
|
68
|
-
"@dxos/
|
|
75
|
+
"effect": "3.20.0",
|
|
76
|
+
"@dxos/ai": "0.8.4-main.abd8ff62ef",
|
|
77
|
+
"@dxos/app-toolkit": "0.8.4-main.abd8ff62ef",
|
|
78
|
+
"@dxos/app-framework": "0.8.4-main.abd8ff62ef",
|
|
79
|
+
"@dxos/assistant": "0.8.4-main.abd8ff62ef",
|
|
80
|
+
"@dxos/async": "0.8.4-main.abd8ff62ef",
|
|
81
|
+
"@dxos/compute": "0.8.4-main.abd8ff62ef",
|
|
82
|
+
"@dxos/echo": "0.8.4-main.abd8ff62ef",
|
|
83
|
+
"@dxos/echo-db": "0.8.4-main.abd8ff62ef",
|
|
84
|
+
"@dxos/invariant": "0.8.4-main.abd8ff62ef",
|
|
85
|
+
"@dxos/display-name": "0.8.4-main.abd8ff62ef",
|
|
86
|
+
"@dxos/echo-react": "0.8.4-main.abd8ff62ef",
|
|
87
|
+
"@dxos/plugin-client": "0.8.4-main.abd8ff62ef",
|
|
88
|
+
"@dxos/plugin-graph": "0.8.4-main.abd8ff62ef",
|
|
89
|
+
"@dxos/plugin-markdown": "0.8.4-main.abd8ff62ef",
|
|
90
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.abd8ff62ef",
|
|
91
|
+
"@dxos/react-ui-gameboard": "0.8.4-main.abd8ff62ef",
|
|
92
|
+
"@dxos/react-client": "0.8.4-main.abd8ff62ef",
|
|
93
|
+
"@dxos/react-ui-sfx": "0.8.4-main.abd8ff62ef",
|
|
94
|
+
"@dxos/react-ui-stack": "0.8.4-main.abd8ff62ef",
|
|
95
|
+
"@dxos/schema": "0.8.4-main.abd8ff62ef",
|
|
96
|
+
"@dxos/plugin-space": "0.8.4-main.abd8ff62ef",
|
|
97
|
+
"@dxos/util": "0.8.4-main.abd8ff62ef",
|
|
98
|
+
"@dxos/types": "0.8.4-main.abd8ff62ef",
|
|
99
|
+
"@dxos/log": "0.8.4-main.abd8ff62ef"
|
|
69
100
|
},
|
|
70
101
|
"devDependencies": {
|
|
71
|
-
"@types/react": "~19.2.
|
|
72
|
-
"@types/react-dom": "~19.2.
|
|
73
|
-
"react": "~19.2.
|
|
74
|
-
"react-dom": "~19.2.
|
|
75
|
-
"vite": "
|
|
76
|
-
"@dxos/plugin-
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/react-ui
|
|
79
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
102
|
+
"@types/react": "~19.2.7",
|
|
103
|
+
"@types/react-dom": "~19.2.3",
|
|
104
|
+
"react": "~19.2.3",
|
|
105
|
+
"react-dom": "~19.2.3",
|
|
106
|
+
"vite": "^8.0.10",
|
|
107
|
+
"@dxos/plugin-testing": "0.8.4-main.abd8ff62ef",
|
|
108
|
+
"@dxos/plugin-theme": "0.8.4-main.abd8ff62ef",
|
|
109
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef",
|
|
110
|
+
"@dxos/storybook-utils": "0.8.4-main.abd8ff62ef",
|
|
111
|
+
"@dxos/ui-theme": "0.8.4-main.abd8ff62ef"
|
|
80
112
|
},
|
|
81
113
|
"peerDependencies": {
|
|
82
|
-
"react": "
|
|
83
|
-
"react-dom": "
|
|
84
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
85
|
-
"@dxos/
|
|
114
|
+
"react": "~19.2.3",
|
|
115
|
+
"react-dom": "~19.2.3",
|
|
116
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef",
|
|
117
|
+
"@dxos/ui-theme": "0.8.4-main.abd8ff62ef"
|
|
86
118
|
},
|
|
87
119
|
"publishConfig": {
|
|
88
120
|
"access": "public"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
7
|
+
|
|
8
|
+
import { Plugin } from '@dxos/app-framework';
|
|
9
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
11
|
+
import { Annotation } from '@dxos/echo';
|
|
12
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
13
|
+
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
14
|
+
|
|
15
|
+
import { BlueprintDefinition, OperationHandler } from '#capabilities';
|
|
16
|
+
import { meta } from '#meta';
|
|
17
|
+
import { Chess } from '#types';
|
|
18
|
+
|
|
19
|
+
export const ChessPlugin = Plugin.define(meta).pipe(
|
|
20
|
+
AppPlugin.addMetadataModule({
|
|
21
|
+
metadata: {
|
|
22
|
+
id: Chess.Game.typename,
|
|
23
|
+
metadata: {
|
|
24
|
+
icon: Annotation.IconAnnotation.get(Chess.Game).pipe(Option.getOrThrow).icon,
|
|
25
|
+
iconHue: Annotation.IconAnnotation.get(Chess.Game).pipe(Option.getOrThrow).hue ?? 'white',
|
|
26
|
+
createObject: ((props, options) =>
|
|
27
|
+
Effect.gen(function* () {
|
|
28
|
+
const object = Chess.make(props);
|
|
29
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
30
|
+
object,
|
|
31
|
+
target: options.target,
|
|
32
|
+
hidden: true,
|
|
33
|
+
targetNodeId: options.targetNodeId,
|
|
34
|
+
});
|
|
35
|
+
})) satisfies CreateObject,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
AppPlugin.addSchemaModule({ schema: [Chess.Game] }),
|
|
40
|
+
AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),
|
|
41
|
+
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
42
|
+
Plugin.make,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
export default ChessPlugin;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { ActivationEvents } from '@dxos/app-framework';
|
|
8
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
9
|
+
import { ClientPlugin } from '@dxos/plugin-client';
|
|
10
|
+
import { createComposerTestApp } from '@dxos/plugin-testing/harness';
|
|
11
|
+
|
|
12
|
+
import { ChessPlugin } from '#plugin';
|
|
13
|
+
|
|
14
|
+
import { meta } from './meta';
|
|
15
|
+
import { Print } from './operations';
|
|
16
|
+
|
|
17
|
+
const moduleId = (name: string) => `${meta.id}.module.${name}`;
|
|
18
|
+
|
|
19
|
+
describe('ChessPlugin', () => {
|
|
20
|
+
test('modules activate on the expected events', async ({ expect }) => {
|
|
21
|
+
await using harness = await createComposerTestApp({
|
|
22
|
+
plugins: [ClientPlugin({}), ChessPlugin()],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Modules expected to be active after a normal startup.
|
|
26
|
+
expect(harness.manager.getActive()).toEqual(expect.arrayContaining([moduleId('metadata'), moduleId('schema')]));
|
|
27
|
+
|
|
28
|
+
// SetupArtifactDefinition is fired by AssistantPlugin, which can't be included here due to a workspace cycle.
|
|
29
|
+
await harness.fire(AppActivationEvents.SetupArtifactDefinition);
|
|
30
|
+
expect(harness.manager.getActive()).toContain(moduleId('BlueprintDefinition'));
|
|
31
|
+
|
|
32
|
+
// Operation handlers are not loaded on startup — SetupOperationHandler fires lazily when an operation is invoked.
|
|
33
|
+
await harness.fire(ActivationEvents.SetupOperationHandler);
|
|
34
|
+
expect(harness.manager.getActive()).toContain(moduleId('OperationHandler'));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('invokes the Print operation via the invoker capability', async ({ expect }) => {
|
|
38
|
+
await using harness = await createComposerTestApp({ plugins: [ChessPlugin()] });
|
|
39
|
+
const result = await harness.invoke(Print, {});
|
|
40
|
+
// Empty input returns empty ASCII (handler swallows errors for malformed FEN).
|
|
41
|
+
expect(typeof result.ascii).toBe('string');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('Print renders a PGN to ASCII board', async ({ expect }) => {
|
|
45
|
+
await using harness = await createComposerTestApp({ plugins: [ChessPlugin()] });
|
|
46
|
+
const { ascii } = await harness.invoke(Print, { pgn: '1. e4 e5' });
|
|
47
|
+
expect(ascii).toContain('a b c d e f g h');
|
|
48
|
+
});
|
|
49
|
+
});
|
package/src/ChessPlugin.tsx
CHANGED
|
@@ -2,59 +2,49 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
8
|
-
import { defineObjectForm } from '@dxos/plugin-space/types';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
9
7
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
8
|
+
import { Plugin } from '@dxos/app-framework';
|
|
9
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
11
|
+
import { Annotation } from '@dxos/echo';
|
|
12
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
13
|
+
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
),
|
|
44
|
-
}),
|
|
45
|
-
defineModule({
|
|
46
|
-
id: `${meta.id}/module/react-surface`,
|
|
47
|
-
activatesOn: Events.SetupReactSurface,
|
|
48
|
-
activate: ReactSurface,
|
|
49
|
-
}),
|
|
50
|
-
defineModule({
|
|
51
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
52
|
-
activatesOn: Events.SetupIntentResolver,
|
|
53
|
-
activate: IntentResolver,
|
|
54
|
-
}),
|
|
55
|
-
defineModule({
|
|
56
|
-
id: `${meta.id}/module/blueprint`,
|
|
57
|
-
activatesOn: Events.SetupArtifactDefinition,
|
|
58
|
-
activate: BlueprintDefinition,
|
|
15
|
+
import { ChessBlueprint } from '#blueprints';
|
|
16
|
+
import { BlueprintDefinition, OperationHandler, ReactSurface } from '#capabilities';
|
|
17
|
+
import { meta } from '#meta';
|
|
18
|
+
import { translations } from '#translations';
|
|
19
|
+
import { Chess } from '#types';
|
|
20
|
+
|
|
21
|
+
export const ChessPlugin = Plugin.define(meta).pipe(
|
|
22
|
+
AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),
|
|
23
|
+
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
24
|
+
AppPlugin.addMetadataModule({
|
|
25
|
+
metadata: {
|
|
26
|
+
id: Chess.Game.typename,
|
|
27
|
+
metadata: {
|
|
28
|
+
icon: Annotation.IconAnnotation.get(Chess.Game).pipe(Option.getOrThrow).icon,
|
|
29
|
+
iconHue: Annotation.IconAnnotation.get(Chess.Game).pipe(Option.getOrThrow).hue ?? 'white',
|
|
30
|
+
blueprints: [ChessBlueprint.key],
|
|
31
|
+
createObject: ((props, options) =>
|
|
32
|
+
Effect.gen(function* () {
|
|
33
|
+
const object = Chess.make(props);
|
|
34
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
35
|
+
object,
|
|
36
|
+
target: options.target,
|
|
37
|
+
hidden: true,
|
|
38
|
+
targetNodeId: options.targetNodeId,
|
|
39
|
+
});
|
|
40
|
+
})) satisfies CreateObject,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
59
43
|
}),
|
|
60
|
-
])
|
|
44
|
+
AppPlugin.addSchemaModule({ schema: [Chess.Game] }),
|
|
45
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
46
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
47
|
+
Plugin.make,
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export default ChessPlugin;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Blueprint, Template } from '@dxos/compute';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
7
|
+
|
|
8
|
+
import { Create, Move, Play, Print } from '#operations';
|
|
9
|
+
|
|
10
|
+
const BLUEPRINT_KEY = 'org.dxos.blueprint.chess';
|
|
11
|
+
|
|
12
|
+
const operations = [Create, Move, Play, Print];
|
|
13
|
+
|
|
14
|
+
const make = () =>
|
|
15
|
+
Blueprint.make({
|
|
16
|
+
key: BLUEPRINT_KEY,
|
|
17
|
+
name: 'Chess',
|
|
18
|
+
tools: Blueprint.toolDefinitions({ operations }),
|
|
19
|
+
instructions: Template.make({
|
|
20
|
+
source: trim`
|
|
21
|
+
You are an expert chess player.
|
|
22
|
+
To analyze a game you can access the "pgn" property by loading the context object that represents the current game.
|
|
23
|
+
You could suggest a good next move or offer to play a move.
|
|
24
|
+
Don't actually make a move unless you are asked to.
|
|
25
|
+
`,
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const blueprint: Blueprint.Definition = {
|
|
30
|
+
key: BLUEPRINT_KEY,
|
|
31
|
+
make,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default blueprint;
|
|
@@ -6,20 +6,21 @@
|
|
|
6
6
|
// @ts-nocheck
|
|
7
7
|
|
|
8
8
|
import { Chess as ChessJS } from 'chess.js';
|
|
9
|
-
import
|
|
9
|
+
import * as Effect from 'effect/Effect';
|
|
10
|
+
import * as Schema from 'effect/Schema';
|
|
10
11
|
|
|
11
12
|
import { ToolResult, createTool } from '@dxos/ai';
|
|
12
|
-
import { Capabilities, type PromiseIntentDispatcher
|
|
13
|
+
import { Capabilities, Capability, type PromiseIntentDispatcher } from '@dxos/app-framework';
|
|
13
14
|
import { ArtifactId, VersionPin, createArtifactElement } from '@dxos/assistant';
|
|
14
|
-
import { defineArtifact } from '@dxos/
|
|
15
|
+
import { defineArtifact } from '@dxos/compute';
|
|
15
16
|
import { Obj } from '@dxos/echo';
|
|
16
17
|
import { invariant } from '@dxos/invariant';
|
|
17
|
-
import {
|
|
18
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
18
19
|
import { Filter, type Space } from '@dxos/react-client/echo';
|
|
19
20
|
import { trim } from '@dxos/util';
|
|
20
21
|
|
|
21
|
-
import { meta } from '
|
|
22
|
-
import { Chess
|
|
22
|
+
import { meta } from '#meta';
|
|
23
|
+
import { Chess } from '#types';
|
|
23
24
|
|
|
24
25
|
// TODO(burdon): Factor out.
|
|
25
26
|
declare global {
|
|
@@ -29,100 +30,106 @@ declare global {
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
export default () =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
export default Capability.makeModule(() =>
|
|
34
|
+
Effect.sync(() => {
|
|
35
|
+
const definition = defineArtifact({
|
|
36
|
+
id: `artifact:${meta.id}`,
|
|
37
|
+
name: meta.name,
|
|
38
|
+
description: 'Provides a simple chess engine.',
|
|
39
|
+
instructions: trim`
|
|
38
40
|
- If the user's message relates to a chess game, you must return the chess game inside the artifact tag as a valid FEN string with no additional text.
|
|
39
41
|
- Always inspect the chess game at the start of every prompt realting to a chess game, as it might have changed since the interaction.
|
|
40
42
|
`,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const intent = pipe(
|
|
54
|
-
createIntent(ChessAction.Create, { pgn }),
|
|
55
|
-
chain(SpaceAction.AddObject, { target: extensions.space }),
|
|
56
|
-
);
|
|
57
|
-
const { data, error } = await extensions.dispatch(intent);
|
|
58
|
-
if (!data || error) {
|
|
59
|
-
return ToolResult.Error(error?.message ?? 'Failed to create chess game');
|
|
60
|
-
}
|
|
43
|
+
schema: Chess.Game,
|
|
44
|
+
tools: [
|
|
45
|
+
createTool(meta.id, {
|
|
46
|
+
name: 'create',
|
|
47
|
+
description: 'Create a new chess game. Returns the artifact definition for the game.',
|
|
48
|
+
caption: 'Creating chess game...',
|
|
49
|
+
schema: Schema.Struct({
|
|
50
|
+
pgn: Schema.String.annotations({ description: 'The state of the chess game in the PGN format.' }),
|
|
51
|
+
}),
|
|
52
|
+
execute: async ({ pgn }, { extensions }) => {
|
|
53
|
+
invariant(extensions?.space, 'No space');
|
|
54
|
+
invariant(extensions?.invoke, 'No operation invoker');
|
|
61
55
|
|
|
62
|
-
|
|
63
|
-
VersionPin.createBlock(VersionPin.fromObject(data.object)),
|
|
64
|
-
]);
|
|
65
|
-
},
|
|
66
|
-
}),
|
|
67
|
-
createTool(meta.id, {
|
|
68
|
-
name: 'list',
|
|
69
|
-
description: 'Query all active chess games.',
|
|
70
|
-
caption: 'Getting games...',
|
|
71
|
-
schema: Schema.Struct({}),
|
|
72
|
-
execute: async (_, { extensions }) => {
|
|
73
|
-
invariant(extensions?.space, 'No space');
|
|
74
|
-
const { objects: games } = await extensions.space.db.query(Filter.type(Chess.Game)).run();
|
|
75
|
-
invariant(games.length > 0, 'No chess games found');
|
|
56
|
+
const game = Chess.make({ pgn });
|
|
76
57
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
schema: Schema.Struct({ id: ArtifactId }),
|
|
85
|
-
execute: async ({ id }, { extensions }) => {
|
|
86
|
-
invariant(extensions?.space, 'No space');
|
|
87
|
-
const game = await extensions.space.db
|
|
88
|
-
.query(Filter.ids(ArtifactId.toDXN(id, extensions.space.id).toString()))
|
|
89
|
-
.first();
|
|
90
|
-
invariant(Obj.instanceOf(Chess.Game, game));
|
|
58
|
+
const { data, error } = await extensions.invoke(SpaceOperation.AddObject, {
|
|
59
|
+
target: extensions.space,
|
|
60
|
+
object: game,
|
|
61
|
+
});
|
|
62
|
+
if (error) {
|
|
63
|
+
return ToolResult.Error(error?.message ?? 'Failed to add chess game to space');
|
|
64
|
+
}
|
|
91
65
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
name: 'move',
|
|
97
|
-
description: 'Make a move in the chess game.',
|
|
98
|
-
caption: 'Making chess move...',
|
|
99
|
-
schema: Schema.Struct({
|
|
100
|
-
id: ArtifactId,
|
|
101
|
-
move: Schema.String.annotations({
|
|
102
|
-
description: 'The move to make in the chess game.',
|
|
103
|
-
examples: ['e4', 'Bf3'],
|
|
104
|
-
}),
|
|
66
|
+
return ToolResult.Success(createArtifactElement(game.id), [
|
|
67
|
+
VersionPin.createBlock(VersionPin.fromObject(game)),
|
|
68
|
+
]);
|
|
69
|
+
},
|
|
105
70
|
}),
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
71
|
+
createTool(meta.id, {
|
|
72
|
+
name: 'list',
|
|
73
|
+
description: 'Query all active chess games.',
|
|
74
|
+
caption: 'Getting games...',
|
|
75
|
+
schema: Schema.Struct({}),
|
|
76
|
+
execute: async (_, { extensions }) => {
|
|
77
|
+
invariant(extensions?.space, 'No space');
|
|
78
|
+
const { objects: games } = await extensions.space.db.query(Filter.type(Chess.Game)).run();
|
|
79
|
+
invariant(games.length > 0, 'No chess games found');
|
|
112
80
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
81
|
+
return ToolResult.Success(games);
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
84
|
+
createTool(meta.id, {
|
|
85
|
+
name: 'inspect',
|
|
86
|
+
description: 'Get the current state of the chess game.',
|
|
87
|
+
caption: 'Inspecting game...',
|
|
88
|
+
schema: Schema.Struct({ id: ArtifactId }),
|
|
89
|
+
execute: async ({ id }, { extensions }) => {
|
|
90
|
+
invariant(extensions?.space, 'No space');
|
|
91
|
+
const game = await extensions.space.db
|
|
92
|
+
.query(Filter.id(ArtifactId.toDXN(id, extensions.space.id).toString()))
|
|
93
|
+
.first();
|
|
94
|
+
invariant(Obj.instanceOf(Chess.Game, game));
|
|
119
95
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
96
|
+
return ToolResult.Success(game.pgn);
|
|
97
|
+
},
|
|
98
|
+
}),
|
|
99
|
+
createTool(meta.id, {
|
|
100
|
+
name: 'move',
|
|
101
|
+
description: 'Make a move in the chess game.',
|
|
102
|
+
caption: 'Making chess move...',
|
|
103
|
+
schema: Schema.Struct({
|
|
104
|
+
id: ArtifactId,
|
|
105
|
+
move: Schema.String.annotations({
|
|
106
|
+
description: 'The move to make in the chess game.',
|
|
107
|
+
examples: ['e4', 'Bf3'],
|
|
108
|
+
}),
|
|
109
|
+
}),
|
|
110
|
+
execute: async ({ id, move }, { extensions }) => {
|
|
111
|
+
invariant(extensions?.space, 'No space');
|
|
112
|
+
const game = await extensions.space.db
|
|
113
|
+
.query(Filter.id(ArtifactId.toDXN(id, extensions.space.id).toString()))
|
|
114
|
+
.first();
|
|
115
|
+
invariant(Obj.instanceOf(Chess.Game, game));
|
|
116
|
+
|
|
117
|
+
const chess = new ChessJS(game.pgn);
|
|
118
|
+
try {
|
|
119
|
+
chess.move(move);
|
|
120
|
+
} catch (error: any) {
|
|
121
|
+
return ToolResult.Error(error.message);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
Obj.update(game, (game) => {
|
|
125
|
+
game.pgn = chess.pgn();
|
|
126
|
+
});
|
|
127
|
+
return ToolResult.Success(game.pgn);
|
|
128
|
+
},
|
|
129
|
+
}),
|
|
130
|
+
],
|
|
131
|
+
});
|
|
126
132
|
|
|
127
|
-
|
|
128
|
-
}
|
|
133
|
+
return Capability.contributes(Capabilities.ArtifactDefinition, definition);
|
|
134
|
+
}),
|
|
135
|
+
);
|