@dxos/plugin-chess 0.9.0 → 0.9.1-staging.ee54ba693a

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 (109) hide show
  1. package/dist/lib/neutral/{ChessArticle-JHI5OXYR.mjs → ChessArticle-MPRT54KQ.mjs} +4 -3
  2. package/dist/lib/neutral/ChessArticle-MPRT54KQ.mjs.map +7 -0
  3. package/dist/lib/neutral/{ChessCard-4TUTIFB6.mjs → ChessCard-VJ3I6MIB.mjs} +8 -3
  4. package/dist/lib/neutral/ChessCard-VJ3I6MIB.mjs.map +7 -0
  5. package/dist/lib/neutral/ChessPlugin.mjs +1 -1
  6. package/dist/lib/neutral/ChessPlugin.node.mjs +3 -3
  7. package/dist/lib/neutral/ChessPlugin.node.mjs.map +3 -3
  8. package/dist/lib/neutral/capabilities/index.mjs +3 -3
  9. package/dist/lib/neutral/capabilities/index.mjs.map +3 -3
  10. package/dist/lib/neutral/{chunk-YB6WZOZI.mjs → chunk-AMXVX7V2.mjs} +2 -2
  11. package/dist/lib/neutral/{chunk-OYWDKJ5B.mjs → chunk-DXIET5G2.mjs} +12 -12
  12. package/dist/lib/neutral/chunk-DXIET5G2.mjs.map +7 -0
  13. package/dist/lib/neutral/{chunk-PJOAFP6S.mjs → chunk-EXZ3XFEG.mjs} +7 -7
  14. package/dist/lib/neutral/chunk-EXZ3XFEG.mjs.map +7 -0
  15. package/dist/lib/neutral/chunk-IKWULCKX.mjs +38 -0
  16. package/dist/lib/neutral/chunk-IKWULCKX.mjs.map +7 -0
  17. package/dist/lib/neutral/chunk-YZTKZ5F7.mjs +42 -0
  18. package/dist/lib/neutral/chunk-YZTKZ5F7.mjs.map +7 -0
  19. package/dist/lib/neutral/components/index.mjs +47 -46
  20. package/dist/lib/neutral/components/index.mjs.map +3 -3
  21. package/dist/lib/neutral/containers/index.mjs +2 -2
  22. package/dist/lib/neutral/index.mjs +5 -5
  23. package/dist/lib/neutral/meta.json +1 -1
  24. package/dist/lib/neutral/meta.mjs +1 -1
  25. package/dist/lib/neutral/{move-6NCMKKWD.mjs → move-UMDTQST4.mjs} +2 -2
  26. package/dist/lib/neutral/operations/index.mjs +1 -1
  27. package/dist/lib/neutral/{play-F5L5LFLW.mjs → play-7XTJZ4N6.mjs} +2 -2
  28. package/dist/lib/neutral/plugin.mjs +2 -2
  29. package/dist/lib/neutral/{print-GMSNKAS2.mjs → print-JR4VB3UX.mjs} +2 -2
  30. package/dist/lib/neutral/skill-definition-ZGQBUE4R.mjs +15 -0
  31. package/dist/lib/neutral/skill-definition-ZGQBUE4R.mjs.map +7 -0
  32. package/dist/lib/neutral/skills/index.mjs +8 -0
  33. package/dist/lib/neutral/testing.mjs +1 -1
  34. package/dist/lib/neutral/translations.mjs +1 -1
  35. package/dist/lib/neutral/translations.mjs.map +3 -3
  36. package/dist/lib/neutral/types/index.mjs +1 -1
  37. package/dist/types/dx.config.d.ts +28 -0
  38. package/dist/types/dx.config.d.ts.map +1 -0
  39. package/dist/types/src/capabilities/game-variant.d.ts +1 -2
  40. package/dist/types/src/capabilities/game-variant.d.ts.map +1 -1
  41. package/dist/types/src/capabilities/index.d.ts +2 -3
  42. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  43. package/dist/types/src/capabilities/skill-definition.d.ts +5 -0
  44. package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -0
  45. package/dist/types/src/components/Chessboard/Chessboard.d.ts +1 -1
  46. package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -1
  47. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +2 -2
  48. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -1
  49. package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -1
  50. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts +2 -2
  51. package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -1
  52. package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -1
  53. package/dist/types/src/index.d.ts +1 -1
  54. package/dist/types/src/index.d.ts.map +1 -1
  55. package/dist/types/src/meta.d.ts +32 -2
  56. package/dist/types/src/meta.d.ts.map +1 -1
  57. package/dist/types/src/skills/chess-skill.d.ts +4 -0
  58. package/dist/types/src/skills/chess-skill.d.ts.map +1 -0
  59. package/dist/types/src/skills/index.d.ts +2 -0
  60. package/dist/types/src/skills/index.d.ts.map +1 -0
  61. package/dist/types/src/types/Chess.d.ts +8 -7
  62. package/dist/types/src/types/Chess.d.ts.map +1 -1
  63. package/dist/types/src/types/ChessOperation.d.ts +2 -8
  64. package/dist/types/src/types/ChessOperation.d.ts.map +1 -1
  65. package/dist/types/tsconfig.tsbuildinfo +1 -1
  66. package/dx.config.ts +24 -0
  67. package/package.json +39 -38
  68. package/src/ChessPlugin.node.ts +2 -2
  69. package/src/ChessPlugin.test.ts +2 -2
  70. package/src/ChessPlugin.tsx +4 -4
  71. package/src/capabilities/index.ts +1 -7
  72. package/src/capabilities/skill-definition.ts +14 -0
  73. package/src/components/Chessboard/Chessboard.stories.tsx +2 -2
  74. package/src/components/Chessboard/Chessboard.tsx +47 -45
  75. package/src/components/Chessboard/Info.tsx +5 -3
  76. package/src/containers/ChessArticle/ChessArticle.stories.tsx +2 -2
  77. package/src/containers/ChessArticle/ChessArticle.tsx +5 -4
  78. package/src/containers/ChessCard/ChessCard.stories.tsx +1 -1
  79. package/src/containers/ChessCard/ChessCard.tsx +12 -5
  80. package/src/index.ts +1 -1
  81. package/src/meta.ts +3 -19
  82. package/src/{blueprints/chess-blueprint.ts → skills/chess-skill.ts} +11 -7
  83. package/src/skills/index.ts +5 -0
  84. package/src/translations.ts +1 -1
  85. package/src/types/Chess.ts +21 -22
  86. package/dist/lib/neutral/ChessArticle-JHI5OXYR.mjs.map +0 -7
  87. package/dist/lib/neutral/ChessCard-4TUTIFB6.mjs.map +0 -7
  88. package/dist/lib/neutral/blueprint-definition-4MOWVVWD.mjs +0 -15
  89. package/dist/lib/neutral/blueprint-definition-4MOWVVWD.mjs.map +0 -7
  90. package/dist/lib/neutral/blueprints/index.mjs +0 -8
  91. package/dist/lib/neutral/chunk-7XZ4CRDL.mjs +0 -32
  92. package/dist/lib/neutral/chunk-7XZ4CRDL.mjs.map +0 -7
  93. package/dist/lib/neutral/chunk-OYWDKJ5B.mjs.map +0 -7
  94. package/dist/lib/neutral/chunk-PJOAFP6S.mjs.map +0 -7
  95. package/dist/lib/neutral/chunk-XWKNXG62.mjs +0 -34
  96. package/dist/lib/neutral/chunk-XWKNXG62.mjs.map +0 -7
  97. package/dist/types/src/blueprints/chess-blueprint.d.ts +0 -4
  98. package/dist/types/src/blueprints/chess-blueprint.d.ts.map +0 -1
  99. package/dist/types/src/blueprints/index.d.ts +0 -2
  100. package/dist/types/src/blueprints/index.d.ts.map +0 -1
  101. package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -6
  102. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
  103. package/src/blueprints/index.ts +0 -5
  104. package/src/capabilities/blueprint-definition.ts +0 -19
  105. /package/dist/lib/neutral/{chunk-YB6WZOZI.mjs.map → chunk-AMXVX7V2.mjs.map} +0 -0
  106. /package/dist/lib/neutral/{move-6NCMKKWD.mjs.map → move-UMDTQST4.mjs.map} +0 -0
  107. /package/dist/lib/neutral/{play-F5L5LFLW.mjs.map → play-7XTJZ4N6.mjs.map} +0 -0
  108. /package/dist/lib/neutral/{print-GMSNKAS2.mjs.map → print-JR4VB3UX.mjs.map} +0 -0
  109. /package/dist/lib/neutral/{blueprints → skills}/index.mjs.map +0 -0
