@dxos/plugin-chess 0.11.0 → 0.12.0-next-bbabc02363f18d7643ea4160e3a7a7809870fd0d

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 (144) hide show
  1. package/dist/lib/Chess.mjs +47 -0
  2. package/dist/lib/Chess.mjs.map +1 -0
  3. package/dist/lib/ChessEvents.mjs +15 -0
  4. package/dist/lib/ChessEvents.mjs.map +1 -0
  5. package/dist/lib/ChessOperation.mjs +83 -0
  6. package/dist/lib/ChessOperation.mjs.map +1 -0
  7. package/dist/lib/ChessPlugin.node.mjs +11 -9
  8. package/dist/lib/ChessPlugin.node.mjs.map +1 -1
  9. package/dist/lib/ChessPlugin.workerd.mjs +11 -9
  10. package/dist/lib/ChessPlugin.workerd.mjs.map +1 -1
  11. package/dist/lib/ChessPositionIndex.mjs +45 -0
  12. package/dist/lib/ChessPositionIndex.mjs.map +1 -0
  13. package/dist/lib/PlayerReview.mjs +40 -0
  14. package/dist/lib/PlayerReview.mjs.map +1 -0
  15. package/dist/lib/capabilities/node.mjs +4 -3
  16. package/dist/lib/capabilities/node.mjs.map +1 -1
  17. package/dist/lib/capabilities.mjs +11 -4
  18. package/dist/lib/capabilities.mjs.map +1 -1
  19. package/dist/lib/chunk-ChessArticle.mjs +4 -4
  20. package/dist/lib/chunk-ChessArticle.mjs.map +1 -1
  21. package/dist/lib/chunk-ChessCard.mjs +2 -2
  22. package/dist/lib/chunk-ChessCard.mjs.map +1 -1
  23. package/dist/lib/chunk-ChessPlugin.mjs +12 -14
  24. package/dist/lib/chunk-ChessPlugin.mjs.map +1 -1
  25. package/dist/lib/chunk-game-variant.mjs +7 -7
  26. package/dist/lib/chunk-game-variant.mjs.map +1 -1
  27. package/dist/lib/chunk-meta.mjs +2 -2
  28. package/dist/lib/chunk-meta.mjs.map +1 -1
  29. package/dist/lib/chunk-move.mjs +5 -4
  30. package/dist/lib/chunk-move.mjs.map +1 -1
  31. package/dist/lib/chunk-operation-handler.mjs +3 -2
  32. package/dist/lib/chunk-operation-handler.mjs.map +1 -1
  33. package/dist/lib/chunk-play.mjs +5 -4
  34. package/dist/lib/chunk-play.mjs.map +1 -1
  35. package/dist/lib/chunk-print.mjs +2 -2
  36. package/dist/lib/chunk-print.mjs.map +1 -1
  37. package/dist/lib/chunk-rebuild-position-index.mjs +7 -5
  38. package/dist/lib/chunk-rebuild-position-index.mjs.map +1 -1
  39. package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
  40. package/dist/lib/chunk-skill-definition.mjs +3 -3
  41. package/dist/lib/chunk-skill-definition.mjs.map +1 -1
  42. package/dist/lib/chunk-skills.mjs +11 -8
  43. package/dist/lib/chunk-skills.mjs.map +1 -1
  44. package/dist/lib/components.mjs.map +1 -1
  45. package/dist/lib/index.mjs +6 -2
  46. package/dist/lib/operations.mjs +9 -2
  47. package/dist/lib/operations.mjs.map +1 -1
  48. package/dist/lib/plugin.mjs +2 -3
  49. package/dist/lib/plugin.mjs.map +1 -1
  50. package/dist/lib/translations.mjs +6 -4
  51. package/dist/lib/translations.mjs.map +1 -1
  52. package/dist/types/src/ChessPlugin.d.ts +1 -1
  53. package/dist/types/src/ChessPlugin.d.ts.map +1 -1
  54. package/dist/types/src/ChessPlugin.node.d.ts +1 -1
  55. package/dist/types/src/ChessPlugin.node.d.ts.map +1 -1
  56. package/dist/types/src/ChessPlugin.workerd.d.ts +1 -1
  57. package/dist/types/src/ChessPlugin.workerd.d.ts.map +1 -1
  58. package/dist/types/src/capabilities/game-variant.d.ts +2 -2
  59. package/dist/types/src/capabilities/game-variant.d.ts.map +1 -1
  60. package/dist/types/src/capabilities/index.d.ts +4 -5
  61. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  62. package/dist/types/src/capabilities/node.d.ts +2 -4
  63. package/dist/types/src/capabilities/node.d.ts.map +1 -1
  64. package/dist/types/src/capabilities/operation-handler.d.ts +2 -3
  65. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
  66. package/dist/types/src/capabilities/skill-definition.d.ts +2 -2
  67. package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -1
  68. package/dist/types/src/components/Chessboard/Chessboard.d.ts +1 -1
  69. package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -1
  70. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +1 -1
  71. package/dist/types/src/components/Chessboard/types.d.ts +1 -1
  72. package/dist/types/src/components/Chessboard/types.d.ts.map +1 -1
  73. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts +2 -2
  74. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -1
  75. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts +1 -1
  76. package/dist/types/src/containers/ChessCard/ChessCard.d.ts +2 -2
  77. package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -1
  78. package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts +1 -1
  79. package/dist/types/src/index.d.ts +5 -1
  80. package/dist/types/src/index.d.ts.map +1 -1
  81. package/dist/types/src/internal/position-index.d.ts +1 -1
  82. package/dist/types/src/internal/position-index.d.ts.map +1 -1
  83. package/dist/types/src/operations/index.d.ts +1 -1
  84. package/dist/types/src/operations/index.d.ts.map +1 -1
  85. package/dist/types/src/operations/move.d.ts +2 -2
  86. package/dist/types/src/operations/move.d.ts.map +1 -1
  87. package/dist/types/src/operations/play.d.ts +2 -2
  88. package/dist/types/src/operations/play.d.ts.map +1 -1
  89. package/dist/types/src/operations/print.d.ts +2 -2
  90. package/dist/types/src/operations/print.d.ts.map +1 -1
  91. package/dist/types/src/operations/rebuild-position-index.d.ts +1 -1
  92. package/dist/types/src/operations/rebuild-position-index.d.ts.map +1 -1
  93. package/dist/types/src/plugin.d.ts +1 -2
  94. package/dist/types/src/plugin.d.ts.map +1 -1
  95. package/dist/types/src/skills/chess-skill.d.ts +1 -1
  96. package/dist/types/src/skills/chess-skill.d.ts.map +1 -1
  97. package/dist/types/src/translations.d.ts.map +1 -1
  98. package/dist/types/src/types/ChessEvents.d.ts +8 -0
  99. package/dist/types/src/types/ChessEvents.d.ts.map +1 -0
  100. package/dist/types/src/types/ChessOperation.d.ts +2 -2
  101. package/dist/types/src/types/ChessOperation.d.ts.map +1 -1
  102. package/dist/types/src/types/ChessPositionIndex.d.ts +1 -1
  103. package/dist/types/src/types/ChessPositionIndex.d.ts.map +1 -1
  104. package/dist/types/tsconfig.tsbuildinfo +1 -1
  105. package/dx.config.ts +1 -1
  106. package/package.json +78 -40
  107. package/src/ChessPlugin.node.ts +9 -6
  108. package/src/ChessPlugin.test.ts +22 -11
  109. package/src/ChessPlugin.tsx +18 -15
  110. package/src/ChessPlugin.workerd.ts +8 -5
  111. package/src/capabilities/game-variant.ts +6 -5
  112. package/src/capabilities/index.ts +13 -7
  113. package/src/capabilities/node.ts +9 -10
  114. package/src/capabilities/operation-handler.ts +4 -4
  115. package/src/capabilities/skill-definition.ts +3 -3
  116. package/src/components/Chessboard/Chessboard.stories.tsx +1 -1
  117. package/src/components/Chessboard/Chessboard.tsx +1 -2
  118. package/src/components/Chessboard/types.ts +1 -1
  119. package/src/containers/ChessArticle/ChessArticle.stories.tsx +2 -2
  120. package/src/containers/ChessArticle/ChessArticle.tsx +4 -3
  121. package/src/containers/ChessCard/ChessCard.stories.tsx +2 -2
  122. package/src/containers/ChessCard/ChessCard.tsx +4 -3
  123. package/src/index.ts +5 -1
  124. package/src/internal/position-index.ts +1 -1
  125. package/src/meta.ts +1 -1
  126. package/src/operations/index.ts +10 -7
  127. package/src/operations/move.ts +5 -4
  128. package/src/operations/play.ts +5 -4
  129. package/src/operations/print.ts +2 -2
  130. package/src/operations/rebuild-position-index.test.ts +6 -3
  131. package/src/operations/rebuild-position-index.ts +8 -5
  132. package/src/plugin.ts +1 -3
  133. package/src/skills/chess-skill.ts +5 -2
  134. package/src/translations.ts +4 -1
  135. package/src/types/Chess.ts +1 -1
  136. package/src/types/ChessEvents.ts +16 -0
  137. package/src/types/ChessOperation.ts +2 -2
  138. package/src/types/ChessPositionIndex.ts +1 -1
  139. package/dist/lib/chunk-types.mjs +0 -202
  140. package/dist/lib/chunk-types.mjs.map +0 -1
  141. package/dist/lib/types.mjs +0 -2
  142. package/dist/types/src/types/index.d.ts +0 -5
  143. package/dist/types/src/types/index.d.ts.map +0 -1
  144. package/src/types/index.ts +0 -8
