@dxos/plugin-chess 0.8.4-main.1da679c → 0.8.4-main.21d9917

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.
Files changed (186) hide show
  1. package/dist/lib/browser/ChessboardContainer-IS4PXWJD.mjs +81 -0
  2. package/dist/lib/browser/ChessboardContainer-IS4PXWJD.mjs.map +7 -0
  3. package/dist/lib/browser/blueprint-definition-5RUGJ64Z.mjs +18 -0
  4. package/dist/lib/browser/blueprint-definition-5RUGJ64Z.mjs.map +7 -0
  5. package/dist/lib/browser/blueprints/index.mjs +11 -0
  6. package/dist/lib/browser/{chunk-T275KG4U.mjs → chunk-7OZ7J7LF.mjs} +19 -39
  7. package/dist/lib/browser/chunk-7OZ7J7LF.mjs.map +7 -0
  8. package/dist/lib/browser/chunk-DH4WQRZH.mjs +229 -0
  9. package/dist/lib/browser/chunk-DH4WQRZH.mjs.map +7 -0
  10. package/dist/lib/browser/chunk-H3NUMCQ6.mjs +21 -0
  11. package/dist/lib/browser/chunk-H3NUMCQ6.mjs.map +7 -0
  12. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  13. package/dist/lib/browser/{chunk-KD4I5VTZ.mjs → chunk-MV2GQK7M.mjs} +2 -2
  14. package/dist/lib/browser/chunk-UUMPZ2FM.mjs +271 -0
  15. package/dist/lib/browser/chunk-UUMPZ2FM.mjs.map +7 -0
  16. package/dist/lib/browser/cli/index.mjs +28 -0
  17. package/dist/lib/browser/cli/index.mjs.map +7 -0
  18. package/dist/lib/browser/index.mjs +53 -79
  19. package/dist/lib/browser/index.mjs.map +4 -4
  20. package/dist/lib/browser/meta.json +1 -1
  21. package/dist/lib/browser/react-surface-GQE7XMWH.mjs +37 -0
  22. package/dist/lib/browser/react-surface-GQE7XMWH.mjs.map +7 -0
  23. package/dist/lib/browser/types/index.mjs +3 -5
  24. package/dist/lib/node-esm/ChessboardContainer-S3T6OE7P.mjs +82 -0
  25. package/dist/lib/node-esm/ChessboardContainer-S3T6OE7P.mjs.map +7 -0
  26. package/dist/lib/node-esm/blueprint-definition-RYKASBIJ.mjs +19 -0
  27. package/dist/lib/node-esm/blueprint-definition-RYKASBIJ.mjs.map +7 -0
  28. package/dist/lib/node-esm/blueprints/index.mjs +12 -0
  29. package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
  30. package/dist/lib/node-esm/{chunk-Q5LJYIMO.mjs → chunk-DOBR6ILE.mjs} +2 -2
  31. package/dist/lib/node-esm/{chunk-6OWCPDUA.mjs → chunk-F5OMIM4F.mjs} +5 -11
  32. package/dist/lib/node-esm/chunk-F5OMIM4F.mjs.map +7 -0
  33. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  34. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  35. package/dist/lib/node-esm/chunk-LKJ5GDAB.mjs +272 -0
  36. package/dist/lib/node-esm/chunk-LKJ5GDAB.mjs.map +7 -0
  37. package/dist/lib/node-esm/{chunk-5DYLCQBR.mjs → chunk-NAYRVJR4.mjs} +19 -39
  38. package/dist/lib/node-esm/chunk-NAYRVJR4.mjs.map +7 -0
  39. package/dist/lib/node-esm/chunk-NFDJU7XQ.mjs +230 -0
  40. package/dist/lib/node-esm/chunk-NFDJU7XQ.mjs.map +7 -0
  41. package/dist/lib/node-esm/cli/index.mjs +29 -0
  42. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  43. package/dist/lib/node-esm/index.mjs +53 -79
  44. package/dist/lib/node-esm/index.mjs.map +4 -4
  45. package/dist/lib/node-esm/meta.json +1 -1
  46. package/dist/lib/node-esm/{react-surface-SBM22GEU.mjs → react-surface-7UZLIVN6.mjs} +15 -16
  47. package/dist/lib/node-esm/react-surface-7UZLIVN6.mjs.map +7 -0
  48. package/dist/lib/node-esm/types/index.mjs +3 -5
  49. package/dist/types/src/ChessPlugin.d.ts +2 -1
  50. package/dist/types/src/ChessPlugin.d.ts.map +1 -1
  51. package/dist/types/src/blueprints/chess-blueprint.d.ts +21 -0
  52. package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -0
  53. package/dist/types/src/blueprints/functions/create.d.ts +15 -0
  54. package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
  55. package/dist/types/src/{functions → blueprints/functions}/index.d.ts +1 -0
  56. package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
  57. package/dist/types/src/{functions → blueprints/functions}/move.d.ts +1 -1
  58. package/dist/types/src/blueprints/functions/move.d.ts.map +1 -0
  59. package/dist/types/src/{functions → blueprints/functions}/play.d.ts +1 -1
  60. package/dist/types/src/blueprints/functions/play.d.ts.map +1 -0
  61. package/dist/types/src/blueprints/functions/print.d.ts +8 -0
  62. package/dist/types/src/blueprints/functions/print.d.ts.map +1 -0
  63. package/dist/types/src/blueprints/index.d.ts +3 -0
  64. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  65. package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +12 -0
  66. package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
  67. package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
  68. package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
  69. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +9 -0
  70. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
  72. package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
  73. package/dist/types/src/capabilities/index.d.ts +1 -3
  74. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  75. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  76. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  78. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  79. package/dist/types/src/cli/index.d.ts +2 -0
  80. package/dist/types/src/cli/index.d.ts.map +1 -0
  81. package/dist/types/src/cli/plugin.d.ts +3 -0
  82. package/dist/types/src/cli/plugin.d.ts.map +1 -0
  83. package/dist/types/src/components/Card.stories.d.ts +10 -9
  84. package/dist/types/src/components/Card.stories.d.ts.map +1 -1
  85. package/dist/types/src/components/Chessboard.d.ts +2 -1
  86. package/dist/types/src/components/Chessboard.d.ts.map +1 -1
  87. package/dist/types/src/components/Chessboard.stories.d.ts +15 -13
  88. package/dist/types/src/components/Chessboard.stories.d.ts.map +1 -1
  89. package/dist/types/src/components/ChessboardArticle.d.ts +3 -4
  90. package/dist/types/src/components/ChessboardArticle.d.ts.map +1 -1
  91. package/dist/types/src/components/ChessboardContainer.d.ts +3 -5
  92. package/dist/types/src/components/ChessboardContainer.d.ts.map +1 -1
  93. package/dist/types/src/components/Info.d.ts.map +1 -1
  94. package/dist/types/src/components/index.d.ts +1 -1
  95. package/dist/types/src/components/index.d.ts.map +1 -1
  96. package/dist/types/src/index.d.ts +1 -1
  97. package/dist/types/src/index.d.ts.map +1 -1
  98. package/dist/types/src/meta.d.ts +2 -3
  99. package/dist/types/src/meta.d.ts.map +1 -1
  100. package/dist/types/src/translations.d.ts +9 -8
  101. package/dist/types/src/translations.d.ts.map +1 -1
  102. package/dist/types/src/types/Chess.d.ts +17 -17
  103. package/dist/types/src/types/Chess.d.ts.map +1 -1
  104. package/dist/types/src/types/index.d.ts +0 -1
  105. package/dist/types/src/types/index.d.ts.map +1 -1
  106. package/dist/types/tsconfig.tsbuildinfo +1 -1
  107. package/package.json +64 -50
  108. package/src/ChessPlugin.tsx +26 -53
  109. package/src/blueprints/chess-blueprint.ts +28 -0
  110. package/src/blueprints/functions/create.ts +38 -0
  111. package/src/{functions → blueprints/functions}/index.ts +1 -0
  112. package/src/{functions → blueprints/functions}/move.ts +13 -7
  113. package/src/{functions → blueprints/functions}/play.ts +13 -7
  114. package/src/blueprints/functions/print.ts +42 -0
  115. package/src/blueprints/index.ts +6 -0
  116. package/src/capabilities/artifact-definition/artifact-definition.ts +135 -0
  117. package/src/capabilities/artifact-definition/index.ts +7 -0
  118. package/src/capabilities/blueprint-definition/blueprint-definition.ts +23 -0
  119. package/src/capabilities/blueprint-definition/index.ts +7 -0
  120. package/src/capabilities/index.ts +1 -6
  121. package/src/capabilities/react-surface/index.ts +7 -0
  122. package/src/capabilities/react-surface/react-surface.tsx +27 -0
  123. package/src/cli/index.ts +5 -0
  124. package/src/cli/plugin.ts +26 -0
  125. package/src/components/Card.stories.tsx +19 -40
  126. package/src/components/Chessboard.stories.tsx +18 -15
  127. package/src/components/Chessboard.tsx +21 -10
  128. package/src/components/ChessboardArticle.tsx +13 -11
  129. package/src/components/ChessboardContainer.tsx +9 -13
  130. package/src/components/Info.tsx +17 -13
  131. package/src/index.ts +1 -1
  132. package/src/meta.ts +6 -6
  133. package/src/translations.ts +9 -8
  134. package/src/types/Chess.ts +23 -31
  135. package/src/types/index.ts +0 -1
  136. package/dist/lib/browser/ChessboardContainer-LIZDOGHI.mjs +0 -97
  137. package/dist/lib/browser/ChessboardContainer-LIZDOGHI.mjs.map +0 -7
  138. package/dist/lib/browser/blueprint-definition-I6UFJHT6.mjs +0 -11
  139. package/dist/lib/browser/chunk-EKNL3H3U.mjs +0 -306
  140. package/dist/lib/browser/chunk-EKNL3H3U.mjs.map +0 -7
  141. package/dist/lib/browser/chunk-M2MBU2O6.mjs +0 -163
  142. package/dist/lib/browser/chunk-M2MBU2O6.mjs.map +0 -7
  143. package/dist/lib/browser/chunk-PE3IWOFR.mjs +0 -28
  144. package/dist/lib/browser/chunk-PE3IWOFR.mjs.map +0 -7
  145. package/dist/lib/browser/chunk-T275KG4U.mjs.map +0 -7
  146. package/dist/lib/browser/intent-resolver-RV2DQSJP.mjs +0 -25
  147. package/dist/lib/browser/intent-resolver-RV2DQSJP.mjs.map +0 -7
  148. package/dist/lib/browser/react-surface-I6CZUR5C.mjs +0 -38
  149. package/dist/lib/browser/react-surface-I6CZUR5C.mjs.map +0 -7
  150. package/dist/lib/node-esm/ChessboardContainer-XWVQ5K7N.mjs +0 -98
  151. package/dist/lib/node-esm/ChessboardContainer-XWVQ5K7N.mjs.map +0 -7
  152. package/dist/lib/node-esm/blueprint-definition-F7WQTNQ7.mjs +0 -12
  153. package/dist/lib/node-esm/chunk-5DYLCQBR.mjs.map +0 -7
  154. package/dist/lib/node-esm/chunk-6OWCPDUA.mjs.map +0 -7
  155. package/dist/lib/node-esm/chunk-EGBWRJWH.mjs +0 -307
  156. package/dist/lib/node-esm/chunk-EGBWRJWH.mjs.map +0 -7
  157. package/dist/lib/node-esm/chunk-TUWE7Y5Z.mjs +0 -164
  158. package/dist/lib/node-esm/chunk-TUWE7Y5Z.mjs.map +0 -7
  159. package/dist/lib/node-esm/intent-resolver-TJF7I4UB.mjs +0 -26
  160. package/dist/lib/node-esm/intent-resolver-TJF7I4UB.mjs.map +0 -7
  161. package/dist/lib/node-esm/react-surface-SBM22GEU.mjs.map +0 -7
  162. package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
  163. package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
  164. package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -6
  165. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
  166. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  167. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  168. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  169. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  170. package/dist/types/src/functions/create.d.ts +0 -14
  171. package/dist/types/src/functions/create.d.ts.map +0 -1
  172. package/dist/types/src/functions/index.d.ts.map +0 -1
  173. package/dist/types/src/functions/move.d.ts.map +0 -1
  174. package/dist/types/src/functions/play.d.ts.map +0 -1
  175. package/dist/types/src/types/ChessAction.d.ts +0 -24
  176. package/dist/types/src/types/ChessAction.d.ts.map +0 -1
  177. package/src/capabilities/artifact-definition.ts +0 -128
  178. package/src/capabilities/blueprint-definition.ts +0 -36
  179. package/src/capabilities/intent-resolver.ts +0 -22
  180. package/src/capabilities/react-surface.tsx +0 -23
  181. package/src/functions/create.ts +0 -30
  182. package/src/types/ChessAction.ts +0 -19
  183. /package/dist/lib/browser/{blueprint-definition-I6UFJHT6.mjs.map → blueprints/index.mjs.map} +0 -0
  184. /package/dist/lib/{node-esm/blueprint-definition-F7WQTNQ7.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
  185. /package/dist/lib/browser/{chunk-KD4I5VTZ.mjs.map → chunk-MV2GQK7M.mjs.map} +0 -0
  186. /package/dist/lib/node-esm/{chunk-Q5LJYIMO.mjs.map → chunk-DOBR6ILE.mjs.map} +0 -0
package/package.json CHANGED
@@ -1,31 +1,41 @@
1
1
  {
2
2
  "name": "@dxos/plugin-chess",
3
- "version": "0.8.4-main.1da679c",
3
+ "version": "0.8.4-main.21d9917",
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",
11
15
  "exports": {
12
16
  ".": {
13
- "source": "./src/index.ts",
14
- "types": "./dist/types/src/index.d.ts",
15
17
  "browser": "./dist/lib/browser/index.mjs",
16
- "node": "./dist/lib/node-esm/index.mjs"
18
+ "node": "./dist/lib/node-esm/index.mjs",
19
+ "source": "./src/index.ts",
20
+ "types": "./dist/types/src/index.d.ts"
21
+ },
22
+ "./blueprints": {
23
+ "browser": "./dist/lib/browser/blueprints/index.mjs",
24
+ "node": "./dist/lib/node-esm/blueprints/index.mjs",
25
+ "source": "./src/blueprints/index.ts",
26
+ "types": "./dist/types/src/blueprints/index.d.ts"
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"
17
33
  },
18
34
  "./types": {
19
- "source": "./src/types/index.ts",
20
- "types": "./dist/types/src/types/index.d.ts",
21
35
  "browser": "./dist/lib/browser/types/index.mjs",
22
- "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"
36
+ "node": "./dist/lib/node-esm/types/index.mjs",
37
+ "source": "./src/types/index.ts",
38
+ "types": "./dist/types/src/types/index.d.ts"
29
39
  }
30
40
  },
31
41
  "types": "dist/types/src/index.d.ts",
@@ -41,48 +51,52 @@
41
51
  "src"
42
52
  ],
43
53
  "dependencies": {
44
- "@preact-signals/safe-react": "^0.9.0",
45
- "@preact/signals-core": "^1.9.0",
54
+ "@automerge/automerge": "3.2.3",
55
+ "@effect-atom/atom-react": "^0.4.6",
46
56
  "chess.js": "^1.0.0",
47
- "effect": "3.17.7",
48
- "@dxos/ai": "0.8.4-main.1da679c",
49
- "@dxos/app-framework": "0.8.4-main.1da679c",
50
- "@dxos/assistant": "0.8.4-main.1da679c",
51
- "@dxos/async": "0.8.4-main.1da679c",
52
- "@dxos/blueprints": "0.8.4-main.1da679c",
53
- "@dxos/display-name": "0.8.4-main.1da679c",
54
- "@dxos/echo-schema": "0.8.4-main.1da679c",
55
- "@dxos/echo": "0.8.4-main.1da679c",
56
- "@dxos/functions": "0.8.4-main.1da679c",
57
- "@dxos/live-object": "0.8.4-main.1da679c",
58
- "@dxos/invariant": "0.8.4-main.1da679c",
59
- "@dxos/log": "0.8.4-main.1da679c",
60
- "@dxos/plugin-client": "0.8.4-main.1da679c",
61
- "@dxos/plugin-graph": "0.8.4-main.1da679c",
62
- "@dxos/plugin-space": "0.8.4-main.1da679c",
63
- "@dxos/react-client": "0.8.4-main.1da679c",
64
- "@dxos/react-ui-gameboard": "0.8.4-main.1da679c",
65
- "@dxos/react-ui-sfx": "0.8.4-main.1da679c",
66
- "@dxos/react-ui-stack": "0.8.4-main.1da679c",
67
- "@dxos/schema": "0.8.4-main.1da679c",
68
- "@dxos/util": "0.8.4-main.1da679c"
57
+ "effect": "3.19.11",
58
+ "@dxos/ai": "0.8.4-main.21d9917",
59
+ "@dxos/app-framework": "0.8.4-main.21d9917",
60
+ "@dxos/assistant": "0.8.4-main.21d9917",
61
+ "@dxos/async": "0.8.4-main.21d9917",
62
+ "@dxos/blueprints": "0.8.4-main.21d9917",
63
+ "@dxos/echo": "0.8.4-main.21d9917",
64
+ "@dxos/display-name": "0.8.4-main.21d9917",
65
+ "@dxos/echo-db": "0.8.4-main.21d9917",
66
+ "@dxos/echo-react": "0.8.4-main.21d9917",
67
+ "@dxos/functions": "0.8.4-main.21d9917",
68
+ "@dxos/invariant": "0.8.4-main.21d9917",
69
+ "@dxos/log": "0.8.4-main.21d9917",
70
+ "@dxos/operation": "0.8.4-main.21d9917",
71
+ "@dxos/plugin-graph": "0.8.4-main.21d9917",
72
+ "@dxos/plugin-markdown": "0.8.4-main.21d9917",
73
+ "@dxos/plugin-client": "0.8.4-main.21d9917",
74
+ "@dxos/plugin-space": "0.8.4-main.21d9917",
75
+ "@dxos/react-ui-mosaic": "0.8.4-main.21d9917",
76
+ "@dxos/react-ui-gameboard": "0.8.4-main.21d9917",
77
+ "@dxos/react-client": "0.8.4-main.21d9917",
78
+ "@dxos/react-ui-sfx": "0.8.4-main.21d9917",
79
+ "@dxos/react-ui-stack": "0.8.4-main.21d9917",
80
+ "@dxos/schema": "0.8.4-main.21d9917",
81
+ "@dxos/types": "0.8.4-main.21d9917",
82
+ "@dxos/util": "0.8.4-main.21d9917"
69
83
  },
70
84
  "devDependencies": {
71
- "@types/react": "~18.2.0",
72
- "@types/react-dom": "~18.2.0",
73
- "react": "~18.2.0",
74
- "react-dom": "~18.2.0",
75
- "vite": "7.1.1",
76
- "@dxos/react-ui": "0.8.4-main.1da679c",
77
- "@dxos/react-ui-theme": "0.8.4-main.1da679c",
78
- "@dxos/storybook-utils": "0.8.4-main.1da679c",
79
- "@dxos/plugin-theme": "0.8.4-main.1da679c"
85
+ "@types/react": "~19.2.7",
86
+ "@types/react-dom": "~19.2.3",
87
+ "react": "~19.2.3",
88
+ "react-dom": "~19.2.3",
89
+ "vite": "7.1.9",
90
+ "@dxos/plugin-theme": "0.8.4-main.21d9917",
91
+ "@dxos/react-ui": "0.8.4-main.21d9917",
92
+ "@dxos/storybook-utils": "0.8.4-main.21d9917",
93
+ "@dxos/ui-theme": "0.8.4-main.21d9917"
80
94
  },
81
95
  "peerDependencies": {
82
- "react": "~18.2.0",
83
- "react-dom": "~18.2.0",
84
- "@dxos/react-ui": "0.8.4-main.1da679c",
85
- "@dxos/react-ui-theme": "0.8.4-main.1da679c"
96
+ "react": "~19.2.3",
97
+ "react-dom": "~19.2.3",
98
+ "@dxos/react-ui": "0.8.4-main.21d9917",
99
+ "@dxos/ui-theme": "0.8.4-main.21d9917"
86
100
  },
87
101
  "publishConfig": {
88
102
  "access": "public"
@@ -2,60 +2,33 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Capabilities, Events, contributes, createIntent, defineModule, definePlugin } from '@dxos/app-framework';
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 { BLUEPRINT_KEY, BlueprintDefinition, IntentResolver, ReactSurface } from './capabilities';
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, ChessAction } from './types';
14
+ import { Chess } from './types';
14
15
 