@@ -3,6 +3,7 @@ import "./chunk-J5LGTIGS.mjs";
3
3
  // src/containers/ChessArticle/ChessArticle.tsx
4
4
  import { Chess as ChessJS } from "chess.js";
5
5
  import React, { useCallback, useRef, useState } from "react";
6
+ import { AppSurface } from "@dxos/app-toolkit/ui";
6
7
  import { Obj } from "@dxos/echo";
7
8
  import { Panel, Toolbar, useTranslation } from "@dxos/react-ui";
8
9
  import { mx } from "@dxos/ui-theme";
@@ -10,7 +11,7 @@ import { Chessboard } from "#components";
10
11
  import { meta } from "#meta";
11
12
  import { Chess } from "#types";
12
13
  var ChessArticle = ({ role, variant }) => {
13
- const { t } = useTranslation(meta.id);
14
+ const { t } = useTranslation(meta.profile.key);
14
15
  const [orientation, setOrientation] = useState("white");
15
16
  const [showInfo, setShowInfo] = useState(true);
16
17
  const controller = useRef(null);
@@ -67,7 +68,7 @@ var ChessArticle = ({ role, variant }) => {
67
68
  classNames: mx("invisible @4xl:visible"),
68
69
  onClick: () => setShowInfo((open) => !open)
69
70
  }))), /* @__PURE__ */ React.createElement(Panel.Content, null, /* @__PURE__ */ React.createElement("div", {
70
- className: mx("grid h-full w-full", showInfo && "@4xl:grid-cols-[1fr_320px] gap-8", role === "article" && "p-4", role === "section" && "aspect-square", role === "section" && showInfo && "@4xl:aspect-auto")
71
+ className: mx("grid h-full w-full", showInfo && "@4xl:grid-cols-[1fr_320px] gap-8", role === AppSurface.Article.role && "p-4", role === AppSurface.Section.role && "aspect-square", role === AppSurface.Section.role && showInfo && "@4xl:aspect-auto")
71
72
  }, /* @__PURE__ */ React.createElement(Chessboard.Content, null, /* @__PURE__ */ React.createElement(Chessboard.Board, {
72
73
  classNames: "border rounded-xs",
73
74
  orientation
@@ -85,4 +86,4 @@ var ChessArticle = ({ role, variant }) => {
85
86
  export {
86
87
  ChessArticle as default
87
88
  };
88
- //# sourceMappingURL=ChessArticle-JHI5OXYR.mjs.map
89
+ //# sourceMappingURL=ChessArticle-MPRT54KQ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/ChessArticle/ChessArticle.tsx"],
4
+ "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 { 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 isGameOver = (() => {\n if (!Obj.instanceOf(Chess.State, variant) || (!variant.pgn && !variant.fen)) {\n return false;\n }\n try {\n const chess = new ChessJS();\n if (variant.pgn) {\n chess.loadPgn(variant.pgn);\n } else if (variant.fen) {\n chess.load(variant.fen);\n }\n return chess.isGameOver();\n } catch {\n return false;\n }\n })();\n\n const handleNewGame = useCallback(() => {\n if (!Obj.instanceOf(Chess.State, variant)) {\n return;\n }\n Obj.update(variant, (variant) => {\n const mutable = variant as Obj.Mutable<typeof variant>;\n mutable.pgn = undefined;\n mutable.fen = undefined;\n });\n }, [variant]);\n\n if (!Obj.instanceOf(Chess.State, variant)) {\n return null;\n }\n\n return (\n <Chessboard.Root state={variant} 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"],
5
+ "mappings": ";;;AAIA,SAASA,SAASC,eAAe;AACjC,OAAOC,SAASC,aAAaC,QAAQC,gBAAgB;AAErD,SAASC,kBAAkB;AAC3B,SAASC,WAAW;AAEpB,SAASC,OAAOC,SAASC,sBAAsB;AAE/C,SAASC,UAAU;AAEnB,SAASC,kBAAuE;AAChF,SAASC,YAAY;AACrB,SAASb,aAAa;AAIf,IAAMc,eAAe,CAAC,EAAEC,MAAMC,QAAO,MAAqB;AAC/D,QAAM,EAAEC,EAAC,IAAKP,eAAeG,KAAKK,QAAQC,GAAG;AAC7C,QAAM,CAACC,aAAaC,cAAAA,IAAkBhB,SAAiB,OAAA;AACvD,QAAM,CAACiB,UAAUC,WAAAA,IAAelB,SAAS,IAAA;AACzC,QAAMmB,aAAapB,OAA6B,IAAA;AAEhD,QAAMqB,eAAetB,YAA0D,CAACuB,UAAAA;AAC9EF,eAAWG,SAASC,cAAcF,KAAAA;EACpC,GAAG,CAAA,CAAE;AAEL,QAAMG,cAAc,MAAA;AAClB,QAAI,CAACtB,IAAIuB,WAAW9B,MAAM+B,OAAOf,OAAAA,KAAa,CAACA,QAAQgB,OAAO,CAAChB,QAAQiB,KAAM;AAC3E,aAAO;IACT;AACA,QAAI;AACF,YAAMC,QAAQ,IAAIjC,QAAAA;AAClB,UAAIe,QAAQgB,KAAK;AACfE,cAAMC,QAAQnB,QAAQgB,GAAG;MAC3B,WAAWhB,QAAQiB,KAAK;AACtBC,cAAME,KAAKpB,QAAQiB,GAAG;MACxB;AACA,aAAOC,MAAML,WAAU;IACzB,QAAQ;AACN,aAAO;IACT;EACF,GAAA;AAEA,QAAMQ,gBAAgBlC,YAAY,MAAA;AAChC,QAAI,CAACI,IAAIuB,WAAW9B,MAAM+B,OAAOf,OAAAA,GAAU;AACzC;IACF;AACAT,QAAI+B,OAAOtB,SAAS,CAACA,aAAAA;AACnB,YAAMuB,UAAUvB;AAChBuB,cAAQP,MAAMQ;AACdD,cAAQN,MAAMO;IAChB,CAAA;EACF,GAAG;IAACxB;GAAQ;AAEZ,MAAI,CAACT,IAAIuB,WAAW9B,MAAM+B,OAAOf,OAAAA,GAAU;AACzC,WAAO;EACT;AAEA,SACE,sBAAA,cAACJ,WAAW6B,MAAI;IAACC,OAAO1B;IAAS2B,KAAKnB;KACpC,sBAAA,cAAChB,MAAMiC,MAAI;IAAC1B;IAAY6B,YAAW;KACjC,sBAAA,cAACpC,MAAMC,SAAO;IAACoC,SAAAA;KACb,sBAAA,cAACpC,QAAQgC,MAAI,MACVZ,cAAc,sBAAA,cAACpB,QAAQqC,QAAM;IAACC,SAASV;KAAgBpB,EAAE,iBAAA,CAAA,GAC1D,sBAAA,cAAC+B,OAAAA;IAAIC,WAAU;MACf,sBAAA,cAACxC,QAAQyC,YAAU;IACjBC,MAAK;IACLC,UAAAA;IACAC,OAAOpC,EAAE,oBAAA;IACT2B,YAAYjC,GAAG,wBAAA;IACfoC,SAAS,MAAMxB,YAAY,CAAC+B,SAAS,CAACA,IAAAA;QAI5C,sBAAA,cAAC9C,MAAM+C,SAAO,MACZ,sBAAA,cAACP,OAAAA;IACCC,WAAWtC,GACT,sBACAW,YAAY,oCACZP,SAAST,WAAWkD,QAAQzC,QAAQ,OACpCA,SAAST,WAAWmD,QAAQ1C,QAAQ,iBACpCA,SAAST,WAAWmD,QAAQ1C,QAAQO,YAAY,kBAAA;KAGlD,sBAAA,cAACV,WAAW2C,SAAO,MACjB,sBAAA,cAAC3C,WAAW8C,OAAK;IAACd,YAAW;IAAoBxB;OAElDE,YACC,sBAAA,cAAC0B,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAACrC,WAAW+C,MAAI;IACdvC;IACAwC,KAAK;IACLC,KAAK;IACLC,qBAAqBzC;IACrB0C,SAAS,MAAMxC,YAAY,KAAA;IAC3ByC,UAAUvC;;AAS5B;",
6
+ "names": ["Chess", "ChessJS", "React", "useCallback", "useRef", "useState", "AppSurface", "Obj", "Panel", "Toolbar", "useTranslation", "mx", "Chessboard", "meta", "ChessArticle", "role", "variant", "t", "profile", "key", "orientation", "setOrientation", "showInfo", "setShowInfo", "controller", "handleSelect", "index", "current", "setMoveNumber", "isGameOver", "instanceOf", "State", "pgn", "fen", "chess", "loadPgn", "load", "handleNewGame", "update", "mutable", "undefined", "Root", "state", "ref", "classNames", "asChild", "Button", "onClick", "div", "className", "IconButton", "icon", "iconOnly", "label", "open", "Content", "Article", "Section", "Board", "Info", "min", "max", "onOrientationChange", "onClose", "onSelect"]
7
+ }
@@ -3,17 +3,22 @@ import "./chunk-J5LGTIGS.mjs";
3
3
  // src/containers/ChessCard/ChessCard.tsx
4
4
  import React from "react";
5
5
  import { Obj } from "@dxos/echo";
6
+ import { Card } from "@dxos/react-ui";
6
7
  import { Chessboard } from "#components";
7
8
  import { Chess } from "#types";
8
9
  var ChessCard = ({ variant }) => {
9
10
  if (!Obj.instanceOf(Chess.State, variant)) {
10
11
  return null;
11
12
  }
12
- return /* @__PURE__ */ React.createElement(Chessboard.Root, {
13
+ return /* @__PURE__ */ React.createElement(Card.Body, null, /* @__PURE__ */ React.createElement(Card.Section, {
14
+ classNames: "aspect-square"
15
+ }, /* @__PURE__ */ React.createElement(Card.Row, {
16
+ fullWidth: true
17
+ }, /* @__PURE__ */ React.createElement(Chessboard.Root, {
13
18
  state: variant
14
- }, /* @__PURE__ */ React.createElement(Chessboard.Content, null, /* @__PURE__ */ React.createElement(Chessboard.Board, null)));
19
+ }, /* @__PURE__ */ React.createElement(Chessboard.Content, null, /* @__PURE__ */ React.createElement(Chessboard.Board, null))))));
15
20
  };
16
21
  export {
17
22
  ChessCard as default
18
23
  };
19
- //# sourceMappingURL=ChessCard-4TUTIFB6.mjs.map
24
+ //# sourceMappingURL=ChessCard-VJ3I6MIB.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/ChessCard/ChessCard.tsx"],
4
+ "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"],
5
+ "mappings": ";;;AAIA,OAAOA,WAAW;AAElB,SAASC,WAAW;AAEpB,SAASC,YAAY;AAErB,SAASC,kBAAkB;AAC3B,SAASC,aAAa;AAIf,IAAMC,YAAY,CAAC,EAAEC,QAAO,MAAkB;AACnD,MAAI,CAACL,IAAIM,WAAWH,MAAMI,OAAOF,OAAAA,GAAU;AACzC,WAAO;EACT;AAEA,SACE,sBAAA,cAACJ,KAAKO,MAAI,MACR,sBAAA,cAACP,KAAKQ,SAAO;IAACC,YAAW;KACvB,sBAAA,cAACT,KAAKU,KAAG;IAACC,WAAAA;KACR,sBAAA,cAACV,WAAWW,MAAI;IAACC,OAAOT;KACtB,sBAAA,cAACH,WAAWa,SAAO,MACjB,sBAAA,cAACb,WAAWc,OAAK,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAO/B;",
6
+ "names": ["React", "Obj", "Card", "Chessboard", "Chess", "ChessCard", "variant", "instanceOf", "State", "Body", "Section", "classNames", "Row", "fullWidth", "Root", "state", "Content", "Board"]
7
+ }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ChessPlugin,
3
3
  ChessPlugin_default
4
- } from "./chunk-PJOAFP6S.mjs";
4
+ } from "./chunk-EXZ3XFEG.mjs";
5
5
  import "./chunk-J5LGTIGS.mjs";