@@ -0,0 +1,47 @@
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import { Chess } from "chess.js";
3
+ import * as Schema from "effect/Schema";
4
+ import * as AppAnnotation from "@dxos/app-toolkit/AppAnnotation";
5
+ import { Annotation, DXN, Obj, Type } from "@dxos/echo";
6
+ import { FormInputAnnotation, HiddenAnnotation } from "@dxos/echo/Annotation";
7
+ import { log } from "@dxos/log";
8
+ //#region src/types/Chess.ts
9
+ var Chess_exports = /* @__PURE__ */ __exportAll({
10
+ SKILL_KEY: () => SKILL_KEY,
11
+ State: () => State,
12
+ make: () => make
13
+ });
14
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-chess/src/types/Chess.ts";
15
+ var SKILL_KEY = "org.dxos.skill.chess";
16
+ /**
17
+ * Chess variant state. Referenced by the base `Game` object via `Game.variant`.
18
+ * Players, name, and other game-shared fields live on the base `Game`.
19
+ */
20
+ var State = class extends Type.makeObject(DXN.make("org.dxos.type.chess.state", "0.1.0"))(Schema.Struct({
21
+ pgn: Schema.String.annotations({ description: "Portable Game Notation." }).pipe(FormInputAnnotation.set(false), Schema.optional),
22
+ fen: Schema.String.annotations({ description: "Forsyth-Edwards Notation." }).pipe(FormInputAnnotation.set(false), Schema.optional)
23
+ }).pipe(Annotation.IconAnnotation.set({
24
+ icon: "ph--shield-chevron--regular",
25
+ hue: "amber"
26
+ }), AppAnnotation.SkillsAnnotation.set([SKILL_KEY]), HiddenAnnotation.set(true))) {};
27
+ var make = ({ pgn, fen } = {}) => {
28
+ const chess = new Chess();
29
+ if (pgn) try {
30
+ chess.loadPgn(pgn);
31
+ } catch {
32
+ log.warn(pgn, void 0, {
33
+ "~LogMeta": "~LogMeta",
34
+ F: __dxlog_file,
35
+ L: 44,
36
+ S: void 0
37
+ });
38
+ }
39
+ return Obj.make(State, {
40
+ pgn,
41
+ fen
42
+ });
43
+ };
44
+ //#endregion
45
+ export { SKILL_KEY, State, make, Chess_exports as t };
46
+
47
+ //# sourceMappingURL=Chess.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chess.mjs","names":[],"sources":["../../src/types/Chess.ts"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Schema from 'effect/Schema';\n\nimport * as AppAnnotation from '@dxos/app-toolkit/AppAnnotation';\nimport { Annotation, DXN, Obj, Type } from '@dxos/echo';\nimport { FormInputAnnotation, HiddenAnnotation } from '@dxos/echo/Annotation';\nimport { log } from '@dxos/log';\n\nexport const SKILL_KEY = 'org.dxos.skill.chess';\n\n/**\n * Chess variant state. Referenced by the base `Game` object via `Game.variant`.\n * Players, name, and other game-shared fields live on the base `Game`.\n */\nexport class State extends Type.makeObject<State>(DXN.make('org.dxos.type.chess.state', '0.1.0'))(\n Schema.Struct({\n pgn: Schema.String.annotations({\n description: 'Portable Game Notation.',\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\n fen: Schema.String.annotations({\n description: 'Forsyth-Edwards Notation.',\n }).pipe(FormInputAnnotation.set(false), Schema.optional),\n }).pipe(\n Annotation.IconAnnotation.set({ icon: 'ph--shield-chevron--regular', hue: 'amber' }),\n AppAnnotation.SkillsAnnotation.set([SKILL_KEY]),\n // Implementation detail of the unified `Game` schema. The user-facing object is `Game`;\n // this state is only ever referenced via `Game.variant`. HiddenAnnotation keeps it out of the\n // navtree's typed branches so an orphaned state object doesn't reappear after the\n // wrapping Game is deleted.\n HiddenAnnotation.set(true),\n ),\n) {}\n\nexport const make = ({ pgn, fen }: { pgn?: string; fen?: string } = {}): State => {\n const chess = new ChessJS();\n if (pgn) {\n try {\n chess.loadPgn(pgn);\n } catch {\n log.warn(pgn);\n }\n }\n\n return Obj.make(State, {\n pgn,\n fen,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;AAYA,IAAa,YAAY;;;;;AAMzB,IAAa,QAAb,cAA2B,KAAK,WAAkB,IAAI,KAAK,6BAA6B,OAAO,CAAC,CAAC,CAC/F,OAAO,OAAO;CACZ,KAAK,OAAO,OAAO,YAAY,EAC7B,aAAa,0BACf,CAAC,CAAC,CAAC,KAAK,oBAAoB,IAAI,KAAK,GAAG,OAAO,QAAQ;CACvD,KAAK,OAAO,OAAO,YAAY,EAC7B,aAAa,4BACf,CAAC,CAAC,CAAC,KAAK,oBAAoB,IAAI,KAAK,GAAG,OAAO,QAAQ;AACzD,CAAC,CAAC,CAAC,KACD,WAAW,eAAe,IAAI;CAAE,MAAM;CAA+B,KAAK;AAAQ,CAAC,GACnF,cAAc,iBAAiB,IAAI,CAAC,SAAS,CAAC,GAK9C,iBAAiB,IAAI,IAAI,CAC3B,CACF,CAAC,CAAC,CAAC;AAEH,IAAa,QAAQ,EAAE,KAAK,QAAwC,CAAC,MAAa;CAChF,MAAM,QAAQ,IAAI,MAAQ;CAC1B,IAAI,KACF,IAAI;EACF,MAAM,QAAQ,GAAG;CACnB,QAAQ;EACN,IAAI,KAAK,KAAE,KAAA,GAAA;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;GAAA,GAAA,KAAA;EAAA,CAAC;CACd;CAGF,OAAO,IAAI,KAAK,OAAO;EACrB;EACA;CACF,CAAC;AACH"}
@@ -0,0 +1,15 @@
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import * as ActivationEvent from "@dxos/app-framework/ActivationEvent";
3
+ import { meta } from "#meta";
4
+ //#region src/types/ChessEvents.ts
5
+ var ChessEvents_exports = /* @__PURE__ */ __exportAll({ Start: () => Start });
6
+ /**
7
+ * The feature's start event: the plugin's start-gated modules (and cross-plugin
8
+ * contributions consumed by this feature) activate here. Fired on demand and by the
9
+ * host's idle trickle.
10
+ */
11
+ var Start = ActivationEvent.pluginStart(meta.profile.key);
12
+ //#endregion
13
+ export { Start, ChessEvents_exports as t };
14
+
15
+ //# sourceMappingURL=ChessEvents.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChessEvents.mjs","names":[],"sources":["../../src/types/ChessEvents.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as ActivationEvent from '@dxos/app-framework/ActivationEvent';\n\nimport { meta } from '#meta';\n\n/**\n * The feature's start event: the plugin's start-gated modules (and cross-plugin\n * contributions consumed by this feature) activate here. Fired on demand and by the\n * host's idle trickle.\n */\nexport const Start = ActivationEvent.pluginStart(meta.profile.key);\n"],"mappings":";;;;;;;;;;AAeA,IAAa,QAAQ,gBAAgB,YAAY,KAAK,QAAQ,GAAG"}
@@ -0,0 +1,83 @@
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import { State } from "./Chess.mjs";
3
+ import { Review } from "./PlayerReview.mjs";
4
+ import * as Schema from "effect/Schema";
5
+ import { DXN, Database, Ref } from "@dxos/echo";
6
+ import * as Operation from "@dxos/compute/Operation";
7
+ import * as Game from "@dxos/plugin-game/Game";
8
+ //#region src/types/ChessOperation.ts
9
+ var ChessOperation_exports = /* @__PURE__ */ __exportAll({
10
+ Move: () => Move,
11
+ Play: () => Play,
12
+ Print: () => Print,
13
+ RebuildPositionIndex: () => RebuildPositionIndex
14
+ });
15
+ var Move = Operation.make({
16
+ meta: {
17
+ key: DXN.make("org.dxos.function.chess.move"),
18
+ name: "Move",
19
+ description: "Makes a move in the given chess game.",
20
+ icon: "ph--play--regular"
21
+ },
22
+ input: Schema.Struct({
23
+ game: Game.GameRef(State).annotations({ description: "The ID of the game object (variant must be Chess)." }),
24
+ move: Schema.String.annotations({
25
+ description: "The move to make in the chess game.",
26
+ examples: ["e4", "Bf3"]
27
+ })
28
+ }),
29
+ output: Schema.Struct({ pgn: Schema.String.annotations({ description: "The PGN of the game after the move was played." }) }),
30
+ services: [Database.Service]
31
+ });
32
+ var Play = Operation.make({
33
+ meta: {
34
+ key: DXN.make("org.dxos.function.chess.play"),
35
+ name: "Play",
36
+ description: "Uses the chess engine to play the next move.",
37
+ icon: "ph--play--regular"
38
+ },
39
+ input: Schema.Struct({
40
+ game: Game.GameRef(State).annotations({ description: "The ID of the game object (variant must be Chess)." }),
41
+ side: Schema.optional(Schema.Literal("white", "black", "any")).annotations({
42
+ description: "The side to play.",
43
+ defaultValue: "any"
44
+ })
45
+ }),
46
+ output: Schema.Struct({
47
+ pgn: Schema.String.annotations({ description: "The PGN of the game after the move was played." }),
48
+ move: Schema.optional(Schema.String).annotations({ description: "The move that was played." })
49
+ }),
50
+ services: [Database.Service]
51
+ });
52
+ var Print = Operation.make({
53
+ meta: {
54
+ key: DXN.make("org.dxos.function.chess.print"),
55
+ name: "Print game",
56
+ description: "Prints the chess game to ASCII.",
57
+ icon: "ph--clipboard-text--regular"
58
+ },
59
+ input: Schema.Struct({
60
+ pgn: Schema.optional(Schema.String.annotations({ description: "Portable Game Notation." })),
61
+ fen: Schema.optional(Schema.String.annotations({ description: "Forsyth-Edwards Notation." }))
62
+ }),
63
+ output: Schema.Struct({ ascii: Schema.String })
64
+ });
65
+ /** Rebuilds a player review position index from all chess games in the space. */
66
+ var RebuildPositionIndex = Operation.make({
67
+ meta: {
68
+ key: DXN.make("org.dxos.plugin.chess.operation.rebuildPositionIndex"),
69
+ name: "Rebuild Position Index",
70
+ description: "Scans chess games and updates the player review position index.",
71
+ icon: "ph--arrows-clockwise--regular"
72
+ },
73
+ services: [Database.Service],
74
+ input: Schema.Struct({ review: Ref.Ref(Review).annotations({ description: "Player review whose position index should be rebuilt." }) }),
75
+ output: Schema.Struct({
76
+ gamesScanned: Schema.Number,
77
+ positionsUpdated: Schema.Number
78
+ })
79
+ }).pipe(Operation.visible);
80
+ //#endregion
81
+ export { Move, Play, Print, RebuildPositionIndex, ChessOperation_exports as t };
82
+
83
+ //# sourceMappingURL=ChessOperation.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChessOperation.mjs","names":[],"sources":["../../src/types/ChessOperation.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport * as Operation from '@dxos/compute/Operation';\nimport { Database, DXN, Ref } from '@dxos/echo';\nimport * as Game from '@dxos/plugin-game/Game';\n\nimport * as Chess from './Chess';\nimport * as PlayerReview from './PlayerReview';\n\nexport const Move = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.chess.move'),\n name: 'Move',\n description: 'Makes a move in the given chess game.',\n icon: 'ph--play--regular',\n },\n input: Schema.Struct({\n game: Game.GameRef(Chess.State).annotations({\n description: 'The ID of the game object (variant must be Chess).',\n }),\n move: Schema.String.annotations({\n description: 'The move to make in the chess game.',\n examples: ['e4', 'Bf3'],\n }),\n }),\n output: Schema.Struct({\n pgn: Schema.String.annotations({\n description: 'The PGN of the game after the move was played.',\n }),\n }),\n services: [Database.Service],\n});\n\nexport const Play = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.chess.play'),\n name: 'Play',\n description: 'Uses the chess engine to play the next move.',\n icon: 'ph--play--regular',\n },\n input: Schema.Struct({\n game: Game.GameRef(Chess.State).annotations({\n description: 'The ID of the game object (variant must be Chess).',\n }),\n side: Schema.optional(Schema.Literal('white', 'black', 'any')).annotations({\n description: 'The side to play.',\n defaultValue: 'any',\n }),\n }),\n output: Schema.Struct({\n pgn: Schema.String.annotations({\n description: 'The PGN of the game after the move was played.',\n }),\n move: Schema.optional(Schema.String).annotations({\n description: 'The move that was played.',\n }),\n }),\n services: [Database.Service],\n});\n\nexport const Print = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.chess.print'),\n name: 'Print game',\n description: 'Prints the chess game to ASCII.',\n icon: 'ph--clipboard-text--regular',\n },\n input: Schema.Struct({\n pgn: Schema.optional(\n Schema.String.annotations({\n description: 'Portable Game Notation.',\n }),\n ),\n fen: Schema.optional(\n Schema.String.annotations({\n description: 'Forsyth-Edwards Notation.',\n }),\n ),\n }),\n output: Schema.Struct({\n ascii: Schema.String,\n }),\n});\n\n/** Rebuilds a player review position index from all chess games in the space. */\nexport const RebuildPositionIndex = Operation.make({\n meta: {\n key: DXN.make('org.dxos.plugin.chess.operation.rebuildPositionIndex'),\n name: 'Rebuild Position Index',\n description: 'Scans chess games and updates the player review position index.',\n icon: 'ph--arrows-clockwise--regular',\n },\n services: [Database.Service],\n input: Schema.Struct({\n review: Ref.Ref(PlayerReview.Review).annotations({\n description: 'Player review whose position index should be rebuilt.',\n }),\n }),\n output: Schema.Struct({\n gamesScanned: Schema.Number,\n positionsUpdated: Schema.Number,\n }),\n}).pipe(Operation.visible);\n"],"mappings":";;;;;;;;;;;;;;AAeA,IAAa,OAAO,UAAU,KAAK;CACjC,MAAM;EACJ,KAAK,IAAI,KAAK,8BAA8B;EAC5C,MAAM;EACN,aAAa;EACb,MAAM;CACR;CACA,OAAO,OAAO,OAAO;EACnB,MAAM,KAAK,QAAQ,KAAW,CAAC,CAAC,YAAY,EAC1C,aAAa,qDACf,CAAC;EACD,MAAM,OAAO,OAAO,YAAY;GAC9B,aAAa;GACb,UAAU,CAAC,MAAM,KAAK;EACxB,CAAC;CACH,CAAC;CACD,QAAQ,OAAO,OAAO,EACpB,KAAK,OAAO,OAAO,YAAY,EAC7B,aAAa,iDACf,CAAC,EACH,CAAC;CACD,UAAU,CAAC,SAAS,OAAO;AAC7B,CAAC;AAED,IAAa,OAAO,UAAU,KAAK;CACjC,MAAM;EACJ,KAAK,IAAI,KAAK,8BAA8B;EAC5C,MAAM;EACN,aAAa;EACb,MAAM;CACR;CACA,OAAO,OAAO,OAAO;EACnB,MAAM,KAAK,QAAQ,KAAW,CAAC,CAAC,YAAY,EAC1C,aAAa,qDACf,CAAC;EACD,MAAM,OAAO,SAAS,OAAO,QAAQ,SAAS,SAAS,KAAK,CAAC,CAAC,CAAC,YAAY;GACzE,aAAa;GACb,cAAc;EAChB,CAAC;CACH,CAAC;CACD,QAAQ,OAAO,OAAO;EACpB,KAAK,OAAO,OAAO,YAAY,EAC7B,aAAa,iDACf,CAAC;EACD,MAAM,OAAO,SAAS,OAAO,MAAM,CAAC,CAAC,YAAY,EAC/C,aAAa,4BACf,CAAC;CACH,CAAC;CACD,UAAU,CAAC,SAAS,OAAO;AAC7B,CAAC;AAED,IAAa,QAAQ,UAAU,KAAK;CAClC,MAAM;EACJ,KAAK,IAAI,KAAK,+BAA+B;EAC7C,MAAM;EACN,aAAa;EACb,MAAM;CACR;CACA,OAAO,OAAO,OAAO;EACnB,KAAK,OAAO,SACV,OAAO,OAAO,YAAY,EACxB,aAAa,0BACf,CAAC,CACH;EACA,KAAK,OAAO,SACV,OAAO,OAAO,YAAY,EACxB,aAAa,4BACf,CAAC,CACH;CACF,CAAC;CACD,QAAQ,OAAO,OAAO,EACpB,OAAO,OAAO,OAChB,CAAC;AACH,CAAC;;AAGD,IAAa,uBAAuB,UAAU,KAAK;CACjD,MAAM;EACJ,KAAK,IAAI,KAAK,sDAAsD;EACpE,MAAM;EACN,aAAa;EACb,MAAM;CACR;CACA,UAAU,CAAC,SAAS,OAAO;CAC3B,OAAO,OAAO,OAAO,EACnB,QAAQ,IAAI,IAAI,MAAmB,CAAC,CAAC,YAAY,EAC/C,aAAa,wDACf,CAAC,EACH,CAAC;CACD,QAAQ,OAAO,OAAO;EACpB,cAAc,OAAO;EACrB,kBAAkB,OAAO;CAC3B,CAAC;AACH,CAAC,CAAC,CAAC,KAAK,UAAU,OAAO"}
@@ -1,18 +1,20 @@
1
- import { Chess, ChessPositionIndex, PlayerReview } from "#types";
2
- import { Plugin } from "@dxos/app-framework";
3
- import { AppPlugin } from "@dxos/app-toolkit";
4
- import { OperationHandler, SkillDefinition } from "#capabilities";
1
+ import { State } from "./Chess.mjs";
2
+ import { PositionIndex } from "./ChessPositionIndex.mjs";
3
+ import { Review } from "./PlayerReview.mjs";
4
+ import * as Plugin from "@dxos/app-framework/Plugin";
5
5
  import { meta } from "#meta";
