pi-roundtable-drawing 0.7.3 → 0.7.4
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 +4 -0
- package/README.md +4 -2
- package/package.json +2 -2
- package/src/index.ts +5 -1
- package/src/plugin.ts +19 -1
- package/src/tools/draw-cards-tool.ts +3 -1
- package/src/tools/relationship-map-tool.ts +12 -5
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.7.4] - 2026-10-03
|
|
9
|
+
|
|
10
|
+
- Add `cardPresentation.result` for the card draw result text and `mapLimits` for longer relationship-map text.
|
|
11
|
+
|
|
8
12
|
## [0.7.3] - 2026-10-03
|
|
9
13
|
|
|
10
14
|
- Add `DrawingOptions.cardPresentation` for trusted operator card headings and reversal suffixes.
|
package/README.md
CHANGED
|
@@ -82,12 +82,14 @@ export default {
|
|
|
82
82
|
| `deckDir` | `string` | none | A directory with one subdirectory for each deck; see [the deck directory](#the-deck-directory). Without it the plugin has no `draw_cards` tool. A directory that does not exist, holds no deck, or holds an invalid manifest stops the start with a message that names the deck and what to fix |
|
|
83
83
|
| `random` | `() => number` | `Math.random` | The random source of the map layouts and the card draws, returning a number from 0 up to, not including, 1. A seeded source makes a run reproducible: a new `seededRandom(seed)` given the same calls draws the same pictures. `seededRandom(seed)` is exported for that |
|
|
84
84
|
| `minTier` | `"owner" \| "admin" \| "member"` | `member` | The lowest tier that may use the tools. The operator's `toolTiers` setting still wins |
|
|
85
|
-
| `cardPresentation` | `CardPresentation` | package captions | Trusted operator-local headings
|
|
85
|
+
| `cardPresentation` | `CardPresentation` | package captions | Trusted operator-local headings, reversal suffixes and result text |
|
|
86
|
+
| `mapLimits` | `{ title?, text? }` | 80 and 60 | Longest relationship-map title, and node id, node label or edge label, in characters, for a host whose callers already draw longer text; the renderer's size limit still applies |
|
|
86
87
|
|
|
87
88
|
The plugin is named `drawing`.
|
|
88
89
|
`cardPresentation.heading(draw, turn)` returns `{ title, subtitle }`; `draw` holds the selected `deck`, `count`, and optional `question`, and `turn` carries the host-bound speaker/channel.
|
|
89
90
|
`cardPresentation.reversedSuffix` replaces the default `" (reversed)"` on pictured reversed card names.
|
|
90
|
-
|
|
91
|
+
`cardPresentation.result({ deck, cards, positions })` replaces the text the model reads back after a draw; `{file}` stands for the attached file's name.
|
|
92
|
+
These hooks change only presentation, not card selection, model-visible arguments, or attachment limits.
|
|
91
93
|
They are trusted configuration callbacks, never guest-supplied code.
|
|
92
94
|
|
|
93
95
|
## The tools
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-roundtable-drawing",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "Relationship maps, magic circles, sigils, sacred geometry, and card spreads drawn locally for pi-roundtable",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@biomejs/biome": "2.5.15",
|
|
50
50
|
"@types/bun": "1.4.2",
|
|
51
|
-
"pi-roundtable": "0.7.
|
|
51
|
+
"pi-roundtable": "0.7.4",
|
|
52
52
|
"typescript": "7.0.2"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export type { Card, Deck } from "./cards/deck.ts";
|
|
2
|
-
export type {
|
|
2
|
+
export type {
|
|
3
|
+
CardPresentation,
|
|
4
|
+
DrawingOptions,
|
|
5
|
+
RelationshipMapLimits,
|
|
6
|
+
} from "./plugin.ts";
|
|
3
7
|
export { drawing } from "./plugin.ts";
|
|
4
8
|
export type { Random } from "./random.ts";
|
|
5
9
|
export { seededRandom } from "./random.ts";
|
package/src/plugin.ts
CHANGED
|
@@ -23,6 +23,22 @@ export interface CardPresentation {
|
|
|
23
23
|
) => { title: string; subtitle: string };
|
|
24
24
|
/** Appended to reversed card names on the picture; default " (reversed)". */
|
|
25
25
|
reversedSuffix?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The text the model reads back after a draw; `{file}` stands for the attached file's name.
|
|
28
|
+
* Default: the deck id, then one numbered line per card with its position label and id.
|
|
29
|
+
*/
|
|
30
|
+
result?: (draw: {
|
|
31
|
+
deck: Deck;
|
|
32
|
+
cards: { id: string; name: string; reversed: boolean }[];
|
|
33
|
+
positions: { row: number; col: number; label?: string | undefined }[];
|
|
34
|
+
}) => string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Longest map text a host accepts, in characters; the defaults suit a picture that stays readable. */
|
|
38
|
+
export interface RelationshipMapLimits {
|
|
39
|
+
title?: number;
|
|
40
|
+
/** Node ids, node labels and edge labels. */
|
|
41
|
+
text?: number;
|
|
26
42
|
}
|
|
27
43
|
|
|
28
44
|
export interface DrawingOptions {
|
|
@@ -38,6 +54,8 @@ export interface DrawingOptions {
|
|
|
38
54
|
minTier?: Tier;
|
|
39
55
|
/** Operator-local captions and reversal wording; default package presentation. */
|
|
40
56
|
cardPresentation?: CardPresentation;
|
|
57
|
+
/** Longer map text than the defaults, for a host whose callers already draw longer labels. */
|
|
58
|
+
mapLimits?: RelationshipMapLimits;
|
|
41
59
|
}
|
|
42
60
|
|
|
43
61
|
function readDecks(deckDir: string): Deck[] {
|
|
@@ -66,7 +84,7 @@ export function drawing(options: DrawingOptions = {}) {
|
|
|
66
84
|
};
|
|
67
85
|
return {
|
|
68
86
|
tools: [
|
|
69
|
-
relationshipMapTool(env, random),
|
|
87
|
+
relationshipMapTool(env, random, options.mapLimits),
|
|
70
88
|
magicCircleTool(env),
|
|
71
89
|
sigilTool(env),
|
|
72
90
|
sacredGeometryTool(env),
|
|
@@ -124,7 +124,9 @@ export function drawCardsTool(
|
|
|
124
124
|
return {
|
|
125
125
|
stem: "cards",
|
|
126
126
|
image,
|
|
127
|
-
text:
|
|
127
|
+
text:
|
|
128
|
+
presentation.result?.({ deck, cards, positions }) ??
|
|
129
|
+
`Drew ${cards.length} from ${deck.id}; the spread picture is attached to your reply as {file}.\n${lines.join("\n")}`,
|
|
128
130
|
};
|
|
129
131
|
},
|
|
130
132
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
|
+
import type { RelationshipMapLimits } from "../plugin.ts";
|
|
2
3
|
import type { Random } from "../random.ts";
|
|
3
4
|
import {
|
|
4
5
|
EDGE_TYPES,
|
|
@@ -16,25 +17,31 @@ import {
|
|
|
16
17
|
strictObject,
|
|
17
18
|
} from "./image-tool.ts";
|
|
18
19
|
|
|
19
|
-
export function relationshipMapTool(
|
|
20
|
+
export function relationshipMapTool(
|
|
21
|
+
env: ImageToolEnv,
|
|
22
|
+
random: Random,
|
|
23
|
+
limits: RelationshipMapLimits = {},
|
|
24
|
+
) {
|
|
25
|
+
const maxTitle = limits.title ?? MAX_TITLE;
|
|
26
|
+
const maxText = limits.text ?? MAX_TEXT;
|
|
20
27
|
return imageTool(
|
|
21
28
|
{
|
|
22
29
|
name: "relationship_map",
|
|
23
30
|
description:
|
|
24
31
|
"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
32
|
parameters: strictObject({
|
|
26
|
-
title: Type.Optional(Type.String({ maxLength:
|
|
33
|
+
title: Type.Optional(Type.String({ maxLength: maxTitle })),
|
|
27
34
|
nodes: Type.Array(
|
|
28
35
|
strictObject({
|
|
29
36
|
id: Type.String({
|
|
30
37
|
minLength: 1,
|
|
31
|
-
maxLength:
|
|
38
|
+
maxLength: maxText,
|
|
32
39
|
description: "Character or faction name.",
|
|
33
40
|
}),
|
|
34
41
|
type: literals(NODE_TYPES),
|
|
35
42
|
label: Type.Optional(
|
|
36
43
|
Type.String({
|
|
37
|
-
maxLength:
|
|
44
|
+
maxLength: maxText,
|
|
38
45
|
description: "A sub-label such as a role.",
|
|
39
46
|
}),
|
|
40
47
|
),
|
|
@@ -49,7 +56,7 @@ export function relationshipMapTool(env: ImageToolEnv, random: Random) {
|
|
|
49
56
|
EDGE_TYPES,
|
|
50
57
|
"romantic: arrow; entanglement: dashed arrow; bond: plain line; faction: dashed arrow; hostile: arrows both ways.",
|
|
51
58
|
),
|
|
52
|
-
label: Type.Optional(Type.String({ maxLength:
|
|
59
|
+
label: Type.Optional(Type.String({ maxLength: maxText })),
|
|
53
60
|
}),
|
|
54
61
|
{ maxItems: MAX_EDGES },
|
|
55
62
|
),
|