@sudobility/music_types 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.
@@ -0,0 +1,1597 @@
1
+ /**
2
+ * @sudobility/music_types — types and Zod schemas for the ScoreSmith music family.
3
+ *
4
+ * Single sectioned entry point (sudojo_types convention):
5
+ * 1. Score model types (spec §4 of the ScoreSmith spec)
6
+ * 2. Type guards
7
+ * 3. Selection / fragment types
8
+ * 4. Zod schemas for the score tree
9
+ * 5. AI generation contracts (requests, results, provider interface)
10
+ * 6. Zod schemas for the generation contracts
11
+ * 7. Project API types (music_api payloads)
12
+ * 8. Zod schemas for the project API
13
+ * 9. Response envelope + error codes
14
+ *
15
+ * This package contains types, schemas, and pure helpers only — no domain
16
+ * logic (tick math, factories, commands live in @sudobility/music_lib).
17
+ */
18
+ import { z } from 'zod';
19
+ export type UUID = string;
20
+ export type Fraction = {
21
+ numerator: number;
22
+ denominator: number;
23
+ };
24
+ export type PitchStep = 'C' | 'D' | 'E' | 'F' | 'G' | 'A' | 'B';
25
+ /** -2 = double flat, -1 = flat, 0 = natural, 1 = sharp, 2 = double sharp. */
26
+ export type Accidental = -2 | -1 | 0 | 1 | 2;
27
+ export type Pitch = {
28
+ step: PitchStep;
29
+ accidental: Accidental;
30
+ octave: number;
31
+ };
32
+ export type TimeSignature = {
33
+ numerator: number;
34
+ denominator: number;
35
+ };
36
+ export type KeySignature = {
37
+ fifths: number;
38
+ mode: 'major' | 'minor';
39
+ };
40
+ export type TempoEvent = {
41
+ id: UUID;
42
+ tick: number;
43
+ bpm: number;
44
+ };
45
+ /**
46
+ * Renderable note-duration names: base values (whole down to thirty-second),
47
+ * their dotted (1.5x) variants, and their triplet (2/3x) variants.
48
+ */
49
+ export type DurationName = 'whole' | 'half' | 'quarter' | 'eighth' | 'sixteenth' | 'thirtysecond' | 'dotted-whole' | 'dotted-half' | 'dotted-quarter' | 'dotted-eighth' | 'dotted-sixteenth' | 'dotted-thirtysecond' | 'triplet-whole' | 'triplet-half' | 'triplet-quarter' | 'triplet-eighth' | 'triplet-sixteenth' | 'triplet-thirtysecond';
50
+ export type Articulation = 'staccato' | 'accent' | 'tenuto' | 'marcato';
51
+ export type Clef = 'treble' | 'bass' | 'alto' | 'tenor' | 'percussion';
52
+ export type NoteEvent = {
53
+ id: UUID;
54
+ pitch: Pitch;
55
+ startTick: number;
56
+ durationTicks: number;
57
+ velocity: number;
58
+ voiceId: UUID;
59
+ trackId: UUID;
60
+ tieStart?: boolean;
61
+ tieStop?: boolean;
62
+ articulation?: Articulation;
63
+ };
64
+ export type RestEvent = {
65
+ id: UUID;
66
+ startTick: number;
67
+ durationTicks: number;
68
+ voiceId: UUID;
69
+ trackId: UUID;
70
+ };
71
+ export type MusicalEvent = NoteEvent | RestEvent;
72
+ export type Voice = {
73
+ id: UUID;
74
+ name: string;
75
+ events: MusicalEvent[];
76
+ };
77
+ export type Measure = {
78
+ id: UUID;
79
+ index: number;
80
+ startTick: number;
81
+ durationTicks: number;
82
+ timeSignature: TimeSignature;
83
+ keySignature: KeySignature;
84
+ voices: Voice[];
85
+ };
86
+ export type Track = {
87
+ id: UUID;
88
+ name: string;
89
+ instrumentName: string;
90
+ midiProgram: number;
91
+ midiChannel: number;
92
+ clef: Clef;
93
+ volume: number;
94
+ pan: number;
95
+ muted: boolean;
96
+ solo: boolean;
97
+ measures: Measure[];
98
+ };
99
+ export type ScoreMetadata = {
100
+ title: string;
101
+ composer?: string;
102
+ description?: string;
103
+ createdAt: string;
104
+ updatedAt: string;
105
+ };
106
+ export type Score = {
107
+ id: UUID;
108
+ version: number;
109
+ ppq: number;
110
+ metadata: ScoreMetadata;
111
+ tempoMap: TempoEvent[];
112
+ tracks: Track[];
113
+ };
114
+ /** True for `NoteEvent`s (distinguished from `RestEvent` by the `pitch` property). */
115
+ export declare function isNoteEvent(event: MusicalEvent): event is NoteEvent;
116
+ /** True for `RestEvent`s (distinguished from `NoteEvent` by lacking a `pitch` property). */
117
+ export declare function isRestEvent(event: MusicalEvent): event is RestEvent;
118
+ /** A tick range scoped to a set of tracks (e.g. a loop region or regeneration target). */
119
+ export type ScoreRange = {
120
+ startTick: number;
121
+ endTick: number;
122
+ trackIds: string[];
123
+ };
124
+ export type ScoreSelection = {
125
+ eventIds: string[];
126
+ measureIds: string[];
127
+ trackIds: string[];
128
+ range?: ScoreRange;
129
+ };
130
+ /** A region of a score extracted for regeneration/preview: measures per track over a range. */
131
+ export type ScoreFragment = {
132
+ range: ScoreRange;
133
+ ppq: number;
134
+ tracks: Array<{
135
+ trackId: UUID;
136
+ measures: Measure[];
137
+ }>;
138
+ };
139
+ export declare const uuidSchema: z.ZodString;
140
+ export declare const pitchStepSchema: z.ZodEnum<{
141
+ C: "C";
142
+ D: "D";
143
+ E: "E";
144
+ F: "F";
145
+ G: "G";
146
+ A: "A";
147
+ B: "B";
148
+ }>;
149
+ export declare const accidentalSchema: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
150
+ export declare const pitchSchema: z.ZodObject<{
151
+ step: z.ZodEnum<{
152
+ C: "C";
153
+ D: "D";
154
+ E: "E";
155
+ F: "F";
156
+ G: "G";
157
+ A: "A";
158
+ B: "B";
159
+ }>;
160
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
161
+ octave: z.ZodNumber;
162
+ }, z.core.$strip>;
163
+ export declare const timeSignatureSchema: z.ZodObject<{
164
+ numerator: z.ZodNumber;
165
+ denominator: z.ZodNumber;
166
+ }, z.core.$strip>;
167
+ export declare const keySignatureSchema: z.ZodObject<{
168
+ fifths: z.ZodNumber;
169
+ mode: z.ZodEnum<{
170
+ major: "major";
171
+ minor: "minor";
172
+ }>;
173
+ }, z.core.$strip>;
174
+ export declare const tempoEventSchema: z.ZodObject<{
175
+ id: z.ZodString;
176
+ tick: z.ZodNumber;
177
+ bpm: z.ZodNumber;
178
+ }, z.core.$strip>;
179
+ export declare const articulationSchema: z.ZodEnum<{
180
+ staccato: "staccato";
181
+ accent: "accent";
182
+ tenuto: "tenuto";
183
+ marcato: "marcato";
184
+ }>;
185
+ export declare const clefSchema: z.ZodEnum<{
186
+ treble: "treble";
187
+ bass: "bass";
188
+ alto: "alto";
189
+ tenor: "tenor";
190
+ percussion: "percussion";
191
+ }>;
192
+ export declare const noteEventSchema: z.ZodObject<{
193
+ id: z.ZodString;
194
+ pitch: z.ZodObject<{
195
+ step: z.ZodEnum<{
196
+ C: "C";
197
+ D: "D";
198
+ E: "E";
199
+ F: "F";
200
+ G: "G";
201
+ A: "A";
202
+ B: "B";
203
+ }>;
204
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
205
+ octave: z.ZodNumber;
206
+ }, z.core.$strip>;
207
+ startTick: z.ZodNumber;
208
+ durationTicks: z.ZodNumber;
209
+ velocity: z.ZodNumber;
210
+ voiceId: z.ZodString;
211
+ trackId: z.ZodString;
212
+ tieStart: z.ZodOptional<z.ZodBoolean>;
213
+ tieStop: z.ZodOptional<z.ZodBoolean>;
214
+ articulation: z.ZodOptional<z.ZodEnum<{
215
+ staccato: "staccato";
216
+ accent: "accent";
217
+ tenuto: "tenuto";
218
+ marcato: "marcato";
219
+ }>>;
220
+ }, z.core.$strict>;
221
+ export declare const restEventSchema: z.ZodObject<{
222
+ id: z.ZodString;
223
+ startTick: z.ZodNumber;
224
+ durationTicks: z.ZodNumber;
225
+ voiceId: z.ZodString;
226
+ trackId: z.ZodString;
227
+ }, z.core.$strict>;
228
+ export declare const musicalEventSchema: z.ZodUnion<readonly [z.ZodObject<{
229
+ id: z.ZodString;
230
+ pitch: z.ZodObject<{
231
+ step: z.ZodEnum<{
232
+ C: "C";
233
+ D: "D";
234
+ E: "E";
235
+ F: "F";
236
+ G: "G";
237
+ A: "A";
238
+ B: "B";
239
+ }>;
240
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
241
+ octave: z.ZodNumber;
242
+ }, z.core.$strip>;
243
+ startTick: z.ZodNumber;
244
+ durationTicks: z.ZodNumber;
245
+ velocity: z.ZodNumber;
246
+ voiceId: z.ZodString;
247
+ trackId: z.ZodString;
248
+ tieStart: z.ZodOptional<z.ZodBoolean>;
249
+ tieStop: z.ZodOptional<z.ZodBoolean>;
250
+ articulation: z.ZodOptional<z.ZodEnum<{
251
+ staccato: "staccato";
252
+ accent: "accent";
253
+ tenuto: "tenuto";
254
+ marcato: "marcato";
255
+ }>>;
256
+ }, z.core.$strict>, z.ZodObject<{
257
+ id: z.ZodString;
258
+ startTick: z.ZodNumber;
259
+ durationTicks: z.ZodNumber;
260
+ voiceId: z.ZodString;
261
+ trackId: z.ZodString;
262
+ }, z.core.$strict>]>;
263
+ export declare const voiceSchema: z.ZodObject<{
264
+ id: z.ZodString;
265
+ name: z.ZodString;
266
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
267
+ id: z.ZodString;
268
+ pitch: z.ZodObject<{
269
+ step: z.ZodEnum<{
270
+ C: "C";
271
+ D: "D";
272
+ E: "E";
273
+ F: "F";
274
+ G: "G";
275
+ A: "A";
276
+ B: "B";
277
+ }>;
278
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
279
+ octave: z.ZodNumber;
280
+ }, z.core.$strip>;
281
+ startTick: z.ZodNumber;
282
+ durationTicks: z.ZodNumber;
283
+ velocity: z.ZodNumber;
284
+ voiceId: z.ZodString;
285
+ trackId: z.ZodString;
286
+ tieStart: z.ZodOptional<z.ZodBoolean>;
287
+ tieStop: z.ZodOptional<z.ZodBoolean>;
288
+ articulation: z.ZodOptional<z.ZodEnum<{
289
+ staccato: "staccato";
290
+ accent: "accent";
291
+ tenuto: "tenuto";
292
+ marcato: "marcato";
293
+ }>>;
294
+ }, z.core.$strict>, z.ZodObject<{
295
+ id: z.ZodString;
296
+ startTick: z.ZodNumber;
297
+ durationTicks: z.ZodNumber;
298
+ voiceId: z.ZodString;
299
+ trackId: z.ZodString;
300
+ }, z.core.$strict>]>>;
301
+ }, z.core.$strip>;
302
+ export declare const measureSchema: z.ZodObject<{
303
+ id: z.ZodString;
304
+ index: z.ZodNumber;
305
+ startTick: z.ZodNumber;
306
+ durationTicks: z.ZodNumber;
307
+ timeSignature: z.ZodObject<{
308
+ numerator: z.ZodNumber;
309
+ denominator: z.ZodNumber;
310
+ }, z.core.$strip>;
311
+ keySignature: z.ZodObject<{
312
+ fifths: z.ZodNumber;
313
+ mode: z.ZodEnum<{
314
+ major: "major";
315
+ minor: "minor";
316
+ }>;
317
+ }, z.core.$strip>;
318
+ voices: z.ZodArray<z.ZodObject<{
319
+ id: z.ZodString;
320
+ name: z.ZodString;
321
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
322
+ id: z.ZodString;
323
+ pitch: z.ZodObject<{
324
+ step: z.ZodEnum<{
325
+ C: "C";
326
+ D: "D";
327
+ E: "E";
328
+ F: "F";
329
+ G: "G";
330
+ A: "A";
331
+ B: "B";
332
+ }>;
333
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
334
+ octave: z.ZodNumber;
335
+ }, z.core.$strip>;
336
+ startTick: z.ZodNumber;
337
+ durationTicks: z.ZodNumber;
338
+ velocity: z.ZodNumber;
339
+ voiceId: z.ZodString;
340
+ trackId: z.ZodString;
341
+ tieStart: z.ZodOptional<z.ZodBoolean>;
342
+ tieStop: z.ZodOptional<z.ZodBoolean>;
343
+ articulation: z.ZodOptional<z.ZodEnum<{
344
+ staccato: "staccato";
345
+ accent: "accent";
346
+ tenuto: "tenuto";
347
+ marcato: "marcato";
348
+ }>>;
349
+ }, z.core.$strict>, z.ZodObject<{
350
+ id: z.ZodString;
351
+ startTick: z.ZodNumber;
352
+ durationTicks: z.ZodNumber;
353
+ voiceId: z.ZodString;
354
+ trackId: z.ZodString;
355
+ }, z.core.$strict>]>>;
356
+ }, z.core.$strip>>;
357
+ }, z.core.$strip>;
358
+ export declare const trackSchema: z.ZodObject<{
359
+ id: z.ZodString;
360
+ name: z.ZodString;
361
+ instrumentName: z.ZodString;
362
+ midiProgram: z.ZodNumber;
363
+ midiChannel: z.ZodNumber;
364
+ clef: z.ZodEnum<{
365
+ treble: "treble";
366
+ bass: "bass";
367
+ alto: "alto";
368
+ tenor: "tenor";
369
+ percussion: "percussion";
370
+ }>;
371
+ volume: z.ZodNumber;
372
+ pan: z.ZodNumber;
373
+ muted: z.ZodBoolean;
374
+ solo: z.ZodBoolean;
375
+ measures: z.ZodArray<z.ZodObject<{
376
+ id: z.ZodString;
377
+ index: z.ZodNumber;
378
+ startTick: z.ZodNumber;
379
+ durationTicks: z.ZodNumber;
380
+ timeSignature: z.ZodObject<{
381
+ numerator: z.ZodNumber;
382
+ denominator: z.ZodNumber;
383
+ }, z.core.$strip>;
384
+ keySignature: z.ZodObject<{
385
+ fifths: z.ZodNumber;
386
+ mode: z.ZodEnum<{
387
+ major: "major";
388
+ minor: "minor";
389
+ }>;
390
+ }, z.core.$strip>;
391
+ voices: z.ZodArray<z.ZodObject<{
392
+ id: z.ZodString;
393
+ name: z.ZodString;
394
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
395
+ id: z.ZodString;
396
+ pitch: z.ZodObject<{
397
+ step: z.ZodEnum<{
398
+ C: "C";
399
+ D: "D";
400
+ E: "E";
401
+ F: "F";
402
+ G: "G";
403
+ A: "A";
404
+ B: "B";
405
+ }>;
406
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
407
+ octave: z.ZodNumber;
408
+ }, z.core.$strip>;
409
+ startTick: z.ZodNumber;
410
+ durationTicks: z.ZodNumber;
411
+ velocity: z.ZodNumber;
412
+ voiceId: z.ZodString;
413
+ trackId: z.ZodString;
414
+ tieStart: z.ZodOptional<z.ZodBoolean>;
415
+ tieStop: z.ZodOptional<z.ZodBoolean>;
416
+ articulation: z.ZodOptional<z.ZodEnum<{
417
+ staccato: "staccato";
418
+ accent: "accent";
419
+ tenuto: "tenuto";
420
+ marcato: "marcato";
421
+ }>>;
422
+ }, z.core.$strict>, z.ZodObject<{
423
+ id: z.ZodString;
424
+ startTick: z.ZodNumber;
425
+ durationTicks: z.ZodNumber;
426
+ voiceId: z.ZodString;
427
+ trackId: z.ZodString;
428
+ }, z.core.$strict>]>>;
429
+ }, z.core.$strip>>;
430
+ }, z.core.$strip>>;
431
+ }, z.core.$strip>;
432
+ export declare const scoreMetadataSchema: z.ZodObject<{
433
+ title: z.ZodString;
434
+ composer: z.ZodOptional<z.ZodString>;
435
+ description: z.ZodOptional<z.ZodString>;
436
+ createdAt: z.ZodString;
437
+ updatedAt: z.ZodString;
438
+ }, z.core.$strip>;
439
+ export declare const scoreSchema: z.ZodObject<{
440
+ id: z.ZodString;
441
+ version: z.ZodNumber;
442
+ ppq: z.ZodNumber;
443
+ metadata: z.ZodObject<{
444
+ title: z.ZodString;
445
+ composer: z.ZodOptional<z.ZodString>;
446
+ description: z.ZodOptional<z.ZodString>;
447
+ createdAt: z.ZodString;
448
+ updatedAt: z.ZodString;
449
+ }, z.core.$strip>;
450
+ tempoMap: z.ZodArray<z.ZodObject<{
451
+ id: z.ZodString;
452
+ tick: z.ZodNumber;
453
+ bpm: z.ZodNumber;
454
+ }, z.core.$strip>>;
455
+ tracks: z.ZodArray<z.ZodObject<{
456
+ id: z.ZodString;
457
+ name: z.ZodString;
458
+ instrumentName: z.ZodString;
459
+ midiProgram: z.ZodNumber;
460
+ midiChannel: z.ZodNumber;
461
+ clef: z.ZodEnum<{
462
+ treble: "treble";
463
+ bass: "bass";
464
+ alto: "alto";
465
+ tenor: "tenor";
466
+ percussion: "percussion";
467
+ }>;
468
+ volume: z.ZodNumber;
469
+ pan: z.ZodNumber;
470
+ muted: z.ZodBoolean;
471
+ solo: z.ZodBoolean;
472
+ measures: z.ZodArray<z.ZodObject<{
473
+ id: z.ZodString;
474
+ index: z.ZodNumber;
475
+ startTick: z.ZodNumber;
476
+ durationTicks: z.ZodNumber;
477
+ timeSignature: z.ZodObject<{
478
+ numerator: z.ZodNumber;
479
+ denominator: z.ZodNumber;
480
+ }, z.core.$strip>;
481
+ keySignature: z.ZodObject<{
482
+ fifths: z.ZodNumber;
483
+ mode: z.ZodEnum<{
484
+ major: "major";
485
+ minor: "minor";
486
+ }>;
487
+ }, z.core.$strip>;
488
+ voices: z.ZodArray<z.ZodObject<{
489
+ id: z.ZodString;
490
+ name: z.ZodString;
491
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
492
+ id: z.ZodString;
493
+ pitch: z.ZodObject<{
494
+ step: z.ZodEnum<{
495
+ C: "C";
496
+ D: "D";
497
+ E: "E";
498
+ F: "F";
499
+ G: "G";
500
+ A: "A";
501
+ B: "B";
502
+ }>;
503
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
504
+ octave: z.ZodNumber;
505
+ }, z.core.$strip>;
506
+ startTick: z.ZodNumber;
507
+ durationTicks: z.ZodNumber;
508
+ velocity: z.ZodNumber;
509
+ voiceId: z.ZodString;
510
+ trackId: z.ZodString;
511
+ tieStart: z.ZodOptional<z.ZodBoolean>;
512
+ tieStop: z.ZodOptional<z.ZodBoolean>;
513
+ articulation: z.ZodOptional<z.ZodEnum<{
514
+ staccato: "staccato";
515
+ accent: "accent";
516
+ tenuto: "tenuto";
517
+ marcato: "marcato";
518
+ }>>;
519
+ }, z.core.$strict>, z.ZodObject<{
520
+ id: z.ZodString;
521
+ startTick: z.ZodNumber;
522
+ durationTicks: z.ZodNumber;
523
+ voiceId: z.ZodString;
524
+ trackId: z.ZodString;
525
+ }, z.core.$strict>]>>;
526
+ }, z.core.$strip>>;
527
+ }, z.core.$strip>>;
528
+ }, z.core.$strip>>;
529
+ }, z.core.$strip>;
530
+ /** Parses and validates untrusted JSON as a `Score`. Throws `ZodError` on invalid input. */
531
+ export declare function parseScore(json: unknown): Score;
532
+ export type GenerateScoreRequestTrack = {
533
+ name: string;
534
+ instrumentName: string;
535
+ midiProgram: number;
536
+ clef: Track['clef'];
537
+ range?: {
538
+ lowestMidi: number;
539
+ highestMidi: number;
540
+ };
541
+ maximumPolyphony?: number;
542
+ };
543
+ export type GenerateScoreRequest = {
544
+ prompt: string;
545
+ title?: string;
546
+ style?: string;
547
+ mood?: string;
548
+ durationMeasures: number;
549
+ tempo?: number;
550
+ timeSignature?: TimeSignature;
551
+ keySignature?: KeySignature;
552
+ tracks: GenerateScoreRequestTrack[];
553
+ complexity?: 'simple' | 'moderate' | 'complex';
554
+ };
555
+ /** Never a rendered/notation payload and never raw MIDI: always a structured `Score`. */
556
+ export type GenerateScoreResult = {
557
+ score: Score;
558
+ warnings: string[];
559
+ };
560
+ export type RegenerationConstraints = {
561
+ preserveMeasureCount: true;
562
+ preserveTimeSignatures: true;
563
+ preserveTempoEvents: true;
564
+ preserveBoundaryNotes?: boolean;
565
+ preserveHarmony?: boolean;
566
+ preserveRhythm?: boolean;
567
+ preserveMelody?: boolean;
568
+ maximumPolyphony?: number;
569
+ allowedPitchRangeByTrack?: Record<string, {
570
+ lowestMidi: number;
571
+ highestMidi: number;
572
+ }>;
573
+ };
574
+ export type RegenerateRegionRequest = {
575
+ scoreId: string;
576
+ instruction: string;
577
+ range: ScoreRange;
578
+ precedingContext: ScoreFragment;
579
+ selectedFragment: ScoreFragment;
580
+ followingContext: ScoreFragment;
581
+ constraints: RegenerationConstraints;
582
+ candidateCount: number;
583
+ };
584
+ export type RegenerationCandidate = {
585
+ id: string;
586
+ label: string;
587
+ fragment: ScoreFragment;
588
+ };
589
+ export type RegenerateRegionResult = {
590
+ candidates: RegenerationCandidate[];
591
+ warnings: string[];
592
+ };
593
+ export interface MusicGenerationProvider {
594
+ id: string;
595
+ name: string;
596
+ generateScore(request: GenerateScoreRequest, signal?: AbortSignal): Promise<GenerateScoreResult>;
597
+ regenerateRegion(request: RegenerateRegionRequest, signal?: AbortSignal): Promise<RegenerateRegionResult>;
598
+ }
599
+ export declare const midiRangeSchema: z.ZodObject<{
600
+ lowestMidi: z.ZodNumber;
601
+ highestMidi: z.ZodNumber;
602
+ }, z.core.$strip>;
603
+ export declare const scoreRangeSchema: z.ZodObject<{
604
+ startTick: z.ZodNumber;
605
+ endTick: z.ZodNumber;
606
+ trackIds: z.ZodArray<z.ZodString>;
607
+ }, z.core.$strip>;
608
+ export declare const scoreFragmentSchema: z.ZodObject<{
609
+ range: z.ZodObject<{
610
+ startTick: z.ZodNumber;
611
+ endTick: z.ZodNumber;
612
+ trackIds: z.ZodArray<z.ZodString>;
613
+ }, z.core.$strip>;
614
+ ppq: z.ZodNumber;
615
+ tracks: z.ZodArray<z.ZodObject<{
616
+ trackId: z.ZodString;
617
+ measures: z.ZodArray<z.ZodObject<{
618
+ id: z.ZodString;
619
+ index: z.ZodNumber;
620
+ startTick: z.ZodNumber;
621
+ durationTicks: z.ZodNumber;
622
+ timeSignature: z.ZodObject<{
623
+ numerator: z.ZodNumber;
624
+ denominator: z.ZodNumber;
625
+ }, z.core.$strip>;
626
+ keySignature: z.ZodObject<{
627
+ fifths: z.ZodNumber;
628
+ mode: z.ZodEnum<{
629
+ major: "major";
630
+ minor: "minor";
631
+ }>;
632
+ }, z.core.$strip>;
633
+ voices: z.ZodArray<z.ZodObject<{
634
+ id: z.ZodString;
635
+ name: z.ZodString;
636
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
637
+ id: z.ZodString;
638
+ pitch: z.ZodObject<{
639
+ step: z.ZodEnum<{
640
+ C: "C";
641
+ D: "D";
642
+ E: "E";
643
+ F: "F";
644
+ G: "G";
645
+ A: "A";
646
+ B: "B";
647
+ }>;
648
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
649
+ octave: z.ZodNumber;
650
+ }, z.core.$strip>;
651
+ startTick: z.ZodNumber;
652
+ durationTicks: z.ZodNumber;
653
+ velocity: z.ZodNumber;
654
+ voiceId: z.ZodString;
655
+ trackId: z.ZodString;
656
+ tieStart: z.ZodOptional<z.ZodBoolean>;
657
+ tieStop: z.ZodOptional<z.ZodBoolean>;
658
+ articulation: z.ZodOptional<z.ZodEnum<{
659
+ staccato: "staccato";
660
+ accent: "accent";
661
+ tenuto: "tenuto";
662
+ marcato: "marcato";
663
+ }>>;
664
+ }, z.core.$strict>, z.ZodObject<{
665
+ id: z.ZodString;
666
+ startTick: z.ZodNumber;
667
+ durationTicks: z.ZodNumber;
668
+ voiceId: z.ZodString;
669
+ trackId: z.ZodString;
670
+ }, z.core.$strict>]>>;
671
+ }, z.core.$strip>>;
672
+ }, z.core.$strip>>;
673
+ }, z.core.$strip>>;
674
+ }, z.core.$strip>;
675
+ export declare const generateScoreRequestTrackSchema: z.ZodObject<{
676
+ name: z.ZodString;
677
+ instrumentName: z.ZodString;
678
+ midiProgram: z.ZodNumber;
679
+ clef: z.ZodEnum<{
680
+ treble: "treble";
681
+ bass: "bass";
682
+ alto: "alto";
683
+ tenor: "tenor";
684
+ percussion: "percussion";
685
+ }>;
686
+ range: z.ZodOptional<z.ZodObject<{
687
+ lowestMidi: z.ZodNumber;
688
+ highestMidi: z.ZodNumber;
689
+ }, z.core.$strip>>;
690
+ maximumPolyphony: z.ZodOptional<z.ZodNumber>;
691
+ }, z.core.$strip>;
692
+ export declare const generateScoreRequestSchema: z.ZodObject<{
693
+ prompt: z.ZodString;
694
+ title: z.ZodOptional<z.ZodString>;
695
+ style: z.ZodOptional<z.ZodString>;
696
+ mood: z.ZodOptional<z.ZodString>;
697
+ durationMeasures: z.ZodNumber;
698
+ tempo: z.ZodOptional<z.ZodNumber>;
699
+ timeSignature: z.ZodOptional<z.ZodObject<{
700
+ numerator: z.ZodNumber;
701
+ denominator: z.ZodNumber;
702
+ }, z.core.$strip>>;
703
+ keySignature: z.ZodOptional<z.ZodObject<{
704
+ fifths: z.ZodNumber;
705
+ mode: z.ZodEnum<{
706
+ major: "major";
707
+ minor: "minor";
708
+ }>;
709
+ }, z.core.$strip>>;
710
+ tracks: z.ZodArray<z.ZodObject<{
711
+ name: z.ZodString;
712
+ instrumentName: z.ZodString;
713
+ midiProgram: z.ZodNumber;
714
+ clef: z.ZodEnum<{
715
+ treble: "treble";
716
+ bass: "bass";
717
+ alto: "alto";
718
+ tenor: "tenor";
719
+ percussion: "percussion";
720
+ }>;
721
+ range: z.ZodOptional<z.ZodObject<{
722
+ lowestMidi: z.ZodNumber;
723
+ highestMidi: z.ZodNumber;
724
+ }, z.core.$strip>>;
725
+ maximumPolyphony: z.ZodOptional<z.ZodNumber>;
726
+ }, z.core.$strip>>;
727
+ complexity: z.ZodOptional<z.ZodEnum<{
728
+ simple: "simple";
729
+ moderate: "moderate";
730
+ complex: "complex";
731
+ }>>;
732
+ }, z.core.$strip>;
733
+ export declare const generateScoreResultSchema: z.ZodObject<{
734
+ score: z.ZodObject<{
735
+ id: z.ZodString;
736
+ version: z.ZodNumber;
737
+ ppq: z.ZodNumber;
738
+ metadata: z.ZodObject<{
739
+ title: z.ZodString;
740
+ composer: z.ZodOptional<z.ZodString>;
741
+ description: z.ZodOptional<z.ZodString>;
742
+ createdAt: z.ZodString;
743
+ updatedAt: z.ZodString;
744
+ }, z.core.$strip>;
745
+ tempoMap: z.ZodArray<z.ZodObject<{
746
+ id: z.ZodString;
747
+ tick: z.ZodNumber;
748
+ bpm: z.ZodNumber;
749
+ }, z.core.$strip>>;
750
+ tracks: z.ZodArray<z.ZodObject<{
751
+ id: z.ZodString;
752
+ name: z.ZodString;
753
+ instrumentName: z.ZodString;
754
+ midiProgram: z.ZodNumber;
755
+ midiChannel: z.ZodNumber;
756
+ clef: z.ZodEnum<{
757
+ treble: "treble";
758
+ bass: "bass";
759
+ alto: "alto";
760
+ tenor: "tenor";
761
+ percussion: "percussion";
762
+ }>;
763
+ volume: z.ZodNumber;
764
+ pan: z.ZodNumber;
765
+ muted: z.ZodBoolean;
766
+ solo: z.ZodBoolean;
767
+ measures: z.ZodArray<z.ZodObject<{
768
+ id: z.ZodString;
769
+ index: z.ZodNumber;
770
+ startTick: z.ZodNumber;
771
+ durationTicks: z.ZodNumber;
772
+ timeSignature: z.ZodObject<{
773
+ numerator: z.ZodNumber;
774
+ denominator: z.ZodNumber;
775
+ }, z.core.$strip>;
776
+ keySignature: z.ZodObject<{
777
+ fifths: z.ZodNumber;
778
+ mode: z.ZodEnum<{
779
+ major: "major";
780
+ minor: "minor";
781
+ }>;
782
+ }, z.core.$strip>;
783
+ voices: z.ZodArray<z.ZodObject<{
784
+ id: z.ZodString;
785
+ name: z.ZodString;
786
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
787
+ id: z.ZodString;
788
+ pitch: z.ZodObject<{
789
+ step: z.ZodEnum<{
790
+ C: "C";
791
+ D: "D";
792
+ E: "E";
793
+ F: "F";
794
+ G: "G";
795
+ A: "A";
796
+ B: "B";
797
+ }>;
798
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
799
+ octave: z.ZodNumber;
800
+ }, z.core.$strip>;
801
+ startTick: z.ZodNumber;
802
+ durationTicks: z.ZodNumber;
803
+ velocity: z.ZodNumber;
804
+ voiceId: z.ZodString;
805
+ trackId: z.ZodString;
806
+ tieStart: z.ZodOptional<z.ZodBoolean>;
807
+ tieStop: z.ZodOptional<z.ZodBoolean>;
808
+ articulation: z.ZodOptional<z.ZodEnum<{
809
+ staccato: "staccato";
810
+ accent: "accent";
811
+ tenuto: "tenuto";
812
+ marcato: "marcato";
813
+ }>>;
814
+ }, z.core.$strict>, z.ZodObject<{
815
+ id: z.ZodString;
816
+ startTick: z.ZodNumber;
817
+ durationTicks: z.ZodNumber;
818
+ voiceId: z.ZodString;
819
+ trackId: z.ZodString;
820
+ }, z.core.$strict>]>>;
821
+ }, z.core.$strip>>;
822
+ }, z.core.$strip>>;
823
+ }, z.core.$strip>>;
824
+ }, z.core.$strip>;
825
+ warnings: z.ZodArray<z.ZodString>;
826
+ }, z.core.$strip>;
827
+ export declare const regenerationConstraintsSchema: z.ZodObject<{
828
+ preserveMeasureCount: z.ZodLiteral<true>;
829
+ preserveTimeSignatures: z.ZodLiteral<true>;
830
+ preserveTempoEvents: z.ZodLiteral<true>;
831
+ preserveBoundaryNotes: z.ZodOptional<z.ZodBoolean>;
832
+ preserveHarmony: z.ZodOptional<z.ZodBoolean>;
833
+ preserveRhythm: z.ZodOptional<z.ZodBoolean>;
834
+ preserveMelody: z.ZodOptional<z.ZodBoolean>;
835
+ maximumPolyphony: z.ZodOptional<z.ZodNumber>;
836
+ allowedPitchRangeByTrack: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
837
+ lowestMidi: z.ZodNumber;
838
+ highestMidi: z.ZodNumber;
839
+ }, z.core.$strip>>>;
840
+ }, z.core.$strip>;
841
+ export declare const regenerateRegionRequestSchema: z.ZodObject<{
842
+ scoreId: z.ZodString;
843
+ instruction: z.ZodString;
844
+ range: z.ZodObject<{
845
+ startTick: z.ZodNumber;
846
+ endTick: z.ZodNumber;
847
+ trackIds: z.ZodArray<z.ZodString>;
848
+ }, z.core.$strip>;
849
+ precedingContext: z.ZodObject<{
850
+ range: z.ZodObject<{
851
+ startTick: z.ZodNumber;
852
+ endTick: z.ZodNumber;
853
+ trackIds: z.ZodArray<z.ZodString>;
854
+ }, z.core.$strip>;
855
+ ppq: z.ZodNumber;
856
+ tracks: z.ZodArray<z.ZodObject<{
857
+ trackId: z.ZodString;
858
+ measures: z.ZodArray<z.ZodObject<{
859
+ id: z.ZodString;
860
+ index: z.ZodNumber;
861
+ startTick: z.ZodNumber;
862
+ durationTicks: z.ZodNumber;
863
+ timeSignature: z.ZodObject<{
864
+ numerator: z.ZodNumber;
865
+ denominator: z.ZodNumber;
866
+ }, z.core.$strip>;
867
+ keySignature: z.ZodObject<{
868
+ fifths: z.ZodNumber;
869
+ mode: z.ZodEnum<{
870
+ major: "major";
871
+ minor: "minor";
872
+ }>;
873
+ }, z.core.$strip>;
874
+ voices: z.ZodArray<z.ZodObject<{
875
+ id: z.ZodString;
876
+ name: z.ZodString;
877
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
878
+ id: z.ZodString;
879
+ pitch: z.ZodObject<{
880
+ step: z.ZodEnum<{
881
+ C: "C";
882
+ D: "D";
883
+ E: "E";
884
+ F: "F";
885
+ G: "G";
886
+ A: "A";
887
+ B: "B";
888
+ }>;
889
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
890
+ octave: z.ZodNumber;
891
+ }, z.core.$strip>;
892
+ startTick: z.ZodNumber;
893
+ durationTicks: z.ZodNumber;
894
+ velocity: z.ZodNumber;
895
+ voiceId: z.ZodString;
896
+ trackId: z.ZodString;
897
+ tieStart: z.ZodOptional<z.ZodBoolean>;
898
+ tieStop: z.ZodOptional<z.ZodBoolean>;
899
+ articulation: z.ZodOptional<z.ZodEnum<{
900
+ staccato: "staccato";
901
+ accent: "accent";
902
+ tenuto: "tenuto";
903
+ marcato: "marcato";
904
+ }>>;
905
+ }, z.core.$strict>, z.ZodObject<{
906
+ id: z.ZodString;
907
+ startTick: z.ZodNumber;
908
+ durationTicks: z.ZodNumber;
909
+ voiceId: z.ZodString;
910
+ trackId: z.ZodString;
911
+ }, z.core.$strict>]>>;
912
+ }, z.core.$strip>>;
913
+ }, z.core.$strip>>;
914
+ }, z.core.$strip>>;
915
+ }, z.core.$strip>;
916
+ selectedFragment: z.ZodObject<{
917
+ range: z.ZodObject<{
918
+ startTick: z.ZodNumber;
919
+ endTick: z.ZodNumber;
920
+ trackIds: z.ZodArray<z.ZodString>;
921
+ }, z.core.$strip>;
922
+ ppq: z.ZodNumber;
923
+ tracks: z.ZodArray<z.ZodObject<{
924
+ trackId: z.ZodString;
925
+ measures: z.ZodArray<z.ZodObject<{
926
+ id: z.ZodString;
927
+ index: z.ZodNumber;
928
+ startTick: z.ZodNumber;
929
+ durationTicks: z.ZodNumber;
930
+ timeSignature: z.ZodObject<{
931
+ numerator: z.ZodNumber;
932
+ denominator: z.ZodNumber;
933
+ }, z.core.$strip>;
934
+ keySignature: z.ZodObject<{
935
+ fifths: z.ZodNumber;
936
+ mode: z.ZodEnum<{
937
+ major: "major";
938
+ minor: "minor";
939
+ }>;
940
+ }, z.core.$strip>;
941
+ voices: z.ZodArray<z.ZodObject<{
942
+ id: z.ZodString;
943
+ name: z.ZodString;
944
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
945
+ id: z.ZodString;
946
+ pitch: z.ZodObject<{
947
+ step: z.ZodEnum<{
948
+ C: "C";
949
+ D: "D";
950
+ E: "E";
951
+ F: "F";
952
+ G: "G";
953
+ A: "A";
954
+ B: "B";
955
+ }>;
956
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
957
+ octave: z.ZodNumber;
958
+ }, z.core.$strip>;
959
+ startTick: z.ZodNumber;
960
+ durationTicks: z.ZodNumber;
961
+ velocity: z.ZodNumber;
962
+ voiceId: z.ZodString;
963
+ trackId: z.ZodString;
964
+ tieStart: z.ZodOptional<z.ZodBoolean>;
965
+ tieStop: z.ZodOptional<z.ZodBoolean>;
966
+ articulation: z.ZodOptional<z.ZodEnum<{
967
+ staccato: "staccato";
968
+ accent: "accent";
969
+ tenuto: "tenuto";
970
+ marcato: "marcato";
971
+ }>>;
972
+ }, z.core.$strict>, z.ZodObject<{
973
+ id: z.ZodString;
974
+ startTick: z.ZodNumber;
975
+ durationTicks: z.ZodNumber;
976
+ voiceId: z.ZodString;
977
+ trackId: z.ZodString;
978
+ }, z.core.$strict>]>>;
979
+ }, z.core.$strip>>;
980
+ }, z.core.$strip>>;
981
+ }, z.core.$strip>>;
982
+ }, z.core.$strip>;
983
+ followingContext: z.ZodObject<{
984
+ range: z.ZodObject<{
985
+ startTick: z.ZodNumber;
986
+ endTick: z.ZodNumber;
987
+ trackIds: z.ZodArray<z.ZodString>;
988
+ }, z.core.$strip>;
989
+ ppq: z.ZodNumber;
990
+ tracks: z.ZodArray<z.ZodObject<{
991
+ trackId: z.ZodString;
992
+ measures: z.ZodArray<z.ZodObject<{
993
+ id: z.ZodString;
994
+ index: z.ZodNumber;
995
+ startTick: z.ZodNumber;
996
+ durationTicks: z.ZodNumber;
997
+ timeSignature: z.ZodObject<{
998
+ numerator: z.ZodNumber;
999
+ denominator: z.ZodNumber;
1000
+ }, z.core.$strip>;
1001
+ keySignature: z.ZodObject<{
1002
+ fifths: z.ZodNumber;
1003
+ mode: z.ZodEnum<{
1004
+ major: "major";
1005
+ minor: "minor";
1006
+ }>;
1007
+ }, z.core.$strip>;
1008
+ voices: z.ZodArray<z.ZodObject<{
1009
+ id: z.ZodString;
1010
+ name: z.ZodString;
1011
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1012
+ id: z.ZodString;
1013
+ pitch: z.ZodObject<{
1014
+ step: z.ZodEnum<{
1015
+ C: "C";
1016
+ D: "D";
1017
+ E: "E";
1018
+ F: "F";
1019
+ G: "G";
1020
+ A: "A";
1021
+ B: "B";
1022
+ }>;
1023
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
1024
+ octave: z.ZodNumber;
1025
+ }, z.core.$strip>;
1026
+ startTick: z.ZodNumber;
1027
+ durationTicks: z.ZodNumber;
1028
+ velocity: z.ZodNumber;
1029
+ voiceId: z.ZodString;
1030
+ trackId: z.ZodString;
1031
+ tieStart: z.ZodOptional<z.ZodBoolean>;
1032
+ tieStop: z.ZodOptional<z.ZodBoolean>;
1033
+ articulation: z.ZodOptional<z.ZodEnum<{
1034
+ staccato: "staccato";
1035
+ accent: "accent";
1036
+ tenuto: "tenuto";
1037
+ marcato: "marcato";
1038
+ }>>;
1039
+ }, z.core.$strict>, z.ZodObject<{
1040
+ id: z.ZodString;
1041
+ startTick: z.ZodNumber;
1042
+ durationTicks: z.ZodNumber;
1043
+ voiceId: z.ZodString;
1044
+ trackId: z.ZodString;
1045
+ }, z.core.$strict>]>>;
1046
+ }, z.core.$strip>>;
1047
+ }, z.core.$strip>>;
1048
+ }, z.core.$strip>>;
1049
+ }, z.core.$strip>;
1050
+ constraints: z.ZodObject<{
1051
+ preserveMeasureCount: z.ZodLiteral<true>;
1052
+ preserveTimeSignatures: z.ZodLiteral<true>;
1053
+ preserveTempoEvents: z.ZodLiteral<true>;
1054
+ preserveBoundaryNotes: z.ZodOptional<z.ZodBoolean>;
1055
+ preserveHarmony: z.ZodOptional<z.ZodBoolean>;
1056
+ preserveRhythm: z.ZodOptional<z.ZodBoolean>;
1057
+ preserveMelody: z.ZodOptional<z.ZodBoolean>;
1058
+ maximumPolyphony: z.ZodOptional<z.ZodNumber>;
1059
+ allowedPitchRangeByTrack: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1060
+ lowestMidi: z.ZodNumber;
1061
+ highestMidi: z.ZodNumber;
1062
+ }, z.core.$strip>>>;
1063
+ }, z.core.$strip>;
1064
+ candidateCount: z.ZodNumber;
1065
+ }, z.core.$strip>;
1066
+ export declare const regenerationCandidateSchema: z.ZodObject<{
1067
+ id: z.ZodString;
1068
+ label: z.ZodString;
1069
+ fragment: z.ZodObject<{
1070
+ range: z.ZodObject<{
1071
+ startTick: z.ZodNumber;
1072
+ endTick: z.ZodNumber;
1073
+ trackIds: z.ZodArray<z.ZodString>;
1074
+ }, z.core.$strip>;
1075
+ ppq: z.ZodNumber;
1076
+ tracks: z.ZodArray<z.ZodObject<{
1077
+ trackId: z.ZodString;
1078
+ measures: z.ZodArray<z.ZodObject<{
1079
+ id: z.ZodString;
1080
+ index: z.ZodNumber;
1081
+ startTick: z.ZodNumber;
1082
+ durationTicks: z.ZodNumber;
1083
+ timeSignature: z.ZodObject<{
1084
+ numerator: z.ZodNumber;
1085
+ denominator: z.ZodNumber;
1086
+ }, z.core.$strip>;
1087
+ keySignature: z.ZodObject<{
1088
+ fifths: z.ZodNumber;
1089
+ mode: z.ZodEnum<{
1090
+ major: "major";
1091
+ minor: "minor";
1092
+ }>;
1093
+ }, z.core.$strip>;
1094
+ voices: z.ZodArray<z.ZodObject<{
1095
+ id: z.ZodString;
1096
+ name: z.ZodString;
1097
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1098
+ id: z.ZodString;
1099
+ pitch: z.ZodObject<{
1100
+ step: z.ZodEnum<{
1101
+ C: "C";
1102
+ D: "D";
1103
+ E: "E";
1104
+ F: "F";
1105
+ G: "G";
1106
+ A: "A";
1107
+ B: "B";
1108
+ }>;
1109
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
1110
+ octave: z.ZodNumber;
1111
+ }, z.core.$strip>;
1112
+ startTick: z.ZodNumber;
1113
+ durationTicks: z.ZodNumber;
1114
+ velocity: z.ZodNumber;
1115
+ voiceId: z.ZodString;
1116
+ trackId: z.ZodString;
1117
+ tieStart: z.ZodOptional<z.ZodBoolean>;
1118
+ tieStop: z.ZodOptional<z.ZodBoolean>;
1119
+ articulation: z.ZodOptional<z.ZodEnum<{
1120
+ staccato: "staccato";
1121
+ accent: "accent";
1122
+ tenuto: "tenuto";
1123
+ marcato: "marcato";
1124
+ }>>;
1125
+ }, z.core.$strict>, z.ZodObject<{
1126
+ id: z.ZodString;
1127
+ startTick: z.ZodNumber;
1128
+ durationTicks: z.ZodNumber;
1129
+ voiceId: z.ZodString;
1130
+ trackId: z.ZodString;
1131
+ }, z.core.$strict>]>>;
1132
+ }, z.core.$strip>>;
1133
+ }, z.core.$strip>>;
1134
+ }, z.core.$strip>>;
1135
+ }, z.core.$strip>;
1136
+ }, z.core.$strip>;
1137
+ export declare const regenerateRegionResultSchema: z.ZodObject<{
1138
+ candidates: z.ZodArray<z.ZodObject<{
1139
+ id: z.ZodString;
1140
+ label: z.ZodString;
1141
+ fragment: z.ZodObject<{
1142
+ range: z.ZodObject<{
1143
+ startTick: z.ZodNumber;
1144
+ endTick: z.ZodNumber;
1145
+ trackIds: z.ZodArray<z.ZodString>;
1146
+ }, z.core.$strip>;
1147
+ ppq: z.ZodNumber;
1148
+ tracks: z.ZodArray<z.ZodObject<{
1149
+ trackId: z.ZodString;
1150
+ measures: z.ZodArray<z.ZodObject<{
1151
+ id: z.ZodString;
1152
+ index: z.ZodNumber;
1153
+ startTick: z.ZodNumber;
1154
+ durationTicks: z.ZodNumber;
1155
+ timeSignature: z.ZodObject<{
1156
+ numerator: z.ZodNumber;
1157
+ denominator: z.ZodNumber;
1158
+ }, z.core.$strip>;
1159
+ keySignature: z.ZodObject<{
1160
+ fifths: z.ZodNumber;
1161
+ mode: z.ZodEnum<{
1162
+ major: "major";
1163
+ minor: "minor";
1164
+ }>;
1165
+ }, z.core.$strip>;
1166
+ voices: z.ZodArray<z.ZodObject<{
1167
+ id: z.ZodString;
1168
+ name: z.ZodString;
1169
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1170
+ id: z.ZodString;
1171
+ pitch: z.ZodObject<{
1172
+ step: z.ZodEnum<{
1173
+ C: "C";
1174
+ D: "D";
1175
+ E: "E";
1176
+ F: "F";
1177
+ G: "G";
1178
+ A: "A";
1179
+ B: "B";
1180
+ }>;
1181
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
1182
+ octave: z.ZodNumber;
1183
+ }, z.core.$strip>;
1184
+ startTick: z.ZodNumber;
1185
+ durationTicks: z.ZodNumber;
1186
+ velocity: z.ZodNumber;
1187
+ voiceId: z.ZodString;
1188
+ trackId: z.ZodString;
1189
+ tieStart: z.ZodOptional<z.ZodBoolean>;
1190
+ tieStop: z.ZodOptional<z.ZodBoolean>;
1191
+ articulation: z.ZodOptional<z.ZodEnum<{
1192
+ staccato: "staccato";
1193
+ accent: "accent";
1194
+ tenuto: "tenuto";
1195
+ marcato: "marcato";
1196
+ }>>;
1197
+ }, z.core.$strict>, z.ZodObject<{
1198
+ id: z.ZodString;
1199
+ startTick: z.ZodNumber;
1200
+ durationTicks: z.ZodNumber;
1201
+ voiceId: z.ZodString;
1202
+ trackId: z.ZodString;
1203
+ }, z.core.$strict>]>>;
1204
+ }, z.core.$strip>>;
1205
+ }, z.core.$strip>>;
1206
+ }, z.core.$strip>>;
1207
+ }, z.core.$strip>;
1208
+ }, z.core.$strip>>;
1209
+ warnings: z.ZodArray<z.ZodString>;
1210
+ }, z.core.$strip>;
1211
+ /** Parses and validates untrusted JSON as a `GenerateScoreRequest`. Throws `ZodError` on invalid input. */
1212
+ export declare function parseGenerateScoreRequest(json: unknown): GenerateScoreRequest;
1213
+ /** Parses and validates untrusted JSON as a `GenerateScoreResult`. Throws `ZodError` on invalid input. */
1214
+ export declare function parseGenerateScoreResult(json: unknown): GenerateScoreResult;
1215
+ /** Parses and validates untrusted JSON as a `RegenerateRegionRequest`. Throws `ZodError` on invalid input. */
1216
+ export declare function parseRegenerateRegionRequest(json: unknown): RegenerateRegionRequest;
1217
+ /** Parses and validates untrusted JSON as a `RegenerateRegionResult`. Throws `ZodError` on invalid input. */
1218
+ export declare function parseRegenerateRegionResult(json: unknown): RegenerateRegionResult;
1219
+ /** Parses and validates untrusted JSON as a `RegenerationCandidate`. Throws `ZodError` on invalid input. */
1220
+ export declare function parseRegenerationCandidate(json: unknown): RegenerationCandidate;
1221
+ export type ProjectUiPrefs = {
1222
+ view: 'notation' | 'piano-roll';
1223
+ zoom: number;
1224
+ };
1225
+ /** Project list item — everything but the (potentially large) score payload. */
1226
+ export type ProjectSummary = {
1227
+ id: string;
1228
+ name: string;
1229
+ createdAt: string;
1230
+ updatedAt: string;
1231
+ schemaVersion: number;
1232
+ };
1233
+ export type ProjectRecord = ProjectSummary & {
1234
+ score: Score;
1235
+ uiPrefs?: ProjectUiPrefs;
1236
+ };
1237
+ export type ProjectCreateRequest = {
1238
+ name: string;
1239
+ score: Score;
1240
+ uiPrefs?: ProjectUiPrefs;
1241
+ };
1242
+ export type ProjectUpdateRequest = {
1243
+ name?: string;
1244
+ score?: Score;
1245
+ uiPrefs?: ProjectUiPrefs;
1246
+ };
1247
+ export type ProjectListQuery = {
1248
+ search?: string;
1249
+ sort?: 'updatedAt' | 'name';
1250
+ };
1251
+ export declare const projectUiPrefsSchema: z.ZodObject<{
1252
+ view: z.ZodEnum<{
1253
+ notation: "notation";
1254
+ "piano-roll": "piano-roll";
1255
+ }>;
1256
+ zoom: z.ZodNumber;
1257
+ }, z.core.$strip>;
1258
+ export declare const projectSummarySchema: z.ZodObject<{
1259
+ id: z.ZodString;
1260
+ name: z.ZodString;
1261
+ createdAt: z.ZodString;
1262
+ updatedAt: z.ZodString;
1263
+ schemaVersion: z.ZodNumber;
1264
+ }, z.core.$strip>;
1265
+ export declare const projectRecordSchema: z.ZodObject<{
1266
+ id: z.ZodString;
1267
+ name: z.ZodString;
1268
+ createdAt: z.ZodString;
1269
+ updatedAt: z.ZodString;
1270
+ schemaVersion: z.ZodNumber;
1271
+ score: z.ZodObject<{
1272
+ id: z.ZodString;
1273
+ version: z.ZodNumber;
1274
+ ppq: z.ZodNumber;
1275
+ metadata: z.ZodObject<{
1276
+ title: z.ZodString;
1277
+ composer: z.ZodOptional<z.ZodString>;
1278
+ description: z.ZodOptional<z.ZodString>;
1279
+ createdAt: z.ZodString;
1280
+ updatedAt: z.ZodString;
1281
+ }, z.core.$strip>;
1282
+ tempoMap: z.ZodArray<z.ZodObject<{
1283
+ id: z.ZodString;
1284
+ tick: z.ZodNumber;
1285
+ bpm: z.ZodNumber;
1286
+ }, z.core.$strip>>;
1287
+ tracks: z.ZodArray<z.ZodObject<{
1288
+ id: z.ZodString;
1289
+ name: z.ZodString;
1290
+ instrumentName: z.ZodString;
1291
+ midiProgram: z.ZodNumber;
1292
+ midiChannel: z.ZodNumber;
1293
+ clef: z.ZodEnum<{
1294
+ treble: "treble";
1295
+ bass: "bass";
1296
+ alto: "alto";
1297
+ tenor: "tenor";
1298
+ percussion: "percussion";
1299
+ }>;
1300
+ volume: z.ZodNumber;
1301
+ pan: z.ZodNumber;
1302
+ muted: z.ZodBoolean;
1303
+ solo: z.ZodBoolean;
1304
+ measures: z.ZodArray<z.ZodObject<{
1305
+ id: z.ZodString;
1306
+ index: z.ZodNumber;
1307
+ startTick: z.ZodNumber;
1308
+ durationTicks: z.ZodNumber;
1309
+ timeSignature: z.ZodObject<{
1310
+ numerator: z.ZodNumber;
1311
+ denominator: z.ZodNumber;
1312
+ }, z.core.$strip>;
1313
+ keySignature: z.ZodObject<{
1314
+ fifths: z.ZodNumber;
1315
+ mode: z.ZodEnum<{
1316
+ major: "major";
1317
+ minor: "minor";
1318
+ }>;
1319
+ }, z.core.$strip>;
1320
+ voices: z.ZodArray<z.ZodObject<{
1321
+ id: z.ZodString;
1322
+ name: z.ZodString;
1323
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1324
+ id: z.ZodString;
1325
+ pitch: z.ZodObject<{
1326
+ step: z.ZodEnum<{
1327
+ C: "C";
1328
+ D: "D";
1329
+ E: "E";
1330
+ F: "F";
1331
+ G: "G";
1332
+ A: "A";
1333
+ B: "B";
1334
+ }>;
1335
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
1336
+ octave: z.ZodNumber;
1337
+ }, z.core.$strip>;
1338
+ startTick: z.ZodNumber;
1339
+ durationTicks: z.ZodNumber;
1340
+ velocity: z.ZodNumber;
1341
+ voiceId: z.ZodString;
1342
+ trackId: z.ZodString;
1343
+ tieStart: z.ZodOptional<z.ZodBoolean>;
1344
+ tieStop: z.ZodOptional<z.ZodBoolean>;
1345
+ articulation: z.ZodOptional<z.ZodEnum<{
1346
+ staccato: "staccato";
1347
+ accent: "accent";
1348
+ tenuto: "tenuto";
1349
+ marcato: "marcato";
1350
+ }>>;
1351
+ }, z.core.$strict>, z.ZodObject<{
1352
+ id: z.ZodString;
1353
+ startTick: z.ZodNumber;
1354
+ durationTicks: z.ZodNumber;
1355
+ voiceId: z.ZodString;
1356
+ trackId: z.ZodString;
1357
+ }, z.core.$strict>]>>;
1358
+ }, z.core.$strip>>;
1359
+ }, z.core.$strip>>;
1360
+ }, z.core.$strip>>;
1361
+ }, z.core.$strip>;
1362
+ uiPrefs: z.ZodOptional<z.ZodObject<{
1363
+ view: z.ZodEnum<{
1364
+ notation: "notation";
1365
+ "piano-roll": "piano-roll";
1366
+ }>;
1367
+ zoom: z.ZodNumber;
1368
+ }, z.core.$strip>>;
1369
+ }, z.core.$strip>;
1370
+ export declare const projectCreateRequestSchema: z.ZodObject<{
1371
+ name: z.ZodString;
1372
+ score: z.ZodObject<{
1373
+ id: z.ZodString;
1374
+ version: z.ZodNumber;
1375
+ ppq: z.ZodNumber;
1376
+ metadata: z.ZodObject<{
1377
+ title: z.ZodString;
1378
+ composer: z.ZodOptional<z.ZodString>;
1379
+ description: z.ZodOptional<z.ZodString>;
1380
+ createdAt: z.ZodString;
1381
+ updatedAt: z.ZodString;
1382
+ }, z.core.$strip>;
1383
+ tempoMap: z.ZodArray<z.ZodObject<{
1384
+ id: z.ZodString;
1385
+ tick: z.ZodNumber;
1386
+ bpm: z.ZodNumber;
1387
+ }, z.core.$strip>>;
1388
+ tracks: z.ZodArray<z.ZodObject<{
1389
+ id: z.ZodString;
1390
+ name: z.ZodString;
1391
+ instrumentName: z.ZodString;
1392
+ midiProgram: z.ZodNumber;
1393
+ midiChannel: z.ZodNumber;
1394
+ clef: z.ZodEnum<{
1395
+ treble: "treble";
1396
+ bass: "bass";
1397
+ alto: "alto";
1398
+ tenor: "tenor";
1399
+ percussion: "percussion";
1400
+ }>;
1401
+ volume: z.ZodNumber;
1402
+ pan: z.ZodNumber;
1403
+ muted: z.ZodBoolean;
1404
+ solo: z.ZodBoolean;
1405
+ measures: z.ZodArray<z.ZodObject<{
1406
+ id: z.ZodString;
1407
+ index: z.ZodNumber;
1408
+ startTick: z.ZodNumber;
1409
+ durationTicks: z.ZodNumber;
1410
+ timeSignature: z.ZodObject<{
1411
+ numerator: z.ZodNumber;
1412
+ denominator: z.ZodNumber;
1413
+ }, z.core.$strip>;
1414
+ keySignature: z.ZodObject<{
1415
+ fifths: z.ZodNumber;
1416
+ mode: z.ZodEnum<{
1417
+ major: "major";
1418
+ minor: "minor";
1419
+ }>;
1420
+ }, z.core.$strip>;
1421
+ voices: z.ZodArray<z.ZodObject<{
1422
+ id: z.ZodString;
1423
+ name: z.ZodString;
1424
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1425
+ id: z.ZodString;
1426
+ pitch: z.ZodObject<{
1427
+ step: z.ZodEnum<{
1428
+ C: "C";
1429
+ D: "D";
1430
+ E: "E";
1431
+ F: "F";
1432
+ G: "G";
1433
+ A: "A";
1434
+ B: "B";
1435
+ }>;
1436
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
1437
+ octave: z.ZodNumber;
1438
+ }, z.core.$strip>;
1439
+ startTick: z.ZodNumber;
1440
+ durationTicks: z.ZodNumber;
1441
+ velocity: z.ZodNumber;
1442
+ voiceId: z.ZodString;
1443
+ trackId: z.ZodString;
1444
+ tieStart: z.ZodOptional<z.ZodBoolean>;
1445
+ tieStop: z.ZodOptional<z.ZodBoolean>;
1446
+ articulation: z.ZodOptional<z.ZodEnum<{
1447
+ staccato: "staccato";
1448
+ accent: "accent";
1449
+ tenuto: "tenuto";
1450
+ marcato: "marcato";
1451
+ }>>;
1452
+ }, z.core.$strict>, z.ZodObject<{
1453
+ id: z.ZodString;
1454
+ startTick: z.ZodNumber;
1455
+ durationTicks: z.ZodNumber;
1456
+ voiceId: z.ZodString;
1457
+ trackId: z.ZodString;
1458
+ }, z.core.$strict>]>>;
1459
+ }, z.core.$strip>>;
1460
+ }, z.core.$strip>>;
1461
+ }, z.core.$strip>>;
1462
+ }, z.core.$strip>;
1463
+ uiPrefs: z.ZodOptional<z.ZodObject<{
1464
+ view: z.ZodEnum<{
1465
+ notation: "notation";
1466
+ "piano-roll": "piano-roll";
1467
+ }>;
1468
+ zoom: z.ZodNumber;
1469
+ }, z.core.$strip>>;
1470
+ }, z.core.$strip>;
1471
+ export declare const projectUpdateRequestSchema: z.ZodObject<{
1472
+ name: z.ZodOptional<z.ZodString>;
1473
+ score: z.ZodOptional<z.ZodObject<{
1474
+ id: z.ZodString;
1475
+ version: z.ZodNumber;
1476
+ ppq: z.ZodNumber;
1477
+ metadata: z.ZodObject<{
1478
+ title: z.ZodString;
1479
+ composer: z.ZodOptional<z.ZodString>;
1480
+ description: z.ZodOptional<z.ZodString>;
1481
+ createdAt: z.ZodString;
1482
+ updatedAt: z.ZodString;
1483
+ }, z.core.$strip>;
1484
+ tempoMap: z.ZodArray<z.ZodObject<{
1485
+ id: z.ZodString;
1486
+ tick: z.ZodNumber;
1487
+ bpm: z.ZodNumber;
1488
+ }, z.core.$strip>>;
1489
+ tracks: z.ZodArray<z.ZodObject<{
1490
+ id: z.ZodString;
1491
+ name: z.ZodString;
1492
+ instrumentName: z.ZodString;
1493
+ midiProgram: z.ZodNumber;
1494
+ midiChannel: z.ZodNumber;
1495
+ clef: z.ZodEnum<{
1496
+ treble: "treble";
1497
+ bass: "bass";
1498
+ alto: "alto";
1499
+ tenor: "tenor";
1500
+ percussion: "percussion";
1501
+ }>;
1502
+ volume: z.ZodNumber;
1503
+ pan: z.ZodNumber;
1504
+ muted: z.ZodBoolean;
1505
+ solo: z.ZodBoolean;
1506
+ measures: z.ZodArray<z.ZodObject<{
1507
+ id: z.ZodString;
1508
+ index: z.ZodNumber;
1509
+ startTick: z.ZodNumber;
1510
+ durationTicks: z.ZodNumber;
1511
+ timeSignature: z.ZodObject<{
1512
+ numerator: z.ZodNumber;
1513
+ denominator: z.ZodNumber;
1514
+ }, z.core.$strip>;
1515
+ keySignature: z.ZodObject<{
1516
+ fifths: z.ZodNumber;
1517
+ mode: z.ZodEnum<{
1518
+ major: "major";
1519
+ minor: "minor";
1520
+ }>;
1521
+ }, z.core.$strip>;
1522
+ voices: z.ZodArray<z.ZodObject<{
1523
+ id: z.ZodString;
1524
+ name: z.ZodString;
1525
+ events: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1526
+ id: z.ZodString;
1527
+ pitch: z.ZodObject<{
1528
+ step: z.ZodEnum<{
1529
+ C: "C";
1530
+ D: "D";
1531
+ E: "E";
1532
+ F: "F";
1533
+ G: "G";
1534
+ A: "A";
1535
+ B: "B";
1536
+ }>;
1537
+ accidental: z.ZodUnion<readonly [z.ZodLiteral<-2>, z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>]>;
1538
+ octave: z.ZodNumber;
1539
+ }, z.core.$strip>;
1540
+ startTick: z.ZodNumber;
1541
+ durationTicks: z.ZodNumber;
1542
+ velocity: z.ZodNumber;
1543
+ voiceId: z.ZodString;
1544
+ trackId: z.ZodString;
1545
+ tieStart: z.ZodOptional<z.ZodBoolean>;
1546
+ tieStop: z.ZodOptional<z.ZodBoolean>;
1547
+ articulation: z.ZodOptional<z.ZodEnum<{
1548
+ staccato: "staccato";
1549
+ accent: "accent";
1550
+ tenuto: "tenuto";
1551
+ marcato: "marcato";
1552
+ }>>;
1553
+ }, z.core.$strict>, z.ZodObject<{
1554
+ id: z.ZodString;
1555
+ startTick: z.ZodNumber;
1556
+ durationTicks: z.ZodNumber;
1557
+ voiceId: z.ZodString;
1558
+ trackId: z.ZodString;
1559
+ }, z.core.$strict>]>>;
1560
+ }, z.core.$strip>>;
1561
+ }, z.core.$strip>>;
1562
+ }, z.core.$strip>>;
1563
+ }, z.core.$strip>>;
1564
+ uiPrefs: z.ZodOptional<z.ZodObject<{
1565
+ view: z.ZodEnum<{
1566
+ notation: "notation";
1567
+ "piano-roll": "piano-roll";
1568
+ }>;
1569
+ zoom: z.ZodNumber;
1570
+ }, z.core.$strip>>;
1571
+ }, z.core.$strip>;
1572
+ export declare const projectListQuerySchema: z.ZodObject<{
1573
+ search: z.ZodOptional<z.ZodString>;
1574
+ sort: z.ZodOptional<z.ZodEnum<{
1575
+ name: "name";
1576
+ updatedAt: "updatedAt";
1577
+ }>>;
1578
+ }, z.core.$strip>;
1579
+ export declare const API_ERROR_CODES: {
1580
+ readonly QUOTA_EXCEEDED: "QUOTA_EXCEEDED";
1581
+ readonly AI_GENERATION_FAILED: "AI_GENERATION_FAILED";
1582
+ readonly AI_OUTPUT_INVALID: "AI_OUTPUT_INVALID";
1583
+ readonly PROJECT_NOT_FOUND: "PROJECT_NOT_FOUND";
1584
+ readonly UNAUTHORIZED: "UNAUTHORIZED";
1585
+ };
1586
+ export type ApiErrorCode = (typeof API_ERROR_CODES)[keyof typeof API_ERROR_CODES];
1587
+ export type ApiResponse<T> = {
1588
+ success: boolean;
1589
+ data?: T;
1590
+ error?: string;
1591
+ code?: ApiErrorCode;
1592
+ };
1593
+ /** Wraps payload data in the standard success envelope. */
1594
+ export declare function successResponse<T>(data: T): ApiResponse<T>;
1595
+ /** Wraps an error message (and optional typed code) in the standard error envelope. */
1596
+ export declare function errorResponse(message: string, code?: ApiErrorCode): ApiResponse<never>;
1597
+ //# sourceMappingURL=index.d.ts.map