6
+ import * as AppCapability from "@dxos/app-toolkit/AppCapability";
7
+ import { OperationHandler, SkillDefinition } from "#capabilities";
6
8
  //#region src/ChessPlugin.node.ts
7
9
  /**
8
10
  * Headless variant of ChessPlugin (no React surfaces / GameVariant).
9
11
  * Used in node contexts (CLI, agents) where rendering is unavailable.
10
12
  */
11
- var ChessPlugin = Plugin.define(meta).pipe(AppPlugin.addSchemaModule({ schema: [
12
- Chess.State,
13
- ChessPositionIndex.PositionIndex,
14
- PlayerReview.Review
15
- ] }), AppPlugin.addSkillDefinitionModule({ activate: SkillDefinition }), AppPlugin.addOperationHandlerModule({ activate: OperationHandler }), Plugin.make);
13
+ var ChessPlugin = Plugin.define(meta).pipe(Plugin.addModule(AppCapability.schema([
14
+ State,
15
+ PositionIndex,
16
+ Review
17
+ ])), Plugin.addModule(SkillDefinition), Plugin.addModule(OperationHandler), Plugin.make);
16
18
  //#endregion
17
19
  export { ChessPlugin, ChessPlugin as default };
18
20
 
@@ -1 +1 @@
1
- {"version":3,"file":"ChessPlugin.node.mjs","names":[],"sources":["../../src/ChessPlugin.node.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { OperationHandler, SkillDefinition } from '#capabilities';\nimport { meta } from '#meta';\nimport { Chess, ChessPositionIndex, PlayerReview } from '#types';\n\n/**\n * Headless variant of ChessPlugin (no React surfaces / GameVariant).\n * Used in node contexts (CLI, agents) where rendering is unavailable.\n */\nexport const ChessPlugin = Plugin.define(meta).pipe(\n AppPlugin.addSchemaModule({ schema: [Chess.State, ChessPositionIndex.PositionIndex, PlayerReview.Review] }),\n AppPlugin.addSkillDefinitionModule({ activate: SkillDefinition }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n Plugin.make,\n);\n\nexport default ChessPlugin;\n"],"mappings":";;;;;;;;;;AAeA,IAAa,cAAc,OAAO,OAAO,IAAI,CAAC,CAAC,KAC7C,UAAU,gBAAgB,EAAE,QAAQ;CAAC,MAAM;CAAO,mBAAmB;CAAe,aAAa;AAAM,EAAE,CAAC,GAC1G,UAAU,yBAAyB,EAAE,UAAU,gBAAgB,CAAC,GAChE,UAAU,0BAA0B,EAAE,UAAU,iBAAiB,CAAC,GAClE,OAAO,IACT"}
1
+ {"version":3,"file":"ChessPlugin.node.mjs","names":[],"sources":["../../src/ChessPlugin.node.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Plugin from '@dxos/app-framework/Plugin';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { OperationHandler, SkillDefinition } from '#capabilities';\nimport { meta } from '#meta';\n\nimport * as Chess from './types/Chess';\nimport * as ChessPositionIndex from './types/ChessPositionIndex';\nimport * as PlayerReview from './types/PlayerReview';\n\n/**\n * Headless variant of ChessPlugin (no React surfaces / GameVariant).\n * Used in node contexts (CLI, agents) where rendering is unavailable.\n */\nexport const ChessPlugin = Plugin.define(meta).pipe(\n Plugin.addModule(AppCapability.schema([Chess.State, ChessPositionIndex.PositionIndex, PlayerReview.Review])),\n Plugin.addModule(SkillDefinition),\n Plugin.addModule(OperationHandler),\n Plugin.make,\n);\n\nexport default ChessPlugin;\n"],"mappings":";;;;;;;;;;;;AAkBA,IAAa,cAAc,OAAO,OAAO,IAAI,CAAC,CAAC,KAC7C,OAAO,UAAU,cAAc,OAAO;CAAC;CAAa;CAAkC;AAAmB,CAAC,CAAC,GAC3G,OAAO,UAAU,eAAe,GAChC,OAAO,UAAU,gBAAgB,GACjC,OAAO,IACT"}
@@ -1,14 +1,16 @@
1
- import { Chess, ChessPositionIndex, PlayerReview } from "#types";
2
- import { Plugin } from "@dxos/app-framework";
3
- import { AppPlugin } from "@dxos/app-toolkit";
4
- import { OperationHandler } from "#capabilities";
1
+ import { State } from "./Chess.mjs";
2
+ import { PositionIndex } from "./ChessPositionIndex.mjs";
3
+ import { Review } from "./PlayerReview.mjs";
4
+ import * as Plugin from "@dxos/app-framework/Plugin";
5
5
  import { meta } from "#meta";
6
+ import * as AppCapability from "@dxos/app-toolkit/AppCapability";
7
+ import { OperationHandler } from "#capabilities";
6
8
  //#region src/ChessPlugin.workerd.ts
7
- var ChessPlugin = Plugin.define(meta).pipe(AppPlugin.addOperationHandlerModule({ activate: OperationHandler }), AppPlugin.addSchemaModule({ schema: [
8
- Chess.State,
9
- ChessPositionIndex.PositionIndex,
10
- PlayerReview.Review
11
- ] }), Plugin.make);
9
+ var ChessPlugin = Plugin.define(meta).pipe(Plugin.addModule(OperationHandler), Plugin.addModule(AppCapability.schema([
10
+ State,
11
+ PositionIndex,
12
+ Review
13
+ ])), Plugin.make);
12
14
  //#endregion
13
15
  export { ChessPlugin, ChessPlugin as default };
14
16
 
