@dxos/plugin-chess 0.8.4-main.406dc2a → 0.8.4-main.52d7546f51
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/ChessboardContainer-GNSIZKY7.mjs +80 -0
- package/dist/lib/browser/ChessboardContainer-GNSIZKY7.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-YUKJZPOL.mjs +19 -0
- package/dist/lib/browser/blueprint-definition-YUKJZPOL.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +11 -0
- package/dist/lib/browser/{chunk-M63HYNXU.mjs → chunk-66H3V2YV.mjs} +18 -38
- package/dist/lib/browser/chunk-66H3V2YV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WSUUPPDK.mjs → chunk-H3NUMCQ6.mjs} +4 -9
- package/dist/lib/browser/chunk-H3NUMCQ6.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-MABHE5SS.mjs +277 -0
- package/dist/lib/browser/chunk-MABHE5SS.mjs.map +7 -0
- package/dist/lib/browser/chunk-PBRN5Q4R.mjs +227 -0
- package/dist/lib/browser/chunk-PBRN5Q4R.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KQOVCG7Z.mjs → chunk-QGVMZ4PK.mjs} +2 -2
- package/dist/lib/browser/cli/index.mjs +29 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +47 -70
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-C52R6BRL.mjs +38 -0
- package/dist/lib/browser/react-surface-C52R6BRL.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -5
- package/dist/lib/node-esm/ChessboardContainer-5OVYZMIW.mjs +81 -0
- package/dist/lib/node-esm/ChessboardContainer-5OVYZMIW.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-4HZ2HWWC.mjs +20 -0
- package/dist/lib/node-esm/blueprint-definition-4HZ2HWWC.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +12 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3MAU6WHB.mjs +228 -0
- package/dist/lib/node-esm/chunk-3MAU6WHB.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-5C2OYL2B.mjs → chunk-F5OMIM4F.mjs} +4 -8
- package/dist/lib/node-esm/chunk-F5OMIM4F.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-C55L2OCJ.mjs → chunk-IFK6UAKF.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-7YK5RFHY.mjs → chunk-OUNGNJFP.mjs} +18 -38
- package/dist/lib/node-esm/chunk-OUNGNJFP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-V6MKXXPO.mjs +278 -0
- package/dist/lib/node-esm/chunk-V6MKXXPO.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +30 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +47 -70
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-NW33JZ6J.mjs +39 -0
- package/dist/lib/node-esm/react-surface-NW33JZ6J.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +3 -5
- package/dist/types/src/ChessPlugin.d.ts +2 -1
- package/dist/types/src/ChessPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/chess-blueprint.d.ts +21 -0
- package/dist/types/src/blueprints/chess-blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.d.ts +15 -0
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/{functions → blueprints/functions}/index.d.ts +1 -0
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/move.d.ts +16 -0
- package/dist/types/src/blueprints/functions/move.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/play.d.ts +17 -0
- package/dist/types/src/blueprints/functions/play.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/print.d.ts +8 -0
- package/dist/types/src/blueprints/functions/print.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/artifact-definition.d.ts +12 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +10 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +1 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/Card.stories.d.ts +1 -8
- package/dist/types/src/components/Card.stories.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard.d.ts +2 -1
- package/dist/types/src/components/Chessboard.d.ts.map +1 -1
- package/dist/types/src/components/Chessboard.stories.d.ts +6 -4
- package/dist/types/src/components/Chessboard.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChessboardArticle.d.ts +3 -4
- package/dist/types/src/components/ChessboardArticle.d.ts.map +1 -1
- package/dist/types/src/components/ChessboardContainer.d.ts +3 -5
- package/dist/types/src/components/ChessboardContainer.d.ts.map +1 -1
- package/dist/types/src/components/Info.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- 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/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Chess.d.ts +18 -18
- 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 +58 -42
- package/src/ChessPlugin.tsx +26 -51
- package/src/blueprints/chess-blueprint.ts +28 -0
- package/src/{functions → blueprints/functions}/create.ts +10 -4
- package/src/{functions → blueprints/functions}/index.ts +1 -0
- package/src/{functions → blueprints/functions}/move.ts +11 -8
- package/src/{functions → blueprints/functions}/play.ts +11 -8
- package/src/blueprints/functions/print.ts +42 -0
- package/src/blueprints/index.ts +6 -0
- package/src/capabilities/artifact-definition/artifact-definition.ts +135 -0
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +24 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +1 -6
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +28 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +27 -0
- package/src/components/Card.stories.tsx +19 -38
- package/src/components/Chessboard.stories.tsx +16 -12
- package/src/components/Chessboard.tsx +26 -13
- package/src/components/ChessboardArticle.tsx +12 -11
- package/src/components/ChessboardContainer.tsx +9 -13
- package/src/components/Info.tsx +23 -13
- package/src/index.ts +1 -1
- package/src/meta.ts +5 -3
- package/src/translations.ts +1 -0
- package/src/types/Chess.ts +22 -30
- package/src/types/index.ts +0 -1
- package/dist/lib/browser/ChessboardContainer-OX6TILWD.mjs +0 -96
- package/dist/lib/browser/ChessboardContainer-OX6TILWD.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-UVRFUJYE.mjs +0 -11
- package/dist/lib/browser/chunk-E5NQWXQ7.mjs +0 -306
- package/dist/lib/browser/chunk-E5NQWXQ7.mjs.map +0 -7
- package/dist/lib/browser/chunk-M63HYNXU.mjs.map +0 -7
- package/dist/lib/browser/chunk-VA5TW6SD.mjs +0 -169
- package/dist/lib/browser/chunk-VA5TW6SD.mjs.map +0 -7
- package/dist/lib/browser/chunk-WSUUPPDK.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-OQPSVFOB.mjs +0 -25
- package/dist/lib/browser/intent-resolver-OQPSVFOB.mjs.map +0 -7
- package/dist/lib/browser/react-surface-OLAZCU2E.mjs +0 -38
- package/dist/lib/browser/react-surface-OLAZCU2E.mjs.map +0 -7
- package/dist/lib/node-esm/ChessboardContainer-PGDHBG6F.mjs +0 -97
- package/dist/lib/node-esm/ChessboardContainer-PGDHBG6F.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-Z47C4EEX.mjs +0 -12
- package/dist/lib/node-esm/chunk-5C2OYL2B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7YK5RFHY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DWGG7IGH.mjs +0 -307
- package/dist/lib/node-esm/chunk-DWGG7IGH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SW5N5XNV.mjs +0 -170
- package/dist/lib/node-esm/chunk-SW5N5XNV.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-KVGTUDXJ.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-KVGTUDXJ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-FIKCDZ5L.mjs +0 -39
- package/dist/lib/node-esm/react-surface-FIKCDZ5L.mjs.map +0 -7
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- 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/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.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.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/artifact-definition.ts +0 -129
- package/src/capabilities/blueprint-definition.ts +0 -36
- package/src/capabilities/intent-resolver.ts +0 -22
- package/src/capabilities/react-surface.tsx +0 -23
- package/src/types/ChessAction.ts +0 -19
- /package/dist/lib/browser/{blueprint-definition-UVRFUJYE.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-Z47C4EEX.mjs.map → browser/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-KQOVCG7Z.mjs.map → chunk-QGVMZ4PK.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-C55L2OCJ.mjs.map → chunk-IFK6UAKF.mjs.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-definition.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/artifact-definition.ts"],"names":[],"mappings":"AAYA,OAAO,EAAgB,KAAK,uBAAuB,EAAoC,MAAM,qBAAqB,CAAC;AAMnH,OAAO,EAAU,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAO7D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,QAAQ,CAAC,EAAE,uBAAuB,CAAC;KACpC;CACF;;AAED,wBAgGE"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Blueprint } from '@dxos/blueprints';
|
|
2
|
-
import { type FunctionDefinition } from '@dxos/functions';
|
|
3
|
-
export declare const BLUEPRINT_KEY = "dxos.org/blueprint/chess";
|
|
4
|
-
declare const _default: () => (import("@dxos/app-framework").Capability<import("@dxos/app-framework").InterfaceDef<FunctionDefinition<any, any>[]>> | import("@dxos/app-framework").Capability<import("@dxos/app-framework").InterfaceDef<Blueprint.Blueprint>>)[];
|
|
5
|
-
export default _default;
|
|
6
|
-
//# sourceMappingURL=blueprint-definition.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blueprint-definition.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/blueprint-definition.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAY,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAK1D,eAAO,MAAM,aAAa,6BAA6B,CAAC;;AAIxD,wBAoBE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAA+B,MAAM,qBAAqB,CAAC;;AAIhF,wBAaI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/react-surface.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAA8B,MAAM,qBAAqB,CAAC;;AAO/E,wBASK"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare const _default: import("@dxos/functions").FunctionDefinition<{
|
|
2
|
-
readonly pgn?: string | undefined;
|
|
3
|
-
readonly fen?: string | undefined;
|
|
4
|
-
}, import("@dxos/live-object").Live<import("@dxos/echo/Type").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
5
|
-
name?: string | undefined;
|
|
6
|
-
players?: {
|
|
7
|
-
white?: string | undefined;
|
|
8
|
-
black?: string | undefined;
|
|
9
|
-
} | undefined;
|
|
10
|
-
pgn?: string | undefined;
|
|
11
|
-
fen?: string | undefined;
|
|
12
|
-
}>>;
|
|
13
|
-
export default _default;
|
|
14
|
-
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/functions/create.ts"],"names":[],"mappings":";;;;;;;;;;;;AAWA,wBAoBG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/functions/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"move.d.ts","sourceRoot":"","sources":["../../../../src/functions/move.ts"],"names":[],"mappings":";;;;;;AAaA,wBA+BG"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const _default: import("@dxos/functions").FunctionDefinition<{
|
|
2
|
-
readonly id: string;
|
|
3
|
-
readonly side?: "white" | "black" | "any" | undefined;
|
|
4
|
-
}, {
|
|
5
|
-
readonly pgn: string;
|
|
6
|
-
readonly move?: string | undefined;
|
|
7
|
-
}>;
|
|
8
|
-
export default _default;
|
|
9
|
-
//# sourceMappingURL=play.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"play.d.ts","sourceRoot":"","sources":["../../../../src/functions/play.ts"],"names":[],"mappings":";;;;;;;AAaA,wBAyCG"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as Schema from 'effect/Schema';
|
|
2
|
-
declare const Create_base: Schema.TaggedClass<Create, `${string}/action/create`, {
|
|
3
|
-
readonly _tag: Schema.tag<`${string}/action/create`>;
|
|
4
|
-
} & {
|
|
5
|
-
input: Schema.Struct<{
|
|
6
|
-
name: Schema.optional<typeof Schema.String>;
|
|
7
|
-
pgn: Schema.optional<typeof Schema.String>;
|
|
8
|
-
}>;
|
|
9
|
-
output: Schema.Struct<{
|
|
10
|
-
object: import("@dxos/echo/Type").obj<Schema.Struct<{
|
|
11
|
-
name: Schema.optional<typeof Schema.String>;
|
|
12
|
-
players: Schema.optional<Schema.mutable<Schema.Struct<{
|
|
13
|
-
white: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
14
|
-
black: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
15
|
-
}>>>;
|
|
16
|
-
pgn: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
17
|
-
fen: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
18
|
-
}>>;
|
|
19
|
-
}>;
|
|
20
|
-
}>;
|
|
21
|
-
export declare class Create extends Create_base {
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=ChessAction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChessAction.d.ts","sourceRoot":"","sources":["../../../../src/types/ChessAction.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;AAMxC,qBAAa,MAAO,SAAQ,WAQ1B;CAAG"}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// ISSUE(burdon): defineArtifact
|
|
6
|
-
// @ts-nocheck
|
|
7
|
-
|
|
8
|
-
import { Chess as ChessJS } from 'chess.js';
|
|
9
|
-
import * as Function from 'effect/Function';
|
|
10
|
-
import * as Schema from 'effect/Schema';
|
|
11
|
-
|
|
12
|
-
import { ToolResult, createTool } from '@dxos/ai';
|
|
13
|
-
import { Capabilities, type PromiseIntentDispatcher, chain, contributes, createIntent } from '@dxos/app-framework';
|
|
14
|
-
import { ArtifactId, VersionPin, createArtifactElement } from '@dxos/assistant';
|
|
15
|
-
import { defineArtifact } from '@dxos/blueprints';
|
|
16
|
-
import { Obj } from '@dxos/echo';
|
|
17
|
-
import { invariant } from '@dxos/invariant';
|
|
18
|
-
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
19
|
-
import { Filter, type Space } from '@dxos/react-client/echo';
|
|
20
|
-
import { trim } from '@dxos/util';
|
|
21
|
-
|
|
22
|
-
import { meta } from '../meta';
|
|
23
|
-
import { Chess, ChessAction } from '../types';
|
|
24
|
-
|
|
25
|
-
// TODO(burdon): Factor out.
|
|
26
|
-
declare global {
|
|
27
|
-
interface ToolContextExtensions {
|
|
28
|
-
space?: Space;
|
|
29
|
-
dispatch?: PromiseIntentDispatcher;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default () => {
|
|
34
|
-
const definition = defineArtifact({
|
|
35
|
-
id: `artifact:${meta.id}`,
|
|
36
|
-
name: meta.name,
|
|
37
|
-
description: 'Provides a simple chess engine.',
|
|
38
|
-
instructions: trim`
|
|
39
|
-
- If the user's message relates to a chess game, you must return the chess game inside the artifact tag as a valid FEN string with no additional text.
|
|
40
|
-
- Always inspect the chess game at the start of every prompt realting to a chess game, as it might have changed since the interaction.
|
|
41
|
-
`,
|
|
42
|
-
schema: Chess.Game,
|
|
43
|
-
tools: [
|
|
44
|
-
createTool(meta.id, {
|
|
45
|
-
name: 'create',
|
|
46
|
-
description: 'Create a new chess game. Returns the artifact definition for the game.',
|
|
47
|
-
caption: 'Creating chess game...',
|
|
48
|
-
schema: Schema.Struct({
|
|
49
|
-
pgn: Schema.String.annotations({ description: 'The state of the chess game in the PGN format.' }),
|
|
50
|
-
}),
|
|
51
|
-
execute: async ({ pgn }, { extensions }) => {
|
|
52
|
-
invariant(extensions?.space, 'No space');
|
|
53
|
-
invariant(extensions?.dispatch, 'No intent dispatcher');
|
|
54
|
-
const intent = Function.pipe(
|
|
55
|
-
createIntent(ChessAction.Create, { pgn }),
|
|
56
|
-
chain(SpaceAction.AddObject, { target: extensions.space }),
|
|
57
|
-
);
|
|
58
|
-
const { data, error } = await extensions.dispatch(intent);
|
|
59
|
-
if (!data || error) {
|
|
60
|
-
return ToolResult.Error(error?.message ?? 'Failed to create chess game');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return ToolResult.Success(createArtifactElement(data.id), [
|
|
64
|
-
VersionPin.createBlock(VersionPin.fromObject(data.object)),
|
|
65
|
-
]);
|
|
66
|
-
},
|
|
67
|
-
}),
|
|
68
|
-
createTool(meta.id, {
|
|
69
|
-
name: 'list',
|
|
70
|
-
description: 'Query all active chess games.',
|
|
71
|
-
caption: 'Getting games...',
|
|
72
|
-
schema: Schema.Struct({}),
|
|
73
|
-
execute: async (_, { extensions }) => {
|
|
74
|
-
invariant(extensions?.space, 'No space');
|
|
75
|
-
const { objects: games } = await extensions.space.db.query(Filter.type(Chess.Game)).run();
|
|
76
|
-
invariant(games.length > 0, 'No chess games found');
|
|
77
|
-
|
|
78
|
-
return ToolResult.Success(games);
|
|
79
|
-
},
|
|
80
|
-
}),
|
|
81
|
-
createTool(meta.id, {
|
|
82
|
-
name: 'inspect',
|
|
83
|
-
description: 'Get the current state of the chess game.',
|
|
84
|
-
caption: 'Inspecting game...',
|
|
85
|
-
schema: Schema.Struct({ id: ArtifactId }),
|
|
86
|
-
execute: async ({ id }, { extensions }) => {
|
|
87
|
-
invariant(extensions?.space, 'No space');
|
|
88
|
-
const game = await extensions.space.db
|
|
89
|
-
.query(Filter.ids(ArtifactId.toDXN(id, extensions.space.id).toString()))
|
|
90
|
-
.first();
|
|
91
|
-
invariant(Obj.instanceOf(Chess.Game, game));
|
|
92
|
-
|
|
93
|
-
return ToolResult.Success(game.pgn);
|
|
94
|
-
},
|
|
95
|
-
}),
|
|
96
|
-
createTool(meta.id, {
|
|
97
|
-
name: 'move',
|
|
98
|
-
description: 'Make a move in the chess game.',
|
|
99
|
-
caption: 'Making chess move...',
|
|
100
|
-
schema: Schema.Struct({
|
|
101
|
-
id: ArtifactId,
|
|
102
|
-
move: Schema.String.annotations({
|
|
103
|
-
description: 'The move to make in the chess game.',
|
|
104
|
-
examples: ['e4', 'Bf3'],
|
|
105
|
-
}),
|
|
106
|
-
}),
|
|
107
|
-
execute: async ({ id, move }, { extensions }) => {
|
|
108
|
-
invariant(extensions?.space, 'No space');
|
|
109
|
-
const game = await extensions.space.db
|
|
110
|
-
.query(Filter.ids(ArtifactId.toDXN(id, extensions.space.id).toString()))
|
|
111
|
-
.first();
|
|
112
|
-
invariant(Obj.instanceOf(Chess.Game, game));
|
|
113
|
-
|
|
114
|
-
const chess = new ChessJS(game.pgn);
|
|
115
|
-
try {
|
|
116
|
-
chess.move(move);
|
|
117
|
-
} catch (error: any) {
|
|
118
|
-
return ToolResult.Error(error.message);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
game.pgn = chess.pgn();
|
|
122
|
-
return ToolResult.Success(game.pgn);
|
|
123
|
-
},
|
|
124
|
-
}),
|
|
125
|
-
],
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
return contributes(Capabilities.ArtifactDefinition, definition);
|
|
129
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
-
import { Blueprint, Template } from '@dxos/blueprints';
|
|
7
|
-
import { type FunctionDefinition } from '@dxos/functions';
|
|
8
|
-
import { trim } from '@dxos/util';
|
|
9
|
-
|
|
10
|
-
import { create, move, play } from '../functions';
|
|
11
|
-
|
|
12
|
-
export const BLUEPRINT_KEY = 'dxos.org/blueprint/chess';
|
|
13
|
-
|
|
14
|
-
const functions: FunctionDefinition[] = [create, move, play];
|
|
15
|
-
|
|
16
|
-
export default () => {
|
|
17
|
-
return [
|
|
18
|
-
contributes(Capabilities.Functions, functions),
|
|
19
|
-
contributes(
|
|
20
|
-
Capabilities.BlueprintDefinition,
|
|
21
|
-
Blueprint.make({
|
|
22
|
-
key: BLUEPRINT_KEY,
|
|
23
|
-
name: 'Chess',
|
|
24
|
-
tools: Blueprint.toolDefinitions({ functions }),
|
|
25
|
-
instructions: Template.make({
|
|
26
|
-
source: trim`
|
|
27
|
-
You are an expert chess player.
|
|
28
|
-
To analyze a game you can access the "pgn" property by loading the context object that represents the current game.
|
|
29
|
-
You could suggest a good next move or offer to play a move.
|
|
30
|
-
Don't actually make a move unless you are asked to.
|
|
31
|
-
`,
|
|
32
|
-
}),
|
|
33
|
-
}),
|
|
34
|
-
),
|
|
35
|
-
];
|
|
36
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes, createResolver } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
import { Chess, ChessAction } from '../types';
|
|
8
|
-
|
|
9
|
-
export default () =>
|
|
10
|
-
contributes(
|
|
11
|
-
Capabilities.IntentResolver,
|
|
12
|
-
createResolver({
|
|
13
|
-
intent: ChessAction.Create,
|
|
14
|
-
resolve: ({ name, pgn }) => {
|
|
15
|
-
return {
|
|
16
|
-
data: {
|
|
17
|
-
object: Chess.makeGame({ name, pgn }),
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
}),
|
|
22
|
-
);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
|
-
import { Obj } from '@dxos/echo';
|
|
9
|
-
|
|
10
|
-
import { ChessboardContainer } from '../components';
|
|
11
|
-
import { meta } from '../meta';
|
|
12
|
-
import { Chess } from '../types';
|
|
13
|
-
|
|
14
|
-
export default () =>
|
|
15
|
-
contributes(Capabilities.ReactSurface, [
|
|
16
|
-
createSurface({
|
|
17
|
-
id: meta.id,
|
|
18
|
-
role: ['article', 'section', 'card--intrinsic', 'card--extrinsic', 'card--popover', 'card--transclusion'],
|
|
19
|
-
// TODO(burdon): Could this be standardized so that we don't require a subject property.
|
|
20
|
-
filter: (data): data is { subject: Chess.Game } => Obj.instanceOf(Chess.Game, data.subject),
|
|
21
|
-
component: ({ data, role }) => <ChessboardContainer game={data.subject} role={role} />,
|
|
22
|
-
}),
|
|
23
|
-
]);
|
package/src/types/ChessAction.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
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-UVRFUJYE.mjs.map → blueprints/index.mjs.map}
RENAMED
|
File without changes
|
/package/dist/lib/{node-esm/blueprint-definition-Z47C4EEX.mjs.map → browser/chunk-J5LGTIGS.mjs.map}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|