@elizaos/plugin-mysticism 2.0.0-alpha.3 → 2.0.0-beta.1

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 ADDED
@@ -0,0 +1,188 @@
1
+ # @elizaos/plugin-mysticism
2
+
3
+ Mystical divination engines for ElizaOS agents — Tarot, I Ching, and Astrology readings with progressive revelation, emotional attunement, and optional payment integration.
4
+
5
+ ## Overview
6
+
7
+ This plugin gives ElizaOS agents the ability to perform three classical divination systems as interactive, multi-turn conversations:
8
+
9
+ - **Tarot** — Full 78-card Rider-Waite deck with multiple spread layouts (Three Card, Celtic Cross, etc.), card-by-card progressive reveal, and positional interpretation.
10
+ - **I Ching** — Three-coin method hexagram casting with full 64-hexagram corpus, changing line detection, and transformed hexagram support.
11
+ - **Astrology** — Natal chart calculation from birth data with planetary positions, house placements, aspect detection, and sign-by-sign interpretation.
12
+
13
+ Each system follows a phased reading lifecycle: **intake → casting → interpretation → synthesis → closing**, allowing the agent to pace the experience naturally and respond to user feedback between revelations.
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @elizaos/plugin-mysticism@next
19
+ # or
20
+ bun add @elizaos/plugin-mysticism@next
21
+ ```
22
+
23
+ ### Peer Dependencies
24
+
25
+ - `@elizaos/core` (v2.x)
26
+ - Optional `@elizaos/plugin-form` for shared FORM service intake flows
27
+
28
+ ## Quick Start
29
+
30
+ Add the plugin to your agent's character configuration:
31
+
32
+ ```json
33
+ {
34
+ "plugins": ["@elizaos/plugin-mysticism"]
35
+ }
36
+ ```
37
+
38
+ Or import and register it directly:
39
+
40
+ ```typescript
41
+ import { mysticismPlugin } from "@elizaos/plugin-mysticism";
42
+
43
+ // Add to your agent's plugin list
44
+ const character = {
45
+ plugins: [mysticismPlugin],
46
+ };
47
+ ```
48
+
49
+ ## Actions
50
+
51
+ | Action | Similes | Description |
52
+ |--------|---------|-------------|
53
+ | `TAROT_READING` | `READ_TAROT`, `DRAW_CARDS`, `TAROT_SPREAD`, `CARD_READING` | Initiate a tarot card reading |
54
+ | `ICHING_READING` | `CAST_HEXAGRAM`, `CONSULT_ICHING`, `THROW_COINS`, `ORACLE_READING` | Initiate an I Ching divination |
55
+ | `ASTROLOGY_READING` | `BIRTH_CHART`, `NATAL_CHART`, `HOROSCOPE_READING`, `ZODIAC_READING` | Initiate a natal chart reading |
56
+ | `READING_FOLLOWUP` | `CONTINUE_READING`, `NEXT_CARD`, `NEXT_LINE`, `PROCEED_READING` | Reveal the next element in an active reading |
57
+ | `DEEPEN_READING` | `EXPLORE_DEEPER`, `TELL_MORE`, `ELABORATE_READING` | Provide deeper interpretation of a specific element |
58
+ | `REQUEST_PAYMENT` | `CHARGE_USER`, `ASK_FOR_PAYMENT` | Request payment for a reading session |
59
+ | `CHECK_PAYMENT` | `VERIFY_PAYMENT`, `PAYMENT_STATUS` | Verify payment status for the current session |
60
+
61
+ ## Providers
62
+
63
+ | Provider | Description |
64
+ |----------|-------------|
65
+ | `READING_CONTEXT` | Injects active reading session state into the agent's context |
66
+ | `ECONOMIC_CONTEXT` | Provides payment history and revenue facts |
67
+ | `MYSTICAL_KNOWLEDGE` | Grounds the agent's interpretations with domain-specific symbolism |
68
+
69
+ ## Forms
70
+
71
+ | Form | Description |
72
+ |------|-------------|
73
+ | `tarot-intake` | Collects the user's question and preferred spread |
74
+ | `astrology-intake` | Collects birth date, time, and location |
75
+ | `reading-feedback` | Captures user reflection after each revealed element |
76
+
77
+ ## REST API Routes
78
+
79
+ The plugin registers HTTP routes on the agent's API server:
80
+
81
+ | Method | Path | Description |
82
+ |--------|------|-------------|
83
+ | `POST` | `/api/readings/tarot` | Start a tarot reading |
84
+ | `POST` | `/api/readings/iching` | Start an I Ching reading |
85
+ | `POST` | `/api/readings/astrology` | Start an astrology reading |
86
+ | `GET` | `/api/readings/status` | Poll reading session status |
87
+
88
+ ### Example: Start a Tarot Reading
89
+
90
+ ```bash
91
+ curl -X POST http://localhost:3000/api/readings/tarot \
92
+ -H "Content-Type: application/json" \
93
+ -d '{
94
+ "entityId": "user-uuid",
95
+ "roomId": "room-uuid",
96
+ "question": "What should I focus on this month?",
97
+ "spreadId": "celtic_cross"
98
+ }'
99
+ ```
100
+
101
+ ### Example: Start an Astrology Reading
102
+
103
+ ```bash
104
+ curl -X POST http://localhost:3000/api/readings/astrology \
105
+ -H "Content-Type: application/json" \
106
+ -d '{
107
+ "entityId": "user-uuid",
108
+ "roomId": "room-uuid",
109
+ "birthYear": 1990,
110
+ "birthMonth": 6,
111
+ "birthDay": 15,
112
+ "birthHour": 14,
113
+ "birthMinute": 30,
114
+ "latitude": 40.7128,
115
+ "longitude": -74.006,
116
+ "timezone": -5
117
+ }'
118
+ ```
119
+
120
+ ## Configuration
121
+
122
+ Optional pricing parameters can be set via `agentConfig.pluginParameters` or environment variables:
123
+
124
+ | Parameter | Description | Default |
125
+ |-----------|-------------|---------|
126
+ | `READING_PRICE_TAROT` | Price in USDC base units for a tarot reading | `0` (free) |
127
+ | `READING_PRICE_ICHING` | Price in USDC base units for an I Ching reading | `0` (free) |
128
+ | `READING_PRICE_ASTROLOGY` | Price in USDC base units for an astrology reading | `0` (free) |
129
+
130
+ When prices are set to `0`, the payment actions (`REQUEST_PAYMENT`, `CHECK_PAYMENT`) are effectively no-ops and readings proceed without a payment gate.
131
+
132
+ ## Architecture
133
+
134
+ ```
135
+ plugin-mysticism/
136
+ ├── typescript/ # TypeScript implementation (published to npm)
137
+ │ ├── src/
138
+ │ │ ├── actions/ # Agent actions (tarot, iching, astrology, payment, followup)
139
+ │ │ ├── engines/ # Pure divination logic, no runtime dependencies
140
+ │ │ │ ├── tarot/ # 78-card deck, spreads, interpretation
141
+ │ │ │ ├── iching/ # 64 hexagrams, trigrams, coin casting
142
+ │ │ │ └── astrology/# Chart calculation, zodiac, aspects, houses
143
+ │ │ ├── forms/ # Intake and feedback form definitions
144
+ │ │ ├── providers/ # Context providers for the LLM
145
+ │ │ ├── routes/ # REST API endpoints
146
+ │ │ ├── services/ # MysticismService — session and state management
147
+ │ │ └── types.ts # Shared type definitions
148
+ │ └── __tests__/ # Vitest test suite
149
+ ├── python/ # Python implementation of divination engines
150
+ ├── rust/ # Rust implementation of divination engines
151
+ └── package.json # Root package (monorepo orchestration)
152
+ ```
153
+
154
+ ### Engine Design
155
+
156
+ The engines (`TarotEngine`, `IChingEngine`, `AstrologyEngine`) are pure computational modules with no ElizaOS runtime dependency. They operate on structured data (JSON card decks, hexagram tables, zodiac definitions) and return typed results. This makes them independently testable and reusable outside the plugin context.
157
+
158
+ ### Service Layer
159
+
160
+ `MysticismService` manages reading session lifecycle, tracks per-entity active sessions, handles progressive reveal state, records user feedback, detects crisis language (with severity tiers and appropriate referral messaging), and integrates with the payment flow.
161
+
162
+ ### Safety
163
+
164
+ The service includes built-in crisis detection that scans user input for indicators of distress. When detected, the agent pauses the reading and provides appropriate mental health resource referrals rather than continuing with potentially harmful mystical interpretations.
165
+
166
+ ## Development
167
+
168
+ ```bash
169
+ # Install dependencies
170
+ bun install
171
+
172
+ # Build
173
+ bun run build
174
+
175
+ # Run tests
176
+ bun run test
177
+
178
+ # Type check
179
+ bun run typecheck
180
+
181
+ # Lint & format
182
+ bun run lint
183
+ bun run format
184
+ ```
185
+
186
+ ## License
187
+
188
+ MIT