@signalsandsorcery/plugin-sdk 2.35.6 → 2.35.7

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
@@ -4922,6 +4922,13 @@ interface PanelTransitionGroupAdapter {
4922
4922
  /** Group-fade row header label, e.g. `Bassline (3 voices)`. Default `Group (N tracks)`. */
4923
4923
  groupRowLabel?(memberCount: number): string;
4924
4924
  }
4925
+ /** What `onTrackCreated` gets to work with (Add Track is scene-gated, so the scene is non-null). */
4926
+ interface TrackCreatedContext {
4927
+ /** Scene the track was created in. */
4928
+ activeSceneId: string;
4929
+ /** The ONE scene-data key builder (always dbId-based). */
4930
+ trackDataKey: (dbId: string, suffix: string) => string;
4931
+ }
4925
4932
  interface GeneratorPanelAdapter<M = unknown> {
4926
4933
  identity: PanelIdentity;
4927
4934
  features: PanelFeatureFlags;
@@ -4932,6 +4939,18 @@ interface GeneratorPanelAdapter<M = unknown> {
4932
4939
  * Synth: `host.shufflePreset(handle.id)` non-fatal.
4933
4940
  */
4934
4941
  applyPortedTrackSound(handle: PluginTrackHandle, role?: string): Promise<void>;
4942
+ /**
4943
+ * Optional hook run right after a track is born (Add Track / Import Track).
4944
+ * Lets a family stamp per-track scene-data on the newborn — e.g. the arp
4945
+ * panel anchors every new track as a voice-group of ONE so the group
4946
+ * header's intent controls (voice count / rate / split) exist BEFORE the
4947
+ * first generation instead of appearing only after it (which wasted a
4948
+ * throwaway generation on defaults). The core reloads tracks after the hook
4949
+ * so stamped group metas resolve immediately. Failures are non-fatal — the
4950
+ * track lands as a plain row.
4951
+ * @since SDK 2.43.0
4952
+ */
4953
+ onTrackCreated?(handle: PluginTrackHandle, ctx: TrackCreatedContext): Promise<void>;
4935
4954
  /** System prompt for the family's LLM calls (incl. core-owned crossfade/fade generation). */
4936
4955
  buildSystemPrompt(validRoles: readonly string[]): string;
4937
4956
  /** Parse the family's LLM note responses (crossfade/fade flows). */
@@ -5476,7 +5495,7 @@ declare function useAnySolo(host: Pick<PluginHost, 'isAnySoloActive' | 'onTrackS
5476
5495
  * Registry checks semver.gte(PLUGIN_SDK_VERSION, manifest.minHostVersion)
5477
5496
  * during activation and marks incompatible plugins accordingly.
5478
5497
  */
5479
- declare const PLUGIN_SDK_VERSION = "2.42.0";
5498
+ declare const PLUGIN_SDK_VERSION = "2.43.0";
5480
5499
 
5481
5500
  /**
5482
5501
  * FX Preset Definitions
package/dist/index.d.ts CHANGED
@@ -4922,6 +4922,13 @@ interface PanelTransitionGroupAdapter {
4922
4922
  /** Group-fade row header label, e.g. `Bassline (3 voices)`. Default `Group (N tracks)`. */
4923
4923
  groupRowLabel?(memberCount: number): string;
4924
4924
  }
4925
+ /** What `onTrackCreated` gets to work with (Add Track is scene-gated, so the scene is non-null). */
4926
+ interface TrackCreatedContext {
4927
+ /** Scene the track was created in. */
4928
+ activeSceneId: string;
4929
+ /** The ONE scene-data key builder (always dbId-based). */
4930
+ trackDataKey: (dbId: string, suffix: string) => string;
4931
+ }
4925
4932
  interface GeneratorPanelAdapter<M = unknown> {
4926
4933
  identity: PanelIdentity;
4927
4934
  features: PanelFeatureFlags;
@@ -4932,6 +4939,18 @@ interface GeneratorPanelAdapter<M = unknown> {
4932
4939
  * Synth: `host.shufflePreset(handle.id)` non-fatal.
4933
4940
  */
4934
4941
  applyPortedTrackSound(handle: PluginTrackHandle, role?: string): Promise<void>;
4942
+ /**
4943
+ * Optional hook run right after a track is born (Add Track / Import Track).
4944
+ * Lets a family stamp per-track scene-data on the newborn — e.g. the arp
4945
+ * panel anchors every new track as a voice-group of ONE so the group
4946
+ * header's intent controls (voice count / rate / split) exist BEFORE the
4947
+ * first generation instead of appearing only after it (which wasted a
4948
+ * throwaway generation on defaults). The core reloads tracks after the hook
4949
+ * so stamped group metas resolve immediately. Failures are non-fatal — the
4950
+ * track lands as a plain row.
4951
+ * @since SDK 2.43.0
4952
+ */
4953
+ onTrackCreated?(handle: PluginTrackHandle, ctx: TrackCreatedContext): Promise<void>;
4935
4954
  /** System prompt for the family's LLM calls (incl. core-owned crossfade/fade generation). */
4936
4955
  buildSystemPrompt(validRoles: readonly string[]): string;
4937
4956
  /** Parse the family's LLM note responses (crossfade/fade flows). */
@@ -5476,7 +5495,7 @@ declare function useAnySolo(host: Pick<PluginHost, 'isAnySoloActive' | 'onTrackS
5476
5495
  * Registry checks semver.gte(PLUGIN_SDK_VERSION, manifest.minHostVersion)
5477
5496
  * during activation and marks incompatible plugins accordingly.
5478
5497
  */
5479
- declare const PLUGIN_SDK_VERSION = "2.42.0";
5498
+ declare const PLUGIN_SDK_VERSION = "2.43.0";
5480
5499
 
5481
5500
  /**
5482
5501
  * FX Preset Definitions
package/dist/index.js CHANGED
@@ -7178,6 +7178,14 @@ function useGeneratorPanelCore({
7178
7178
  ...adapter.createTrackOptions()
7179
7179
  });
7180
7180
  setTracks((prev) => [...prev, newTrackState(handle)]);
7181
+ if (adapter.onTrackCreated) {
7182
+ try {
7183
+ await adapter.onTrackCreated(handle, { activeSceneId, trackDataKey });
7184
+ } catch (err) {
7185
+ console.warn(`[${logTag}] onTrackCreated failed (non-fatal):`, err);
7186
+ }
7187
+ await loadTracks(true);
7188
+ }
7181
7189
  onExpandSelf?.();
7182
7190
  setTimeout(() => {
7183
7191
  const inputs = document.querySelectorAll(
@@ -7194,7 +7202,7 @@ function useGeneratorPanelCore({
7194
7202
  isAddingTrackRef.current = false;
7195
7203
  setIsAddingTrack(false);
7196
7204
  }
7197
- }, [host, adapter, identity, activeSceneId, isConnected, isAuthenticated, tracks.length, onExpandSelf]);
7205
+ }, [host, adapter, identity, activeSceneId, isConnected, isAuthenticated, tracks.length, onExpandSelf, loadTracks, logTag]);
7198
7206
  const handlePortTrack = (0, import_react30.useCallback)(
7199
7207
  async (sel) => {
7200
7208
  if (!activeSceneId) {
@@ -7234,6 +7242,12 @@ function useGeneratorPanelCore({
7234
7242
  });
7235
7243
  }
7236
7244
  await adapter.applyPortedTrackSound(handle, sel.role);
7245
+ if (adapter.onTrackCreated) {
7246
+ try {
7247
+ await adapter.onTrackCreated(handle, { activeSceneId, trackDataKey });
7248
+ } catch {
7249
+ }
7250
+ }
7237
7251
  host.showToast(
7238
7252
  "success",
7239
7253
  `Imported to ${identity.familyKey}`,
@@ -9034,7 +9048,7 @@ Your previous ensemble had these problems \u2014 fix them while keeping everythi
9034
9048
  }
9035
9049
 
9036
9050
  // src/constants/sdk-version.ts
9037
- var PLUGIN_SDK_VERSION = "2.42.0";
9051
+ var PLUGIN_SDK_VERSION = "2.43.0";
9038
9052
 
9039
9053
  // src/utils/format-concurrent-tracks.ts
9040
9054
  function formatConcurrentTracks(ctx) {