@dxos/plugin-chess 0.8.4-main.70d3990 → 0.8.4-main.74a063c4e0

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 (223) hide show
  1. package/dist/lib/browser/blueprints/index.mjs +14 -0
  2. package/dist/lib/browser/{chunk-CCF24VRU.mjs → chunk-2TJN26DN.mjs} +18 -34
  3. package/dist/lib/browser/chunk-2TJN26DN.mjs.map +7 -0
  4. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  5. package/dist/lib/browser/chunk-MC7L6JNC.mjs +36 -0
  6. package/dist/lib/browser/chunk-MC7L6JNC.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-SBRUTOHG.mjs +28 -0
  8. package/dist/lib/browser/chunk-SBRUTOHG.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-XAJZK6Z2.mjs +110 -0
  10. package/dist/lib/browser/chunk-XAJZK6Z2.mjs.map +7 -0
  11. package/dist/lib/browser/cli/index.mjs +34 -0
  12. package/dist/lib/browser/cli/index.mjs.map +7 -0
  13. package/dist/lib/browser/create-AJHN4QT4.mjs +24 -0
  14. package/dist/lib/browser/create-AJHN4QT4.mjs.map +7 -0
  15. package/dist/lib/browser/index.mjs +364 -99
  16. package/dist/lib/browser/index.mjs.map +4 -4
  17. package/dist/lib/browser/meta.json +1 -1
  18. package/dist/lib/browser/move-CN7BGBOR.mjs +36 -0
  19. package/dist/lib/browser/move-CN7BGBOR.mjs.map +7 -0
  20. package/dist/lib/browser/operations/index.mjs +19 -0
  21. package/dist/lib/browser/operations/index.mjs.map +7 -0
  22. package/dist/lib/browser/play-YRKSZF5U.mjs +45 -0
  23. package/dist/lib/browser/play-YRKSZF5U.mjs.map +7 -0
  24. package/dist/lib/browser/print-EW7LPW4D.mjs +30 -0
  25. package/dist/lib/browser/print-EW7LPW4D.mjs.map +7 -0
  26. package/dist/lib/browser/types/index.mjs +3 -5
  27. package/dist/lib/node-esm/blueprints/index.mjs +15 -0
  28. package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
  29. package/dist/lib/node-esm/chunk-4HZWCKMR.mjs +38 -0
  30. package/dist/lib/node-esm/chunk-4HZWCKMR.mjs.map +7 -0
  31. package/dist/lib/node-esm/chunk-7W2LXAM5.mjs +29 -0
  32. package/dist/lib/node-esm/chunk-7W2LXAM5.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-NYU5JVXP.mjs +111 -0
  36. package/dist/lib/node-esm/chunk-NYU5JVXP.mjs.map +7 -0
  37. package/dist/lib/node-esm/{chunk-QKXLEJNZ.mjs → chunk-OIRJVY2R.mjs} +18 -34
  38. package/dist/lib/node-esm/chunk-OIRJVY2R.mjs.map +7 -0
  39. package/dist/lib/node-esm/cli/index.mjs +35 -0
  40. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  41. package/dist/lib/node-esm/create-QSETDT4N.mjs +25 -0
  42. package/dist/lib/node-esm/create-QSETDT4N.mjs.map +7 -0
  43. package/dist/lib/node-esm/index.mjs +364 -99
  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/move-OTEYBHVI.mjs +37 -0
  47. package/dist/lib/node-esm/move-OTEYBHVI.mjs.map +7 -0
  48. package/dist/lib/node-esm/operations/index.mjs +20 -0
  49. package/dist/lib/node-esm/operations/index.mjs.map +7 -0
  50. package/dist/lib/node-esm/play-ZLDAXADK.mjs +46 -0
  51. package/dist/lib/node-esm/play-ZLDAXADK.mjs.map +7 -0
  52. package/dist/lib/node-esm/print-UJHXAXMS.mjs +31 -0
  53. package/dist/lib/node-esm/print-UJHXAXMS.mjs.map +7 -0
  54. package/dist/lib/node-esm/types/index.mjs +3 -5
  55. package/dist/types/src/ChessPlugin.d.ts +2 -1
  56. package/dist/types/src/ChessPlugin.d.ts.map +1 -1
  57. package/dist/types/src/blueprints/chess-blueprint.d.ts +4 -0
  58. package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -0
  59. package/dist/types/src/blueprints/index.d.ts +3 -0
  60. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  61. package/dist/types/src/capabilities/artifact-definition.d.ts +3 -2
  62. package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
  63. package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -5
  64. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
  65. package/dist/types/src/capabilities/index.d.ts +5 -4
  66. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  67. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  68. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  69. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  70. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  71. package/dist/types/src/cli/index.d.ts +2 -0
  72. package/dist/types/src/cli/index.d.ts.map +1 -0
  73. package/dist/types/src/cli/plugin.d.ts +3 -0
  74. package/dist/types/src/cli/plugin.d.ts.map +1 -0
  75. package/dist/types/src/components/{Chessboard.d.ts → Chessboard/Chessboard.d.ts} +4 -8
  76. package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
  77. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +48 -0
  78. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -0
  79. package/dist/types/src/components/{Info.d.ts → Chessboard/Info.d.ts} +1 -1
  80. package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -0
  81. package/dist/types/src/components/Chessboard/index.d.ts +2 -0
  82. package/dist/types/src/components/Chessboard/index.d.ts.map +1 -0
  83. package/dist/types/src/components/Chessboard/types.d.ts +8 -0
  84. package/dist/types/src/components/Chessboard/types.d.ts.map +1 -0
  85. package/dist/types/src/components/index.d.ts +0 -1
  86. package/dist/types/src/components/index.d.ts.map +1 -1
  87. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts +6 -0
  88. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -0
  89. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts +47 -0
  90. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -0
  91. package/dist/types/src/containers/ChessArticle/index.d.ts +2 -0
  92. package/dist/types/src/containers/ChessArticle/index.d.ts.map +1 -0
  93. package/dist/types/src/containers/ChessCard/ChessCard.d.ts +6 -0
  94. package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -0
  95. package/dist/types/src/{components/Card.stories.d.ts → containers/ChessCard/ChessCard.stories.d.ts} +2 -9
  96. package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts.map +1 -0
  97. package/dist/types/src/containers/ChessCard/index.d.ts +2 -0
  98. package/dist/types/src/containers/ChessCard/index.d.ts.map +1 -0
  99. package/dist/types/src/containers/index.d.ts +4 -0
  100. package/dist/types/src/containers/index.d.ts.map +1 -0
  101. package/dist/types/src/index.d.ts +2 -3
  102. package/dist/types/src/index.d.ts.map +1 -1
  103. package/dist/types/src/meta.d.ts +2 -2
  104. package/dist/types/src/meta.d.ts.map +1 -1
  105. package/dist/types/src/operations/create.d.ts +5 -0
  106. package/dist/types/src/operations/create.d.ts.map +1 -0
  107. package/dist/types/src/operations/definitions.d.ts +51 -0
  108. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  109. package/dist/types/src/operations/index.d.ts +4 -0
  110. package/dist/types/src/operations/index.d.ts.map +1 -0
  111. package/dist/types/src/operations/move.d.ts +5 -0
  112. package/dist/types/src/operations/move.d.ts.map +1 -0
  113. package/dist/types/src/operations/play.d.ts +5 -0
  114. package/dist/types/src/operations/play.d.ts.map +1 -0
  115. package/dist/types/src/operations/print.d.ts +5 -0
  116. package/dist/types/src/operations/print.d.ts.map +1 -0
  117. package/dist/types/src/translations.d.ts +21 -20
  118. package/dist/types/src/translations.d.ts.map +1 -1
  119. package/dist/types/src/types/Chess.d.ts +17 -17
  120. package/dist/types/src/types/Chess.d.ts.map +1 -1
  121. package/dist/types/src/types/index.d.ts +0 -1
  122. package/dist/types/src/types/index.d.ts.map +1 -1
  123. package/dist/types/tsconfig.tsbuildinfo +1 -1
  124. package/package.json +74 -43
  125. package/src/ChessPlugin.tsx +41 -47
  126. package/src/blueprints/chess-blueprint.ts +35 -0
  127. package/src/blueprints/index.ts +6 -0
  128. package/src/capabilities/artifact-definition.ts +98 -92
  129. package/src/capabilities/blueprint-definition.ts +9 -28
  130. package/src/capabilities/index.ts +8 -6
  131. package/src/capabilities/operation-handler.ts +14 -0
  132. package/src/capabilities/react-surface.tsx +27 -15
  133. package/src/cli/index.ts +5 -0
  134. package/src/cli/plugin.ts +37 -0
  135. package/src/components/Chessboard/Chessboard.stories.tsx +94 -0
  136. package/src/components/{Chessboard.tsx → Chessboard/Chessboard.tsx} +32 -29
  137. package/src/components/{Info.tsx → Chessboard/Info.tsx} +41 -24
  138. package/src/components/Chessboard/index.ts +5 -0
  139. package/src/components/Chessboard/types.ts +18 -0
  140. package/src/components/index.ts +1 -5
  141. package/src/containers/ChessArticle/ChessArticle.stories.tsx +53 -0
  142. package/src/containers/ChessArticle/ChessArticle.tsx +73 -0
  143. package/src/containers/ChessArticle/index.ts +5 -0
  144. package/src/containers/ChessCard/ChessCard.stories.tsx +42 -0
  145. package/src/containers/ChessCard/ChessCard.tsx +22 -0
  146. package/src/containers/ChessCard/index.ts +5 -0
  147. package/src/containers/index.ts +8 -0
  148. package/src/index.ts +2 -3
  149. package/src/meta.ts +3 -3
  150. package/src/operations/create.ts +21 -0
  151. package/src/operations/definitions.ts +109 -0
  152. package/src/operations/index.ts +16 -0
  153. package/src/operations/move.ts +36 -0
  154. package/src/operations/play.ts +45 -0
  155. package/src/operations/print.ts +28 -0
  156. package/src/translations.ts +21 -20
  157. package/src/types/Chess.ts +11 -7
  158. package/src/types/index.ts +0 -1
  159. package/dist/lib/browser/ChessboardContainer-5YXEM4VR.mjs +0 -96
  160. package/dist/lib/browser/ChessboardContainer-5YXEM4VR.mjs.map +0 -7
  161. package/dist/lib/browser/blueprint-definition-Y5Y4YGNL.mjs +0 -11
  162. package/dist/lib/browser/chunk-3LPE2B5J.mjs +0 -169
  163. package/dist/lib/browser/chunk-3LPE2B5J.mjs.map +0 -7
  164. package/dist/lib/browser/chunk-5DOZV3PW.mjs +0 -294
  165. package/dist/lib/browser/chunk-5DOZV3PW.mjs.map +0 -7
  166. package/dist/lib/browser/chunk-CCF24VRU.mjs.map +0 -7
  167. package/dist/lib/browser/chunk-DUO4WTAM.mjs +0 -28
  168. package/dist/lib/browser/chunk-DUO4WTAM.mjs.map +0 -7
  169. package/dist/lib/browser/chunk-Q5TZCIH7.mjs +0 -8
  170. package/dist/lib/browser/chunk-Q5TZCIH7.mjs.map +0 -7
  171. package/dist/lib/browser/intent-resolver-KPGHK5JU.mjs +0 -25
  172. package/dist/lib/browser/intent-resolver-KPGHK5JU.mjs.map +0 -7
  173. package/dist/lib/browser/react-surface-3YST34QI.mjs +0 -38
  174. package/dist/lib/browser/react-surface-3YST34QI.mjs.map +0 -7
  175. package/dist/lib/node-esm/ChessboardContainer-7OQ6TOKB.mjs +0 -97
  176. package/dist/lib/node-esm/ChessboardContainer-7OQ6TOKB.mjs.map +0 -7
  177. package/dist/lib/node-esm/blueprint-definition-GR6OLMB6.mjs +0 -12
  178. package/dist/lib/node-esm/chunk-F3HFLDV5.mjs +0 -170
  179. package/dist/lib/node-esm/chunk-F3HFLDV5.mjs.map +0 -7
  180. package/dist/lib/node-esm/chunk-F4C2HVZL.mjs +0 -295
  181. package/dist/lib/node-esm/chunk-F4C2HVZL.mjs.map +0 -7
  182. package/dist/lib/node-esm/chunk-KNOOJFIR.mjs +0 -29
  183. package/dist/lib/node-esm/chunk-KNOOJFIR.mjs.map +0 -7
  184. package/dist/lib/node-esm/chunk-QKXLEJNZ.mjs.map +0 -7
  185. package/dist/lib/node-esm/chunk-VVXTAVIS.mjs +0 -10
  186. package/dist/lib/node-esm/chunk-VVXTAVIS.mjs.map +0 -7
  187. package/dist/lib/node-esm/intent-resolver-ZAELGF7I.mjs +0 -26
  188. package/dist/lib/node-esm/intent-resolver-ZAELGF7I.mjs.map +0 -7
  189. package/dist/lib/node-esm/react-surface-KV2KBSIU.mjs +0 -39
  190. package/dist/lib/node-esm/react-surface-KV2KBSIU.mjs.map +0 -7
  191. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  192. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  193. package/dist/types/src/components/Card.stories.d.ts.map +0 -1
  194. package/dist/types/src/components/Chessboard.d.ts.map +0 -1
  195. package/dist/types/src/components/Chessboard.stories.d.ts +0 -46
  196. package/dist/types/src/components/Chessboard.stories.d.ts.map +0 -1
  197. package/dist/types/src/components/ChessboardArticle.d.ts +0 -7
  198. package/dist/types/src/components/ChessboardArticle.d.ts.map +0 -1
  199. package/dist/types/src/components/ChessboardContainer.d.ts +0 -9
  200. package/dist/types/src/components/ChessboardContainer.d.ts.map +0 -1
  201. package/dist/types/src/components/Info.d.ts.map +0 -1
  202. package/dist/types/src/functions/create.d.ts +0 -14
  203. package/dist/types/src/functions/create.d.ts.map +0 -1
  204. package/dist/types/src/functions/index.d.ts +0 -4
  205. package/dist/types/src/functions/index.d.ts.map +0 -1
  206. package/dist/types/src/functions/move.d.ts +0 -8
  207. package/dist/types/src/functions/move.d.ts.map +0 -1
  208. package/dist/types/src/functions/play.d.ts +0 -9
  209. package/dist/types/src/functions/play.d.ts.map +0 -1
  210. package/dist/types/src/types/ChessAction.d.ts +0 -24
  211. package/dist/types/src/types/ChessAction.d.ts.map +0 -1
  212. package/src/capabilities/intent-resolver.ts +0 -22
  213. package/src/components/Card.stories.tsx +0 -66
  214. package/src/components/Chessboard.stories.tsx +0 -49
  215. package/src/components/ChessboardArticle.tsx +0 -68
  216. package/src/components/ChessboardContainer.tsx +0 -44
  217. package/src/functions/create.ts +0 -32
  218. package/src/functions/index.ts +0 -7
  219. package/src/functions/move.ts +0 -45
  220. package/src/functions/play.ts +0 -55
  221. package/src/types/ChessAction.ts +0 -19
  222. /package/dist/lib/browser/{blueprint-definition-Y5Y4YGNL.mjs.map → blueprints/index.mjs.map} +0 -0
  223. /package/dist/lib/{node-esm/blueprint-definition-GR6OLMB6.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
@@ -1,44 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- import { getSpace } from '@dxos/react-client/echo';
8
-
9
- import { type Chess } from '../types';
10
-
11
- import { Chessboard } from './Chessboard';
12
- import { ChessboardArticle } from './ChessboardArticle';
13
-
14
- export type ChessboardContainerProps = {
15
- game: Chess.Game;
16
- role?: string;
17
- };
18
-
19
- export const ChessboardContainer = ({ game, role }: ChessboardContainerProps) => {
20
- const space = getSpace(game);
21
- if (!space) {
22
- return null;
23
- }
24
-
25
- switch (role) {
26
- case 'card--popover':
27
- case 'card--intrinsic':
28
- case 'card--extrinsic': {
29
- return (
30
- <Chessboard.Root game={game}>
31
- <Chessboard.Content role={role}>
32
- <Chessboard.Board />
33
- </Chessboard.Content>
34
- </Chessboard.Root>
35
- );
36
- }
37
-
38
- default: {
39
- return <ChessboardArticle game={game} role={role} />;
40
- }
41
- }
42
- };
43
-
44
- export default ChessboardContainer;
@@ -1,32 +0,0 @@
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 { DatabaseService, defineFunction } from '@dxos/functions';
9
-
10
- import { Chess } from '../types';
11
-
12
- export default defineFunction({
13
- key: 'dxos.org/function/chess/create',
14
- name: 'Create Chess',
15
- description: 'Creates a new chess game.',
16
- inputSchema: Schema.Struct({
17
- pgn: Schema.optional(
18
- Schema.String.annotations({
19
- description: 'Portable Game Notation.',
20
- }),
21
- ),
22
- fen: Schema.optional(
23
- Schema.String.annotations({
24
- description: 'Forsyth-Edwards Notation.',
25
- }),
26
- ),
27
- }),
28
- outputSchema: Chess.Game,
29
- handler: Effect.fn(function* ({ data: { pgn, fen } }) {
30
- return yield* DatabaseService.add(Chess.makeGame({ pgn, fen }));
31
- }),
32
- });
@@ -1,7 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- export { default as create } from './create';
6
- export { default as move } from './move';
7
- export { default as play } from './play';
@@ -1,45 +0,0 @@
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 { ArtifactId } from '@dxos/assistant';
10
- import { DatabaseService, defineFunction } from '@dxos/functions';
11
-
12
- import { Chess } from '../types';
13
-
14
- export default defineFunction({
15
- key: 'dxos.org/function/chess/move',
16
- name: 'Move',
17
- description: 'Makes a move in the given chess game.',
18
- inputSchema: Schema.Struct({
19
- id: ArtifactId.annotations({
20
- description: 'The ID of the chess object.',
21
- }),
22
- move: Schema.String.annotations({
23
- description: 'The move to make in the chess game.',
24
- examples: ['e4', 'Bf3'],
25
- }),
26
- }),
27
- outputSchema: Schema.Struct({
28
- pgn: Schema.String.annotations({
29
- description: 'The PGN of the game after the move was played.',
30
- }),
31
- }),
32
- handler: Effect.fn(function* ({ data: { id, move } }) {
33
- const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Chess.Game);
34
- const chess = new ChessJS();
35
- if (object.pgn) {
36
- chess.loadPgn(object.pgn);
37
- } else if (object.fen) {
38
- chess.load(object.fen);
39
- }
40
-
41
- chess.move(move, { strict: false });
42
- object.pgn = chess.pgn();
43
- return { pgn: object.pgn };
44
- }),
45
- });
@@ -1,55 +0,0 @@
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 { ArtifactId } from '@dxos/assistant';
10
- import { DatabaseService, defineFunction } from '@dxos/functions';
11
-
12
- import { Chess } from '../types';
13
-
14
- export default defineFunction({
15
- key: 'dxos.org/function/chess/play',
16
- name: 'Play',
17
- description: 'Uses the chess engine to play the next move.',
18
- inputSchema: Schema.Struct({
19
- id: ArtifactId.annotations({
20
- description: 'The ID of the chess object.',
21
- }),
22
- side: Schema.optional(Schema.Literal('white', 'black', 'any')).annotations({
23
- description: 'The side to play.',
24
- defaultValue: 'any',
25
- }),
26
- }),
27
- outputSchema: Schema.Struct({
28
- pgn: Schema.String.annotations({
29
- description: 'The PGN of the game after the move was played.',
30
- }),
31
- move: Schema.optional(Schema.String).annotations({
32
- description: 'The move that was played.',
33
- }),
34
- }),
35
- handler: Effect.fn(function* ({ data: { id, side = 'any' } }) {
36
- const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Chess.Game);
37
- const chess = new ChessJS();
38
- if (object.pgn) {
39
- chess.loadPgn(object.pgn);
40
- } else if (object.fen) {
41
- chess.load(object.fen);
42
- }
43
-
44
- if (!(side === 'any' || (chess.turn() === 'w' && side === 'white') || (chess.turn() === 'b' && side === 'black'))) {
45
- return { move: undefined, pgn: object.pgn! };
46
- }
47
-
48
- const moves = chess.moves();
49
- const move = moves[Math.floor(Math.random() * moves.length)];
50
-
51
- chess.move(move, { strict: false });
52
- object.pgn = chess.pgn();
53
- return { move, pgn: object.pgn };
54
- }),
55
- });
@@ -1,19 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import * as Schema from 'effect/Schema';
6
-
7
- import { meta } from '../meta';
8
-
9
- import { Game } from './Chess';
10
-
11
- export class Create extends Schema.TaggedClass<Create>()(`${meta.id}/action/create`, {
12
- input: Schema.Struct({
13
- name: Schema.optional(Schema.String),
14
- pgn: Schema.optional(Schema.String),
15
- }),
16
- output: Schema.Struct({
17
- object: Game,
18
- }),
19
- }) {}