15
- export const ChessPlugin = () =>
16
- definePlugin(meta, [
17
- defineModule({
18
- id: `${meta.id}/module/translations`,
19
- activatesOn: Events.SetupTranslations,
20
- activate: () => contributes(Capabilities.Translations, translations),
21
- }),
22
- defineModule({
23
- id: `${meta.id}/module/metadata`,
24
- activatesOn: Events.SetupMetadata,
25
- activate: () =>
26
- contributes(Capabilities.Metadata, {
27
- id: Chess.Game.typename,
28
- metadata: {
29
- icon: 'ph--shield-chevron--regular',
30
- blueprints: [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,
60
- }),
61
- ]);
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
+ },
29
+ }),
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
+ });
@@ -0,0 +1,38 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import * as Schema from 'effect/Schema';
7
+
8
+ import { Database } from '@dxos/echo';
9
+ import { defineFunction } from '@dxos/functions';
10
+
11
+ import { Chess } from '../../types';
12
+
13
+ export default defineFunction({
14
+ key: 'dxos.org/function/chess/create',
15
+ name: 'Create Chess',
16
+ description: 'Creates a new chess game.',
17
+ inputSchema: Schema.Struct({
18
+ name: Schema.optional(
19
+ Schema.String.annotations({
20
+ description: 'Name of the game.',
21
+ }),
22
+ ),
23
+ pgn: Schema.optional(
24
+ Schema.String.annotations({
25
+ description: 'Portable Game Notation.',
26
+ }),
27
+ ),
28
+ fen: Schema.optional(
29
+ Schema.String.annotations({
30
+ description: 'Forsyth-Edwards Notation.',
31
+ }),
32
+ ),
33
+ }),
34
+ outputSchema: Chess.Game,
35
+ handler: Effect.fn(function* ({ data: { name, pgn, fen } }) {
36
+ return yield* Database.Service.add(Chess.make({ name, pgn, fen }));
37
+ }),
38
+ });
@@ -5,3 +5,4 @@
5
5
  export { default as create } from './create';
