@dxos/plugin-chess 0.8.4-main.3c1ae3b → 0.8.4-main.3eb6e50203
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/ChessboardContainer-GNSIZKY7.mjs +80 -0
- package/dist/lib/browser/ChessboardContainer-GNSIZKY7.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-YUKJZPOL.mjs +19 -0
- package/dist/lib/browser/blueprint-definition-YUKJZPOL.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +11 -0
- package/dist/lib/browser/{chunk-CCF24VRU.mjs → chunk-66H3V2YV.mjs} +10 -29
- package/dist/lib/browser/chunk-66H3V2YV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DUO4WTAM.mjs → chunk-H3NUMCQ6.mjs} +1 -8
- package/dist/lib/browser/chunk-H3NUMCQ6.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-MABHE5SS.mjs +277 -0
- package/dist/lib/browser/chunk-MABHE5SS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WYPR77TX.mjs → chunk-PBRN5Q4R.mjs} +105 -50
- package/dist/lib/browser/chunk-PBRN5Q4R.mjs.map +7 -0
- package/dist/lib/browser/{chunk-Q5TZCIH7.mjs → chunk-QGVMZ4PK.mjs} +2 -2
- package/dist/lib/browser/cli/index.mjs +29 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +45 -69
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-C52R6BRL.mjs +38 -0
- package/dist/lib/browser/react-surface-C52R6BRL.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -5
- package/dist/lib/node-esm/ChessboardContainer-5OVYZMIW.mjs +81 -0
- package/dist/lib/node-esm/ChessboardContainer-5OVYZMIW.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-4HZ2HWWC.mjs +20 -0
- package/dist/lib/node-esm/blueprint-definition-4HZ2HWWC.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +12 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NU4GSP5Y.mjs → chunk-3MAU6WHB.mjs} +105 -50
- package/dist/lib/node-esm/chunk-3MAU6WHB.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-KNOOJFIR.mjs → chunk-F5OMIM4F.mjs} +1 -7
- package/dist/lib/node-esm/chunk-F5OMIM4F.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-VVXTAVIS.mjs → chunk-IFK6UAKF.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-QKXLEJNZ.mjs → chunk-OUNGNJFP.mjs} +10 -29
- package/dist/lib/node-esm/chunk-OUNGNJFP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-V6MKXXPO.mjs +278 -0
- package/dist/lib/node-esm/chunk-V6MKXXPO.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +30 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +45 -69
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-NW33JZ6J.mjs +39 -0
- package/dist/lib/node-esm/react-surface-NW33JZ6J.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +3 -5
- package/dist/types/src/ChessPlugin.d.ts +2 -1
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/chess-blueprint.d.ts +21 -0
- package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -0
- package/dist/types/src/{functions → blueprints/functions}/create.d.ts +7 -6
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/{functions → blueprints/functions}/index.d.ts +1 -0
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/move.d.ts +16 -0
- package/dist/types/src/blueprints/functions/move.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/play.d.ts +17 -0
- package/dist/types/src/blueprints/functions/play.d.ts.map +1 -0
- package/dist/types/src/{functions/move.d.ts → blueprints/functions/print.d.ts} +4 -4
- package/dist/types/src/blueprints/functions/print.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/artifact-definition.d.ts +12 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +10 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +1 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/Card.stories.d.ts +1 -8
- package/dist/types/src/components/Card.stories.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard.d.ts +2 -1
- package/dist/types/src/components/Chessboard.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard.stories.d.ts +6 -6
- package/dist/types/src/components/Chessboard.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChessboardArticle.d.ts +3 -4
- package/dist/types/src/components/ChessboardArticle.d.ts.map +1 -1
- package/dist/types/src/components/ChessboardContainer.d.ts +3 -5
- package/dist/types/src/components/ChessboardContainer.d.ts.map +1 -1
- package/dist/types/src/components/Info.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- 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/types/Chess.d.ts +16 -16
- 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 +58 -42
- package/src/ChessPlugin.tsx +26 -46
- package/src/blueprints/chess-blueprint.ts +28 -0
- package/src/{functions → blueprints/functions}/create.ts +8 -3
- package/src/{functions → blueprints/functions}/index.ts +1 -0
- package/src/{functions → blueprints/functions}/move.ts +10 -8
- package/src/{functions → blueprints/functions}/play.ts +10 -8
- package/src/blueprints/functions/print.ts +42 -0
- package/src/blueprints/index.ts +6 -0
- package/src/capabilities/artifact-definition/artifact-definition.ts +135 -0
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +24 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +1 -6
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +28 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +27 -0
- package/src/components/Card.stories.tsx +19 -38
- package/src/components/Chessboard.stories.tsx +16 -12
- package/src/components/Chessboard.tsx +26 -13
- package/src/components/ChessboardArticle.tsx +8 -6
- package/src/components/ChessboardContainer.tsx +9 -13
- package/src/components/Info.tsx +21 -11
- package/src/index.ts +1 -1
- package/src/meta.ts +2 -2
- package/src/types/Chess.ts +4 -4
- package/src/types/index.ts +0 -1
- package/dist/lib/browser/ChessboardContainer-5YXEM4VR.mjs +0 -96
- package/dist/lib/browser/ChessboardContainer-5YXEM4VR.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-EAL54B6V.mjs +0 -11
- package/dist/lib/browser/chunk-5DOZV3PW.mjs +0 -294
- package/dist/lib/browser/chunk-5DOZV3PW.mjs.map +0 -7
- package/dist/lib/browser/chunk-CCF24VRU.mjs.map +0 -7
- package/dist/lib/browser/chunk-DUO4WTAM.mjs.map +0 -7
- package/dist/lib/browser/chunk-WYPR77TX.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-KPGHK5JU.mjs +0 -25
- package/dist/lib/browser/intent-resolver-KPGHK5JU.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3YST34QI.mjs +0 -38
- package/dist/lib/browser/react-surface-3YST34QI.mjs.map +0 -7
- package/dist/lib/node-esm/ChessboardContainer-7OQ6TOKB.mjs +0 -97
- package/dist/lib/node-esm/ChessboardContainer-7OQ6TOKB.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-2LWD6BR3.mjs +0 -12
- package/dist/lib/node-esm/chunk-F4C2HVZL.mjs +0 -295
- package/dist/lib/node-esm/chunk-F4C2HVZL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KNOOJFIR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NU4GSP5Y.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QKXLEJNZ.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-ZAELGF7I.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-ZAELGF7I.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-KV2KBSIU.mjs +0 -39
- package/dist/lib/node-esm/react-surface-KV2KBSIU.mjs.map +0 -7
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- 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/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/functions/create.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts.map +0 -1
- 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/artifact-definition.ts +0 -129
- package/src/capabilities/blueprint-definition.ts +0 -36
- package/src/capabilities/intent-resolver.ts +0 -22
- package/src/capabilities/react-surface.tsx +0 -23
- package/src/types/ChessAction.ts +0 -19
- /package/dist/lib/browser/{blueprint-definition-EAL54B6V.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-2LWD6BR3.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-Q5TZCIH7.mjs.map → chunk-QGVMZ4PK.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-VVXTAVIS.mjs.map → chunk-IFK6UAKF.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-chess",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.3eb6e50203",
|
|
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,
|
|
@@ -15,17 +19,23 @@
|
|
|
15
19
|
"browser": "./dist/lib/browser/index.mjs",
|
|
16
20
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
17
21
|
},
|
|
22
|
+
"./blueprints": {
|
|
23
|
+
"source": "./src/blueprints/index.ts",
|
|
24
|
+
"types": "./dist/types/src/blueprints/index.d.ts",
|
|
25
|
+
"browser": "./dist/lib/browser/blueprints/index.mjs",
|
|
26
|
+
"node": "./dist/lib/node-esm/blueprints/index.mjs"
|
|
27
|
+
},
|
|
28
|
+
"./cli": {
|
|
29
|
+
"source": "./src/cli/index.ts",
|
|
30
|
+
"types": "./dist/types/src/cli/index.d.ts",
|
|
31
|
+
"browser": "./dist/lib/browser/cli/index.mjs",
|
|
32
|
+
"node": "./dist/lib/node-esm/cli/index.mjs"
|
|
33
|
+
},
|
|
18
34
|
"./types": {
|
|
19
35
|
"source": "./src/types/index.ts",
|
|
20
36
|
"types": "./dist/types/src/types/index.d.ts",
|
|
21
37
|
"browser": "./dist/lib/browser/types/index.mjs",
|
|
22
38
|
"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
39
|
}
|
|
30
40
|
},
|
|
31
41
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -41,47 +51,53 @@
|
|
|
41
51
|
"src"
|
|
42
52
|
],
|
|
43
53
|
"dependencies": {
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
54
|
+
"@automerge/automerge": "3.2.3",
|
|
55
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
46
56
|
"chess.js": "^1.0.0",
|
|
47
|
-
"effect": "3.
|
|
48
|
-
"@dxos/ai": "0.8.4-main.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/react-
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
57
|
+
"effect": "3.19.16",
|
|
58
|
+
"@dxos/ai": "0.8.4-main.3eb6e50203",
|
|
59
|
+
"@dxos/app-framework": "0.8.4-main.3eb6e50203",
|
|
60
|
+
"@dxos/app-toolkit": "0.8.4-main.3eb6e50203",
|
|
61
|
+
"@dxos/assistant": "0.8.4-main.3eb6e50203",
|
|
62
|
+
"@dxos/async": "0.8.4-main.3eb6e50203",
|
|
63
|
+
"@dxos/blueprints": "0.8.4-main.3eb6e50203",
|
|
64
|
+
"@dxos/display-name": "0.8.4-main.3eb6e50203",
|
|
65
|
+
"@dxos/echo-db": "0.8.4-main.3eb6e50203",
|
|
66
|
+
"@dxos/echo-react": "0.8.4-main.3eb6e50203",
|
|
67
|
+
"@dxos/functions": "0.8.4-main.3eb6e50203",
|
|
68
|
+
"@dxos/echo": "0.8.4-main.3eb6e50203",
|
|
69
|
+
"@dxos/invariant": "0.8.4-main.3eb6e50203",
|
|
70
|
+
"@dxos/log": "0.8.4-main.3eb6e50203",
|
|
71
|
+
"@dxos/operation": "0.8.4-main.3eb6e50203",
|
|
72
|
+
"@dxos/plugin-client": "0.8.4-main.3eb6e50203",
|
|
73
|
+
"@dxos/plugin-graph": "0.8.4-main.3eb6e50203",
|
|
74
|
+
"@dxos/plugin-markdown": "0.8.4-main.3eb6e50203",
|
|
75
|
+
"@dxos/react-client": "0.8.4-main.3eb6e50203",
|
|
76
|
+
"@dxos/plugin-space": "0.8.4-main.3eb6e50203",
|
|
77
|
+
"@dxos/react-ui-gameboard": "0.8.4-main.3eb6e50203",
|
|
78
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.3eb6e50203",
|
|
79
|
+
"@dxos/react-ui-sfx": "0.8.4-main.3eb6e50203",
|
|
80
|
+
"@dxos/react-ui-stack": "0.8.4-main.3eb6e50203",
|
|
81
|
+
"@dxos/schema": "0.8.4-main.3eb6e50203",
|
|
82
|
+
"@dxos/types": "0.8.4-main.3eb6e50203",
|
|
83
|
+
"@dxos/util": "0.8.4-main.3eb6e50203"
|
|
68
84
|
},
|
|
69
85
|
"devDependencies": {
|
|
70
|
-
"@types/react": "~19.2.
|
|
71
|
-
"@types/react-dom": "~19.2.
|
|
72
|
-
"react": "~19.2.
|
|
73
|
-
"react-dom": "~19.2.
|
|
86
|
+
"@types/react": "~19.2.7",
|
|
87
|
+
"@types/react-dom": "~19.2.3",
|
|
88
|
+
"react": "~19.2.3",
|
|
89
|
+
"react-dom": "~19.2.3",
|
|
74
90
|
"vite": "7.1.9",
|
|
75
|
-
"@dxos/plugin-theme": "0.8.4-main.
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
91
|
+
"@dxos/plugin-theme": "0.8.4-main.3eb6e50203",
|
|
92
|
+
"@dxos/storybook-utils": "0.8.4-main.3eb6e50203",
|
|
93
|
+
"@dxos/ui-theme": "0.8.4-main.3eb6e50203",
|
|
94
|
+
"@dxos/react-ui": "0.8.4-main.3eb6e50203"
|
|
79
95
|
},
|
|
80
96
|
"peerDependencies": {
|
|
81
|
-
"react": "
|
|
82
|
-
"react-dom": "
|
|
83
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
84
|
-
"@dxos/
|
|
97
|
+
"react": "~19.2.3",
|
|
98
|
+
"react-dom": "~19.2.3",
|
|
99
|
+
"@dxos/react-ui": "0.8.4-main.3eb6e50203",
|
|
100
|
+
"@dxos/ui-theme": "0.8.4-main.3eb6e50203"
|
|
85
101
|
},
|
|
86
102
|
"publishConfig": {
|
|
87
103
|
"access": "public"
|
package/src/ChessPlugin.tsx
CHANGED
|
@@ -2,54 +2,34 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
7
|
-
import { type CreateObjectIntent } from '@dxos/plugin-space/types';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
8
6
|
|
|
9
|
-
import {
|
|
7
|
+
import { Plugin } from '@dxos/app-framework';
|
|
8
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
9
|
+
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
10
|
+
|
|
11
|
+
import { ChessBlueprint } from './blueprints';
|
|
12
|
+
import { BlueprintDefinition, ReactSurface } from './capabilities';
|
|
10
13
|
import { meta } from './meta';
|
|
11
14
|
import { translations } from './translations';
|
|
12
|
-
import { Chess
|
|
15
|
+
import { Chess } from './types';
|
|
13
16
|
|
|
14
|
-
export const ChessPlugin =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
icon: 'ph--shield-chevron--regular',
|
|
28
|
-
iconHue: 'amber',
|
|
29
|
-
blueprints: [CHESS_BLUEPRINT_KEY],
|
|
30
|
-
createObjectIntent: (() => createIntent(ChessAction.Create)) satisfies CreateObjectIntent,
|
|
31
|
-
addToCollectionOnCreate: true,
|
|
32
|
-
},
|
|
33
|
-
}),
|
|
34
|
-
}),
|
|
35
|
-
defineModule({
|
|
36
|
-
id: `${meta.id}/module/schema`,
|
|
37
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
38
|
-
activate: () => contributes(ClientCapabilities.Schema, [Chess.Game]),
|
|
39
|
-
}),
|
|
40
|
-
defineModule({
|
|
41
|
-
id: `${meta.id}/module/react-surface`,
|
|
42
|
-
activatesOn: Events.SetupReactSurface,
|
|
43
|
-
activate: ReactSurface,
|
|
44
|
-
}),
|
|
45
|
-
defineModule({
|
|
46
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
47
|
-
activatesOn: Events.SetupIntentResolver,
|
|
48
|
-
activate: IntentResolver,
|
|
49
|
-
}),
|
|
50
|
-
defineModule({
|
|
51
|
-
id: `${meta.id}/module/blueprint`,
|
|
52
|
-
activatesOn: Events.SetupArtifactDefinition,
|
|
53
|
-
activate: BlueprintDefinition,
|
|
17
|
+
export const ChessPlugin = Plugin.define(meta).pipe(
|
|
18
|
+
AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),
|
|
19
|
+
AppPlugin.addMetadataModule({
|
|
20
|
+
metadata: {
|
|
21
|
+
id: Chess.Game.typename,
|
|
22
|
+
metadata: {
|
|
23
|
+
icon: 'ph--shield-chevron--regular',
|
|
24
|
+
iconHue: 'amber',
|
|
25
|
+
blueprints: [ChessBlueprint.Key],
|
|
26
|
+
createObject: ((props) => Effect.sync(() => Chess.make(props))) satisfies CreateObject,
|
|
27
|
+
addToCollectionOnCreate: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
54
30
|
}),
|
|
55
|
-
])
|
|
31
|
+
AppPlugin.addSchemaModule({ schema: [Chess.Game] }),
|
|
32
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
33
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
34
|
+
Plugin.make,
|
|
35
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Blueprint, Template } from '@dxos/blueprints';
|
|
6
|
+
import { type FunctionDefinition } from '@dxos/functions';
|
|
7
|
+
import { trim } from '@dxos/util';
|
|
8
|
+
|
|
9
|
+
import { create, move, play, print } from './functions';
|
|
10
|
+
|
|
11
|
+
export const Key = 'dxos.org/blueprint/chess';
|
|
12
|
+
|
|
13
|
+
export const functions: FunctionDefinition[] = [create, move, play, print];
|
|
14
|
+
|
|
15
|
+
export const make = () =>
|
|
16
|
+
Blueprint.make({
|
|
17
|
+
key: Key,
|
|
18
|
+
name: 'Chess',
|
|
19
|
+
tools: Blueprint.toolDefinitions({ functions }),
|
|
20
|
+
instructions: Template.make({
|
|
21
|
+
source: trim`
|
|
22
|
+
You are an expert chess player.
|
|
23
|
+
To analyze a game you can access the "pgn" property by loading the context object that represents the current game.
|
|
24
|
+
You could suggest a good next move or offer to play a move.
|
|
25
|
+
Don't actually make a move unless you are asked to.
|
|
26
|
+
`,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
@@ -8,13 +8,18 @@ import * as Schema from 'effect/Schema';
|
|
|
8
8
|
import { Database } from '@dxos/echo';
|
|
9
9
|
import { defineFunction } from '@dxos/functions';
|
|
10
10
|
|
|
11
|
-
import { Chess } from '
|
|
11
|
+
import { Chess } from '../../types';
|
|
12
12
|
|
|
13
13
|
export default defineFunction({
|
|
14
14
|
key: 'dxos.org/function/chess/create',
|
|
15
15
|
name: 'Create Chess',
|
|
16
16
|
description: 'Creates a new chess game.',
|
|
17
17
|
inputSchema: Schema.Struct({
|
|
18
|
+
name: Schema.optional(
|
|
19
|
+
Schema.String.annotations({
|
|
20
|
+
description: 'Name of the game.',
|
|
21
|
+
}),
|
|
22
|
+
),
|
|
18
23
|
pgn: Schema.optional(
|
|
19
24
|
Schema.String.annotations({
|
|
20
25
|
description: 'Portable Game Notation.',
|
|
@@ -27,7 +32,7 @@ export default defineFunction({
|
|
|
27
32
|
),
|
|
28
33
|
}),
|
|
29
34
|
outputSchema: Chess.Game,
|
|
30
|
-
handler: Effect.fn(function* ({ data: { pgn, fen } }) {
|
|
31
|
-
return yield* Database.
|
|
35
|
+
handler: Effect.fn(function* ({ data: { name, pgn, fen } }) {
|
|
36
|
+
return yield* Database.add(Chess.make({ name, pgn, fen }));
|
|
32
37
|
}),
|
|
33
38
|
});
|
|
@@ -6,18 +6,17 @@ import { Chess as ChessJS } from 'chess.js';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import * as Schema from 'effect/Schema';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import { Database } from '@dxos/echo';
|
|
9
|
+
import { Database, Obj, Type } from '@dxos/echo';
|
|
11
10
|
import { defineFunction } from '@dxos/functions';
|
|
12
11
|
|
|
13
|
-
import { Chess } from '
|
|
12
|
+
import { Chess } from '../../types';
|
|
14
13
|
|
|
15
14
|
export default defineFunction({
|
|
16
15
|
key: 'dxos.org/function/chess/move',
|
|
17
16
|
name: 'Move',
|
|
18
17
|
description: 'Makes a move in the given chess game.',
|
|
19
18
|
inputSchema: Schema.Struct({
|
|
20
|
-
|
|
19
|
+
game: Type.Ref(Chess.Game).annotations({
|
|
21
20
|
description: 'The ID of the chess object.',
|
|
22
21
|
}),
|
|
23
22
|
move: Schema.String.annotations({
|
|
@@ -30,8 +29,8 @@ export default defineFunction({
|
|
|
30
29
|
description: 'The PGN of the game after the move was played.',
|
|
31
30
|
}),
|
|
32
31
|
}),
|
|
33
|
-
handler: Effect.fn(function* ({ data: {
|
|
34
|
-
const object = yield* Database.
|
|
32
|
+
handler: Effect.fn(function* ({ data: { game, move } }) {
|
|
33
|
+
const object = yield* Database.load(game);
|
|
35
34
|
const chess = new ChessJS();
|
|
36
35
|
if (object.pgn) {
|
|
37
36
|
chess.loadPgn(object.pgn);
|
|
@@ -40,7 +39,10 @@ export default defineFunction({
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
chess.move(move, { strict: false });
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
const pgn = chess.pgn();
|
|
43
|
+
Obj.change(object, (o) => {
|
|
44
|
+
o.pgn = pgn;
|
|
45
|
+
});
|
|
46
|
+
return { pgn };
|
|
45
47
|
}),
|
|
46
48
|
});
|
|
@@ -6,18 +6,17 @@ import { Chess as ChessJS } from 'chess.js';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import * as Schema from 'effect/Schema';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import { Database } from '@dxos/echo';
|
|
9
|
+
import { Database, Obj, Type } from '@dxos/echo';
|
|
11
10
|
import { defineFunction } from '@dxos/functions';
|
|
12
11
|
|
|
13
|
-
import { Chess } from '
|
|
12
|
+
import { Chess } from '../../types';
|
|
14
13
|
|
|
15
14
|
export default defineFunction({
|
|
16
15
|
key: 'dxos.org/function/chess/play',
|
|
17
16
|
name: 'Play',
|
|
18
17
|
description: 'Uses the chess engine to play the next move.',
|
|
19
18
|
inputSchema: Schema.Struct({
|
|
20
|
-
|
|
19
|
+
game: Type.Ref(Chess.Game).annotations({
|
|
21
20
|
description: 'The ID of the chess object.',
|
|
22
21
|
}),
|
|
23
22
|
side: Schema.optional(Schema.Literal('white', 'black', 'any')).annotations({
|
|
@@ -33,8 +32,8 @@ export default defineFunction({
|
|
|
33
32
|
description: 'The move that was played.',
|
|
34
33
|
}),
|
|
35
34
|
}),
|
|
36
|
-
handler: Effect.fn(function* ({ data: {
|
|
37
|
-
const object = yield* Database.
|
|
35
|
+
handler: Effect.fn(function* ({ data: { game, side = 'any' } }) {
|
|
36
|
+
const object = yield* Database.load(game);
|
|
38
37
|
const chess = new ChessJS();
|
|
39
38
|
if (object.pgn) {
|
|
40
39
|
chess.loadPgn(object.pgn);
|
|
@@ -50,7 +49,10 @@ export default defineFunction({
|
|
|
50
49
|
const move = moves[Math.floor(Math.random() * moves.length)];
|
|
51
50
|
|
|
52
51
|
chess.move(move, { strict: false });
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
const pgn = chess.pgn();
|
|
53
|
+
Obj.change(object, (o) => {
|
|
54
|
+
o.pgn = pgn;
|
|
55
|
+
});
|
|
56
|
+
return { move, pgn };
|
|
55
57
|
}),
|
|
56
58
|
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Chess as ChessJS } from 'chess.js';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { defineFunction } from '@dxos/functions';
|
|
10
|
+
|
|
11
|
+
export default defineFunction({
|
|
12
|
+
key: 'dxos.org/function/chess/print',
|
|
13
|
+
name: 'Print game',
|
|
14
|
+
description: 'Prints the chess game to ASCII.',
|
|
15
|
+
inputSchema: Schema.Struct({
|
|
16
|
+
pgn: Schema.optional(
|
|
17
|
+
Schema.String.annotations({
|
|
18
|
+
description: 'Portable Game Notation.',
|
|
19
|
+
}),
|
|
20
|
+
),
|
|
21
|
+
fen: Schema.optional(
|
|
22
|
+
Schema.String.annotations({
|
|
23
|
+
description: 'Forsyth-Edwards Notation.',
|
|
24
|
+
}),
|
|
25
|
+
),
|
|
26
|
+
}),
|
|
27
|
+
outputSchema: Schema.Struct({
|
|
28
|
+
ascii: Schema.String,
|
|
29
|
+
}),
|
|
30
|
+
handler: Effect.fn(function* ({ data: { pgn, fen } }) {
|
|
31
|
+
try {
|
|
32
|
+
const chess = new ChessJS(fen);
|
|
33
|
+
if (pgn) {
|
|
34
|
+
chess.loadPgn(pgn);
|
|
35
|
+
}
|
|
36
|
+
return { ascii: chess.ascii() };
|
|
37
|
+
} catch {
|
|
38
|
+
// TODO(burdon): Error handling?
|
|
39
|
+
return { ascii: '' };
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// ISSUE(burdon): defineArtifact
|
|
6
|
+
// @ts-nocheck
|
|
7
|
+
|
|
8
|
+
import { Chess as ChessJS } from 'chess.js';
|
|
9
|
+
import * as Effect from 'effect/Effect';
|
|
10
|
+
import * as Schema from 'effect/Schema';
|
|
11
|
+
|
|
12
|
+
import { ToolResult, createTool } from '@dxos/ai';
|
|
13
|
+
import { Capabilities, Capability, type PromiseIntentDispatcher } from '@dxos/app-framework';
|
|
14
|
+
import { ArtifactId, VersionPin, createArtifactElement } from '@dxos/assistant';
|
|
15
|
+
import { defineArtifact } from '@dxos/blueprints';
|
|
16
|
+
import { Obj } from '@dxos/echo';
|
|
17
|
+
import { invariant } from '@dxos/invariant';
|
|
18
|
+
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
19
|
+
import { Filter, type Space } from '@dxos/react-client/echo';
|
|
20
|
+
import { trim } from '@dxos/util';
|
|
21
|
+
|
|
22
|
+
import { meta } from '../../meta';
|
|
23
|
+
import { Chess } from '../../types';
|
|
24
|
+
|
|
25
|
+
// TODO(burdon): Factor out.
|
|
26
|
+
declare global {
|
|
27
|
+
interface ToolContextExtensions {
|
|
28
|
+
space?: Space;
|
|
29
|
+
dispatch?: PromiseIntentDispatcher;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
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`
|
|
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.
|
|
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.
|
|
42
|
+
`,
|
|
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');
|
|
55
|
+
|
|
56
|
+
const game = Chess.make({ pgn });
|
|
57
|
+
|
|
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
|
+
}
|
|
65
|
+
|
|
66
|
+
return ToolResult.Success(createArtifactElement(game.id), [
|
|
67
|
+
VersionPin.createBlock(VersionPin.fromObject(game)),
|
|
68
|
+
]);
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
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');
|
|
80
|
+
|
|
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));
|
|
95
|
+
|
|
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.change(game, (g) => {
|
|
125
|
+
g.pgn = chess.pgn();
|
|
126
|
+
});
|
|
127
|
+
return ToolResult.Success(game.pgn);
|
|
128
|
+
},
|
|
129
|
+
}),
|
|
130
|
+
],
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
return Capability.contributes(Capabilities.ArtifactDefinition, definition);
|
|
134
|
+
}),
|
|
135
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
|
|
10
|
+
import { ChessBlueprint } from '../../blueprints';
|
|
11
|
+
|
|
12
|
+
export type BlueprintCapabilities = [
|
|
13
|
+
Capability.Capability<typeof AppCapabilities.Functions>,
|
|
14
|
+
Capability.Capability<typeof AppCapabilities.BlueprintDefinition>,
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
const blueprintDefinition = Capability.makeModule<[], BlueprintCapabilities>(() =>
|
|
18
|
+
Effect.succeed([
|
|
19
|
+
Capability.contributes(AppCapabilities.Functions, ChessBlueprint.functions),
|
|
20
|
+
Capability.contributes(AppCapabilities.BlueprintDefinition, ChessBlueprint.make()),
|
|
21
|
+
]),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export default blueprintDefinition;
|
|
@@ -2,10 +2,5 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
export const BlueprintDefinition = lazy(() => import('./blueprint-definition'));
|
|
8
|
-
export const IntentResolver = lazy(() => import('./intent-resolver'));
|
|
9
|
-
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
10
|
-
|
|
11
5
|
export * from './blueprint-definition';
|
|
6
|
+
export * from './react-surface';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
|
|
12
|
+
import { ChessboardContainer } from '../../components';
|
|
13
|
+
import { meta } from '../../meta';
|
|
14
|
+
import { Chess } from '../../types';
|
|
15
|
+
|
|
16
|
+
export default Capability.makeModule(() =>
|
|
17
|
+
Effect.succeed(
|
|
18
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
19
|
+
Surface.create({
|
|
20
|
+
id: meta.id,
|
|
21
|
+
role: ['article', 'section', 'card--content'],
|
|
22
|
+
// TODO(burdon): Could this be standardized so that we don't require a subject property.
|
|
23
|
+
filter: (data): data is { subject: Chess.Game } => Obj.instanceOf(Chess.Game, data.subject),
|
|
24
|
+
component: ({ data, role }) => <ChessboardContainer role={role} subject={data.subject} />,
|
|
25
|
+
}),
|
|
26
|
+
]),
|
|
27
|
+
),
|
|
28
|
+
);
|