@@ -1 +1 @@
1
- {"version":3,"file":"ChessPlugin.workerd.mjs","names":[],"sources":["../../src/ChessPlugin.workerd.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { OperationHandler } from '#capabilities';\nimport { meta } from '#meta';\nimport { Chess, ChessPositionIndex, PlayerReview } from '#types';\n\nexport const ChessPlugin = Plugin.define(meta).pipe(\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({ schema: [Chess.State, ChessPositionIndex.PositionIndex, PlayerReview.Review] }),\n Plugin.make,\n);\n\nexport default ChessPlugin;\n"],"mappings":";;;;;;AAWA,IAAa,cAAc,OAAO,OAAO,IAAI,CAAC,CAAC,KAC7C,UAAU,0BAA0B,EAAE,UAAU,iBAAiB,CAAC,GAClE,UAAU,gBAAgB,EAAE,QAAQ;CAAC,MAAM;CAAO,mBAAmB;CAAe,aAAa;AAAM,EAAE,CAAC,GAC1G,OAAO,IACT"}
1
+ {"version":3,"file":"ChessPlugin.workerd.mjs","names":[],"sources":["../../src/ChessPlugin.workerd.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Plugin from '@dxos/app-framework/Plugin';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { OperationHandler } from '#capabilities';\nimport { meta } from '#meta';\n\nimport * as Chess from './types/Chess';\nimport * as ChessPositionIndex from './types/ChessPositionIndex';\nimport * as PlayerReview from './types/PlayerReview';\n\nexport const ChessPlugin = Plugin.define(meta).pipe(\n Plugin.addModule(OperationHandler),\n Plugin.addModule(AppCapability.schema([Chess.State, ChessPositionIndex.PositionIndex, PlayerReview.Review])),\n Plugin.make,\n);\n\nexport default ChessPlugin;\n"],"mappings":";;;;;;;;AAcA,IAAa,cAAc,OAAO,OAAO,IAAI,CAAC,CAAC,KAC7C,OAAO,UAAU,gBAAgB,GACjC,OAAO,UAAU,cAAc,OAAO;CAAC;CAAa;CAAkC;AAAmB,CAAC,CAAC,GAC3G,OAAO,IACT"}
@@ -0,0 +1,45 @@
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import * as Schema from "effect/Schema";
3
+ import { Annotation, DXN, Obj, Ref, Type } from "@dxos/echo";
4
+ import { FormInputAnnotation } from "@dxos/echo/Annotation";
5
+ import * as Game from "@dxos/plugin-game/Game";
6
+ //#region src/types/ChessPositionIndex.ts
7
+ var ChessPositionIndex_exports = /* @__PURE__ */ __exportAll({
8
+ Index: () => Index,
9
+ PositionEntry: () => PositionEntry,
10
+ PositionIndex: () => PositionIndex,
11
+ Side: () => Side,
12
+ SideIndex: () => SideIndex,
13
+ make: () => make
14
+ });
15
+ /** Side the reviewed player may play in indexed games. */
16
+ var Side = Schema.Literal("white", "black");
17
+ /** Games that reached a normalized FEN while the reviewed player was on this side. */
18
+ var PositionEntry = Schema.Struct({ games: Schema.mutable(Schema.Array(Ref.Ref(Game.Game))).pipe(FormInputAnnotation.set(false)) });
19
+ /** FEN-keyed lookup of {@link PositionEntry} for one side. */
20
+ var SideIndex = Schema.Record({
21
+ key: Schema.String,
22
+ value: PositionEntry
23
+ });
24
+ /** Per-side position reach counts for a player review. */
25
+ var Index = Schema.Struct({
26
+ white: SideIndex,
27
+ black: SideIndex
28
+ });
29
+ /**
30
+ * Aggregated chess positions reached by a player across indexed games.
31
+ * Stored as a child of {@link PlayerReview}.
32
+ */
33
+ var PositionIndex = class extends Type.makeObject(DXN.make("org.dxos.type.chess.positionIndex", "0.1.0"))(Schema.Struct({ index: Index.pipe(FormInputAnnotation.set(false)) }).pipe(Annotation.IconAnnotation.set({
34
+ icon: "ph--map-trifold--regular",
35
+ hue: "amber"
36
+ }))) {};
37
+ /** Creates an empty position index. */
38
+ var make = () => Obj.make(PositionIndex, { index: {
39
+ white: {},
40
+ black: {}
41
+ } });
42
+ //#endregion
43
+ export { Index, PositionEntry, PositionIndex, Side, SideIndex, make, ChessPositionIndex_exports as t };
44
+
45
+ //# sourceMappingURL=ChessPositionIndex.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChessPositionIndex.mjs","names":[],"sources":["../../src/types/ChessPositionIndex.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';\nimport { FormInputAnnotation } from '@dxos/echo/Annotation';\nimport * as Game from '@dxos/plugin-game/Game';\n\n/** Side the reviewed player may play in indexed games. */\nexport const Side = Schema.Literal('white', 'black');\nexport type Side = Schema.Schema.Type<typeof Side>;\n\n/** Games that reached a normalized FEN while the reviewed player was on this side. */\nexport const PositionEntry = Schema.Struct({\n games: Schema.mutable(Schema.Array(Ref.Ref(Game.Game))).pipe(FormInputAnnotation.set(false)),\n});\n\nexport type PositionEntry = Schema.Schema.Type<typeof PositionEntry>;\n\n/** FEN-keyed lookup of {@link PositionEntry} for one side. */\nexport const SideIndex = Schema.Record({ key: Schema.String, value: PositionEntry });\n\nexport type SideIndex = Schema.Schema.Type<typeof SideIndex>;\n\n/** Per-side position reach counts for a player review. */\nexport const Index = Schema.Struct({\n white: SideIndex,\n black: SideIndex,\n});\n\nexport type Index = Schema.Schema.Type<typeof Index>;\n\n/**\n * Aggregated chess positions reached by a player across indexed games.\n * Stored as a child of {@link PlayerReview}.\n */\nexport class PositionIndex extends Type.makeObject<PositionIndex>(\n DXN.make('org.dxos.type.chess.positionIndex', '0.1.0'),\n)(\n Schema.Struct({\n index: Index.pipe(FormInputAnnotation.set(false)),\n }).pipe(Annotation.IconAnnotation.set({ icon: 'ph--map-trifold--regular', hue: 'amber' })),\n) {}\n\n/** Creates an empty position index. */\nexport const make = (): PositionIndex =>\n Obj.make(PositionIndex, {\n index: { white: {}, black: {} },\n });\n"],"mappings":";;;;;;;;;;;;;;;AAaA,IAAa,OAAO,OAAO,QAAQ,SAAS,OAAO;;AAInD,IAAa,gBAAgB,OAAO,OAAO,EACzC,OAAO,OAAO,QAAQ,OAAO,MAAM,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,oBAAoB,IAAI,KAAK,CAAC,EAC7F,CAAC;;AAKD,IAAa,YAAY,OAAO,OAAO;CAAE,KAAK,OAAO;CAAQ,OAAO;AAAc,CAAC;;AAKnF,IAAa,QAAQ,OAAO,OAAO;CACjC,OAAO;CACP,OAAO;AACT,CAAC;;;;;AAQD,IAAa,gBAAb,cAAmC,KAAK,WACtC,IAAI,KAAK,qCAAqC,OAAO,CACvD,CAAC,CACC,OAAO,OAAO,EACZ,OAAO,MAAM,KAAK,oBAAoB,IAAI,KAAK,CAAC,EAClD,CAAC,CAAC,CAAC,KAAK,WAAW,eAAe,IAAI;CAAE,MAAM;CAA4B,KAAK;AAAQ,CAAC,CAAC,CAC3F,CAAC,CAAC,CAAC;;AAGH,IAAa,aACX,IAAI,KAAK,eAAe,EACtB,OAAO;CAAE,OAAO,CAAC;CAAG,OAAO,CAAC;AAAE,EAChC,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import { PositionIndex, make } from "./ChessPositionIndex.mjs";
3
+ import * as Schema from "effect/Schema";
4
+ import { Annotation, DXN, Obj, Ref, Type } from "@dxos/echo";
5
+ import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/Annotation";
6
+ //#region src/types/PlayerReview.ts
7
+ var PlayerReview_exports = /* @__PURE__ */ __exportAll({
8
+ Review: () => Review,
9
+ makeReview: () => makeReview
10
+ });
11
+ /**
12
+ * Personal chess opening/position review for a single player.
13
+ * Indexes all reachable positions (by side) across games in the space.
14
+ */
15
+ var Review = class extends Type.makeObject(DXN.make("org.dxos.type.chess.playerReview", "0.1.0"))(Schema.Struct({
16
+ name: Schema.optional(Schema.String),
17
+ /** DID of the reviewed player; matched against {@link org.dxos.type.game} players. */
18
+ playerIdentity: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),
19
+ /** Display name fallback when identity is absent (e.g. Chess.com username). */
20
+ playerName: Schema.String.pipe(Schema.optional),
21
+ positionIndex: Ref.Ref(PositionIndex).pipe(FormInputAnnotation.set(false))
22
+ }).pipe(LabelAnnotation.set(["name"]), Annotation.IconAnnotation.set({
23
+ icon: "ph--chart-polar--regular",
24
+ hue: "amber"
25
+ }))) {};
26
+ /** Creates a player review with an empty child position index. */
27
+ var makeReview = (props = {}) => {
28
+ const positionIndex = make();
29
+ const review = Obj.make(Review, {
30
+ ...props,
31
+ name: props.name ?? props.playerName ?? "Player review",
32
+ positionIndex: Ref.make(positionIndex)
33
+ });
34
+ Obj.setParent(positionIndex, review);
35
+ return review;
36
+ };
37
+ //#endregion
38
+ export { Review, makeReview, PlayerReview_exports as t };
39
+
40
+ //# sourceMappingURL=PlayerReview.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlayerReview.mjs","names":[],"sources":["../../src/types/PlayerReview.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, DXN, Obj, Ref, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/Annotation';\n\nimport * as ChessPositionIndex from './ChessPositionIndex';\n\n/**\n * Personal chess opening/position review for a single player.\n * Indexes all reachable positions (by side) across games in the space.\n */\nexport class Review extends Type.makeObject<Review>(DXN.make('org.dxos.type.chess.playerReview', '0.1.0'))(\n Schema.Struct({\n name: Schema.optional(Schema.String),\n /** DID of the reviewed player; matched against {@link org.dxos.type.game} players. */\n playerIdentity: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),\n /** Display name fallback when identity is absent (e.g. Chess.com username). */\n playerName: Schema.String.pipe(Schema.optional),\n positionIndex: Ref.Ref(ChessPositionIndex.PositionIndex).pipe(FormInputAnnotation.set(false)),\n }).pipe(\n LabelAnnotation.set(['name']),\n Annotation.IconAnnotation.set({ icon: 'ph--chart-polar--regular', hue: 'amber' }),\n ),\n) {}\n\nexport type MakeReviewProps = {\n name?: string;\n playerIdentity?: string;\n playerName?: string;\n};\n\n/** Creates a player review with an empty child position index. */\nexport const makeReview = (props: MakeReviewProps = {}): Review => {\n const positionIndex = ChessPositionIndex.make();\n const review = Obj.make(Review, {\n ...props,\n name: props.name ?? props.playerName ?? 'Player review',\n positionIndex: Ref.make(positionIndex),\n });\n Obj.setParent(positionIndex, review);\n return review;\n};\n"],"mappings":";;;;;;;;;;;;;;AAiBA,IAAa,SAAb,cAA4B,KAAK,WAAmB,IAAI,KAAK,oCAAoC,OAAO,CAAC,CAAC,CACxG,OAAO,OAAO;CACZ,MAAM,OAAO,SAAS,OAAO,MAAM;;CAEnC,gBAAgB,OAAO,OAAO,KAAK,oBAAoB,IAAI,KAAK,GAAG,OAAO,QAAQ;;CAElF,YAAY,OAAO,OAAO,KAAK,OAAO,QAAQ;CAC9C,eAAe,IAAI,IAAI,aAAgC,CAAC,CAAC,KAAK,oBAAoB,IAAI,KAAK,CAAC;AAC9F,CAAC,CAAC,CAAC,KACD,gBAAgB,IAAI,CAAC,MAAM,CAAC,GAC5B,WAAW,eAAe,IAAI;CAAE,MAAM;CAA4B,KAAK;AAAQ,CAAC,CAClF,CACF,CAAC,CAAC,CAAC;;AASH,IAAa,cAAc,QAAyB,CAAC,MAAc;CACjE,MAAM,gBAAgB,KAAwB;CAC9C,MAAM,SAAS,IAAI,KAAK,QAAQ;EAC9B,GAAG;EACH,MAAM,MAAM,QAAQ,MAAM,cAAc;EACxC,eAAe,IAAI,KAAK,aAAa;CACvC,CAAC;CACD,IAAI,UAAU,eAAe,MAAM;CACnC,OAAO;AACT"}
@@ -1,7 +1,8 @@
1
- import { Capability } from "@dxos/app-framework";
1
+ import * as AppCapability from "@dxos/app-toolkit/AppCapability";
2
+ import * as ActivationEvents from "@dxos/app-framework/ActivationEvents";
2
3
  //#region src/capabilities/node.ts
