@layer_ai/sdk 1.0.4 → 1.0.6

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.
@@ -42,6 +42,8 @@ export interface BaseModelCapabilitiesREST {
42
42
  duration_seconds_max?: number | null;
43
43
  /** This model has no default clip length; without duration_seconds the shortest is used. */
44
44
  duration_seconds_required?: boolean;
45
+ /** Quality rungs this model offers, lowest first, from minimal, low, medium, high, xhigh, max. Empty means the model has no quality control. Pass one of these as `quality`; a rung outside the list is clamped to the nearest one offered rather than refused. Higher rungs can cost more — price a run before spending on one. */
46
+ quality_levels?: Array<string>;
45
47
  generate_audio?: boolean;
46
48
  lipsync?: boolean;
47
49
  textures?: boolean;
@@ -590,6 +592,8 @@ export interface ExecuteInferenceV2Output {
590
592
  reference_sets_degraded?: boolean;
591
593
  /** Names each degraded reference set and why, or null when none is degraded. */
592
594
  reference_sets_warning?: string | null;
595
+ /** Deliveries this run will produce, resolved when it was submitted. Empty when no webhook was supplied. A generation reports its own outcome, and additionally produces a scoring run when this scope has automatic scoring rules — so this is how to tell 'more is coming' from 'that was everything'. Best-effort: a rule turned off mid-run can still remove an event listed here. */
596
+ expected_events?: Array<WebhookEventType>;
593
597
  }
594
598
  /** REST request body for executing an inference. workspace_id comes from path. */
595
599
  export interface ExecuteInferenceV2Request {
@@ -689,6 +693,8 @@ export interface ExecuteInferenceV2Request {
689
693
  mask?: ForgeMaskInput | null;
690
694
  /** Session name. */
691
695
  session_name?: string | null;
696
+ /** Deliver this run's terminal events to a URL instead of polling for them. See the Webhooks section of this document for the payload, headers and retry behaviour. */
697
+ webhook?: WebhookInput | null;
692
698
  }
693
699
  export interface ExecuteWorkflowOutput {
694
700
  /** Unique identifier for this workflow run. */
@@ -703,6 +709,8 @@ export interface ExecuteWorkflowOutput {
703
709
  created_at: string;
704
710
  /** Session ID the run was added to, if a session was specified. */
705
711
  session_id?: string | null;
712
+ /** Deliveries this run will produce. Empty when no webhook was supplied. */
713
+ expected_events?: Array<WebhookEventType>;
706
714
  }
707
715
  export interface ExecuteWorkflowRequest {
708
716
  /** Input values matching the workflow's input schema. */
@@ -711,6 +719,8 @@ export interface ExecuteWorkflowRequest {
711
719
  session_id?: string | null;
712
720
  /** Session name. Creates a new session if not found in the workspace. Ignored if session_id is set. */
713
721
  session_name?: string | null;
722
+ /** Deliver this run's terminal events to a URL instead of polling for them. Only the run's own outcome is delivered — the generations it performs internally are not yours to poll and raise no events of their own. See the Webhooks section of this document for the payload, headers and retry behaviour. */
723
+ webhook?: WebhookInput | null;
714
724
  }
715
725
  export interface FileScore {
716
726
  /** The rule that produced this verdict. */
@@ -842,6 +852,8 @@ export interface GetInferenceRunV2Output {
842
852
  reference_sets_degraded?: boolean;
843
853
  /** Names each degraded reference set and why, or null when none is degraded. */
844
854
  reference_sets_warning?: string | null;
855
+ /** The callback attached to this run and how its delivery has gone. Null when the run was submitted without one. */
856
+ webhook?: WebhookStatusView | null;
845
857
  }
846
858
  export interface GetModelRESTOutput {
847
859
  model: ModelDetailREST;
@@ -863,6 +875,34 @@ export interface GetReferenceSetOutput {
863
875
  /** Attached files, ordered by index. */
864
876
  files?: Array<ReferenceSetFile>;
865
877
  }
878
+ export interface GetScoringRunOutput {
879
+ /** Unique identifier for this scoring run. */
880
+ scoring_run_id: string;
881
+ /** Current status: pending, complete, or failed. */
882
+ status: ScoringRunStatus;
883
+ /** The generation whose outputs this run judged, when it was started automatically. */
884
+ inference_id?: string | null;
885
+ /** Suggested polling interval in seconds. Present while pending. */
886
+ poll_interval_seconds?: number | null;
887
+ /** How many (file, rule) pairs the run set out to judge. */
888
+ requested_pair_count: number;
889
+ /** How many produced a verdict. Lower than requested means some pairs went unjudged. */
890
+ completed_pair_count: number;
891
+ /** The files the run was asked to judge. */
892
+ file_ids?: Array<string>;
893
+ /** The rules the run judged against. */
894
+ rule_ids?: Array<string>;
895
+ /** The verdicts recorded. Present once the run is complete. */
896
+ scores?: Array<ScoringRunFileScore> | null;
897
+ /** When the run settled. Present once terminal. */
898
+ finished_at?: string | null;
899
+ /** Error message. Present only on failed. */
900
+ error?: string | null;
901
+ /** Machine-readable error code. Present only on failed. */
902
+ error_code?: string | null;
903
+ /** The callback attached to this run and how its delivery has gone. Null when the run was submitted without one. */
904
+ webhook?: WebhookStatusView | null;
905
+ }
866
906
  export interface GetTrainingRunResponse {
867
907
  training_run_id: string;
868
908
  /** in_progress, terminal_success, or terminal_failure. */
@@ -881,6 +921,8 @@ export interface GetTrainingRunResponse {
881
921
  error?: string | null;
882
922
  /** Machine-readable error code. Present on terminal_failure. */
883
923
  error_code?: string | null;
924
+ /** The callback attached to this run and how its delivery has gone. Null when the run was submitted without one. */
925
+ webhook?: WebhookStatusView | null;
884
926
  }
885
927
  export interface GetWorkflowRunOutput {
886
928
  /** Unique identifier for this workflow run. */
@@ -903,6 +945,8 @@ export interface GetWorkflowRunOutput {
903
945
  error?: string | null;
904
946
  /** Machine-readable error code. Present only on FAILURE. Balance-related values: `BlueprintInsufficientBalanceError` (the workspace ran out of Creative Units — top up and resubmit) and `BlueprintBalanceUnavailableError` (the balance could not be verified — retry later). */
905
947
  error_code?: string | null;
948
+ /** The callback attached to this run and how its delivery has gone. Null when the run was submitted without one. */
949
+ webhook?: WebhookStatusView | null;
906
950
  }
907
951
  export interface GetWorkflowRunStep {
908
952
  /** The name of the workflow step */
@@ -943,6 +987,9 @@ export interface GroupOut {
943
987
  * type, because it is not the same slot.
944
988
  */
945
989
  export type GuidanceFileType = "init_image" | "reference_image" | "scribble" | "color_sketch" | "pose" | "depth" | "canny" | "softedge_hed" | "segmentation" | "lineart" | "face" | "ip_adapter" | "first_frame" | "last_frame" | "init_video" | "reference_video" | "init_mesh" | "texture_image" | "element_frontal_image" | "element_reference_image" | "element_video" | "init_audio" | "reference_audio";
990
+ export interface HTTPValidationError {
991
+ detail?: Array<ValidationError>;
992
+ }
946
993
  export interface InferenceReferenceSetInput {
947
994
  /** Reference set ID from GET /v2/workspaces/{workspace_id}/reference-sets. */
948
995
  set_id: string;
@@ -951,6 +998,19 @@ export interface InferenceReferenceSetInput {
951
998
  }
952
999
  export type InferenceStatus = "in_progress" | "complete" | "failed" | "cancelled" | "deleted";
953
1000
  export type InferenceUseCase = "text_to_image" | "image_editing" | "multi_angle" | "inpainting" | "reframing" | "split_into_layers" | "text_to_video" | "image_to_video" | "video_editing" | "video_extend" | "video_subtitle" | "video_lipsync" | "image_to_video_lipsync" | "text_to_3d" | "image_to_3d" | "remesh" | "retexture" | "uv_unwrap" | "animate" | "rig" | "segment" | "image_segment" | "text_to_speech" | "sound_effects" | "music" | "upscaling" | "video_interpolation" | "denoise_image" | "denoise_video" | "deblur_video" | "restore_image" | "sdr_to_hdr_video" | "background_removal" | "vectorization" | "virtual_try_on";
1001
+ /** Delivered when an inference run reaches a terminal state. */
1002
+ export interface InferenceWebhookEvent {
1003
+ /** Unique event id, repeated in the webhook-id header. */
1004
+ id: string;
1005
+ /** inference.completed, inference.failed or inference.cancelled. */
1006
+ type: WebhookEventType;
1007
+ /** When the event was raised (RFC 3339). */
1008
+ created_at: string;
1009
+ /** Identical to the body of GET on the inference run. */
1010
+ data: GetInferenceRunV2Output;
1011
+ /** Whatever you sent as webhook.metadata. */
1012
+ metadata?: Record<string, string>;
1013
+ }
954
1014
  export interface InviteMemberBody {
955
1015
  /** Email of the person to invite. A Layer user is created if none exists. */
956
1016
  email: string;
@@ -1223,6 +1283,12 @@ export interface RequestUploadUrlResponse {
1223
1283
  source_type?: FileSourceType | null;
1224
1284
  }
1225
1285
  export type Role = "admin" | "editor" | "settings_admin" | "art_director" | "artist" | "member";
1286
+ export interface RotateWebhookSecretResponse {
1287
+ /** The new signing secret. Start verifying with it. */
1288
+ secret: string;
1289
+ /** When the previous secret stops signing. Until then both secrets sign every delivery, so a receiver can be updated without dropping anything. */
1290
+ previous_secret_expires_at: string;
1291
+ }
1226
1292
  export interface ScoreFilesBody {
1227
1293
  /** The files to score. Images, video and 3D can be judged; audio and text cannot. */
1228
1294
  file_ids: Array<string>;
@@ -1230,14 +1296,20 @@ export interface ScoreFilesBody {
1230
1296
  project_id?: string | null;
1231
1297
  /** Score against these rules only. Empty runs every rule in force for the scope. */
1232
1298
  rule_ids?: Array<string>;
1299
+ /** Deliver this run's terminal event to a URL instead of polling for it. See the Webhooks section of this document for the payload, headers and retry behaviour. */
1300
+ webhook?: WebhookInput | null;
1233
1301
  }
1234
1302
  export interface ScoreFilesOutput {
1303
+ /** Handle for this batch. Poll `GET /v1/workspaces/{workspace_id}/scoring-runs/{id}` for its verdicts. Null when no rule was in force, which queues nothing. */
1304
+ scoring_run_id?: string | null;
1235
1305
  /** How many (file, rule) judgements were queued — one model call each. */
1236
1306
  requested_pair_count: number;
1237
1307
  /** How many files were accepted for scoring. */
1238
1308
  file_count: number;
1239
1309
  /** The rules the files are being scored against. */
1240
1310
  rule_ids: Array<string>;
1311
+ /** Deliveries this run will produce. Empty when no webhook was supplied. */
1312
+ expected_events?: Array<WebhookEventType>;
1241
1313
  }
1242
1314
  export interface ScoringRuleSummary {
1243
1315
  /** Pass this as a `rule_ids` entry to score against this rule alone. */
@@ -1259,8 +1331,39 @@ export interface ScoringRuleSummary {
1259
1331
  /** True for the one rule whose score is stamped on assets as their headline score. */
1260
1332
  is_nominated: boolean;
1261
1333
  }
1334
+ export interface ScoringRunFileScore {
1335
+ /** The file this verdict is about. */
1336
+ file_id: string;
1337
+ /** The scoring rule that produced it. */
1338
+ rule_id: string;
1339
+ /** The rule's name as it stood when the verdict was recorded. */
1340
+ rule_name: string;
1341
+ /** Score in [0, 100] against that rule. */
1342
+ score: number;
1343
+ /** The judge's reasoning, in its own words. */
1344
+ rationale?: string;
1345
+ }
1262
1346
  /** When a rule runs. */
1263
1347
  export type ScoringRunMode = "always" | "on_demand";
1348
+ export type ScoringRunStatus = "pending" | "complete" | "failed";
1349
+ /**
1350
+ * Delivered when a scoring run settles.
1351
+ *
1352
+ * Also raised for the automatic scoring that follows a generation, in which case `data`
1353
+ * carries the `inference_id` of the generation whose outputs were judged.
1354
+ */
1355
+ export interface ScoringRunWebhookEvent {
1356
+ /** Unique event id, repeated in the webhook-id header. */
1357
+ id: string;
1358
+ /** scoring_run.completed or scoring_run.failed. */
1359
+ type: WebhookEventType;
1360
+ /** When the event was raised (RFC 3339). */
1361
+ created_at: string;
1362
+ /** Identical to the body of GET on the scoring run. */
1363
+ data: GetScoringRunOutput;
1364
+ /** Whatever you sent as webhook.metadata. */
1365
+ metadata?: Record<string, string>;
1366
+ }
1264
1367
  export interface SetUsageLimitBody {
1265
1368
  /** Creative Units cap for the period. */
1266
1369
  cu_limit: number;
@@ -1279,6 +1382,8 @@ export interface StartTrainingRequest {
1279
1382
  base_model_id?: string | null;
1280
1383
  /** Training framework override. Omit for the server default. */
1281
1384
  training_framework?: "fal" | "ai-toolkit" | null;
1385
+ /** Deliver this run's terminal events to a URL instead of polling for them. See the Webhooks section of this document for the payload, headers and retry behaviour. */
1386
+ webhook?: WebhookInput | null;
1282
1387
  }
1283
1388
  export interface StartTrainingResponse {
1284
1389
  /** Unique identifier for this training run. */
@@ -1293,8 +1398,18 @@ export interface StartTrainingResponse {
1293
1398
  created_at: string;
1294
1399
  /** Suggested polling interval in seconds. */
1295
1400
  poll_interval_seconds: number;
1401
+ /** Deliveries this run will produce. Empty when no webhook was supplied. */
1402
+ expected_events?: Array<WebhookEventType>;
1296
1403
  }
1297
- export type StyleCategory = "general" | "character" | "object" | "scene" | "effect" | "animation";
1404
+ /**
1405
+ * What a reference set *is*.
1406
+ *
1407
+ * The first group is user-settable: a curator picks one when creating or editing a set.
1408
+ * The second group is internal — the cinematic-technique library owns those values, they
1409
+ * are seeded only by the fixtures in ``core/workflows/fixtures/data/reference_sets`` and
1410
+ * a user-facing write path must reject them (see ``USER_SETTABLE_CATEGORIES``).
1411
+ */
1412
+ export type StyleCategory = "general" | "character" | "object" | "scene" | "effect" | "animation" | "camera_movement" | "camera_angle" | "camera_framing" | "camera_lens" | "scene_lighting" | "scene_composition" | "scene_atmosphere" | "time_and_motion" | "genre_look" | "optical_effect" | "visual_effect" | "character_performance";
1298
1413
  export interface ToolGuidanceFileTypeSupport {
1299
1414
  /** Guidance file type, such as init_image, reference_image, first_frame, pose, or depth. */
1300
1415
  type: string;
@@ -1318,6 +1433,19 @@ export interface TrainingRunSummary {
1318
1433
  progress: number;
1319
1434
  started_at?: string | null;
1320
1435
  }
1436
+ /** Delivered when a training run reaches a terminal state. */
1437
+ export interface TrainingWebhookEvent {
1438
+ /** Unique event id, repeated in the webhook-id header. */
1439
+ id: string;
1440
+ /** training.succeeded or training.failed. */
1441
+ type: WebhookEventType;
1442
+ /** When the event was raised (RFC 3339). */
1443
+ created_at: string;
1444
+ /** Identical to the body of GET on the training run. */
1445
+ data: GetTrainingRunResponse;
1446
+ /** Whatever you sent as webhook.metadata. */
1447
+ metadata?: Record<string, string>;
1448
+ }
1321
1449
  export interface UpdateGroupBody {
1322
1450
  /** New builtin role to grant members. Send null with no role_id to clear the group's role. */
1323
1451
  role: Role | null;
@@ -1339,7 +1467,70 @@ export interface UpdateProjectBody {
1339
1467
  archived?: boolean | null;
1340
1468
  }
1341
1469
  export type UsageLimitPeriod = "daily" | "weekly" | "monthly";
1470
+ export interface ValidationError {
1471
+ loc: Array<string | number>;
1472
+ msg: string;
1473
+ type: string;
1474
+ input?: unknown;
1475
+ ctx?: Record<string, unknown>;
1476
+ }
1342
1477
  export type VideoEffectType = "general" | "orbit_360" | "action_run" | "agent_reveal" | "arc" | "arc_left" | "baseball_kick" | "basketball_dunks" | "boxing" | "buckle_up" | "building_explosion" | "bullet_time" | "car_chasing" | "car_explosion" | "car_grip" | "catch" | "catwalk" | "crane_down" | "crane_over_the_head" | "crane_up" | "crash_zoom_in" | "crash_zoom_out" | "dirty_lens" | "disintegration" | "dolly_in" | "dolly_left" | "dolly_out" | "dolly_right" | "dolly_zoom_in" | "dolly_zoom_out" | "double_dolly" | "downhill_pov" | "dutch_angle" | "eyes_in" | "face_punch" | "fisheye" | "flying" | "focus_change" | "fpv_drone" | "glam" | "handheld" | "head_tracking" | "hyperlapse" | "invisible" | "jib_down" | "jib_up" | "kiss" | "lazy_susan" | "lens_crack" | "lens_flare" | "levitation" | "low_shutter" | "melting" | "moonwalk_left" | "moonwalk_right" | "mouth_in" | "object_pov" | "overhead" | "push_to_glass" | "rap_flex" | "robo_arm" | "set_on_fire" | "skateboard_glide" | "skateboarding" | "skateboard_kickflip" | "skateboard_ollie" | "skate_cruise" | "ski_carving" | "ski_powder" | "snorricam" | "snowboard_carving" | "snowboard_powder" | "soul_jump" | "static" | "super_dolly_in" | "super_dolly_out" | "tentacles" | "through_object_in" | "through_object_out" | "thunder_god" | "tilt_down" | "tilt_up" | "timelapse_human" | "timelapse_landscape" | "turning_metal" | "whip_pan" | "wiggle" | "wind_to_face" | "yoyo_zoom" | "zoom_in" | "zoom_out";
1478
+ export type WebhookDeliveryStatus = "pending" | "delivered" | "failed";
1479
+ /**
1480
+ * Every event the public API can deliver.
1481
+ *
1482
+ * Terminal outcomes only: a job produces exactly one of these, once. The value is what
1483
+ * appears as ``type`` in the envelope and as the operation name in the OpenAPI
1484
+ * ``webhooks`` block, so it is a public contract.
1485
+ */
1486
+ export type WebhookEventType = "inference.completed" | "inference.failed" | "inference.cancelled" | "training.succeeded" | "training.failed" | "scoring_run.completed" | "scoring_run.failed" | "workflow_run.succeeded" | "workflow_run.failed" | "workflow_run.cancelled";
1487
+ /** Where to POST this request's terminal events, and what to include with them. */
1488
+ export interface WebhookInput {
1489
+ /** HTTPS URL that receives a POST when this request reaches a terminal state. Must be publicly reachable; must not redirect. Acknowledge with any 2xx within 10 seconds and do the work asynchronously. Reply 410 to stop delivery permanently. */
1490
+ url: string;
1491
+ /** Narrows what is delivered. Omit to receive every event this request can produce, which is what `expected_events` on the response lists. */
1492
+ events?: Array<WebhookEventType> | null;
1493
+ /** Opaque key/value pairs echoed back verbatim in every delivery, for correlating a callback with your own records. At most 10 keys and 1024 bytes in total. */
1494
+ metadata?: Record<string, string>;
1495
+ }
1496
+ export interface WebhookSecretResponse {
1497
+ /** The workspace's current signing secret, in `whsec_` form. */
1498
+ secret: string;
1499
+ }
1500
+ /**
1501
+ * What a job's ``GET`` reports about the callback attached to it.
1502
+ *
1503
+ * The URL is echoed so a caller can tell which of its endpoints a run was aimed at; the
1504
+ * rest is how the delivery went, which is the only place a failed delivery is visible.
1505
+ */
1506
+ export interface WebhookStatusView {
1507
+ /** The callback URL this run was submitted with. */
1508
+ url: string;
1509
+ /** pending until a delivery settles, then delivered or failed. */
1510
+ status: WebhookDeliveryStatus;
1511
+ /** How many delivery attempts have been made. */
1512
+ attempts: number;
1513
+ /** When the last attempt was made. */
1514
+ last_attempt_at?: string | null;
1515
+ /** HTTP status the receiver returned on the last attempt, if it responded. */
1516
+ last_response_status?: number | null;
1517
+ /** Why the last attempt did not succeed. Null once delivered. */
1518
+ last_error?: string | null;
1519
+ }
1520
+ export interface WebhookTestRequest {
1521
+ /** The endpoint to test. `url` and `metadata` are used; `events` is ignored. */
1522
+ webhook: WebhookInput;
1523
+ }
1524
+ export interface WebhookTestResponse {
1525
+ /** Whether the receiver acknowledged with a 2xx. */
1526
+ delivered: boolean;
1527
+ /** HTTP status the receiver returned, or null if it never responded. */
1528
+ response_status?: number | null;
1529
+ /** How long the attempt took, end to end. */
1530
+ latency_ms: number;
1531
+ /** Why the attempt did not succeed, when it did not. */
1532
+ error?: string | null;
1533
+ }
1343
1534
  export interface WorkflowInput {
1344
1535
  /** Input parameter name (used as key in execute_workflow inputs) */
1345
1536
  name: string;
@@ -1390,6 +1581,19 @@ export interface WorkflowRunAsset {
1390
1581
  /** File size in bytes. */
1391
1582
  file_size_bytes?: number | null;
1392
1583
  }
1584
+ /** Delivered when a workflow run reaches a terminal state. */
1585
+ export interface WorkflowRunWebhookEvent {
1586
+ /** Unique event id, repeated in the webhook-id header. */
1587
+ id: string;
1588
+ /** workflow_run.succeeded, workflow_run.failed or workflow_run.cancelled. */
1589
+ type: WebhookEventType;
1590
+ /** When the event was raised (RFC 3339). */
1591
+ created_at: string;
1592
+ /** Identical to the body of GET on the workflow run. */
1593
+ data: GetWorkflowRunOutput;
1594
+ /** Whatever you sent as webhook.metadata. */
1595
+ metadata?: Record<string, string>;
1596
+ }
1393
1597
  export interface WorkflowSummary {
1394
1598
  /** Unique workflow identifier */
1395
1599
  workflow_id: string;
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.0.4";
1
+ export const VERSION = "1.0.6";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layer_ai/sdk",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Official JavaScript and TypeScript SDK for Layer \u2014 AI asset creation for game studios.",
5
5
  "keywords": [
6
6
  "ai",