@dxos/plugin-chess 0.8.4-main.a4bbb77 → 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 +14 -0
- package/dist/lib/browser/chunk-H6SON7WG.mjs +28 -0
- package/dist/lib/browser/chunk-H6SON7WG.mjs.map +7 -0
- package/dist/lib/browser/chunk-IN3LZ2OO.mjs +62 -0
- package/dist/lib/browser/chunk-IN3LZ2OO.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-JYP24G6K.mjs +36 -0
- package/dist/lib/browser/chunk-JYP24G6K.mjs.map +7 -0
- package/dist/lib/browser/chunk-OBKYFOJA.mjs +110 -0
- package/dist/lib/browser/chunk-OBKYFOJA.mjs.map +7 -0
- package/dist/lib/browser/create-2ME3FNBX.mjs +24 -0
- package/dist/lib/browser/create-2ME3FNBX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +30 -111
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/move-TTMIPD5J.mjs +36 -0
- package/dist/lib/browser/move-TTMIPD5J.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +19 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/play-GHXPV2T2.mjs +45 -0
- package/dist/lib/browser/play-GHXPV2T2.mjs.map +7 -0
- package/dist/lib/browser/print-RNAGAOM7.mjs +30 -0
- package/dist/lib/browser/print-RNAGAOM7.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +38 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -5
- package/dist/lib/node-esm/blueprints/index.mjs +15 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4C4GPZTA.mjs +29 -0
- package/dist/lib/node-esm/chunk-4C4GPZTA.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-G2EHRXHX.mjs +111 -0
- package/dist/lib/node-esm/chunk-G2EHRXHX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NSFPC4IO.mjs +38 -0
- package/dist/lib/node-esm/chunk-NSFPC4IO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-OHBKSL2Q.mjs +63 -0
- package/dist/lib/node-esm/chunk-OHBKSL2Q.mjs.map +7 -0
- package/dist/lib/node-esm/create-CC2P7GPT.mjs +25 -0
- package/dist/lib/node-esm/create-CC2P7GPT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +30 -111
- 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-CYHXWHHM.mjs +37 -0
- package/dist/lib/node-esm/move-CYHXWHHM.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +20 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/play-KTNK2PBL.mjs +46 -0
- package/dist/lib/node-esm/play-KTNK2PBL.mjs.map +7 -0
- package/dist/lib/node-esm/print-P23VKVNU.mjs +31 -0
- package/dist/lib/node-esm/print-P23VKVNU.mjs.map +7 -0
- 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 +3 -5
- package/dist/types/src/ChessPlugin.d.ts +3 -1
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/ChessPlugin.node.d.ts +4 -0
- 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 +4 -0
- package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +3 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition.d.ts +3 -2
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -4
- 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 +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/{Chessboard.d.ts → Chessboard/Chessboard.d.ts} +8 -8
- package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +65 -0
- package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Info.d.ts → Chessboard/Info.d.ts} +5 -6
- package/dist/types/src/components/Chessboard/Info.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/index.d.ts +2 -0
- package/dist/types/src/components/Chessboard/index.d.ts.map +1 -0
- package/dist/types/src/components/Chessboard/types.d.ts +8 -0
- package/dist/types/src/components/Chessboard/types.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts +6 -0
- package/dist/types/src/containers/ChessArticle/ChessArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts +64 -0
- package/dist/types/src/containers/ChessArticle/ChessArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ChessArticle/index.d.ts +2 -0
- package/dist/types/src/containers/ChessArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChessCard/ChessCard.d.ts +6 -0
- package/dist/types/src/containers/ChessCard/ChessCard.d.ts.map +1 -0
- package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts +15 -0
- package/dist/types/src/containers/ChessCard/ChessCard.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ChessCard/index.d.ts +2 -0
- package/dist/types/src/containers/ChessCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +51 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/move.d.ts +5 -0
- package/dist/types/src/operations/move.d.ts.map +1 -0
- package/dist/types/src/operations/play.d.ts +5 -0
- package/dist/types/src/operations/play.d.ts.map +1 -0
- package/dist/types/src/operations/print.d.ts +5 -0
- package/dist/types/src/operations/print.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +40 -22
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts +19 -19
- package/dist/types/src/types/Chess.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +83 -51
- package/src/ChessPlugin.node.ts +45 -0
- package/src/ChessPlugin.test.ts +49 -0
- package/src/ChessPlugin.tsx +43 -53
- package/src/blueprints/chess-blueprint.ts +34 -0
- package/src/blueprints/index.ts +6 -0
- package/src/capabilities/artifact-definition.ts +100 -93
- package/src/capabilities/blueprint-definition.ts +11 -28
- package/src/capabilities/index.ts +9 -6
- package/src/capabilities/node.ts +16 -0
- package/src/capabilities/operation-handler.ts +14 -0
- package/src/capabilities/react-surface.tsx +27 -15
- package/src/components/Chessboard/Chessboard.stories.tsx +94 -0
- package/src/components/{Chessboard.tsx → Chessboard/Chessboard.tsx} +32 -29
- package/src/components/{Info.tsx → Chessboard/Info.tsx} +42 -25
- package/src/components/Chessboard/index.ts +5 -0
- package/src/components/Chessboard/types.ts +18 -0
- package/src/components/index.ts +1 -5
- package/src/containers/ChessArticle/ChessArticle.stories.tsx +53 -0
- package/src/containers/ChessArticle/ChessArticle.tsx +73 -0
- package/src/containers/ChessArticle/index.ts +5 -0
- package/src/containers/ChessCard/ChessCard.stories.tsx +42 -0
- package/src/containers/ChessCard/ChessCard.tsx +22 -0
- package/src/containers/ChessCard/index.ts +5 -0
- package/src/containers/index.ts +8 -0
- package/src/index.ts +6 -4
- package/src/meta.ts +6 -4
- package/src/operations/create.ts +21 -0
- package/src/operations/definitions.ts +109 -0
- package/src/operations/index.ts +16 -0
- package/src/operations/move.ts +36 -0
- package/src/operations/play.ts +45 -0
- package/src/operations/print.ts +28 -0
- package/src/translations.ts +21 -19
- package/src/types/Chess.ts +30 -34
- package/src/types/index.ts +0 -1
- package/dist/lib/browser/ChessboardContainer-JOCAWL5W.mjs +0 -97
- package/dist/lib/browser/ChessboardContainer-JOCAWL5W.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-LC4GNYMG.mjs +0 -11
- package/dist/lib/browser/chunk-2EN3CBLB.mjs +0 -8
- package/dist/lib/browser/chunk-2EN3CBLB.mjs.map +0 -7
- package/dist/lib/browser/chunk-3WEALY7P.mjs +0 -84
- package/dist/lib/browser/chunk-3WEALY7P.mjs.map +0 -7
- package/dist/lib/browser/chunk-4ULSTPL6.mjs +0 -166
- package/dist/lib/browser/chunk-4ULSTPL6.mjs.map +0 -7
- package/dist/lib/browser/chunk-NR4YFUK7.mjs +0 -306
- package/dist/lib/browser/chunk-NR4YFUK7.mjs.map +0 -7
- package/dist/lib/browser/chunk-WSUUPPDK.mjs +0 -26
- package/dist/lib/browser/chunk-WSUUPPDK.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-PMP36Y5B.mjs +0 -25
- package/dist/lib/browser/intent-resolver-PMP36Y5B.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TSLFLTXN.mjs +0 -38
- package/dist/lib/browser/react-surface-TSLFLTXN.mjs.map +0 -7
- package/dist/lib/node-esm/ChessboardContainer-XAVVBRFW.mjs +0 -98
- package/dist/lib/node-esm/ChessboardContainer-XAVVBRFW.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-FBGRWYEW.mjs +0 -12
- package/dist/lib/node-esm/chunk-5C2OYL2B.mjs +0 -27
- package/dist/lib/node-esm/chunk-5C2OYL2B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7PHZFXU5.mjs +0 -10
- package/dist/lib/node-esm/chunk-7PHZFXU5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AR3TI5LX.mjs +0 -167
- package/dist/lib/node-esm/chunk-AR3TI5LX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LMXETYDF.mjs +0 -85
- package/dist/lib/node-esm/chunk-LMXETYDF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VVTQFCUK.mjs +0 -307
- package/dist/lib/node-esm/chunk-VVTQFCUK.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-5P7Y2ZKB.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-5P7Y2ZKB.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-AN4SMEDU.mjs +0 -39
- package/dist/lib/node-esm/react-surface-AN4SMEDU.mjs.map +0 -7
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/Card.stories.d.ts +0 -13
- package/dist/types/src/components/Card.stories.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard.d.ts.map +0 -1
- package/dist/types/src/components/Chessboard.stories.d.ts +0 -44
- package/dist/types/src/components/Chessboard.stories.d.ts.map +0 -1
- package/dist/types/src/components/ChessboardArticle.d.ts +0 -7
- package/dist/types/src/components/ChessboardArticle.d.ts.map +0 -1
- package/dist/types/src/components/ChessboardContainer.d.ts +0 -9
- package/dist/types/src/components/ChessboardContainer.d.ts.map +0 -1
- package/dist/types/src/components/Info.d.ts.map +0 -1
- package/dist/types/src/functions/create.d.ts +0 -14
- package/dist/types/src/functions/create.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -4
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/move.d.ts +0 -8
- package/dist/types/src/functions/move.d.ts.map +0 -1
- package/dist/types/src/functions/play.d.ts +0 -9
- package/dist/types/src/functions/play.d.ts.map +0 -1
- package/dist/types/src/types/ChessAction.d.ts +0 -24
- package/dist/types/src/types/ChessAction.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -22
- package/src/components/Card.stories.tsx +0 -66
- package/src/components/Chessboard.stories.tsx +0 -49
- package/src/components/ChessboardArticle.tsx +0 -69
- package/src/components/ChessboardContainer.tsx +0 -44
- package/src/functions/create.ts +0 -31
- package/src/functions/index.ts +0 -7
- package/src/functions/move.ts +0 -44
- package/src/functions/play.ts +0 -54
- package/src/types/ChessAction.ts +0 -19
- /package/dist/lib/browser/{blueprint-definition-LC4GNYMG.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-FBGRWYEW.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
package/src/functions/move.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Chess as ChessJS } from 'chess.js';
|
|
6
|
-
import { Effect, Schema } from 'effect';
|
|
7
|
-
|
|
8
|
-
import { ArtifactId } from '@dxos/assistant';
|
|
9
|
-
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
10
|
-
|
|
11
|
-
import { Chess } from '../types';
|
|
12
|
-
|
|
13
|
-
export default defineFunction({
|
|
14
|
-
key: 'dxos.org/function/chess/move',
|
|
15
|
-
name: 'Move',
|
|
16
|
-
description: 'Makes a move in the given chess game.',
|
|
17
|
-
inputSchema: Schema.Struct({
|
|
18
|
-
id: ArtifactId.annotations({
|
|
19
|
-
description: 'The ID of the chess object.',
|
|
20
|
-
}),
|
|
21
|
-
move: Schema.String.annotations({
|
|
22
|
-
description: 'The move to make in the chess game.',
|
|
23
|
-
examples: ['e4', 'Bf3'],
|
|
24
|
-
}),
|
|
25
|
-
}),
|
|
26
|
-
outputSchema: Schema.Struct({
|
|
27
|
-
pgn: Schema.String.annotations({
|
|
28
|
-
description: 'The PGN of the game after the move was played.',
|
|
29
|
-
}),
|
|
30
|
-
}),
|
|
31
|
-
handler: Effect.fn(function* ({ data: { id, move } }) {
|
|
32
|
-
const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Chess.Game);
|
|
33
|
-
const chess = new ChessJS();
|
|
34
|
-
if (object.pgn) {
|
|
35
|
-
chess.loadPgn(object.pgn);
|
|
36
|
-
} else if (object.fen) {
|
|
37
|
-
chess.load(object.fen);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
chess.move(move, { strict: false });
|
|
41
|
-
object.pgn = chess.pgn();
|
|
42
|
-
return { pgn: object.pgn };
|
|
43
|
-
}),
|
|
44
|
-
});
|
package/src/functions/play.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Chess as ChessJS } from 'chess.js';
|
|
6
|
-
import { Effect, Schema } from 'effect';
|
|
7
|
-
|
|
8
|
-
import { ArtifactId } from '@dxos/assistant';
|
|
9
|
-
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
10
|
-
|
|
11
|
-
import { Chess } from '../types';
|
|
12
|
-
|
|
13
|
-
export default defineFunction({
|
|
14
|
-
key: 'dxos.org/function/chess/play',
|
|
15
|
-
name: 'Play',
|
|
16
|
-
description: 'Uses the chess engine to play the next move.',
|
|
17
|
-
inputSchema: Schema.Struct({
|
|
18
|
-
id: ArtifactId.annotations({
|
|
19
|
-
description: 'The ID of the chess object.',
|
|
20
|
-
}),
|
|
21
|
-
side: Schema.optional(Schema.Literal('white', 'black', 'any')).annotations({
|
|
22
|
-
description: 'The side to play.',
|
|
23
|
-
defaultValue: 'any',
|
|
24
|
-
}),
|
|
25
|
-
}),
|
|
26
|
-
outputSchema: Schema.Struct({
|
|
27
|
-
pgn: Schema.String.annotations({
|
|
28
|
-
description: 'The PGN of the game after the move was played.',
|
|
29
|
-
}),
|
|
30
|
-
move: Schema.optional(Schema.String).annotations({
|
|
31
|
-
description: 'The move that was played.',
|
|
32
|
-
}),
|
|
33
|
-
}),
|
|
34
|
-
handler: Effect.fn(function* ({ data: { id, side = 'any' } }) {
|
|
35
|
-
const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Chess.Game);
|
|
36
|
-
const chess = new ChessJS();
|
|
37
|
-
if (object.pgn) {
|
|
38
|
-
chess.loadPgn(object.pgn);
|
|
39
|
-
} else if (object.fen) {
|
|
40
|
-
chess.load(object.fen);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (!(side === 'any' || (chess.turn() === 'w' && side === 'white') || (chess.turn() === 'b' && side === 'black'))) {
|
|
44
|
-
return { move: undefined, pgn: object.pgn! };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const moves = chess.moves();
|
|
48
|
-
const move = moves[Math.floor(Math.random() * moves.length)];
|
|
49
|
-
|
|
50
|
-
chess.move(move, { strict: false });
|
|
51
|
-
object.pgn = chess.pgn();
|
|
52
|
-
return { move, pgn: object.pgn };
|
|
53
|
-
}),
|
|
54
|
-
});
|
package/src/types/ChessAction.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
|
-
|
|
7
|
-
import { meta } from '../meta';
|
|
8
|
-
|
|
9
|
-
import { Game } from './Chess';
|
|
10
|
-
|
|
11
|
-
export class Create extends Schema.TaggedClass<Create>()(`${meta.id}/action/create`, {
|
|
12
|
-
input: Schema.Struct({
|
|
13
|
-
name: Schema.optional(Schema.String),
|
|
14
|
-
pgn: Schema.optional(Schema.String),
|
|
15
|
-
}),
|
|
16
|
-
output: Schema.Struct({
|
|
17
|
-
object: Game,
|
|
18
|
-
}),
|
|
19
|
-
}) {}
|
/package/dist/lib/browser/{blueprint-definition-LC4GNYMG.mjs.map → blueprints/index.mjs.map}
RENAMED
|
File without changes
|
/package/dist/lib/{node-esm/blueprint-definition-FBGRWYEW.mjs.map → browser/chunk-J5LGTIGS.mjs.map}
RENAMED
|
File without changes
|