@dxos/plugin-chess 0.8.4-main.422d1c7879 → 0.8.4-main.4f23b4e393

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 (194) hide show
  1. package/dist/lib/neutral/ChessArticle-QLLKZGPH.mjs +88 -0
  2. package/dist/lib/neutral/ChessArticle-QLLKZGPH.mjs.map +7 -0
  3. package/dist/lib/neutral/ChessCard-I5RSZZIP.mjs +19 -0
  4. package/dist/lib/neutral/ChessCard-I5RSZZIP.mjs.map +7 -0
  5. package/dist/lib/neutral/ChessPlugin.mjs +30 -0
  6. package/dist/lib/neutral/ChessPlugin.mjs.map +7 -0
  7. package/dist/lib/neutral/ChessPlugin.node.mjs +23 -0
  8. package/dist/lib/neutral/ChessPlugin.node.mjs.map +7 -0
  9. package/dist/lib/neutral/blueprint-definition-PZXHAYLD.mjs +15 -0
  10. package/dist/lib/neutral/blueprint-definition-PZXHAYLD.mjs.map +7 -0
  11. package/dist/lib/neutral/blueprints/index.mjs +8 -0
  12. package/dist/lib/neutral/capabilities/index.mjs +13 -0
  13. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  14. package/dist/lib/neutral/chunk-5UOTTW6U.mjs +8 -0
  15. package/dist/lib/neutral/chunk-5UOTTW6U.mjs.map +7 -0
  16. package/dist/lib/neutral/chunk-E4LZPHAQ.mjs +148 -0
  17. package/dist/lib/neutral/chunk-E4LZPHAQ.mjs.map +7 -0
  18. package/dist/lib/neutral/chunk-FFXSIHW6.mjs +21 -0
  19. package/dist/lib/neutral/chunk-FFXSIHW6.mjs.map +7 -0
  20. package/dist/lib/{browser/chunk-MC7L6JNC.mjs → neutral/chunk-XWKNXG62.mjs} +8 -10
  21. package/dist/lib/neutral/chunk-XWKNXG62.mjs.map +7 -0
  22. package/dist/lib/{browser → neutral/components}/index.mjs +8 -158
  23. package/dist/lib/neutral/components/index.mjs.map +7 -0
  24. package/dist/lib/neutral/containers/index.mjs +11 -0
  25. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  26. package/dist/lib/neutral/game-variant-24UKIBRM.mjs +40 -0
  27. package/dist/lib/neutral/game-variant-24UKIBRM.mjs.map +7 -0
  28. package/dist/lib/neutral/index.mjs +18 -0
  29. package/dist/lib/neutral/meta.json +1 -0
  30. package/dist/lib/neutral/meta.mjs +8 -0
  31. package/dist/lib/neutral/move-RQZ7BJY3.mjs +37 -0
  32. package/dist/lib/neutral/move-RQZ7BJY3.mjs.map +7 -0
  33. package/dist/lib/neutral/operation-handler-EKZKFQUG.mjs +13 -0
  34. package/dist/lib/neutral/operation-handler-EKZKFQUG.mjs.map +7 -0
  35. package/dist/lib/{browser/types → neutral/operations}/index.mjs +3 -3
  36. package/dist/lib/neutral/play-GDGCEPQL.mjs +46 -0
  37. package/dist/lib/neutral/play-GDGCEPQL.mjs.map +7 -0
  38. package/dist/lib/neutral/plugin.mjs +16 -0
  39. package/dist/lib/neutral/plugin.mjs.map +7 -0
  40. package/dist/lib/{browser/print-EW7LPW4D.mjs → neutral/print-ZQA74KZI.mjs} +5 -6
  41. package/dist/lib/neutral/print-ZQA74KZI.mjs.map +7 -0
  42. package/dist/lib/neutral/translations.mjs +34 -0
  43. package/dist/lib/neutral/translations.mjs.map +7 -0
  44. package/dist/lib/neutral/types/index.mjs +10 -0
  45. package/dist/types/src/ChessPlugin.d.ts +1 -0
  46. package/dist/types/src/ChessPlugin.d.ts.map +1 -1
  47. package/dist/types/src/ChessPlugin.node.d.ts +8 -0
  48. package/dist/types/src/ChessPlugin.node.d.ts.map +1 -0
  49. package/dist/types/src/blueprints/chess-blueprint.d.ts +2 -2
  50. package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -1
  51. package/dist/types/src/blueprints/index.d.ts +0 -1
  52. package/dist/types/src/blueprints/index.d.ts.map +1 -1
  53. package/dist/types/src/capabilities/blueprint-definition.d.ts +2 -2
  54. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
  55. package/dist/types/src/capabilities/game-variant.d.ts +6 -0
  56. package/dist/types/src/capabilities/game-variant.d.ts.map +1 -0
  57. package/dist/types/src/capabilities/index.d.ts +3 -3
  58. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  59. package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
  60. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
  61. package/dist/types/src/components/Chessboard/Chessboard.d.ts +6 -2
  62. package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -1
  63. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +32 -23
  64. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -1
  65. package/dist/types/src/components/Chessboard/Info.d.ts +4 -5
  66. package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -1
  67. package/dist/types/src/components/Chessboard/types.d.ts +2 -2
  68. package/dist/types/src/components/Chessboard/types.d.ts.map +1 -1
  69. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts +3 -4
  70. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -1
  71. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts +32 -23
  72. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -1
  73. package/dist/types/src/containers/ChessCard/ChessCard.d.ts +3 -4
  74. package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -1
  75. package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts.map +1 -1
  76. package/dist/types/src/index.d.ts +0 -2
  77. package/dist/types/src/index.d.ts.map +1 -1
  78. package/dist/types/src/operations/index.d.ts +2 -3
  79. package/dist/types/src/operations/index.d.ts.map +1 -1
  80. package/dist/types/src/operations/move.d.ts +3 -3
  81. package/dist/types/src/operations/move.d.ts.map +1 -1
  82. package/dist/types/src/operations/play.d.ts +3 -3
  83. package/dist/types/src/operations/play.d.ts.map +1 -1
  84. package/dist/types/src/operations/print.d.ts +3 -3
  85. package/dist/types/src/operations/print.d.ts.map +1 -1
  86. package/dist/types/src/{cli/plugin.d.ts → plugin.d.ts} +1 -0
  87. package/dist/types/src/plugin.d.ts.map +1 -0
  88. package/dist/types/src/translations.d.ts +32 -24
  89. package/dist/types/src/translations.d.ts.map +1 -1
  90. package/dist/types/src/types/Chess.d.ts +10 -19
  91. package/dist/types/src/types/Chess.d.ts.map +1 -1
  92. package/dist/types/src/types/ChessOperation.d.ts +24 -0
  93. package/dist/types/src/types/ChessOperation.d.ts.map +1 -0
  94. package/dist/types/src/types/index.d.ts +1 -0
  95. package/dist/types/src/types/index.d.ts.map +1 -1
  96. package/dist/types/tsconfig.tsbuildinfo +1 -1
  97. package/package.json +91 -68
  98. package/src/ChessPlugin.node.ts +23 -0
  99. package/src/ChessPlugin.test.ts +8 -10
  100. package/src/ChessPlugin.tsx +11 -34
  101. package/src/blueprints/chess-blueprint.ts +6 -9
  102. package/src/blueprints/index.ts +0 -1
  103. package/src/capabilities/blueprint-definition.ts +2 -0
  104. package/src/capabilities/game-variant.ts +42 -0
  105. package/src/capabilities/index.ts +3 -2
  106. package/src/capabilities/operation-handler.ts +3 -3
  107. package/src/components/Chessboard/Chessboard.stories.tsx +3 -3
  108. package/src/components/Chessboard/Chessboard.tsx +4 -4
  109. package/src/components/Chessboard/Info.tsx +3 -63
  110. package/src/components/Chessboard/types.ts +1 -1
  111. package/src/containers/ChessArticle/ChessArticle.stories.tsx +9 -3
  112. package/src/containers/ChessArticle/ChessArticle.tsx +45 -10
  113. package/src/containers/ChessCard/ChessCard.stories.tsx +7 -2
  114. package/src/containers/ChessCard/ChessCard.tsx +10 -5
  115. package/src/index.ts +0 -3
  116. package/src/operations/index.ts +2 -7
  117. package/src/operations/move.ts +13 -13
  118. package/src/operations/play.ts +14 -14
  119. package/src/operations/print.ts +3 -3
  120. package/src/plugin.ts +11 -0
  121. package/src/translations.ts +6 -10
  122. package/src/types/Chess.ts +19 -22
  123. package/src/{operations/definitions.ts → types/ChessOperation.ts} +10 -34
  124. package/src/types/index.ts +1 -0
  125. package/dist/lib/browser/blueprints/index.mjs +0 -14
  126. package/dist/lib/browser/chunk-2TJN26DN.mjs +0 -67
  127. package/dist/lib/browser/chunk-2TJN26DN.mjs.map +0 -7
  128. package/dist/lib/browser/chunk-JZMN24DY.mjs +0 -28
  129. package/dist/lib/browser/chunk-JZMN24DY.mjs.map +0 -7
  130. package/dist/lib/browser/chunk-MC7L6JNC.mjs.map +0 -7
  131. package/dist/lib/browser/chunk-XAJZK6Z2.mjs +0 -110
  132. package/dist/lib/browser/chunk-XAJZK6Z2.mjs.map +0 -7
  133. package/dist/lib/browser/cli/index.mjs +0 -34
  134. package/dist/lib/browser/cli/index.mjs.map +0 -7
  135. package/dist/lib/browser/create-AJHN4QT4.mjs +0 -24
  136. package/dist/lib/browser/create-AJHN4QT4.mjs.map +0 -7
  137. package/dist/lib/browser/index.mjs.map +0 -7
  138. package/dist/lib/browser/meta.json +0 -1
  139. package/dist/lib/browser/move-T2NLRBR4.mjs +0 -36
  140. package/dist/lib/browser/move-T2NLRBR4.mjs.map +0 -7
  141. package/dist/lib/browser/operations/index.mjs +0 -19
  142. package/dist/lib/browser/play-7VTMD3SJ.mjs +0 -45
  143. package/dist/lib/browser/play-7VTMD3SJ.mjs.map +0 -7
  144. package/dist/lib/browser/print-EW7LPW4D.mjs.map +0 -7
  145. package/dist/lib/node-esm/blueprints/index.mjs +0 -15
  146. package/dist/lib/node-esm/chunk-4HZWCKMR.mjs +0 -38
  147. package/dist/lib/node-esm/chunk-4HZWCKMR.mjs.map +0 -7
  148. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  149. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
  150. package/dist/lib/node-esm/chunk-LQEDIKCV.mjs +0 -29
  151. package/dist/lib/node-esm/chunk-LQEDIKCV.mjs.map +0 -7
  152. package/dist/lib/node-esm/chunk-NYU5JVXP.mjs +0 -111
  153. package/dist/lib/node-esm/chunk-NYU5JVXP.mjs.map +0 -7
  154. package/dist/lib/node-esm/chunk-OIRJVY2R.mjs +0 -68
  155. package/dist/lib/node-esm/chunk-OIRJVY2R.mjs.map +0 -7
  156. package/dist/lib/node-esm/cli/index.mjs +0 -35
  157. package/dist/lib/node-esm/cli/index.mjs.map +0 -7
  158. package/dist/lib/node-esm/create-QSETDT4N.mjs +0 -25
  159. package/dist/lib/node-esm/create-QSETDT4N.mjs.map +0 -7
  160. package/dist/lib/node-esm/index.mjs +0 -390
  161. package/dist/lib/node-esm/index.mjs.map +0 -7
  162. package/dist/lib/node-esm/meta.json +0 -1
  163. package/dist/lib/node-esm/move-5F2ANDTE.mjs +0 -37
  164. package/dist/lib/node-esm/move-5F2ANDTE.mjs.map +0 -7
  165. package/dist/lib/node-esm/operations/index.mjs +0 -20
  166. package/dist/lib/node-esm/play-W4DQCQRX.mjs +0 -46
  167. package/dist/lib/node-esm/play-W4DQCQRX.mjs.map +0 -7
  168. package/dist/lib/node-esm/print-UJHXAXMS.mjs +0 -31
  169. package/dist/lib/node-esm/print-UJHXAXMS.mjs.map +0 -7
  170. package/dist/lib/node-esm/types/index.mjs +0 -9
  171. package/dist/lib/node-esm/types/index.mjs.map +0 -7
  172. package/dist/types/src/capabilities/artifact-definition.d.ts +0 -12
  173. package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
  174. package/dist/types/src/capabilities/react-surface.d.ts +0 -5
  175. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  176. package/dist/types/src/cli/index.d.ts +0 -2
  177. package/dist/types/src/cli/index.d.ts.map +0 -1
  178. package/dist/types/src/cli/plugin.d.ts.map +0 -1
  179. package/dist/types/src/operations/create.d.ts +0 -5
  180. package/dist/types/src/operations/create.d.ts.map +0 -1
  181. package/dist/types/src/operations/definitions.d.ts +0 -51
  182. package/dist/types/src/operations/definitions.d.ts.map +0 -1
  183. package/src/capabilities/artifact-definition.ts +0 -135
  184. package/src/capabilities/react-surface.tsx +0 -35
  185. package/src/cli/index.ts +0 -5
  186. package/src/cli/plugin.ts +0 -37
  187. package/src/operations/create.ts +0 -21
  188. /package/dist/lib/{browser → neutral}/blueprints/index.mjs.map +0 -0
  189. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
  190. /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
  191. /package/dist/lib/{browser/operations → neutral}/index.mjs.map +0 -0
  192. /package/dist/lib/{browser/types/index.mjs.map → neutral/meta.mjs.map} +0 -0
  193. /package/dist/lib/{node-esm/blueprints → neutral/operations}/index.mjs.map +0 -0
  194. /package/dist/lib/{node-esm/operations → neutral/types}/index.mjs.map +0 -0
