@dxos/plugin-chess 0.8.2-main.f11618f → 0.8.2-main.fbd8ed0
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/{artifact-definition-HTXW3AKR.mjs → artifact-definition-YUAPS5GU.mjs} +11 -11
- package/dist/lib/browser/artifact-definition-YUAPS5GU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EIRRN4WP.mjs → chunk-FSWWNFQE.mjs} +20 -18
- package/dist/lib/browser/chunk-FSWWNFQE.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +4 -4
- package/dist/lib/browser/{intent-resolver-QECLUB7C.mjs → intent-resolver-O5FBTUC6.mjs} +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-CMUAPVQA.mjs → react-surface-IT4WC47R.mjs} +2 -2
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/{artifact-definition-XRVEXVXI.cjs → artifact-definition-N5H23WYL.cjs} +22 -22
- package/dist/lib/node/artifact-definition-N5H23WYL.cjs.map +7 -0
- package/dist/lib/node/{chunk-SVNVQAMR.cjs → chunk-ZYU6LFL4.cjs} +21 -19
- package/dist/lib/node/chunk-ZYU6LFL4.cjs.map +7 -0
- package/dist/lib/node/index.cjs +18 -18
- package/dist/lib/node/{intent-resolver-JMO3PEBA.cjs → intent-resolver-TSN5O423.cjs} +7 -7
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-GSLVN4KN.cjs → react-surface-6OYEX6SB.cjs} +8 -8
- package/dist/lib/node/types/index.cjs +5 -5
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{artifact-definition-VPB2TSLQ.mjs → artifact-definition-NGV6PDXW.mjs} +11 -11
- package/dist/lib/node-esm/artifact-definition-NGV6PDXW.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-WDC3FJ53.mjs → chunk-FKW7YGV5.mjs} +20 -18
- package/dist/lib/node-esm/chunk-FKW7YGV5.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +4 -4
- package/dist/lib/node-esm/{intent-resolver-BDI3HVPZ.mjs → intent-resolver-PXPQTYAA.mjs} +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-L5YMO5FM.mjs → react-surface-G4CSGFTJ.mjs} +2 -2
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/components/ChessComponent.d.ts.map +1 -1
- package/dist/types/src/components/ChessContainer.d.ts.map +1 -1
- package/dist/types/src/components/PlayerSelector.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -8
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +15 -15
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +7 -7
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -21
- package/src/capabilities/artifact-definition.ts +9 -9
- package/src/types/schema.ts +15 -13
- package/src/types/types.ts +8 -6
- package/dist/lib/browser/artifact-definition-HTXW3AKR.mjs.map +0 -7
- package/dist/lib/browser/chunk-EIRRN4WP.mjs.map +0 -7
- package/dist/lib/node/artifact-definition-XRVEXVXI.cjs.map +0 -7
- package/dist/lib/node/chunk-SVNVQAMR.cjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-VPB2TSLQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WDC3FJ53.mjs.map +0 -7
- /package/dist/lib/browser/{intent-resolver-QECLUB7C.mjs.map → intent-resolver-O5FBTUC6.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-CMUAPVQA.mjs.map → react-surface-IT4WC47R.mjs.map} +0 -0
- /package/dist/lib/node/{intent-resolver-JMO3PEBA.cjs.map → intent-resolver-TSN5O423.cjs.map} +0 -0
- /package/dist/lib/node/{react-surface-GSLVN4KN.cjs.map → react-surface-6OYEX6SB.cjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-resolver-BDI3HVPZ.mjs.map → intent-resolver-PXPQTYAA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-surface-L5YMO5FM.mjs.map → react-surface-G4CSGFTJ.mjs.map} +0 -0
package/dist/lib/browser/{artifact-definition-HTXW3AKR.mjs → artifact-definition-YUAPS5GU.mjs}
RENAMED
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
ChessAction,
|
|
3
3
|
ChessType,
|
|
4
4
|
meta
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FSWWNFQE.mjs";
|
|
6
6
|
|
|
7
7
|
// packages/plugins/plugin-chess/src/capabilities/artifact-definition.ts
|
|
8
8
|
import { Chess } from "chess.js";
|
|
9
|
-
import { pipe } from "effect";
|
|
9
|
+
import { pipe, Schema } from "effect";
|
|
10
10
|
import { Capabilities, chain, contributes, createIntent } from "@dxos/app-framework";
|
|
11
11
|
import { ArtifactId, defineArtifact, defineTool, ToolResult } from "@dxos/artifact";
|
|
12
12
|
import { createArtifactElement, VersionPin } from "@dxos/assistant";
|
|
13
|
-
import { isInstanceOf
|
|
13
|
+
import { isInstanceOf } from "@dxos/echo-schema";
|
|
14
14
|
import { invariant } from "@dxos/invariant";
|
|
15
15
|
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
16
16
|
import { Filter } from "@dxos/react-client/echo";
|
|
@@ -30,8 +30,8 @@ var artifact_definition_default = () => {
|
|
|
30
30
|
name: "create",
|
|
31
31
|
description: "Create a new chess game. Returns the artifact definition for the game.",
|
|
32
32
|
caption: "Creating chess game...",
|
|
33
|
-
schema:
|
|
34
|
-
fen:
|
|
33
|
+
schema: Schema.Struct({
|
|
34
|
+
fen: Schema.String.annotations({
|
|
35
35
|
description: "The state of the chess game in the FEN format."
|
|
36
36
|
})
|
|
37
37
|
}),
|
|
@@ -72,7 +72,7 @@ var artifact_definition_default = () => {
|
|
|
72
72
|
name: "list",
|
|
73
73
|
description: "Query all active chess games.",
|
|
74
74
|
caption: "Getting games...",
|
|
75
|
-
schema:
|
|
75
|
+
schema: Schema.Struct({}),
|
|
76
76
|
execute: async (_, { extensions }) => {
|
|
77
77
|
invariant(extensions?.space, "No space", {
|
|
78
78
|
F: __dxlog_file,
|
|
@@ -83,7 +83,7 @@ var artifact_definition_default = () => {
|
|
|
83
83
|
"'No space'"
|
|
84
84
|
]
|
|
85
85
|
});
|
|
86
|
-
const { objects: games } = await extensions.space.db.query(Filter.
|
|
86
|
+
const { objects: games } = await extensions.space.db.query(Filter.type(ChessType)).run();
|
|
87
87
|
invariant(games.length > 0, "No chess games found", {
|
|
88
88
|
F: __dxlog_file,
|
|
89
89
|
L: 70,
|
|
@@ -100,7 +100,7 @@ var artifact_definition_default = () => {
|
|
|
100
100
|
name: "inspect",
|
|
101
101
|
description: "Get the current state of the chess game.",
|
|
102
102
|
caption: "Inspecting game...",
|
|
103
|
-
schema:
|
|
103
|
+
schema: Schema.Struct({
|
|
104
104
|
id: ArtifactId
|
|
105
105
|
}),
|
|
106
106
|
execute: async ({ id }, { extensions }) => {
|
|
@@ -132,9 +132,9 @@ var artifact_definition_default = () => {
|
|
|
132
132
|
name: "move",
|
|
133
133
|
description: "Make a move in the chess game.",
|
|
134
134
|
caption: "Making chess move...",
|
|
135
|
-
schema:
|
|
135
|
+
schema: Schema.Struct({
|
|
136
136
|
id: ArtifactId,
|
|
137
|
-
move:
|
|
137
|
+
move: Schema.String.annotations({
|
|
138
138
|
description: "The move to make in the chess game.",
|
|
139
139
|
examples: [
|
|
140
140
|
"e4",
|
|
@@ -182,4 +182,4 @@ var artifact_definition_default = () => {
|
|
|
182
182
|
export {
|
|
183
183
|
artifact_definition_default as default
|
|
184
184
|
};
|
|
185
|
-
//# sourceMappingURL=artifact-definition-
|
|
185
|
+
//# sourceMappingURL=artifact-definition-YUAPS5GU.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/artifact-definition.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess } from 'chess.js';\nimport { pipe, Schema } from 'effect';\n\nimport { Capabilities, chain, contributes, createIntent, type PromiseIntentDispatcher } from '@dxos/app-framework';\nimport { ArtifactId, defineArtifact, defineTool, ToolResult } from '@dxos/artifact';\nimport { createArtifactElement, VersionPin } from '@dxos/assistant';\nimport { isInstanceOf } from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Filter, type Space } from '@dxos/react-client/echo';\n\nimport { meta } from '../meta';\nimport { ChessAction, ChessType } from '../types';\n\n// TODO(burdon): Factor out.\ndeclare global {\n interface ToolContextExtensions {\n space?: Space;\n dispatch?: PromiseIntentDispatcher;\n }\n}\n\nexport default () => {\n const definition = defineArtifact({\n id: `artifact:${meta.id}`,\n name: meta.name,\n description: 'Provides a simple chess engine.',\n instructions: `\n - 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.\n - Always inspect the chess game at the start of every prompt realting to a chess game, as it might have changed since the interaction.\n `,\n schema: ChessType,\n tools: [\n defineTool(meta.id, {\n name: 'create',\n description: 'Create a new chess game. Returns the artifact definition for the game.',\n caption: 'Creating chess game...',\n schema: Schema.Struct({\n fen: Schema.String.annotations({ description: 'The state of the chess game in the FEN format.' }),\n }),\n execute: async ({ fen }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n invariant(extensions?.dispatch, 'No intent dispatcher');\n const intent = pipe(\n createIntent(ChessAction.Create, { fen }),\n chain(SpaceAction.AddObject, { target: extensions.space }),\n );\n const { data, error } = await extensions.dispatch(intent);\n if (!data || error) {\n return ToolResult.Error(error?.message ?? 'Failed to create chess game');\n }\n\n return ToolResult.Success(createArtifactElement(data.id), [\n VersionPin.createBlock(VersionPin.fromObject(data.object)),\n ]);\n },\n }),\n defineTool(meta.id, {\n name: 'list',\n description: 'Query all active chess games.',\n caption: 'Getting games...',\n schema: Schema.Struct({}),\n execute: async (_, { extensions }) => {\n invariant(extensions?.space, 'No space');\n const { objects: games } = await extensions.space.db.query(Filter.type(ChessType)).run();\n invariant(games.length > 0, 'No chess games found');\n return ToolResult.Success(games);\n },\n }),\n defineTool(meta.id, {\n name: 'inspect',\n description: 'Get the current state of the chess game.',\n caption: 'Inspecting game...',\n schema: Schema.Struct({ id: ArtifactId }),\n execute: async ({ id }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n const game = await extensions.space.db\n .query({ id: ArtifactId.toDXN(id, extensions.space.id).toString() })\n .first();\n invariant(isInstanceOf(ChessType, game));\n\n return ToolResult.Success(game.fen);\n },\n }),\n defineTool(meta.id, {\n name: 'move',\n description: 'Make a move in the chess game.',\n caption: 'Making chess move...',\n schema: Schema.Struct({\n id: ArtifactId,\n move: Schema.String.annotations({\n description: 'The move to make in the chess game.',\n examples: ['e4', 'Bf3'],\n }),\n }),\n execute: async ({ id, move }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n const game = await extensions.space.db\n .query({ id: ArtifactId.toDXN(id, extensions.space.id).toString() })\n .first();\n invariant(isInstanceOf(ChessType, game));\n\n const board = new Chess(game.fen);\n try {\n board.move(move);\n } catch (error: any) {\n return ToolResult.Error(error.message);\n }\n game.pgn = board.pgn();\n game.fen = board.fen();\n return ToolResult.Success(game.fen);\n },\n }),\n ],\n });\n\n return contributes(Capabilities.ArtifactDefinition, definition);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAIA,SAASA,aAAa;AACtB,SAASC,MAAMC,cAAc;AAE7B,SAASC,cAAcC,OAAOC,aAAaC,oBAAkD;AAC7F,SAASC,YAAYC,gBAAgBC,YAAYC,kBAAkB;AACnE,SAASC,uBAAuBC,kBAAkB;AAClD,SAASC,oBAAoB;AAC7B,SAASC,iBAAiB;AAC1B,SAASC,mBAAmB;AAC5B,SAASC,cAA0B;;AAanC,IAAA,8BAA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A,IAAAA;UACb,SAASzB,OAAY;AACnB,mBAAOC,WAAWC,MAAMF,MAAMG,OAAO;UACvC;AACAiB,eAAKS,MAAMF,MAAME,IAAG;AACpBT,eAAKtC,MAAM6C,MAAM7C,IAAG;AACpB,iBAAOmB,WAAWG,QAAQgB,KAAKtC,GAAG;QACpC;MACF,CAAA;;EAEJ,CAAA;AAEA,SAAOgD,YAAYC,aAAaC,oBAAoBhE,UAAAA;AACtD;",
|
|
6
|
+
"names": ["Chess", "pipe", "Schema", "Capabilities", "chain", "contributes", "createIntent", "ArtifactId", "defineArtifact", "defineTool", "ToolResult", "createArtifactElement", "VersionPin", "isInstanceOf", "invariant", "SpaceAction", "Filter", "definition", "defineArtifact", "id", "meta", "name", "description", "instructions", "schema", "ChessType", "tools", "defineTool", "caption", "Schema", "Struct", "fen", "String", "annotations", "execute", "extensions", "invariant", "space", "dispatch", "intent", "pipe", "createIntent", "ChessAction", "Create", "chain", "SpaceAction", "AddObject", "target", "data", "error", "ToolResult", "Error", "message", "Success", "createArtifactElement", "VersionPin", "createBlock", "fromObject", "object", "_", "objects", "games", "db", "query", "Filter", "type", "run", "length", "ArtifactId", "game", "toDXN", "toString", "first", "isInstanceOf", "move", "examples", "board", "Chess", "pgn", "contributes", "Capabilities", "ArtifactDefinition"]
|
|
7
|
+
}
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
// packages/plugins/plugin-chess/src/types/schema.ts
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { TypedObject } from "@dxos/echo-schema";
|
|
4
|
+
var MoveSchema = Schema.mutable(Schema.partial(Schema.Struct({
|
|
5
|
+
source: Schema.String,
|
|
6
|
+
target: Schema.String,
|
|
7
|
+
piece: Schema.String
|
|
7
8
|
})));
|
|
8
9
|
var ChessType = class extends TypedObject({
|
|
9
10
|
typename: "dxos.org/type/Chess",
|
|
10
11
|
version: "0.1.0"
|
|
11
12
|
})({
|
|
12
|
-
name:
|
|
13
|
-
playerWhite:
|
|
14
|
-
playerBlack:
|
|
15
|
-
moves:
|
|
13
|
+
name: Schema.optional(Schema.String),
|
|
14
|
+
playerWhite: Schema.String,
|
|
15
|
+
playerBlack: Schema.String,
|
|
16
|
+
moves: Schema.mutable(Schema.Array(Schema.String)),
|
|
16
17
|
// TODO(wittjosiah): Remove. Redundant with moves.
|
|
17
|
-
pgn:
|
|
18
|
-
fen:
|
|
18
|
+
pgn: Schema.String,
|
|
19
|
+
fen: Schema.String
|
|
19
20
|
}, {
|
|
20
21
|
partial: true
|
|
21
22
|
}) {
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
// packages/plugins/plugin-chess/src/types/types.ts
|
|
25
|
-
import {
|
|
26
|
+
import { Schema as Schema2 } from "effect";
|
|
27
|
+
import { isInstanceOf } from "@dxos/echo-schema";
|
|
26
28
|
import { isLiveObject } from "@dxos/live-object";
|
|
27
29
|
|
|
28
30
|
// packages/plugins/plugin-chess/src/meta.ts
|
|
@@ -42,12 +44,12 @@ var meta = {
|
|
|
42
44
|
var ChessAction;
|
|
43
45
|
(function(ChessAction2) {
|
|
44
46
|
const CHESS_ACTION = `${CHESS_PLUGIN}/action`;
|
|
45
|
-
class Create extends
|
|
46
|
-
input:
|
|
47
|
-
name:
|
|
48
|
-
fen:
|
|
47
|
+
class Create extends Schema2.TaggedClass()(`${CHESS_ACTION}/create`, {
|
|
48
|
+
input: Schema2.Struct({
|
|
49
|
+
name: Schema2.optional(Schema2.String),
|
|
50
|
+
fen: Schema2.optional(Schema2.String)
|
|
49
51
|
}),
|
|
50
|
-
output:
|
|
52
|
+
output: Schema2.Struct({
|
|
51
53
|
object: ChessType
|
|
52
54
|
})
|
|
53
55
|
}) {
|
|
@@ -66,4 +68,4 @@ export {
|
|
|
66
68
|
ChessAction,
|
|
67
69
|
isObject
|
|
68
70
|
};
|
|
69
|
-
//# sourceMappingURL=chunk-
|
|
71
|
+
//# sourceMappingURL=chunk-FSWWNFQE.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts", "../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { TypedObject } from '@dxos/echo-schema';\n\nexport const MoveSchema = Schema.mutable(\n Schema.partial(\n Schema.Struct({\n source: Schema.String,\n target: Schema.String,\n piece: Schema.String,\n }),\n ),\n);\n\nexport class ChessType extends TypedObject({ typename: 'dxos.org/type/Chess', version: '0.1.0' })(\n {\n name: Schema.optional(Schema.String),\n playerWhite: Schema.String,\n playerBlack: Schema.String,\n moves: Schema.mutable(Schema.Array(Schema.String)),\n // TODO(wittjosiah): Remove. Redundant with moves.\n pgn: Schema.String,\n fen: Schema.String,\n },\n { partial: true },\n) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { isInstanceOf } from '@dxos/echo-schema';\nimport { isLiveObject } from '@dxos/live-object';\n\nimport { ChessType } from './schema';\nimport { CHESS_PLUGIN } from '../meta';\n\nexport namespace ChessAction {\n const CHESS_ACTION = `${CHESS_PLUGIN}/action`;\n\n export class Create extends Schema.TaggedClass<Create>()(`${CHESS_ACTION}/create`, {\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n fen: Schema.optional(Schema.String),\n }),\n output: Schema.Struct({\n object: ChessType,\n }),\n }) {}\n}\n\nexport const isObject = (object: unknown): object is typeof ChessType => {\n return isLiveObject(object) && isInstanceOf(ChessType, object);\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const CHESS_PLUGIN = 'dxos.org/plugin/chess';\n\nexport const meta: PluginMeta = {\n id: CHESS_PLUGIN,\n name: 'Chess',\n description:\n 'Chess is a simple plugin which allows you to render an interactive chessboard inside of a plank. This chessboard can be used for collaborative chess games, or for practice experiments with the LLM. ',\n icon: 'ph--shield-chevron--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-chess',\n screenshots: ['https://dxos.network/plugin-details-chess-dark.png'],\n};\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,cAAc;AAEvB,SAASC,mBAAmB;AAErB,IAAMC,aAAaC,OAAOC,QAC/BD,OAAOE,QACLF,OAAOG,OAAO;EACZC,QAAQJ,OAAOK;EACfC,QAAQN,OAAOK;EACfE,OAAOP,OAAOK;AAChB,CAAA,CAAA,CAAA;AAIG,IAAMG,YAAN,cAAwBC,YAAY;EAAEC,UAAU;EAAuBC,SAAS;AAAQ,CAAA,EAC7F;EACEC,MAAMZ,OAAOa,SAASb,OAAOK,MAAM;EACnCS,aAAad,OAAOK;EACpBU,aAAaf,OAAOK;EACpBW,OAAOhB,OAAOC,QAAQD,OAAOiB,MAAMjB,OAAOK,MAAM,CAAA;;EAEhDa,KAAKlB,OAAOK;EACZc,KAAKnB,OAAOK;AACd,GACA;EAAEH,SAAS;AAAK,CAAA,EAAA;AACf;;;ACzBH,SAASkB,UAAAA,eAAc;AAEvB,SAASC,oBAAoB;AAC7B,SAASC,oBAAoB;;;ACDtB,IAAMC,eAAe;AAErB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,aACE;EACFC,MAAM;EACNC,QAAQ;EACRC,aAAa;IAAC;;AAChB;;;;UDJiBC,cAAAA;AACf,QAAMC,eAAe,GAAGC,YAAAA;EAEjB,MAAMC,eAAeC,QAAOC,YAAW,EAAW,GAAGJ,YAAAA,WAAuB;IACjFK,OAAOF,QAAOG,OAAO;MACnBC,MAAMJ,QAAOK,SAASL,QAAOM,MAAM;MACnCC,KAAKP,QAAOK,SAASL,QAAOM,MAAM;IACpC,CAAA;IACAE,QAAQR,QAAOG,OAAO;MACpBM,QAAQC;IACV,CAAA;EACF,CAAA,EAAA;EAAI;eARSX,SAAAA;AASf,GAZiBH,gBAAAA,cAAAA,CAAAA,EAAAA;AAcV,IAAMe,WAAW,CAACF,WAAAA;AACvB,SAAOG,aAAaH,MAAAA,KAAWI,aAAaH,WAAWD,MAAAA;AACzD;",
|
|
6
|
+
"names": ["Schema", "TypedObject", "MoveSchema", "Schema", "mutable", "partial", "Struct", "source", "String", "target", "piece", "ChessType", "TypedObject", "typename", "version", "name", "optional", "playerWhite", "playerBlack", "moves", "Array", "pgn", "fen", "Schema", "isInstanceOf", "isLiveObject", "CHESS_PLUGIN", "meta", "id", "name", "description", "icon", "source", "screenshots", "ChessAction", "CHESS_ACTION", "CHESS_PLUGIN", "Create", "Schema", "TaggedClass", "input", "Struct", "name", "optional", "String", "fen", "output", "object", "ChessType", "isObject", "isLiveObject", "isInstanceOf"]
|
|
7
|
+
}
|
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
ChessAction,
|
|
7
7
|
ChessType,
|
|
8
8
|
meta
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FSWWNFQE.mjs";
|
|
10
10
|
import {
|
|
11
11
|
ChessComponent
|
|
12
12
|
} from "./chunk-VRWXC5L2.mjs";
|
|
13
13
|
|
|
14
14
|
// packages/plugins/plugin-chess/src/capabilities/index.ts
|
|
15
15
|
import { lazy } from "@dxos/app-framework";
|
|
16
|
-
var ArtifactDefinition = lazy(() => import("./artifact-definition-
|
|
17
|
-
var IntentResolver = lazy(() => import("./intent-resolver-
|
|
18
|
-
var ReactSurface = lazy(() => import("./react-surface-
|
|
16
|
+
var ArtifactDefinition = lazy(() => import("./artifact-definition-YUAPS5GU.mjs"));
|
|
17
|
+
var IntentResolver = lazy(() => import("./intent-resolver-O5FBTUC6.mjs"));
|
|
18
|
+
var ReactSurface = lazy(() => import("./react-surface-IT4WC47R.mjs"));
|
|
19
19
|
|
|
20
20
|
// packages/plugins/plugin-chess/src/ChessPlugin.tsx
|
|
21
21
|
import { Capabilities, contributes, createIntent, defineModule, definePlugin, Events } from "@dxos/app-framework";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ChessAction,
|
|
3
3
|
ChessType
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FSWWNFQE.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts
|
|
7
7
|
import { Chess } from "chess.js";
|
|
@@ -25,4 +25,4 @@ var intent_resolver_default = () => contributes(Capabilities.IntentResolver, cre
|
|
|
25
25
|
export {
|
|
26
26
|
intent_resolver_default as default
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=intent-resolver-
|
|
28
|
+
//# sourceMappingURL=intent-resolver-O5FBTUC6.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-chess/src/meta.ts":{"bytes":2077,"imports":[],"format":"esm"},"packages/plugins/plugin-chess/src/types/schema.ts":{"bytes":2700,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/types/types.ts":{"bytes":3023,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-chess/src/types/index.ts":{"bytes":586,"imports":[{"path":"packages/plugins/plugin-chess/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/plugins/plugin-chess/src/types/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/artifact-definition.ts":{"bytes":19202,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/artifact","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts":{"bytes":2736,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-chess/src/components/ChessComponent.tsx":{"bytes":4522,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/components/PlayerSelector.tsx":{"bytes":8761,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/components/ChessContainer.tsx":{"bytes":3257,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/ChessComponent.tsx","kind":"import-statement","original":"./ChessComponent"},{"path":"packages/plugins/plugin-chess/src/components/PlayerSelector.tsx","kind":"import-statement","original":"./PlayerSelector"}],"format":"esm"},"packages/plugins/plugin-chess/src/components/index.ts":{"bytes":908,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/ChessComponent.tsx","kind":"import-statement","original":"./ChessComponent"},{"path":"packages/plugins/plugin-chess/src/components/ChessContainer.tsx","kind":"dynamic-import","original":"./ChessContainer"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx":{"bytes":3926,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/index.ts","kind":"import-statement","original":"../components"},{"path":"packages/plugins/plugin-chess/src/components/ChessComponent.tsx","kind":"import-statement","original":"../components/ChessComponent"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/index.ts":{"bytes":1365,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/capabilities/artifact-definition.ts","kind":"dynamic-import","original":"./artifact-definition"},{"path":"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts","kind":"dynamic-import","original":"./intent-resolver"},{"path":"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"packages/plugins/plugin-chess/src/translations.ts":{"bytes":1694,"imports":[{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-chess/src/ChessPlugin.tsx":{"bytes":7388,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-chess/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-chess/src/index.ts":{"bytes":790,"imports":[{"path":"packages/plugins/plugin-chess/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-chess/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-chess/src/ChessPlugin.tsx","kind":"import-statement","original":"./ChessPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-chess/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4837},"packages/plugins/plugin-chess/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-7SPN7XYA.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-EIRRN4WP.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/dist/lib/browser/artifact-definition-HTXW3AKR.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/intent-resolver-QECLUB7C.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/react-surface-CMUAPVQA.mjs","kind":"dynamic-import"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true}],"exports":["ArtifactDefinition","CHESS_PLUGIN","ChessComponent","ChessContainer","ChessPlugin","IntentResolver","ReactSurface","meta"],"entryPoint":"packages/plugins/plugin-chess/src/index.ts","inputs":{"packages/plugins/plugin-chess/src/capabilities/index.ts":{"bytesInOutput":273},"packages/plugins/plugin-chess/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-chess/src/ChessPlugin.tsx":{"bytesInOutput":1500},"packages/plugins/plugin-chess/src/translations.ts":{"bytesInOutput":282}},"bytes":2659},"packages/plugins/plugin-chess/dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-chess/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-EIRRN4WP.mjs","kind":"import-statement"}],"exports":["ChessAction","ChessType","MoveSchema","isObject"],"entryPoint":"packages/plugins/plugin-chess/src/types/index.ts","inputs":{},"bytes":194},"packages/plugins/plugin-chess/dist/lib/browser/artifact-definition-HTXW3AKR.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8373},"packages/plugins/plugin-chess/dist/lib/browser/artifact-definition-HTXW3AKR.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-EIRRN4WP.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/artifact","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/capabilities/artifact-definition.ts","inputs":{"packages/plugins/plugin-chess/src/capabilities/artifact-definition.ts":{"bytesInOutput":5940}},"bytes":6200},"packages/plugins/plugin-chess/dist/lib/browser/intent-resolver-QECLUB7C.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1366},"packages/plugins/plugin-chess/dist/lib/browser/intent-resolver-QECLUB7C.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-EIRRN4WP.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts","inputs":{"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts":{"bytesInOutput":507}},"bytes":747},"packages/plugins/plugin-chess/dist/lib/browser/ChessContainer-6JIE36JW.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6150},"packages/plugins/plugin-chess/dist/lib/browser/ChessContainer-6JIE36JW.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/components/ChessContainer.tsx","inputs":{"packages/plugins/plugin-chess/src/components/ChessContainer.tsx":{"bytesInOutput":791},"packages/plugins/plugin-chess/src/components/PlayerSelector.tsx":{"bytesInOutput":2299}},"bytes":3452},"packages/plugins/plugin-chess/dist/lib/browser/react-surface-CMUAPVQA.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1850},"packages/plugins/plugin-chess/dist/lib/browser/react-surface-CMUAPVQA.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-7SPN7XYA.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-EIRRN4WP.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx","inputs":{"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx":{"bytesInOutput":745}},"bytes":1107},"packages/plugins/plugin-chess/dist/lib/browser/chunk-7SPN7XYA.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":402},"packages/plugins/plugin-chess/dist/lib/browser/chunk-7SPN7XYA.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/dist/lib/browser/ChessContainer-6JIE36JW.mjs","kind":"dynamic-import"}],"exports":["ChessContainer"],"inputs":{"packages/plugins/plugin-chess/src/components/index.ts":{"bytesInOutput":104}},"bytes":235},"packages/plugins/plugin-chess/dist/lib/browser/chunk-EIRRN4WP.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3741},"packages/plugins/plugin-chess/dist/lib/browser/chunk-EIRRN4WP.mjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"exports":["CHESS_PLUGIN","ChessAction","ChessType","MoveSchema","isObject","meta"],"inputs":{"packages/plugins/plugin-chess/src/types/schema.ts":{"bytesInOutput":501},"packages/plugins/plugin-chess/src/types/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-chess/src/types/types.ts":{"bytesInOutput":605},"packages/plugins/plugin-chess/src/meta.ts":{"bytesInOutput":513}},"bytes":1958},"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2436},"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs":{"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true}],"exports":["ChessComponent"],"inputs":{"packages/plugins/plugin-chess/src/components/ChessComponent.tsx":{"bytesInOutput":990}},"bytes":1131}}}
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-chess/src/meta.ts":{"bytes":2077,"imports":[],"format":"esm"},"packages/plugins/plugin-chess/src/types/schema.ts":{"bytes":2981,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/types/types.ts":{"bytes":3208,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-chess/src/types/index.ts":{"bytes":586,"imports":[{"path":"packages/plugins/plugin-chess/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/plugins/plugin-chess/src/types/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/artifact-definition.ts":{"bytes":19311,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/artifact","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts":{"bytes":2736,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-chess/src/components/ChessComponent.tsx":{"bytes":4522,"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/components/PlayerSelector.tsx":{"bytes":8761,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-chess/src/components/ChessContainer.tsx":{"bytes":3257,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/ChessComponent.tsx","kind":"import-statement","original":"./ChessComponent"},{"path":"packages/plugins/plugin-chess/src/components/PlayerSelector.tsx","kind":"import-statement","original":"./PlayerSelector"}],"format":"esm"},"packages/plugins/plugin-chess/src/components/index.ts":{"bytes":908,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/ChessComponent.tsx","kind":"import-statement","original":"./ChessComponent"},{"path":"packages/plugins/plugin-chess/src/components/ChessContainer.tsx","kind":"dynamic-import","original":"./ChessContainer"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx":{"bytes":3926,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/components/index.ts","kind":"import-statement","original":"../components"},{"path":"packages/plugins/plugin-chess/src/components/ChessComponent.tsx","kind":"import-statement","original":"../components/ChessComponent"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-chess/src/capabilities/index.ts":{"bytes":1365,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/capabilities/artifact-definition.ts","kind":"dynamic-import","original":"./artifact-definition"},{"path":"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts","kind":"dynamic-import","original":"./intent-resolver"},{"path":"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"packages/plugins/plugin-chess/src/translations.ts":{"bytes":1694,"imports":[{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-chess/src/ChessPlugin.tsx":{"bytes":7388,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-chess/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/plugins/plugin-chess/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-chess/src/index.ts":{"bytes":790,"imports":[{"path":"packages/plugins/plugin-chess/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-chess/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/plugin-chess/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-chess/src/ChessPlugin.tsx","kind":"import-statement","original":"./ChessPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-chess/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4837},"packages/plugins/plugin-chess/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-7SPN7XYA.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-FSWWNFQE.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/dist/lib/browser/artifact-definition-YUAPS5GU.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/intent-resolver-O5FBTUC6.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/react-surface-IT4WC47R.mjs","kind":"dynamic-import"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true}],"exports":["ArtifactDefinition","CHESS_PLUGIN","ChessComponent","ChessContainer","ChessPlugin","IntentResolver","ReactSurface","meta"],"entryPoint":"packages/plugins/plugin-chess/src/index.ts","inputs":{"packages/plugins/plugin-chess/src/capabilities/index.ts":{"bytesInOutput":273},"packages/plugins/plugin-chess/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-chess/src/ChessPlugin.tsx":{"bytesInOutput":1500},"packages/plugins/plugin-chess/src/translations.ts":{"bytesInOutput":282}},"bytes":2659},"packages/plugins/plugin-chess/dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-chess/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-FSWWNFQE.mjs","kind":"import-statement"}],"exports":["ChessAction","ChessType","MoveSchema","isObject"],"entryPoint":"packages/plugins/plugin-chess/src/types/index.ts","inputs":{},"bytes":194},"packages/plugins/plugin-chess/dist/lib/browser/artifact-definition-YUAPS5GU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8430},"packages/plugins/plugin-chess/dist/lib/browser/artifact-definition-YUAPS5GU.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-FSWWNFQE.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/artifact","kind":"import-statement","external":true},{"path":"@dxos/assistant","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/capabilities/artifact-definition.ts","inputs":{"packages/plugins/plugin-chess/src/capabilities/artifact-definition.ts":{"bytesInOutput":5973}},"bytes":6233},"packages/plugins/plugin-chess/dist/lib/browser/intent-resolver-O5FBTUC6.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1366},"packages/plugins/plugin-chess/dist/lib/browser/intent-resolver-O5FBTUC6.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-FSWWNFQE.mjs","kind":"import-statement"},{"path":"chess.js","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts","inputs":{"packages/plugins/plugin-chess/src/capabilities/intent-resolver.ts":{"bytesInOutput":507}},"bytes":747},"packages/plugins/plugin-chess/dist/lib/browser/ChessContainer-6JIE36JW.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6150},"packages/plugins/plugin-chess/dist/lib/browser/ChessContainer-6JIE36JW.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/display-name","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/components/ChessContainer.tsx","inputs":{"packages/plugins/plugin-chess/src/components/ChessContainer.tsx":{"bytesInOutput":791},"packages/plugins/plugin-chess/src/components/PlayerSelector.tsx":{"bytesInOutput":2299}},"bytes":3452},"packages/plugins/plugin-chess/dist/lib/browser/react-surface-IT4WC47R.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1850},"packages/plugins/plugin-chess/dist/lib/browser/react-surface-IT4WC47R.mjs":{"imports":[{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-7SPN7XYA.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-FSWWNFQE.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx","inputs":{"packages/plugins/plugin-chess/src/capabilities/react-surface.tsx":{"bytesInOutput":745}},"bytes":1107},"packages/plugins/plugin-chess/dist/lib/browser/chunk-7SPN7XYA.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":402},"packages/plugins/plugin-chess/dist/lib/browser/chunk-7SPN7XYA.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-chess/dist/lib/browser/ChessContainer-6JIE36JW.mjs","kind":"dynamic-import"}],"exports":["ChessContainer"],"inputs":{"packages/plugins/plugin-chess/src/components/index.ts":{"bytesInOutput":104}},"bytes":235},"packages/plugins/plugin-chess/dist/lib/browser/chunk-FSWWNFQE.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3966},"packages/plugins/plugin-chess/dist/lib/browser/chunk-FSWWNFQE.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/live-object","kind":"import-statement","external":true}],"exports":["CHESS_PLUGIN","ChessAction","ChessType","MoveSchema","isObject","meta"],"inputs":{"packages/plugins/plugin-chess/src/types/schema.ts":{"bytesInOutput":606},"packages/plugins/plugin-chess/src/types/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-chess/src/types/types.ts":{"bytesInOutput":675},"packages/plugins/plugin-chess/src/meta.ts":{"bytesInOutput":513}},"bytes":2133},"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2436},"packages/plugins/plugin-chess/dist/lib/browser/chunk-VRWXC5L2.mjs":{"imports":[{"path":"chess.js","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-gameboard","kind":"import-statement","external":true}],"exports":["ChessComponent"],"inputs":{"packages/plugins/plugin-chess/src/components/ChessComponent.tsx":{"bytesInOutput":990}},"bytes":1131}}}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
CHESS_PLUGIN,
|
|
6
6
|
ChessType,
|
|
7
7
|
isObject
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FSWWNFQE.mjs";
|
|
9
9
|
import {
|
|
10
10
|
ChessComponent
|
|
11
11
|
} from "./chunk-VRWXC5L2.mjs";
|
|
@@ -39,4 +39,4 @@ var react_surface_default = () => contributes(Capabilities.ReactSurface, [
|
|
|
39
39
|
export {
|
|
40
40
|
react_surface_default as default
|
|
41
41
|
};
|
|
42
|
-
//# sourceMappingURL=react-surface-
|
|
42
|
+
//# sourceMappingURL=react-surface-IT4WC47R.mjs.map
|
|
@@ -16,12 +16,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var artifact_definition_N5H23WYL_exports = {};
|
|
20
|
+
__export(artifact_definition_N5H23WYL_exports, {
|
|
21
21
|
default: () => artifact_definition_default
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
23
|
+
module.exports = __toCommonJS(artifact_definition_N5H23WYL_exports);
|
|
24
|
+
var import_chunk_ZYU6LFL4 = require("./chunk-ZYU6LFL4.cjs");
|
|
25
25
|
var import_chess = require("chess.js");
|
|
26
26
|
var import_effect = require("effect");
|
|
27
27
|
var import_app_framework = require("@dxos/app-framework");
|
|
@@ -34,21 +34,21 @@ var import_echo = require("@dxos/react-client/echo");
|
|
|
34
34
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-chess/src/capabilities/artifact-definition.ts";
|
|
35
35
|
var artifact_definition_default = () => {
|
|
36
36
|
const definition = (0, import_artifact.defineArtifact)({
|
|
37
|
-
id: `artifact:${
|
|
38
|
-
name:
|
|
37
|
+
id: `artifact:${import_chunk_ZYU6LFL4.meta.id}`,
|
|
38
|
+
name: import_chunk_ZYU6LFL4.meta.name,
|
|
39
39
|
description: "Provides a simple chess engine.",
|
|
40
40
|
instructions: `
|
|
41
41
|
- 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.
|
|
42
42
|
- Always inspect the chess game at the start of every prompt realting to a chess game, as it might have changed since the interaction.
|
|
43
43
|
`,
|
|
44
|
-
schema:
|
|
44
|
+
schema: import_chunk_ZYU6LFL4.ChessType,
|
|
45
45
|
tools: [
|
|
46
|
-
(0, import_artifact.defineTool)(
|
|
46
|
+
(0, import_artifact.defineTool)(import_chunk_ZYU6LFL4.meta.id, {
|
|
47
47
|
name: "create",
|
|
48
48
|
description: "Create a new chess game. Returns the artifact definition for the game.",
|
|
49
49
|
caption: "Creating chess game...",
|
|
50
|
-
schema:
|
|
51
|
-
fen:
|
|
50
|
+
schema: import_effect.Schema.Struct({
|
|
51
|
+
fen: import_effect.Schema.String.annotations({
|
|
52
52
|
description: "The state of the chess game in the FEN format."
|
|
53
53
|
})
|
|
54
54
|
}),
|
|
@@ -71,7 +71,7 @@ var artifact_definition_default = () => {
|
|
|
71
71
|
"'No intent dispatcher'"
|
|
72
72
|
]
|
|
73
73
|
});
|
|
74
|
-
const intent = (0, import_effect.pipe)((0, import_app_framework.createIntent)(
|
|
74
|
+
const intent = (0, import_effect.pipe)((0, import_app_framework.createIntent)(import_chunk_ZYU6LFL4.ChessAction.Create, {
|
|
75
75
|
fen
|
|
76
76
|
}), (0, import_app_framework.chain)(import_types.SpaceAction.AddObject, {
|
|
77
77
|
target: extensions.space
|
|
@@ -85,11 +85,11 @@ var artifact_definition_default = () => {
|
|
|
85
85
|
]);
|
|
86
86
|
}
|
|
87
87
|
}),
|
|
88
|
-
(0, import_artifact.defineTool)(
|
|
88
|
+
(0, import_artifact.defineTool)(import_chunk_ZYU6LFL4.meta.id, {
|
|
89
89
|
name: "list",
|
|
90
90
|
description: "Query all active chess games.",
|
|
91
91
|
caption: "Getting games...",
|
|
92
|
-
schema:
|
|
92
|
+
schema: import_effect.Schema.Struct({}),
|
|
93
93
|
execute: async (_, { extensions }) => {
|
|
94
94
|
(0, import_invariant.invariant)(extensions?.space, "No space", {
|
|
95
95
|
F: __dxlog_file,
|
|
@@ -100,7 +100,7 @@ var artifact_definition_default = () => {
|
|
|
100
100
|
"'No space'"
|
|
101
101
|
]
|
|
102
102
|
});
|
|
103
|
-
const { objects: games } = await extensions.space.db.query(import_echo.Filter.
|
|
103
|
+
const { objects: games } = await extensions.space.db.query(import_echo.Filter.type(import_chunk_ZYU6LFL4.ChessType)).run();
|
|
104
104
|
(0, import_invariant.invariant)(games.length > 0, "No chess games found", {
|
|
105
105
|
F: __dxlog_file,
|
|
106
106
|
L: 70,
|
|
@@ -113,11 +113,11 @@ var artifact_definition_default = () => {
|
|
|
113
113
|
return import_artifact.ToolResult.Success(games);
|
|
114
114
|
}
|
|
115
115
|
}),
|
|
116
|
-
(0, import_artifact.defineTool)(
|
|
116
|
+
(0, import_artifact.defineTool)(import_chunk_ZYU6LFL4.meta.id, {
|
|
117
117
|
name: "inspect",
|
|
118
118
|
description: "Get the current state of the chess game.",
|
|
119
119
|
caption: "Inspecting game...",
|
|
120
|
-
schema:
|
|
120
|
+
schema: import_effect.Schema.Struct({
|
|
121
121
|
id: import_artifact.ArtifactId
|
|
122
122
|
}),
|
|
123
123
|
execute: async ({ id }, { extensions }) => {
|
|
@@ -133,7 +133,7 @@ var artifact_definition_default = () => {
|
|
|
133
133
|
const game = await extensions.space.db.query({
|
|
134
134
|
id: import_artifact.ArtifactId.toDXN(id, extensions.space.id).toString()
|
|
135
135
|
}).first();
|
|
136
|
-
(0, import_invariant.invariant)((0, import_echo_schema.isInstanceOf)(
|
|
136
|
+
(0, import_invariant.invariant)((0, import_echo_schema.isInstanceOf)(import_chunk_ZYU6LFL4.ChessType, game), void 0, {
|
|
137
137
|
F: __dxlog_file,
|
|
138
138
|
L: 84,
|
|
139
139
|
S: void 0,
|
|
@@ -145,13 +145,13 @@ var artifact_definition_default = () => {
|
|
|
145
145
|
return import_artifact.ToolResult.Success(game.fen);
|
|
146
146
|
}
|
|
147
147
|
}),
|
|
148
|
-
(0, import_artifact.defineTool)(
|
|
148
|
+
(0, import_artifact.defineTool)(import_chunk_ZYU6LFL4.meta.id, {
|
|
149
149
|
name: "move",
|
|
150
150
|
description: "Make a move in the chess game.",
|
|
151
151
|
caption: "Making chess move...",
|
|
152
|
-
schema:
|
|
152
|
+
schema: import_effect.Schema.Struct({
|
|
153
153
|
id: import_artifact.ArtifactId,
|
|
154
|
-
move:
|
|
154
|
+
move: import_effect.Schema.String.annotations({
|
|
155
155
|
description: "The move to make in the chess game.",
|
|
156
156
|
examples: [
|
|
157
157
|
"e4",
|
|
@@ -172,7 +172,7 @@ var artifact_definition_default = () => {
|
|
|
172
172
|
const game = await extensions.space.db.query({
|
|
173
173
|
id: import_artifact.ArtifactId.toDXN(id, extensions.space.id).toString()
|
|
174
174
|
}).first();
|
|
175
|
-
(0, import_invariant.invariant)((0, import_echo_schema.isInstanceOf)(
|
|
175
|
+
(0, import_invariant.invariant)((0, import_echo_schema.isInstanceOf)(import_chunk_ZYU6LFL4.ChessType, game), void 0, {
|
|
176
176
|
F: __dxlog_file,
|
|
177
177
|
L: 105,
|
|
178
178
|
S: void 0,
|
|
@@ -196,4 +196,4 @@ var artifact_definition_default = () => {
|
|
|
196
196
|
});
|
|
197
197
|
return (0, import_app_framework.contributes)(import_app_framework.Capabilities.ArtifactDefinition, definition);
|
|
198
198
|
};
|
|
199
|
-
//# sourceMappingURL=artifact-definition-
|
|
199
|
+
//# sourceMappingURL=artifact-definition-N5H23WYL.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/artifact-definition.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Chess } from 'chess.js';\nimport { pipe, Schema } from 'effect';\n\nimport { Capabilities, chain, contributes, createIntent, type PromiseIntentDispatcher } from '@dxos/app-framework';\nimport { ArtifactId, defineArtifact, defineTool, ToolResult } from '@dxos/artifact';\nimport { createArtifactElement, VersionPin } from '@dxos/assistant';\nimport { isInstanceOf } from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Filter, type Space } from '@dxos/react-client/echo';\n\nimport { meta } from '../meta';\nimport { ChessAction, ChessType } from '../types';\n\n// TODO(burdon): Factor out.\ndeclare global {\n interface ToolContextExtensions {\n space?: Space;\n dispatch?: PromiseIntentDispatcher;\n }\n}\n\nexport default () => {\n const definition = defineArtifact({\n id: `artifact:${meta.id}`,\n name: meta.name,\n description: 'Provides a simple chess engine.',\n instructions: `\n - 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.\n - Always inspect the chess game at the start of every prompt realting to a chess game, as it might have changed since the interaction.\n `,\n schema: ChessType,\n tools: [\n defineTool(meta.id, {\n name: 'create',\n description: 'Create a new chess game. Returns the artifact definition for the game.',\n caption: 'Creating chess game...',\n schema: Schema.Struct({\n fen: Schema.String.annotations({ description: 'The state of the chess game in the FEN format.' }),\n }),\n execute: async ({ fen }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n invariant(extensions?.dispatch, 'No intent dispatcher');\n const intent = pipe(\n createIntent(ChessAction.Create, { fen }),\n chain(SpaceAction.AddObject, { target: extensions.space }),\n );\n const { data, error } = await extensions.dispatch(intent);\n if (!data || error) {\n return ToolResult.Error(error?.message ?? 'Failed to create chess game');\n }\n\n return ToolResult.Success(createArtifactElement(data.id), [\n VersionPin.createBlock(VersionPin.fromObject(data.object)),\n ]);\n },\n }),\n defineTool(meta.id, {\n name: 'list',\n description: 'Query all active chess games.',\n caption: 'Getting games...',\n schema: Schema.Struct({}),\n execute: async (_, { extensions }) => {\n invariant(extensions?.space, 'No space');\n const { objects: games } = await extensions.space.db.query(Filter.type(ChessType)).run();\n invariant(games.length > 0, 'No chess games found');\n return ToolResult.Success(games);\n },\n }),\n defineTool(meta.id, {\n name: 'inspect',\n description: 'Get the current state of the chess game.',\n caption: 'Inspecting game...',\n schema: Schema.Struct({ id: ArtifactId }),\n execute: async ({ id }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n const game = await extensions.space.db\n .query({ id: ArtifactId.toDXN(id, extensions.space.id).toString() })\n .first();\n invariant(isInstanceOf(ChessType, game));\n\n return ToolResult.Success(game.fen);\n },\n }),\n defineTool(meta.id, {\n name: 'move',\n description: 'Make a move in the chess game.',\n caption: 'Making chess move...',\n schema: Schema.Struct({\n id: ArtifactId,\n move: Schema.String.annotations({\n description: 'The move to make in the chess game.',\n examples: ['e4', 'Bf3'],\n }),\n }),\n execute: async ({ id, move }, { extensions }) => {\n invariant(extensions?.space, 'No space');\n const game = await extensions.space.db\n .query({ id: ArtifactId.toDXN(id, extensions.space.id).toString() })\n .first();\n invariant(isInstanceOf(ChessType, game));\n\n const board = new Chess(game.fen);\n try {\n board.move(move);\n } catch (error: any) {\n return ToolResult.Error(error.message);\n }\n game.pgn = board.pgn();\n game.fen = board.fen();\n return ToolResult.Success(game.fen);\n },\n }),\n ],\n });\n\n return contributes(Capabilities.ArtifactDefinition, definition);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;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AAIgB,WAAWE,MAAMlB,EAAE,EAAEoD,SAAQ;UAAG,CAAA,EACjEC,MAAK;AACRpC,8CAAUqC,iCAAahD,iCAAW4C,IAAAA,GAAAA,QAAAA;;;;;;;;;AAElC,gBAAMO,QAAQ,IAAIC,mBAAMR,KAAKtC,GAAG;AAChC,cAAI;AACF6C,kBAAMF,KAAKA,IAAAA;UACb,SAASzB,OAAY;AACnB,mBAAOC,2BAAWC,MAAMF,MAAMG,OAAO;UACvC;AACAiB,eAAKS,MAAMF,MAAME,IAAG;AACpBT,eAAKtC,MAAM6C,MAAM7C,IAAG;AACpB,iBAAOmB,2BAAWG,QAAQgB,KAAKtC,GAAG;QACpC;MACF,CAAA;;EAEJ,CAAA;AAEA,aAAOgD,kCAAYC,kCAAaC,oBAAoBhE,UAAAA;AACtD;",
|
|
6
|
+
"names": ["definition", "defineArtifact", "id", "meta", "name", "description", "instructions", "schema", "ChessType", "tools", "defineTool", "caption", "Schema", "Struct", "fen", "String", "annotations", "execute", "extensions", "invariant", "space", "dispatch", "intent", "pipe", "createIntent", "ChessAction", "Create", "chain", "SpaceAction", "AddObject", "target", "data", "error", "ToolResult", "Error", "message", "Success", "createArtifactElement", "VersionPin", "createBlock", "fromObject", "object", "_", "objects", "games", "db", "query", "Filter", "type", "run", "length", "ArtifactId", "game", "toDXN", "toString", "first", "isInstanceOf", "move", "examples", "board", "Chess", "pgn", "contributes", "Capabilities", "ArtifactDefinition"]
|
|
7
|
+
}
|
|
@@ -16,8 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_ZYU6LFL4_exports = {};
|
|
20
|
+
__export(chunk_ZYU6LFL4_exports, {
|
|
21
21
|
CHESS_PLUGIN: () => CHESS_PLUGIN,
|
|
22
22
|
ChessAction: () => ChessAction,
|
|
23
23
|
ChessType: () => ChessType,
|
|
@@ -25,26 +25,28 @@ __export(chunk_SVNVQAMR_exports, {
|
|
|
25
25
|
isObject: () => isObject,
|
|
26
26
|
meta: () => meta
|
|
27
27
|
});
|
|
28
|
-
module.exports = __toCommonJS(
|
|
28
|
+
module.exports = __toCommonJS(chunk_ZYU6LFL4_exports);
|
|
29
|
+
var import_effect = require("effect");
|
|
29
30
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
31
|
+
var import_effect2 = require("effect");
|
|
30
32
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
31
33
|
var import_live_object = require("@dxos/live-object");
|
|
32
|
-
var MoveSchema =
|
|
33
|
-
source:
|
|
34
|
-
target:
|
|
35
|
-
piece:
|
|
34
|
+
var MoveSchema = import_effect.Schema.mutable(import_effect.Schema.partial(import_effect.Schema.Struct({
|
|
35
|
+
source: import_effect.Schema.String,
|
|
36
|
+
target: import_effect.Schema.String,
|
|
37
|
+
piece: import_effect.Schema.String
|
|
36
38
|
})));
|
|
37
39
|
var ChessType = class extends (0, import_echo_schema.TypedObject)({
|
|
38
40
|
typename: "dxos.org/type/Chess",
|
|
39
41
|
version: "0.1.0"
|
|
40
42
|
})({
|
|
41
|
-
name:
|
|
42
|
-
playerWhite:
|
|
43
|
-
playerBlack:
|
|
44
|
-
moves:
|
|
43
|
+
name: import_effect.Schema.optional(import_effect.Schema.String),
|
|
44
|
+
playerWhite: import_effect.Schema.String,
|
|
45
|
+
playerBlack: import_effect.Schema.String,
|
|
46
|
+
moves: import_effect.Schema.mutable(import_effect.Schema.Array(import_effect.Schema.String)),
|
|
45
47
|
// TODO(wittjosiah): Remove. Redundant with moves.
|
|
46
|
-
pgn:
|
|
47
|
-
fen:
|
|
48
|
+
pgn: import_effect.Schema.String,
|
|
49
|
+
fen: import_effect.Schema.String
|
|
48
50
|
}, {
|
|
49
51
|
partial: true
|
|
50
52
|
}) {
|
|
@@ -63,12 +65,12 @@ var meta = {
|
|
|
63
65
|
var ChessAction;
|
|
64
66
|
(function(ChessAction2) {
|
|
65
67
|
const CHESS_ACTION = `${CHESS_PLUGIN}/action`;
|
|
66
|
-
class Create extends
|
|
67
|
-
input:
|
|
68
|
-
name:
|
|
69
|
-
fen:
|
|
68
|
+
class Create extends import_effect2.Schema.TaggedClass()(`${CHESS_ACTION}/create`, {
|
|
69
|
+
input: import_effect2.Schema.Struct({
|
|
70
|
+
name: import_effect2.Schema.optional(import_effect2.Schema.String),
|
|
71
|
+
fen: import_effect2.Schema.optional(import_effect2.Schema.String)
|
|
70
72
|
}),
|
|
71
|
-
output:
|
|
73
|
+
output: import_effect2.Schema.Struct({
|
|
72
74
|
object: ChessType
|
|
73
75
|
})
|
|
74
76
|
}) {
|
|
@@ -87,4 +89,4 @@ var isObject = (object) => {
|
|
|
87
89
|
isObject,
|
|
88
90
|
meta
|
|
89
91
|
});
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
92
|
+
//# sourceMappingURL=chunk-ZYU6LFL4.cjs.map
|