run-dmcp 0.1.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.
Files changed (167) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +79 -0
  3. package/dist/__tests__/engineVocabulary.test.d.ts +1 -0
  4. package/dist/__tests__/engineVocabulary.test.js +147 -0
  5. package/dist/db/__tests__/connection.test.d.ts +1 -0
  6. package/dist/db/__tests__/connection.test.js +72 -0
  7. package/dist/db/__tests__/testDb.d.ts +33 -0
  8. package/dist/db/__tests__/testDb.js +41 -0
  9. package/dist/db/connection.d.ts +22 -0
  10. package/dist/db/connection.js +107 -0
  11. package/dist/db/schema.d.ts +1 -0
  12. package/dist/db/schema.js +725 -0
  13. package/dist/events/emitter.d.ts +22 -0
  14. package/dist/events/emitter.js +71 -0
  15. package/dist/http/server.d.ts +3 -0
  16. package/dist/http/server.js +649 -0
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.js +92 -0
  19. package/dist/register/abilities.d.ts +2 -0
  20. package/dist/register/abilities.js +165 -0
  21. package/dist/register/audio.d.ts +2 -0
  22. package/dist/register/audio.js +326 -0
  23. package/dist/register/batch.d.ts +2 -0
  24. package/dist/register/batch.js +343 -0
  25. package/dist/register/character.d.ts +2 -0
  26. package/dist/register/character.js +324 -0
  27. package/dist/register/combat.d.ts +2 -0
  28. package/dist/register/combat.js +207 -0
  29. package/dist/register/core.d.ts +2 -0
  30. package/dist/register/core.js +1040 -0
  31. package/dist/register/display.d.ts +2 -0
  32. package/dist/register/display.js +263 -0
  33. package/dist/register/factions.d.ts +2 -0
  34. package/dist/register/factions.js +186 -0
  35. package/dist/register/images.d.ts +2 -0
  36. package/dist/register/images.js +400 -0
  37. package/dist/register/inventory.d.ts +2 -0
  38. package/dist/register/inventory.js +115 -0
  39. package/dist/register/mcp-prompts.d.ts +2 -0
  40. package/dist/register/mcp-prompts.js +684 -0
  41. package/dist/register/mcp-resources.d.ts +2 -0
  42. package/dist/register/mcp-resources.js +335 -0
  43. package/dist/register/narrative.d.ts +2 -0
  44. package/dist/register/narrative.js +242 -0
  45. package/dist/register/notes.d.ts +2 -0
  46. package/dist/register/notes.js +170 -0
  47. package/dist/register/pause.d.ts +2 -0
  48. package/dist/register/pause.js +580 -0
  49. package/dist/register/quests.d.ts +2 -0
  50. package/dist/register/quests.js +118 -0
  51. package/dist/register/relationships.d.ts +2 -0
  52. package/dist/register/relationships.js +147 -0
  53. package/dist/register/resources.d.ts +2 -0
  54. package/dist/register/resources.js +277 -0
  55. package/dist/register/secrets.d.ts +2 -0
  56. package/dist/register/secrets.js +192 -0
  57. package/dist/register/status.d.ts +2 -0
  58. package/dist/register/status.js +130 -0
  59. package/dist/register/tables.d.ts +2 -0
  60. package/dist/register/tables.js +146 -0
  61. package/dist/register/tags.d.ts +2 -0
  62. package/dist/register/tags.js +114 -0
  63. package/dist/register/time.d.ts +2 -0
  64. package/dist/register/time.js +281 -0
  65. package/dist/register/world.d.ts +2 -0
  66. package/dist/register/world.js +127 -0
  67. package/dist/schemas/index.d.ts +921 -0
  68. package/dist/schemas/index.js +121 -0
  69. package/dist/test-setup.d.ts +1 -0
  70. package/dist/test-setup.js +13 -0
  71. package/dist/tools/__tests__/audio.test.d.ts +1 -0
  72. package/dist/tools/__tests__/audio.test.js +59 -0
  73. package/dist/tools/__tests__/conserved.test.d.ts +1 -0
  74. package/dist/tools/__tests__/conserved.test.js +488 -0
  75. package/dist/tools/__tests__/constraint.test.d.ts +1 -0
  76. package/dist/tools/__tests__/constraint.test.js +212 -0
  77. package/dist/tools/__tests__/expiry-consequences.test.d.ts +1 -0
  78. package/dist/tools/__tests__/expiry-consequences.test.js +110 -0
  79. package/dist/tools/__tests__/images.test.d.ts +1 -0
  80. package/dist/tools/__tests__/images.test.js +59 -0
  81. package/dist/tools/__tests__/relationship.test.d.ts +1 -0
  82. package/dist/tools/__tests__/relationship.test.js +132 -0
  83. package/dist/tools/__tests__/resource-constraints.test.d.ts +1 -0
  84. package/dist/tools/__tests__/resource-constraints.test.js +131 -0
  85. package/dist/tools/__tests__/resource.test.d.ts +1 -0
  86. package/dist/tools/__tests__/resource.test.js +190 -0
  87. package/dist/tools/__tests__/time.test.d.ts +1 -0
  88. package/dist/tools/__tests__/time.test.js +404 -0
  89. package/dist/tools/__tests__/timers.test.d.ts +1 -0
  90. package/dist/tools/__tests__/timers.test.js +426 -0
  91. package/dist/tools/__tests__/world.test.d.ts +1 -0
  92. package/dist/tools/__tests__/world.test.js +70 -0
  93. package/dist/tools/ability.d.ts +48 -0
  94. package/dist/tools/ability.js +238 -0
  95. package/dist/tools/audio.d.ts +24 -0
  96. package/dist/tools/audio.js +365 -0
  97. package/dist/tools/character.d.ts +70 -0
  98. package/dist/tools/character.js +309 -0
  99. package/dist/tools/combat.d.ts +13 -0
  100. package/dist/tools/combat.js +195 -0
  101. package/dist/tools/constraint.d.ts +132 -0
  102. package/dist/tools/constraint.js +269 -0
  103. package/dist/tools/dice.d.ts +23 -0
  104. package/dist/tools/dice.js +111 -0
  105. package/dist/tools/display.d.ts +120 -0
  106. package/dist/tools/display.js +528 -0
  107. package/dist/tools/faction.d.ts +61 -0
  108. package/dist/tools/faction.js +269 -0
  109. package/dist/tools/game.d.ts +96 -0
  110. package/dist/tools/game.js +526 -0
  111. package/dist/tools/image-prompt.d.ts +49 -0
  112. package/dist/tools/image-prompt.js +479 -0
  113. package/dist/tools/images.d.ts +47 -0
  114. package/dist/tools/images.js +449 -0
  115. package/dist/tools/inventory.d.ts +20 -0
  116. package/dist/tools/inventory.js +145 -0
  117. package/dist/tools/narrative.d.ts +58 -0
  118. package/dist/tools/narrative.js +237 -0
  119. package/dist/tools/notes.d.ts +41 -0
  120. package/dist/tools/notes.js +220 -0
  121. package/dist/tools/pause.d.ts +110 -0
  122. package/dist/tools/pause.js +1254 -0
  123. package/dist/tools/quest.d.ts +34 -0
  124. package/dist/tools/quest.js +164 -0
  125. package/dist/tools/relationship.d.ts +74 -0
  126. package/dist/tools/relationship.js +324 -0
  127. package/dist/tools/resource.d.ts +93 -0
  128. package/dist/tools/resource.js +374 -0
  129. package/dist/tools/rules.d.ts +4 -0
  130. package/dist/tools/rules.js +30 -0
  131. package/dist/tools/secrets.d.ts +49 -0
  132. package/dist/tools/secrets.js +195 -0
  133. package/dist/tools/status.d.ts +36 -0
  134. package/dist/tools/status.js +218 -0
  135. package/dist/tools/tables.d.ts +33 -0
  136. package/dist/tools/tables.js +209 -0
  137. package/dist/tools/tags.d.ts +52 -0
  138. package/dist/tools/tags.js +176 -0
  139. package/dist/tools/time.d.ts +33 -0
  140. package/dist/tools/time.js +276 -0
  141. package/dist/tools/timers.d.ts +41 -0
  142. package/dist/tools/timers.js +215 -0
  143. package/dist/tools/world.d.ts +78 -0
  144. package/dist/tools/world.js +331 -0
  145. package/dist/types/index.d.ts +969 -0
  146. package/dist/types/index.js +1 -0
  147. package/dist/utils/__tests__/json.test.d.ts +1 -0
  148. package/dist/utils/__tests__/json.test.js +55 -0
  149. package/dist/utils/__tests__/validation.test.d.ts +1 -0
  150. package/dist/utils/__tests__/validation.test.js +90 -0
  151. package/dist/utils/errors.d.ts +44 -0
  152. package/dist/utils/errors.js +121 -0
  153. package/dist/utils/json.d.ts +9 -0
  154. package/dist/utils/json.js +23 -0
  155. package/dist/utils/logger.d.ts +7 -0
  156. package/dist/utils/logger.js +50 -0
  157. package/dist/utils/output-schemas.d.ts +594 -0
  158. package/dist/utils/output-schemas.js +331 -0
  159. package/dist/utils/tool-annotations.d.ts +147 -0
  160. package/dist/utils/tool-annotations.js +98 -0
  161. package/dist/utils/validation.d.ts +34 -0
  162. package/dist/utils/validation.js +52 -0
  163. package/dist/utils/verbosity.d.ts +57 -0
  164. package/dist/utils/verbosity.js +67 -0
  165. package/dist/utils/webui.d.ts +20 -0
  166. package/dist/utils/webui.js +35 -0
  167. package/package.json +75 -0