@@ -1,46 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- Play
4
- } from "./chunk-NYU5JVXP.mjs";
5
- import "./chunk-OIRJVY2R.mjs";
6
- import "./chunk-HSLMI22Q.mjs";
7
-
8
- // src/operations/play.ts
9
- import { Chess as ChessJS } from "chess.js";
10
- import * as Effect from "effect/Effect";
11
- import { Database, Obj } from "@dxos/echo";
12
- import { Operation } from "@dxos/operation";
13
- var handler = Play.pipe(Operation.withHandler(Effect.fn(function* ({ game, side = "any" }) {
14
- const object = yield* Database.load(game);
15
- const chess = new ChessJS();
16
- if (object.pgn) {
17
- chess.loadPgn(object.pgn);
18
- } else if (object.fen) {
19
- chess.load(object.fen);
20
- }
21
- if (!(side === "any" || chess.turn() === "w" && side === "white" || chess.turn() === "b" && side === "black")) {
22
- return {
23
- move: void 0,
24
- pgn: object.pgn
25
- };
26
- }
27
- const moves = chess.moves();
28
- const move = moves[Math.floor(Math.random() * moves.length)];
29
- chess.move(move, {
30
- strict: false
31
- });
32
- const pgn = chess.pgn();
33
- Obj.change(object, (object2) => {
34
- const mutableGame = object2;
35
- mutableGame.pgn = pgn;
36
- });
37
- return {
38
- move,
39
- pgn
40
- };
41
- })));
42
- var play_default = handler;
43
- export {
44
- play_default as default
45
- };
46
- //# sourceMappingURL=play-W4DQCQRX.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/operations/play.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\n\nimport { Database, Obj } from '@dxos/echo';\nimport { Operation } from '@dxos/operation';\n\nimport { type Chess } from '../types';\nimport { Play } from './definitions';\n\nconst handler: Operation.WithHandler<typeof Play> = Play.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ game, side = 'any' }) {\n const object = (yield* Database.load(game)) as Chess.Game;\n const chess = new ChessJS();\n if (object.pgn) {\n chess.loadPgn(object.pgn);\n } else if (object.fen) {\n chess.load(object.fen);\n }\n\n if (\n !(side === 'any' || (chess.turn() === 'w' && side === 'white') || (chess.turn() === 'b' && side === 'black'))\n ) {\n return { move: undefined, pgn: object.pgn! };\n }\n\n const moves = chess.moves();\n const move = moves[Math.floor(Math.random() * moves.length)];\n\n chess.move(move, { strict: false });\n const pgn = chess.pgn();\n Obj.change(object, (object) => {\n const mutableGame = object as Obj.Mutable<typeof object>;\n mutableGame.pgn = pgn;\n });\n return { move, pgn };\n }),\n ),\n);\n\nexport default handler;\n"],
5
- "mappings": ";;;;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,UAAUC,WAAW;AAC9B,SAASC,iBAAiB;AAK1B,IAAMC,UAA8CC,KAAKC,KACvDC,UAAUC,YACDC,UAAG,WAAW,EAAEC,MAAMC,OAAO,MAAK,GAAE;AACzC,QAAMC,SAAU,OAAOC,SAASC,KAAKJ,IAAAA;AACrC,QAAMK,QAAQ,IAAIC,QAAAA;AAClB,MAAIJ,OAAOK,KAAK;AACdF,UAAMG,QAAQN,OAAOK,GAAG;EAC1B,WAAWL,OAAOO,KAAK;AACrBJ,UAAMD,KAAKF,OAAOO,GAAG;EACvB;AAEA,MACE,EAAER,SAAS,SAAUI,MAAMK,KAAI,MAAO,OAAOT,SAAS,WAAaI,MAAMK,KAAI,MAAO,OAAOT,SAAS,UACpG;AACA,WAAO;MAAEU,MAAMC;MAAWL,KAAKL,OAAOK;IAAK;EAC7C;AAEA,QAAMM,QAAQR,MAAMQ,MAAK;AACzB,QAAMF,OAAOE,MAAMC,KAAKC,MAAMD,KAAKE,OAAM,IAAKH,MAAMI,MAAM,CAAA;AAE1DZ,QAAMM,KAAKA,MAAM;IAAEO,QAAQ;EAAM,CAAA;AACjC,QAAMX,MAAMF,MAAME,IAAG;AACrBY,MAAIC,OAAOlB,QAAQ,CAACA,YAAAA;AAClB,UAAMmB,cAAcnB;AACpBmB,gBAAYd,MAAMA;EACpB,CAAA;AACA,SAAO;IAAEI;IAAMJ;EAAI;AACrB,CAAA,CAAA,CAAA;AAIJ,IAAA,eAAeb;",
6
- "names": ["Chess", "ChessJS", "Effect", "Database", "Obj", "Operation", "handler", "Play", "pipe", "Operation", "withHandler", "fn", "game", "side", "object", "Database", "load", "chess", "ChessJS", "pgn", "loadPgn", "fen", "turn", "move", "undefined", "moves", "Math", "floor", "random", "length", "strict", "Obj", "change", "mutableGame"]
7
- }
@@ -1,31 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- Print
4
- } from "./chunk-NYU5JVXP.mjs";
5
- import "./chunk-OIRJVY2R.mjs";
6
- import "./chunk-HSLMI22Q.mjs";
7
-
8
- // src/operations/print.ts
9
- import { Chess as ChessJS } from "chess.js";
10
- import * as Effect from "effect/Effect";
11
- import { Operation } from "@dxos/operation";
12
- var handler = Print.pipe(Operation.withHandler(Effect.fn(function* ({ pgn, fen }) {
13
- try {
14
- const chess = new ChessJS(fen);
15
- if (pgn) {
16
- chess.loadPgn(pgn);
17
- }
18
- return {
19
- ascii: chess.ascii()
20
- };
21
- } catch {
22
- return {
23
- ascii: ""
24
- };
25
- }
26
- })));
27
- var print_default = handler;
28
- export {
29
- print_default as default
30
- };
31
- //# sourceMappingURL=print-UJHXAXMS.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/operations/print.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\n\nimport { Operation } from '@dxos/operation';\n\nimport { Print } from './definitions';\n\nconst handler: Operation.WithHandler<typeof Print> = Print.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ pgn, fen }) {\n try {\n const chess = new ChessJS(fen);\n if (pgn) {\n chess.loadPgn(pgn);\n }\n return { ascii: chess.ascii() };\n } catch {\n return { ascii: '' };\n }\n }),\n ),\n);\n\nexport default handler;\n"],
5
- "mappings": ";;;;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAI1B,IAAMC,UAA+CC,MAAMC,KACzDC,UAAUC,YACDC,UAAG,WAAW,EAAEC,KAAKC,IAAG,GAAE;AAC/B,MAAI;AACF,UAAMC,QAAQ,IAAIC,QAAQF,GAAAA;AAC1B,QAAID,KAAK;AACPE,YAAME,QAAQJ,GAAAA;IAChB;AACA,WAAO;MAAEK,OAAOH,MAAMG,MAAK;IAAG;EAChC,QAAQ;AACN,WAAO;MAAEA,OAAO;IAAG;EACrB;AACF,CAAA,CAAA,CAAA;AAIJ,IAAA,gBAAeX;",
6
- "names": ["Chess", "ChessJS", "Effect", "Operation", "handler", "Print", "pipe", "Operation", "withHandler", "fn", "pgn", "fen", "chess", "ChessJS", "loadPgn", "ascii"]
7
- }
@@ -1,9 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- Chess_exports
4
- } from "../chunk-OIRJVY2R.mjs";
5
- import "../chunk-HSLMI22Q.mjs";
6
- export {
7
- Chess_exports as Chess
8
- };
9
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,12 +0,0 @@
1
- import * as Effect from 'effect/Effect';
2
- import { Capability, type PromiseIntentDispatcher } from '@dxos/app-framework';
3
- import { type Space } from '@dxos/react-client/echo';
4
- declare global {
5
- interface ToolContextExtensions {
6
- space?: Space;
7
- dispatch?: PromiseIntentDispatcher;
8
- }
9
- }
10
- declare const _default: (props: void) => Effect.Effect<Capability.Capability<any>, never, never>;
11
- export default _default;
12
- //# sourceMappingURL=artifact-definition.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"artifact-definition.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/artifact-definition.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAgB,UAAU,EAAE,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAM7F,OAAO,EAAU,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAO7D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,QAAQ,CAAC,EAAE,uBAAuB,CAAC;KACpC;CACF;;AAED,wBAsGE"}
@@ -1,5 +0,0 @@
1
- import * as Effect from 'effect/Effect';
2
- import { Capabilities, Capability } from '@dxos/app-framework';
3
- declare const _default: (props: void) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Capabilities.ReactSurface>>, never, never>;
4
- export default _default;
5
- //# sourceMappingURL=react-surface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/react-surface.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;;AAO/D,wBAoBE"}
@@ -1,2 +0,0 @@
1
- export * from './plugin';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/cli/plugin.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAU7C,eAAO,MAAM,WAAW,4BAoBvB,CAAC"}
@@ -1,5 +0,0 @@
1
- import { Operation } from '@dxos/operation';
2
- import { Create } from './definitions';
3
- declare const handler: Operation.WithHandler<typeof Create>;
4
- export default handler;
5
- //# sourceMappingURL=create.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/operations/create.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,QAAA,MAAM,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,OAAO,MAAM,CAMjD,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -1,51 +0,0 @@
1
- import { Database } from '@dxos/echo';
2
- import { Operation } from '@dxos/operation';
3
- export declare const Create: Operation.Definition<{
4
- readonly name?: string | undefined;
5
- readonly pgn?: string | undefined;
6
- readonly fen?: string | undefined;
7
- }, import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
8
- readonly name?: string | undefined;
9
- readonly players?: {
10
- readonly white?: string | undefined;
11
- readonly black?: string | undefined;
12
- } | undefined;
13
- readonly pgn?: string | undefined;
14
- readonly fen?: string | undefined;
15
- }, Database.Service>;
16
- export declare const Move: Operation.Definition<{
17
- readonly game: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
18
- readonly name?: string | undefined;
19
- readonly players?: {
20
- readonly white?: string | undefined;
21
- readonly black?: string | undefined;
22
- } | undefined;
23
- readonly pgn?: string | undefined;
24
- readonly fen?: string | undefined;
25
- }>;
26
- readonly move: string;
27
- }, {
28
- readonly pgn: string;
29
- }, Database.Service>;
30
- export declare const Play: Operation.Definition<{
31
- readonly game: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
32
- readonly name?: string | undefined;
33
- readonly players?: {
34
- readonly white?: string | undefined;
35
- readonly black?: string | undefined;
36
- } | undefined;
37
- readonly pgn?: string | undefined;
38
- readonly fen?: string | undefined;
39
- }>;
40
- readonly side?: "white" | "black" | "any" | undefined;
41
- }, {
42
- readonly pgn: string;
43
- readonly move?: string | undefined;
44
- }, Database.Service>;
45
- export declare const Print: Operation.Definition<{
46
- readonly pgn?: string | undefined;
47
- readonly fen?: string | undefined;
48
- }, {
49
- readonly ascii: string;
50
- }, never>;
51
- //# sourceMappingURL=definitions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../../src/operations/definitions.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAO,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,eAAO,MAAM,MAAM;;;;;;;;;;;;oBAyBjB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;oBAqBf,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;oBAwBf,CAAC;AAEH,eAAO,MAAM,KAAK;;;;;SAqBhB,CAAC"}
@@ -1,135 +0,0 @@
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/operations';
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, (game) => {
125
- game.pgn = chess.pgn();
126
- });
127
- return ToolResult.Success(game.pgn);
128
- },
129
- }),
130
- ],
131
- });
132
-
133
- return Capability.contributes(Capabilities.ArtifactDefinition, definition);
134
- }),
135
- );
@@ -1,35 +0,0 @@
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 { AppSurface } from '@dxos/app-toolkit/ui';
11
-
12
- import { ChessArticle, ChessCard } from '#containers';
13
- import { Chess } from '#types';
14
-
15
- export default Capability.makeModule(() =>
16
- Effect.succeed(
17
- Capability.contributes(Capabilities.ReactSurface, [
18
- Surface.create({
19
- id: 'game',
20
- filter: AppSurface.oneOf(
21
- AppSurface.object(AppSurface.Article, Chess.Game),
22
- AppSurface.object(AppSurface.Section, Chess.Game),
23
- ),
24
- component: ({ data, role }) => (
25
- <ChessArticle role={role} subject={data.subject} attendableId={data.attendableId} />
26
- ),
27
- }),
28
- Surface.create({
29
- id: 'game-card',
30
- filter: AppSurface.object(AppSurface.Card, Chess.Game),
31
- component: ({ data, role }) => <ChessCard role={role} subject={data.subject} />,
32
- }),
33
- ]),
34
- ),
35
- );
package/src/cli/index.ts DELETED
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- export * from './plugin';
package/src/cli/plugin.ts DELETED
@@ -1,37 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import * as Effect from 'effect/Effect';
6
-
7
- import { Plugin } from '@dxos/app-framework';
8
- import { AppPlugin } from '@dxos/app-toolkit';
9
- import { Operation } from '@dxos/operation';
10
- import { SpaceOperation } from '@dxos/plugin-space/operations';
11
- import { type CreateObject } from '@dxos/plugin-space/types';
12
-
13
- import { meta } from '#meta';
14
- import { Chess } from '#types';
15
-
16
- // TODO(wittjosiah): Factor out shared modules.
17
- export const ChessPlugin = Plugin.define(meta).pipe(
18
- AppPlugin.addMetadataModule({
19
- metadata: {
20
- id: Chess.Game.typename,
21
- metadata: {
22
- createObject: ((props, options) =>
23
- Effect.gen(function* () {
24
- const object = Chess.make(props);
25
- return yield* Operation.invoke(SpaceOperation.AddObject, {
26
- object,
27
- target: options.target,
28
- hidden: true,
29
- targetNodeId: options.targetNodeId,
30
- });
31
- })) satisfies CreateObject,
32
- },
33
- },
34
- }),
35
- AppPlugin.addSchemaModule({ schema: [Chess.Game] }),
36
- Plugin.make,
37
- );
@@ -1,21 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import * as Effect from 'effect/Effect';
6
-
7
- import { Database } from '@dxos/echo';
8
- import { Operation } from '@dxos/operation';
9
-
10
- import { Chess } from '../types';
11
- import { Create } from './definitions';
12
-
13
- const handler: Operation.WithHandler<typeof Create> = Create.pipe(
14
- Operation.withHandler(
15
- Effect.fn(function* ({ name, pgn, fen }) {
16
- return yield* Database.add(Chess.make({ name, pgn, fen }));
17
- }),
18
- ),
19
- );
20
-
21
- export default handler;