@signalsandsorcery/plugin-sdk 2.35.7 → 2.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import React$1, { ReactNode, ComponentType, DragEvent, Dispatch, SetStateAction } from 'react';
1
+ import React$1, { ReactNode, ComponentType, DragEvent, Dispatch, SetStateAction, KeyboardEvent } from 'react';
2
2
 
3
3
  /**
4
4
  * Plugin SDK Type Definitions
@@ -348,8 +348,17 @@ interface PluginHost {
348
348
  * pool; the current preset is always implicitly excluded. Use this to
349
349
  * implement a "no-repeat until full cycle" shuffle: the panel accumulates
350
350
  * the history and resets when shufflePreset throws "no presets available".
351
- */
352
- shufflePreset(trackId: string, excludeNames?: readonly string[]): Promise<ShufflePresetResult>;
351
+ *
352
+ * `options.description` (since SDK 2.44.0) is the user's sound description
353
+ * for semantic retrieval — when the host's patch index is available the pick
354
+ * is vector-proximity against this text instead of random-within-category.
355
+ * Pass the live prompt from panel state (host-side stored prompts are
356
+ * debounced and may lag). Member voices of a group should pass the ANCHOR's
357
+ * prompt, optionally suffixed with the voice label ("horn section — bass
358
+ * register"). Omitting it falls back to the prompt stored on the track, and
359
+ * failing that, the legacy random pick.
360
+ */
361
+ shufflePreset(trackId: string, excludeNames?: readonly string[], options?: ShufflePresetOptions): Promise<ShufflePresetResult>;
353
362
  /** Duplicate track: copy MIDI + role to a new track with a different preset. Only works on owned tracks. */
354
363
  duplicateTrack(trackId: string): Promise<PluginTrackHandle>;
355
364
  /**
@@ -2014,6 +2023,18 @@ interface PluginPresetData {
2014
2023
  /** Base64-encoded plugin state — pass to setPluginState() */
2015
2024
  state: string;
2016
2025
  }
2026
+ /**
2027
+ * Options for shufflePreset().
2028
+ * @since SDK 2.44.0
2029
+ */
2030
+ interface ShufflePresetOptions {
2031
+ /**
2032
+ * The user's sound description ("muted trumpet", "warm analog pads").
2033
+ * Enables semantic (vector-proximity) preset retrieval on hosts that ship a
2034
+ * patch index; hosts without one ignore it and pick random-within-category.
2035
+ */
2036
+ description?: string;
2037
+ }
2017
2038
  /** Result of shufflePreset() — the new preset that was applied */
