pi-roundtable-drawing 0.7.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/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +231 -0
- package/examples/decks/playing-cards/deck.json +274 -0
- package/examples/decks/tarot/deck.json +395 -0
- package/examples/roundtable.config.ts +23 -0
- package/fonts/NotoSansTC-Bold.otf +0 -0
- package/fonts/OFL.txt +92 -0
- package/package.json +54 -0
- package/src/cards/deck.ts +204 -0
- package/src/cards/draw.ts +66 -0
- package/src/cards/spread.ts +232 -0
- package/src/errors.ts +4 -0
- package/src/index.ts +5 -0
- package/src/magic.ts +525 -0
- package/src/plugin.ts +61 -0
- package/src/random.ts +19 -0
- package/src/relationship-map.ts +466 -0
- package/src/style.ts +31 -0
- package/src/tools/draw-cards-tool.ts +121 -0
- package/src/tools/image-tool.ts +97 -0
- package/src/tools/magic-tools.ts +140 -0
- package/src/tools/relationship-map-tool.ts +65 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
import {
|
|
3
|
+
CIRCLE_TYPES,
|
|
4
|
+
MAX_CIRCLE_TEXT,
|
|
5
|
+
MAX_LAYERS,
|
|
6
|
+
renderMagicCircle,
|
|
7
|
+
renderSacredGeometry,
|
|
8
|
+
renderSigil,
|
|
9
|
+
} from "../magic.ts";
|
|
10
|
+
import {
|
|
11
|
+
BACKGROUND,
|
|
12
|
+
type ImageToolEnv,
|
|
13
|
+
imageTool,
|
|
14
|
+
literals,
|
|
15
|
+
strictObject,
|
|
16
|
+
} from "./image-tool.ts";
|
|
17
|
+
|
|
18
|
+
const SIZES = { small: 512, medium: 1024, large: 2048 } as const;
|
|
19
|
+
|
|
20
|
+
export function magicCircleTool(env: ImageToolEnv) {
|
|
21
|
+
return imageTool(
|
|
22
|
+
{
|
|
23
|
+
name: "magic_circle_generate",
|
|
24
|
+
description:
|
|
25
|
+
"Draw a magic circle: a pentagram, hexagram, or Tree of Life, with optional elemental symbols at the quarters and text around the rim, and attach it to your reply as an image.",
|
|
26
|
+
parameters: strictObject({
|
|
27
|
+
type: literals(CIRCLE_TYPES, "custom draws a pentagram."),
|
|
28
|
+
style: Type.Optional(
|
|
29
|
+
literals(["traditional", "modern", "geometric"], "Line weight."),
|
|
30
|
+
),
|
|
31
|
+
elements: Type.Optional(
|
|
32
|
+
Type.Array(literals(["fire", "air", "water", "earth"]), {
|
|
33
|
+
maxItems: 4,
|
|
34
|
+
description: "Placed north, east, south, west in this order.",
|
|
35
|
+
}),
|
|
36
|
+
),
|
|
37
|
+
text: Type.Optional(
|
|
38
|
+
Type.String({
|
|
39
|
+
maxLength: MAX_CIRCLE_TEXT,
|
|
40
|
+
description: "Written around the rim.",
|
|
41
|
+
}),
|
|
42
|
+
),
|
|
43
|
+
size: Type.Optional(
|
|
44
|
+
literals(
|
|
45
|
+
["small", "medium", "large"],
|
|
46
|
+
"512, 1024, or 2048 px; default medium.",
|
|
47
|
+
),
|
|
48
|
+
),
|
|
49
|
+
background: BACKGROUND,
|
|
50
|
+
}),
|
|
51
|
+
draw: (args) => ({
|
|
52
|
+
stem: "magic-circle",
|
|
53
|
+
image: renderMagicCircle({
|
|
54
|
+
type: args.type,
|
|
55
|
+
style: args.style ?? "traditional",
|
|
56
|
+
size: SIZES[args.size ?? "medium"],
|
|
57
|
+
background: args.background ?? "dark",
|
|
58
|
+
...(args.elements ? { elements: args.elements } : {}),
|
|
59
|
+
...(args.text ? { text: args.text } : {}),
|
|
60
|
+
}),
|
|
61
|
+
text: "The magic circle is attached to your reply as {file}.",
|
|
62
|
+
}),
|
|
63
|
+
},
|
|
64
|
+
env,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function sigilTool(env: ImageToolEnv) {
|
|
69
|
+
return imageTool(
|
|
70
|
+
{
|
|
71
|
+
name: "sigil_generate",
|
|
72
|
+
description:
|
|
73
|
+
"Draw a sigil from an intention, by the chaos (letter elimination), rose cross, planetary, or geometric method, and attach it to your reply as an image.",
|
|
74
|
+
parameters: strictObject({
|
|
75
|
+
intention: Type.String({ minLength: 1, maxLength: 200 }),
|
|
76
|
+
method: literals(["chaos", "rose_cross", "planetary", "geometric"]),
|
|
77
|
+
complexity: Type.Optional(literals(["simple", "elaborate"])),
|
|
78
|
+
style: Type.Optional(literals(["traditional", "modern"])),
|
|
79
|
+
background: BACKGROUND,
|
|
80
|
+
}),
|
|
81
|
+
draw: (args) => ({
|
|
82
|
+
stem: "sigil",
|
|
83
|
+
image: renderSigil({
|
|
84
|
+
intention: args.intention,
|
|
85
|
+
method: args.method,
|
|
86
|
+
complexity: args.complexity ?? "elaborate",
|
|
87
|
+
style: args.style ?? "traditional",
|
|
88
|
+
background: args.background ?? "dark",
|
|
89
|
+
}),
|
|
90
|
+
text: "The sigil is attached to your reply as {file}.",
|
|
91
|
+
}),
|
|
92
|
+
},
|
|
93
|
+
env,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function sacredGeometryTool(env: ImageToolEnv) {
|
|
98
|
+
return imageTool(
|
|
99
|
+
{
|
|
100
|
+
name: "sacred_geometry_generate",
|
|
101
|
+
description:
|
|
102
|
+
"Draw sacred geometry: the Flower of Life, Metatron's Cube, a simplified Sri Yantra (nested triangles around a point, in a circle), or the Vesica Piscis, and attach it to your reply as an image. More layers add rings of circles, nested shapes, or, for Metatron's Cube, the outer ring (two or more layers).",
|
|
103
|
+
parameters: strictObject({
|
|
104
|
+
pattern: literals([
|
|
105
|
+
"flower_of_life",
|
|
106
|
+
"metatron",
|
|
107
|
+
"sri_yantra",
|
|
108
|
+
"vesica_pisces",
|
|
109
|
+
]),
|
|
110
|
+
layers: Type.Optional(
|
|
111
|
+
Type.Integer({
|
|
112
|
+
minimum: 1,
|
|
113
|
+
maximum: MAX_LAYERS,
|
|
114
|
+
description: "Default 3.",
|
|
115
|
+
}),
|
|
116
|
+
),
|
|
117
|
+
rotation: Type.Optional(Type.Number({ description: "Degrees." })),
|
|
118
|
+
colors: Type.Optional(
|
|
119
|
+
Type.Array(Type.String(), {
|
|
120
|
+
maxItems: MAX_LAYERS,
|
|
121
|
+
description: "CSS colors cycled per layer.",
|
|
122
|
+
}),
|
|
123
|
+
),
|
|
124
|
+
background: BACKGROUND,
|
|
125
|
+
}),
|
|
126
|
+
draw: (args) => ({
|
|
127
|
+
stem: "sacred-geometry",
|
|
128
|
+
image: renderSacredGeometry({
|
|
129
|
+
pattern: args.pattern,
|
|
130
|
+
layers: args.layers ?? 3,
|
|
131
|
+
rotation: args.rotation ?? 0,
|
|
132
|
+
colors: args.colors ?? [],
|
|
133
|
+
background: args.background ?? "dark",
|
|
134
|
+
}),
|
|
135
|
+
text: "The sacred geometry is attached to your reply as {file}.",
|
|
136
|
+
}),
|
|
137
|
+
},
|
|
138
|
+
env,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
import type { Random } from "../random.ts";
|
|
3
|
+
import {
|
|
4
|
+
EDGE_TYPES,
|
|
5
|
+
MAX_EDGES,
|
|
6
|
+
MAX_NODES,
|
|
7
|
+
MAX_TEXT,
|
|
8
|
+
MAX_TITLE,
|
|
9
|
+
NODE_TYPES,
|
|
10
|
+
renderRelationshipMap,
|
|
11
|
+
} from "../relationship-map.ts";
|
|
12
|
+
import {
|
|
13
|
+
type ImageToolEnv,
|
|
14
|
+
imageTool,
|
|
15
|
+
literals,
|
|
16
|
+
strictObject,
|
|
17
|
+
} from "./image-tool.ts";
|
|
18
|
+
|
|
19
|
+
export function relationshipMapTool(env: ImageToolEnv, random: Random) {
|
|
20
|
+
return imageTool(
|
|
21
|
+
{
|
|
22
|
+
name: "relationship_map",
|
|
23
|
+
description:
|
|
24
|
+
"Draw a hand-drawn relationship map of characters (pc, npc) and factions, with typed relationships between them, and attach it to your reply as an image.",
|
|
25
|
+
parameters: strictObject({
|
|
26
|
+
title: Type.Optional(Type.String({ maxLength: MAX_TITLE })),
|
|
27
|
+
nodes: Type.Array(
|
|
28
|
+
strictObject({
|
|
29
|
+
id: Type.String({
|
|
30
|
+
minLength: 1,
|
|
31
|
+
maxLength: MAX_TEXT,
|
|
32
|
+
description: "Character or faction name.",
|
|
33
|
+
}),
|
|
34
|
+
type: literals(NODE_TYPES),
|
|
35
|
+
label: Type.Optional(
|
|
36
|
+
Type.String({
|
|
37
|
+
maxLength: MAX_TEXT,
|
|
38
|
+
description: "A sub-label such as a role.",
|
|
39
|
+
}),
|
|
40
|
+
),
|
|
41
|
+
}),
|
|
42
|
+
{ minItems: 1, maxItems: MAX_NODES },
|
|
43
|
+
),
|
|
44
|
+
edges: Type.Array(
|
|
45
|
+
strictObject({
|
|
46
|
+
from: Type.String({ description: "The id of a node." }),
|
|
47
|
+
to: Type.String({ description: "The id of another node." }),
|
|
48
|
+
type: literals(
|
|
49
|
+
EDGE_TYPES,
|
|
50
|
+
"romantic: arrow; entanglement: dashed arrow; bond: plain line; faction: dashed arrow; hostile: arrows both ways.",
|
|
51
|
+
),
|
|
52
|
+
label: Type.Optional(Type.String({ maxLength: MAX_TEXT })),
|
|
53
|
+
}),
|
|
54
|
+
{ maxItems: MAX_EDGES },
|
|
55
|
+
),
|
|
56
|
+
}),
|
|
57
|
+
draw: (args) => ({
|
|
58
|
+
stem: "relationship-map",
|
|
59
|
+
image: renderRelationshipMap(args, random),
|
|
60
|
+
text: "The relationship map is attached to your reply as {file}.",
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
env,
|
|
64
|
+
);
|
|
65
|
+
}
|