@sogni-ai/sogni-client 5.34.1 → 5.35.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.
@@ -68,6 +68,7 @@ import {
68
68
  isAudioModel,
69
69
  isModelArtifactModel,
70
70
  isMinimaxH3ReferenceModel,
71
+ isSegmentationModel,
71
72
  isVideoModel,
72
73
  usesReferenceMask
73
74
  } from './utils/index.js';
@@ -1350,11 +1351,11 @@ class ProjectsApi extends ApiGroup<ProjectApiEvents> {
1350
1351
  * @param data
1351
1352
  */
1352
1353
  async create(data: ProjectParams): Promise<Project> {
1353
- // SAM3 is a one-source/one-mask utility workflow. Normalize before Project
1354
- // construction so lifecycle completion and result MIME use the same values
1355
- // as the serialized request.
1354
+ // Segmentation is a one-source/one-mask utility workflow, SAM 3 and
1355
+ // BiRefNet alike. Normalize before Project construction so lifecycle
1356
+ // completion and result MIME use the same values as the serialized request.
1356
1357
  let normalizedData =
1357
- data.type === 'image' && data.modelId === 'sam3_image_segment_bf16'
1358
+ data.type === 'image' && isSegmentationModel(data.modelId)
1358
1359
  ? ({
1359
1360
  ...data,
1360
1361
  numberOfMedia: 1,
@@ -675,7 +675,26 @@ export interface Sam3ImagePrompt {
675
675
  * is far heavier than a real-time engine wants, so asking for less yields a
676
676
  * more useful asset.
677
677
  */
678
+ /**
679
+ * Which Pixal3D reconstruction graph to run.
680
+ *
681
+ * ComfyUI registers two under the one workflow id. `i23d-birefnet` is the
682
+ * default: it isolates the subject with BiRefNet and takes no prompt.
683
+ * `i23d` is the prompted graph, where `positivePrompt` names the object to
684
+ * reconstruct rather than describing how it should look.
685
+ *
686
+ * Both cost the same and accept the same options. Leave it unset to let the
687
+ * worker run its own default, which is what every caller wants unless it
688
+ * specifically needs the prompted path.
689
+ */
690
+ export type Pixal3dTemplateVariant = 'i23d-birefnet' | 'i23d';
691
+
678
692
  export interface Pixal3dGenerationOptions {
693
+ /**
694
+ * Which reconstruction graph to run. Unset means the worker's own default.
695
+ * `i23d` requires `positivePrompt`.
696
+ */
697
+ templateVariant?: Pixal3dTemplateVariant;
679
698
  /** Base-colour bake and UV atlas resolution, 1024 to 4096. Default 4096. */
680
699
  textureSize?: number;
681
700
  /** Decimation target in triangles, 5000 to 700000. Default 700000. */
@@ -721,6 +740,19 @@ export interface ImageProjectParams extends BaseProjectParams, Pixal3dGeneration
721
740
  * `startingImage`; one source image produces one lossless binary PNG mask.
722
741
  */
723
742
  sam3Prompt?: Sam3ImagePrompt;
743
+ /**
744
+ * Return an RGBA cutout instead of the bare mask.
745
+ *
746
+ * Only for `birefnet_image_background_removal_fp16`, which requires a
747
+ * `startingImage` and takes no prompt. Left unset (the default) the job
748
+ * returns the foreground matte at the source dimensions; set, it returns the
749
+ * source image carrying that matte as its alpha channel, so the mask is still
750
+ * recoverable from the artifact.
751
+ *
752
+ * SAM 3 has its own `applyMask`, inside `sam3Prompt`. They are different
753
+ * fields on different models and are not interchangeable.
754
+ */
755
+ applyMask?: boolean;
724
756
  /**
725
757
  * How strong effect of starting image should be. From 0 to 1, default 0.5
726
758
  */
@@ -99,6 +99,9 @@ export const PIXAL3D_IMAGE_TO_3D_MODEL_ID = 'pixal3d_int8_i23d';
99
99
  /** Canonical id of the SAM 3 interactive image-segmentation workflow. */
100
100
  export const SAM3_IMAGE_SEGMENT_MODEL_ID = 'sam3_image_segment_bf16';
101
101
 
102
+ /** Canonical id of the standalone BiRefNet background-removal workflow. */
103
+ export const BIREFNET_BACKGROUND_REMOVAL_MODEL_ID = 'birefnet_image_background_removal_fp16';
104
+
102
105
  /** Check if a model returns a downloadable 3D model artifact. */
103
106
  export function isModelArtifactModel(modelId: string): boolean {
104
107
  return modelId.startsWith('pixal3d_');
@@ -110,9 +113,16 @@ export function isModelArtifactModel(modelId: string): boolean {
110
113
  * Segmentation returns a lossless mask PNG the same size as the source, not a
111
114
  * new image, so callers must not treat it as a generated result: it has no
112
115
  * meaningful prompt-to-pixels relationship and is not enhanceable.
116
+ *
117
+ * BiRefNet counts. It reaches the same artifact with no prompt at all, and its
118
+ * cutout branch is that mask carried as an alpha channel, so every consumer
119
+ * that hides a mask from a gallery, refuses to enhance one, or requires a
120
+ * source image has to treat it exactly as it treats SAM 3.
113
121
  */
114
122
  export function isSegmentationModel(modelId: string): boolean {
115
- return modelId === SAM3_IMAGE_SEGMENT_MODEL_ID;
123
+ return (
124
+ modelId === SAM3_IMAGE_SEGMENT_MODEL_ID || modelId === BIREFNET_BACKGROUND_REMOVAL_MODEL_ID
125
+ );
116
126
  }
117
127
 
118
128
  /**
package/src/index.ts CHANGED
@@ -24,6 +24,7 @@ import { DefaultLogger, Logger, LogLevel } from './lib/DefaultLogger.js';
24
24
  import EIP712Helper from './lib/EIP712Helper.js';
25
25
  // Projects API
26
26
  import {
27
+ BIREFNET_BACKGROUND_REMOVAL_MODEL_ID,
27
28
  PIXAL3D_IMAGE_TO_3D_MODEL_ID,
28
29
  SAM3_IMAGE_SEGMENT_MODEL_ID,
29
30
  isAudioModel,
@@ -43,6 +44,7 @@ import {
43
44
  ImageProjectParams,
44
45
  ImageOutputFormat,
45
46
  Pixal3dGenerationOptions,
47
+ Pixal3dTemplateVariant,
46
48
  Sam3ImagePrompt,
47
49
  Sam3PromptBox,
48
50
  Sam3PromptPoint,
@@ -291,6 +293,7 @@ export type {
291
293
  ImageProjectParams,
292
294
  ImageOutputFormat,
293
295
  Pixal3dGenerationOptions,
296
+ Pixal3dTemplateVariant,
294
297
  Sam3ImagePrompt,
295
298
  Sam3PromptBox,
296
299
  Sam3PromptPoint,
@@ -418,6 +421,7 @@ export type {
418
421
  };
419
422
 
420
423
  export {
424
+ BIREFNET_BACKGROUND_REMOVAL_MODEL_ID,
421
425
  PIXAL3D_IMAGE_TO_3D_MODEL_ID,
422
426
  SAM3_IMAGE_SEGMENT_MODEL_ID,
423
427
  isAudioModel,
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED by scripts/generate-version.mjs — do not edit.
2
2
  // Source of truth: package.json version.
3
- export const LIB_VERSION = '5.34.1';
3
+ export const LIB_VERSION = '5.35.0';