3
- var SkillDefinition = Capability.lazy("SkillDefinition", () => import("../chunk-skill-definition.mjs"));
4
- var OperationHandler = Capability.lazy("OperationHandler", () => import("../chunk-operation-handler.mjs"));
4
+ var SkillDefinition = AppCapability.skillDefinition(() => import("../chunk-skill-definition.mjs"));
5
+ var OperationHandler = AppCapability.operationHandler(() => import("../chunk-operation-handler.mjs"), { activatesOn: ActivationEvents.Idle });
5
6
  //#endregion
6
7
  export { OperationHandler, SkillDefinition };
7
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"node.mjs","names":[],"sources":["../../../src/capabilities/node.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\nimport type { OperationHandlerSet } from '@dxos/compute';\n\n// The capabilities `ChessPlugin.node` activates, and only those. `Capability.lazy` defers the\n// import at runtime but a bundler still walks it, so listing the React surfaces here would pull\n// the plugin's components into every node and bun build.\n\nexport const SkillDefinition = Capability.lazy('SkillDefinition', () => import('./skill-definition'));\nexport const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(\n 'OperationHandler',\n () => import('./operation-handler'),\n);\n"],"mappings":";;AAWA,IAAa,kBAAkB,WAAW,KAAK,yBAAyB,OAAO,gCAAqB;AACpG,IAAa,mBAAmB,WAAW,KACzC,0BACM,OAAO,iCACf"}
1
+ {"version":3,"file":"node.mjs","names":[],"sources":["../../../src/capabilities/node.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\n// The capabilities `ChessPlugin.node` activates, and only those. A lazy module defers its import at\n// runtime but a bundler still walks it, so listing the React surfaces here — including `GameVariant`,\n// which contributes them — would pull the plugin's components into every node and bun build.\n\nexport const SkillDefinition = AppCapability.skillDefinition(() => import('./skill-definition'));\nexport const OperationHandler = AppCapability.operationHandler(() => import('./operation-handler'), {\n activatesOn: ActivationEvents.Idle,\n});\n"],"mappings":";;;AAWA,IAAa,kBAAkB,cAAc,sBAAsB,OAAO,gCAAqB;AAC/F,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,mCAAwB,EAClG,aAAa,iBAAiB,KAChC,CAAC"}
@@ -1,8 +1,15 @@
1
- import { Capability } from "@dxos/app-framework";
1
+ import * as AppCapability from "@dxos/app-toolkit/AppCapability";
2
+ import * as ActivationEvents from "@dxos/app-framework/ActivationEvents";
3
+ import * as Capability from "@dxos/app-framework/Capability";
4
+ import * as GameCapabilities from "@dxos/plugin-game/GameCapabilities";
5
+ import * as GameEvents from "@dxos/plugin-game/GameEvents";
2
6
  //#region src/capabilities/index.ts
3
- var SkillDefinition = Capability.lazy("SkillDefinition", () => import("./chunk-skill-definition.mjs"));
4
- var GameVariant = Capability.lazy("GameVariant", () => import("./chunk-game-variant.mjs"));
5
- var OperationHandler = Capability.lazy("OperationHandler", () => import("./chunk-operation-handler.mjs"));
7
+ var SkillDefinition = AppCapability.skillDefinition(() => import("./chunk-skill-definition.mjs"));
8
+ var GameVariant = Capability.lazyModule("GameVariant", {
9
+ provides: [GameCapabilities.VariantProvider],
10
+ activatesOn: GameEvents.Start
11
+ }, () => import("./chunk-game-variant.mjs"));
12
+ var OperationHandler = AppCapability.operationHandler(() => import("./chunk-operation-handler.mjs"), { activatesOn: ActivationEvents.Idle });
6
13
  //#endregion
7
14
  export { GameVariant, OperationHandler, SkillDefinition };
8
15
 
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.mjs","names":[],"sources":["../../src/capabilities/index.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\nimport type { OperationHandlerSet } from '@dxos/compute';\n\nexport const SkillDefinition = Capability.lazy('SkillDefinition', () => import('./skill-definition'));\nexport const GameVariant = Capability.lazy('GameVariant', () => import('./game-variant'));\nexport const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(\n 'OperationHandler',\n () => import('./operation-handler'),\n);\n"],"mappings":";;AAOA,IAAa,kBAAkB,WAAW,KAAK,yBAAyB,OAAO,+BAAqB;AACpG,IAAa,cAAc,WAAW,KAAK,qBAAqB,OAAO,2BAAiB;AACxF,IAAa,mBAAmB,WAAW,KACzC,0BACM,OAAO,gCACf"}
1
+ {"version":3,"file":"capabilities.mjs","names":[],"sources":["../../src/capabilities/index.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as ActivationEvents from '@dxos/app-framework/ActivationEvents';\nimport * as Capability from '@dxos/app-framework/Capability';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\nimport * as GameCapabilities from '@dxos/plugin-game/GameCapabilities';\nimport * as GameEvents from '@dxos/plugin-game/GameEvents';\n\nexport const SkillDefinition = AppCapability.skillDefinition(() => import('./skill-definition'));\nexport const GameVariant = Capability.lazyModule(\n 'GameVariant',\n { provides: [GameCapabilities.VariantProvider], activatesOn: GameEvents.Start },\n () => import('./game-variant'),\n);\nexport const OperationHandler = AppCapability.operationHandler(() => import('./operation-handler'), {\n activatesOn: ActivationEvents.Idle,\n});\n"],"mappings":";;;;;;AAUA,IAAa,kBAAkB,cAAc,sBAAsB,OAAO,+BAAqB;AAC/F,IAAa,cAAc,WAAW,WACpC,eACA;CAAE,UAAU,CAAC,iBAAiB,eAAe;CAAG,aAAa,WAAW;AAAM,SACxE,OAAO,2BACf;AACA,IAAa,mBAAmB,cAAc,uBAAuB,OAAO,kCAAwB,EAClG,aAAa,iBAAiB,KAChC,CAAC"}
@@ -1,5 +1,5 @@
1
- import { Chess } from "#types";
2
- import { Chess as Chess$1 } from "chess.js";
1
+ import { State } from "./Chess.mjs";
2
+ import { Chess } from "chess.js";
3
3
  import { Obj } from "@dxos/echo";
4
4
  import { meta } from "#meta";
5
5
  import { useCallback, useRef, useState } from "react";
