@dxos/plugin-chess 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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-JZ4ANG4O.mjs +81 -0
- package/dist/lib/browser/ChessboardContainer-JZ4ANG4O.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-P7TYXWMF.mjs +18 -0
- package/dist/lib/browser/blueprint-definition-P7TYXWMF.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +11 -0
- package/dist/lib/browser/{chunk-FBLAVAMY.mjs → chunk-66H3V2YV.mjs} +15 -35
- package/dist/lib/browser/chunk-66H3V2YV.mjs.map +7 -0
- package/dist/lib/browser/chunk-73BDP7UV.mjs +275 -0
- package/dist/lib/browser/chunk-73BDP7UV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TIIGNOGK.mjs → chunk-FO4ZNFN6.mjs} +105 -45
- package/dist/lib/browser/chunk-FO4ZNFN6.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-WLXUZMHC.mjs → chunk-OW6S2SRG.mjs} +2 -2
- package/dist/lib/browser/cli/index.mjs +28 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +46 -71
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-VNOWFKC6.mjs +37 -0
- package/dist/lib/browser/react-surface-VNOWFKC6.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -5
- package/dist/lib/node-esm/ChessboardContainer-7ONFYN7L.mjs +82 -0
- package/dist/lib/node-esm/ChessboardContainer-7ONFYN7L.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-SL4LBVV5.mjs +19 -0
- package/dist/lib/node-esm/blueprint-definition-SL4LBVV5.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-FKRBFLJC.mjs → chunk-24GJHLHM.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-RTCAAOLF.mjs → chunk-C7IWIXCJ.mjs} +105 -45
- package/dist/lib/node-esm/chunk-C7IWIXCJ.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-MP3A3AGA.mjs → chunk-OUNGNJFP.mjs} +15 -35
- package/dist/lib/node-esm/chunk-OUNGNJFP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WXEPWOHT.mjs +276 -0
- package/dist/lib/node-esm/chunk-WXEPWOHT.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +29 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +46 -71
- 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-4PRNWQ2V.mjs → react-surface-HSHCIOAS.mjs} +15 -16
- package/dist/lib/node-esm/react-surface-HSHCIOAS.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/blueprints/functions/create.d.ts +15 -0
- 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/{functions → blueprints/functions}/move.d.ts +1 -1
- package/dist/types/src/blueprints/functions/move.d.ts.map +1 -0
- package/dist/types/src/{functions → blueprints/functions}/play.d.ts +1 -1
- package/dist/types/src/blueprints/functions/play.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/print.d.ts +8 -0
- 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 +9 -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 -4
- 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/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts +18 -18
- 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 +57 -42
- package/src/ChessPlugin.tsx +25 -52
- package/src/blueprints/chess-blueprint.ts +28 -0
- package/src/{functions → blueprints/functions}/create.ts +10 -4
- package/src/{functions → blueprints/functions}/index.ts +1 -0
- package/src/{functions → blueprints/functions}/move.ts +9 -5
- package/src/{functions → blueprints/functions}/play.ts +9 -5
- 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 +23 -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 +27 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +26 -0
- package/src/components/Card.stories.tsx +18 -37
- package/src/components/Chessboard.stories.tsx +15 -11
- package/src/components/Chessboard.tsx +21 -10
- package/src/components/ChessboardArticle.tsx +13 -11
- package/src/components/ChessboardContainer.tsx +9 -13
- package/src/components/Info.tsx +19 -11
- package/src/index.ts +1 -1
- package/src/meta.ts +2 -2
- package/src/translations.ts +1 -0
- package/src/types/Chess.ts +7 -9
- package/src/types/index.ts +0 -1
- package/dist/lib/browser/ChessboardContainer-SZMONNHG.mjs +0 -96
- package/dist/lib/browser/ChessboardContainer-SZMONNHG.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-FD4TL5EE.mjs +0 -11
- package/dist/lib/browser/chunk-DUO4WTAM.mjs.map +0 -7
- package/dist/lib/browser/chunk-FBLAVAMY.mjs.map +0 -7
- package/dist/lib/browser/chunk-R6KK3WAS.mjs +0 -294
- package/dist/lib/browser/chunk-R6KK3WAS.mjs.map +0 -7
- package/dist/lib/browser/chunk-TIIGNOGK.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-GXZN2EBT.mjs +0 -25
- package/dist/lib/browser/intent-resolver-GXZN2EBT.mjs.map +0 -7
- package/dist/lib/browser/react-surface-EVJLBV6U.mjs +0 -38
- package/dist/lib/browser/react-surface-EVJLBV6U.mjs.map +0 -7
- package/dist/lib/node-esm/ChessboardContainer-GAIIADOA.mjs +0 -97
- package/dist/lib/node-esm/ChessboardContainer-GAIIADOA.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-O7ZM3HUF.mjs +0 -12
- package/dist/lib/node-esm/chunk-IVEIH4ER.mjs +0 -295
- package/dist/lib/node-esm/chunk-IVEIH4ER.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KNOOJFIR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MP3A3AGA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RTCAAOLF.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-HK5L6P6Z.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-HK5L6P6Z.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-4PRNWQ2V.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 +0 -14
- 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.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-FD4TL5EE.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-O7ZM3HUF.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-WLXUZMHC.mjs.map → chunk-OW6S2SRG.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-FKRBFLJC.mjs.map → chunk-24GJHLHM.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.bc674ce",
|
|
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,52 @@
|
|
|
41
51
|
"src"
|
|
42
52
|
],
|
|
43
53
|
"dependencies": {
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
54
|
+
"@automerge/automerge": "3.2.3",
|
|
55
|
+
"@effect-atom/atom-react": "^0.4.6",
|
|
46
56
|
"chess.js": "^1.0.0",
|
|
47
|
-
"effect": "3.
|
|
48
|
-
"@dxos/ai": "0.8.4-main.
|
|
49
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/display-name": "0.8.4-main.
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/invariant": "0.8.4-main.
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/plugin-
|
|
64
|
-
"@dxos/react-
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
57
|
+
"effect": "3.19.11",
|
|
58
|
+
"@dxos/ai": "0.8.4-main.bc674ce",
|
|
59
|
+
"@dxos/app-framework": "0.8.4-main.bc674ce",
|
|
60
|
+
"@dxos/async": "0.8.4-main.bc674ce",
|
|
61
|
+
"@dxos/display-name": "0.8.4-main.bc674ce",
|
|
62
|
+
"@dxos/assistant": "0.8.4-main.bc674ce",
|
|
63
|
+
"@dxos/echo-db": "0.8.4-main.bc674ce",
|
|
64
|
+
"@dxos/echo": "0.8.4-main.bc674ce",
|
|
65
|
+
"@dxos/echo-react": "0.8.4-main.bc674ce",
|
|
66
|
+
"@dxos/invariant": "0.8.4-main.bc674ce",
|
|
67
|
+
"@dxos/blueprints": "0.8.4-main.bc674ce",
|
|
68
|
+
"@dxos/functions": "0.8.4-main.bc674ce",
|
|
69
|
+
"@dxos/log": "0.8.4-main.bc674ce",
|
|
70
|
+
"@dxos/plugin-client": "0.8.4-main.bc674ce",
|
|
71
|
+
"@dxos/operation": "0.8.4-main.bc674ce",
|
|
72
|
+
"@dxos/plugin-markdown": "0.8.4-main.bc674ce",
|
|
73
|
+
"@dxos/plugin-graph": "0.8.4-main.bc674ce",
|
|
74
|
+
"@dxos/react-client": "0.8.4-main.bc674ce",
|
|
75
|
+
"@dxos/plugin-space": "0.8.4-main.bc674ce",
|
|
76
|
+
"@dxos/react-ui-gameboard": "0.8.4-main.bc674ce",
|
|
77
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.bc674ce",
|
|
78
|
+
"@dxos/react-ui-sfx": "0.8.4-main.bc674ce",
|
|
79
|
+
"@dxos/react-ui-stack": "0.8.4-main.bc674ce",
|
|
80
|
+
"@dxos/schema": "0.8.4-main.bc674ce",
|
|
81
|
+
"@dxos/util": "0.8.4-main.bc674ce",
|
|
82
|
+
"@dxos/types": "0.8.4-main.bc674ce"
|
|
68
83
|
},
|
|
69
84
|
"devDependencies": {
|
|
70
|
-
"@types/react": "~19.2.
|
|
71
|
-
"@types/react-dom": "~19.2.
|
|
72
|
-
"react": "~19.2.
|
|
73
|
-
"react-dom": "~19.2.
|
|
85
|
+
"@types/react": "~19.2.7",
|
|
86
|
+
"@types/react-dom": "~19.2.3",
|
|
87
|
+
"react": "~19.2.3",
|
|
88
|
+
"react-dom": "~19.2.3",
|
|
74
89
|
"vite": "7.1.9",
|
|
75
|
-
"@dxos/plugin-theme": "0.8.4-main.
|
|
76
|
-
"@dxos/react-ui
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
90
|
+
"@dxos/plugin-theme": "0.8.4-main.bc674ce",
|
|
91
|
+
"@dxos/react-ui": "0.8.4-main.bc674ce",
|
|
92
|
+
"@dxos/storybook-utils": "0.8.4-main.bc674ce",
|
|
93
|
+
"@dxos/ui-theme": "0.8.4-main.bc674ce"
|
|
79
94
|
},
|
|
80
95
|
"peerDependencies": {
|
|
81
|
-
"react": "
|
|
82
|
-
"react-dom": "
|
|
83
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
84
|
-
"@dxos/
|
|
96
|
+
"react": "~19.2.3",
|
|
97
|
+
"react-dom": "~19.2.3",
|
|
98
|
+
"@dxos/react-ui": "0.8.4-main.bc674ce",
|
|
99
|
+
"@dxos/ui-theme": "0.8.4-main.bc674ce"
|
|
85
100
|
},
|
|
86
101
|
"publishConfig": {
|
|
87
102
|
"access": "public"
|
package/src/ChessPlugin.tsx
CHANGED
|
@@ -2,60 +2,33 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { ClientEvents } from '@dxos/plugin-client';
|
|
7
|
-
import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
8
|
-
import { defineObjectForm } from '@dxos/plugin-space/types';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
9
6
|
|
|
10
|
-
import {
|
|
7
|
+
import { Common, Plugin } from '@dxos/app-framework';
|
|
8
|
+
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
9
|
+
|
|
10
|
+
import { ChessBlueprint } from './blueprints';
|
|
11
|
+
import { BlueprintDefinition, ReactSurface } from './capabilities';
|
|
11
12
|
import { meta } from './meta';
|
|
12
13
|
import { translations } from './translations';
|
|
13
|
-
import { Chess
|
|
14
|
+
import { Chess } from './types';
|
|
14
15
|
|
|
15
|
-
export const ChessPlugin =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
icon: 'ph--shield-chevron--regular',
|
|
29
|
-
iconHue: 'amber',
|
|
30
|
-
blueprints: [CHESS_BLUEPRINT_KEY],
|
|
31
|
-
},
|
|
32
|
-
}),
|
|
33
|
-
}),
|
|
34
|
-
defineModule({
|
|
35
|
-
id: `${meta.id}/module/object-form`,
|
|
36
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
37
|
-
activate: () =>
|
|
38
|
-
contributes(
|
|
39
|
-
SpaceCapabilities.ObjectForm,
|
|
40
|
-
defineObjectForm({
|
|
41
|
-
objectSchema: Chess.Game,
|
|
42
|
-
getIntent: () => createIntent(ChessAction.Create),
|
|
43
|
-
}),
|
|
44
|
-
),
|
|
45
|
-
}),
|
|
46
|
-
defineModule({
|
|
47
|
-
id: `${meta.id}/module/react-surface`,
|
|
48
|
-
activatesOn: Events.SetupReactSurface,
|
|
49
|
-
activate: ReactSurface,
|
|
50
|
-
}),
|
|
51
|
-
defineModule({
|
|
52
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
53
|
-
activatesOn: Events.SetupIntentResolver,
|
|
54
|
-
activate: IntentResolver,
|
|
55
|
-
}),
|
|
56
|
-
defineModule({
|
|
57
|
-
id: `${meta.id}/module/blueprint`,
|
|
58
|
-
activatesOn: Events.SetupArtifactDefinition,
|
|
59
|
-
activate: BlueprintDefinition,
|
|
16
|
+
export const ChessPlugin = Plugin.define(meta).pipe(
|
|
17
|
+
Common.Plugin.addTranslationsModule({ translations }),
|
|
18
|
+
Common.Plugin.addMetadataModule({
|
|
19
|
+
metadata: {
|
|
20
|
+
id: Chess.Game.typename,
|
|
21
|
+
metadata: {
|
|
22
|
+
icon: 'ph--shield-chevron--regular',
|
|
23
|
+
iconHue: 'amber',
|
|
24
|
+
blueprints: [ChessBlueprint.Key],
|
|
25
|
+
createObject: ((props) => Effect.sync(() => Chess.make(props))) satisfies CreateObject,
|
|
26
|
+
addToCollectionOnCreate: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
60
29
|
}),
|
|
61
|
-
])
|
|
30
|
+
Common.Plugin.addSchemaModule({ schema: [Chess.Game] }),
|
|
31
|
+
Common.Plugin.addSurfaceModule({ activate: ReactSurface }),
|
|
32
|
+
Common.Plugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),
|
|
33
|
+
Plugin.make,
|
|
34
|
+
);
|
|
@@ -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
|
+
});
|
|
@@ -5,15 +5,21 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
import * as Schema from 'effect/Schema';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Database } from '@dxos/echo';
|
|
9
|
+
import { defineFunction } from '@dxos/functions';
|
|
9
10
|
|
|
10
|
-
import { Chess } from '
|
|
11
|
+
import { Chess } from '../../types';
|
|
11
12
|
|
|
12
13
|
export default defineFunction({
|
|
13
14
|
key: 'dxos.org/function/chess/create',
|
|
14
15
|
name: 'Create Chess',
|
|
15
16
|
description: 'Creates a new chess game.',
|
|
16
17
|
inputSchema: Schema.Struct({
|
|
18
|
+
name: Schema.optional(
|
|
19
|
+
Schema.String.annotations({
|
|
20
|
+
description: 'Name of the game.',
|
|
21
|
+
}),
|
|
22
|
+
),
|
|
17
23
|
pgn: Schema.optional(
|
|
18
24
|
Schema.String.annotations({
|
|
19
25
|
description: 'Portable Game Notation.',
|
|
@@ -26,7 +32,7 @@ export default defineFunction({
|
|
|
26
32
|
),
|
|
27
33
|
}),
|
|
28
34
|
outputSchema: Chess.Game,
|
|
29
|
-
handler: Effect.fn(function* ({ data: { pgn, fen } }) {
|
|
30
|
-
return yield*
|
|
35
|
+
handler: Effect.fn(function* ({ data: { name, pgn, fen } }) {
|
|
36
|
+
return yield* Database.Service.add(Chess.make({ name, pgn, fen }));
|
|
31
37
|
}),
|
|
32
38
|
});
|
|
@@ -7,9 +7,10 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import * as Schema from 'effect/Schema';
|
|
8
8
|
|
|
9
9
|
import { ArtifactId } from '@dxos/assistant';
|
|
10
|
-
import {
|
|
10
|
+
import { Database, Obj } from '@dxos/echo';
|
|
11
|
+
import { defineFunction } from '@dxos/functions';
|
|
11
12
|
|
|
12
|
-
import { Chess } from '
|
|
13
|
+
import { Chess } from '../../types';
|
|
13
14
|
|
|
14
15
|
export default defineFunction({
|
|
15
16
|
key: 'dxos.org/function/chess/move',
|
|
@@ -30,7 +31,7 @@ export default defineFunction({
|
|
|
30
31
|
}),
|
|
31
32
|
}),
|
|
32
33
|
handler: Effect.fn(function* ({ data: { id, move } }) {
|
|
33
|
-
const object = yield*
|
|
34
|
+
const object = yield* Database.Service.resolve(ArtifactId.toDXN(id), Chess.Game);
|
|
34
35
|
const chess = new ChessJS();
|
|
35
36
|
if (object.pgn) {
|
|
36
37
|
chess.loadPgn(object.pgn);
|
|
@@ -39,7 +40,10 @@ export default defineFunction({
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
chess.move(move, { strict: false });
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
const pgn = chess.pgn();
|
|
44
|
+
Obj.change(object, (o) => {
|
|
45
|
+
o.pgn = pgn;
|
|
46
|
+
});
|
|
47
|
+
return { pgn };
|
|
44
48
|
}),
|
|
45
49
|
});
|
|
@@ -7,9 +7,10 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import * as Schema from 'effect/Schema';
|
|
8
8
|
|
|
9
9
|
import { ArtifactId } from '@dxos/assistant';
|
|
10
|
-
import {
|
|
10
|
+
import { Database, Obj } from '@dxos/echo';
|
|
11
|
+
import { defineFunction } from '@dxos/functions';
|
|
11
12
|
|
|
12
|
-
import { Chess } from '
|
|
13
|
+
import { Chess } from '../../types';
|
|
13
14
|
|
|
14
15
|
export default defineFunction({
|
|
15
16
|
key: 'dxos.org/function/chess/play',
|
|
@@ -33,7 +34,7 @@ export default defineFunction({
|
|
|
33
34
|
}),
|
|
34
35
|
}),
|
|
35
36
|
handler: Effect.fn(function* ({ data: { id, side = 'any' } }) {
|
|
36
|
-
const object = yield*
|
|
37
|
+
const object = yield* Database.Service.resolve(ArtifactId.toDXN(id), Chess.Game);
|
|
37
38
|
const chess = new ChessJS();
|
|
38
39
|
if (object.pgn) {
|
|
39
40
|
chess.loadPgn(object.pgn);
|
|
@@ -49,7 +50,10 @@ export default defineFunction({
|
|
|
49
50
|
const move = moves[Math.floor(Math.random() * moves.length)];
|
|
50
51
|
|
|
51
52
|
chess.move(move, { strict: false });
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
const pgn = chess.pgn();
|
|
54
|
+
Obj.change(object, (o) => {
|
|
55
|
+
o.pgn = pgn;
|
|
56
|
+
});
|
|
57
|
+
return { move, pgn };
|
|
54
58
|
}),
|
|
55
59
|
});
|
|
@@ -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,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
+
|
|
9
|
+
import { ChessBlueprint } from '../../blueprints';
|
|
10
|
+
|
|
11
|
+
export type BlueprintCapabilities = [
|
|
12
|
+
Capability.Capability<typeof Common.Capability.Functions>,
|
|
13
|
+
Capability.Capability<typeof Common.Capability.BlueprintDefinition>,
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const blueprintDefinition = Capability.makeModule<[], BlueprintCapabilities>(() =>
|
|
17
|
+
Effect.succeed([
|
|
18
|
+
Capability.contributes(Common.Capability.Functions, ChessBlueprint.functions),
|
|
19
|
+
Capability.contributes(Common.Capability.BlueprintDefinition, ChessBlueprint.make()),
|
|
20
|
+
]),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
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,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
|
|
11
|
+
import { ChessboardContainer } from '../../components';
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
|
+
import { Chess } from '../../types';
|
|
14
|
+
|
|
15
|
+
export default Capability.makeModule(() =>
|
|
16
|
+
Effect.succeed(
|
|
17
|
+
Capability.contributes(Common.Capability.ReactSurface, [
|
|
18
|
+
Common.createSurface({
|
|
19
|
+
id: meta.id,
|
|
20
|
+
role: ['article', 'section', 'card--content'],
|
|
21
|
+
// TODO(burdon): Could this be standardized so that we don't require a subject property.
|
|
22
|
+
filter: (data): data is { subject: Chess.Game } => Obj.instanceOf(Chess.Game, data.subject),
|
|
23
|
+
component: ({ data, role }) => <ChessboardContainer role={role} subject={data.subject} />,
|
|
24
|
+
}),
|
|
25
|
+
]),
|
|
26
|
+
),
|
|
27
|
+
);
|