@zodic/shared 0.0.313 → 0.0.315
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/app/services/ArchetypeService.ts +190 -0
- package/app/workflow/ArchetypeWorkflow.ts +676 -124
- package/db/migrations/0014_green_marvel_apes.sql +10 -0
- package/db/migrations/meta/0014_snapshot.json +2723 -0
- package/db/migrations/meta/_journal.json +7 -0
- package/db/schema.ts +17 -0
- package/package.json +1 -1
- package/utils/buildMessages.ts +273 -59
- package/utils/duplicatedArchetypeNamePrompt.ts +47 -0
package/db/schema.ts
CHANGED
|
@@ -469,6 +469,10 @@ export const generations = sqliteTable(
|
|
|
469
469
|
() => conceptCombinations.id,
|
|
470
470
|
{ onDelete: 'cascade' }
|
|
471
471
|
),
|
|
472
|
+
archetypeDataId: text('archetype_data_id').references(
|
|
473
|
+
() => archetypesData.id,
|
|
474
|
+
{ onDelete: 'cascade' }
|
|
475
|
+
), // New column to reference archetypes_data
|
|
472
476
|
type: text('type').notNull(), // e.g., "concept_image"
|
|
473
477
|
status: text('status').default('pending').notNull(), // "pending", "completed", "failed"
|
|
474
478
|
url: text('url'), // URL for the generated image
|
|
@@ -478,6 +482,7 @@ export const generations = sqliteTable(
|
|
|
478
482
|
index('generations_user_id_idx').on(t.userId),
|
|
479
483
|
index('generations_concept_combination_id_idx').on(t.conceptCombinationId),
|
|
480
484
|
index('generations_archetype_index_idx').on(t.archetypeIndex),
|
|
485
|
+
index('generations_archetype_data_id_idx').on(t.archetypeDataId), // New index for archetypeDataId
|
|
481
486
|
]
|
|
482
487
|
);
|
|
483
488
|
|
|
@@ -526,3 +531,15 @@ export const tokens = sqliteTable(
|
|
|
526
531
|
index('tokens_user_id_idx').on(t.userId), // Index on user_id
|
|
527
532
|
]
|
|
528
533
|
);
|
|
534
|
+
|
|
535
|
+
export const logs = sqliteTable(
|
|
536
|
+
'logs',
|
|
537
|
+
{
|
|
538
|
+
id: text('id').primaryKey(), // e.g., "archetype-workflow:timestamp"
|
|
539
|
+
level: text('level').notNull(), // "info", "debug", "warn", "error"
|
|
540
|
+
message: text('message').notNull(),
|
|
541
|
+
context: text('context').default('{}').notNull(), // JSON stringified object with additional data
|
|
542
|
+
createdAt: integer('created_at').default(sql`CURRENT_TIMESTAMP`),
|
|
543
|
+
},
|
|
544
|
+
() => []
|
|
545
|
+
);
|
package/package.json
CHANGED
package/utils/buildMessages.ts
CHANGED
|
@@ -10,78 +10,292 @@ import { conceptPrompts } from './conceptPrompts';
|
|
|
10
10
|
import { mapConceptToPlanets } from './mapConceptToPlanets';
|
|
11
11
|
|
|
12
12
|
export const buildLLMMessages = (env: BackendBindings) => ({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
13
|
+
generateCosmicMirrorDescriptionAndVirtues: ({
|
|
14
|
+
combination,
|
|
15
|
+
names,
|
|
16
|
+
essenceLines,
|
|
17
|
+
}: {
|
|
18
|
+
combination: string;
|
|
19
|
+
names: [string, string, string]; // archetypeIndex: 1, 2, 3
|
|
20
|
+
essenceLines: [string, string, string];
|
|
21
|
+
}): ChatMessages => {
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
role: 'system',
|
|
25
|
+
content: `
|
|
26
|
+
You are a gifted fantasy writer and astrologer. Your task is to write mystical **narrative descriptions** and **core virtues** for three archetypes, based on their names, essence lines, and astrological combination.
|
|
27
|
+
|
|
28
|
+
Each archetype is influenced by the zodiac combination (Sun, Ascendant, Moon), and each one emphasizes one of those signs respectively.
|
|
29
|
+
|
|
30
|
+
Please provide:
|
|
31
|
+
|
|
32
|
+
1. A **Narrative Description** for each archetype (80–100 words):
|
|
33
|
+
• English (gender-neutral)
|
|
34
|
+
• Portuguese — masculine version
|
|
35
|
+
• Portuguese — feminine version
|
|
36
|
+
|
|
37
|
+
2. Three symbolic **Virtues** for each archetype.
|
|
38
|
+
|
|
39
|
+
—
|
|
40
|
+
|
|
41
|
+
✳️ Use the following format exactly for the response:
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
1.
|
|
46
|
+
|
|
47
|
+
• Description EN: ...
|
|
48
|
+
• Description PT-M: ...
|
|
49
|
+
• Description PT-F: ...
|
|
50
|
+
• Virtues: Virtue1, Virtue2, Virtue3
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
2.
|
|
55
|
+
|
|
56
|
+
• Description EN: ...
|
|
57
|
+
• Description PT-M: ...
|
|
58
|
+
• Description PT-F: ...
|
|
59
|
+
• Virtues: Virtue1, Virtue2, Virtue3
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
3.
|
|
64
|
+
|
|
65
|
+
• Description EN: ...
|
|
66
|
+
• Description PT-M: ...
|
|
67
|
+
• Description PT-F: ...
|
|
68
|
+
• Virtues: Virtue1, Virtue2, Virtue3
|
|
69
|
+
`,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
role: 'user',
|
|
73
|
+
content: `
|
|
74
|
+
Zodiac Combination: ${combination}
|
|
75
|
+
|
|
76
|
+
Archetype 1:
|
|
77
|
+
- Name: ${names[0]}
|
|
78
|
+
- Essence Line: ${essenceLines[0]}
|
|
79
|
+
|
|
80
|
+
Archetype 2:
|
|
81
|
+
- Name: ${names[1]}
|
|
82
|
+
- Essence Line: ${essenceLines[1]}
|
|
83
|
+
|
|
84
|
+
Archetype 3:
|
|
85
|
+
- Name: ${names[2]}
|
|
86
|
+
- Essence Line: ${essenceLines[2]}
|
|
87
|
+
`,
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
},
|
|
55
91
|
generateCosmicMirrorArchetypeContent: ({
|
|
56
92
|
name,
|
|
57
93
|
description,
|
|
58
|
-
|
|
59
|
-
ascendant,
|
|
60
|
-
moon,
|
|
94
|
+
combination,
|
|
61
95
|
}: {
|
|
62
96
|
name: string;
|
|
63
97
|
description: string;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
moon
|
|
67
|
-
|
|
98
|
+
combination: string;
|
|
99
|
+
}): ChatMessages => {
|
|
100
|
+
const [sun, ascendant, moon] = combination.split('-');
|
|
101
|
+
|
|
102
|
+
return [
|
|
103
|
+
{
|
|
104
|
+
role: 'system',
|
|
105
|
+
content: `
|
|
106
|
+
You are an expert in astrology and archetypal synthesis. Your task is to generate detailed **archetype content** based on a person's core archetype name, description, and Sun, Ascendant, and Moon signs.
|
|
107
|
+
|
|
108
|
+
Your response must be insightful, symbolic, and poetic. Avoid direct mentions of zodiac signs or planets; instead, convey their **archetypal energy** through rich metaphors and evocative storytelling.
|
|
109
|
+
|
|
110
|
+
Generate two versions of the content:
|
|
111
|
+
- One in **English** (gender-neutral).
|
|
112
|
+
- One in **Brazilian Portuguese**, with both **masculine and feminine** phrasing. Content and metaphors should remain identical; only adapt gendered language.
|
|
113
|
+
|
|
114
|
+
Each content version must include **six sections**, each with approximately **140 words**:
|
|
115
|
+
|
|
116
|
+
1. **The Voice of the Soul** – How the archetype expresses itself in daily life.
|
|
117
|
+
2. **The Gifts You Bear** – Strengths and contributions of the archetype.
|
|
118
|
+
3. **The Shadows You Face** – Challenges or inner conflicts.
|
|
119
|
+
4. **The Rhythm of Your Days** – Their lifestyle, habits, and inner tempo.
|
|
120
|
+
5. **The Ties That Bind** – Relationships and emotional connections.
|
|
121
|
+
6. **The Light Within** – Inner peace, fulfillment, and spiritual resonance.
|
|
122
|
+
|
|
123
|
+
—
|
|
124
|
+
|
|
125
|
+
✨ Output Format:
|
|
126
|
+
|
|
127
|
+
Return the full response in this exact format:
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
EN:
|
|
132
|
+
# The Voice of the Soul
|
|
133
|
+
[English version]
|
|
134
|
+
|
|
135
|
+
# The Gifts You Bear
|
|
136
|
+
[...]
|
|
137
|
+
|
|
138
|
+
# The Shadows You Face
|
|
139
|
+
[...]
|
|
140
|
+
|
|
141
|
+
# The Rhythm of Your Days
|
|
142
|
+
[...]
|
|
143
|
+
|
|
144
|
+
# The Ties That Bind
|
|
145
|
+
[...]
|
|
146
|
+
|
|
147
|
+
# The Light Within
|
|
148
|
+
[...]
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
PT-M:
|
|
153
|
+
# A Voz da Alma
|
|
154
|
+
[Versão masculina em português]
|
|
155
|
+
|
|
156
|
+
# Os Dons que Você Carrega
|
|
157
|
+
[...]
|
|
158
|
+
|
|
159
|
+
# As Sombras que Enfrenta
|
|
160
|
+
[...]
|
|
161
|
+
|
|
162
|
+
# O Ritmo dos Seus Dias
|
|
163
|
+
[...]
|
|
164
|
+
|
|
165
|
+
# Os Laços que te Conectam
|
|
166
|
+
[...]
|
|
167
|
+
|
|
168
|
+
# A Luz Interior
|
|
169
|
+
[...]
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
PT-F:
|
|
174
|
+
# A Voz da Alma
|
|
175
|
+
[Versão feminina em português]
|
|
176
|
+
|
|
177
|
+
# Os Dons que Você Carrega
|
|
178
|
+
[...]
|
|
179
|
+
|
|
180
|
+
# As Sombras que Enfrenta
|
|
181
|
+
[...]
|
|
182
|
+
|
|
183
|
+
# O Ritmo dos Seus Dias
|
|
184
|
+
[...]
|
|
185
|
+
|
|
186
|
+
# Os Laços que te Conectam
|
|
187
|
+
[...]
|
|
188
|
+
|
|
189
|
+
# A Luz Interior
|
|
190
|
+
[...]
|
|
191
|
+
`,
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
role: 'user',
|
|
195
|
+
content: `
|
|
196
|
+
Generate rich and mystical content for the following archetype:
|
|
197
|
+
|
|
198
|
+
• Archetype Name: ${name}
|
|
199
|
+
• Archetype Description: ${description}
|
|
200
|
+
• Sun Sign: ${sun}
|
|
201
|
+
• Ascendant Sign: ${ascendant}
|
|
202
|
+
• Moon Sign: ${moon}
|
|
203
|
+
`,
|
|
204
|
+
},
|
|
205
|
+
];
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
generateCosmicMirrorArchetypeLeonardoPrompts: (
|
|
209
|
+
archetypes: Array<{ name: string; description: string }>
|
|
210
|
+
): ChatMessages => [
|
|
68
211
|
{
|
|
69
212
|
role: 'system',
|
|
70
|
-
content: env.PROMPT_GENERATE_ARCHETYPE_CONTENT,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
role: 'user',
|
|
74
213
|
content: `
|
|
75
|
-
|
|
214
|
+
You are an expert in fantasy image generation. Your task is to transform archetype names and symbolic descriptions into highly detailed prompts for generating photorealistic fantasy characters using Leonardo.ai.
|
|
76
215
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
216
|
+
For each archetype, generate two prompts:
|
|
217
|
+
- One for a male character
|
|
218
|
+
- One for a female character
|
|
219
|
+
|
|
220
|
+
Instructions:
|
|
221
|
+
- Focus primarily on the character design—their appearance, clothing, and demeanor. This is more important than the background or setting.
|
|
222
|
+
- The setting should remain fantasy-inspired, but avoid over-specification. General hints like “enchanted realm” or “mystical battlefield” are enough unless the archetype demands more.
|
|
223
|
+
- The character must reflect the symbolic and mythic tone of the archetype name and description.
|
|
224
|
+
- Make sure male characters have short, cropped, or bald hair. Never long.
|
|
225
|
+
- Female characters may have long, flowing, or styled hair if it suits the archetype.
|
|
226
|
+
- The outfit should be rich in fantasy elements: armor, cloaks, robes, accessories. Avoid modern or casual clothing.
|
|
227
|
+
- The character must always be facing the camera, with a clear, visible face.
|
|
228
|
+
- Rendering instructions must include: 8K, HDR, Unreal Engine, photorealism, cinematic lighting, full body, fantasy aesthetic.
|
|
229
|
+
|
|
230
|
+
Each prompt must:
|
|
231
|
+
- Be under 1200 characters (including spaces).
|
|
232
|
+
- Clearly distinguish between the male and female versions only by adapting gender-specific features.
|
|
233
|
+
- Maintain identical structure, setting, and tone between both versions.
|
|
234
|
+
|
|
235
|
+
Output Format
|
|
236
|
+
|
|
237
|
+
1.m
|
|
238
|
+
[Prompt for the first archetype made for a male character]
|
|
239
|
+
|
|
240
|
+
1.f
|
|
241
|
+
[Prompt for the first archetype made for a female character (same as the male prompt but adapted for gender-specific traits)]
|
|
242
|
+
|
|
243
|
+
2.m
|
|
244
|
+
[Prompt for the second archetype made for a male character]
|
|
245
|
+
|
|
246
|
+
2.f
|
|
247
|
+
[Prompt for the second archetype made for a female character]
|
|
248
|
+
|
|
249
|
+
3.m
|
|
250
|
+
[Prompt for the third archetype made for a male character]
|
|
251
|
+
|
|
252
|
+
3.f
|
|
253
|
+
[Prompt for the third archetype made for a female character]
|
|
82
254
|
`,
|
|
83
255
|
},
|
|
256
|
+
{
|
|
257
|
+
role: 'user',
|
|
258
|
+
content: archetypes
|
|
259
|
+
.map((a, idx) =>
|
|
260
|
+
`
|
|
261
|
+
${idx + 1}.
|
|
262
|
+
- Name: ${a.name}
|
|
263
|
+
- Description: ${a.description}`.trim()
|
|
264
|
+
)
|
|
265
|
+
.join('\n\n'),
|
|
266
|
+
},
|
|
84
267
|
],
|
|
268
|
+
|
|
269
|
+
// generateCosmicMirrorArchetypeContent: ({
|
|
270
|
+
// name,
|
|
271
|
+
// description,
|
|
272
|
+
// sun,
|
|
273
|
+
// ascendant,
|
|
274
|
+
// moon,
|
|
275
|
+
// }: {
|
|
276
|
+
// name: string;
|
|
277
|
+
// description: string;
|
|
278
|
+
// sun: string;
|
|
279
|
+
// ascendant: string;
|
|
280
|
+
// moon: string;
|
|
281
|
+
// }): ChatMessages => [
|
|
282
|
+
// {
|
|
283
|
+
// role: 'system',
|
|
284
|
+
// content: env.PROMPT_GENERATE_ARCHETYPE_CONTENT,
|
|
285
|
+
// },
|
|
286
|
+
// {
|
|
287
|
+
// role: 'user',
|
|
288
|
+
// content: `
|
|
289
|
+
// Generate a detailed archetype description using the following inputs:
|
|
290
|
+
|
|
291
|
+
// Archetype Name: ${name}
|
|
292
|
+
// Archetype Description: ${description}
|
|
293
|
+
// Sun Sign: ${sun}
|
|
294
|
+
// Ascendant Sign: ${ascendant}
|
|
295
|
+
// Moon Sign: ${moon}
|
|
296
|
+
// `,
|
|
297
|
+
// },
|
|
298
|
+
// ],
|
|
85
299
|
personalizeCosmicMirrorLeonardoPrompt: ({
|
|
86
300
|
leonardoPrompt,
|
|
87
301
|
traits,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
type ArchetypePromptInputs = {
|
|
2
|
+
combination: string;
|
|
3
|
+
essenceLine: string;
|
|
4
|
+
existingNames: string[];
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export function duplicatedArchetypeNamePrompt({
|
|
8
|
+
combination,
|
|
9
|
+
essenceLine,
|
|
10
|
+
existingNames,
|
|
11
|
+
}: ArchetypePromptInputs): string {
|
|
12
|
+
return `
|
|
13
|
+
You are a creative naming assistant for a symbolic astrology project. Each archetype is defined by a unique combination of three zodiac signs (Sun, Moon, Ascendant), and has an associated *essence line* that captures its spiritual and psychological meaning. Your task is to generate a new, poetic and meaningful name for the archetype, ensuring it is unique among previously used names.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
Input:
|
|
18
|
+
|
|
19
|
+
- Combination: \`${combination}\`
|
|
20
|
+
- Essence Line: \`${essenceLine}\`
|
|
21
|
+
- Existing Names: \`${JSON.stringify(existingNames)}\`
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
Important Instructions:
|
|
26
|
+
|
|
27
|
+
1. Create a new archetype name that poetically reflects the given essence line.
|
|
28
|
+
2. The name should follow the same style as existing archetypes (e.g., \`The Wandering Alchemist\`, \`The Radiant Mask\`, \`The Harmonious Builder\`).
|
|
29
|
+
3. The name must not appear in the list of existing names.
|
|
30
|
+
4. Also generate Portuguese translations of the name:
|
|
31
|
+
- One in masculine form.
|
|
32
|
+
- One in feminine form.
|
|
33
|
+
5. Ensure all outputs are semantically coherent and well-written.
|
|
34
|
+
6. Use the following output format precisely.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
Output Format (exactly like this, do not change it):
|
|
39
|
+
|
|
40
|
+
{
|
|
41
|
+
"name_en": <Name in English>,
|
|
42
|
+
"name_pt_male": <Name in Portuguese Male>,
|
|
43
|
+
"name_pt_female": <Name in Portuguese Female>,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
`;
|
|
47
|
+
}
|