@@ -18,13 +18,13 @@ var ChessArticle = ({ role, variant }) => {
18
18
  const handleSelect = useCallback((index) => {
19
19
  controller.current?.setMoveNumber(index);
20
20
  }, []);
21
- const state = Obj.instanceOf(Chess.State, variant) ? variant : void 0;
21
+ const state = Obj.instanceOf(State, variant) ? variant : void 0;
22
22
  const [pgn] = useObject(state, "pgn");
23
23
  const [fen] = useObject(state, "fen");
24
24
  const isGameOver = (() => {
25
25
  if (!pgn && !fen) return false;
26
26
  try {
27
- const chess = new Chess$1();
27
+ const chess = new Chess();
28
28
  if (pgn) chess.loadPgn(pgn);
29
29
  else if (fen) chess.load(fen);
30
30
  return chess.isGameOver();
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-ChessArticle.mjs","names":[],"sources":["../../src/containers/ChessArticle/ChessArticle.tsx"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { Obj } from '@dxos/echo';\nimport { useObject } from '@dxos/echo-react';\nimport { type GameVariantSurfaceProps } from '@dxos/plugin-game/types';\nimport { Panel, Toolbar, useTranslation } from '@dxos/react-ui';\nimport { type Player } from '@dxos/react-ui-gameboard';\nimport { mx } from '@dxos/ui-theme';\n\nimport { Chessboard, type ChessboardController, type ChessboardInfoProps } from '#components';\nimport { meta } from '#meta';\nimport { Chess } from '#types';\n\nexport type ChessArticleProps = GameVariantSurfaceProps;\n\nexport const ChessArticle = ({ role, variant }: ChessArticleProps) => {\n const { t } = useTranslation(meta.profile.key);\n const [orientation, setOrientation] = useState<Player>('white');\n const [showInfo, setShowInfo] = useState(true);\n const controller = useRef<ChessboardController>(null);\n\n const handleSelect = useCallback<NonNullable<ChessboardInfoProps['onSelect']>>((index) => {\n controller.current?.setMoveNumber(index);\n }, []);\n\n const state = Obj.instanceOf(Chess.State, variant) ? variant : undefined;\n const [pgn] = useObject(state, 'pgn');\n const [fen] = useObject(state, 'fen');\n\n const isGameOver = (() => {\n if (!pgn && !fen) {\n return false;\n }\n try {\n const chess = new ChessJS();\n if (pgn) {\n chess.loadPgn(pgn);\n } else if (fen) {\n chess.load(fen);\n }\n return chess.isGameOver();\n } catch {\n return false;\n }\n })();\n\n const handleNewGame = useCallback(() => {\n if (!state) {\n return;\n }\n Obj.update(state, (state) => {\n state.pgn = undefined;\n state.fen = undefined;\n });\n }, [state]);\n\n if (!state) {\n return null;\n }\n\n return (\n <Chessboard.Root state={state} ref={controller}>\n <Panel.Root role={role} classNames='@container'>\n <Panel.Toolbar asChild>\n <Toolbar.Root>\n {isGameOver && <Toolbar.Button onClick={handleNewGame}>{t('new-game.button')}</Toolbar.Button>}\n <div className='grow' />\n <Toolbar.IconButton\n icon='ph--info--regular'\n iconOnly\n label={t('toggle-info.button')}\n classNames={mx('invisible @4xl:visible')}\n onClick={() => setShowInfo((open) => !open)}\n />\n </Toolbar.Root>\n </Panel.Toolbar>\n <Panel.Content>\n <div\n className={mx(\n 'grid h-full w-full',\n showInfo && '@4xl:grid-cols-[1fr_320px] gap-8',\n role === AppSurface.Article.role && 'p-4',\n role === AppSurface.Section.role && 'aspect-square',\n role === AppSurface.Section.role && showInfo && '@4xl:aspect-auto',\n )}\n >\n <Chessboard.Content>\n <Chessboard.Board classNames='border rounded-xs' orientation={orientation} />\n </Chessboard.Content>\n {showInfo && (\n <div className='hidden @4xl:flex flex-col justify-center items-center overflow-hidden'>\n <Chessboard.Info\n orientation={orientation}\n min={8}\n max={8}\n onOrientationChange={setOrientation}\n onClose={() => setShowInfo(false)}\n onSelect={handleSelect}\n />\n </div>\n )}\n </div>\n </Panel.Content>\n </Panel.Root>\n </Chessboard.Root>\n );\n};\n\nChessArticle.displayName = 'ChessArticle';\n"],"mappings":";;;;;;;;;;;;AAqBA,IAAa,gBAAgB,EAAE,MAAM,cAAiC;CACpE,MAAM,EAAE,MAAM,eAAe,KAAK,QAAQ,GAAG;CAC7C,MAAM,CAAC,aAAa,kBAAkB,SAAiB,OAAO;CAC9D,MAAM,CAAC,UAAU,eAAe,SAAS,IAAI;CAC7C,MAAM,aAAa,OAA6B,IAAI;CAEpD,MAAM,eAAe,aAA2D,UAAU;EACxF,WAAW,SAAS,cAAc,KAAK;CACzC,GAAG,CAAC,CAAC;CAEL,MAAM,QAAQ,IAAI,WAAW,MAAM,OAAO,OAAO,IAAI,UAAU,KAAA;CAC/D,MAAM,CAAC,OAAO,UAAU,OAAO,KAAK;CACpC,MAAM,CAAC,OAAO,UAAU,OAAO,KAAK;CAEpC,MAAM,oBAAoB;EACxB,IAAI,CAAC,OAAO,CAAC,KACX,OAAO;EAET,IAAI;GACF,MAAM,QAAQ,IAAI,QAAQ;GAC1B,IAAI,KACF,MAAM,QAAQ,GAAG;QACZ,IAAI,KACT,MAAM,KAAK,GAAG;GAEhB,OAAO,MAAM,WAAW;EAC1B,QAAQ;GACN,OAAO;EACT;CACF,EAAA,CAAG;CAEH,MAAM,gBAAgB,kBAAkB;EACtC,IAAI,CAAC,OACH;EAEF,IAAI,OAAO,QAAQ,UAAU;GAC3B,MAAM,MAAM,KAAA;GACZ,MAAM,MAAM,KAAA;EACd,CAAC;CACH,GAAG,CAAC,KAAK,CAAC;CAEV,IAAI,CAAC,OACH,OAAO;CAGT,OACE,oBAAC,WAAW,MAAZ;EAAwB;EAAO,KAAK;YAClC,qBAAC,MAAM,MAAP;GAAkB;GAAM,YAAW;aAAnC,CACE,oBAAC,MAAM,SAAP;IAAe,SAAA;cACb,qBAAC,QAAQ,MAAT,EAAA,UAAA;KACG,cAAc,oBAAC,QAAQ,QAAT;MAAgB,SAAS;gBAAgB,EAAE,iBAAiB;KAAkB,CAAA;KAC7F,oBAAC,OAAD,EAAK,WAAU,OAAQ,CAAA;KACvB,oBAAC,QAAQ,YAAT;MACE,MAAK;MACL,UAAA;MACA,OAAO,EAAE,oBAAoB;MAC7B,YAAY,GAAG,wBAAwB;MACvC,eAAe,aAAa,SAAS,CAAC,IAAI;KAC3C,CAAA;IACW,EAAA,CAAA;GACD,CAAA,GACf,oBAAC,MAAM,SAAP,EAAA,UACE,qBAAC,OAAD;IACE,WAAW,GACT,sBACA,YAAY,oCACZ,SAAS,WAAW,QAAQ,QAAQ,OACpC,SAAS,WAAW,QAAQ,QAAQ,iBACpC,SAAS,WAAW,QAAQ,QAAQ,YAAY,kBAClD;cAPF,CASE,oBAAC,WAAW,SAAZ,EAAA,UACE,oBAAC,WAAW,OAAZ;KAAkB,YAAW;KAAiC;IAAc,CAAA,EAC1D,CAAA,GACnB,YACC,oBAAC,OAAD;KAAK,WAAU;eACb,oBAAC,WAAW,MAAZ;MACe;MACb,KAAK;MACL,KAAK;MACL,qBAAqB;MACrB,eAAe,YAAY,KAAK;MAChC,UAAU;KACX,CAAA;IACE,CAAA,CAEJ;MACQ,CAAA,CACL;;CACG,CAAA;AAErB;AAEA,aAAa,cAAc"}
1
+ {"version":3,"file":"chunk-ChessArticle.mjs","names":[],"sources":["../../src/containers/ChessArticle/ChessArticle.tsx"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport React, { useCallback, useRef, useState } from 'react';\n\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { Obj } from '@dxos/echo';\nimport { useObject } from '@dxos/echo-react';\nimport * as GameCapabilities from '@dxos/plugin-game/GameCapabilities';\nimport { Panel, Toolbar, useTranslation } from '@dxos/react-ui';\nimport { type Player } from '@dxos/react-ui-gameboard';\nimport { mx } from '@dxos/ui-theme';\n\nimport { Chessboard, type ChessboardController, type ChessboardInfoProps } from '#components';\nimport { meta } from '#meta';\n\nimport * as Chess from '../../types/Chess';\n\nexport type ChessArticleProps = GameCapabilities.GameVariantSurfaceProps;\n\nexport const ChessArticle = ({ role, variant }: ChessArticleProps) => {\n const { t } = useTranslation(meta.profile.key);\n const [orientation, setOrientation] = useState<Player>('white');\n const [showInfo, setShowInfo] = useState(true);\n const controller = useRef<ChessboardController>(null);\n\n const handleSelect = useCallback<NonNullable<ChessboardInfoProps['onSelect']>>((index) => {\n controller.current?.setMoveNumber(index);\n }, []);\n\n const state = Obj.instanceOf(Chess.State, variant) ? variant : undefined;\n const [pgn] = useObject(state, 'pgn');\n const [fen] = useObject(state, 'fen');\n\n const isGameOver = (() => {\n if (!pgn && !fen) {\n return false;\n }\n try {\n const chess = new ChessJS();\n if (pgn) {\n chess.loadPgn(pgn);\n } else if (fen) {\n chess.load(fen);\n }\n return chess.isGameOver();\n } catch {\n return false;\n }\n })();\n\n const handleNewGame = useCallback(() => {\n if (!state) {\n return;\n }\n Obj.update(state, (state) => {\n state.pgn = undefined;\n state.fen = undefined;\n });\n }, [state]);\n\n if (!state) {\n return null;\n }\n\n return (\n <Chessboard.Root state={state} ref={controller}>\n <Panel.Root role={role} classNames='@container'>\n <Panel.Toolbar asChild>\n <Toolbar.Root>\n {isGameOver && <Toolbar.Button onClick={handleNewGame}>{t('new-game.button')}</Toolbar.Button>}\n <div className='grow' />\n <Toolbar.IconButton\n icon='ph--info--regular'\n iconOnly\n label={t('toggle-info.button')}\n classNames={mx('invisible @4xl:visible')}\n onClick={() => setShowInfo((open) => !open)}\n />\n </Toolbar.Root>\n </Panel.Toolbar>\n <Panel.Content>\n <div\n className={mx(\n 'grid h-full w-full',\n showInfo && '@4xl:grid-cols-[1fr_320px] gap-8',\n role === AppSurface.Article.role && 'p-4',\n role === AppSurface.Section.role && 'aspect-square',\n role === AppSurface.Section.role && showInfo && '@4xl:aspect-auto',\n )}\n >\n <Chessboard.Content>\n <Chessboard.Board classNames='border rounded-xs' orientation={orientation} />\n </Chessboard.Content>\n {showInfo && (\n <div className='hidden @4xl:flex flex-col justify-center items-center overflow-hidden'>\n <Chessboard.Info\n orientation={orientation}\n min={8}\n max={8}\n onOrientationChange={setOrientation}\n onClose={() => setShowInfo(false)}\n onSelect={handleSelect}\n />\n </div>\n )}\n </div>\n </Panel.Content>\n </Panel.Root>\n </Chessboard.Root>\n );\n};\n\nChessArticle.displayName = 'ChessArticle';\n"],"mappings":";;;;;;;;;;;;AAsBA,IAAa,gBAAgB,EAAE,MAAM,cAAiC;CACpE,MAAM,EAAE,MAAM,eAAe,KAAK,QAAQ,GAAG;CAC7C,MAAM,CAAC,aAAa,kBAAkB,SAAiB,OAAO;CAC9D,MAAM,CAAC,UAAU,eAAe,SAAS,IAAI;CAC7C,MAAM,aAAa,OAA6B,IAAI;CAEpD,MAAM,eAAe,aAA2D,UAAU;EACxF,WAAW,SAAS,cAAc,KAAK;CACzC,GAAG,CAAC,CAAC;CAEL,MAAM,QAAQ,IAAI,WAAW,OAAa,OAAO,IAAI,UAAU,KAAA;CAC/D,MAAM,CAAC,OAAO,UAAU,OAAO,KAAK;CACpC,MAAM,CAAC,OAAO,UAAU,OAAO,KAAK;CAEpC,MAAM,oBAAoB;EACxB,IAAI,CAAC,OAAO,CAAC,KACX,OAAO;EAET,IAAI;GACF,MAAM,QAAQ,IAAI,MAAQ;GAC1B,IAAI,KACF,MAAM,QAAQ,GAAG;QACZ,IAAI,KACT,MAAM,KAAK,GAAG;GAEhB,OAAO,MAAM,WAAW;EAC1B,QAAQ;GACN,OAAO;EACT;CACF,EAAA,CAAG;CAEH,MAAM,gBAAgB,kBAAkB;EACtC,IAAI,CAAC,OACH;EAEF,IAAI,OAAO,QAAQ,UAAU;GAC3B,MAAM,MAAM,KAAA;GACZ,MAAM,MAAM,KAAA;EACd,CAAC;CACH,GAAG,CAAC,KAAK,CAAC;CAEV,IAAI,CAAC,OACH,OAAO;CAGT,OACE,oBAAC,WAAW,MAAZ;EAAwB;EAAO,KAAK;YAClC,qBAAC,MAAM,MAAP;GAAkB;GAAM,YAAW;aAAnC,CACE,oBAAC,MAAM,SAAP;IAAe,SAAA;cACb,qBAAC,QAAQ,MAAT,EAAA,UAAA;KACG,cAAc,oBAAC,QAAQ,QAAT;MAAgB,SAAS;gBAAgB,EAAE,iBAAiB;KAAkB,CAAA;KAC7F,oBAAC,OAAD,EAAK,WAAU,OAAQ,CAAA;KACvB,oBAAC,QAAQ,YAAT;MACE,MAAK;MACL,UAAA;MACA,OAAO,EAAE,oBAAoB;MAC7B,YAAY,GAAG,wBAAwB;MACvC,eAAe,aAAa,SAAS,CAAC,IAAI;KAC3C,CAAA;IACW,EAAA,CAAA;GACD,CAAA,GACf,oBAAC,MAAM,SAAP,EAAA,UACE,qBAAC,OAAD;IACE,WAAW,GACT,sBACA,YAAY,oCACZ,SAAS,WAAW,QAAQ,QAAQ,OACpC,SAAS,WAAW,QAAQ,QAAQ,iBACpC,SAAS,WAAW,QAAQ,QAAQ,YAAY,kBAClD;cAPF,CASE,oBAAC,WAAW,SAAZ,EAAA,UACE,oBAAC,WAAW,OAAZ;KAAkB,YAAW;KAAiC;IAAc,CAAA,EAC1D,CAAA,GACnB,YACC,oBAAC,OAAD;KAAK,WAAU;eACb,oBAAC,WAAW,MAAZ;MACe;MACb,KAAK;MACL,KAAK;MACL,qBAAqB;MACrB,eAAe,YAAY,KAAK;MAChC,UAAU;KACX,CAAA;IACE,CAAA,CAEJ;MACQ,CAAA,CACL;;CACG,CAAA;AAErB;AAEA,aAAa,cAAc"}
@@ -1,4 +1,4 @@
1
- import { Chess } from "#types";
1
+ import { State } from "./Chess.mjs";
2
2
  import { Obj } from "@dxos/echo";
3
3
  import "react";
4
4
  import { Card } from "@dxos/react-ui";
@@ -6,7 +6,7 @@ import { jsx } from "react/jsx-runtime";
6
6
  import { Chessboard } from "#components";
7
7
  //#region src/containers/ChessCard/ChessCard.tsx
8
8
  var ChessCard = ({ variant }) => {
9
- if (!Obj.instanceOf(Chess.State, variant)) return null;
9
+ if (!Obj.instanceOf(State, variant)) return null;
10
10
  return /* @__PURE__ */ jsx(Card.Body, { children: /* @__PURE__ */ jsx(Card.Section, {
11
11
  classNames: "aspect-square",
12
12
  children: /* @__PURE__ */ jsx(Card.Row, {
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-ChessCard.mjs","names":[],"sources":["../../src/containers/ChessCard/ChessCard.tsx"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport { type GameVariantSurfaceProps } from '@dxos/plugin-game/types';\nimport { Card } from '@dxos/react-ui';\n\nimport { Chessboard } from '#components';\nimport { Chess } from '#types';\n\nexport type ChessCardProps = GameVariantSurfaceProps;\n\nexport const ChessCard = ({ variant }: ChessCardProps) => {\n if (!Obj.instanceOf(Chess.State, variant)) {\n return null;\n }\n\n return (\n <Card.Body>\n <Card.Section classNames='aspect-square'>\n <Card.Row fullWidth>\n <Chessboard.Root state={variant}>\n <Chessboard.Content>\n <Chessboard.Board />\n </Chessboard.Content>\n </Chessboard.Root>\n </Card.Row>\n </Card.Section>\n </Card.Body>\n );\n};\n\nChessCard.displayName = 'ChessCard';\n"],"mappings":";;;;;;;AAeA,IAAa,aAAa,EAAE,cAA8B;CACxD,IAAI,CAAC,IAAI,WAAW,MAAM,OAAO,OAAO,GACtC,OAAO;CAGT,OACE,oBAAC,KAAK,MAAN,EAAA,UACE,oBAAC,KAAK,SAAN;EAAc,YAAW;YACvB,oBAAC,KAAK,KAAN;GAAU,WAAA;aACR,oBAAC,WAAW,MAAZ;IAAiB,OAAO;cACtB,oBAAC,WAAW,SAAZ,EAAA,UACE,oBAAC,WAAW,OAAZ,CAAmB,CAAA,EACD,CAAA;GACL,CAAA;EACT,CAAA;CACE,CAAA,EACL,CAAA;AAEf;AAEA,UAAU,cAAc"}
1
+ {"version":3,"file":"chunk-ChessCard.mjs","names":[],"sources":["../../src/containers/ChessCard/ChessCard.tsx"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport * as GameCapabilities from '@dxos/plugin-game/GameCapabilities';\nimport { Card } from '@dxos/react-ui';\n\nimport { Chessboard } from '#components';\n\nimport * as Chess from '../../types/Chess';\n\nexport type ChessCardProps = GameCapabilities.GameVariantSurfaceProps;\n\nexport const ChessCard = ({ variant }: ChessCardProps) => {\n if (!Obj.instanceOf(Chess.State, variant)) {\n return null;\n }\n\n return (\n <Card.Body>\n <Card.Section classNames='aspect-square'>\n <Card.Row fullWidth>\n <Chessboard.Root state={variant}>\n <Chessboard.Content>\n <Chessboard.Board />\n </Chessboard.Content>\n </Chessboard.Root>\n </Card.Row>\n </Card.Section>\n </Card.Body>\n );\n};\n\nChessCard.displayName = 'ChessCard';\n"],"mappings":";;;;;;;AAgBA,IAAa,aAAa,EAAE,cAA8B;CACxD,IAAI,CAAC,IAAI,WAAW,OAAa,OAAO,GACtC,OAAO;CAGT,OACE,oBAAC,KAAK,MAAN,EAAA,UACE,oBAAC,KAAK,SAAN;EAAc,YAAW;YACvB,oBAAC,KAAK,KAAN;GAAU,WAAA;aACR,oBAAC,WAAW,MAAZ;IAAiB,OAAO;cACtB,oBAAC,WAAW,SAAZ,EAAA,UACE,oBAAC,WAAW,OAAZ,CAAmB,CAAA,EACD,CAAA;GACL,CAAA;EACT,CAAA;CACE,CAAA,EACL,CAAA;AAEf;AAEA,UAAU,cAAc"}
@@ -1,25 +1,23 @@
1
- import { Chess, ChessPositionIndex, PlayerReview } from "#types";
2
- import { Plugin } from "@dxos/app-framework";
3
- import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
4
- import { GameVariant, OperationHandler, SkillDefinition } from "#capabilities";
1
+ import { State } from "./Chess.mjs";
2
+ import { PositionIndex } from "./ChessPositionIndex.mjs";
3
+ import { Review } from "./PlayerReview.mjs";
4
+ import * as Plugin from "@dxos/app-framework/Plugin";
5
5
  import { meta } from "#meta";
6
+ import * as AppCapability from "@dxos/app-toolkit/AppCapability";
7
+ import { GameVariant, OperationHandler, SkillDefinition } from "#capabilities";
6
8
  import { translations } from "#translations";
7
9
  //#endregion
8
10
  //#region src/ChessPlugin.tsx
9
- var ChessPlugin = Plugin.define(meta).pipe(Plugin.addModule({
10
- id: "game-variant",
11
- activatesOn: AppActivationEvents.SetupSchema,
12
- activate: GameVariant
13
- }), AppPlugin.addSkillDefinitionModule({ activate: SkillDefinition }), AppPlugin.addOperationHandlerModule({ activate: OperationHandler }), AppPlugin.addPluginAssetModule({ asset: {
11
+ var ChessPlugin = Plugin.define(meta).pipe(Plugin.addModule(GameVariant), Plugin.addModule(SkillDefinition), Plugin.addModule(OperationHandler), Plugin.addModule(AppCapability.pluginAsset({
14
12
  pluginId: meta.profile.key,
15
13
  path: "PLUGIN.mdl",
16
14
  content: "---\nid: org.dxos.plugin.chess\nname: ChessPlugin\nversion: 0.1.0\n---\n\nA two-player chess game plugin for `DXOS` Composer.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|--------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n| `service` | `org.dxos.mdl.service@1.0` |\n\n## Types\n\n```mdl\ntype Color\n literals: white | black\n```\n\n```mdl\ntype PieceKind\n literals: pawn | rook | knight | bishop | queen | king\n```\n\n```mdl\ntype Piece\n fields:\n kind: PieceKind\n color: Color\n```\n\n```mdl\ntype Square\n fields:\n file: a | b | c | d | e | f | g | h\n rank: 1..8\n piece?: Piece\n```\n\n```mdl\ntype Move\n fields:\n from: Square\n to: Square\n promotion?: PieceKind # only valid for pawn reaching back rank\n```\n\n```mdl\ntype Board\n fields:\n squares: Square[8][8]\n turn: Color\n status: playing | check | checkmate | stalemate\n moves: Move[] # full move history\n```\n\n```mdl\ntype Player\n fields:\n id: string\n name: string\n color: Color\n```\n\n```mdl\ntype GameStatus\n literals: waiting | active | finished\n```\n\n```mdl\ntype Game\n fields:\n id: string\n players: Player[2]\n board: Board\n status: GameStatus\n winner?: Player\n```\n\n## Components\n\n```mdl\ncomponent Lobby\n desc: Entry point where players create or join a game.\n props:\n playerId: string\n state:\n games: Game[] # list of open/active games\n selected?: Game\n slots:\n header?: ReactNode\n empty?: ReactNode # shown when games list is empty\n actions:\n createGame() → Game\n joinGame(game: Game) → Game\n spectate(game: Game)\n emits:\n onJoin(game: Game)\n layout: |\n ┌─────────────────────────┐\n │ [header slot] │\n ├─────────────────────────┤\n │ Game list │\n │ ┌───────────────────┐ │\n │ │ game row │ │\n │ └───────────────────┘ │\n │ [empty slot] │\n ├─────────────────────────┤\n │ [Create Game] │\n └─────────────────────────┘\n```\n\n```mdl\ncomponent Gameboard\n desc: Interactive chess board for an active game.\n props:\n game: Game\n playerId: string # identifies which side the viewer plays\n state:\n selected?: Square # currently selected square\n highlights: Square[] # legal move targets for selected piece\n perspective: Color # which side is at the bottom (default: player's color)\n slots:\n toolbar?: ReactNode\n sidebar?: ReactNode\n overlay?: ReactNode # e.g. checkmate / promotion dialogs\n actions:\n selectSquare(square: Square)\n submitMove(move: Move)\n flipBoard()\n emits:\n onMove(move: Move)\n onResign()\n layout: |\n ┌─────────────────────────┐\n │ [toolbar slot] │\n ├──────────┬──────────────┤\n │ │ [sidebar] │\n │ 8×8 │ │\n │ board │ move history │\n │ │ │\n ├──────────┴──────────────┤\n │ [overlay slot] │\n └─────────────────────────┘\n```\n\n## Services\n\n```mdl\nservice ChessEngine\n desc: Validates moves and computes game state. May be local (WASM) or remote.\n loading: lazy\n ops:\n validate(board: Board, move: Move) → Move\n legalMoves(board: Board, square: Square) → Square[]\n applyMove(board: Board, move: Move) → Board\n errors:\n EngineNotReady: engine has not finished loading\n```\n\n```mdl\nservice GameStore\n desc: Persists and replicates Game state via ECHO.\n ops:\n create(white: Player, black: Player) → Game\n load(id: string) → Game\n save(game: Game) → Game\n list() → Game[]\n effects: [echo:write, echo:read]\n```\n\n## Operations\n\nPure operations (no effects, no service dependencies) — safe to call anywhere.\n\n```mdl\nop getLegalMoves\n desc: Returns legal target squares for the piece on the given square.\n input:\n board: Board\n square: Square\n output: Square[]\n errors:\n EmptySquare: no piece on square\n WrongSide: piece does not belong to the active side\n requires: [ChessEngine]\n```\n\n```mdl\nop validateMove\n desc: Checks a move against chess rules without mutating state.\n input:\n board: Board\n move: Move\n output: Move\n errors:\n IllegalMove: move violates chess rules\n WrongTurn: piece does not belong to the active side\n GameOver: game has already ended\n requires: [ChessEngine]\n```\n\n```mdl\nop applyMove\n desc: Applies a validated move and returns the next board state.\n input:\n board: Board\n move: Move # must be pre-validated\n output: Board\n requires: [ChessEngine]\n note: does not persist; use submitMove for the full transactional flow\n```\n\nEffectful operations — mutate persistent state.\n\n```mdl\nop startGame\n desc: Creates a new Game with two players and an initial Board.\n input:\n white: Player\n black: Player\n output: Game\n effects: [echo:write]\n requires: [GameStore]\n```\n\n```mdl\nop submitMove\n desc: Validates and applies a move, then persists the updated Game.\n input:\n game: Game\n player: Player\n move: Move\n output: Game\n errors:\n WrongTurn: player is not the active side\n IllegalMove: move violates chess rules\n GameOver: game has already ended\n effects: [echo:write]\n requires: [ChessEngine, GameStore]\n note: |\n Composes validateMove → applyMove → GameStore.save.\n Atomic: Game is not persisted if validation fails.\n```\n\n```mdl\nop resignGame\n desc: Player forfeits; opponent wins.\n input:\n game: Game\n player: Player\n output: Game # Game.status === finished, Game.winner set\n errors:\n GameOver: game has already ended\n effects: [echo:write]\n requires: [GameStore]\n```\n\n## Features\n\n```mdl\nfeat F-1: Start Game\n\n req F-1.1: New Board created with pieces in standard starting positions.\n req F-1.2: White moves first.\n```\n\n```mdl\nfeat F-2: Make Move\n\n req F-2.1:\n when: player submits a Move on their turn\n then: Move validated against chess rules\n errors: [InvalidMove, WrongTurn, GameOver]\n\n req F-2.2:\n when: Move is valid\n then: Board updated; turn advances to opponent\n\n req F-2.3:\n when: resulting position leaves opponent's king in check\n then: Board.status set to check\n\n req F-2.4:\n when: no legal moves remain for the side to move\n then: Board.status set to checkmate (if in check) or stalemate\n```\n\n```mdl\nfeat F-3: Lobby\n\n req F-3.1: Player sees list of open games on entering the Lobby.\n req F-3.2:\n when: player creates a game\n then: new Game created with status waiting; player assigned white\n\n req F-3.3:\n when: second player joins an open game\n then: Game.status transitions to active; joining player assigned black\n\n req F-3.4:\n when: Game.status becomes active\n then: both players navigated to Gameboard\n```\n\n```mdl\nfeat F-4: Gameboard\n\n req F-4.1:\n when: player selects a square containing their piece\n then: legal move targets highlighted on board\n\n req F-4.2:\n when: player selects a highlighted target square\n then: Move submitted via submitMove(); board updated on success\n\n req F-4.3:\n when: pawn reaches the back rank\n then: promotion dialog shown via overlay slot; player selects piece kind\n\n req F-4.4:\n when: Game.status is finished\n then: result overlay shown (winner or draw); further moves disabled\n```\n\n```mdl\nfeat F-5: Move Validation\n\n req F-5.1:\n when: Gameboard calls submitMove\n then: op:validateMove runs before any state change\n\n req F-5.2:\n when: validation fails\n then: error returned to caller; Game state unchanged\n\n req F-5.3:\n when: square is selected on Gameboard\n then: op:getLegalMoves called; results drive component:Gameboard.highlights\n```\n\n```mdl\nfeat F-6: Game Persistence\n\n req F-6.1:\n when: op:startGame completes\n then: Game written to ECHO and visible in component:Lobby game list\n\n req F-6.2:\n when: op:submitMove completes\n then: updated Game replicated to all peers via ECHO\n\n req F-6.3:\n when: peer receives a Game update\n then: component:Gameboard re-renders with new Board state\n tags: [collaborative]\n```\n\n## Acceptance\n\n```mdl\ntest T-1: New game starting position\n given: a new game is started\n then:\n - Board.turn === white\n - Board.status === playing\n - each player has 16 pieces in standard positions\n```\n\n```mdl\ntest T-2: Illegal move rejected\n given: it is white's turn\n when: white attempts to move a black piece\n then: WrongTurn error; Board unchanged\n```\n\n```mdl\ntest T-3: Create and join game\n given: two players are in the Lobby\n when: player A creates a game, player B joins it\n then:\n - Game.status === active\n - Game.players[0].color === white # creator\n - Game.players[1].color === black # joiner\n - both players see the Gameboard\n```\n\n```mdl\ntest T-4: Legal move highlight\n given: Gameboard is shown, it is white's turn\n when: white selects the e2 pawn\n then:\n - squares e3 and e4 are highlighted\n - no other squares are highlighted\n```\n\n```mdl\ntest T-5: Pawn promotion\n given: white pawn is on e7, it is white's turn\n when: white moves pawn to e8\n then:\n - promotion overlay appears\n - after player selects queen, Move recorded with promotion: queen\n - board shows white queen on e8\n```\n\n```mdl\ntest T-6: Submit valid move\n given: active game, white's turn, white player logged in\n when: white submits pawn e2→e4\n then:\n - op:validateMove returns move without error\n - Board updated: e4 occupied by white pawn, e2 empty\n - Game.board.turn === black\n - Game persisted to ECHO\n```\n\n```mdl\ntest T-7: Submit invalid move rejected atomically\n given: active game, white's turn\n when: white submits an illegal move (e2→e5)\n then:\n - IllegalMove error returned\n - Game.board unchanged\n - no ECHO write occurs\n```\n\n```mdl\ntest T-8: Legal moves highlighted\n given: new game, white's turn, Gameboard shown\n when: player selects e2\n then:\n - op:getLegalMoves returns [e3, e4]\n - Gameboard.highlights === [e3, e4]\n```\n\n---\n\n## Appendix: Extension Definitions\n\nExtension block types used in this document are defined below using\nthe core `ext` primitive — the only construct the base language provides.\n\n```mdl\next type\n uri: dxos.spec/ext/type@1.0\n desc: A named data structure with typed fields and optional literals.\n fields:\n desc?: Prose\n fields?: FieldMap # name[?]: TypeExpr (# inline comment)\n literals?: UnionList # a | b | c\n extends?: TypeRef[]\n```\n\n```mdl\next feat\n uri: dxos.spec/ext/feat@1.0\n desc: A named feature grouping one or more requirements.\n fields:\n desc?: Prose\n req: RequirementList\n nesting: self # feat blocks may contain feat blocks\n```\n\n```mdl\next test\n uri: dxos.spec/ext/test@1.0\n desc: An acceptance scenario expressed as given / when / then steps.\n fields:\n given?: Step | Step[]\n when?: Step | Step[]\n then: Step | Step[]\n tags?: TagList\n```\n\n```mdl\next component\n uri: org.dxos.mdl.component@1.0\n desc: A UI component with props, internal state, slots, actions, and events.\n fields:\n desc?: Prose\n props?: FieldMap # external inputs (immutable inside component)\n state?: FieldMap # internal reactive state\n slots?: FieldMap # named ReactNode injection points\n actions?: ActionMap # methods the component exposes or handles\n emits?: EventMap # events the component raises to its parent\n layout?: CodeBlock # ASCII sketch of visual structure (non-normative)\n```\n\n```mdl\next op\n uri: org.dxos.mdl.op@1.0\n desc: |\n A named operation with typed inputs, outputs, and declared errors.\n Pure ops have no effects or requires. Effectful ops declare both.\n fields:\n desc?: Prose\n input?: FieldMap # named input parameters\n output?: TypeExpr # return type\n errors?: ErrorMap # name: Prose (when this error occurs)\n effects?: EffectList # echo:read | echo:write | http | fs | ...\n requires?: ServiceList # injected service dependencies\n note?: Prose # implementation guidance (non-normative)\n```\n\n```mdl\next service\n uri: org.dxos.mdl.service@1.0\n desc: An external or system-level dependency providing named operations.\n fields:\n desc?: Prose\n loading?: eager | lazy\n ops?: OpMap # name(params) → ReturnType\n errors?: ErrorMap\n note?: Prose\n```\n",
17
15
  mimeType: "application/x-mdl"
18
- } }), AppPlugin.addSchemaModule({ schema: [
19
- Chess.State,
20
- ChessPositionIndex.PositionIndex,
21
- PlayerReview.Review
22
- ] }), AppPlugin.addTranslationsModule({ translations }), Plugin.make);
16
+ })), Plugin.addModule(AppCapability.schema([
17
+ State,
18
+ PositionIndex,
19
+ Review
20
+ ])), Plugin.addModule(AppCapability.translations(translations)), Plugin.make);
23
21
  //#endregion
24
22
  export { ChessPlugin as t };
25
23
 
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-ChessPlugin.mjs","names":[],"sources":["../../src/ChessPlugin.tsx"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';\n\nimport { GameVariant, OperationHandler, SkillDefinition } from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\nimport { Chess, ChessPositionIndex, PlayerReview } from '#types';\n\n// eslint-disable-next-line import/no-relative-packages\nimport pluginSpec from '../PLUGIN.mdl?raw';\n\nexport const ChessPlugin = Plugin.define(meta).pipe(\n Plugin.addModule({\n id: 'game-variant',\n activatesOn: AppActivationEvents.SetupSchema,\n activate: GameVariant,\n }),\n AppPlugin.addSkillDefinitionModule({ activate: SkillDefinition }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addPluginAssetModule({\n asset: { pluginId: meta.profile.key, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },\n }),\n AppPlugin.addSchemaModule({ schema: [Chess.State, ChessPositionIndex.PositionIndex, PlayerReview.Review] }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.make,\n);\n\nexport default ChessPlugin;\n"],"mappings":";;;;;;;;AAeA,IAAa,cAAc,OAAO,OAAO,IAAI,CAAC,CAAC,KAC7C,OAAO,UAAU;CACf,IAAI;CACJ,aAAa,oBAAoB;CACjC,UAAU;AACZ,CAAC,GACD,UAAU,yBAAyB,EAAE,UAAU,gBAAgB,CAAC,GAChE,UAAU,0BAA0B,EAAE,UAAU,iBAAiB,CAAC,GAClE,UAAU,qBAAqB,EAC7B,OAAO;CAAE,UAAU,KAAK,QAAQ;CAAK,MAAM;CAAc,SAAS;CAAY,UAAU;AAAoB,EAC9G,CAAC,GACD,UAAU,gBAAgB,EAAE,QAAQ;CAAC,MAAM;CAAO,mBAAmB;CAAe,aAAa;AAAM,EAAE,CAAC,GAC1G,UAAU,sBAAsB,EAAE,aAAa,CAAC,GAChD,OAAO,IACT"}
1
+ {"version":3,"file":"chunk-ChessPlugin.mjs","names":[],"sources":["../../src/ChessPlugin.tsx"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Plugin from '@dxos/app-framework/Plugin';\nimport * as AppCapability from '@dxos/app-toolkit/AppCapability';\n\nimport { GameVariant, OperationHandler, SkillDefinition } from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\n\n// eslint-disable-next-line import/no-relative-packages\nimport pluginSpec from '../PLUGIN.mdl?raw';\nimport * as Chess from './types/Chess';\nimport * as ChessPositionIndex from './types/ChessPositionIndex';\nimport * as PlayerReview from './types/PlayerReview';\n\nexport const ChessPlugin = Plugin.define(meta).pipe(\n Plugin.addModule(GameVariant),\n Plugin.addModule(SkillDefinition),\n Plugin.addModule(OperationHandler),\n Plugin.addModule(\n AppCapability.pluginAsset({\n pluginId: meta.profile.key,\n path: 'PLUGIN.mdl',\n content: pluginSpec,\n mimeType: 'application/x-mdl',\n }),\n ),\n Plugin.addModule(AppCapability.schema([Chess.State, ChessPositionIndex.PositionIndex, PlayerReview.Review])),\n Plugin.addModule(AppCapability.translations(translations)),\n Plugin.make,\n);\n\nexport default ChessPlugin;\n"],"mappings":";;;;;;;;;;AAiBA,IAAa,cAAc,OAAO,OAAO,IAAI,CAAC,CAAC,KAC7C,OAAO,UAAU,WAAW,GAC5B,OAAO,UAAU,eAAe,GAChC,OAAO,UAAU,gBAAgB,GACjC,OAAO,UACL,cAAc,YAAY;CACxB,UAAU,KAAK,QAAQ;CACvB,MAAM;CACN,SAAS;CACT,UAAU;AACZ,CAAC,CACH,GACA,OAAO,UAAU,cAAc,OAAO;CAAC;CAAa;CAAkC;AAAmB,CAAC,CAAC,GAC3G,OAAO,UAAU,cAAc,aAAa,YAAY,CAAC,GACzD,OAAO,IACT"}