@dxos/plugin-chess 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef
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.
- package/dist/lib/browser/blueprints/index.mjs +4 -4
- package/dist/lib/browser/{chunk-JZMN24DY.mjs → chunk-H6SON7WG.mjs} +4 -4
- package/dist/lib/browser/chunk-H6SON7WG.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2TJN26DN.mjs → chunk-IN3LZ2OO.mjs} +2 -7
- package/dist/lib/browser/{chunk-2TJN26DN.mjs.map → chunk-IN3LZ2OO.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-MC7L6JNC.mjs → chunk-JYP24G6K.mjs} +2 -2
- package/dist/lib/browser/chunk-JYP24G6K.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XAJZK6Z2.mjs → chunk-OBKYFOJA.mjs} +3 -3
- package/dist/lib/browser/chunk-OBKYFOJA.mjs.map +7 -0
- package/dist/lib/browser/{create-AJHN4QT4.mjs → create-2ME3FNBX.mjs} +4 -4
- package/dist/lib/browser/create-2ME3FNBX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +10 -357
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{move-T2NLRBR4.mjs → move-TTMIPD5J.mjs} +5 -5
- package/dist/lib/browser/move-TTMIPD5J.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +3 -3
- package/dist/lib/browser/{play-7VTMD3SJ.mjs → play-GHXPV2T2.mjs} +5 -5
- package/dist/lib/browser/play-GHXPV2T2.mjs.map +7 -0
- package/dist/lib/browser/{print-EW7LPW4D.mjs → print-RNAGAOM7.mjs} +4 -4
- package/dist/lib/browser/{print-EW7LPW4D.mjs.map → print-RNAGAOM7.mjs.map} +1 -1
- package/dist/lib/browser/translations.mjs +38 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/blueprints/index.mjs +4 -4
- package/dist/lib/node-esm/{chunk-LQEDIKCV.mjs → chunk-4C4GPZTA.mjs} +4 -4
- package/dist/lib/node-esm/chunk-4C4GPZTA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NYU5JVXP.mjs → chunk-G2EHRXHX.mjs} +3 -3
- package/dist/lib/node-esm/chunk-G2EHRXHX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-4HZWCKMR.mjs → chunk-NSFPC4IO.mjs} +2 -2
- package/dist/lib/node-esm/chunk-NSFPC4IO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OIRJVY2R.mjs → chunk-OHBKSL2Q.mjs} +2 -7
- package/dist/lib/node-esm/{chunk-OIRJVY2R.mjs.map → chunk-OHBKSL2Q.mjs.map} +2 -2
- package/dist/lib/node-esm/{create-QSETDT4N.mjs → create-CC2P7GPT.mjs} +4 -4
- package/dist/lib/node-esm/create-CC2P7GPT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +10 -357
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{move-5F2ANDTE.mjs → move-CYHXWHHM.mjs} +5 -5
- package/dist/lib/node-esm/move-CYHXWHHM.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +3 -3
- package/dist/lib/node-esm/{play-W4DQCQRX.mjs → play-KTNK2PBL.mjs} +5 -5
- package/dist/lib/node-esm/play-KTNK2PBL.mjs.map +7 -0
- package/dist/lib/node-esm/{print-UJHXAXMS.mjs → print-P23VKVNU.mjs} +4 -4
- package/dist/lib/node-esm/{print-UJHXAXMS.mjs.map → print-P23VKVNU.mjs.map} +1 -1
- package/dist/lib/node-esm/translations.mjs +39 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/ChessPlugin.d.ts +1 -0
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/{cli/plugin.d.ts → ChessPlugin.node.d.ts} +2 -1
- package/dist/types/src/ChessPlugin.node.d.ts.map +1 -0
- package/dist/types/src/ChessPlugin.test.d.ts +2 -0
- package/dist/types/src/ChessPlugin.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/chess-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +2 -2
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +5 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/Chessboard.d.ts +4 -0
- package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +40 -23
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/Info.d.ts +4 -5
- package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard/types.d.ts.map +1 -1
- package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts +40 -23
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -1
- package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/create.d.ts +1 -1
- package/dist/types/src/operations/create.d.ts.map +1 -1
- package/dist/types/src/operations/definitions.d.ts +2 -2
- package/dist/types/src/operations/definitions.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/move.d.ts +1 -1
- package/dist/types/src/operations/move.d.ts.map +1 -1
- package/dist/types/src/operations/play.d.ts +1 -1
- package/dist/types/src/operations/play.d.ts.map +1 -1
- package/dist/types/src/operations/print.d.ts +1 -1
- package/dist/types/src/operations/print.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +40 -24
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +50 -48
- package/src/{cli/plugin.ts → ChessPlugin.node.ts} +11 -3
- package/src/ChessPlugin.test.ts +49 -0
- package/src/ChessPlugin.tsx +4 -3
- package/src/blueprints/chess-blueprint.ts +2 -3
- package/src/capabilities/artifact-definition.ts +2 -2
- package/src/capabilities/blueprint-definition.ts +2 -0
- package/src/capabilities/index.ts +2 -1
- package/src/capabilities/node.ts +16 -0
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +5 -5
- package/src/components/Chessboard/Chessboard.stories.tsx +1 -1
- package/src/components/Chessboard/Info.tsx +2 -2
- package/src/containers/ChessArticle/ChessArticle.stories.tsx +1 -1
- package/src/index.ts +5 -2
- package/src/operations/create.ts +1 -1
- package/src/operations/definitions.ts +1 -1
- package/src/operations/index.ts +1 -1
- package/src/operations/move.ts +2 -2
- package/src/operations/play.ts +2 -2
- package/src/operations/print.ts +1 -1
- package/dist/lib/browser/chunk-JZMN24DY.mjs.map +0 -7
- package/dist/lib/browser/chunk-MC7L6JNC.mjs.map +0 -7
- package/dist/lib/browser/chunk-XAJZK6Z2.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs +0 -34
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/create-AJHN4QT4.mjs.map +0 -7
- package/dist/lib/browser/move-T2NLRBR4.mjs.map +0 -7
- package/dist/lib/browser/play-7VTMD3SJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4HZWCKMR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LQEDIKCV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NYU5JVXP.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -35
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/create-QSETDT4N.mjs.map +0 -7
- package/dist/lib/node-esm/move-5F2ANDTE.mjs.map +0 -7
- package/dist/lib/node-esm/play-W4DQCQRX.mjs.map +0 -7
- package/dist/types/src/cli/index.d.ts +0 -2
- package/dist/types/src/cli/index.d.ts.map +0 -1
- package/dist/types/src/cli/plugin.d.ts.map +0 -1
- package/src/cli/index.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-chess",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.abd8ff62ef",
|
|
4
4
|
"description": "Chess for new plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -14,11 +14,21 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"imports": {
|
|
16
16
|
"#blueprints": "./src/blueprints/index.ts",
|
|
17
|
-
"#capabilities":
|
|
17
|
+
"#capabilities": {
|
|
18
|
+
"browser": "./src/capabilities/index.ts",
|
|
19
|
+
"node": "./src/capabilities/node.ts",
|
|
20
|
+
"default": "./src/capabilities/index.ts"
|
|
21
|
+
},
|
|
18
22
|
"#components": "./src/components/index.ts",
|
|
19
23
|
"#containers": "./src/containers/index.ts",
|
|
20
24
|
"#meta": "./src/meta.ts",
|
|
21
25
|
"#operations": "./src/operations/index.ts",
|
|
26
|
+
"#translations": "./src/translations.ts",
|
|
27
|
+
"#plugin": {
|
|
28
|
+
"browser": "./src/ChessPlugin.tsx",
|
|
29
|
+
"node": "./src/ChessPlugin.node.ts",
|
|
30
|
+
"default": "./src/ChessPlugin.tsx"
|
|
31
|
+
},
|
|
22
32
|
"#types": "./src/types/index.ts"
|
|
23
33
|
},
|
|
24
34
|
"exports": {
|
|
@@ -34,18 +44,18 @@
|
|
|
34
44
|
"browser": "./dist/lib/browser/blueprints/index.mjs",
|
|
35
45
|
"node": "./dist/lib/node-esm/blueprints/index.mjs"
|
|
36
46
|
},
|
|
37
|
-
"./cli": {
|
|
38
|
-
"source": "./src/cli/index.ts",
|
|
39
|
-
"types": "./dist/types/src/cli/index.d.ts",
|
|
40
|
-
"browser": "./dist/lib/browser/cli/index.mjs",
|
|
41
|
-
"node": "./dist/lib/node-esm/cli/index.mjs"
|
|
42
|
-
},
|
|
43
47
|
"./operations": {
|
|
44
48
|
"source": "./src/operations/index.ts",
|
|
45
49
|
"types": "./dist/types/src/operations/index.d.ts",
|
|
46
50
|
"browser": "./dist/lib/browser/operations/index.mjs",
|
|
47
51
|
"node": "./dist/lib/node-esm/operations/index.mjs"
|
|
48
52
|
},
|
|
53
|
+
"./translations": {
|
|
54
|
+
"source": "./src/translations.ts",
|
|
55
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
56
|
+
"browser": "./dist/lib/browser/translations.mjs",
|
|
57
|
+
"node": "./dist/lib/node-esm/translations.mjs"
|
|
58
|
+
},
|
|
49
59
|
"./types": {
|
|
50
60
|
"source": "./src/types/index.ts",
|
|
51
61
|
"types": "./dist/types/src/types/index.d.ts",
|
|
@@ -54,13 +64,6 @@
|
|
|
54
64
|
}
|
|
55
65
|
},
|
|
56
66
|
"types": "dist/types/src/index.d.ts",
|
|
57
|
-
"typesVersions": {
|
|
58
|
-
"*": {
|
|
59
|
-
"types": [
|
|
60
|
-
"dist/types/src/types/index.d.ts"
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
67
|
"files": [
|
|
65
68
|
"dist",
|
|
66
69
|
"src"
|
|
@@ -70,49 +73,48 @@
|
|
|
70
73
|
"@effect-atom/atom-react": "^0.5.0",
|
|
71
74
|
"chess.js": "^1.0.0",
|
|
72
75
|
"effect": "3.20.0",
|
|
73
|
-
"@dxos/ai": "0.8.4-main.
|
|
74
|
-
"@dxos/app-
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/echo": "0.8.4-main.
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/
|
|
83
|
-
"@dxos/
|
|
84
|
-
"@dxos/
|
|
85
|
-
"@dxos/plugin-
|
|
86
|
-
"@dxos/plugin-
|
|
87
|
-
"@dxos/
|
|
88
|
-
"@dxos/
|
|
89
|
-
"@dxos/
|
|
90
|
-
"@dxos/react-
|
|
91
|
-
"@dxos/react-ui-
|
|
92
|
-
"@dxos/
|
|
93
|
-
"@dxos/plugin-space": "0.8.4-main.
|
|
94
|
-
"@dxos/
|
|
95
|
-
"@dxos/
|
|
96
|
-
"@dxos/
|
|
97
|
-
"@dxos/util": "0.8.4-main.9be5663bfe",
|
|
98
|
-
"@dxos/types": "0.8.4-main.9be5663bfe"
|
|
76
|
+
"@dxos/ai": "0.8.4-main.abd8ff62ef",
|
|
77
|
+
"@dxos/app-toolkit": "0.8.4-main.abd8ff62ef",
|
|
78
|
+
"@dxos/app-framework": "0.8.4-main.abd8ff62ef",
|
|
79
|
+
"@dxos/assistant": "0.8.4-main.abd8ff62ef",
|
|
80
|
+
"@dxos/async": "0.8.4-main.abd8ff62ef",
|
|
81
|
+
"@dxos/compute": "0.8.4-main.abd8ff62ef",
|
|
82
|
+
"@dxos/echo": "0.8.4-main.abd8ff62ef",
|
|
83
|
+
"@dxos/echo-db": "0.8.4-main.abd8ff62ef",
|
|
84
|
+
"@dxos/invariant": "0.8.4-main.abd8ff62ef",
|
|
85
|
+
"@dxos/display-name": "0.8.4-main.abd8ff62ef",
|
|
86
|
+
"@dxos/echo-react": "0.8.4-main.abd8ff62ef",
|
|
87
|
+
"@dxos/plugin-client": "0.8.4-main.abd8ff62ef",
|
|
88
|
+
"@dxos/plugin-graph": "0.8.4-main.abd8ff62ef",
|
|
89
|
+
"@dxos/plugin-markdown": "0.8.4-main.abd8ff62ef",
|
|
90
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.abd8ff62ef",
|
|
91
|
+
"@dxos/react-ui-gameboard": "0.8.4-main.abd8ff62ef",
|
|
92
|
+
"@dxos/react-client": "0.8.4-main.abd8ff62ef",
|
|
93
|
+
"@dxos/react-ui-sfx": "0.8.4-main.abd8ff62ef",
|
|
94
|
+
"@dxos/react-ui-stack": "0.8.4-main.abd8ff62ef",
|
|
95
|
+
"@dxos/schema": "0.8.4-main.abd8ff62ef",
|
|
96
|
+
"@dxos/plugin-space": "0.8.4-main.abd8ff62ef",
|
|
97
|
+
"@dxos/util": "0.8.4-main.abd8ff62ef",
|
|
98
|
+
"@dxos/types": "0.8.4-main.abd8ff62ef",
|
|
99
|
+
"@dxos/log": "0.8.4-main.abd8ff62ef"
|
|
99
100
|
},
|
|
100
101
|
"devDependencies": {
|
|
101
102
|
"@types/react": "~19.2.7",
|
|
102
103
|
"@types/react-dom": "~19.2.3",
|
|
103
104
|
"react": "~19.2.3",
|
|
104
105
|
"react-dom": "~19.2.3",
|
|
105
|
-
"vite": "^
|
|
106
|
-
"@dxos/plugin-
|
|
107
|
-
"@dxos/
|
|
108
|
-
"@dxos/
|
|
109
|
-
"@dxos/
|
|
106
|
+
"vite": "^8.0.10",
|
|
107
|
+
"@dxos/plugin-testing": "0.8.4-main.abd8ff62ef",
|
|
108
|
+
"@dxos/plugin-theme": "0.8.4-main.abd8ff62ef",
|
|
109
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef",
|
|
110
|
+
"@dxos/storybook-utils": "0.8.4-main.abd8ff62ef",
|
|
111
|
+
"@dxos/ui-theme": "0.8.4-main.abd8ff62ef"
|
|
110
112
|
},
|
|
111
113
|
"peerDependencies": {
|
|
112
114
|
"react": "~19.2.3",
|
|
113
115
|
"react-dom": "~19.2.3",
|
|
114
|
-
"@dxos/ui
|
|
115
|
-
"@dxos/
|
|
116
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef",
|
|
117
|
+
"@dxos/ui-theme": "0.8.4-main.abd8ff62ef"
|
|
116
118
|
},
|
|
117
119
|
"publishConfig": {
|
|
118
120
|
"access": "public"
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
6
7
|
|
|
7
8
|
import { Plugin } from '@dxos/app-framework';
|
|
8
9
|
import { AppPlugin } from '@dxos/app-toolkit';
|
|
9
|
-
import { Operation } from '@dxos/
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
11
|
+
import { Annotation } from '@dxos/echo';
|
|
10
12
|
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
11
13
|
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
12
14
|
|
|
15
|
+
import { BlueprintDefinition, OperationHandler } from '#capabilities';
|
|
13
16
|
import { meta } from '#meta';
|
|
14
17
|
import { Chess } from '#types';
|
|
15
18
|
|
|
16
|
-
// TODO(wittjosiah): Factor out shared modules.
|
|
17
19
|
export const ChessPlugin = Plugin.define(meta).pipe(
|
|
18
20
|
AppPlugin.addMetadataModule({
|
|
19
21
|
metadata: {
|
|
20
22
|
id: Chess.Game.typename,
|
|
21
23
|
metadata: {
|
|
24
|
+
icon: Annotation.IconAnnotation.get(Chess.Game).pipe(Option.getOrThrow).icon,
|
|
25
|
+
iconHue: Annotation.IconAnnotation.get(Chess.Game).pipe(Option.getOrThrow).hue ?? 'white',
|
|
22
26
|
createObject: ((props, options) =>
|
|
23
27
|
Effect.gen(function* () {
|
|
24
28
|
const object = Chess.make(props);
|
|
@@ -33,5 +37,9 @@ export const ChessPlugin = Plugin.define(meta).pipe(
|
|
|
33
37
|
},
|
|
34
38
|
}),
|
|
35
39
|
AppPlugin.addSchemaModule({ schema: [Chess.Game] }),
|
|
40
|
+
AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),
|
|
41
|
+
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
36
42
|
Plugin.make,
|
|
37
43
|
);
|
|
44
|
+
|
|
45
|
+
export default ChessPlugin;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { ActivationEvents } from '@dxos/app-framework';
|
|
8
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
9
|
+
import { ClientPlugin } from '@dxos/plugin-client';
|
|
10
|
+
import { createComposerTestApp } from '@dxos/plugin-testing/harness';
|
|
11
|
+
|
|
12
|
+
import { ChessPlugin } from '#plugin';
|
|
13
|
+
|
|
14
|
+
import { meta } from './meta';
|
|
15
|
+
import { Print } from './operations';
|
|
16
|
+
|
|
17
|
+
const moduleId = (name: string) => `${meta.id}.module.${name}`;
|
|
18
|
+
|
|
19
|
+
describe('ChessPlugin', () => {
|
|
20
|
+
test('modules activate on the expected events', async ({ expect }) => {
|
|
21
|
+
await using harness = await createComposerTestApp({
|
|
22
|
+
plugins: [ClientPlugin({}), ChessPlugin()],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Modules expected to be active after a normal startup.
|
|
26
|
+
expect(harness.manager.getActive()).toEqual(expect.arrayContaining([moduleId('metadata'), moduleId('schema')]));
|
|
27
|
+
|
|
28
|
+
// SetupArtifactDefinition is fired by AssistantPlugin, which can't be included here due to a workspace cycle.
|
|
29
|
+
await harness.fire(AppActivationEvents.SetupArtifactDefinition);
|
|
30
|
+
expect(harness.manager.getActive()).toContain(moduleId('BlueprintDefinition'));
|
|
31
|
+
|
|
32
|
+
// Operation handlers are not loaded on startup — SetupOperationHandler fires lazily when an operation is invoked.
|
|
33
|
+
await harness.fire(ActivationEvents.SetupOperationHandler);
|
|
34
|
+
expect(harness.manager.getActive()).toContain(moduleId('OperationHandler'));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('invokes the Print operation via the invoker capability', async ({ expect }) => {
|
|
38
|
+
await using harness = await createComposerTestApp({ plugins: [ChessPlugin()] });
|
|
39
|
+
const result = await harness.invoke(Print, {});
|
|
40
|
+
// Empty input returns empty ASCII (handler swallows errors for malformed FEN).
|
|
41
|
+
expect(typeof result.ascii).toBe('string');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('Print renders a PGN to ASCII board', async ({ expect }) => {
|
|
45
|
+
await using harness = await createComposerTestApp({ plugins: [ChessPlugin()] });
|
|
46
|
+
const { ascii } = await harness.invoke(Print, { pgn: '1. e4 e5' });
|
|
47
|
+
expect(ascii).toContain('a b c d e f g h');
|
|
48
|
+
});
|
|
49
|
+
});
|
package/src/ChessPlugin.tsx
CHANGED
|
@@ -7,18 +7,17 @@ import * as Option from 'effect/Option';
|
|
|
7
7
|
|
|
8
8
|
import { Plugin } from '@dxos/app-framework';
|
|
9
9
|
import { AppPlugin } from '@dxos/app-toolkit';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
10
11
|
import { Annotation } from '@dxos/echo';
|
|
11
|
-
import { Operation } from '@dxos/operation';
|
|
12
12
|
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
13
13
|
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
14
14
|
|
|
15
15
|
import { ChessBlueprint } from '#blueprints';
|
|
16
16
|
import { BlueprintDefinition, OperationHandler, ReactSurface } from '#capabilities';
|
|
17
17
|
import { meta } from '#meta';
|
|
18
|
+
import { translations } from '#translations';
|
|
18
19
|
import { Chess } from '#types';
|
|
19
20
|
|
|
20
|
-
import { translations } from './translations';
|
|
21
|
-
|
|
22
21
|
export const ChessPlugin = Plugin.define(meta).pipe(
|
|
23
22
|
AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),
|
|
24
23
|
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
@@ -47,3 +46,5 @@ export const ChessPlugin = Plugin.define(meta).pipe(
|
|
|
47
46
|
AppPlugin.addTranslationsModule({ translations }),
|
|
48
47
|
Plugin.make,
|
|
49
48
|
);
|
|
49
|
+
|
|
50
|
+
export default ChessPlugin;
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { Blueprint, Template } from '@dxos/blueprints';
|
|
5
|
+
import { Blueprint, Template } from '@dxos/compute';
|
|
7
6
|
import { trim } from '@dxos/util';
|
|
8
7
|
|
|
9
8
|
import { Create, Move, Play, Print } from '#operations';
|
|
@@ -27,7 +26,7 @@ const make = () =>
|
|
|
27
26
|
}),
|
|
28
27
|
});
|
|
29
28
|
|
|
30
|
-
const blueprint:
|
|
29
|
+
const blueprint: Blueprint.Definition = {
|
|
31
30
|
key: BLUEPRINT_KEY,
|
|
32
31
|
make,
|
|
33
32
|
};
|
|
@@ -12,7 +12,7 @@ import * as Schema from 'effect/Schema';
|
|
|
12
12
|
import { ToolResult, createTool } from '@dxos/ai';
|
|
13
13
|
import { Capabilities, Capability, type PromiseIntentDispatcher } from '@dxos/app-framework';
|
|
14
14
|
import { ArtifactId, VersionPin, createArtifactElement } from '@dxos/assistant';
|
|
15
|
-
import { defineArtifact } from '@dxos/
|
|
15
|
+
import { defineArtifact } from '@dxos/compute';
|
|
16
16
|
import { Obj } from '@dxos/echo';
|
|
17
17
|
import { invariant } from '@dxos/invariant';
|
|
18
18
|
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
@@ -121,7 +121,7 @@ export default Capability.makeModule(() =>
|
|
|
121
121
|
return ToolResult.Error(error.message);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
Obj.
|
|
124
|
+
Obj.update(game, (game) => {
|
|
125
125
|
game.pgn = chess.pgn();
|
|
126
126
|
});
|
|
127
127
|
return ToolResult.Success(game.pgn);
|
|
@@ -6,6 +6,8 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
|
|
7
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
8
|
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
10
|
+
import type { Blueprint } from '@dxos/compute';
|
|
9
11
|
|
|
10
12
|
import { ChessBlueprint } from '#blueprints';
|
|
11
13
|
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Capability } from '@dxos/app-framework';
|
|
6
|
-
|
|
6
|
+
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
7
|
+
import type { Blueprint, OperationHandlerSet } from '@dxos/compute';
|
|
7
8
|
|
|
8
9
|
export const BlueprintDefinition = Capability.lazy('BlueprintDefinition', () => import('./blueprint-definition'));
|
|
9
10
|
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
7
|
+
|
|
8
|
+
export const BlueprintDefinition = Capability.lazy<[], Capability.Any[]>(
|
|
9
|
+
'BlueprintDefinition',
|
|
10
|
+
() => import('./blueprint-definition'),
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
14
|
+
'OperationHandler',
|
|
15
|
+
() => import('./operation-handler'),
|
|
16
|
+
);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as Effect from 'effect/Effect';
|
|
4
4
|
|
|
5
5
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
6
|
-
import type { OperationHandlerSet } from '@dxos/
|
|
6
|
+
import type { OperationHandlerSet } from '@dxos/compute';
|
|
7
7
|
|
|
8
8
|
import { ChessHandlers } from '#operations';
|
|
9
9
|
|
|
@@ -17,17 +17,17 @@ export default Capability.makeModule(() =>
|
|
|
17
17
|
Capability.contributes(Capabilities.ReactSurface, [
|
|
18
18
|
Surface.create({
|
|
19
19
|
id: 'game',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
filter: AppSurface.oneOf(
|
|
21
|
+
AppSurface.object(AppSurface.Article, Chess.Game),
|
|
22
|
+
AppSurface.object(AppSurface.Section, Chess.Game),
|
|
23
|
+
),
|
|
23
24
|
component: ({ data, role }) => (
|
|
24
25
|
<ChessArticle role={role} subject={data.subject} attendableId={data.attendableId} />
|
|
25
26
|
),
|
|
26
27
|
}),
|
|
27
28
|
Surface.create({
|
|
28
29
|
id: 'game-card',
|
|
29
|
-
|
|
30
|
-
filter: AppSurface.objectCard(Chess.Game),
|
|
30
|
+
filter: AppSurface.object(AppSurface.Card, Chess.Game),
|
|
31
31
|
component: ({ data, role }) => <ChessCard role={role} subject={data.subject} />,
|
|
32
32
|
}),
|
|
33
33
|
]),
|
|
@@ -9,9 +9,9 @@ import { withClientProvider } from '@dxos/react-client/testing';
|
|
|
9
9
|
import { type Player } from '@dxos/react-ui-gameboard';
|
|
10
10
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
11
|
|
|
12
|
+
import { translations } from '#translations';
|
|
12
13
|
import { Chess } from '#types';
|
|
13
14
|
|
|
14
|
-
import { translations } from '../../translations';
|
|
15
15
|
import { Chessboard, type ChessboardController, type ChessboardInfoProps } from './Chessboard';
|
|
16
16
|
|
|
17
17
|
const SAMPLE_PGN =
|
|
@@ -58,7 +58,7 @@ export const Info = ({ classNames, orientation = 'white', onOrientationChange, o
|
|
|
58
58
|
<PlayerSelector
|
|
59
59
|
value={model.object.players?.[orientation === 'white' ? 'black' : 'white']}
|
|
60
60
|
onValueChange={(value) => {
|
|
61
|
-
Obj.
|
|
61
|
+
Obj.update(model.object, (obj) => {
|
|
62
62
|
obj.players![orientation === 'white' ? 'black' : 'white'] = value;
|
|
63
63
|
});
|
|
64
64
|
}}
|
|
@@ -87,7 +87,7 @@ export const Info = ({ classNames, orientation = 'white', onOrientationChange, o
|
|
|
87
87
|
<PlayerSelector
|
|
88
88
|
value={model.object.players?.[orientation]}
|
|
89
89
|
onValueChange={(value) => {
|
|
90
|
-
Obj.
|
|
90
|
+
Obj.update(model.object, (obj) => {
|
|
91
91
|
obj.players![orientation] = value;
|
|
92
92
|
});
|
|
93
93
|
}}
|
|
@@ -8,9 +8,9 @@ import React, { useMemo } from 'react';
|
|
|
8
8
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
9
9
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
10
10
|
|
|
11
|
+
import { translations } from '#translations';
|
|
11
12
|
import { Chess } from '#types';
|
|
12
13
|
|
|
13
|
-
import { translations } from '../../translations';
|
|
14
14
|
import { ChessArticle } from './ChessArticle';
|
|
15
15
|
|
|
16
16
|
type DefaultStoryProps = {
|
package/src/index.ts
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
5
9
|
export * from './blueprints';
|
|
6
|
-
export * from './components/Chessboard';
|
|
7
10
|
export * from './meta';
|
|
8
11
|
export * from './types';
|
|
9
12
|
|
|
10
|
-
export
|
|
13
|
+
export const ChessPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
package/src/operations/create.ts
CHANGED
package/src/operations/index.ts
CHANGED
package/src/operations/move.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { Chess as ChessJS } from 'chess.js';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
8
9
|
import { Database, Obj } from '@dxos/echo';
|
|
9
|
-
import { Operation } from '@dxos/operation';
|
|
10
10
|
|
|
11
11
|
import { type Chess } from '../types';
|
|
12
12
|
import { Move } from './definitions';
|
|
@@ -24,7 +24,7 @@ const handler: Operation.WithHandler<typeof Move> = Move.pipe(
|
|
|
24
24
|
|
|
25
25
|
chess.move(move, { strict: false });
|
|
26
26
|
const pgn = chess.pgn();
|
|
27
|
-
Obj.
|
|
27
|
+
Obj.update(obj, (obj) => {
|
|
28
28
|
const mutableGame = obj as Obj.Mutable<typeof obj>;
|
|
29
29
|
mutableGame.pgn = pgn;
|
|
30
30
|
});
|
package/src/operations/play.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { Chess as ChessJS } from 'chess.js';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
8
9
|
import { Database, Obj } from '@dxos/echo';
|
|
9
|
-
import { Operation } from '@dxos/operation';
|
|
10
10
|
|
|
11
11
|
import { type Chess } from '../types';
|
|
12
12
|
import { Play } from './definitions';
|
|
@@ -33,7 +33,7 @@ const handler: Operation.WithHandler<typeof Play> = Play.pipe(
|
|
|
33
33
|
|
|
34
34
|
chess.move(move, { strict: false });
|
|
35
35
|
const pgn = chess.pgn();
|
|
36
|
-
Obj.
|
|
36
|
+
Obj.update(object, (object) => {
|
|
37
37
|
const mutableGame = object as Obj.Mutable<typeof object>;
|
|
38
38
|
mutableGame.pgn = pgn;
|
|
39
39
|
});
|
package/src/operations/print.ts
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/operations/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { OperationHandlerSet } from '@dxos/operation';\n\nconst Handlers = OperationHandlerSet.lazy(\n () => import('./create'),\n () => import('./move'),\n () => import('./play'),\n () => import('./print'),\n);\n\nexport { Create, Move, Play, Print } from './definitions';\n\nexport const ChessHandlers = Handlers;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAAA;;;;;;;;AAIA,SAASA,2BAA2B;AAEpC,IAAMC,WAAWC,oBAAoBC,KACnC,MAAM,OAAO,uBAAA,GACb,MAAM,OAAO,qBAAA,GACb,MAAM,OAAO,qBAAA,GACb,MAAM,OAAO,sBAAA,CAAA;AAKR,IAAMC,gBAAgBH;",
|
|
6
|
-
"names": ["OperationHandlerSet", "Handlers", "OperationHandlerSet", "lazy", "ChessHandlers"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/blueprints/chess-blueprint.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type AppCapabilities } from '@dxos/app-toolkit';\nimport { Blueprint, Template } from '@dxos/blueprints';\nimport { trim } from '@dxos/util';\n\nimport { Create, Move, Play, Print } from '#operations';\n\nconst BLUEPRINT_KEY = 'org.dxos.blueprint.chess';\n\nconst operations = [Create, Move, Play, Print];\n\nconst make = () =>\n Blueprint.make({\n key: BLUEPRINT_KEY,\n name: 'Chess',\n tools: Blueprint.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 }),\n });\n\nconst blueprint: AppCapabilities.BlueprintDefinition = {\n key: BLUEPRINT_KEY,\n make,\n};\n\nexport default blueprint;\n"],
|
|
5
|
-
"mappings": ";AAKA,SAASA,WAAWC,gBAAgB;AACpC,SAASC,YAAY;AAErB,SAASC,QAAQC,MAAMC,MAAMC,aAAa;AAE1C,IAAMC,gBAAgB;AAEtB,IAAMC,aAAa;EAACC;EAAQC;EAAMC;EAAMC;;AAExC,IAAMC,OAAO,MACXC,UAAUD,KAAK;EACbE,KAAKR;EACLS,MAAM;EACNC,OAAOH,UAAUI,gBAAgB;IAAEV;EAAW,CAAA;EAC9CW,cAAcC,SAASP,KAAK;IAC1BQ,QAAQC;;;;;;EAMV,CAAA;AACF,CAAA;AAEF,IAAMC,YAAiD;EACrDR,KAAKR;EACLM;AACF;AAEA,IAAA,0BAAeU;",
|
|
6
|
-
"names": ["Blueprint", "Template", "trim", "Create", "Move", "Play", "Print", "BLUEPRINT_KEY", "operations", "Create", "Move", "Play", "Print", "make", "Blueprint", "key", "name", "tools", "toolDefinitions", "instructions", "Template", "source", "trim", "blueprint"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/operations/definitions.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Database, Ref } from '@dxos/echo';\nimport { Operation } from '@dxos/operation';\n\nimport { Chess } from '../types';\n\nexport const Create = Operation.make({\n meta: {\n key: 'org.dxos.function.chess.create',\n name: 'Create Chess',\n description: 'Creates a new chess game.',\n },\n input: Schema.Struct({\n name: Schema.optional(\n Schema.String.annotations({\n description: 'Name of the game.',\n }),\n ),\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: Chess.Game,\n services: [Database.Service],\n});\n\nexport const Move = Operation.make({\n meta: {\n key: 'org.dxos.function.chess.move',\n name: 'Move',\n description: 'Makes a move in the given chess game.',\n },\n input: Schema.Struct({\n game: Ref.Ref(Chess.Game).annotations({\n description: 'The ID of the chess object.',\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: 'org.dxos.function.chess.play',\n name: 'Play',\n description: 'Uses the chess engine to play the next move.',\n },\n input: Schema.Struct({\n game: Ref.Ref(Chess.Game).annotations({\n description: 'The ID of the chess object.',\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: 'org.dxos.function.chess.print',\n name: 'Print game',\n description: 'Prints the chess game to ASCII.',\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": ";;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,UAAUC,WAAW;AAC9B,SAASC,iBAAiB;AAInB,IAAMC,SAASC,UAAUC,KAAK;EACnCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBH,MAAaI,gBACJC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;IAEFM,KAAYH,gBACHC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;IAEFO,KAAYJ,gBACHC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;EAEJ,CAAA;EACAQ,QAAQC,cAAMC;EACdC,UAAU;IAACC,SAASC;;AACtB,CAAA;AAEO,IAAMC,OAAOnB,UAAUC,KAAK;EACjCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBa,MAAMC,IAAIA,IAAIP,cAAMC,IAAI,EAAEL,YAAY;MACpCL,aAAa;IACf,CAAA;IACAiB,MAAab,cAAOC,YAAY;MAC9BL,aAAa;MACbkB,UAAU;QAAC;QAAM;;IACnB,CAAA;EACF,CAAA;EACAV,QAAeN,cAAO;IACpBI,KAAYF,cAAOC,YAAY;MAC7BL,aAAa;IACf,CAAA;EACF,CAAA;EACAW,UAAU;IAACC,SAASC;;AACtB,CAAA;AAEO,IAAMM,OAAOxB,UAAUC,KAAK;EACjCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBa,MAAMC,IAAIA,IAAIP,cAAMC,IAAI,EAAEL,YAAY;MACpCL,aAAa;IACf,CAAA;IACAoB,MAAajB,gBAAgBkB,eAAQ,SAAS,SAAS,KAAA,CAAA,EAAQhB,YAAY;MACzEL,aAAa;MACbsB,cAAc;IAChB,CAAA;EACF,CAAA;EACAd,QAAeN,cAAO;IACpBI,KAAYF,cAAOC,YAAY;MAC7BL,aAAa;IACf,CAAA;IACAiB,MAAad,gBAAgBC,aAAM,EAAEC,YAAY;MAC/CL,aAAa;IACf,CAAA;EACF,CAAA;EACAW,UAAU;IAACC,SAASC;;AACtB,CAAA;AAEO,IAAMU,QAAQ5B,UAAUC,KAAK;EAClCC,MAAM;IACJC,KAAK;IACLC,MAAM;IACNC,aAAa;EACf;EACAC,OAAcC,cAAO;IACnBI,KAAYH,gBACHC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;IAEFO,KAAYJ,gBACHC,cAAOC,YAAY;MACxBL,aAAa;IACf,CAAA,CAAA;EAEJ,CAAA;EACAQ,QAAeN,cAAO;IACpBsB,OAAcpB;EAChB,CAAA;AACF,CAAA;",
|
|
6
|
-
"names": ["Schema", "Database", "Ref", "Operation", "Create", "Operation", "make", "meta", "key", "name", "description", "input", "Struct", "optional", "String", "annotations", "pgn", "fen", "output", "Chess", "Game", "services", "Database", "Service", "Move", "game", "Ref", "move", "examples", "Play", "side", "Literal", "defaultValue", "Print", "ascii"]
|
|
7
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import "../chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
|
-
// src/cli/plugin.ts
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
|
-
import { Plugin } from "@dxos/app-framework";
|
|
6
|
-
import { AppPlugin } from "@dxos/app-toolkit";
|
|
7
|
-
import { Operation } from "@dxos/operation";
|
|
8
|
-
import { SpaceOperation } from "@dxos/plugin-space/operations";
|
|
9
|
-
import { meta } from "#meta";
|
|
10
|
-
import { Chess } from "#types";
|
|
11
|
-
var ChessPlugin = Plugin.define(meta).pipe(AppPlugin.addMetadataModule({
|
|
12
|
-
metadata: {
|
|
13
|
-
id: Chess.Game.typename,
|
|
14
|
-
metadata: {
|
|
15
|
-
createObject: (props, options) => Effect.gen(function* () {
|
|
16
|
-
const object = Chess.make(props);
|
|
17
|
-
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
18
|
-
object,
|
|
19
|
-
target: options.target,
|
|
20
|
-
hidden: true,
|
|
21
|
-
targetNodeId: options.targetNodeId
|
|
22
|
-
});
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}), AppPlugin.addSchemaModule({
|
|
27
|
-
schema: [
|
|
28
|
-
Chess.Game
|
|
29
|
-
]
|
|
30
|
-
}), Plugin.make);
|
|
31
|
-
export {
|
|
32
|
-
ChessPlugin
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/cli/plugin.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/operation';\nimport { SpaceOperation } from '@dxos/plugin-space/operations';\nimport { type CreateObject } from '@dxos/plugin-space/types';\n\nimport { meta } from '#meta';\nimport { Chess } from '#types';\n\n// TODO(wittjosiah): Factor out shared modules.\nexport const ChessPlugin = Plugin.define(meta).pipe(\n AppPlugin.addMetadataModule({\n metadata: {\n id: Chess.Game.typename,\n metadata: {\n createObject: ((props, options) =>\n Effect.gen(function* () {\n const object = Chess.make(props);\n return yield* Operation.invoke(SpaceOperation.AddObject, {\n object,\n target: options.target,\n hidden: true,\n targetNodeId: options.targetNodeId,\n });\n })) satisfies CreateObject,\n },\n },\n }),\n AppPlugin.addSchemaModule({ schema: [Chess.Game] }),\n Plugin.make,\n);\n"],
|
|
5
|
-
"mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAc;AACvB,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,sBAAsB;AAG/B,SAASC,YAAY;AACrB,SAASC,aAAa;AAGf,IAAMC,cAAcC,OAAOC,OAAOC,IAAAA,EAAMC,KAC7CC,UAAUC,kBAAkB;EAC1BC,UAAU;IACRC,IAAIC,MAAMC,KAAKC;IACfJ,UAAU;MACRK,cAAe,CAACC,OAAOC,YACdC,WAAI,aAAA;AACT,cAAMC,SAASP,MAAMQ,KAAKJ,KAAAA;AAC1B,eAAO,OAAOK,UAAUC,OAAOC,eAAeC,WAAW;UACvDL;UACAM,QAAQR,QAAQQ;UAChBC,QAAQ;UACRC,cAAcV,QAAQU;QACxB,CAAA;MACF,CAAA;IACJ;EACF;AACF,CAAA,GACAnB,UAAUoB,gBAAgB;EAAEC,QAAQ;IAACjB,MAAMC;;AAAM,CAAA,GACjDT,OAAOgB,IAAI;",
|
|
6
|
-
"names": ["Effect", "Plugin", "AppPlugin", "Operation", "SpaceOperation", "meta", "Chess", "ChessPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addMetadataModule", "metadata", "id", "Chess", "Game", "typename", "createObject", "props", "options", "gen", "object", "make", "Operation", "invoke", "SpaceOperation", "AddObject", "target", "hidden", "targetNodeId", "addSchemaModule", "schema"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/operations/create.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Database } from '@dxos/echo';\nimport { Operation } from '@dxos/operation';\n\nimport { Chess } from '../types';\nimport { Create } from './definitions';\n\nconst handler: Operation.WithHandler<typeof Create> = Create.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ name, pgn, fen }) {\n return yield* Database.add(Chess.make({ name, pgn, fen }));\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAK1B,IAAMC,UAAgDC,OAAOC,KAC3DC,UAAUC,YACDC,UAAG,WAAW,EAAEC,MAAMC,KAAKC,IAAG,GAAE;AACrC,SAAO,OAAOC,SAASC,IAAIC,cAAMC,KAAK;IAAEN;IAAMC;IAAKC;EAAI,CAAA,CAAA;AACzD,CAAA,CAAA,CAAA;AAIJ,IAAA,iBAAeR;",
|
|
6
|
-
"names": ["Effect", "Database", "Operation", "handler", "Create", "pipe", "Operation", "withHandler", "fn", "name", "pgn", "fen", "Database", "add", "Chess", "make"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/operations/move.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess as ChessJS } from 'chess.js';\nimport * as Effect from 'effect/Effect';\n\nimport { Database, Obj } from '@dxos/echo';\nimport { Operation } from '@dxos/operation';\n\nimport { type Chess } from '../types';\nimport { Move } from './definitions';\n\nconst handler: Operation.WithHandler<typeof Move> = Move.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ game, move }) {\n const obj = (yield* Database.load(game)) as Chess.Game;\n const chess = new ChessJS();\n if (obj.pgn) {\n chess.loadPgn(obj.pgn);\n } else if (obj.fen) {\n chess.load(obj.fen);\n }\n\n chess.move(move, { strict: false });\n const pgn = chess.pgn();\n Obj.change(obj, (obj) => {\n const mutableGame = obj as Obj.Mutable<typeof obj>;\n mutableGame.pgn = pgn;\n });\n return { pgn };\n }),\n ),\n);\n\nexport default handler;\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAIA,SAASA,SAASC,eAAe;AACjC,YAAYC,YAAY;AAExB,SAASC,UAAUC,WAAW;AAC9B,SAASC,iBAAiB;AAK1B,IAAMC,UAA8CC,KAAKC,KACvDC,UAAUC,YACDC,UAAG,WAAW,EAAEC,MAAMC,KAAI,GAAE;AACjC,QAAMC,MAAO,OAAOC,SAASC,KAAKJ,IAAAA;AAClC,QAAMK,QAAQ,IAAIC,QAAAA;AAClB,MAAIJ,IAAIK,KAAK;AACXF,UAAMG,QAAQN,IAAIK,GAAG;EACvB,WAAWL,IAAIO,KAAK;AAClBJ,UAAMD,KAAKF,IAAIO,GAAG;EACpB;AAEAJ,QAAMJ,KAAKA,MAAM;IAAES,QAAQ;EAAM,CAAA;AACjC,QAAMH,MAAMF,MAAME,IAAG;AACrBI,MAAIC,OAAOV,KAAK,CAACA,SAAAA;AACf,UAAMW,cAAcX;AACpBW,gBAAYN,MAAMA;EACpB,CAAA;AACA,SAAO;IAAEA;EAAI;AACf,CAAA,CAAA,CAAA;AAIJ,IAAA,eAAeb;",
|
|
6
|
-
"names": ["Chess", "ChessJS", "Effect", "Database", "Obj", "Operation", "handler", "Move", "pipe", "Operation", "withHandler", "fn", "game", "move", "obj", "Database", "load", "chess", "ChessJS", "pgn", "loadPgn", "fen", "strict", "Obj", "change", "mutableGame"]
|
|
7
|
-
}
|