6
6
  export { default as move } from './move';
7
7
  export { default as play } from './play';
8
+ export { default as print } from './print';
@@ -3,15 +3,18 @@
3
3
  //
4
4
 
5
5
  import { Chess as ChessJS } from 'chess.js';
6
- import { Effect, Schema } from 'effect';
6
+ import * as Effect from 'effect/Effect';
7
+ import * as Schema from 'effect/Schema';
7
8
 
8
9
  import { ArtifactId } from '@dxos/assistant';
9
- import { DatabaseService, defineFunction } from '@dxos/functions';
10
+ import { Database, Obj } from '@dxos/echo';
11
+ import { defineFunction } from '@dxos/functions';
10
12
 
11
- import { Chess } from '../types';
13
+ import { Chess } from '../../types';
12
14
 
13
15
  export default defineFunction({
14
- name: 'dxos.org/function/chess/move',
16
+ key: 'dxos.org/function/chess/move',
17
+ name: 'Move',
15
18
  description: 'Makes a move in the given chess game.',
16
19
  inputSchema: Schema.Struct({
17
20
  id: ArtifactId.annotations({
@@ -28,7 +31,7 @@ export default defineFunction({
28
31
  }),
29
32
  }),
30
33
  handler: Effect.fn(function* ({ data: { id, move } }) {
31
- const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Chess.Game);
34
+ const object = yield* Database.Service.resolve(ArtifactId.toDXN(id), Chess.Game);
32
35
  const chess = new ChessJS();
33
36
  if (object.pgn) {
34
37
  chess.loadPgn(object.pgn);
@@ -37,7 +40,10 @@ export default defineFunction({
37
40
  }
38
41
 
39
42
  chess.move(move, { strict: false });
40
- object.pgn = chess.pgn();
41
- return { pgn: object.pgn };
43
+ const pgn = chess.pgn();
44
+ Obj.change(object, (o) => {
45
+ o.pgn = pgn;
46
+ });
47
+ return { pgn };
42
48
  }),
43
49
  });
@@ -3,15 +3,18 @@
3
3
  //
4
4
 
5
5
  import { Chess as ChessJS } from 'chess.js';
6
- import { Effect, Schema } from 'effect';
6
+ import * as Effect from 'effect/Effect';
7
+ import * as Schema from 'effect/Schema';
7
8
 
8
9
  import { ArtifactId } from '@dxos/assistant';
9
- import { DatabaseService, defineFunction } from '@dxos/functions';
10
+ import { Database, Obj } from '@dxos/echo';
11
+ import { defineFunction } from '@dxos/functions';
10
12
 
11
- import { Chess } from '../types';
13
+ import { Chess } from '../../types';
12
14
 
13
15
  export default defineFunction({
14
- name: 'dxos.org/function/chess/play',
16
+ key: 'dxos.org/function/chess/play',
17
+ name: 'Play',
15
18
  description: 'Uses the chess engine to play the next move.',
16
19
  inputSchema: Schema.Struct({
17
20
  id: ArtifactId.annotations({
@@ -31,7 +34,7 @@ export default defineFunction({
31
34
  }),
32
35
  }),
33
36
  handler: Effect.fn(function* ({ data: { id, side = 'any' } }) {
34
- const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Chess.Game);
37
+ const object = yield* Database.Service.resolve(ArtifactId.toDXN(id), Chess.Game);
35
38
  const chess = new ChessJS();
36
39
  if (object.pgn) {
37
40
  chess.loadPgn(object.pgn);
@@ -47,7 +50,10 @@ export default defineFunction({
47
50
  const move = moves[Math.floor(Math.random() * moves.length)];
48
51
 
49
52
  chess.move(move, { strict: false });
50
- object.pgn = chess.pgn();
51
- return { move, pgn: object.pgn };
53
+ const pgn = chess.pgn();
54
+ Obj.change(object, (o) => {
55
+ o.pgn = pgn;
56
+ });
57
+ return { move, pgn };
52
58
  }),
53
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,6 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * as ChessBlueprint from './chess-blueprint';
6
+ export * as ChessFunctions from './functions';
@@ -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,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ArtifactDefinition = Capability.lazy('ArtifactDefinition', () => import('./artifact-definition'));
@@ -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;
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const BlueprintDefinition = Capability.lazy('BlueprintDefinition', () => import('./blueprint-definition'));
@@ -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,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));