6
6
  export {
7
7
  ChessPlugin,
@@ -3,15 +3,15 @@ import "./chunk-J5LGTIGS.mjs";
3
3
  // src/ChessPlugin.node.ts
4
4
  import { Plugin } from "@dxos/app-framework";
5
5
  import { AppPlugin } from "@dxos/app-toolkit";
6
- import { BlueprintDefinition, OperationHandler } from "#capabilities";
6
+ import { OperationHandler, SkillDefinition } from "#capabilities";
7
7
  import { meta } from "#meta";
8
8
  import { Chess } from "#types";
9
9
  var ChessPlugin = Plugin.define(meta).pipe(AppPlugin.addSchemaModule({
10
10
  schema: [
11
11
  Chess.State
12
12
  ]
13
- }), AppPlugin.addBlueprintDefinitionModule({
14
- activate: BlueprintDefinition
13
+ }), AppPlugin.addSkillDefinitionModule({
14
+ activate: SkillDefinition
15
15
  }), AppPlugin.addOperationHandlerModule({
16
16
  activate: OperationHandler
17
17
  }), Plugin.make);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/ChessPlugin.node.ts"],
4
- "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { BlueprintDefinition, OperationHandler } from '#capabilities';\nimport { meta } from '#meta';\nimport { Chess } 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] }),\n AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n Plugin.make,\n);\n\nexport default ChessPlugin;\n"],
5
- "mappings": ";;;AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAE1B,SAASC,qBAAqBC,wBAAwB;AACtD,SAASC,YAAY;AACrB,SAASC,aAAa;AAMf,IAAMC,cAAcN,OAAOO,OAAOH,IAAAA,EAAMI,KAC7CP,UAAUQ,gBAAgB;EAAEC,QAAQ;IAACL,MAAMM;;AAAO,CAAA,GAClDV,UAAUW,6BAA6B;EAAEC,UAAUX;AAAoB,CAAA,GACvED,UAAUa,0BAA0B;EAAED,UAAUV;AAAiB,CAAA,GACjEH,OAAOe,IAAI;AAGb,IAAA,2BAAeT;",
6
- "names": ["Plugin", "AppPlugin", "BlueprintDefinition", "OperationHandler", "meta", "Chess", "ChessPlugin", "define", "pipe", "addSchemaModule", "schema", "State", "addBlueprintDefinitionModule", "activate", "addOperationHandlerModule", "make"]
4
+ "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 } 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] }),\n AppPlugin.addSkillDefinitionModule({ activate: SkillDefinition }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n Plugin.make,\n);\n\nexport default ChessPlugin;\n"],
5
+ "mappings": ";;;AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAE1B,SAASC,kBAAkBC,uBAAuB;AAClD,SAASC,YAAY;AACrB,SAASC,aAAa;AAMf,IAAMC,cAAcN,OAAOO,OAAOH,IAAAA,EAAMI,KAC7CP,UAAUQ,gBAAgB;EAAEC,QAAQ;IAACL,MAAMM;;AAAO,CAAA,GAClDV,UAAUW,yBAAyB;EAAEC,UAAUV;AAAgB,CAAA,GAC/DF,UAAUa,0BAA0B;EAAED,UAAUX;AAAiB,CAAA,GACjEF,OAAOe,IAAI;AAGb,IAAA,2BAAeT;",
6
+ "names": ["Plugin", "AppPlugin", "OperationHandler", "SkillDefinition", "meta", "Chess", "ChessPlugin", "define", "pipe", "addSchemaModule", "schema", "State", "addSkillDefinitionModule", "activate", "addOperationHandlerModule", "make"]
7
7
  }