2018
2039
  interface ShufflePresetResult {
2019
2040
  presetName: string;
@@ -3758,13 +3779,21 @@ declare function Modal({ open, onClose, children, testIdPrefix, closeOnBackdrop,
3758
3779
  *
3759
3780
  * Coordinate spaces:
3760
3781
  * pitch (0-127) ── row = hi - pitch ── top px = row * ROW_HEIGHT
3761
- * beat (¼ notes) ─────────────────────── left px = beat * PX_PER_BEAT
3782
+ * beat (¼ notes) ─────────────────────── left px = beat * pxPerBeat
3783
+ * where pxPerBeat is the EFFECTIVE horizontal scale: at least PX_PER_BEAT
3784
+ * (long clips overflow into a horizontal scroll), stretched up so short clips
3785
+ * fill the viewport width (see effectivePxPerBeat).
3762
3786
  *
3763
3787
  * The pure helpers (`cellToPx` / `pxToCell` / `transposeNotes`) and layout
3764
3788
  * constants are exported so coordinate math can be unit-tested without a DOM.
3765
3789
  */
3766
3790
 
3767
- /** Horizontal pixels per quarter-note beat. */
3791
+ /**
3792
+ * MINIMUM horizontal pixels per quarter-note beat. The grid never renders
3793
+ * tighter than this (long clips overflow into a horizontal scroll), but it
3794
+ * stretches beyond it to fill the container when the clip is short — see
3795
+ * {@link effectivePxPerBeat}.
3796
+ */
3768
3797
  declare const PX_PER_BEAT = 24;
3769
3798
  /** Vertical pixels per semitone row. */
3770
3799
  declare const ROW_HEIGHT = 12;
@@ -3774,13 +3803,22 @@ declare const GUTTER_W = 28;
3774
3803
  declare const DRAG_DEAD_ZONE = 4;
3775
3804
  /** Width (px) of the right-edge grab handle that resizes a note's length. */
3776
3805
  declare const RESIZE_HANDLE_PX = 6;
3806
+ /**
3807
+ * Pixels per beat for a grid of `totalBeats` inside a `containerWidth`-px
3808
+ * scroll viewport (which also holds the {@link GUTTER_W} keyboard gutter).
3809
+ * Fills the available width when the clip is short; never drops below
3810
+ * {@link PX_PER_BEAT}, so long clips overflow into a horizontal scroll.
3811
+ * An unknown/unmeasured container (≤ gutter width) yields the minimum.
3812
+ */
3813
+ declare function effectivePxPerBeat(containerWidth: number, totalBeats: number): number;
3777
3814
  /** MIDI pitch → scientific note name (60 = C4). */
3778
3815
  declare function pitchToName(pitch: number): string;
3779
3816
  /**
3780
3817
  * Cell (pitch, startBeat) → top-left pixel offset within the grid.
3781
- * `hi` is the highest (top) visible pitch.
3818
+ * `hi` is the highest (top) visible pitch. `pxPerBeat` is the effective
3819
+ * (possibly stretched) horizontal scale; defaults to the minimum.
3782
3820
  */
3783
- declare function cellToPx(pitch: number, startBeat: number, hi: number): {
3821
+ declare function cellToPx(pitch: number, startBeat: number, hi: number, pxPerBeat?: number): {
3784
3822
  left: number;
3785
3823
  top: number;
3786
3824
  };
@@ -3789,7 +3827,7 @@ declare function cellToPx(pitch: number, startBeat: number, hi: number): {
3789
3827
  * snaps to the nearest `snap` step and clamps to `[0, totalBeats - snap]`;
3790
3828
  * pitch clamps to `[0, 127]`.
3791
3829
  */
3792
- declare function pxToCell(localX: number, localY: number, hi: number, snap: number, bars: number, beatsPerBar: number): {
3830
+ declare function pxToCell(localX: number, localY: number, hi: number, snap: number, bars: number, beatsPerBar: number, pxPerBeat?: number): {
3793
3831
  pitch: number;
3794
3832
  startBeat: number;
3795
3833
  };
@@ -3799,7 +3837,7 @@ declare function pxToCell(localX: number, localY: number, hi: number, snap: numb
3799
3837
  * step past `startBeat`, and never extends beyond the grid's right edge
3800
3838
  * (`bars * beatsPerBar`). `startBeat` and `pitch` are untouched.
3801
3839
  */
3802
- declare function resizeNoteDuration(startBeat: number, localX: number, snap: number, bars: number, beatsPerBar: number): number;
3840
+ declare function resizeNoteDuration(startBeat: number, localX: number, snap: number, bars: number, beatsPerBar: number, pxPerBeat?: number): number;
3803
3841
  /**
3804
3842
  * `scrollTop` that vertically centers the bulk of the notes in a `viewportH`-px
3805
3843
  * window. Targets the MEDIAN pitch (robust to a stray high/low outlier — keeps
@@ -3815,7 +3853,7 @@ interface PianoRollEditorProps {
3815
3853
  notes: readonly PluginMidiNote[];
3816
3854
  /** Emitted on every edit (add / delete / move / transpose) with the full next array. */
3817
3855
  onChange: (next: PluginMidiNote[]) => void;
3818
- /** Scene length in bars → grid width = bars * beatsPerBar * PX_PER_BEAT. */
3856
+ /** Scene length in bars → grid width = bars * beatsPerBar * pxPerBeat (min PX_PER_BEAT, stretched to fill). */
3819
3857
  bars: number;
3820
3858
  /** BPM — used only for audition timing in v1. */
3821
3859
  bpm: number;
@@ -4619,6 +4657,16 @@ declare function resolveTrackGroups<M, T>(parsedGroups: TrackGroupMeta<M>[], tra
4619
4657
  * @since SDK 2.35.0
4620
4658
  */
4621
4659
 
4660
+ /**
4661
+ * Default prompt-field keyboard behavior: Enter (without Shift) fires the
4662
+ * Generate action, exactly like clicking the Generate button. The SDK
4663
+ * TrackRow's own prompt input uses this; group headers that render their OWN
4664
+ * prompt input (bass / ensemble / arp / pad stacks) must attach it too so
4665
+ * Enter is never a dead key while the button sits right next to the field.
4666
+ *
4667
+ * @since SDK 2.36.0
4668
+ */
4669
+ declare function promptEnterToGenerate(generate: () => void, disabled?: boolean): (e: KeyboardEvent<HTMLInputElement>) => void;
4622
4670
  /**
4623
4671
  * Build a scene plugin_data key for a track-scoped value. Scene-data keys are
4624
4672
  * ALWAYS constructed from the stable DB UUID (`handle.dbId`) — never the
@@ -5654,4 +5702,4 @@ interface PickTopKOptions {
5654
5702
  */
5655
5703
  declare function pickTopKWeighted<T>(scored: ReadonlyArray<ScoredCandidate<T>>, options?: PickTopKOptions): T | null;
5656
5704
 
5657
- export { AUDIO_EFFECTS, AUDIO_EFFECT_LABEL, type AdjacentPairAnalysis, type AudioEffect, type AudioInputDevice, type BulkAddPlaceholderTrack, type ComposeProgressEvent, type ComposeProgressListener, type ComposeSceneOptions, type ComposeSceneResult, ConfirmDialog, type ConfirmDialogProps, type CoreTrackHandlers, type CreateTrackOptions, type CrossfadeInpaintInput, type CrossfadeLayer, type CrossfadeMeta, CrossfadeModal, type CrossfadeModalProps, type CrossfadePairMeta, type CrossfadeSelection, type CrossfadeSlot, CrossfadeTrackRow, type CrossfadeTrackRowProps, type CrossfadeVolumeCurves, DB_MAX, DB_MIN, DEFAULT_FX_CATEGORY_DETAIL, DEFAULT_FX_DRY_WET, DRAG_DEAD_ZONE, type DeckBoundaryEvent, type DeckBoundaryListener, type DesignerRowSlots, DownloadPackButton, type DownloadPackButtonProps, type DownloadPackButtonVariant, type DrawerTab, type DrumKit, EMPTY_FX_DETAIL_STATE, EMPTY_FX_STATE, ENSEMBLE_MAX_VOICES, ENSEMBLE_MIN_VOICES, ENSEMBLE_STYLES, EQUAL_POWER_GAIN, type EnforceVoiceOptions, type EnforceVoiceResult, type EnsembleAnalysis, type EnsembleNote, type EnsembleStyle, type EnsembleStyleRules, type EnsembleVoiceSpec, type ExportMidiBundleOptions, type ExportMidiBundleResult, type ExportedPluginData, FX_CATEGORIES, FX_CHAIN_ORDER, FX_DISPLAY_LABELS, FX_ENGINE_PLUGIN_NAMES, FX_PRESET_CONFIGS, type FadeDirection, type FadeEntry, type FadeGesture, type FadeLayer, type FadeMeta, FadeModal, type FadeModalProps, type FadeSelection, FadeTrackRow, type FadeTrackRowProps, type FxCategory, type FxCategoryDetailState, type FxPreset, type FxPresetConfig, type FxPresetData, type FxPresetDataEntry, FxToggleBar, type FxToggleBarProps, GUTTER_W, type GenerationServices, type GeneratorPanelAdapter, type GeneratorPanelCore, GeneratorPanelShell, type GeneratorPanelShellProps, type GeneratorPanelSlots, type GeneratorPlugin, type GeneratorTrackState, type GeneratorType, type GroupFadeEntry, type GroupFadeEntryOf, type GroupFadeMemberLayer, GroupFadeTrackRow, type GroupFadeTrackRowProps, type GroupParseSpec, type GroupRenderContext, type ImportCandidateScene, type ImportCandidateTrack, ImportTrackModal, type ImportTrackModalProps, type InstrumentDescriptor, TrackDrawer as InstrumentDrawer, type TrackDrawerProps as InstrumentDrawerProps, type InstrumentSampler, type InstrumentZone, type LLMCandidate, type LLMContent, type LLMFunctionDeclaration, type LLMGenerationConfig, type LLMGenerationRequest, type LLMGenerationResult, type LLMNoteResponse, type LLMPart, type LLMSystemInstruction, type LLMTool, type LLMToolUseRequest, type LLMToolUseResponse, type LLMUsageMetadata, LevelMeter, type LevelMeterProps, type ListAudioFilesOptions, type ListImportableTracksOptions, MIN_NOTE_DURATION_BEATS, type MidiClipData, type MidiWriteResult, type MixInterpolation, Modal, type ModalProps, type MotionKind, type MusicalContext, OffsetScrubber, type OffsetScrubberProps, PLUGIN_SDK_VERSION, PX_PER_BEAT, PanSlider, type PanelBusFxEntry, type PanelBusLevels, type PanelBusState, type PanelFeatureFlags, type PanelGenerationStrategy, type PanelGroupExtension, type PanelIdentity, PanelMasterStrip, type PanelMasterStripProps, type PanelShuffleAdapter, type PanelSoundAdapter, type PanelTransitionGroupAdapter, type ParsedEnsemble, type PeakAnalysis, PianoRollEditor, type PianoRollEditorProps, type PickTopKOptions, type PluginAppTool, type PluginAppToolInputSchema, type PluginAppToolResult, type PluginAudioTextureRequest, type PluginAudioTextureResult, type PluginCapabilities, type PluginChordSegment, type PluginChordTiming, type PluginConcurrentTrackInfo, type PluginCuePoints, type PluginDownloadOptions, PluginError, type PluginErrorCode, type PluginFileDialogOptions, type PluginFxCategoryDetailState, type PluginGenerationContext, type PluginGenerationContextOptions, type PluginHost, type PluginHttpRequestOptions, type PluginHttpResponse, type PluginManifest, type PluginMidiNote, type PluginPresetData, type PluginPresetInfo, type PluginRegistration, type PluginSampleFilter, type PluginSampleImportResult, type PluginSampleInfo, type PluginSampleTrackInfo, type PluginSceneContext, type PluginSceneInfo, type PluginSettingsSchema, type PluginSettingsStore, type PluginSkill, type PluginSkillInputSchema, type PluginStatus, type PluginStemSplitResult, type PluginStemTrackInfo, type PluginSynthInfo, type PluginTrackFxDetailState, type PluginTrackHandle, type PluginTrackInfo, type PluginTrackLevel, type PluginTrackRuntimeState, type PluginTransportState, type PluginTrimWindow, type PluginUIProps, type PostProcessOptions, RESIZE_HANDLE_PX, ROW_HEIGHT, type ReadMidiClip, type ReadMidiResult, type RecordingChunkFinalizedEvent, type RecordingTargetInfo, type ResolveGroupsOptions, type ResolvedCrossfadePair, type ResolvedFade, type ResolvedGroupFade, type ResolvedGroupsResult, type ResolvedTrackGroup, type SDKTrackRowProps, SLIDER_UNITY, STYLE_RULES, SUBMIT_ENSEMBLE_TOOL_NAME, SamplePackCTACard, type SamplePackCTACardProps, type SamplePackCTACardStatus, type SamplePackCardInfo, type SavePluginPresetOptions, type SceneChangeListener, type SceneFamilyTrack, type SceneTrackSummary, type ScoredCandidate, ScrollingWaveform, type ScrollingWaveformProps, type SettingDefinition, type ShufflePresetResult, SorceryProgressBar, type SoundHistoryEntry, type StemType, type SurgeSoundAdapterOverrides, type SynthesizeCuePointsOptions, TEXTURAL_ROLES, TRANSITION_DESIGNER_DRAFT_KEY, TrackDrawer, type TrackDrawerProps, type TrackExternalFxEntry, TrackExternalFxSection, type TrackExternalFxSectionProps, type TrackFxDetailState, type TrackFxState, type TrackGroupMember, type TrackGroupMeta, type TrackLevelsHandle, TrackMeterStrip, type TrackMeterStripProps, type TrackMeterView, TrackRow, type TrackRowDragProps, type TrackSoundHistory, type TrackSoundSnapshot, type TrackStateChangeListener, TransitionDesigner, type TransitionDesignerDraft, type TransitionDesignerProps, type TransitionOps, type TransitionRowType, type TransportEvent, type TransportEventListener, type UnsubscribeFn, type UseGeneratorPanelCoreOptions, type UsePanelBusResult, type UseSoundHistoryOptions, type UseSoundHistoryResult, type UseTrackExternalFxResult, type UseTrackReorderOptions, type UseTrackReorderResult, type UseTransitionOpsInputs, type VerbatimFadeMember, type VolumeAutomationPoint, VolumeSlider, type WaveformPeaks, WaveformView, type WaveformViewProps, analyzeEnsemble, analyzeWavPeak, asAudioEffect, asCrossfadeMeta, asFadeMeta, asTransitionDesignerDraft, buildCrossfadeInpaintPrompt, buildCrossfadeVolumeCurves, buildEnsembleSystemPrompt, buildFadeVolumeCurve, buildRowSlots, buildSubmitEnsembleParameters, buildViolationRetrySuffix, calculateTimeBasedTarget, cellToPx, centerScrollTop, computePeaks, createSurgeSoundAdapter, dbIdsFromKeys, dbToSlider, defaultFadeGesture, defaultVoiceSpecs, describeViolations, drawWaveform, enforceVoice, foldPitchToRegister, formatConcurrentTracks, hashString, moveItem, nearestPitchWithPc, newTrackState, normalizeSlots, padPair, padSlots, parseCrossfadePairs, parseEnsembleArgs, parseFades, parseLLMNoteResponse, parseTrackGroups, pickTopKWeighted, pitchToName, pluginFxToToggleFx, pxToCell, reconcileSlots, resizeNoteDuration, resolveTrackGroups, rowKey, rowType, scorePromptMatch, sliderToDb, slotsEqual, soundIdentity, splitFadeEntries, synthesizeCuePoints, tokenizePrompt, trackDataKey, transposeNotes, useAnySolo, useGeneratorPanelCore, usePanelBus, useSceneState, useSoundHistory, useTrackExternalFx, useTrackLevel, useTrackLevels, useTrackMeter, useTrackReorder, useTransitionOps, useTransportPlaying };
5705
+ export { AUDIO_EFFECTS, AUDIO_EFFECT_LABEL, type AdjacentPairAnalysis, type AudioEffect, type AudioInputDevice, type BulkAddPlaceholderTrack, type ComposeProgressEvent, type ComposeProgressListener, type ComposeSceneOptions, type ComposeSceneResult, ConfirmDialog, type ConfirmDialogProps, type CoreTrackHandlers, type CreateTrackOptions, type CrossfadeInpaintInput, type CrossfadeLayer, type CrossfadeMeta, CrossfadeModal, type CrossfadeModalProps, type CrossfadePairMeta, type CrossfadeSelection, type CrossfadeSlot, CrossfadeTrackRow, type CrossfadeTrackRowProps, type CrossfadeVolumeCurves, DB_MAX, DB_MIN, DEFAULT_FX_CATEGORY_DETAIL, DEFAULT_FX_DRY_WET, DRAG_DEAD_ZONE, type DeckBoundaryEvent, type DeckBoundaryListener, type DesignerRowSlots, DownloadPackButton, type DownloadPackButtonProps, type DownloadPackButtonVariant, type DrawerTab, type DrumKit, EMPTY_FX_DETAIL_STATE, EMPTY_FX_STATE, ENSEMBLE_MAX_VOICES, ENSEMBLE_MIN_VOICES, ENSEMBLE_STYLES, EQUAL_POWER_GAIN, type EnforceVoiceOptions, type EnforceVoiceResult, type EnsembleAnalysis, type EnsembleNote, type EnsembleStyle, type EnsembleStyleRules, type EnsembleVoiceSpec, type ExportMidiBundleOptions, type ExportMidiBundleResult, type ExportedPluginData, FX_CATEGORIES, FX_CHAIN_ORDER, FX_DISPLAY_LABELS, FX_ENGINE_PLUGIN_NAMES, FX_PRESET_CONFIGS, type FadeDirection, type FadeEntry, type FadeGesture, type FadeLayer, type FadeMeta, FadeModal, type FadeModalProps, type FadeSelection, FadeTrackRow, type FadeTrackRowProps, type FxCategory, type FxCategoryDetailState, type FxPreset, type FxPresetConfig, type FxPresetData, type FxPresetDataEntry, FxToggleBar, type FxToggleBarProps, GUTTER_W, type GenerationServices, type GeneratorPanelAdapter, type GeneratorPanelCore, GeneratorPanelShell, type GeneratorPanelShellProps, type GeneratorPanelSlots, type GeneratorPlugin, type GeneratorTrackState, type GeneratorType, type GroupFadeEntry, type GroupFadeEntryOf, type GroupFadeMemberLayer, GroupFadeTrackRow, type GroupFadeTrackRowProps, type GroupParseSpec, type GroupRenderContext, type ImportCandidateScene, type ImportCandidateTrack, ImportTrackModal, type ImportTrackModalProps, type InstrumentDescriptor, TrackDrawer as InstrumentDrawer, type TrackDrawerProps as InstrumentDrawerProps, type InstrumentSampler, type InstrumentZone, type LLMCandidate, type LLMContent, type LLMFunctionDeclaration, type LLMGenerationConfig, type LLMGenerationRequest, type LLMGenerationResult, type LLMNoteResponse, type LLMPart, type LLMSystemInstruction, type LLMTool, type LLMToolUseRequest, type LLMToolUseResponse, type LLMUsageMetadata, LevelMeter, type LevelMeterProps, type ListAudioFilesOptions, type ListImportableTracksOptions, MIN_NOTE_DURATION_BEATS, type MidiClipData, type MidiWriteResult, type MixInterpolation, Modal, type ModalProps, type MotionKind, type MusicalContext, OffsetScrubber, type OffsetScrubberProps, PLUGIN_SDK_VERSION, PX_PER_BEAT, PanSlider, type PanelBusFxEntry, type PanelBusLevels, type PanelBusState, type PanelFeatureFlags, type PanelGenerationStrategy, type PanelGroupExtension, type PanelIdentity, PanelMasterStrip, type PanelMasterStripProps, type PanelShuffleAdapter, type PanelSoundAdapter, type PanelTransitionGroupAdapter, type ParsedEnsemble, type PeakAnalysis, PianoRollEditor, type PianoRollEditorProps, type PickTopKOptions, type PluginAppTool, type PluginAppToolInputSchema, type PluginAppToolResult, type PluginAudioTextureRequest, type PluginAudioTextureResult, type PluginCapabilities, type PluginChordSegment, type PluginChordTiming, type PluginConcurrentTrackInfo, type PluginCuePoints, type PluginDownloadOptions, PluginError, type PluginErrorCode, type PluginFileDialogOptions, type PluginFxCategoryDetailState, type PluginGenerationContext, type PluginGenerationContextOptions, type PluginHost, type PluginHttpRequestOptions, type PluginHttpResponse, type PluginManifest, type PluginMidiNote, type PluginPresetData, type PluginPresetInfo, type PluginRegistration, type PluginSampleFilter, type PluginSampleImportResult, type PluginSampleInfo, type PluginSampleTrackInfo, type PluginSceneContext, type PluginSceneInfo, type PluginSettingsSchema, type PluginSettingsStore, type PluginSkill, type PluginSkillInputSchema, type PluginStatus, type PluginStemSplitResult, type PluginStemTrackInfo, type PluginSynthInfo, type PluginTrackFxDetailState, type PluginTrackHandle, type PluginTrackInfo, type PluginTrackLevel, type PluginTrackRuntimeState, type PluginTransportState, type PluginTrimWindow, type PluginUIProps, type PostProcessOptions, RESIZE_HANDLE_PX, ROW_HEIGHT, type ReadMidiClip, type ReadMidiResult, type RecordingChunkFinalizedEvent, type RecordingTargetInfo, type ResolveGroupsOptions, type ResolvedCrossfadePair, type ResolvedFade, type ResolvedGroupFade, type ResolvedGroupsResult, type ResolvedTrackGroup, type SDKTrackRowProps, SLIDER_UNITY, STYLE_RULES, SUBMIT_ENSEMBLE_TOOL_NAME, SamplePackCTACard, type SamplePackCTACardProps, type SamplePackCTACardStatus, type SamplePackCardInfo, type SavePluginPresetOptions, type SceneChangeListener, type SceneFamilyTrack, type SceneTrackSummary, type ScoredCandidate, ScrollingWaveform, type ScrollingWaveformProps, type SettingDefinition, type ShufflePresetOptions, type ShufflePresetResult, SorceryProgressBar, type SoundHistoryEntry, type StemType, type SurgeSoundAdapterOverrides, type SynthesizeCuePointsOptions, TEXTURAL_ROLES, TRANSITION_DESIGNER_DRAFT_KEY, TrackDrawer, type TrackDrawerProps, type TrackExternalFxEntry, TrackExternalFxSection, type TrackExternalFxSectionProps, type TrackFxDetailState, type TrackFxState, type TrackGroupMember, type TrackGroupMeta, type TrackLevelsHandle, TrackMeterStrip, type TrackMeterStripProps, type TrackMeterView, TrackRow, type TrackRowDragProps, type TrackSoundHistory, type TrackSoundSnapshot, type TrackStateChangeListener, TransitionDesigner, type TransitionDesignerDraft, type TransitionDesignerProps, type TransitionOps, type TransitionRowType, type TransportEvent, type TransportEventListener, type UnsubscribeFn, type UseGeneratorPanelCoreOptions, type UsePanelBusResult, type UseSoundHistoryOptions, type UseSoundHistoryResult, type UseTrackExternalFxResult, type UseTrackReorderOptions, type UseTrackReorderResult, type UseTransitionOpsInputs, type VerbatimFadeMember, type VolumeAutomationPoint, VolumeSlider, type WaveformPeaks, WaveformView, type WaveformViewProps, analyzeEnsemble, analyzeWavPeak, asAudioEffect, asCrossfadeMeta, asFadeMeta, asTransitionDesignerDraft, buildCrossfadeInpaintPrompt, buildCrossfadeVolumeCurves, buildEnsembleSystemPrompt, buildFadeVolumeCurve, buildRowSlots, buildSubmitEnsembleParameters, buildViolationRetrySuffix, calculateTimeBasedTarget, cellToPx, centerScrollTop, computePeaks, createSurgeSoundAdapter, dbIdsFromKeys, dbToSlider, defaultFadeGesture, defaultVoiceSpecs, describeViolations, drawWaveform, effectivePxPerBeat, enforceVoice, foldPitchToRegister, formatConcurrentTracks, hashString, moveItem, nearestPitchWithPc, newTrackState, normalizeSlots, padPair, padSlots, parseCrossfadePairs, parseEnsembleArgs, parseFades, parseLLMNoteResponse, parseTrackGroups, pickTopKWeighted, pitchToName, pluginFxToToggleFx, promptEnterToGenerate, pxToCell, reconcileSlots, resizeNoteDuration, resolveTrackGroups, rowKey, rowType, scorePromptMatch, sliderToDb, slotsEqual, soundIdentity, splitFadeEntries, synthesizeCuePoints, tokenizePrompt, trackDataKey, transposeNotes, useAnySolo, useGeneratorPanelCore, usePanelBus, useSceneState, useSoundHistory, useTrackExternalFx, useTrackLevel, useTrackLevels, useTrackMeter, useTrackReorder, useTransitionOps, useTransportPlaying };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React$1, { ReactNode, ComponentType, DragEvent, Dispatch, SetStateAction } from 'react';
1
+ import React$1, { ReactNode, ComponentType, DragEvent, Dispatch, SetStateAction, KeyboardEvent } from 'react';
2
2
 
3
3
  /**
4
4
  * Plugin SDK Type Definitions
@@ -348,8 +348,17 @@ interface PluginHost {
348
348
  * pool; the current preset is always implicitly excluded. Use this to
349
349
  * implement a "no-repeat until full cycle" shuffle: the panel accumulates
350
350
  * the history and resets when shufflePreset throws "no presets available".
351
- */
352
- shufflePreset(trackId: string, excludeNames?: readonly string[]): Promise<ShufflePresetResult>;
351
+ *
352
+ * `options.description` (since SDK 2.44.0) is the user's sound description
353
+ * for semantic retrieval — when the host's patch index is available the pick
354
+ * is vector-proximity against this text instead of random-within-category.
355
+ * Pass the live prompt from panel state (host-side stored prompts are
356
+ * debounced and may lag). Member voices of a group should pass the ANCHOR's
357
+ * prompt, optionally suffixed with the voice label ("horn section — bass
358
+ * register"). Omitting it falls back to the prompt stored on the track, and
359
+ * failing that, the legacy random pick.
360
+ */
361
+ shufflePreset(trackId: string, excludeNames?: readonly string[], options?: ShufflePresetOptions): Promise<ShufflePresetResult>;
353
362
  /** Duplicate track: copy MIDI + role to a new track with a different preset. Only works on owned tracks. */
354
363
  duplicateTrack(trackId: string): Promise<PluginTrackHandle>;
355
364
  /**
@@ -2014,6 +2023,18 @@ interface PluginPresetData {
2014
2023
  /** Base64-encoded plugin state — pass to setPluginState() */
2015
2024
  state: string;
2016
2025
  }
2026
+ /**
2027
+ * Options for shufflePreset().
2028
+ * @since SDK 2.44.0
2029
+ */
2030
+ interface ShufflePresetOptions {
2031
+ /**
2032
+ * The user's sound description ("muted trumpet", "warm analog pads").
2033
+ * Enables semantic (vector-proximity) preset retrieval on hosts that ship a
2034
+ * patch index; hosts without one ignore it and pick random-within-category.
2035
+ */
2036
+ description?: string;
2037
+ }
2017
2038
  /** Result of shufflePreset() — the new preset that was applied */
2018
2039
  interface ShufflePresetResult {
2019
2040
  presetName: string;
@@ -3758,13 +3779,21 @@ declare function Modal({ open, onClose, children, testIdPrefix, closeOnBackdrop,
3758
3779
  *
3759
3780
  * Coordinate spaces:
3760
3781
  * pitch (0-127) ── row = hi - pitch ── top px = row * ROW_HEIGHT
3761
- * beat (¼ notes) ─────────────────────── left px = beat * PX_PER_BEAT
3782
+ * beat (¼ notes) ─────────────────────── left px = beat * pxPerBeat
3783
+ * where pxPerBeat is the EFFECTIVE horizontal scale: at least PX_PER_BEAT
3784
+ * (long clips overflow into a horizontal scroll), stretched up so short clips
3785
+ * fill the viewport width (see effectivePxPerBeat).
3762
3786
  *
3763
3787
  * The pure helpers (`cellToPx` / `pxToCell` / `transposeNotes`) and layout
3764
3788
  * constants are exported so coordinate math can be unit-tested without a DOM.
3765
3789
  */
3766
3790
 
3767
- /** Horizontal pixels per quarter-note beat. */
3791
+ /**
3792
+ * MINIMUM horizontal pixels per quarter-note beat. The grid never renders
3793
+ * tighter than this (long clips overflow into a horizontal scroll), but it
3794
+ * stretches beyond it to fill the container when the clip is short — see
3795
+ * {@link effectivePxPerBeat}.
3796
+ */
3768
3797
  declare const PX_PER_BEAT = 24;
3769
3798
  /** Vertical pixels per semitone row. */
3770
3799
  declare const ROW_HEIGHT = 12;
@@ -3774,13 +3803,22 @@ declare const GUTTER_W = 28;
3774
3803
  declare const DRAG_DEAD_ZONE = 4;
3775
3804
  /** Width (px) of the right-edge grab handle that resizes a note's length. */
3776
3805
  declare const RESIZE_HANDLE_PX = 6;
3806
+ /**
3807
+ * Pixels per beat for a grid of `totalBeats` inside a `containerWidth`-px
3808
+ * scroll viewport (which also holds the {@link GUTTER_W} keyboard gutter).
3809
+ * Fills the available width when the clip is short; never drops below
3810
+ * {@link PX_PER_BEAT}, so long clips overflow into a horizontal scroll.
3811
+ * An unknown/unmeasured container (≤ gutter width) yields the minimum.
3812
+ */
3813
+ declare function effectivePxPerBeat(containerWidth: number, totalBeats: number): number;
3777
3814
  /** MIDI pitch → scientific note name (60 = C4). */
3778
3815
  declare function pitchToName(pitch: number): string;
3779
3816
  /**
3780
3817
  * Cell (pitch, startBeat) → top-left pixel offset within the grid.
3781
- * `hi` is the highest (top) visible pitch.
3818
+ * `hi` is the highest (top) visible pitch. `pxPerBeat` is the effective
3819
+ * (possibly stretched) horizontal scale; defaults to the minimum.
3782
3820
  */
3783
- declare function cellToPx(pitch: number, startBeat: number, hi: number): {
3821
+ declare function cellToPx(pitch: number, startBeat: number, hi: number, pxPerBeat?: number): {
3784
3822
  left: number;
3785
3823
  top: number;
3786
3824
  };
@@ -3789,7 +3827,7 @@ declare function cellToPx(pitch: number, startBeat: number, hi: number): {
3789
3827
  * snaps to the nearest `snap` step and clamps to `[0, totalBeats - snap]`;
3790
3828
  * pitch clamps to `[0, 127]`.
3791
3829
  */
3792
- declare function pxToCell(localX: number, localY: number, hi: number, snap: number, bars: number, beatsPerBar: number): {
3830
+ declare function pxToCell(localX: number, localY: number, hi: number, snap: number, bars: number, beatsPerBar: number, pxPerBeat?: number): {
3793
3831
  pitch: number;
3794
3832
  startBeat: number;
3795
3833
  };
@@ -3799,7 +3837,7 @@ declare function pxToCell(localX: number, localY: number, hi: number, snap: numb
3799
3837
  * step past `startBeat`, and never extends beyond the grid's right edge
3800
3838
  * (`bars * beatsPerBar`). `startBeat` and `pitch` are untouched.
3801
3839
  */
3802
- declare function resizeNoteDuration(startBeat: number, localX: number, snap: number, bars: number, beatsPerBar: number): number;
3840
+ declare function resizeNoteDuration(startBeat: number, localX: number, snap: number, bars: number, beatsPerBar: number, pxPerBeat?: number): number;
3803
3841
  /**
3804
3842
  * `scrollTop` that vertically centers the bulk of the notes in a `viewportH`-px
3805
3843
  * window. Targets the MEDIAN pitch (robust to a stray high/low outlier — keeps
@@ -3815,7 +3853,7 @@ interface PianoRollEditorProps {
3815
3853
  notes: readonly PluginMidiNote[];
3816
3854
  /** Emitted on every edit (add / delete / move / transpose) with the full next array. */
3817
3855
  onChange: (next: PluginMidiNote[]) => void;
3818
- /** Scene length in bars → grid width = bars * beatsPerBar * PX_PER_BEAT. */
3856
+ /** Scene length in bars → grid width = bars * beatsPerBar * pxPerBeat (min PX_PER_BEAT, stretched to fill). */
3819
3857
  bars: number;
3820
3858
  /** BPM — used only for audition timing in v1. */
3821
3859
  bpm: number;
@@ -4619,6 +4657,16 @@ declare function resolveTrackGroups<M, T>(parsedGroups: TrackGroupMeta<M>[], tra
4619
4657
  * @since SDK 2.35.0
4620
4658
  */
4621
4659
 
4660
+ /**
4661
+ * Default prompt-field keyboard behavior: Enter (without Shift) fires the
4662
+ * Generate action, exactly like clicking the Generate button. The SDK
4663
+ * TrackRow's own prompt input uses this; group headers that render their OWN
4664
+ * prompt input (bass / ensemble / arp / pad stacks) must attach it too so
4665
+ * Enter is never a dead key while the button sits right next to the field.
4666
+ *
4667
+ * @since SDK 2.36.0
4668
+ */
4669
+ declare function promptEnterToGenerate(generate: () => void, disabled?: boolean): (e: KeyboardEvent<HTMLInputElement>) => void;
4622
4670
  /**
4623
4671
  * Build a scene plugin_data key for a track-scoped value. Scene-data keys are
4624
4672
  * ALWAYS constructed from the stable DB UUID (`handle.dbId`) — never the
@@ -5654,4 +5702,4 @@ interface PickTopKOptions {
5654
5702
  */
5655
5703
  declare function pickTopKWeighted<T>(scored: ReadonlyArray<ScoredCandidate<T>>, options?: PickTopKOptions): T | null;
5656
5704
 
5657
- export { AUDIO_EFFECTS, AUDIO_EFFECT_LABEL, type AdjacentPairAnalysis, type AudioEffect, type AudioInputDevice, type BulkAddPlaceholderTrack, type ComposeProgressEvent, type ComposeProgressListener, type ComposeSceneOptions, type ComposeSceneResult, ConfirmDialog, type ConfirmDialogProps, type CoreTrackHandlers, type CreateTrackOptions, type CrossfadeInpaintInput, type CrossfadeLayer, type CrossfadeMeta, CrossfadeModal, type CrossfadeModalProps, type CrossfadePairMeta, type CrossfadeSelection, type CrossfadeSlot, CrossfadeTrackRow, type CrossfadeTrackRowProps, type CrossfadeVolumeCurves, DB_MAX, DB_MIN, DEFAULT_FX_CATEGORY_DETAIL, DEFAULT_FX_DRY_WET, DRAG_DEAD_ZONE, type DeckBoundaryEvent, type DeckBoundaryListener, type DesignerRowSlots, DownloadPackButton, type DownloadPackButtonProps, type DownloadPackButtonVariant, type DrawerTab, type DrumKit, EMPTY_FX_DETAIL_STATE, EMPTY_FX_STATE, ENSEMBLE_MAX_VOICES, ENSEMBLE_MIN_VOICES, ENSEMBLE_STYLES, EQUAL_POWER_GAIN, type EnforceVoiceOptions, type EnforceVoiceResult, type EnsembleAnalysis, type EnsembleNote, type EnsembleStyle, type EnsembleStyleRules, type EnsembleVoiceSpec, type ExportMidiBundleOptions, type ExportMidiBundleResult, type ExportedPluginData, FX_CATEGORIES, FX_CHAIN_ORDER, FX_DISPLAY_LABELS, FX_ENGINE_PLUGIN_NAMES, FX_PRESET_CONFIGS, type FadeDirection, type FadeEntry, type FadeGesture, type FadeLayer, type FadeMeta, FadeModal, type FadeModalProps, type FadeSelection, FadeTrackRow, type FadeTrackRowProps, type FxCategory, type FxCategoryDetailState, type FxPreset, type FxPresetConfig, type FxPresetData, type FxPresetDataEntry, FxToggleBar, type FxToggleBarProps, GUTTER_W, type GenerationServices, type GeneratorPanelAdapter, type GeneratorPanelCore, GeneratorPanelShell, type GeneratorPanelShellProps, type GeneratorPanelSlots, type GeneratorPlugin, type GeneratorTrackState, type GeneratorType, type GroupFadeEntry, type GroupFadeEntryOf, type GroupFadeMemberLayer, GroupFadeTrackRow, type GroupFadeTrackRowProps, type GroupParseSpec, type GroupRenderContext, type ImportCandidateScene, type ImportCandidateTrack, ImportTrackModal, type ImportTrackModalProps, type InstrumentDescriptor, TrackDrawer as InstrumentDrawer, type TrackDrawerProps as InstrumentDrawerProps, type InstrumentSampler, type InstrumentZone, type LLMCandidate, type LLMContent, type LLMFunctionDeclaration, type LLMGenerationConfig, type LLMGenerationRequest, type LLMGenerationResult, type LLMNoteResponse, type LLMPart, type LLMSystemInstruction, type LLMTool, type LLMToolUseRequest, type LLMToolUseResponse, type LLMUsageMetadata, LevelMeter, type LevelMeterProps, type ListAudioFilesOptions, type ListImportableTracksOptions, MIN_NOTE_DURATION_BEATS, type MidiClipData, type MidiWriteResult, type MixInterpolation, Modal, type ModalProps, type MotionKind, type MusicalContext, OffsetScrubber, type OffsetScrubberProps, PLUGIN_SDK_VERSION, PX_PER_BEAT, PanSlider, type PanelBusFxEntry, type PanelBusLevels, type PanelBusState, type PanelFeatureFlags, type PanelGenerationStrategy, type PanelGroupExtension, type PanelIdentity, PanelMasterStrip, type PanelMasterStripProps, type PanelShuffleAdapter, type PanelSoundAdapter, type PanelTransitionGroupAdapter, type ParsedEnsemble, type PeakAnalysis, PianoRollEditor, type PianoRollEditorProps, type PickTopKOptions, type PluginAppTool, type PluginAppToolInputSchema, type PluginAppToolResult, type PluginAudioTextureRequest, type PluginAudioTextureResult, type PluginCapabilities, type PluginChordSegment, type PluginChordTiming, type PluginConcurrentTrackInfo, type PluginCuePoints, type PluginDownloadOptions, PluginError, type PluginErrorCode, type PluginFileDialogOptions, type PluginFxCategoryDetailState, type PluginGenerationContext, type PluginGenerationContextOptions, type PluginHost, type PluginHttpRequestOptions, type PluginHttpResponse, type PluginManifest, type PluginMidiNote, type PluginPresetData, type PluginPresetInfo, type PluginRegistration, type PluginSampleFilter, type PluginSampleImportResult, type PluginSampleInfo, type PluginSampleTrackInfo, type PluginSceneContext, type PluginSceneInfo, type PluginSettingsSchema, type PluginSettingsStore, type PluginSkill, type PluginSkillInputSchema, type PluginStatus, type PluginStemSplitResult, type PluginStemTrackInfo, type PluginSynthInfo, type PluginTrackFxDetailState, type PluginTrackHandle, type PluginTrackInfo, type PluginTrackLevel, type PluginTrackRuntimeState, type PluginTransportState, type PluginTrimWindow, type PluginUIProps, type PostProcessOptions, RESIZE_HANDLE_PX, ROW_HEIGHT, type ReadMidiClip, type ReadMidiResult, type RecordingChunkFinalizedEvent, type RecordingTargetInfo, type ResolveGroupsOptions, type ResolvedCrossfadePair, type ResolvedFade, type ResolvedGroupFade, type ResolvedGroupsResult, type ResolvedTrackGroup, type SDKTrackRowProps, SLIDER_UNITY, STYLE_RULES, SUBMIT_ENSEMBLE_TOOL_NAME, SamplePackCTACard, type SamplePackCTACardProps, type SamplePackCTACardStatus, type SamplePackCardInfo, type SavePluginPresetOptions, type SceneChangeListener, type SceneFamilyTrack, type SceneTrackSummary, type ScoredCandidate, ScrollingWaveform, type ScrollingWaveformProps, type SettingDefinition, type ShufflePresetResult, SorceryProgressBar, type SoundHistoryEntry, type StemType, type SurgeSoundAdapterOverrides, type SynthesizeCuePointsOptions, TEXTURAL_ROLES, TRANSITION_DESIGNER_DRAFT_KEY, TrackDrawer, type TrackDrawerProps, type TrackExternalFxEntry, TrackExternalFxSection, type TrackExternalFxSectionProps, type TrackFxDetailState, type TrackFxState, type TrackGroupMember, type TrackGroupMeta, type TrackLevelsHandle, TrackMeterStrip, type TrackMeterStripProps, type TrackMeterView, TrackRow, type TrackRowDragProps, type TrackSoundHistory, type TrackSoundSnapshot, type TrackStateChangeListener, TransitionDesigner, type TransitionDesignerDraft, type TransitionDesignerProps, type TransitionOps, type TransitionRowType, type TransportEvent, type TransportEventListener, type UnsubscribeFn, type UseGeneratorPanelCoreOptions, type UsePanelBusResult, type UseSoundHistoryOptions, type UseSoundHistoryResult, type UseTrackExternalFxResult, type UseTrackReorderOptions, type UseTrackReorderResult, type UseTransitionOpsInputs, type VerbatimFadeMember, type VolumeAutomationPoint, VolumeSlider, type WaveformPeaks, WaveformView, type WaveformViewProps, analyzeEnsemble, analyzeWavPeak, asAudioEffect, asCrossfadeMeta, asFadeMeta, asTransitionDesignerDraft, buildCrossfadeInpaintPrompt, buildCrossfadeVolumeCurves, buildEnsembleSystemPrompt, buildFadeVolumeCurve, buildRowSlots, buildSubmitEnsembleParameters, buildViolationRetrySuffix, calculateTimeBasedTarget, cellToPx, centerScrollTop, computePeaks, createSurgeSoundAdapter, dbIdsFromKeys, dbToSlider, defaultFadeGesture, defaultVoiceSpecs, describeViolations, drawWaveform, enforceVoice, foldPitchToRegister, formatConcurrentTracks, hashString, moveItem, nearestPitchWithPc, newTrackState, normalizeSlots, padPair, padSlots, parseCrossfadePairs, parseEnsembleArgs, parseFades, parseLLMNoteResponse, parseTrackGroups, pickTopKWeighted, pitchToName, pluginFxToToggleFx, pxToCell, reconcileSlots, resizeNoteDuration, resolveTrackGroups, rowKey, rowType, scorePromptMatch, sliderToDb, slotsEqual, soundIdentity, splitFadeEntries, synthesizeCuePoints, tokenizePrompt, trackDataKey, transposeNotes, useAnySolo, useGeneratorPanelCore, usePanelBus, useSceneState, useSoundHistory, useTrackExternalFx, useTrackLevel, useTrackLevels, useTrackMeter, useTrackReorder, useTransitionOps, useTransportPlaying };
5705
+ export { AUDIO_EFFECTS, AUDIO_EFFECT_LABEL, type AdjacentPairAnalysis, type AudioEffect, type AudioInputDevice, type BulkAddPlaceholderTrack, type ComposeProgressEvent, type ComposeProgressListener, type ComposeSceneOptions, type ComposeSceneResult, ConfirmDialog, type ConfirmDialogProps, type CoreTrackHandlers, type CreateTrackOptions, type CrossfadeInpaintInput, type CrossfadeLayer, type CrossfadeMeta, CrossfadeModal, type CrossfadeModalProps, type CrossfadePairMeta, type CrossfadeSelection, type CrossfadeSlot, CrossfadeTrackRow, type CrossfadeTrackRowProps, type CrossfadeVolumeCurves, DB_MAX, DB_MIN, DEFAULT_FX_CATEGORY_DETAIL, DEFAULT_FX_DRY_WET, DRAG_DEAD_ZONE, type DeckBoundaryEvent, type DeckBoundaryListener, type DesignerRowSlots, DownloadPackButton, type DownloadPackButtonProps, type DownloadPackButtonVariant, type DrawerTab, type DrumKit, EMPTY_FX_DETAIL_STATE, EMPTY_FX_STATE, ENSEMBLE_MAX_VOICES, ENSEMBLE_MIN_VOICES, ENSEMBLE_STYLES, EQUAL_POWER_GAIN, type EnforceVoiceOptions, type EnforceVoiceResult, type EnsembleAnalysis, type EnsembleNote, type EnsembleStyle, type EnsembleStyleRules, type EnsembleVoiceSpec, type ExportMidiBundleOptions, type ExportMidiBundleResult, type ExportedPluginData, FX_CATEGORIES, FX_CHAIN_ORDER, FX_DISPLAY_LABELS, FX_ENGINE_PLUGIN_NAMES, FX_PRESET_CONFIGS, type FadeDirection, type FadeEntry, type FadeGesture, type FadeLayer, type FadeMeta, FadeModal, type FadeModalProps, type FadeSelection, FadeTrackRow, type FadeTrackRowProps, type FxCategory, type FxCategoryDetailState, type FxPreset, type FxPresetConfig, type FxPresetData, type FxPresetDataEntry, FxToggleBar, type FxToggleBarProps, GUTTER_W, type GenerationServices, type GeneratorPanelAdapter, type GeneratorPanelCore, GeneratorPanelShell, type GeneratorPanelShellProps, type GeneratorPanelSlots, type GeneratorPlugin, type GeneratorTrackState, type GeneratorType, type GroupFadeEntry, type GroupFadeEntryOf, type GroupFadeMemberLayer, GroupFadeTrackRow, type GroupFadeTrackRowProps, type GroupParseSpec, type GroupRenderContext, type ImportCandidateScene, type ImportCandidateTrack, ImportTrackModal, type ImportTrackModalProps, type InstrumentDescriptor, TrackDrawer as InstrumentDrawer, type TrackDrawerProps as InstrumentDrawerProps, type InstrumentSampler, type InstrumentZone, type LLMCandidate, type LLMContent, type LLMFunctionDeclaration, type LLMGenerationConfig, type LLMGenerationRequest, type LLMGenerationResult, type LLMNoteResponse, type LLMPart, type LLMSystemInstruction, type LLMTool, type LLMToolUseRequest, type LLMToolUseResponse, type LLMUsageMetadata, LevelMeter, type LevelMeterProps, type ListAudioFilesOptions, type ListImportableTracksOptions, MIN_NOTE_DURATION_BEATS, type MidiClipData, type MidiWriteResult, type MixInterpolation, Modal, type ModalProps, type MotionKind, type MusicalContext, OffsetScrubber, type OffsetScrubberProps, PLUGIN_SDK_VERSION, PX_PER_BEAT, PanSlider, type PanelBusFxEntry, type PanelBusLevels, type PanelBusState, type PanelFeatureFlags, type PanelGenerationStrategy, type PanelGroupExtension, type PanelIdentity, PanelMasterStrip, type PanelMasterStripProps, type PanelShuffleAdapter, type PanelSoundAdapter, type PanelTransitionGroupAdapter, type ParsedEnsemble, type PeakAnalysis, PianoRollEditor, type PianoRollEditorProps, type PickTopKOptions, type PluginAppTool, type PluginAppToolInputSchema, type PluginAppToolResult, type PluginAudioTextureRequest, type PluginAudioTextureResult, type PluginCapabilities, type PluginChordSegment, type PluginChordTiming, type PluginConcurrentTrackInfo, type PluginCuePoints, type PluginDownloadOptions, PluginError, type PluginErrorCode, type PluginFileDialogOptions, type PluginFxCategoryDetailState, type PluginGenerationContext, type PluginGenerationContextOptions, type PluginHost, type PluginHttpRequestOptions, type PluginHttpResponse, type PluginManifest, type PluginMidiNote, type PluginPresetData, type PluginPresetInfo, type PluginRegistration, type PluginSampleFilter, type PluginSampleImportResult, type PluginSampleInfo, type PluginSampleTrackInfo, type PluginSceneContext, type PluginSceneInfo, type PluginSettingsSchema, type PluginSettingsStore, type PluginSkill, type PluginSkillInputSchema, type PluginStatus, type PluginStemSplitResult, type PluginStemTrackInfo, type PluginSynthInfo, type PluginTrackFxDetailState, type PluginTrackHandle, type PluginTrackInfo, type PluginTrackLevel, type PluginTrackRuntimeState, type PluginTransportState, type PluginTrimWindow, type PluginUIProps, type PostProcessOptions, RESIZE_HANDLE_PX, ROW_HEIGHT, type ReadMidiClip, type ReadMidiResult, type RecordingChunkFinalizedEvent, type RecordingTargetInfo, type ResolveGroupsOptions, type ResolvedCrossfadePair, type ResolvedFade, type ResolvedGroupFade, type ResolvedGroupsResult, type ResolvedTrackGroup, type SDKTrackRowProps, SLIDER_UNITY, STYLE_RULES, SUBMIT_ENSEMBLE_TOOL_NAME, SamplePackCTACard, type SamplePackCTACardProps, type SamplePackCTACardStatus, type SamplePackCardInfo, type SavePluginPresetOptions, type SceneChangeListener, type SceneFamilyTrack, type SceneTrackSummary, type ScoredCandidate, ScrollingWaveform, type ScrollingWaveformProps, type SettingDefinition, type ShufflePresetOptions, type ShufflePresetResult, SorceryProgressBar, type SoundHistoryEntry, type StemType, type SurgeSoundAdapterOverrides, type SynthesizeCuePointsOptions, TEXTURAL_ROLES, TRANSITION_DESIGNER_DRAFT_KEY, TrackDrawer, type TrackDrawerProps, type TrackExternalFxEntry, TrackExternalFxSection, type TrackExternalFxSectionProps, type TrackFxDetailState, type TrackFxState, type TrackGroupMember, type TrackGroupMeta, type TrackLevelsHandle, TrackMeterStrip, type TrackMeterStripProps, type TrackMeterView, TrackRow, type TrackRowDragProps, type TrackSoundHistory, type TrackSoundSnapshot, type TrackStateChangeListener, TransitionDesigner, type TransitionDesignerDraft, type TransitionDesignerProps, type TransitionOps, type TransitionRowType, type TransportEvent, type TransportEventListener, type UnsubscribeFn, type UseGeneratorPanelCoreOptions, type UsePanelBusResult, type UseSoundHistoryOptions, type UseSoundHistoryResult, type UseTrackExternalFxResult, type UseTrackReorderOptions, type UseTrackReorderResult, type UseTransitionOpsInputs, type VerbatimFadeMember, type VolumeAutomationPoint, VolumeSlider, type WaveformPeaks, WaveformView, type WaveformViewProps, analyzeEnsemble, analyzeWavPeak, asAudioEffect, asCrossfadeMeta, asFadeMeta, asTransitionDesignerDraft, buildCrossfadeInpaintPrompt, buildCrossfadeVolumeCurves, buildEnsembleSystemPrompt, buildFadeVolumeCurve, buildRowSlots, buildSubmitEnsembleParameters, buildViolationRetrySuffix, calculateTimeBasedTarget, cellToPx, centerScrollTop, computePeaks, createSurgeSoundAdapter, dbIdsFromKeys, dbToSlider, defaultFadeGesture, defaultVoiceSpecs, describeViolations, drawWaveform, effectivePxPerBeat, enforceVoice, foldPitchToRegister, formatConcurrentTracks, hashString, moveItem, nearestPitchWithPc, newTrackState, normalizeSlots, padPair, padSlots, parseCrossfadePairs, parseEnsembleArgs, parseFades, parseLLMNoteResponse, parseTrackGroups, pickTopKWeighted, pitchToName, pluginFxToToggleFx, promptEnterToGenerate, pxToCell, reconcileSlots, resizeNoteDuration, resolveTrackGroups, rowKey, rowType, scorePromptMatch, sliderToDb, slotsEqual, soundIdentity, splitFadeEntries, synthesizeCuePoints, tokenizePrompt, trackDataKey, transposeNotes, useAnySolo, useGeneratorPanelCore, usePanelBus, useSceneState, useSoundHistory, useTrackExternalFx, useTrackLevel, useTrackLevels, useTrackMeter, useTrackReorder, useTransitionOps, useTransportPlaying };
package/dist/index.js CHANGED
@@ -111,6 +111,7 @@ __export(index_exports, {
111
111
  defaultVoiceSpecs: () => defaultVoiceSpecs,
112
112
  describeViolations: () => describeViolations,
113
113
  drawWaveform: () => drawWaveform,
114
+ effectivePxPerBeat: () => effectivePxPerBeat,
114
115
  enforceVoice: () => enforceVoice,
115
116
  foldPitchToRegister: () => foldPitchToRegister,
116
117
  formatConcurrentTracks: () => formatConcurrentTracks,
@@ -129,6 +130,7 @@ __export(index_exports, {
129
130
  pickTopKWeighted: () => pickTopKWeighted,
130
131
  pitchToName: () => pitchToName,
131
132
  pluginFxToToggleFx: () => pluginFxToToggleFx,
133
+ promptEnterToGenerate: () => promptEnterToGenerate,
132
134
  pxToCell: () => pxToCell,
133
135
  reconcileSlots: () => reconcileSlots,
134
136
  resizeNoteDuration: () => resizeNoteDuration,
@@ -604,25 +606,31 @@ function clamp(v, lo, hi) {
604
606
  function snapLabel(s) {
605
607
  return SNAP_LABELS[String(s)] ?? `${s}`;
606
608
  }
609
+ function effectivePxPerBeat(containerWidth, totalBeats) {
610
+ if (totalBeats <= 0) return PX_PER_BEAT;
611
+ const available = containerWidth - GUTTER_W;
612
+ if (available <= 0) return PX_PER_BEAT;
613
+ return Math.max(PX_PER_BEAT, available / totalBeats);
614
+ }
607
615
  function pitchToName(pitch) {
608
616
  const name = NOTE_NAMES[(pitch % 12 + 12) % 12];
609
617
  const octave = Math.floor(pitch / 12) - 1;
610
618
  return `${name}${octave}`;
611
619
  }
612
- function cellToPx(pitch, startBeat, hi) {
613
- return { left: startBeat * PX_PER_BEAT, top: (hi - pitch) * ROW_HEIGHT };
620
+ function cellToPx(pitch, startBeat, hi, pxPerBeat = PX_PER_BEAT) {
621
+ return { left: startBeat * pxPerBeat, top: (hi - pitch) * ROW_HEIGHT };
614
622
  }
615
- function pxToCell(localX, localY, hi, snap, bars, beatsPerBar) {
623
+ function pxToCell(localX, localY, hi, snap, bars, beatsPerBar, pxPerBeat = PX_PER_BEAT) {
616
624
  const totalBeats = bars * beatsPerBar;
617
625
  const pitch = clamp(hi - Math.floor(localY / ROW_HEIGHT), 0, 127);
618
- const rawBeat = localX / PX_PER_BEAT;
626
+ const rawBeat = localX / pxPerBeat;
619
627
  const snapped = Math.round(rawBeat / snap) * snap;
620
628
  const startBeat = clamp(snapped, 0, Math.max(0, totalBeats - snap));
621
629
  return { pitch, startBeat };
622
630
  }
623
- function resizeNoteDuration(startBeat, localX, snap, bars, beatsPerBar) {
631
+ function resizeNoteDuration(startBeat, localX, snap, bars, beatsPerBar, pxPerBeat = PX_PER_BEAT) {
624
632
  const totalBeats = bars * beatsPerBar;
625
- const snappedEnd = Math.round(localX / PX_PER_BEAT / snap) * snap;
633
+ const snappedEnd = Math.round(localX / pxPerBeat / snap) * snap;
626
634
  const end = clamp(snappedEnd, startBeat + snap, totalBeats);
627
635
  return end - startBeat;
628
636
  }
@@ -673,7 +681,19 @@ function PianoRollEditor({
673
681
  }, [autoFit, notes, minPitch, maxPitch]);
674
682
  const rowCount = hi - lo + 1;
675
683
  const totalBeats = bars * beatsPerBar;
676
- const gridWidth = totalBeats * PX_PER_BEAT;
684
+ const [containerW, setContainerW] = (0, import_react.useState)(0);
685
+ (0, import_react.useLayoutEffect)(() => {
686
+ const el = scrollRef.current;
687
+ if (!el) return;
688
+ const measure = () => setContainerW(el.clientWidth);
689
+ measure();
690
+ if (typeof ResizeObserver === "undefined") return void 0;
691
+ const ro = new ResizeObserver(measure);
692
+ ro.observe(el);
693
+ return () => ro.disconnect();
694
+ }, []);
695
+ const pxPerBeat = effectivePxPerBeat(containerW, totalBeats);
696
+ const gridWidth = totalBeats * pxPerBeat;
677
697
  const gridHeight = rowCount * ROW_HEIGHT;
678
698
  const stateRef = (0, import_react.useRef)({
679
699
  notes,
@@ -685,7 +705,8 @@ function PianoRollEditor({
685
705
  defaultVelocity,
686
706
  bpm,
687
707
  onAuditionNote,
688
- disabled
708
+ disabled,
709
+ pxPerBeat
689
710
  });
690
711
  stateRef.current = {
691
712
  notes,
@@ -697,7 +718,8 @@ function PianoRollEditor({
697
718
  defaultVelocity,
698
719
  bpm,
699
720
  onAuditionNote,
700
- disabled
721
+ disabled,
722
+ pxPerBeat
701
723
  };
702
724
  const localCoords = (0, import_react.useCallback)((clientX, clientY) => {
703
725
  const rect = gridRef.current?.getBoundingClientRect();
@@ -733,14 +755,14 @@ function PianoRollEditor({
733
755
  if (drag.mode === "resize") {
734
756
  const note = s.notes[drag.index];
735
757
  if (!note) return;
736
- const durationBeats = resizeNoteDuration(note.startBeat, x, s.snapState, s.bars, s.beatsPerBar);
758
+ const durationBeats = resizeNoteDuration(note.startBeat, x, s.snapState, s.bars, s.beatsPerBar, s.pxPerBeat);
737
759
  if (durationBeats === note.durationBeats) return;
738
760
  const next2 = s.notes.map((n, i) => i === drag.index ? { ...n, durationBeats } : n);
739
761
  s.onChange(next2);
740
762
  return;
741
763
  }
742
764
  if (drag.mode !== "drag") return;
743
- const { pitch, startBeat } = pxToCell(x, y, s.hi, s.snapState, s.bars, s.beatsPerBar);
765
+ const { pitch, startBeat } = pxToCell(x, y, s.hi, s.snapState, s.bars, s.beatsPerBar, s.pxPerBeat);
744
766
  const next = s.notes.map((n, i) => i === drag.index ? { ...n, pitch, startBeat } : n);
745
767
  s.onChange(next);
746
768
  }, [localCoords]);
@@ -756,7 +778,7 @@ function PianoRollEditor({
756
778
  }
757
779
  if (drag.mode === "pending-add") {
758
780
  const { x, y } = localCoords(e.clientX, e.clientY);
759
- const { pitch, startBeat } = pxToCell(x, y, s.hi, s.snapState, s.bars, s.beatsPerBar);
781
+ const { pitch, startBeat } = pxToCell(x, y, s.hi, s.snapState, s.bars, s.beatsPerBar, s.pxPerBeat);
760
782
  const note = {
761
783
  pitch,
762
784
  startBeat,
@@ -805,14 +827,14 @@ function PianoRollEditor({
805
827
  return out;
806
828
  }, [hi, lo]);
807
829
  const gridBg = (0, import_react.useMemo)(() => {
808
- const beatPx = PX_PER_BEAT;
809
- const barPx = PX_PER_BEAT * beatsPerBar;
830
+ const beatPx = pxPerBeat;
831
+ const barPx = pxPerBeat * beatsPerBar;
810
832
  return [
811
833
  `repeating-linear-gradient(to right, transparent 0 ${beatPx - 1}px, rgba(255,255,255,0.06) ${beatPx - 1}px ${beatPx}px)`,
812
834
  `repeating-linear-gradient(to right, transparent 0 ${barPx - 1}px, rgba(255,255,255,0.16) ${barPx - 1}px ${barPx}px)`,
813
835
  `repeating-linear-gradient(to bottom, transparent 0 ${ROW_HEIGHT - 1}px, rgba(255,255,255,0.04) ${ROW_HEIGHT - 1}px ${ROW_HEIGHT}px)`
814
836
  ].join(", ");
815
- }, [beatsPerBar]);
837
+ }, [beatsPerBar, pxPerBeat]);
816
838
  const octaveDisabled = disabled || notes.length === 0;
817
839
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `flex flex-col gap-1 ${className ?? ""}`, "data-testid": testId, children: [
818
840
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center gap-1", "data-testid": "sdk-pr-toolbar", children: [
@@ -906,8 +928,8 @@ function PianoRollEditor({
906
928
  onPointerCancel: handlePointerCancel,
907
929
  children: [
908
930
  notes.map((n, i) => {
909
- const { left, top } = cellToPx(n.pitch, n.startBeat, hi);
910
- const width = Math.max(3, n.durationBeats * PX_PER_BEAT);
931
+ const { left, top } = cellToPx(n.pitch, n.startBeat, hi, pxPerBeat);
932
+ const width = Math.max(3, n.durationBeats * pxPerBeat);
911
933
  const handleW = Math.min(RESIZE_HANDLE_PX, width / 2);
912
934
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
913
935
  "div",
@@ -2385,6 +2407,71 @@ function SorceryProgressBar({
2385
2407
  );
2386
2408
  }
2387
2409
 
2410
+ // src/panel-core/panel-helpers.ts
2411
+ function promptEnterToGenerate(generate, disabled = false) {
2412
+ return (e) => {
2413
+ if (e.key === "Enter" && !e.shiftKey && !disabled) {
2414
+ e.preventDefault();
2415
+ generate();
2416
+ }
2417
+ };
2418
+ }
2419
+ function trackDataKey(dbId, suffix) {
2420
+ return `track:${dbId}:${suffix}`;
2421
+ }
2422
+ function pluginFxToToggleFx(sdkState) {
2423
+ const result = { ...EMPTY_FX_DETAIL_STATE };
2424
+ for (const category of ["eq", "compressor", "chorus", "phaser", "delay", "reverb"]) {
2425
+ const sdkCat = sdkState[category];
2426
+ if (sdkCat) {
2427
+ result[category] = {
2428
+ enabled: sdkCat.enabled,
2429
+ presetIndex: sdkCat.presetIndex,
2430
+ dryWet: sdkCat.dryWet
2431
+ };
2432
+ }
2433
+ }
2434
+ return result;
2435
+ }
2436
+ function parseLLMNoteResponse(content) {
2437
+ try {
2438
+ let jsonStr = content.trim();
2439
+ const fenceMatch = jsonStr.match(/```(?:json)?\s*\n?([\s\S]*?)```/);
2440
+ if (fenceMatch) {
2441
+ jsonStr = fenceMatch[1].trim();
2442
+ }
2443
+ const parsed = JSON.parse(jsonStr);
2444
+ if (typeof parsed !== "object" || parsed === null || !("notes" in parsed)) {
2445
+ return null;
2446
+ }
2447
+ const obj = parsed;
2448
+ if (!Array.isArray(obj.notes)) {
2449
+ return null;
2450
+ }
2451
+ const validNotes = [];
2452
+ for (const raw of obj.notes) {
2453
+ if (typeof raw !== "object" || raw === null) continue;
2454
+ const note = raw;
2455
+ const pitch = typeof note.pitch === "number" ? note.pitch : NaN;
2456
+ const startBeat = typeof note.startBeat === "number" ? note.startBeat : NaN;
2457
+ const durationBeats = typeof note.durationBeats === "number" ? note.durationBeats : NaN;
2458
+ const velocity = typeof note.velocity === "number" ? note.velocity : NaN;
2459
+ if (!isNaN(pitch) && pitch >= 0 && pitch <= 127 && !isNaN(startBeat) && startBeat >= 0 && !isNaN(durationBeats) && durationBeats > 0 && !isNaN(velocity) && velocity >= 1 && velocity <= 127) {
2460
+ validNotes.push({
2461
+ pitch: Math.round(pitch),
2462
+ startBeat,
2463
+ durationBeats,
2464
+ velocity: Math.round(velocity)
2465
+ });
2466
+ }
2467
+ }
2468
+ const role = typeof obj.role === "string" ? obj.role : void 0;
2469
+ return { notes: validNotes, role };
2470
+ } catch {
2471
+ return null;
2472
+ }
2473
+ }
2474
+
2388
2475
  // src/components/TrackRow.tsx
2389
2476
  var import_jsx_runtime12 = require("react/jsx-runtime");
2390
2477
  function TrackRow({
@@ -2453,12 +2540,7 @@ function TrackRow({
2453
2540
  );
2454
2541
  const fxTabOpen = drawerOpen && drawerTab === "fx";
2455
2542
  const soundTabOpen = drawerOpen && drawerTab !== "fx";
2456
- const handleKeyDown = (e) => {
2457
- if (e.key === "Enter" && !e.shiftKey && onGenerate) {
2458
- e.preventDefault();
2459
- onGenerate();
2460
- }
2461
- };
2543
+ const handleKeyDown = promptEnterToGenerate(() => onGenerate?.(), !onGenerate);
2462
2544
  const borderColorStyle = needsGeneration ? void 0 : accentColor;
2463
2545
  const borderClass = needsGeneration ? "border-amber-400 animate-pulse" : "border-sas-border";
2464
2546
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { "data-testid": "sdk-track-row-wrapper", className: "w-full", ...drag?.rowProps ?? {}, children: [
@@ -6046,63 +6128,6 @@ function newTrackState(handle, overrides = {}) {
6046
6128
  };
6047
6129
  }
6048
6130
 
6049
- // src/panel-core/panel-helpers.ts
6050
- function trackDataKey(dbId, suffix) {
6051
- return `track:${dbId}:${suffix}`;
6052
- }
6053
- function pluginFxToToggleFx(sdkState) {
6054
- const result = { ...EMPTY_FX_DETAIL_STATE };
6055
- for (const category of ["eq", "compressor", "chorus", "phaser", "delay", "reverb"]) {
6056
- const sdkCat = sdkState[category];
6057
- if (sdkCat) {
6058
- result[category] = {
6059
- enabled: sdkCat.enabled,
6060
- presetIndex: sdkCat.presetIndex,
6061
- dryWet: sdkCat.dryWet
6062
- };
6063
- }
6064
- }
6065
- return result;
6066
- }
6067
- function parseLLMNoteResponse(content) {
6068
- try {
6069
- let jsonStr = content.trim();
6070
- const fenceMatch = jsonStr.match(/```(?:json)?\s*\n?([\s\S]*?)```/);
6071
- if (fenceMatch) {
6072
- jsonStr = fenceMatch[1].trim();
6073
- }
6074
- const parsed = JSON.parse(jsonStr);
6075
- if (typeof parsed !== "object" || parsed === null || !("notes" in parsed)) {
6076
- return null;
6077
- }
6078
- const obj = parsed;
6079
- if (!Array.isArray(obj.notes)) {
6080
- return null;
6081
- }
6082
- const validNotes = [];
6083
- for (const raw of obj.notes) {
6084
- if (typeof raw !== "object" || raw === null) continue;
6085
- const note = raw;
6086
- const pitch = typeof note.pitch === "number" ? note.pitch : NaN;
6087
- const startBeat = typeof note.startBeat === "number" ? note.startBeat : NaN;
6088
- const durationBeats = typeof note.durationBeats === "number" ? note.durationBeats : NaN;
6089
- const velocity = typeof note.velocity === "number" ? note.velocity : NaN;
6090
- if (!isNaN(pitch) && pitch >= 0 && pitch <= 127 && !isNaN(startBeat) && startBeat >= 0 && !isNaN(durationBeats) && durationBeats > 0 && !isNaN(velocity) && velocity >= 1 && velocity <= 127) {
6091
- validNotes.push({
6092
- pitch: Math.round(pitch),
6093
- startBeat,
6094
- durationBeats,
6095
- velocity: Math.round(velocity)
6096
- });
6097
- }
6098
- }
6099
- const role = typeof obj.role === "string" ? obj.role : void 0;
6100
- return { notes: validNotes, role };
6101
- } catch {
6102
- return null;
6103
- }
6104
- }
6105
-
6106
6131
  // src/panel-core/group-meta.ts
6107
6132
  function parseTrackGroups(sceneData, spec) {
6108
6133
  const pattern = new RegExp(`^track:(.+):${spec.metaKey}$`);
@@ -9286,6 +9311,7 @@ function pickTopKWeighted(scored, options = {}) {
9286
9311
  defaultVoiceSpecs,
9287
9312
  describeViolations,
9288
9313
  drawWaveform,
9314
+ effectivePxPerBeat,
9289
9315
  enforceVoice,
9290
9316
  foldPitchToRegister,
9291
9317
  formatConcurrentTracks,
@@ -9304,6 +9330,7 @@ function pickTopKWeighted(scored, options = {}) {
9304
9330
  pickTopKWeighted,
9305
9331
  pitchToName,
9306
9332
  pluginFxToToggleFx,
9333
+ promptEnterToGenerate,
9307
9334
  pxToCell,
9308
9335
  reconcileSlots,
9309
9336
  resizeNoteDuration,