@altnovatrail/widgets 0.2.0 → 0.3.0
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/README.md +1 -1
- package/cores/vector.schema.json +22 -1
- package/kinds/cards/cards.handles.json +109 -0
- package/kinds/cards/cards.schema.json +483 -0
- package/kinds/cards/vectors/any.json +255 -0
- package/kinds/cards/vectors/box.json +325 -0
- package/kinds/cards/vectors/fork-taps.json +305 -0
- package/kinds/cards/vectors/fork.json +254 -0
- package/kinds/cards/vectors/invalid-goal.json +70 -0
- package/kinds/cards/vectors/invalid-ids.json +113 -0
- package/kinds/cards/vectors/invalid-schema.json +88 -0
- package/kinds/cards/vectors/invalid-taps.json +214 -0
- package/kinds/cards/vectors/key.json +264 -0
- package/kinds/cards/vectors/limit.json +274 -0
- package/kinds/cards/vectors/no-goal.json +205 -0
- package/kinds/cards/vectors/none.json +239 -0
- package/kinds/cards/vectors/recog.json +113 -0
- package/kinds/cards/vectors/riddle.json +397 -0
- package/kinds/cards/vectors/solo.json +218 -0
- package/kinds/cells/cells.schema.json +17 -2
- package/kinds/line/line.handles.json +195 -0
- package/kinds/line/line.schema.json +336 -0
- package/kinds/line/vectors/cases.json +213 -0
- package/kinds/line/vectors/gaps-12-d1-1.json +140 -0
- package/kinds/line/vectors/gaps-12-d1-2.json +95 -0
- package/kinds/line/vectors/gaps-12-d1-3.json +122 -0
- package/kinds/line/vectors/gaps-12-d1-4.json +121 -0
- package/kinds/line/vectors/gaps-12-d1-5.json +87 -0
- package/kinds/line/vectors/gaps-12-d2-1.json +173 -0
- package/kinds/line/vectors/gaps-12-d2-6.json +87 -0
- package/kinds/line/vectors/gaps-12-d3-2.json +173 -0
- package/kinds/line/vectors/gaps-12-d4-4.json +168 -0
- package/kinds/line/vectors/gaps-12-d5-3.json +99 -0
- package/kinds/line/vectors/gaps-12-d5-4.json +215 -0
- package/kinds/line/vectors/gaps-34-d1-1.json +37 -0
- package/kinds/line/vectors/gaps-34-d1-2.json +130 -0
- package/kinds/line/vectors/gaps-34-d1-4.json +155 -0
- package/kinds/line/vectors/gaps-34-d1-5.json +43 -0
- package/kinds/line/vectors/gaps-34-d3-2.json +38 -0
- package/kinds/line/vectors/gaps-34-d3-5.json +177 -0
- package/kinds/line/vectors/gaps-34-d5-3.json +39 -0
- package/kinds/line/vectors/invalid-line.json +34 -0
- package/kinds/line/vectors/invalid-ring.json +34 -0
- package/kinds/line/vectors/invalid.json +43 -0
- package/kinds/line/vectors/jump-unreachable.json +104 -0
- package/kinds/line/vectors/limit.json +40 -0
- package/kinds/line/vectors/op-not-in-scene.json +47 -0
- package/kinds/line/vectors/ring-cut.json +104 -0
- package/kinds/line/vectors/ring-every.json +107 -0
- package/kinds/line/vectors/ring-jump.json +135 -0
- package/lib/cores/arith.d.ts +62 -0
- package/lib/cores/arith.js +197 -0
- package/lib/cores/kind.d.ts +31 -3
- package/lib/cores/registry.d.ts +43 -0
- package/lib/cores/registry.js +87 -0
- package/lib/cores/search.d.ts +22 -6
- package/lib/cores/search.js +70 -14
- package/lib/kinds/cards/goal.d.ts +25 -0
- package/lib/kinds/cards/goal.js +72 -0
- package/lib/kinds/cards/index.d.ts +14 -0
- package/lib/kinds/cards/index.js +17 -0
- package/lib/kinds/cards/kind.d.ts +23 -0
- package/lib/kinds/cards/kind.js +101 -0
- package/lib/kinds/cards/parts.d.ts +36 -0
- package/lib/kinds/cards/parts.js +34 -0
- package/lib/kinds/cards/scene.d.ts +102 -0
- package/lib/kinds/cards/scene.js +356 -0
- package/lib/kinds/cards/schema.d.ts +10 -0
- package/lib/kinds/cards/schema.js +285 -0
- package/lib/kinds/cells/kind.js +11 -64
- package/lib/kinds/cells/operation.d.ts +6 -0
- package/lib/kinds/cells/polyomino.d.ts +14 -0
- package/lib/kinds/cells/polyomino.js +100 -24
- package/lib/kinds/cells/registry.js +1 -1
- package/lib/kinds/cells/schema.js +3 -1
- package/lib/kinds/line/cut.d.ts +2 -0
- package/lib/kinds/line/cut.js +63 -0
- package/lib/kinds/line/goals.d.ts +22 -0
- package/lib/kinds/line/goals.js +137 -0
- package/lib/kinds/line/index.d.ts +13 -0
- package/lib/kinds/line/index.js +17 -0
- package/lib/kinds/line/jump.d.ts +10 -0
- package/lib/kinds/line/jump.js +95 -0
- package/lib/kinds/line/kind.d.ts +25 -0
- package/lib/kinds/line/kind.js +125 -0
- package/lib/kinds/line/line.d.ts +63 -0
- package/lib/kinds/line/line.js +157 -0
- package/lib/kinds/line/operation.d.ts +69 -0
- package/lib/kinds/line/operation.js +1 -0
- package/lib/kinds/line/posts.d.ts +11 -0
- package/lib/kinds/line/posts.js +85 -0
- package/lib/kinds/line/registry.d.ts +2 -0
- package/lib/kinds/line/registry.js +11 -0
- package/lib/kinds/line/schema.d.ts +4 -0
- package/lib/kinds/line/schema.js +159 -0
- package/package.json +16 -4
- package/cores/handles.schema.json +0 -63
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// The operations and goals of the kind line. A new operation or goal is a module of its own,
|
|
2
|
+
// listed here, with the next minor version: nothing else of the kind changes for it.
|
|
3
|
+
import { cut } from "./cut.js";
|
|
4
|
+
import { counters, every } from "./goals.js";
|
|
5
|
+
import { jump } from "./jump.js";
|
|
6
|
+
import { post } from "./posts.js";
|
|
7
|
+
export const registry = {
|
|
8
|
+
version: "1.3",
|
|
9
|
+
operations: [post, cut, jump],
|
|
10
|
+
goals: [counters, every],
|
|
11
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { searchKeySchema } from "../../cores/search.js";
|
|
2
|
+
import { maxNumber, maxPlaces, maxSpacing } from "./line.js";
|
|
3
|
+
import { lineCounters } from "./posts.js";
|
|
4
|
+
/** The $id of the kind's schema at a version: a name, which need not resolve. */
|
|
5
|
+
export function schemaId(version) {
|
|
6
|
+
return `https://altnovatrail.github.io/widgets/kinds/line/${version}/line.schema.json`;
|
|
7
|
+
}
|
|
8
|
+
const places = (description) => ({
|
|
9
|
+
description,
|
|
10
|
+
type: "array",
|
|
11
|
+
items: { description: "A place, by its number.", $ref: "#/$defs/place" },
|
|
12
|
+
uniqueItems: true,
|
|
13
|
+
});
|
|
14
|
+
export function lineSchema(registry) {
|
|
15
|
+
const options = {};
|
|
16
|
+
const moves = {};
|
|
17
|
+
const state = {
|
|
18
|
+
posts: places("The places a post stands on now, by their numbers, in ascending order."),
|
|
19
|
+
};
|
|
20
|
+
const counters = Object.entries(lineCounters).map(([name, c]) => `${name}: ${c.description}`);
|
|
21
|
+
for (const op of registry.operations) {
|
|
22
|
+
options[op.name] = op.schema.options;
|
|
23
|
+
moves[op.name] = op.schema.move;
|
|
24
|
+
if (op.schema.state !== undefined) {
|
|
25
|
+
state[op.schema.state.member] = op.schema.state.schema;
|
|
26
|
+
}
|
|
27
|
+
for (const [name, c] of Object.entries(op.counters ?? {})) {
|
|
28
|
+
counters.push(`${name}, where the scene allows ${op.name}: ${c.description}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const names = counters.map((counter) => counter.slice(0, counter.search(/[,:]/)));
|
|
32
|
+
const goals = {};
|
|
33
|
+
for (const goal of registry.goals) {
|
|
34
|
+
goals[goal.name] = goal.schema;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
38
|
+
$id: schemaId(registry.version),
|
|
39
|
+
title: "A scene of the widget kind line",
|
|
40
|
+
description: "A line of places, the operations a learner may play on it with their parameters, and at most one goal a state may meet. Under $defs, a move and a state of the kind, and the form of a scene's key.",
|
|
41
|
+
type: "object",
|
|
42
|
+
properties: {
|
|
43
|
+
line: {
|
|
44
|
+
description: "The line as the scene gives it.",
|
|
45
|
+
$ref: "#/$defs/line",
|
|
46
|
+
unevaluatedProperties: false,
|
|
47
|
+
},
|
|
48
|
+
operations: {
|
|
49
|
+
description: "The operations a learner may play on the scene, each by its name with its parameters; none, for a line only to look at.",
|
|
50
|
+
type: "object",
|
|
51
|
+
properties: options,
|
|
52
|
+
unevaluatedProperties: false,
|
|
53
|
+
},
|
|
54
|
+
goal: {
|
|
55
|
+
description: "What a state is to meet, one goal by its name with its parameters.",
|
|
56
|
+
type: "object",
|
|
57
|
+
properties: goals,
|
|
58
|
+
minProperties: 1,
|
|
59
|
+
maxProperties: 1,
|
|
60
|
+
unevaluatedProperties: false,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
required: ["line", "operations"],
|
|
64
|
+
unevaluatedProperties: false,
|
|
65
|
+
$defs: {
|
|
66
|
+
place: {
|
|
67
|
+
description: "A place of the line by its number: the line's first number for its first place, and each next place the next number.",
|
|
68
|
+
type: "integer",
|
|
69
|
+
minimum: 0,
|
|
70
|
+
maximum: maxNumber,
|
|
71
|
+
},
|
|
72
|
+
counter: {
|
|
73
|
+
description: `A counter, a number of a state the widget shows, by its name: ${counters.join(" ")}`,
|
|
74
|
+
enum: names,
|
|
75
|
+
},
|
|
76
|
+
line: {
|
|
77
|
+
description: "Places in a row, numbered from the first number on, each a spacing from the next, open or closed into a ring, and the posts that stand on them at the start.",
|
|
78
|
+
type: "object",
|
|
79
|
+
properties: {
|
|
80
|
+
places: {
|
|
81
|
+
description: "The count of places.",
|
|
82
|
+
type: "integer",
|
|
83
|
+
minimum: 2,
|
|
84
|
+
maximum: maxPlaces,
|
|
85
|
+
},
|
|
86
|
+
first: {
|
|
87
|
+
description: "The number of the first place, as the statement numbers it — a floor, a page, a post —, so that the last place's number is at most the greatest a place has; 0 where left out.",
|
|
88
|
+
type: "integer",
|
|
89
|
+
minimum: 0,
|
|
90
|
+
maximum: maxNumber,
|
|
91
|
+
},
|
|
92
|
+
spacing: {
|
|
93
|
+
description: "The length from a place to the next, in the statement's unit — metres, steps, minutes; 1 where left out.",
|
|
94
|
+
type: "integer",
|
|
95
|
+
minimum: 1,
|
|
96
|
+
maximum: maxSpacing,
|
|
97
|
+
},
|
|
98
|
+
vertical: {
|
|
99
|
+
description: "Whether the line is drawn upright, its first place at the bottom, as floors, stairs or a well; it changes no rule, and a ring is never upright. False where left out.",
|
|
100
|
+
type: "boolean",
|
|
101
|
+
},
|
|
102
|
+
closed: {
|
|
103
|
+
description: "Whether the line is closed into a ring, its last place next to its first, as bushes round a flowerbed or a fence round a garden: as many gaps as posts, no end to cut at, and a jumper going on round it. False where left out.",
|
|
104
|
+
type: "boolean",
|
|
105
|
+
},
|
|
106
|
+
sides: {
|
|
107
|
+
description: "A ring's sides, where it is drawn as a figure with corners, as a square flowerbed or a garden's fence: each side by its count of gaps, the first place a corner and each next corner a side on, the sides' gaps together the ring's places. A round ring where left out; it changes no rule.",
|
|
108
|
+
type: "array",
|
|
109
|
+
items: {
|
|
110
|
+
description: "A side's count of gaps.",
|
|
111
|
+
type: "integer",
|
|
112
|
+
minimum: 1,
|
|
113
|
+
maximum: maxPlaces - 1,
|
|
114
|
+
},
|
|
115
|
+
minItems: 3,
|
|
116
|
+
maxItems: maxPlaces,
|
|
117
|
+
},
|
|
118
|
+
posts: places("The places a post stands on at the scene's start, each once."),
|
|
119
|
+
},
|
|
120
|
+
required: ["places"],
|
|
121
|
+
dependentRequired: { sides: ["closed"] },
|
|
122
|
+
allOf: [
|
|
123
|
+
{
|
|
124
|
+
not: {
|
|
125
|
+
properties: {
|
|
126
|
+
closed: { description: "A ring.", const: true },
|
|
127
|
+
vertical: { description: "Upright.", const: true },
|
|
128
|
+
},
|
|
129
|
+
required: ["closed", "vertical"],
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
not: {
|
|
134
|
+
properties: {
|
|
135
|
+
closed: { description: "An open line.", const: false },
|
|
136
|
+
sides: { description: "Sides given." },
|
|
137
|
+
},
|
|
138
|
+
required: ["closed", "sides"],
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
move: {
|
|
144
|
+
description: "A move: one member, named by the operation it plays, holding what a move of the operation holds.",
|
|
145
|
+
type: "object",
|
|
146
|
+
properties: moves,
|
|
147
|
+
minProperties: 1,
|
|
148
|
+
maxProperties: 1,
|
|
149
|
+
},
|
|
150
|
+
state: {
|
|
151
|
+
description: "A state: the posts, and a member for each operation of the scene that keeps one.",
|
|
152
|
+
type: "object",
|
|
153
|
+
properties: state,
|
|
154
|
+
required: ["posts"],
|
|
155
|
+
},
|
|
156
|
+
key: searchKeySchema,
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altnovatrail/widgets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "NovaTrail's widget kinds: each kind's rules and solver over its states, and the shell they share.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"lib",
|
|
13
13
|
"cores/vector.schema.json",
|
|
14
|
-
"cores/handles.schema.json",
|
|
15
14
|
"kinds/*/*.schema.json",
|
|
16
15
|
"kinds/*/*.handles.json",
|
|
17
16
|
"kinds/*/vectors/*.json"
|
|
@@ -39,14 +38,27 @@
|
|
|
39
38
|
"default": "./lib/cores/random.js"
|
|
40
39
|
},
|
|
41
40
|
"./cores/vector.schema.json": "./cores/vector.schema.json",
|
|
42
|
-
"./
|
|
41
|
+
"./kinds/cards": {
|
|
42
|
+
"types": "./lib/kinds/cards/index.d.ts",
|
|
43
|
+
"default": "./lib/kinds/cards/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./kinds/cards/cards.schema.json": "./kinds/cards/cards.schema.json",
|
|
46
|
+
"./kinds/cards/cards.handles.json": "./kinds/cards/cards.handles.json",
|
|
47
|
+
"./kinds/cards/vectors/*": "./kinds/cards/vectors/*",
|
|
43
48
|
"./kinds/cells": {
|
|
44
49
|
"types": "./lib/kinds/cells/index.d.ts",
|
|
45
50
|
"default": "./lib/kinds/cells/index.js"
|
|
46
51
|
},
|
|
47
52
|
"./kinds/cells/cells.schema.json": "./kinds/cells/cells.schema.json",
|
|
48
53
|
"./kinds/cells/cells.handles.json": "./kinds/cells/cells.handles.json",
|
|
49
|
-
"./kinds/cells/vectors/*": "./kinds/cells/vectors/*"
|
|
54
|
+
"./kinds/cells/vectors/*": "./kinds/cells/vectors/*",
|
|
55
|
+
"./kinds/line": {
|
|
56
|
+
"types": "./lib/kinds/line/index.d.ts",
|
|
57
|
+
"default": "./lib/kinds/line/index.js"
|
|
58
|
+
},
|
|
59
|
+
"./kinds/line/line.schema.json": "./kinds/line/line.schema.json",
|
|
60
|
+
"./kinds/line/line.handles.json": "./kinds/line/line.handles.json",
|
|
61
|
+
"./kinds/line/vectors/*": "./kinds/line/vectors/*"
|
|
50
62
|
},
|
|
51
63
|
"devDependencies": {
|
|
52
64
|
"@biomejs/biome": "2.6.9",
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://altnovatrail.github.io/widgets/cores/1.0/handles.schema.json",
|
|
4
|
-
"title": "The handles of a widget",
|
|
5
|
-
"description": "The handles an AI may call on a widget, each in the form of a tool of the Model Context Protocol — its name, its description for the model and the JSON Schema of its arguments — with its class of rights. The shell's file lists the handles every kind gets; a kind's file lists the shell's and its own, and the module package carries it with the bundle, so that the server offers the model only the classes the mode and the place allow.",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"properties": {
|
|
8
|
-
"handles": {
|
|
9
|
-
"description": "The handles, each name given once.",
|
|
10
|
-
"type": "array",
|
|
11
|
-
"items": {
|
|
12
|
-
"description": "A handle.",
|
|
13
|
-
"$ref": "#/$defs/handle",
|
|
14
|
-
"unevaluatedProperties": false
|
|
15
|
-
},
|
|
16
|
-
"minItems": 1
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"required": ["handles"],
|
|
20
|
-
"unevaluatedProperties": false,
|
|
21
|
-
"$defs": {
|
|
22
|
-
"handle": {
|
|
23
|
-
"description": "A handle: a tool of the Model Context Protocol by its members name, description and inputSchema, and its class.",
|
|
24
|
-
"type": "object",
|
|
25
|
-
"properties": {
|
|
26
|
-
"name": {
|
|
27
|
-
"description": "The handle's name in snake_case, which a call names.",
|
|
28
|
-
"type": "string",
|
|
29
|
-
"pattern": "^[a-z][a-z0-9_]{0,63}$"
|
|
30
|
-
},
|
|
31
|
-
"description": {
|
|
32
|
-
"description": "What the handle does, in English, for the model: the module's eval set measures the prompt with it.",
|
|
33
|
-
"type": "string",
|
|
34
|
-
"minLength": 1,
|
|
35
|
-
"maxLength": 1000
|
|
36
|
-
},
|
|
37
|
-
"inputSchema": {
|
|
38
|
-
"description": "The JSON Schema of the call's arguments, by the conventions of the module format's schemas: an object closed by unevaluatedProperties, no argument free text the learner sees, and only the keywords the shell reads on the device.",
|
|
39
|
-
"type": "object",
|
|
40
|
-
"properties": {
|
|
41
|
-
"type": {
|
|
42
|
-
"description": "The arguments are an object.",
|
|
43
|
-
"const": "object"
|
|
44
|
-
},
|
|
45
|
-
"unevaluatedProperties": {
|
|
46
|
-
"description": "The object is closed: it takes no member its schema does not name.",
|
|
47
|
-
"const": false
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"additionalProperties": {
|
|
51
|
-
"description": "A keyword of JSON Schema with its value."
|
|
52
|
-
},
|
|
53
|
-
"required": ["type", "unevaluatedProperties"]
|
|
54
|
-
},
|
|
55
|
-
"class": {
|
|
56
|
-
"description": "The class of rights: show leaves the state and asks nothing of the solver; rewind brings the state back to one of its history; solve is every other.",
|
|
57
|
-
"enum": ["show", "rewind", "solve"]
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"required": ["name", "description", "inputSchema", "class"]
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|