@@ -2,12 +2,12 @@ import "../chunk-J5LGTIGS.mjs";
2
2
 
3
3
  // src/capabilities/index.ts
4
4
  import { Capability } from "@dxos/app-framework";
5
- var BlueprintDefinition = Capability.lazy("BlueprintDefinition", () => import("../blueprint-definition-4MOWVVWD.mjs"));
5
+ var SkillDefinition = Capability.lazy("SkillDefinition", () => import("../skill-definition-ZGQBUE4R.mjs"));
6
6
  var GameVariant = Capability.lazy("GameVariant", () => import("../game-variant-ZLPEN2QK.mjs"));
7
7
  var OperationHandler = Capability.lazy("OperationHandler", () => import("../operation-handler-EKZKFQUG.mjs"));
8
8
  export {
9
- BlueprintDefinition,
10
9
  GameVariant,
11
- OperationHandler
10
+ OperationHandler,
11
+ SkillDefinition
12
12
  };
13
13
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/capabilities/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\nimport { type AppCapabilities } from '@dxos/app-toolkit';\nimport type { OperationHandlerSet } from '@dxos/compute';\n\n// The contributed capability type references Blueprint types from @dxos/compute, so the lazy\n// wrapper needs an explicit annotation to keep the inferred type portable (TS2883).\nexport const BlueprintDefinition: Capability.LazyCapability<\n void,\n Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]\n> = Capability.lazy('BlueprintDefinition', () => import('./blueprint-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"],
5
- "mappings": ";;;AAIA,SAASA,kBAAkB;AAMpB,IAAMC,sBAGTD,WAAWE,KAAK,uBAAuB,MAAM,OAAO,sCAAA,CAAA;AACjD,IAAMC,cAAcH,WAAWE,KAAK,eAAe,MAAM,OAAO,8BAAA,CAAA;AAChE,IAAME,mBAAmBJ,WAAWE,KACzC,oBACA,MAAM,OAAO,mCAAA,CAAA;",
6
- "names": ["Capability", "BlueprintDefinition", "lazy", "GameVariant", "OperationHandler"]
4
+ "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"],
5
+ "mappings": ";;;AAIA,SAASA,kBAAkB;AAGpB,IAAMC,kBAAkBD,WAAWE,KAAK,mBAAmB,MAAM,OAAO,kCAAA,CAAA;AACxE,IAAMC,cAAcH,WAAWE,KAAK,eAAe,MAAM,OAAO,8BAAA,CAAA;AAChE,IAAME,mBAAmBJ,WAAWE,KACzC,oBACA,MAAM,OAAO,mCAAA,CAAA;",
6
+ "names": ["Capability", "SkillDefinition", "lazy", "GameVariant", "OperationHandler"]
7
7
  }