@@ -0,0 +1,969 @@
1
+ export interface Game {
2
+ id: string;
3
+ name: string;
4
+ setting: string;
5
+ style: string;
6
+ rules: RuleSystem | null;
7
+ preferences: GamePreferences | null;
8
+ currentLocationId: string | null;
9
+ titleImageId: string | null;
10
+ faviconImageId: string | null;
11
+ createdAt: string;
12
+ updatedAt: string;
13
+ }
14
+ export interface GameSummary {
15
+ id: string;
16
+ name: string;
17
+ setting: string;
18
+ style: string;
19
+ titleImageId: string | null;
20
+ faviconImageId: string | null;
21
+ createdAt: string;
22
+ updatedAt: string;
23
+ }
24
+ export interface GamePreferences {
25
+ genre: PreferenceValue<string>;
26
+ tone: PreferenceValue<string>;
27
+ setting: PreferenceValue<string>;
28
+ complexity: PreferenceValue<string>;
29
+ combatFrequency: PreferenceValue<string>;
30
+ combatStyle: PreferenceValue<string>;
31
+ lethality: PreferenceValue<string>;
32
+ narrativeStyle: PreferenceValue<string>;
33
+ playerAgency: PreferenceValue<string>;
34
+ npcDepth: PreferenceValue<string>;
35
+ romanceContent: PreferenceValue<string>;
36
+ worldFamiliarity: PreferenceValue<string>;
37
+ magicOrTechLevel: PreferenceValue<string>;
38
+ politicalComplexity: PreferenceValue<string>;
39
+ sessionLength: PreferenceValue<string>;
40
+ pacingPreference: PreferenceValue<string>;
41
+ contentToAvoid: string[];
42
+ contentToInclude: string[];
43
+ inspirations: string[];
44
+ characterCreation: PreferenceValue<string>;
45
+ startingPowerLevel: PreferenceValue<string>;
46
+ additionalNotes: string;
47
+ imageGenerationPresets?: ImageGenerationPreset[];
48
+ defaultImagePresetId?: string;
49
+ imagePromptTemplates?: ImagePromptTemplate[];
50
+ }
51
+ export interface ImageGenerationPreset {
52
+ id: string;
53
+ name: string;
54
+ description?: string;
55
+ entityTypes?: string[];
56
+ isDefault?: boolean;
57
+ config: ImageGenerationPreferences;
58
+ createdAt?: string;
59
+ updatedAt?: string;
60
+ }
61
+ export interface ImagePromptTemplate {
62
+ id: string;
63
+ name: string;
64
+ description?: string;
65
+ entityType: string;
66
+ promptTemplate: string;
67
+ negativePromptTemplate?: string;
68
+ promptPrefix?: string;
69
+ promptSuffix?: string;
70
+ fieldAliases?: Record<string, string>;
71
+ defaults?: Record<string, string>;
72
+ priority?: number;
73
+ isDefault?: boolean;
74
+ createdAt?: string;
75
+ updatedAt?: string;
76
+ }
77
+ export interface ImageGenerationPreferences {
78
+ defaultTool?: "dalle" | "sdxl" | "midjourney" | "comfyui" | "flux" | "other";
79
+ defaultStyle?: {
80
+ artisticStyle?: string;
81
+ mood?: string;
82
+ colorScheme?: string;
83
+ qualityTags?: string[];
84
+ negativePrompts?: string[];
85
+ influences?: string[];
86
+ };
87
+ comfyui?: {
88
+ endpoint?: string;
89
+ checkpoint?: string;
90
+ loras?: Array<{
91
+ name: string;
92
+ weight: number;
93
+ }>;
94
+ samplerSettings?: {
95
+ sampler?: string;
96
+ scheduler?: string;
97
+ steps?: number;
98
+ cfg?: number;
99
+ };
100
+ workflows?: Record<string, {
101
+ name: string;
102
+ description?: string;
103
+ workflow: Record<string, unknown>;
104
+ inputNodes?: {
105
+ positivePrompt?: string;
106
+ negativePrompt?: string;
107
+ checkpoint?: string;
108
+ seed?: string;
109
+ width?: string;
110
+ height?: string;
111
+ steps?: string;
112
+ cfg?: string;
113
+ sampler?: string;
114
+ scheduler?: string;
115
+ };
116
+ }>;
117
+ defaultWorkflowId?: string;
118
+ defaultWorkflow?: string;
119
+ workflowOverrides?: Record<string, unknown>;
120
+ };
121
+ dalle?: {
122
+ model?: string;
123
+ quality?: "standard" | "hd";
124
+ style?: "vivid" | "natural";
125
+ size?: "1024x1024" | "1792x1024" | "1024x1792";
126
+ };
127
+ midjourney?: {
128
+ version?: string;
129
+ stylize?: number;
130
+ chaos?: number;
131
+ quality?: number;
132
+ aspectRatio?: string;
133
+ };
134
+ sdxl?: {
135
+ model?: string;
136
+ samplerName?: string;
137
+ steps?: number;
138
+ cfg?: number;
139
+ width?: number;
140
+ height?: number;
141
+ negativePrompt?: string;
142
+ };
143
+ flux?: {
144
+ model?: string;
145
+ steps?: number;
146
+ guidance?: number;
147
+ };
148
+ defaults?: {
149
+ aspectRatio?: string;
150
+ generateOnCreate?: boolean;
151
+ savePrompts?: boolean;
152
+ framing?: {
153
+ character?: string;
154
+ location?: string;
155
+ item?: string;
156
+ };
157
+ };
158
+ consistency?: {
159
+ maintainColorPalette?: boolean;
160
+ characterSeedImages?: Record<string, string>;
161
+ styleReferenceImage?: string;
162
+ useCharacterRefs?: boolean;
163
+ };
164
+ notes?: string;
165
+ }
166
+ export interface PreferenceValue<T> {
167
+ value: T | null;
168
+ delegatedToDM: boolean;
169
+ notes?: string;
170
+ }
171
+ export interface InterviewQuestion {
172
+ id: keyof GamePreferences;
173
+ category: string;
174
+ question: string;
175
+ description: string;
176
+ options?: {
177
+ value: string;
178
+ label: string;
179
+ description: string;
180
+ }[];
181
+ allowFreeform: boolean;
182
+ allowDelegate: boolean;
183
+ delegateLabel?: string;
184
+ }
185
+ export interface ImageGeneration {
186
+ subject: SubjectDescription;
187
+ style: StyleDescription;
188
+ composition: CompositionDescription;
189
+ prompts?: {
190
+ generic?: string;
191
+ sdxl?: string;
192
+ dalle?: string;
193
+ midjourney?: string;
194
+ flux?: string;
195
+ comfyui?: ComfyUIPrompt;
196
+ };
197
+ generations?: GeneratedImage[];
198
+ consistency?: {
199
+ characterRef?: string;
200
+ seedImage?: string;
201
+ colorPalette?: string[];
202
+ styleRef?: string;
203
+ };
204
+ }
205
+ export interface SubjectDescription {
206
+ type: "character" | "location" | "item" | "scene";
207
+ primaryDescription: string;
208
+ physicalTraits?: {
209
+ age?: string;
210
+ gender?: string;
211
+ bodyType?: string;
212
+ height?: string;
213
+ skinTone?: string;
214
+ hairColor?: string;
215
+ hairStyle?: string;
216
+ eyeColor?: string;
217
+ facialFeatures?: string;
218
+ distinguishingMarks?: string[];
219
+ };
220
+ attire?: {
221
+ description: string;
222
+ colors?: string[];
223
+ materials?: string[];
224
+ accessories?: string[];
225
+ };
226
+ environment?: {
227
+ setting: string;
228
+ timeOfDay?: string;
229
+ weather?: string;
230
+ lighting?: string;
231
+ architecture?: string;
232
+ vegetation?: string;
233
+ notableFeatures?: string[];
234
+ };
235
+ objectDetails?: {
236
+ material?: string;
237
+ size?: string;
238
+ condition?: string;
239
+ glowOrEffects?: string;
240
+ };
241
+ pose?: string;
242
+ expression?: string;
243
+ action?: string;
244
+ }
245
+ export interface StyleDescription {
246
+ artisticStyle: string;
247
+ genre: string;
248
+ mood: string;
249
+ colorScheme?: string;
250
+ influences?: string[];
251
+ qualityTags?: string[];
252
+ negativeElements?: string[];
253
+ }
254
+ export interface CompositionDescription {
255
+ framing: string;
256
+ cameraAngle?: string;
257
+ aspectRatio?: string;
258
+ focusPoint?: string;
259
+ background?: string;
260
+ depth?: string;
261
+ }
262
+ export interface ComfyUIPrompt {
263
+ positive: string;
264
+ negative: string;
265
+ checkpoint?: string;
266
+ loras?: {
267
+ name: string;
268
+ weight: number;
269
+ }[];
270
+ samplerSettings?: {
271
+ sampler?: string;
272
+ scheduler?: string;
273
+ steps?: number;
274
+ cfg?: number;
275
+ };
276
+ }
277
+ export interface GeneratedImage {
278
+ id: string;
279
+ tool: string;
280
+ prompt: string;
281
+ url?: string;
282
+ base64?: string;
283
+ seed?: number;
284
+ timestamp: string;
285
+ metadata?: Record<string, unknown>;
286
+ }
287
+ export interface RuleSystem {
288
+ name: string;
289
+ description: string;
290
+ attributes: AttributeDef[];
291
+ skills: SkillDef[];
292
+ derivedStats: DerivedStatDef[];
293
+ combatRules: CombatRules;
294
+ checkMechanics: CheckMechanics;
295
+ progression: ProgressionRules;
296
+ }
297
+ export interface AttributeDef {
298
+ name: string;
299
+ abbreviation: string;
300
+ description: string;
301
+ defaultValue: number;
302
+ minValue: number;
303
+ maxValue: number;
304
+ }
305
+ export interface SkillDef {
306
+ name: string;
307
+ governingAttribute: string;
308
+ description: string;
309
+ }
310
+ export interface DerivedStatDef {
311
+ name: string;
312
+ abbreviation: string;
313
+ description: string;
314
+ formula: string;
315
+ }
316
+ export interface CombatRules {
317
+ initiativeFormula: string;
318
+ actionsPerTurn: number;
319
+ attackFormula: string;
320
+ defenseFormula: string;
321
+ damageFormula: string;
322
+ conditions: ConditionDef[];
323
+ }
324
+ export interface ConditionDef {
325
+ name: string;
326
+ description: string;
327
+ effects: string;
328
+ }
329
+ export interface CheckMechanics {
330
+ baseDice: string;
331
+ modifierCalculation: string;
332
+ difficultyScale: Record<string, number>;
333
+ criticalSuccess?: number;
334
+ criticalFailure?: number;
335
+ }
336
+ export interface ProgressionRules {
337
+ experienceFormula: string;
338
+ levelUpThresholds: number[];
339
+ attributePointsPerLevel: number;
340
+ skillPointsPerLevel: number;
341
+ }
342
+ export interface Character {
343
+ id: string;
344
+ gameId: string;
345
+ name: string;
346
+ isPlayer: boolean;
347
+ attributes: Record<string, number>;
348
+ skills: Record<string, number>;
349
+ status: CharacterStatus;
350
+ locationId: string | null;
351
+ notes: string;
352
+ voice: VoiceDescription | null;
353
+ imageGen: ImageGeneration | null;
354
+ createdAt: string;
355
+ }
356
+ export interface VoiceDescription {
357
+ pitch: "very_low" | "low" | "medium" | "high" | "very_high";
358
+ speed: "very_slow" | "slow" | "medium" | "fast" | "very_fast";
359
+ tone: string;
360
+ accent?: string;
361
+ quirks?: string[];
362
+ description?: string;
363
+ }
364
+ export interface CharacterStatus {
365
+ health: number;
366
+ maxHealth: number;
367
+ conditions: string[];
368
+ experience: number;
369
+ level: number;
370
+ [key: string]: unknown;
371
+ }
372
+ export interface Location {
373
+ id: string;
374
+ gameId: string;
375
+ name: string;
376
+ description: string;
377
+ properties: LocationProperties;
378
+ imageGen: ImageGeneration | null;
379
+ }
380
+ export interface LocationProperties {
381
+ exits: Exit[];
382
+ features: string[];
383
+ atmosphere: string;
384
+ [key: string]: unknown;
385
+ }
386
+ export interface Exit {
387
+ direction: string;
388
+ destinationId: string;
389
+ description?: string;
390
+ locked?: boolean;
391
+ hidden?: boolean;
392
+ }
393
+ export interface Item {
394
+ id: string;
395
+ gameId: string;
396
+ ownerId: string;
397
+ ownerType: "character" | "location";
398
+ name: string;
399
+ properties: ItemProperties;
400
+ imageGen: ImageGeneration | null;
401
+ }
402
+ export interface ItemProperties {
403
+ description: string;
404
+ type: string;
405
+ weight?: number;
406
+ value?: number;
407
+ effects?: string[];
408
+ [key: string]: unknown;
409
+ }
410
+ export interface Quest {
411
+ id: string;
412
+ gameId: string;
413
+ name: string;
414
+ description: string;
415
+ objectives: QuestObjective[];
416
+ status: "active" | "completed" | "failed" | "abandoned";
417
+ rewards?: string;
418
+ }
419
+ export interface QuestObjective {
420
+ id: string;
421
+ description: string;
422
+ completed: boolean;
423
+ optional?: boolean;
424
+ }
425
+ export interface NarrativeEvent {
426
+ id: string;
427
+ gameId: string;
428
+ eventType: string;
429
+ content: string;
430
+ metadata: Record<string, unknown>;
431
+ timestamp: string;
432
+ }
433
+ export interface Combat {
434
+ id: string;
435
+ gameId: string;
436
+ locationId: string;
437
+ participants: CombatParticipant[];
438
+ currentTurn: number;
439
+ round: number;
440
+ status: "active" | "resolved";
441
+ log: string[];
442
+ }
443
+ export interface CombatParticipant {
444
+ characterId: string;
445
+ initiative: number;
446
+ isActive: boolean;
447
+ }
448
+ export interface DiceRoll {
449
+ expression: string;
450
+ rolls: number[];
451
+ modifier: number;
452
+ total: number;
453
+ }
454
+ export interface CheckResult {
455
+ roll: DiceRoll;
456
+ modifier: number;
457
+ total: number;
458
+ difficulty: number;
459
+ success: boolean;
460
+ criticalSuccess: boolean;
461
+ criticalFailure: boolean;
462
+ margin: number;
463
+ }
464
+ export interface Resource {
465
+ id: string;
466
+ gameId: string;
467
+ ownerId: string | null;
468
+ ownerType: "game" | "character";
469
+ name: string;
470
+ description: string;
471
+ category: string | null;
472
+ value: number;
473
+ minValue: number | null;
474
+ maxValue: number | null;
475
+ createdAt: string;
476
+ }
477
+ export interface ResourceChange {
478
+ id: string;
479
+ resourceId: string;
480
+ previousValue: number;
481
+ newValue: number;
482
+ delta: number;
483
+ reason: string | null;
484
+ timestamp: string;
485
+ }
486
+ export type ConstraintKind = "bounded" | "monotonic" | "conserved";
487
+ /** For 'monotonic': the only direction the value is allowed to move. */
488
+ export type MonotonicDirection = "increasing" | "decreasing";
489
+ export interface ResourceConstraint {
490
+ id: string;
491
+ gameId: string;
492
+ kind: ConstraintKind;
493
+ resourceIds: string[];
494
+ direction: MonotonicDirection | null;
495
+ total: number | null;
496
+ createdAt: string;
497
+ }
498
+ export interface GameDateTime {
499
+ year: number;
500
+ month: number;
501
+ day: number;
502
+ hour: number;
503
+ minute: number;
504
+ }
505
+ export interface CalendarConfig {
506
+ monthNames: string[];
507
+ daysPerMonth: number[];
508
+ hoursPerDay: number;
509
+ minutesPerHour: number;
510
+ startYear: number;
511
+ eraName?: string;
512
+ }
513
+ export interface GameTime {
514
+ gameId: string;
515
+ currentTime: GameDateTime;
516
+ calendarConfig: CalendarConfig;
517
+ }
518
+ export interface ExpiryConsequence {
519
+ resourceId: string;
520
+ delta: number;
521
+ }
522
+ export interface ScheduledEvent {
523
+ id: string;
524
+ gameId: string;
525
+ name: string;
526
+ description: string;
527
+ triggerTime: GameDateTime;
528
+ recurring: string | null;
529
+ triggered: boolean;
530
+ metadata: Record<string, unknown>;
531
+ consequence: ExpiryConsequence | null;
532
+ }
533
+ export interface Timer {
534
+ id: string;
535
+ gameId: string;
536
+ name: string;
537
+ description: string;
538
+ timerType: "countdown" | "stopwatch" | "clock";
539
+ currentValue: number;
540
+ maxValue: number | null;
541
+ direction: "up" | "down";
542
+ triggerAt: number | null;
543
+ triggered: boolean;
544
+ unit: string;
545
+ visibleToPlayers: boolean;
546
+ createdAt: string;
547
+ consequence: ExpiryConsequence | null;
548
+ }
549
+ export interface TableEntry {
550
+ minRoll: number;
551
+ maxRoll: number;
552
+ result: string;
553
+ weight?: number;
554
+ subtable?: string;
555
+ metadata?: Record<string, unknown>;
556
+ }
557
+ export interface RandomTable {
558
+ id: string;
559
+ gameId: string;
560
+ name: string;
561
+ description: string;
562
+ category: string | null;
563
+ entries: TableEntry[];
564
+ rollExpression: string;
565
+ createdAt: string;
566
+ }
567
+ export interface TableRollResult {
568
+ table: RandomTable;
569
+ roll: DiceRoll;
570
+ entry: TableEntry;
571
+ result: string;
572
+ subtableResults?: TableRollResult[];
573
+ }
574
+ export interface Secret {
575
+ id: string;
576
+ gameId: string;
577
+ name: string;
578
+ description: string;
579
+ category: string | null;
580
+ relatedEntityId: string | null;
581
+ relatedEntityType: string | null;
582
+ revealedTo: string[];
583
+ isPublic: boolean;
584
+ clues: string[];
585
+ createdAt: string;
586
+ }
587
+ export interface Relationship {
588
+ id: string;
589
+ gameId: string;
590
+ sourceId: string;
591
+ sourceType: string;
592
+ targetId: string;
593
+ targetType: string;
594
+ relationshipType: string;
595
+ value: number;
596
+ label: string | null;
597
+ notes: string;
598
+ createdAt: string;
599
+ updatedAt: string;
600
+ }
601
+ export interface RelationshipChange {
602
+ id: string;
603
+ relationshipId: string;
604
+ previousValue: number;
605
+ newValue: number;
606
+ reason: string | null;
607
+ timestamp: string;
608
+ }
609
+ export interface Faction {
610
+ id: string;
611
+ gameId: string;
612
+ name: string;
613
+ description: string;
614
+ leaderId: string | null;
615
+ headquartersId: string | null;
616
+ resources: Record<string, number>;
617
+ goals: string[];
618
+ traits: string[];
619
+ status: "active" | "disbanded" | "hidden";
620
+ createdAt: string;
621
+ }
622
+ export interface Ability {
623
+ id: string;
624
+ gameId: string;
625
+ ownerId: string | null;
626
+ ownerType: "template" | "character";
627
+ name: string;
628
+ description: string;
629
+ category: string | null;
630
+ cost: Record<string, number>;
631
+ cooldown: number | null;
632
+ currentCooldown: number;
633
+ effects: string[];
634
+ requirements: Record<string, number>;
635
+ tags: string[];
636
+ createdAt: string;
637
+ }
638
+ export interface StatusEffect {
639
+ id: string;
640
+ gameId: string;
641
+ targetId: string;
642
+ name: string;
643
+ description: string;
644
+ effectType: "buff" | "debuff" | "neutral" | null;
645
+ duration: number | null;
646
+ stacks: number;
647
+ maxStacks: number | null;
648
+ effects: Record<string, number>;
649
+ sourceId: string | null;
650
+ sourceType: string | null;
651
+ expiresAt: string | null;
652
+ createdAt: string;
653
+ }
654
+ export interface Tag {
655
+ id: string;
656
+ gameId: string;
657
+ entityId: string;
658
+ entityType: string;
659
+ tag: string;
660
+ color: string | null;
661
+ notes: string;
662
+ createdAt: string;
663
+ }
664
+ export interface Note {
665
+ id: string;
666
+ gameId: string;
667
+ title: string;
668
+ content: string;
669
+ category: string | null;
670
+ pinned: boolean;
671
+ relatedEntityId: string | null;
672
+ relatedEntityType: string | null;
673
+ tags: string[];
674
+ createdAt: string;
675
+ updatedAt: string;
676
+ }
677
+ export interface ExternalUpdate {
678
+ id: string;
679
+ gameId: string;
680
+ sourceAgent: string;
681
+ sourceDescription: string | null;
682
+ updateType: string;
683
+ category: string | null;
684
+ title: string;
685
+ content: string;
686
+ structuredData: Record<string, unknown> | null;
687
+ targetEntityId: string | null;
688
+ targetEntityType: string | null;
689
+ priority: "low" | "normal" | "high" | "urgent";
690
+ status: "pending" | "acknowledged" | "applied" | "rejected";
691
+ createdAt: string;
692
+ acknowledgedAt: string | null;
693
+ appliedAt: string | null;
694
+ dmNotes: string | null;
695
+ }
696
+ export interface PendingUpdatesResult {
697
+ gameId: string;
698
+ pendingCount: number;
699
+ urgentCount: number;
700
+ updates: ExternalUpdate[];
701
+ hasUrgent: boolean;
702
+ suggestion: string;
703
+ }
704
+ export interface PauseState {
705
+ id: string;
706
+ gameId: string;
707
+ currentScene: string;
708
+ sceneAtmosphere: string | null;
709
+ immediateSituation: string;
710
+ pendingPlayerAction: string | null;
711
+ awaitingResponseTo: string | null;
712
+ presentedChoices: string[] | null;
713
+ activeThreads: NarrativeThread[];
714
+ dmShortTermPlans: string | null;
715
+ dmLongTermPlans: string | null;
716
+ upcomingReveals: string[];
717
+ npcAttitudes: Record<string, string>;
718
+ activeConversations: ActiveConversation[];
719
+ recentTone: string | null;
720
+ playerApparentGoals: string | null;
721
+ unresolvedHooks: string[];
722
+ pauseReason: string | null;
723
+ createdAt: string;
724
+ modelUsed: string | null;
725
+ }
726
+ export interface NarrativeThread {
727
+ name: string;
728
+ description: string;
729
+ status: "active" | "background" | "climax" | "resolving";
730
+ urgency: "low" | "medium" | "high" | "critical";
731
+ involvedCharacterIds?: string[];
732
+ involvedLocationIds?: string[];
733
+ relatedQuestId?: string;
734
+ notes?: string;
735
+ }
736
+ export interface ActiveConversation {
737
+ npcId: string;
738
+ topic: string;
739
+ npcEmotionalState: string;
740
+ lastNpcStatement?: string;
741
+ playerIntent?: string;
742
+ }
743
+ export interface PauseChecklist {
744
+ gameId: string;
745
+ gameName: string;
746
+ currentState: {
747
+ playerLocation: string | null;
748
+ activeQuests: number;
749
+ activeCombat: boolean;
750
+ activeTimers: number;
751
+ pendingEvents: number;
752
+ recentEventCount: number;
753
+ };
754
+ gameStateAudit: GameStateAudit;
755
+ persistenceReminders: PersistenceReminder[];
756
+ checklist: PauseChecklistItem[];
757
+ existingPauseState: PauseState | null;
758
+ instructions: string;
759
+ }
760
+ export interface GameStateAudit {
761
+ characters: {
762
+ total: number;
763
+ players: number;
764
+ npcs: number;
765
+ withNotes: number;
766
+ withConditions: number;
767
+ };
768
+ locations: {
769
+ total: number;
770
+ connected: number;
771
+ };
772
+ quests: {
773
+ active: number;
774
+ completed: number;
775
+ failed: number;
776
+ };
777
+ items: {
778
+ total: number;
779
+ inInventories: number;
780
+ inLocations: number;
781
+ };
782
+ combat: {
783
+ active: boolean;
784
+ combatId: string | null;
785
+ round: number | null;
786
+ participantCount: number;
787
+ };
788
+ resources: {
789
+ gameLevel: number;
790
+ characterLevel: number;
791
+ };
792
+ timers: {
793
+ active: number;
794
+ triggered: number;
795
+ };
796
+ scheduledEvents: {
797
+ pending: number;
798
+ triggered: number;
799
+ };
800
+ relationships: {
801
+ total: number;
802
+ };
803
+ secrets: {
804
+ total: number;
805
+ revealed: number;
806
+ hidden: number;
807
+ };
808
+ factions: {
809
+ active: number;
810
+ disbanded: number;
811
+ };
812
+ abilities: {
813
+ templates: number;
814
+ characterOwned: number;
815
+ };
816
+ notes: {
817
+ total: number;
818
+ pinned: number;
819
+ };
820
+ statusEffects: {
821
+ activeCount: number;
822
+ affectedCharacters: number;
823
+ };
824
+ tags: {
825
+ uniqueTags: number;
826
+ };
827
+ randomTables: {
828
+ total: number;
829
+ };
830
+ narrativeEvents: {
831
+ total: number;
832
+ recentHour: number;
833
+ };
834
+ images: {
835
+ total: number;
836
+ };
837
+ time: {
838
+ hasCalendar: boolean;
839
+ currentTime: string | null;
840
+ };
841
+ }
842
+ export interface PersistenceReminder {
843
+ category: "critical" | "important" | "suggested";
844
+ entityType: string;
845
+ tool: string;
846
+ reminder: string;
847
+ reason: string;
848
+ entityIds?: string[];
849
+ entityNames?: string[];
850
+ }
851
+ export interface PauseChecklistItem {
852
+ category: string;
853
+ item: string;
854
+ description: string;
855
+ required: boolean;
856
+ example?: string;
857
+ }
858
+ export interface ResumeContext {
859
+ pauseState: PauseState;
860
+ gameState: {
861
+ game: Game;
862
+ playerCharacter: Character | null;
863
+ currentLocation: Location | null;
864
+ activeQuests: Quest[];
865
+ activeCombat: Combat | null;
866
+ recentEvents: NarrativeEvent[];
867
+ activeTimers: Timer[];
868
+ pendingScheduledEvents: ScheduledEvent[];
869
+ };
870
+ narrativeSummary: string;
871
+ resumePrompt: string;
872
+ warnings: string[];
873
+ }
874
+ export interface StoredImage {
875
+ id: string;
876
+ gameId: string;
877
+ entityId: string;
878
+ entityType: string;
879
+ entityName?: string;
880
+ filePath: string;
881
+ fileSize: number;
882
+ mimeType: string;
883
+ width: number | null;
884
+ height: number | null;
885
+ label: string | null;
886
+ description: string | null;
887
+ source: "generated" | "uploaded" | "url";
888
+ sourceUrl: string | null;
889
+ generationTool: string | null;
890
+ generationPrompt: string | null;
891
+ isPrimary: boolean;
892
+ createdAt: string;
893
+ }
894
+ export interface StoreImageParams {
895
+ gameId: string;
896
+ entityId: string;
897
+ entityType: string;
898
+ url: string;
899
+ label?: string;
900
+ description?: string;
901
+ mimeType?: string;
902
+ generationTool?: string;
903
+ generationPrompt?: string;
904
+ setAsPrimary?: boolean;
905
+ }
906
+ export interface ImageListResult {
907
+ entityId: string;
908
+ entityType: string;
909
+ images: StoredImage[];
910
+ primaryImage: StoredImage | null;
911
+ }
912
+ export interface StoredAudio {
913
+ id: string;
914
+ gameId: string;
915
+ entityId: string;
916
+ entityType: string;
917
+ entityName?: string;
918
+ filePath: string;
919
+ fileSize: number;
920
+ mimeType: string;
921
+ durationMs: number | null;
922
+ sampleRate: number | null;
923
+ label: string | null;
924
+ description: string | null;
925
+ source: "generated" | "uploaded" | "url";
926
+ sourceUrl: string | null;
927
+ ttsEngine: string | null;
928
+ ttsVoice: string | null;
929
+ ttsText: string | null;
930
+ ttsSettings: Record<string, unknown> | null;
931
+ isVoiceReference: boolean;
932
+ voiceName: string | null;
933
+ voiceDescription: string | null;
934
+ isPrimary: boolean;
935
+ createdAt: string;
936
+ }
937
+ export interface StoreAudioParams {
938
+ gameId: string;
939
+ entityId: string;
940
+ entityType: string;
941
+ url?: string;
942
+ filePath?: string;
943
+ label?: string;
944
+ description?: string;
945
+ mimeType?: string;
946
+ ttsEngine?: string;
947
+ ttsVoice?: string;
948
+ ttsText?: string;
949
+ ttsSettings?: Record<string, unknown>;
950
+ isVoiceReference?: boolean;
951
+ voiceName?: string;
952
+ voiceDescription?: string;
953
+ setAsPrimary?: boolean;
954
+ }
955
+ export interface AudioListResult {
956
+ entityId: string;
957
+ entityType: string;
958
+ audioFiles: StoredAudio[];
959
+ primaryAudio: StoredAudio | null;
960
+ }
961
+ export interface VoiceReferenceResult {
962
+ gameId: string;
963
+ characterId: string;
964
+ characterName: string;
965
+ voiceReferences: StoredAudio[];
966
+ /** Full file paths ready to pass to TTS voice cloning tools */
967
+ filePaths: string[];
968
+ totalCount: number;
969
+ }