@@ -1,8 +1,8 @@
1
1
  // src/operations/index.ts
2
2
  import { OperationHandlerSet } from "@dxos/compute";
3
- var ChessOperationHandlerSet = OperationHandlerSet.lazy(() => import("./move-6NCMKKWD.mjs"), () => import("./play-F5L5LFLW.mjs"), () => import("./print-GMSNKAS2.mjs"));
3
+ var ChessOperationHandlerSet = OperationHandlerSet.lazy(() => import("./move-UMDTQST4.mjs"), () => import("./play-7XTJZ4N6.mjs"), () => import("./print-JR4VB3UX.mjs"));
4
4
 
5
5
  export {
6
6
  ChessOperationHandlerSet
7
7
  };
8
- //# sourceMappingURL=chunk-YB6WZOZI.mjs.map
8
+ //# sourceMappingURL=chunk-AMXVX7V2.mjs.map
@@ -5,19 +5,19 @@ import {
5
5
  // src/types/Chess.ts
6
6
  var Chess_exports = {};
7
7
  __export(Chess_exports, {
8
- BLUEPRINT_KEY: () => BLUEPRINT_KEY,
8
+ SKILL_KEY: () => SKILL_KEY,
9
9
  State: () => State,
10
10
  make: () => make
11
11
  });
12
12
  import { Chess as ChessJS } from "chess.js";
13
13
  import * as Schema from "effect/Schema";
14
- import { BlueprintsAnnotation } from "@dxos/app-toolkit";
15
- import { DXN, Annotation, Obj, Type } from "@dxos/echo";
14
+ import { AppAnnotation } from "@dxos/app-toolkit";
15
+ import { Annotation, DXN, Obj, Type } from "@dxos/echo";
16
16
  import { FormInputAnnotation, HiddenAnnotation } from "@dxos/echo/Annotation";
17
17
  import { log } from "@dxos/log";
18
18
  var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-chess/src/types/Chess.ts";
19
- var BLUEPRINT_KEY = "org.dxos.blueprint.chess";
20
- var State = Schema.Struct({
19
+ var SKILL_KEY = "org.dxos.skill.chess";
20
+ var State = class extends Type.makeObject(DXN.make("org.dxos.type.chess.state", "0.1.0"))(Schema.Struct({
21
21
  pgn: Schema.String.annotations({
22
22
  description: "Portable Game Notation."
23
23
  }).pipe(FormInputAnnotation.set(false), Schema.optional),
@@ -29,23 +29,23 @@ var State = Schema.Struct({
29
29
  icon: "ph--shield-chevron--regular",
30
30
  hue: "amber"
31
31
  }),
32
- BlueprintsAnnotation.set([
33
- BLUEPRINT_KEY
32
+ AppAnnotation.SkillsAnnotation.set([
33
+ SKILL_KEY
34
34
  ]),
35
35
  // Implementation detail of the unified `Game` schema. The user-facing object is `Game`;
36
36
  // this state is only ever referenced via `Game.variant`. HiddenAnnotation keeps it out of the
37
37
  // navtree's typed branches so an orphaned state object doesn't reappear after the
38
38
  // wrapping Game is deleted.
39
- HiddenAnnotation.set(true),
40
- Type.makeObject(DXN.make("org.dxos.type.chess.state", "0.1.0"))
41
- );
39
+ HiddenAnnotation.set(true)
40
+ )) {
41
+ };
42
42
  var make = ({ pgn, fen } = {}) => {
43
43
  const chess = new ChessJS();
44
44
  if (pgn) {
45
45
  try {
46
46
  chess.loadPgn(pgn);
47
47
  } catch {
48
- log.warn(pgn, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 37, S: void 0 });
48
+ log.warn(pgn, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 38, S: void 0 });
49
49
  }
50
50
  }
51
51
  return Obj.make(State, {
@@ -145,4 +145,4 @@ export {
145
145
  Chess_exports,
146
146
  ChessOperation_exports
147
147
  };
148
- //# sourceMappingURL=chunk-OYWDKJ5B.mjs.map
148
+ //# sourceMappingURL=chunk-DXIET5G2.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types/Chess.ts", "../../../src/types/ChessOperation.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Schema from 'effect/Schema';\n\nimport { AppAnnotation } from '@dxos/app-toolkit';\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", "//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/compute';\nimport { Database, DXN } from '@dxos/echo';\nimport { GameRef } from '@dxos/plugin-game/types';\n\nimport * as Chess from './Chess';\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: 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: 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"],
5
+ "mappings": ";;;;;AAAA;;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,qBAAqB;AAC9B,SAASC,YAAYC,KAAKC,KAAKC,YAAY;AAC3C,SAASC,qBAAqBC,wBAAwB;AACtD,SAASC,WAAW;AAEpB,IAAA,eAAaC;;AASPC,IAAAA,QAAAA,cAAa,KAAA,WAAA,IAAA,KAAA,6BAAA,OAAA,CAAA,EAAA,cAAA;EACf,KAAQJ,cAAAA,YAAuB;IAC/BK,aAAYC;UACVF,oBAAa,IAAA,KAAA,GAAA,eAAA;EACf,KAAQJ,cAAAA,YAAuB;IAE/BJ,aAAWW;EAAqBC,CAAAA,EAAAA,KAAM,oBAAA,IAAA,KAAA,GAAA,eAAA;;EAA+BC,WAAK,eAAA,IAAA;IAC1Ed,MAAAA;IAAoCQ,KAAAA;GAAU;EAC9C,cAAA,iBAAA,IAAA;IACA;EACA,CAAA;;;;;EAMJ,iBAAaO,IAAQ,IAAEC;AAAG,CAAA,EAAEN;;AAE1B,IAAS,OAAA,CAAA,EAAA,KAAA,IAAA,IAAA,CAAA,MAAA;QACP,QAAI,IAAA,QAAA;WACFO;AACF,QAAE;AACAV,YAAIW,QAAKF,GAAAA;IACX,QAAA;AACF,UAAA,KAAA,KAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;IAEA;;SAEEN,IAAAA,KAAAA,OAAAA;IACF;IACA;;;;;ACnDF;;;;;;AAMA,YAAYS,aAAY;AAExB,SAASC,iBAAiB;AAC1B,SAASC,UAAUC,OAAAA,YAAW;AAC9B,SAASC,eAAe;AAIjB,IAAMC,OAAOC,UAAUC,KAAK;EACjCC,MAAM;IACJC,KAAKC,KAAIH,KAAK,8BAAA;IACdI,MAAM;IACNC,aAAa;IACbC,MAAM;EACR;EACAC,OAAcC,eAAO;IACnBC,MAAMC,QAAcC,KAAK,EAAEC,YAAY;MACrCP,aAAa;IACf,CAAA;IACAQ,MAAaC,eAAOF,YAAY;MAC9BP,aAAa;MACbU,UAAU;QAAC;QAAM;;IACnB,CAAA;EACF,CAAA;EACAC,QAAeR,eAAO;IACpBS,KAAYH,eAAOF,YAAY;MAC7BP,aAAa;IACf,CAAA;EACF,CAAA;EACAa,UAAU;IAACC,SAASC;;AACtB,CAAA;AAEO,IAAMC,OAAOtB,UAAUC,KAAK;EACjCC,MAAM;IACJC,KAAKC,KAAIH,KAAK,8BAAA;IACdI,MAAM;IACNC,aAAa;IACbC,MAAM;EACR;EACAC,OAAcC,eAAO;IACnBC,MAAMC,QAAcC,KAAK,EAAEC,YAAY;MACrCP,aAAa;IACf,CAAA;IACAiB,MAAaC,iBAAgBC,gBAAQ,SAAS,SAAS,KAAA,CAAA,EAAQZ,YAAY;MACzEP,aAAa;MACboB,cAAc;IAChB,CAAA;EACF,CAAA;EACAT,QAAeR,eAAO;IACpBS,KAAYH,eAAOF,YAAY;MAC7BP,aAAa;IACf,CAAA;IACAQ,MAAaU,iBAAgBT,cAAM,EAAEF,YAAY;MAC/CP,aAAa;IACf,CAAA;EACF,CAAA;EACAa,UAAU;IAACC,SAASC;;AACtB,CAAA;AAEO,IAAMM,QAAQ3B,UAAUC,KAAK;EAClCC,MAAM;IACJC,KAAKC,KAAIH,KAAK,+BAAA;IACdI,MAAM;IACNC,aAAa;IACbC,MAAM;EACR;EACAC,OAAcC,eAAO;IACnBS,KAAYM,iBACHT,eAAOF,YAAY;MACxBP,aAAa;IACf,CAAA,CAAA;IAEFsB,KAAYJ,iBACHT,eAAOF,YAAY;MACxBP,aAAa;IACf,CAAA,CAAA;EAEJ,CAAA;EACAW,QAAeR,eAAO;IACpBoB,OAAcd;EAChB,CAAA;AACF,CAAA;",
6
+ "names": ["Chess", "ChessJS", "Schema", "AppAnnotation", "Annotation", "DXN", "Obj", "Type", "FormInputAnnotation", "HiddenAnnotation", "log", "SKILL_KEY", "description", "fen", "String", "IconAnnotation", "icon", "hue", "make", "pgn", "chess", "warn", "Schema", "Operation", "Database", "DXN", "GameRef", "Move", "Operation", "make", "meta", "key", "DXN", "name", "description", "icon", "input", "Struct", "game", "GameRef", "State", "annotations", "move", "String", "examples", "output", "pgn", "services", "Database", "Service", "Play", "side", "optional", "Literal", "defaultValue", "Print", "fen", "ascii"]
7
+ }
@@ -1,12 +1,12 @@
1
1
  // src/ChessPlugin.tsx
2
2
  import { Plugin } from "@dxos/app-framework";
3
- import { AppPlugin, AppActivationEvents } from "@dxos/app-toolkit";
4
- import { BlueprintDefinition, GameVariant, OperationHandler } from "#capabilities";
3
+ import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
4
+ import { GameVariant, OperationHandler, SkillDefinition } from "#capabilities";
5
5
  import { meta } from "#meta";
6
6
  import { translations } from "#translations";
7
7
  import { Chess } from "#types";
8
8
 
9
- // raw-loader:/__w/dxos/dxos/packages/plugins/plugin-chess/PLUGIN.mdl?raw
9
+ // raw-loader:/__w/dxos/dxos/packages/plugins/plugin-chess/PLUGIN.mdl
10
10
  var PLUGIN_default = "---\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() \u2192 Game\n joinGame(game: Game) \u2192 Game\n spectate(game: Game)\n emits:\n onJoin(game: Game)\n layout: |\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 [header slot] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 Game list \u2502\n \u2502 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502\n \u2502 \u2502 game row \u2502 \u2502\n \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n \u2502 [empty slot] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 [Create Game] \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\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 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 [toolbar slot] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 \u2502 [sidebar] \u2502\n \u2502 8\xD78 \u2502 \u2502\n \u2502 board \u2502 move history \u2502\n \u2502 \u2502 \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 [overlay slot] \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\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) \u2192 Move\n legalMoves(board: Board, square: Square) \u2192 Square[]\n applyMove(board: Board, move: Move) \u2192 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) \u2192 Game\n load(id: string) \u2192 Game\n save(game: Game) \u2192 Game\n list() \u2192 Game[]\n effects: [echo:write, echo:read]\n```\n\n## Operations\n\nPure operations (no effects, no service dependencies) \u2014 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 \u2014 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 \u2192 applyMove \u2192 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\u2192e4\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\u2192e5)\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 \u2014 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) \u2192 ReturnType\n errors?: ErrorMap\n note?: Prose\n```\n";
11
11
 
12
12
  // src/ChessPlugin.tsx
@@ -14,13 +14,13 @@ var ChessPlugin = Plugin.define(meta).pipe(Plugin.addModule({
14
14
  id: "game-variant",
15
15
  activatesOn: AppActivationEvents.SetupSchema,
16
16
  activate: GameVariant
17
- }), AppPlugin.addBlueprintDefinitionModule({
18
- activate: BlueprintDefinition
17
+ }), AppPlugin.addSkillDefinitionModule({
18
+ activate: SkillDefinition
19
19
  }), AppPlugin.addOperationHandlerModule({
20
20
  activate: OperationHandler
21
21
  }), AppPlugin.addPluginAssetModule({
22
22
  asset: {
23
- pluginId: meta.id,
23
+ pluginId: meta.profile.key,
24
24
  path: "PLUGIN.mdl",
25
25
  content: PLUGIN_default,
26
26
  mimeType: "application/x-mdl"
@@ -38,4 +38,4 @@ export {
38
38
  ChessPlugin,
39
39
  ChessPlugin_default
40
40
  };
41
- //# sourceMappingURL=chunk-PJOAFP6S.mjs.map
41
+ //# sourceMappingURL=chunk-EXZ3XFEG.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ChessPlugin.tsx", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-chess/PLUGIN.mdl"],
4
+ "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 } 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] }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.make,\n);\n\nexport default ChessPlugin;\n", "---\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() \u2192 Game\n joinGame(game: Game) \u2192 Game\n spectate(game: Game)\n emits:\n onJoin(game: Game)\n layout: |\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 [header slot] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 Game list \u2502\n \u2502 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502\n \u2502 \u2502 game row \u2502 \u2502\n \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n \u2502 [empty slot] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 [Create Game] \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\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 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 [toolbar slot] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 \u2502 [sidebar] \u2502\n \u2502 8\u00D78 \u2502 \u2502\n \u2502 board \u2502 move history \u2502\n \u2502 \u2502 \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 [overlay slot] \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\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) \u2192 Move\n legalMoves(board: Board, square: Square) \u2192 Square[]\n applyMove(board: Board, move: Move) \u2192 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) \u2192 Game\n load(id: string) \u2192 Game\n save(game: Game) \u2192 Game\n list() \u2192 Game[]\n effects: [echo:write, echo:read]\n```\n\n## Operations\n\nPure operations (no effects, no service dependencies) \u2014 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 \u2014 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 \u2192 applyMove \u2192 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\u2192e4\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\u2192e5)\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 \u2014 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) \u2192 ReturnType\n errors?: ErrorMap\n note?: Prose\n```\n"],
5
+ "mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,qBAAqBC,iBAAiB;AAE/C,SAASC,aAAaC,kBAAkBC,uBAAuB;AAC/D,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAC7B,SAASC,aAAa;;;ACVtB;;;ADeO,IAAMC,cAAcC,OAAOC,OAAOC,IAAAA,EAAMC,KAC7CH,OAAOI,UAAU;EACfC,IAAI;EACJC,aAAaC,oBAAoBC;EACjCC,UAAUC;AACZ,CAAA,GACAC,UAAUC,yBAAyB;EAAEH,UAAUI;AAAgB,CAAA,GAC/DF,UAAUG,0BAA0B;EAAEL,UAAUM;AAAiB,CAAA,GACjEJ,UAAUK,qBAAqB;EAC7BC,OAAO;IAAEC,UAAUhB,KAAKiB,QAAQC;IAAKC,MAAM;IAAcC,SAASC;IAAYC,UAAU;EAAoB;AAC9G,CAAA,GACAb,UAAUc,gBAAgB;EAAEC,QAAQ;IAACC,MAAMC;;AAAO,CAAA,GAClDjB,UAAUkB,sBAAsB;EAAEC;AAAa,CAAA,GAC/C9B,OAAO+B,IAAI;AAGb,IAAA,sBAAehC;",
6
+ "names": ["Plugin", "AppActivationEvents", "AppPlugin", "GameVariant", "OperationHandler", "SkillDefinition", "meta", "translations", "Chess", "ChessPlugin", "Plugin", "define", "meta", "pipe", "addModule", "id", "activatesOn", "AppActivationEvents", "SetupSchema", "activate", "GameVariant", "AppPlugin", "addSkillDefinitionModule", "SkillDefinition", "addOperationHandlerModule", "OperationHandler", "addPluginAssetModule", "asset", "pluginId", "profile", "key", "path", "content", "pluginSpec", "mimeType", "addSchemaModule", "schema", "Chess", "State", "addTranslationsModule", "translations", "make"]
7
+ }
@@ -0,0 +1,38 @@
1
+ // src/skills/chess-skill.ts
2
+ import { Skill, Template } from "@dxos/compute";
3
+ import { trim } from "@dxos/util";
4
+ import { Chess, ChessOperation } from "#types";
5
+ var operations = [
6
+ ChessOperation.Move,
7
+ ChessOperation.Play,
8
+ ChessOperation.Print
9
+ ];
10
+ var make = () => Skill.make({
11
+ key: Chess.SKILL_KEY,
12
+ name: "Chess",
13
+ tools: Skill.toolDefinitions({
14
+ operations
15
+ }),
16
+ instructions: Template.make({
17
+ source: trim`
18
+ You are an expert chess player.
19
+ To analyze a game you can access the "pgn" property by loading the context object that represents the current game.
20
+ You could suggest a good next move or offer to play a move.
21
+ Don't actually make a move unless you are asked to.
22
+
23
+ When setting a chess position, always set the "pgn" field (move list in standard PGN notation) on the org.dxos.type.chess.state object.
24
+ The "fen" field is not used by the UI for display — the board is driven exclusively from "pgn".
25
+ Setting "fen" alone or leaving "pgn" empty will result in the initial position being shown.
26
+ `
27
+ })
28
+ });
29
+ var skill = {
30
+ key: Chess.SKILL_KEY,
31
+ make
32
+ };
33
+ var chess_skill_default = skill;
34
+
35
+ export {
36
+ chess_skill_default
37
+ };
38
+ //# sourceMappingURL=chunk-IKWULCKX.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/skills/chess-skill.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Skill, Template } from '@dxos/compute';\nimport { trim } from '@dxos/util';\n\nimport { Chess, ChessOperation } from '#types';\n\nconst operations = [ChessOperation.Move, ChessOperation.Play, ChessOperation.Print];\n\nconst make = () =>\n Skill.make({\n key: Chess.SKILL_KEY,\n name: 'Chess',\n tools: Skill.toolDefinitions({ operations }),\n instructions: Template.make({\n source: trim`\n You are an expert chess player.\n To analyze a game you can access the \"pgn\" property by loading the context object that represents the current game.\n You could suggest a good next move or offer to play a move.\n Don't actually make a move unless you are asked to.\n\n When setting a chess position, always set the \"pgn\" field (move list in standard PGN notation) on the org.dxos.type.chess.state object.\n The \"fen\" field is not used by the UI for display — the board is driven exclusively from \"pgn\".\n Setting \"fen\" alone or leaving \"pgn\" empty will result in the initial position being shown.\n `,\n }),\n });\n\nconst skill: Skill.Definition = {\n key: Chess.SKILL_KEY,\n make,\n};\n\nexport default skill;\n"],
5
+ "mappings": ";AAIA,SAASA,OAAOC,gBAAgB;AAChC,SAASC,YAAY;AAErB,SAASC,OAAOC,sBAAsB;AAEtC,IAAMC,aAAa;EAACD,eAAeE;EAAMF,eAAeG;EAAMH,eAAeI;;AAE7E,IAAMC,OAAO,MACXT,MAAMS,KAAK;EACTC,KAAKP,MAAMQ;EACXC,MAAM;EACNC,OAAOb,MAAMc,gBAAgB;IAAET;EAAW,CAAA;EAC1CU,cAAcd,SAASQ,KAAK;IAC1BO,QAAQd;;;;;;;;;;EAUV,CAAA;AACF,CAAA;AAEF,IAAMe,QAA0B;EAC9BP,KAAKP,MAAMQ;EACXF;AACF;AAEA,IAAA,sBAAeQ;",
6
+ "names": ["Skill", "Template", "trim", "Chess", "ChessOperation", "operations", "Move", "Play", "Print", "make", "key", "SKILL_KEY", "name", "tools", "toolDefinitions", "instructions", "source", "skill"]
7
+ }
@@ -0,0 +1,42 @@
1
+ // src/meta.ts
2
+ import { Plugin } from "@dxos/app-framework";
3
+
4
+ // dx.config.ts
5
+ import { Config2 } from "@dxos/app-framework/config";
6
+ import { trim } from "@dxos/util";
7
+ var dx_config_default = Config2.make({
8
+ plugin: {
9
+ key: "org.dxos.plugin.chess",
10
+ name: "Chess",
11
+ author: "DXOS",
12
+ description: trim`
13
+ Full-featured chess game supporting multiplayer matches with friends or practice sessions against AI opponents.
14
+ Track game history and analyze moves in real-time.
15
+ `,
16
+ source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess",
17
+ icon: {
18
+ key: "ph--shield-chevron--regular",
19
+ hue: "amber"
20
+ },
21
+ spec: "PLUGIN.mdl",
22
+ tags: [
23
+ "game"
24
+ ],
25
+ screenshots: [
26
+ {
27
+ dark: "https://dxos.network/plugin-details-chess-dark.png"
28
+ }
29
+ ],
30
+ dependsOn: [
31
+ "org.dxos.plugin.game"
32
+ ]
33
+ }
34
+ });
35
+
36
+ // src/meta.ts
37
+ var meta = Plugin.getMetaFromConfig(dx_config_default);
38
+
39
+ export {
40
+ meta
41
+ };
42
+ //# sourceMappingURL=chunk-YZTKZ5F7.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts", "../../../dx.config.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport config from '../dx.config';\n\nexport const meta = Plugin.getMetaFromConfig(config);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Config2 } from '@dxos/app-framework/config';\nimport { trim } from '@dxos/util';\n\nexport default Config2.make({\n plugin: {\n key: 'org.dxos.plugin.chess',\n name: 'Chess',\n author: 'DXOS',\n description: trim`\n Full-featured chess game supporting multiplayer matches with friends or practice sessions against AI opponents.\n Track game history and analyze moves in real-time.\n `,\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess',\n icon: { key: 'ph--shield-chevron--regular', hue: 'amber' },\n spec: 'PLUGIN.mdl',\n tags: ['game'],\n screenshots: [{ dark: 'https://dxos.network/plugin-details-chess-dark.png' }],\n dependsOn: ['org.dxos.plugin.game'],\n },\n});\n"],
5
+ "mappings": ";AAIA,SAASA,cAAc;;;ACAvB,SAASC,eAAe;AACxB,SAASC,YAAY;AAErB,IAAA,oBAAeD,QAAQE,KAAK;EAC1BC,QAAQ;IACNC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,aAAaN;;;;IAIbO,QAAQ;IACRC,MAAM;MAAEL,KAAK;MAA+BM,KAAK;IAAQ;IACzDC,MAAM;IACNC,MAAM;MAAC;;IACPC,aAAa;MAAC;QAAEC,MAAM;MAAqD;;IAC3EC,WAAW;MAAC;;EACd;AACF,CAAA;;;ADfO,IAAMC,OAAOC,OAAOC,kBAAkBC,iBAAAA;",
6
+ "names": ["Plugin", "Config2", "trim", "make", "plugin", "key", "name", "author", "description", "source", "icon", "hue", "spec", "tags", "screenshots", "dark", "dependsOn", "meta", "Plugin", "getMetaFromConfig", "config"]
7
+ }