@nodaro/sdk 2.55.0 → 2.56.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.
Files changed (87) hide show
  1. package/dist/{chunk-HRV3VX22.cjs → chunk-2LOTDOUV.cjs} +5 -5
  2. package/dist/{chunk-HRV3VX22.cjs.map → chunk-2LOTDOUV.cjs.map} +1 -1
  3. package/dist/{chunk-CV2ZZAUO.js → chunk-37LL6BPM.js} +4 -4
  4. package/dist/{chunk-CV2ZZAUO.js.map → chunk-37LL6BPM.js.map} +1 -1
  5. package/dist/{chunk-XALPYUZI.cjs → chunk-3CVWTUK5.cjs} +4 -4
  6. package/dist/{chunk-XALPYUZI.cjs.map → chunk-3CVWTUK5.cjs.map} +1 -1
  7. package/dist/{chunk-7CUWAVWB.js → chunk-4FSWJTRS.js} +3 -3
  8. package/dist/{chunk-7CUWAVWB.js.map → chunk-4FSWJTRS.js.map} +1 -1
  9. package/dist/{chunk-DV6GTEX5.js → chunk-4SZUSZXK.js} +2 -2
  10. package/dist/{chunk-DV6GTEX5.js.map → chunk-4SZUSZXK.js.map} +1 -1
  11. package/dist/{chunk-L6T44A3G.js → chunk-4VP2GFIZ.js} +20 -5
  12. package/dist/chunk-4VP2GFIZ.js.map +1 -0
  13. package/dist/{chunk-NKH2UFSD.cjs → chunk-4WOT5OAY.cjs} +5 -5
  14. package/dist/{chunk-NKH2UFSD.cjs.map → chunk-4WOT5OAY.cjs.map} +1 -1
  15. package/dist/{chunk-AUKHMT53.js → chunk-BGOZRZHY.js} +3 -3
  16. package/dist/{chunk-AUKHMT53.js.map → chunk-BGOZRZHY.js.map} +1 -1
  17. package/dist/{chunk-OSMKIRKI.cjs → chunk-DFT4LD2H.cjs} +4 -4
  18. package/dist/{chunk-OSMKIRKI.cjs.map → chunk-DFT4LD2H.cjs.map} +1 -1
  19. package/dist/{chunk-RBX3QTKB.js → chunk-E6X6BGRO.js} +3 -3
  20. package/dist/{chunk-RBX3QTKB.js.map → chunk-E6X6BGRO.js.map} +1 -1
  21. package/dist/{chunk-47ULSVO2.js → chunk-FTCAT2LK.js} +3 -3
  22. package/dist/chunk-FTCAT2LK.js.map +1 -0
  23. package/dist/{chunk-65VIIZEF.cjs → chunk-GJH73EGF.cjs} +2 -2
  24. package/dist/{chunk-65VIIZEF.cjs.map → chunk-GJH73EGF.cjs.map} +1 -1
  25. package/dist/{chunk-D2ILCSOQ.js → chunk-HK6XP5EN.js} +3 -3
  26. package/dist/{chunk-D2ILCSOQ.js.map → chunk-HK6XP5EN.js.map} +1 -1
  27. package/dist/{chunk-SF2CMKWA.cjs → chunk-OMJ45CW4.cjs} +9 -9
  28. package/dist/{chunk-SF2CMKWA.cjs.map → chunk-OMJ45CW4.cjs.map} +1 -1
  29. package/dist/{chunk-LUHAB7UJ.js → chunk-PQ6G5EM7.js} +9 -9
  30. package/dist/{chunk-LUHAB7UJ.js.map → chunk-PQ6G5EM7.js.map} +1 -1
  31. package/dist/{chunk-FRQJNGJS.cjs → chunk-Q4MFQC2J.cjs} +5 -5
  32. package/dist/{chunk-FRQJNGJS.cjs.map → chunk-Q4MFQC2J.cjs.map} +1 -1
  33. package/dist/{chunk-VHTDOACT.cjs → chunk-Q7W4QNE5.cjs} +22 -22
  34. package/dist/chunk-Q7W4QNE5.cjs.map +1 -0
  35. package/dist/{chunk-I6Q4UDS2.cjs → chunk-RIMDKJSQ.cjs} +16 -16
  36. package/dist/{chunk-I6Q4UDS2.cjs.map → chunk-RIMDKJSQ.cjs.map} +1 -1
  37. package/dist/{chunk-24JE54FQ.js → chunk-VEQLP5TA.js} +3 -3
  38. package/dist/{chunk-24JE54FQ.js.map → chunk-VEQLP5TA.js.map} +1 -1
  39. package/dist/{chunk-FM2KM5TY.cjs → chunk-Z4B4SZ33.cjs} +21 -4
  40. package/dist/chunk-Z4B4SZ33.cjs.map +1 -0
  41. package/dist/entries/cast-swap.cjs +2 -2
  42. package/dist/entries/cast-swap.d.cts +12 -0
  43. package/dist/entries/cast-swap.d.ts +12 -0
  44. package/dist/entries/cast-swap.js +1 -1
  45. package/dist/entries/characters.d.cts +1 -1
  46. package/dist/entries/characters.d.ts +1 -1
  47. package/dist/entries/client.cjs +15 -15
  48. package/dist/entries/client.d.cts +1 -1
  49. package/dist/entries/client.d.ts +1 -1
  50. package/dist/entries/client.js +10 -10
  51. package/dist/entries/copilot.cjs +4 -4
  52. package/dist/entries/copilot.js +3 -3
  53. package/dist/entries/core.cjs +6 -6
  54. package/dist/entries/core.js +2 -2
  55. package/dist/entries/creatures.d.cts +1 -1
  56. package/dist/entries/creatures.d.ts +1 -1
  57. package/dist/entries/edit.cjs +7 -7
  58. package/dist/entries/edit.js +2 -2
  59. package/dist/entries/errors.cjs +32 -24
  60. package/dist/entries/errors.d.cts +26 -2
  61. package/dist/entries/errors.d.ts +26 -2
  62. package/dist/entries/errors.js +1 -1
  63. package/dist/entries/locations.d.cts +1 -1
  64. package/dist/entries/locations.d.ts +1 -1
  65. package/dist/entries/media.cjs +4 -4
  66. package/dist/entries/media.js +3 -3
  67. package/dist/entries/nodes.cjs +3 -3
  68. package/dist/entries/nodes.d.cts +1 -1
  69. package/dist/entries/nodes.d.ts +1 -1
  70. package/dist/entries/nodes.js +2 -2
  71. package/dist/entries/objects.d.cts +1 -1
  72. package/dist/entries/objects.d.ts +1 -1
  73. package/dist/entries/scene3d.d.cts +2 -2
  74. package/dist/entries/scene3d.d.ts +2 -2
  75. package/dist/entries/studio.cjs +5 -5
  76. package/dist/entries/studio.js +2 -2
  77. package/dist/index.cjs +59 -51
  78. package/dist/index.d.cts +2 -2
  79. package/dist/index.d.ts +2 -2
  80. package/dist/index.js +10 -10
  81. package/dist/{nodes-B74WaY9r.d.ts → nodes-1u7MPrD5.d.ts} +10 -0
  82. package/dist/{nodes-Ceetyyh0.d.cts → nodes-BZavad1T.d.cts} +10 -0
  83. package/package.json +1 -1
  84. package/dist/chunk-47ULSVO2.js.map +0 -1
  85. package/dist/chunk-FM2KM5TY.cj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E,IAAA,EAAM,IAAI,CAAA;AAAA,EACrH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,WAAA,CAAY,KAAA,EAAe,MAAA,GAAoC,EAAC,EAAuC;AACrG,IAAA,MAAM,IAAA,GAAO,OAAO,SAAA,KAAc,MAAA,GAAY,EAAE,SAAA,EAAW,MAAA,CAAO,SAAA,EAAU,GAAI,EAAC;AACjF,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,EAAQ,CAAA,cAAA,EAAiB,kBAAA,CAAmB,KAAK,CAAC,CAAA,aAAA,CAAA,EAAiB,EAAE,IAAA,EAAM,CAAA;AAAA,EACxG;AACF","file":"chunk-DV6GTEX5.js","sourcesContent":["import { nodaroMotionEngineFrom } from \"@nodaro/shared/models\"\nimport type { NodaroClientCore } from \"../core.js\"\n\n/**\n * Nodaro Motion (the `castSwap` resource; routes `/v1/cast-swap`) — replace\n * the people, pets, products and/or the location in a short video with your\n * own references, keeping its motion, framing, timing and sound (the clip's\n * audio is kept, and the result is the clip's length).\n *\n * Before the video, each person, pet and product role's photos are turned\n * into one clean reference picture by an image model. This costs extra\n * credits (`breakdown.references` in the estimate), charged when it runs, even\n * if the video then fails; it adds about a minute, falls back to your own\n * photos if it fails, and is turned off with `prepareReferences: false`.\n * Locations are not prepared.\n *\n * Engines: a run is made on Nodaro Motion Prism (`engine` left out, or\n * `\"motion-prism\"`) or Nodaro Motion Pulse (`\"motion-pulse\"`). Pulse renders 720p\n * (its default) or 1080p and has no draft; it makes a new take guided by the\n * clip and pictures, so its Full Quality is a new take at 1080p rather than\n * the same take re-rendered (`CastSwapFullQualityEstimate.kind`).\n *\n * How the clip is prepared for the video model (for one, whether faces are\n * hidden first, and whether a refused clip is retried) is set by Nodaro for\n * each engine; a run cannot change it. `faceMasking` is no longer read\n * (deprecated: accepted and ignored).\n *\n * Cloud edition only: `/v1/cast-swap` is served by the cloud plugin and 404s\n * on self-hosted installs. `run()` answers 202 with a job id; follow it with\n * `client.jobs.get(jobId)` / `client.jobs.getStatus(jobId)` like any other job.\n *\n * Repeats: pass `{ idempotencyKey }` to `run()` and it is sent as the\n * `Idempotency-Key` header. A repeat with the same key within the credit\n * guard's dedup window (about 10 s) answers 200 `{ jobId, deduped: true }` with\n * an `X-Dedup-Hit` header; a later one answers 202 with the first run's\n * `jobId`. Nothing new is started or charged.\n *\n * Refusals (thrown as a `NodaroError` subclass; body `{ error: { code, message } }`), before\n * anything is charged: 400 `validation_error` (the body: no role with images,\n * no reference and no `prePrompt` or `postPrompt`, more roles of a kind\n * than allowed, more than 30 images in all, `draft: true` above 480p, a\n * `prePrompt` or `postPrompt` over 4,000 characters); on Nodaro Motion Pulse,\n * `draft_unsupported` (`draft: true`), `resolution_unsupported` (480p),\n * `output_format_unsupported` (a MOV edit output) and `too_many_images` (more\n * than 10 images in the run, across every role and fixed reference);\n * `raw_reference_token` (also in a reference's `line`),\n * `invalid_role_mention` (also any `{role:N}` in a reference's `line`),\n * `unsafe_url`, `video_unreadable`, `clip_out_of_range` (4–30 s),\n * `preview_out_of_range`, `no_roles_in_preview` (a preview with every role\n * `inPreview: false`, always refused even with a prompt, or with no role kept\n * in it that has images and no `prePrompt` or `postPrompt`), `prompt_too_long`\n * (the prompt would build too long: a `{role:N}` reads as the role's name when\n * it sends no images; Nodaro Motion Pulse's cap is 8,000 characters); 401; 402 `insufficient_credits` (`run()` only); 404\n * (a `sessionId` you may not use, `run()` only); 422 `job_blocked` (`run()`\n * only); 503 `host_too_old` (both); 503 `estimate_unavailable` (`estimate()`\n * only).\n */\n\n/**\n * The engine a Nodaro Motion run is made on, by its public id. Left out =\n * `\"motion-prism\"`.\n *\n * - `\"motion-prism\"` (Nodaro Motion Prism): 480p (the default, a draft unless\n * `draft: false`), 720p or 1080p; Full Quality re-renders a draft's own take\n * at 1080p.\n * - `\"motion-pulse\"` (Nodaro Motion Pulse): 720p (the default) or 1080p, never a\n * draft (`draft: true` answers 400 `draft_unsupported`); Full Quality makes a\n * new take at 1080p from a completed 720p run's inputs. A preview is still\n * 4 s from `previewStart`.\n */\nexport type CastSwapEngine = \"motion-prism\" | \"motion-pulse\"\n\n/**\n * The engine ids an older client sent: the earlier public ids (`\"motion-pro\"`\n * = `\"motion-prism\"`, `\"motion-lite\"` = `\"motion-pulse\"`) and the internal\n * ones (`\"seedance-2-5\"`, `\"kling-4\"`). Still accepted in a request; never\n * returned.\n * @deprecated use {@link CastSwapEngine}.\n */\nexport type CastSwapEngineLegacyId = \"motion-pro\" | \"motion-lite\" | \"seedance-2-5\" | \"kling-4\"\n\n/**\n * How a run follows its clip. Left out = `\"precise\"`.\n *\n * - `\"precise\"`: follows the clip exactly.\n * - `\"motion\"`: follows the clip's movement and takes the looks from your\n * photos, more freely than `\"precise\"`. Its price may differ from\n * `\"precise\"`'s: the estimate shows the exact price.\n */\nexport type CastSwapStyle = \"precise\" | \"motion\"\n\n/**\n * Where a Nodaro Motion Pulse run cuts the clip to whole seconds (Pulse renders\n * whole seconds; asked for more than the clip, it would stretch the motion):\n * - `\"cut-end\"` (the default): drop the fraction of a second at its end;\n * - `\"cut-start\"`: drop it at its start.\n */\nexport type CastSwapMotionLength = \"cut-end\" | \"cut-start\"\n\n/** @deprecated use {@link CastSwapMotionLength}. */\nexport type CastSwapKlingLength = CastSwapMotionLength\n\n/** Whether a swapped subject takes this trait from the references (`\"new\"`) or keeps the video's (`\"original\"`). */\nexport type CastSwapTraitSource = \"new\" | \"original\"\n\n/**\n * Preview-only settings, on every role kind; a full run (`preview` not `true`)\n * ignores both.\n */\nexport interface CastSwapRolePreviewSettings {\n /** The name used instead of `name` in a preview. Same rules as `name` (1–200 characters). */\n previewName?: string\n /**\n * `false` leaves this role out of the preview: its reference images are not\n * sent, not prepared and not charged, and a `{role:N}` naming it reads as its\n * `previewName`, else its `name`. Default `true`. A preview with every role\n * left out (always refused, even with a prompt), or with no role kept in it\n * that has images and no pre / post prompt, answers 400 `no_roles_in_preview`.\n */\n inPreview?: boolean\n}\n\n/** A person in the video to recast. */\nexport interface CastSwapPersonRole extends CastSwapRolePreviewSettings {\n kind: \"person\"\n /** How the person is told apart in the video, e.g. `\"the woman that attacks\"`. */\n name: string\n /** 0–3 images of ONE person. Empty or `null` keeps the original person. */\n images: string[] | null\n /** Body from the references or the video. Default `\"new\"`. */\n body?: CastSwapTraitSource\n /** Outfit from the references or the video. Default `\"new\"`. */\n outfit?: CastSwapTraitSource\n /** Hairstyle and haircut from the references or the video. Default `\"new\"`. */\n hair?: CastSwapTraitSource\n}\n\n/** The place the video happens in. */\nexport interface CastSwapLocationRole extends CastSwapRolePreviewSettings {\n kind: \"location\"\n /** How the place is named. Default `\"the setting\"`. */\n name?: string\n /** 0–3 images of ONE place. Empty or `null` keeps the original place. */\n images: string[] | null\n}\n\n/** An animal in the video to recast. */\nexport interface CastSwapPetRole extends CastSwapRolePreviewSettings {\n kind: \"pet\"\n /** How the animal is told apart in the video, e.g. `\"the dog\"`. */\n name: string\n /** 0–3 images of ONE animal. Empty or `null` keeps the original animal. */\n images: string[] | null\n /** Body (shape, size and build) from the references or the video. Default `\"new\"`. */\n body?: CastSwapTraitSource\n /** Coat (fur, colors and markings) from the references or the video. Default `\"new\"`. */\n coat?: CastSwapTraitSource\n}\n\n/** An object in the video to recast. */\nexport interface CastSwapProductRole extends CastSwapRolePreviewSettings {\n kind: \"product\"\n /** How the object is told apart in the video, e.g. `\"the can\"`. */\n name: string\n /** 0–3 images of ONE product. Empty or `null` keeps the original object. */\n images: string[] | null\n /** Shape and proportions from the references or the video. Default `\"new\"`. */\n shape?: CastSwapTraitSource\n /** Finish (colors, materials, label and markings) from the references or the video. Default `\"new\"`. */\n finish?: CastSwapTraitSource\n}\n\nexport type CastSwapRole = CastSwapPersonRole | CastSwapLocationRole | CastSwapPetRole | CastSwapProductRole\n\n/**\n * A fixed reference: 1–3 images of ONE thing that no role replaces, and the\n * line that says what it is (`\"the glass she drinks from\"`). Sent as given,\n * never prepared; its images count toward the 30.\n */\nexport interface CastSwapReference {\n /** 1–3 http(s) image URLs of one thing. */\n images: string[]\n /**\n * What it is, 1–500 characters. `{image}` in the line stands for this\n * reference's first image (`\"Use {image} for the sky\"`); a line without it\n * gets it appended. A `{role:N}` or a raw `{image:` / `{video:` / `{audio:`\n * token answers 400.\n */\n line: string\n}\n\n/**\n * @deprecated Nodaro sets this per engine; a run's `faceMasking` is ignored.\n */\nexport interface CastSwapFaceMaskingZone {\n leftPct?: number\n rightPct?: number\n topPct?: number\n bottomPct?: number\n}\n\n/**\n * @deprecated Nodaro sets how the clip is prepared for the video model, per\n * engine; a run cannot change it. A `faceMasking` sent is accepted and\n * ignored (no error), so older code keeps working unchanged.\n */\nexport interface CastSwapFaceMasking {\n mode: \"off\" | \"always\" | \"auto\"\n fill?: \"blur\" | \"depth\"\n minFaceHeightPct?: number\n maxFaceHeightPct?: number\n zone?: CastSwapFaceMaskingZone | null\n blurStrengthPct?: number\n threshold?: number\n}\n\n/** The body of `POST /v1/cast-swap` and `POST /v1/cast-swap/estimate`. */\nexport interface CastSwapParams {\n /** The source clip, 4–30 seconds. */\n videoUrl: string\n /**\n * Who and what to swap: at most 6 person roles, 1 location role, 3 pet roles\n * and 3 product roles, with at most 30 images in all. A role with no images\n * is skipped (that subject or place stays as in the video). At least one role\n * with images, or a `prePrompt` or `postPrompt`, is required.\n */\n roles: CastSwapRole[]\n /**\n * Fixed references (at most 5): things the video should show that no role\n * replaces, each with the line that names it. Their images count toward the\n * 30. A reference alone is enough for a run (no role needs images).\n */\n references?: CastSwapReference[]\n /**\n * Your own words placed at the start of the prompt, before the role\n * instructions; at most 4,000 characters. Mention a role as `{role:N}`, as in\n * `postPrompt`; the same 400 refusals apply (an N outside 1..`roles.length`,\n * a raw `{image:` / `{video:` / `{audio:` token).\n */\n prePrompt?: string\n /**\n * Extra instructions in your own words, at most 4,000 characters. Mention a\n * role as `{role:N}`, where N is its 1-based position in `roles`\n * (`{role:1}` is `roles[0]`; empty roles count).\n *\n * The route answers 400, before charging, for an N outside 1..`roles.length`,\n * for a raw `{image:` / `{video:` / `{audio:` token in the pre or post prompt\n * or a role's `name`, for a clip outside 4–30 s, and for a preview past the clip's\n * end (`previewStart + 4` > its length).\n */\n postPrompt?: string\n /** `true` runs on 4 seconds of the clip, starting at `previewStart`: a cheap check of the roles and choices. */\n preview?: boolean\n /** Where the preview starts, in seconds. Default 0. */\n previewStart?: number\n /**\n * The engine (see {@link CastSwapEngine}). Default `\"motion-prism\"`. The job\n * records it in `input_data.engine`, and a completed job's output in its\n * `engine`. The ids an older client sent ({@link CastSwapEngineLegacyId})\n * are still accepted.\n */\n engine?: CastSwapEngine | CastSwapEngineLegacyId\n /**\n * How the run follows the clip (see {@link CastSwapStyle}). Default\n * `\"precise\"`; the job records it in `input_data.style`.\n */\n style?: CastSwapStyle\n /**\n * Nodaro Motion Pulse only (Prism ignores it): which end of the clip is cut to\n * whole seconds (see {@link CastSwapMotionLength}). Default `\"cut-end\"`.\n */\n motionLength?: CastSwapMotionLength\n /** @deprecated use {@link motionLength} (still accepted). */\n klingLength?: CastSwapKlingLength\n /**\n * The output resolution. Nodaro Motion Prism: `\"480p\"` (default), `\"720p\"` or\n * `\"1080p\"`. Nodaro Motion Pulse: `\"720p\"` (default) or `\"1080p\"`; `\"480p\"`\n * answers 400.\n */\n resolution?: \"480p\" | \"720p\" | \"1080p\"\n /**\n * Render as a draft (Nodaro Motion Prism only). Defaults to `true` at 480p and\n * `false` above it; `true` with `\"720p\"` or `\"1080p\"` answers 400 (draft is\n * 480p only). Nodaro Motion Pulse has no draft: `true` answers 400\n * `draft_unsupported`.\n */\n draft?: boolean\n /**\n * Turn each person, pet and product role's photos into one clean reference\n * picture before the video (extra credits, shown in `breakdown.references`;\n * about a minute longer; falls back to your own photos if it fails).\n * Default `true`.\n */\n prepareReferences?: boolean\n /**\n * Ignored: Nodaro sets how the clip is prepared, per engine. Accepted (no\n * error) so older code keeps working.\n * @deprecated leave it out.\n */\n faceMasking?: CastSwapFaceMasking\n /**\n * `\"draft\"` means 480p draft.\n * @deprecated use `resolution` + `draft`.\n */\n quality?: \"draft\"\n /** A generation session to file the result in. */\n sessionId?: string\n /** The client app that sent the run (stored on the job as `input_data.origin`). */\n origin?: string\n}\n\n/** What a run would cost, in credits. */\nexport interface CastSwapEstimate {\n /**\n * The engine the run would use, by its public id (absent from an older\n * server = `\"motion-prism\"`). An id an older server answers is read as the\n * public id it names.\n */\n engine?: CastSwapEngine\n /**\n * What is held when the run starts. The run is charged what it actually\n * costs, which is expected to be `expectedCredits`.\n */\n totalCredits: number\n /**\n * The charge the run is expected to come to. Never above `totalCredits`\n * (on Nodaro Motion Pulse it equals it: Pulse renders exactly the length\n * asked for, so the hold is what it settles at). Absent from an older\n * server: read `totalCredits` then.\n */\n expectedCredits?: number\n /**\n * The parts of the quote, by name, for display only:\n * - `base`: the run itself (its base fee). A server before Cast Swap 0.396.0\n * names it `castSwap` instead: read `base`, else `castSwap`;\n * - `references`: preparing the reference pictures (0 when\n * `prepareReferences` is off or there is nothing to prepare);\n * - `motion`: what the video holds (on Nodaro Motion Pulse, what it costs);\n * - `motionExpected`: what the video is expected to be charged, never above\n * `motion` (Nodaro Motion Prism);\n * - `privacy`: preparing the clip, when the engine's setting does. In both\n * totals when it always runs; outside both when it is the retry\n * (`privacyCredits`).\n *\n * `motion` and `motionExpected` are alternatives, so the parts sum to more\n * than either total: read `totalCredits` and `expectedCredits`, never the\n * sum. Other parts may appear.\n */\n breakdown: {\n base?: number\n /** @deprecated read {@link base} (an older server answered this name for the same part). */\n castSwap?: number\n references: number\n motion?: number\n motionExpected?: number\n privacy?: number\n } & Record<string, number>\n /**\n * The extra credits charged only if the video model refuses the clip and\n * the run is retried (Nodaro's setting for the engine decides whether it\n * does). Not in `totalCredits` or `expectedCredits`; `run()` needs credits\n * for both the hold and this (else 402).\n */\n privacyCredits?: number\n /** @deprecated read {@link privacyCredits} (an older server answered this name). */\n maskingCredits?: number\n /**\n * `true` when the video is made at Auto length (every Nodaro Motion Prism\n * run): the final charge is expected to come out lower than `totalCredits`,\n * at about `expectedCredits`. `false` on Nodaro Motion Pulse.\n */\n settlesLower: boolean\n}\n\n/** Per-call options for {@link CastSwapResource.run}. */\nexport interface CastSwapRunOptions {\n /**\n * Sent as the `Idempotency-Key` header, unchanged (the SDK checks nothing;\n * an empty string sends no header, like no key).\n * The server takes 8–200 characters and answers 400 for any other length.\n * Reuse the same value when retrying the same run: within about 10 s the\n * repeat answers 200 `{ jobId, deduped: true }`, later 202 with the first\n * run's `jobId`. Nothing new is started or charged.\n */\n idempotencyKey?: string\n}\n\n/**\n * What a Full Quality version would be: `\"same-take\"` re-renders a Nodaro\n * Motion Prism draft's own take at 1080p; `\"new-take\"` makes a new Nodaro Motion Pulse take at\n * 1080p from a 720p run's inputs (it will not match the 720p run frame for\n * frame). The 720p run or draft stays either way.\n */\nexport type CastSwapFullQualityKind = \"same-take\" | \"new-take\"\n\n/**\n * What a Full Quality version of a run would cost\n * (`POST /v1/cast-swap/:jobId/full-quality/estimate`): a Nodaro Motion Prism\n * draft, or a completed Nodaro Motion Pulse run at 720p.\n */\nexport interface CastSwapFullQualityEstimate {\n /**\n * Which Full Quality this is ({@link CastSwapFullQualityKind}), so it can\n * be worded right. Absent from an older server: `\"same-take\"`.\n */\n kind?: CastSwapFullQualityKind\n /** The quote in credits: `breakdown.base` plus the 1080p render (same take) or the new take. */\n totalCredits: number\n /**\n * The parts of the quote, by name, for display only: `base` (the Full\n * Quality job's own steps; a server before Cast Swap 0.396.0 names it\n * `castSwap` instead: read `base`, else `castSwap`), and `motionHd` (a same\n * take: the 1080p render, 0 when an earlier try of this draft already\n * finished that render, which is then reused) or `motion` (a new take).\n */\n breakdown: {\n base?: number\n /** @deprecated read {@link base} (an older server answered this name for the same part). */\n castSwap?: number\n motionHd?: number\n motion?: number\n } & Record<string, number>\n /** ISO time until which the run can be finished at Full Quality (7 days after it completed). */\n availableUntil: string\n}\n\n/** Options for {@link CastSwapResource.fullQuality}. */\nexport interface CastSwapFullQualityParams {\n /** A generation session to file the Full Quality result in. */\n sessionId?: string\n}\n\n/** The Full Quality job (`POST /v1/cast-swap/:jobId/full-quality`). */\nexport interface CastSwapFullQualityResult {\n jobId: string\n /** `true` when this run's Full Quality was already running or done: that job is answered, nothing new is started or charged. */\n existing?: boolean\n}\n\n/**\n * The `code` of a Full Quality refusal (`NodaroError.code`), all before\n * anything is charged:\n * - `unauthorized` (401): no authenticated user;\n * - `not_found` (404): not your job, or not a Nodaro Motion run; also a\n * `sessionId` you may not use;\n * - `not_completed` (409): the run has not finished;\n * - `not_a_draft` (409): the run is neither a Nodaro Motion Prism draft nor a\n * Nodaro Motion Pulse run at 720p (a Pulse run at 1080p is already Full Quality);\n * - `draft_expired` (410): more than 7 days after the draft completed, or\n * the draft can no longer be finished at Full Quality;\n * - `full_quality_pending` (409, `details.retryable: true`): not final — an\n * earlier try's 1080p render of this draft is being reviewed, or has not\n * started yet; try again later (once the review ends). The only refusal\n * that ends on its own;\n * - `full_quality_unavailable` (409): final — nothing kept to re-render, no\n * readable completion time, or the 1080p finalize refuses this draft; on\n * the start only, also \"failed too many times\" (every try failed) or no\n * try can be started for this run;\n * - `insufficient_credits` (402), or in a workspace `budget_exceeded`,\n * `member_cap_exceeded` or `user_allowance_exceeded`;\n * - `job_blocked` (422): the request was blocked by the job policy;\n * - `job_read_failed` (503, retryable), `estimate_unavailable` (503, try\n * again shortly), `host_too_old` (503).\n *\n * Open-ended: a code not listed here may still arrive.\n */\nexport type CastSwapFullQualityRefusalCode =\n | \"unauthorized\"\n | \"not_found\"\n | \"not_completed\"\n | \"not_a_draft\"\n | \"draft_expired\"\n | \"full_quality_pending\"\n | \"full_quality_unavailable\"\n | \"insufficient_credits\"\n | \"budget_exceeded\"\n | \"member_cap_exceeded\"\n | \"user_allowance_exceeded\"\n | \"job_blocked\"\n | \"job_read_failed\"\n | \"estimate_unavailable\"\n | \"host_too_old\"\n | (string & {})\n\nexport class CastSwapResource {\n constructor(private client: NodaroClientCore) {}\n\n /**\n * Start a Nodaro Motion run (`POST /v1/cast-swap`, 202 `{ jobId }`). Returns the\n * job to follow. With `options.idempotencyKey` (sent as the\n * `Idempotency-Key` header; 8–200 characters, else 400) a repeat with the\n * same key within about 10 s answers 200 `{ jobId, deduped: true }`, a later\n * one 202 with the first run's `jobId`; nothing new starts.\n */\n run(params: CastSwapParams, options?: CastSwapRunOptions): Promise<{ jobId: string; deduped?: boolean }> {\n return this.client.request(\"POST\", \"/v1/cast-swap\", {\n body: params,\n ...(options?.idempotencyKey ? { headers: { \"Idempotency-Key\": options.idempotencyKey } } : {}),\n })\n }\n\n /** Quote a run before starting it (`POST /v1/cast-swap/estimate`); spends nothing. */\n async estimate(params: CastSwapParams): Promise<CastSwapEstimate> {\n const quote = await this.client.request<CastSwapEstimate>(\"POST\", \"/v1/cast-swap/estimate\", { body: params })\n // An older server names the engine by an earlier id: answered as the public id it names.\n const engine = nodaroMotionEngineFrom(quote?.engine)\n return engine && engine !== quote.engine ? { ...quote, engine } : quote\n }\n\n /**\n * Quote finishing a run at Full Quality (`POST\n * /v1/cast-swap/:jobId/full-quality/estimate`); spends nothing. `jobId` is a\n * finished Nodaro Motion Prism DRAFT run, or a finished Nodaro Motion Pulse\n * run at 720p (a Nodaro Motion or trend run); the quote's `kind` says whether it is the same take\n * re-rendered or a new take. The quote\n * does not look for a Full Quality already running: when one is,\n * {@link fullQuality} answers it (`existing: true`) and charges nothing.\n * Refusals: {@link CastSwapFullQualityRefusalCode}.\n */\n fullQualityEstimate(jobId: string): Promise<CastSwapFullQualityEstimate> {\n return this.client.request(\"POST\", `/v1/cast-swap/${encodeURIComponent(jobId)}/full-quality/estimate`, { body: {} })\n }\n\n /**\n * Finish a run at Full Quality (`POST /v1/cast-swap/:jobId/full-quality`):\n * at 1080p, with the clip's audio, as a new job linked to the run — a\n * Nodaro Motion Prism draft's own take re-rendered, or a new Nodaro Motion Pulse take from a\n * 720p run's inputs (the quote's `kind`). SPENDS CREDITS: quote it first with\n * {@link fullQualityEstimate}. Answers 202 `{ jobId }`, or 200\n * `{ jobId, existing: true }` when this run's Full Quality is already\n * running or done (one per run; a failed one may be asked again). Follow\n * the job with `client.jobs.get(jobId)`. No `Idempotency-Key` is taken: the\n * server keys the job by the draft. The new job keeps the draft's origin.\n * Refusals: {@link CastSwapFullQualityRefusalCode}.\n */\n fullQuality(jobId: string, params: CastSwapFullQualityParams = {}): Promise<CastSwapFullQualityResult> {\n const body = params.sessionId !== undefined ? { sessionId: params.sessionId } : {}\n return this.client.request(\"POST\", `/v1/cast-swap/${encodeURIComponent(jobId)}/full-quality`, { body })\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/resources/cast-swap.ts"],"names":[],"mappings":";;;AA8eO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAAoB,MAAA,EAA0B;AAA1B,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAA2B;AAAA,EAA3B,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpB,GAAA,CAAI,QAAwB,OAAA,EAA6E;AACvG,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,EAAQ,eAAA,EAAiB;AAAA,MAClD,IAAA,EAAM,MAAA;AAAA,MACN,GAAI,OAAA,EAAS,cAAA,GAAiB,EAAE,OAAA,EAAS,EAAE,iBAAA,EAAmB,OAAA,CAAQ,cAAA,EAAe,EAAE,GAAI;AAAC,KAC7F,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,SAAS,MAAA,EAAmD;AAChE,IAAA,MAAM,KAAA,GAAQ,MAAM,IAAA,CAAK,MAAA,CAAO,OAAA,CAA0B,QAAQ,wBAAA,EAA0B,EAAE,IAAA,EAAM,MAAA,EAAQ,CAAA;AAE5G,IAAA,MAAM,MAAA,GAAS,sBAAA,CAAuB,KAAA,EAAO,MAAM,CAAA;AACnD,IAAA,OAAO,MAAA,IAAU,WAAW,KAAA,CAAM,MAAA,GAAS,EAAE,GAAG,KAAA,EAAO,QAAO,GAAI,KAAA;AAAA,EACpE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,oBAAoB,KAAA,EAAqD;AACvE,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,EAAQ,CAAA,cAAA,EAAiB,kBAAA,CAAmB,KAAK,CAAC,CAAA,sBAAA,CAAA,EAA0B,EAAE,IAAA,EAAM,IAAI,CAAA;AAAA,EACrH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,WAAA,CAAY,KAAA,EAAe,MAAA,GAAoC,EAAC,EAAuC;AACrG,IAAA,MAAM,IAAA,GAAO,OAAO,SAAA,KAAc,MAAA,GAAY,EAAE,SAAA,EAAW,MAAA,CAAO,SAAA,EAAU,GAAI,EAAC;AACjF,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,EAAQ,CAAA,cAAA,EAAiB,kBAAA,CAAmB,KAAK,CAAC,CAAA,aAAA,CAAA,EAAiB,EAAE,IAAA,EAAM,CAAA;AAAA,EACxG;AACF","file":"chunk-4SZUSZXK.js","sourcesContent":["import { nodaroMotionEngineFrom } from \"@nodaro/shared/models\"\nimport type { NodaroClientCore } from \"../core.js\"\n\n/**\n * Nodaro Motion (the `castSwap` resource; routes `/v1/cast-swap`) — replace\n * the people, pets, products and/or the location in a short video with your\n * own references, keeping its motion, framing, timing and sound (the clip's\n * audio is kept, and the result is the clip's length).\n *\n * Before the video, each person, pet and product role's photos are turned\n * into one clean reference picture by an image model. This costs extra\n * credits (`breakdown.references` in the estimate), charged when it runs, even\n * if the video then fails; it adds about a minute, falls back to your own\n * photos if it fails, and is turned off with `prepareReferences: false`.\n * Locations are not prepared.\n *\n * Engines: a run is made on Nodaro Motion Prism (`engine` left out, or\n * `\"motion-prism\"`) or Nodaro Motion Pulse (`\"motion-pulse\"`). Pulse renders 720p\n * (its default) or 1080p and has no draft; it makes a new take guided by the\n * clip and pictures, so its Full Quality is a new take at 1080p rather than\n * the same take re-rendered (`CastSwapFullQualityEstimate.kind`).\n *\n * How the clip is prepared for the video model (for one, whether faces are\n * hidden first, and whether a refused clip is retried) is set by Nodaro for\n * each engine; a run cannot change it. `faceMasking` is no longer read\n * (deprecated: accepted and ignored).\n *\n * Cloud edition only: `/v1/cast-swap` is served by the cloud plugin and 404s\n * on self-hosted installs. `run()` answers 202 with a job id; follow it with\n * `client.jobs.get(jobId)` / `client.jobs.getStatus(jobId)` like any other job.\n *\n * Repeats: pass `{ idempotencyKey }` to `run()` and it is sent as the\n * `Idempotency-Key` header. A repeat with the same key within the credit\n * guard's dedup window (about 10 s) answers 200 `{ jobId, deduped: true }` with\n * an `X-Dedup-Hit` header; a later one answers 202 with the first run's\n * `jobId`. Nothing new is started or charged.\n *\n * Refusals (thrown as a `NodaroError` subclass; body `{ error: { code, message } }`), before\n * anything is charged: 400 `validation_error` (the body: no role with images,\n * no reference and no `prePrompt` or `postPrompt`, more roles of a kind\n * than allowed, more than 30 images in all, `draft: true` above 480p, a\n * `prePrompt` or `postPrompt` over 4,000 characters); on Nodaro Motion Pulse,\n * `draft_unsupported` (`draft: true`), `resolution_unsupported` (480p),\n * `output_format_unsupported` (a MOV edit output) and `too_many_images` (more\n * than 10 images in the run, across every role and fixed reference);\n * `raw_reference_token` (also in a reference's `line`),\n * `invalid_role_mention` (also any `{role:N}` in a reference's `line`),\n * `unsafe_url`, `video_unreadable`, `clip_out_of_range` (4–30 s),\n * `preview_out_of_range`, `no_roles_in_preview` (a preview with every role\n * `inPreview: false`, always refused even with a prompt, or with no role kept\n * in it that has images and no `prePrompt` or `postPrompt`), `prompt_too_long`\n * (the prompt would build too long: a `{role:N}` reads as the role's name when\n * it sends no images; Nodaro Motion Pulse's cap is 8,000 characters); 401; 402 `insufficient_credits` (`run()` only); 404\n * (a `sessionId` you may not use, `run()` only); 422 `job_blocked` (`run()`\n * only); 503 `host_too_old` (both); 503 `estimate_unavailable` (`estimate()`\n * only).\n */\n\n/**\n * The engine a Nodaro Motion run is made on, by its public id. Left out =\n * `\"motion-prism\"`.\n *\n * - `\"motion-prism\"` (Nodaro Motion Prism): 480p (the default, a draft unless\n * `draft: false`), 720p or 1080p; Full Quality re-renders a draft's own take\n * at 1080p.\n * - `\"motion-pulse\"` (Nodaro Motion Pulse): 720p (the default) or 1080p, never a\n * draft (`draft: true` answers 400 `draft_unsupported`); Full Quality makes a\n * new take at 1080p from a completed 720p run's inputs. A preview is still\n * 4 s from `previewStart`.\n */\nexport type CastSwapEngine = \"motion-prism\" | \"motion-pulse\"\n\n/**\n * The engine ids an older client sent: the earlier public ids (`\"motion-pro\"`\n * = `\"motion-prism\"`, `\"motion-lite\"` = `\"motion-pulse\"`) and the internal\n * ones (`\"seedance-2-5\"`, `\"kling-4\"`). Still accepted in a request; never\n * returned.\n * @deprecated use {@link CastSwapEngine}.\n */\nexport type CastSwapEngineLegacyId = \"motion-pro\" | \"motion-lite\" | \"seedance-2-5\" | \"kling-4\"\n\n/**\n * How a run follows its clip. Left out = `\"precise\"`.\n *\n * - `\"precise\"`: follows the clip exactly.\n * - `\"motion\"`: follows the clip's movement and takes the looks from your\n * photos, more freely than `\"precise\"`. Its price may differ from\n * `\"precise\"`'s: the estimate shows the exact price.\n */\nexport type CastSwapStyle = \"precise\" | \"motion\"\n\n/**\n * Where a Nodaro Motion Pulse run cuts the clip to whole seconds (Pulse renders\n * whole seconds; asked for more than the clip, it would stretch the motion):\n * - `\"cut-end\"` (the default): drop the fraction of a second at its end;\n * - `\"cut-start\"`: drop it at its start.\n */\nexport type CastSwapMotionLength = \"cut-end\" | \"cut-start\"\n\n/** @deprecated use {@link CastSwapMotionLength}. */\nexport type CastSwapKlingLength = CastSwapMotionLength\n\n/** Whether a swapped subject takes this trait from the references (`\"new\"`) or keeps the video's (`\"original\"`). */\nexport type CastSwapTraitSource = \"new\" | \"original\"\n\n/**\n * Preview-only settings, on every role kind; a full run (`preview` not `true`)\n * ignores both.\n */\nexport interface CastSwapRolePreviewSettings {\n /** The name used instead of `name` in a preview. Same rules as `name` (1–200 characters). */\n previewName?: string\n /**\n * `false` leaves this role out of the preview: its reference images are not\n * sent, not prepared and not charged, and a `{role:N}` naming it reads as its\n * `previewName`, else its `name`. Default `true`. A preview with every role\n * left out (always refused, even with a prompt), or with no role kept in it\n * that has images and no pre / post prompt, answers 400 `no_roles_in_preview`.\n */\n inPreview?: boolean\n}\n\n/** A person in the video to recast. */\nexport interface CastSwapPersonRole extends CastSwapRolePreviewSettings {\n kind: \"person\"\n /** How the person is told apart in the video, e.g. `\"the woman that attacks\"`. */\n name: string\n /** 0–3 images of ONE person. Empty or `null` keeps the original person. */\n images: string[] | null\n /** Body from the references or the video. Default `\"new\"`. */\n body?: CastSwapTraitSource\n /** Outfit from the references or the video. Default `\"new\"`. */\n outfit?: CastSwapTraitSource\n /** Hairstyle and haircut from the references or the video. Default `\"new\"`. */\n hair?: CastSwapTraitSource\n}\n\n/** The place the video happens in. */\nexport interface CastSwapLocationRole extends CastSwapRolePreviewSettings {\n kind: \"location\"\n /** How the place is named. Default `\"the setting\"`. */\n name?: string\n /** 0–3 images of ONE place. Empty or `null` keeps the original place. */\n images: string[] | null\n}\n\n/** An animal in the video to recast. */\nexport interface CastSwapPetRole extends CastSwapRolePreviewSettings {\n kind: \"pet\"\n /** How the animal is told apart in the video, e.g. `\"the dog\"`. */\n name: string\n /** 0–3 images of ONE animal. Empty or `null` keeps the original animal. */\n images: string[] | null\n /** Body (shape, size and build) from the references or the video. Default `\"new\"`. */\n body?: CastSwapTraitSource\n /** Coat (fur, colors and markings) from the references or the video. Default `\"new\"`. */\n coat?: CastSwapTraitSource\n}\n\n/** An object in the video to recast. */\nexport interface CastSwapProductRole extends CastSwapRolePreviewSettings {\n kind: \"product\"\n /** How the object is told apart in the video, e.g. `\"the can\"`. */\n name: string\n /** 0–3 images of ONE product. Empty or `null` keeps the original object. */\n images: string[] | null\n /** Shape and proportions from the references or the video. Default `\"new\"`. */\n shape?: CastSwapTraitSource\n /** Finish (colors, materials, label and markings) from the references or the video. Default `\"new\"`. */\n finish?: CastSwapTraitSource\n}\n\nexport type CastSwapRole = CastSwapPersonRole | CastSwapLocationRole | CastSwapPetRole | CastSwapProductRole\n\n/**\n * A fixed reference: 1–3 images of ONE thing that no role replaces, and the\n * line that says what it is (`\"the glass she drinks from\"`). Sent as given,\n * never prepared; its images count toward the 30.\n */\nexport interface CastSwapReference {\n /** 1–3 http(s) image URLs of one thing. */\n images: string[]\n /**\n * What it is, 1–500 characters. `{image}` in the line stands for this\n * reference's first image (`\"Use {image} for the sky\"`); a line without it\n * gets it appended. A `{role:N}` or a raw `{image:` / `{video:` / `{audio:`\n * token answers 400.\n */\n line: string\n}\n\n/**\n * @deprecated Nodaro sets this per engine; a run's `faceMasking` is ignored.\n */\nexport interface CastSwapFaceMaskingZone {\n leftPct?: number\n rightPct?: number\n topPct?: number\n bottomPct?: number\n}\n\n/**\n * @deprecated Nodaro sets how the clip is prepared for the video model, per\n * engine; a run cannot change it. A `faceMasking` sent is accepted and\n * ignored (no error), so older code keeps working unchanged.\n */\nexport interface CastSwapFaceMasking {\n mode: \"off\" | \"always\" | \"auto\"\n fill?: \"blur\" | \"depth\"\n minFaceHeightPct?: number\n maxFaceHeightPct?: number\n zone?: CastSwapFaceMaskingZone | null\n blurStrengthPct?: number\n threshold?: number\n}\n\n/** The body of `POST /v1/cast-swap` and `POST /v1/cast-swap/estimate`. */\nexport interface CastSwapParams {\n /** The source clip, 4–30 seconds. */\n videoUrl: string\n /**\n * Who and what to swap: at most 6 person roles, 1 location role, 3 pet roles\n * and 3 product roles, with at most 30 images in all. A role with no images\n * is skipped (that subject or place stays as in the video). At least one role\n * with images, or a `prePrompt` or `postPrompt`, is required.\n */\n roles: CastSwapRole[]\n /**\n * Fixed references (at most 5): things the video should show that no role\n * replaces, each with the line that names it. Their images count toward the\n * 30. A reference alone is enough for a run (no role needs images).\n */\n references?: CastSwapReference[]\n /**\n * Your own words placed at the start of the prompt, before the role\n * instructions; at most 4,000 characters. Mention a role as `{role:N}`, as in\n * `postPrompt`; the same 400 refusals apply (an N outside 1..`roles.length`,\n * a raw `{image:` / `{video:` / `{audio:` token).\n */\n prePrompt?: string\n /**\n * Extra instructions in your own words, at most 4,000 characters. Mention a\n * role as `{role:N}`, where N is its 1-based position in `roles`\n * (`{role:1}` is `roles[0]`; empty roles count).\n *\n * The route answers 400, before charging, for an N outside 1..`roles.length`,\n * for a raw `{image:` / `{video:` / `{audio:` token in the pre or post prompt\n * or a role's `name`, for a clip outside 4–30 s, and for a preview past the clip's\n * end (`previewStart + 4` > its length).\n */\n postPrompt?: string\n /** `true` runs on 4 seconds of the clip, starting at `previewStart`: a cheap check of the roles and choices. */\n preview?: boolean\n /** Where the preview starts, in seconds. Default 0. */\n previewStart?: number\n /**\n * The engine (see {@link CastSwapEngine}). Default `\"motion-prism\"`. The job\n * records it in `input_data.engine`, and a completed job's output in its\n * `engine`. The ids an older client sent ({@link CastSwapEngineLegacyId})\n * are still accepted.\n */\n engine?: CastSwapEngine | CastSwapEngineLegacyId\n /**\n * How the run follows the clip (see {@link CastSwapStyle}). Default\n * `\"precise\"`; the job records it in `input_data.style`.\n */\n style?: CastSwapStyle\n /**\n * Flex only (`style: \"motion\"`, a direct run): an art style that restyles\n * the whole video, as a `direction.style` id of the platform's `style`\n * picker catalog (the same ids an image's `direction.style` takes); the\n * platform words it. Refused with 400 `unknown_art_style` (not in the\n * catalog), `art_style_not_supported` (a saved moodboard, `moodboard:…`)\n * or `art_style_needs_flex` (Precise, a trend run). It never changes the\n * price. The job records it in `input_data.direction`.\n */\n direction?: { style: string }\n /**\n * Nodaro Motion Pulse only (Prism ignores it): which end of the clip is cut to\n * whole seconds (see {@link CastSwapMotionLength}). Default `\"cut-end\"`.\n */\n motionLength?: CastSwapMotionLength\n /** @deprecated use {@link motionLength} (still accepted). */\n klingLength?: CastSwapKlingLength\n /**\n * The output resolution. Nodaro Motion Prism: `\"480p\"` (default), `\"720p\"` or\n * `\"1080p\"`. Nodaro Motion Pulse: `\"720p\"` (default) or `\"1080p\"`; `\"480p\"`\n * answers 400.\n */\n resolution?: \"480p\" | \"720p\" | \"1080p\"\n /**\n * Render as a draft (Nodaro Motion Prism only). Defaults to `true` at 480p and\n * `false` above it; `true` with `\"720p\"` or `\"1080p\"` answers 400 (draft is\n * 480p only). Nodaro Motion Pulse has no draft: `true` answers 400\n * `draft_unsupported`.\n */\n draft?: boolean\n /**\n * Turn each person, pet and product role's photos into one clean reference\n * picture before the video (extra credits, shown in `breakdown.references`;\n * about a minute longer; falls back to your own photos if it fails).\n * Default `true`.\n */\n prepareReferences?: boolean\n /**\n * Ignored: Nodaro sets how the clip is prepared, per engine. Accepted (no\n * error) so older code keeps working.\n * @deprecated leave it out.\n */\n faceMasking?: CastSwapFaceMasking\n /**\n * `\"draft\"` means 480p draft.\n * @deprecated use `resolution` + `draft`.\n */\n quality?: \"draft\"\n /** A generation session to file the result in. */\n sessionId?: string\n /** The client app that sent the run (stored on the job as `input_data.origin`). */\n origin?: string\n}\n\n/** What a run would cost, in credits. */\nexport interface CastSwapEstimate {\n /**\n * The engine the run would use, by its public id (absent from an older\n * server = `\"motion-prism\"`). An id an older server answers is read as the\n * public id it names.\n */\n engine?: CastSwapEngine\n /**\n * What is held when the run starts. The run is charged what it actually\n * costs, which is expected to be `expectedCredits`.\n */\n totalCredits: number\n /**\n * The charge the run is expected to come to. Never above `totalCredits`\n * (on Nodaro Motion Pulse it equals it: Pulse renders exactly the length\n * asked for, so the hold is what it settles at). Absent from an older\n * server: read `totalCredits` then.\n */\n expectedCredits?: number\n /**\n * The parts of the quote, by name, for display only:\n * - `base`: the run itself (its base fee). A server before Cast Swap 0.396.0\n * names it `castSwap` instead: read `base`, else `castSwap`;\n * - `references`: preparing the reference pictures (0 when\n * `prepareReferences` is off or there is nothing to prepare);\n * - `motion`: what the video holds (on Nodaro Motion Pulse, what it costs);\n * - `motionExpected`: what the video is expected to be charged, never above\n * `motion` (Nodaro Motion Prism);\n * - `privacy`: preparing the clip, when the engine's setting does. In both\n * totals when it always runs; outside both when it is the retry\n * (`privacyCredits`).\n *\n * `motion` and `motionExpected` are alternatives, so the parts sum to more\n * than either total: read `totalCredits` and `expectedCredits`, never the\n * sum. Other parts may appear.\n */\n breakdown: {\n base?: number\n /** @deprecated read {@link base} (an older server answered this name for the same part). */\n castSwap?: number\n references: number\n motion?: number\n motionExpected?: number\n privacy?: number\n } & Record<string, number>\n /**\n * The extra credits charged only if the video model refuses the clip and\n * the run is retried (Nodaro's setting for the engine decides whether it\n * does). Not in `totalCredits` or `expectedCredits`; `run()` needs credits\n * for both the hold and this (else 402).\n */\n privacyCredits?: number\n /** @deprecated read {@link privacyCredits} (an older server answered this name). */\n maskingCredits?: number\n /**\n * `true` when the video is made at Auto length (every Nodaro Motion Prism\n * run): the final charge is expected to come out lower than `totalCredits`,\n * at about `expectedCredits`. `false` on Nodaro Motion Pulse.\n */\n settlesLower: boolean\n}\n\n/** Per-call options for {@link CastSwapResource.run}. */\nexport interface CastSwapRunOptions {\n /**\n * Sent as the `Idempotency-Key` header, unchanged (the SDK checks nothing;\n * an empty string sends no header, like no key).\n * The server takes 8–200 characters and answers 400 for any other length.\n * Reuse the same value when retrying the same run: within about 10 s the\n * repeat answers 200 `{ jobId, deduped: true }`, later 202 with the first\n * run's `jobId`. Nothing new is started or charged.\n */\n idempotencyKey?: string\n}\n\n/**\n * What a Full Quality version would be: `\"same-take\"` re-renders a Nodaro\n * Motion Prism draft's own take at 1080p; `\"new-take\"` makes a new Nodaro Motion Pulse take at\n * 1080p from a 720p run's inputs (it will not match the 720p run frame for\n * frame). The 720p run or draft stays either way.\n */\nexport type CastSwapFullQualityKind = \"same-take\" | \"new-take\"\n\n/**\n * What a Full Quality version of a run would cost\n * (`POST /v1/cast-swap/:jobId/full-quality/estimate`): a Nodaro Motion Prism\n * draft, or a completed Nodaro Motion Pulse run at 720p.\n */\nexport interface CastSwapFullQualityEstimate {\n /**\n * Which Full Quality this is ({@link CastSwapFullQualityKind}), so it can\n * be worded right. Absent from an older server: `\"same-take\"`.\n */\n kind?: CastSwapFullQualityKind\n /** The quote in credits: `breakdown.base` plus the 1080p render (same take) or the new take. */\n totalCredits: number\n /**\n * The parts of the quote, by name, for display only: `base` (the Full\n * Quality job's own steps; a server before Cast Swap 0.396.0 names it\n * `castSwap` instead: read `base`, else `castSwap`), and `motionHd` (a same\n * take: the 1080p render, 0 when an earlier try of this draft already\n * finished that render, which is then reused) or `motion` (a new take).\n */\n breakdown: {\n base?: number\n /** @deprecated read {@link base} (an older server answered this name for the same part). */\n castSwap?: number\n motionHd?: number\n motion?: number\n } & Record<string, number>\n /** ISO time until which the run can be finished at Full Quality (7 days after it completed). */\n availableUntil: string\n}\n\n/** Options for {@link CastSwapResource.fullQuality}. */\nexport interface CastSwapFullQualityParams {\n /** A generation session to file the Full Quality result in. */\n sessionId?: string\n}\n\n/** The Full Quality job (`POST /v1/cast-swap/:jobId/full-quality`). */\nexport interface CastSwapFullQualityResult {\n jobId: string\n /** `true` when this run's Full Quality was already running or done: that job is answered, nothing new is started or charged. */\n existing?: boolean\n}\n\n/**\n * The `code` of a Full Quality refusal (`NodaroError.code`), all before\n * anything is charged:\n * - `unauthorized` (401): no authenticated user;\n * - `not_found` (404): not your job, or not a Nodaro Motion run; also a\n * `sessionId` you may not use;\n * - `not_completed` (409): the run has not finished;\n * - `not_a_draft` (409): the run is neither a Nodaro Motion Prism draft nor a\n * Nodaro Motion Pulse run at 720p (a Pulse run at 1080p is already Full Quality);\n * - `draft_expired` (410): more than 7 days after the draft completed, or\n * the draft can no longer be finished at Full Quality;\n * - `full_quality_pending` (409, `details.retryable: true`): not final — an\n * earlier try's 1080p render of this draft is being reviewed, or has not\n * started yet; try again later (once the review ends). The only refusal\n * that ends on its own;\n * - `full_quality_unavailable` (409): final — nothing kept to re-render, no\n * readable completion time, or the 1080p finalize refuses this draft; on\n * the start only, also \"failed too many times\" (every try failed) or no\n * try can be started for this run;\n * - `insufficient_credits` (402), or in a workspace `budget_exceeded`,\n * `member_cap_exceeded` or `user_allowance_exceeded`;\n * - `job_blocked` (422): the request was blocked by the job policy;\n * - `job_read_failed` (503, retryable), `estimate_unavailable` (503, try\n * again shortly), `host_too_old` (503).\n *\n * Open-ended: a code not listed here may still arrive.\n */\nexport type CastSwapFullQualityRefusalCode =\n | \"unauthorized\"\n | \"not_found\"\n | \"not_completed\"\n | \"not_a_draft\"\n | \"draft_expired\"\n | \"full_quality_pending\"\n | \"full_quality_unavailable\"\n | \"insufficient_credits\"\n | \"budget_exceeded\"\n | \"member_cap_exceeded\"\n | \"user_allowance_exceeded\"\n | \"job_blocked\"\n | \"job_read_failed\"\n | \"estimate_unavailable\"\n | \"host_too_old\"\n | (string & {})\n\nexport class CastSwapResource {\n constructor(private client: NodaroClientCore) {}\n\n /**\n * Start a Nodaro Motion run (`POST /v1/cast-swap`, 202 `{ jobId }`). Returns the\n * job to follow. With `options.idempotencyKey` (sent as the\n * `Idempotency-Key` header; 8–200 characters, else 400) a repeat with the\n * same key within about 10 s answers 200 `{ jobId, deduped: true }`, a later\n * one 202 with the first run's `jobId`; nothing new starts.\n */\n run(params: CastSwapParams, options?: CastSwapRunOptions): Promise<{ jobId: string; deduped?: boolean }> {\n return this.client.request(\"POST\", \"/v1/cast-swap\", {\n body: params,\n ...(options?.idempotencyKey ? { headers: { \"Idempotency-Key\": options.idempotencyKey } } : {}),\n })\n }\n\n /** Quote a run before starting it (`POST /v1/cast-swap/estimate`); spends nothing. */\n async estimate(params: CastSwapParams): Promise<CastSwapEstimate> {\n const quote = await this.client.request<CastSwapEstimate>(\"POST\", \"/v1/cast-swap/estimate\", { body: params })\n // An older server names the engine by an earlier id: answered as the public id it names.\n const engine = nodaroMotionEngineFrom(quote?.engine)\n return engine && engine !== quote.engine ? { ...quote, engine } : quote\n }\n\n /**\n * Quote finishing a run at Full Quality (`POST\n * /v1/cast-swap/:jobId/full-quality/estimate`); spends nothing. `jobId` is a\n * finished Nodaro Motion Prism DRAFT run, or a finished Nodaro Motion Pulse\n * run at 720p (a Nodaro Motion or trend run); the quote's `kind` says whether it is the same take\n * re-rendered or a new take. The quote\n * does not look for a Full Quality already running: when one is,\n * {@link fullQuality} answers it (`existing: true`) and charges nothing.\n * Refusals: {@link CastSwapFullQualityRefusalCode}.\n */\n fullQualityEstimate(jobId: string): Promise<CastSwapFullQualityEstimate> {\n return this.client.request(\"POST\", `/v1/cast-swap/${encodeURIComponent(jobId)}/full-quality/estimate`, { body: {} })\n }\n\n /**\n * Finish a run at Full Quality (`POST /v1/cast-swap/:jobId/full-quality`):\n * at 1080p, with the clip's audio, as a new job linked to the run — a\n * Nodaro Motion Prism draft's own take re-rendered, or a new Nodaro Motion Pulse take from a\n * 720p run's inputs (the quote's `kind`). SPENDS CREDITS: quote it first with\n * {@link fullQualityEstimate}. Answers 202 `{ jobId }`, or 200\n * `{ jobId, existing: true }` when this run's Full Quality is already\n * running or done (one per run; a failed one may be asked again). Follow\n * the job with `client.jobs.get(jobId)`. No `Idempotency-Key` is taken: the\n * server keys the job by the draft. The new job keeps the draft's origin.\n * Refusals: {@link CastSwapFullQualityRefusalCode}.\n */\n fullQuality(jobId: string, params: CastSwapFullQualityParams = {}): Promise<CastSwapFullQualityResult> {\n const body = params.sessionId !== undefined ? { sessionId: params.sessionId } : {}\n return this.client.request(\"POST\", `/v1/cast-swap/${encodeURIComponent(jobId)}/full-quality`, { body })\n }\n}\n"]}
@@ -25,13 +25,24 @@ var UnauthorizedError = class extends NodaroError {
25
25
  }
26
26
  };
27
27
  var ForbiddenError = class extends NodaroError {
28
- constructor(message = "Forbidden", missingScope) {
29
- super(message, "forbidden", 403);
28
+ /** `code` defaults to `"forbidden"`; {@link ModelUnavailableError} passes its own. */
29
+ constructor(message = "Forbidden", missingScope, code = "forbidden") {
30
+ super(message, code, 403);
30
31
  this.missingScope = missingScope;
31
32
  this.name = "ForbiddenError";
32
33
  }
33
34
  missingScope;
34
35
  };
36
+ var MODEL_UNAVAILABLE_CODES = /* @__PURE__ */ new Set([
37
+ "model_not_available",
38
+ "model_disabled"
39
+ ]);
40
+ var ModelUnavailableError = class extends ForbiddenError {
41
+ constructor(code, message = "This model is not available") {
42
+ super(message, void 0, code);
43
+ this.name = "ModelUnavailableError";
44
+ }
45
+ };
35
46
  var NotFoundError = class extends NodaroError {
36
47
  constructor(message = "Not found") {
37
48
  super(message, "not_found", 404);
@@ -276,6 +287,10 @@ function selectError(status, body) {
276
287
  throw new AppRunVersionChangedError(message, finite(parsed.runVersion), finite(parsed.appVersion));
277
288
  }
278
289
  if (status === 422 && code === "job_blocked") throw new JobBlockedError(read.message);
290
+ const modelCode = read.code;
291
+ if (status === 403 && modelCode !== void 0 && MODEL_UNAVAILABLE_CODES.has(modelCode)) {
292
+ throw new ModelUnavailableError(modelCode, read.message);
293
+ }
279
294
  if (status === 403 && code === "insufficient_scope") {
280
295
  throw new ForbiddenError(read.message, envelope.missingScope);
281
296
  }
@@ -295,6 +310,6 @@ function selectError(status, body) {
295
310
  throw new NodaroError(message, code, status);
296
311
  }
297
312
 
298
- export { AlreadyRunningError, AppRunVersionChangedError, CREDIT_CAP_CODES, ContinuationPreviewPendingError, ContinuationRefusedError, CreditCapExceededError, ForbiddenError, InsufficientCreditsError, JobAbortedError, JobBlockedError, JobFailedError, JobHeldError, JobTimeoutError, NodaroError, NotFoundError, RateLimitedError, StorageExceededError, StudioOpError, StudioPreviewAppliedError, StudioPreviewUnavailable, UnauthorizedError, WorkflowConflictError, throwFromResponse };
299
- //# sourceMappingURL=chunk-L6T44A3G.js.map
300
- //# sourceMappingURL=chunk-L6T44A3G.js.map
313
+ export { AlreadyRunningError, AppRunVersionChangedError, CREDIT_CAP_CODES, ContinuationPreviewPendingError, ContinuationRefusedError, CreditCapExceededError, ForbiddenError, InsufficientCreditsError, JobAbortedError, JobBlockedError, JobFailedError, JobHeldError, JobTimeoutError, MODEL_UNAVAILABLE_CODES, ModelUnavailableError, NodaroError, NotFoundError, RateLimitedError, StorageExceededError, StudioOpError, StudioPreviewAppliedError, StudioPreviewUnavailable, UnauthorizedError, WorkflowConflictError, throwFromResponse };
314
+ //# sourceMappingURL=chunk-4VP2GFIZ.js.map
315
+ //# sourceMappingURL=chunk-4VP2GFIZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";AAEO,IAAM,WAAA,GAAN,cAA0B,KAAA,CAAM;AAAA,EAUrC,WAAA,CACE,OAAA,EACgB,IAAA,EACA,MAAA,EAChB,OAAA,EACA;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAJG,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AACA,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAIhB,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AACZ,IAAA,IAAI,OAAA,EAAS,IAAA,CAAK,OAAA,GAAU,EAAE,GAAG,OAAA,EAAQ;AAAA,EAC3C;AAAA,EAPkB,IAAA;AAAA,EACA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EALF,UAA6C,EAAC;AAYhE;AAEO,IAAM,iBAAA,GAAN,cAAgC,WAAA,CAAY;AAAA,EACjD,WAAA,CAAY,UAAU,yBAAA,EAA2B;AAC/C,IAAA,KAAA,CAAM,OAAA,EAAS,gBAAgB,GAAG,CAAA;AAClC,IAAA,IAAA,CAAK,IAAA,GAAO,mBAAA;AAAA,EACd;AACF;AAEO,IAAM,cAAA,GAAN,cAA6B,WAAA,CAAY;AAAA;AAAA,EAE9C,WAAA,CAAY,OAAA,GAAU,WAAA,EAA6B,YAAA,EAAuB,OAAO,WAAA,EAAa;AAC5F,IAAA,KAAA,CAAM,OAAA,EAAS,MAAM,GAAG,CAAA;AADyB,IAAA,IAAA,CA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n /**\n * Every other field of the server's error envelope (`{ error: { code,\n * message, … } }`), as it was sent: for example a trend refusal's `slot`, a\n * publish refusal's `reasons`, a validation error's `issues`. Empty when the\n * envelope had nothing else, or for an error the SDK made itself. A copy —\n * changing it changes nothing else.\n */\n public readonly details: Readonly<Record<string, unknown>> = {}\n\n constructor(\n message: string,\n public readonly code: string,\n public readonly status: number,\n details?: Readonly<Record<string, unknown>>,\n ) {\n super(message)\n this.name = \"NodaroError\"\n if (details) this.details = { ...details }\n }\n}\n\nexport class UnauthorizedError extends NodaroError {\n constructor(message = \"Authentication required\") {\n super(message, \"unauthorized\", 401)\n this.name = \"UnauthorizedError\"\n }\n}\n\nexport class ForbiddenError extends NodaroError {\n /** `code` defaults to `\"forbidden\"`; {@link ModelUnavailableError} passes its own. */\n constructor(message = \"Forbidden\", public readonly missingScope?: string, code = \"forbidden\") {\n super(message, code, 403)\n this.name = \"ForbiddenError\"\n }\n}\n\nexport type ModelUnavailableCode = \"model_not_available\" | \"model_disabled\"\n\n/**\n * The 403 codes {@link ModelUnavailableError} carries: a model this\n * deployment does not offer (`model_not_available` — outside its edition or\n * surface, or hidden by its operator) and a model an admin switched off on\n * the models page (`model_disabled`).\n */\nexport const MODEL_UNAVAILABLE_CODES: ReadonlySet<ModelUnavailableCode> = new Set<ModelUnavailableCode>([\n \"model_not_available\",\n \"model_disabled\",\n])\n\n/**\n * HTTP 403 refusing the MODEL, not the caller: this deployment does not offer\n * it, or an admin switched it off. Answered by the credit guard before any\n * credits are held (the LLM and pipeline lanes still answer a switched-off\n * model with a 402 for now).\n * Choosing another model is the remedy — retrying, topping up or a wider\n * scope changes nothing. A {@link ForbiddenError}, so existing catches keep\n * working; `code` is the server's own code and says which. The envelope\n * names no model: what was refused is the request's own `provider` (or, for\n * a fan-out, one of its `models`).\n */\nexport class ModelUnavailableError extends ForbiddenError {\n declare readonly code: ModelUnavailableCode\n\n constructor(code: ModelUnavailableCode, message = \"This model is not available\") {\n super(message, undefined, code)\n this.name = \"ModelUnavailableError\"\n }\n}\n\nexport class NotFoundError extends NodaroError {\n constructor(message = \"Not found\") {\n super(message, \"not_found\", 404)\n this.name = \"NotFoundError\"\n }\n}\n\nexport class RateLimitedError extends NodaroError {\n constructor(message = \"Rate limited\") {\n super(message, \"rate_limited\", 429)\n this.name = \"RateLimitedError\"\n }\n}\n\n/**\n * HTTP 402: the run costs more than the caller may spend. `code` is the\n * refusal's own code — `insufficient_credits` for the caller's own balance, or\n * another 402 code such as `free_video_limit`. A spending cap someone else set\n * (a workspace budget, a member cap, a per-user allowance) is the subclass\n * {@link CreditCapExceededError}, so `instanceof InsufficientCreditsError`\n * still catches every 402.\n */\nexport class InsufficientCreditsError extends NodaroError {\n constructor(\n message = \"Insufficient credits\",\n public readonly required?: number,\n public readonly available?: number,\n code = \"insufficient_credits\",\n ) {\n super(message, code, 402)\n this.name = \"InsufficientCreditsError\"\n }\n}\n\n/** The 402 codes of a spending cap set by someone other than the caller. */\nexport type CreditCapCode = \"budget_exceeded\" | \"member_cap_exceeded\" | \"user_allowance_exceeded\"\n\n/**\n * The 402 codes {@link CreditCapExceededError} carries: the workspace's budget\n * (`budget_exceeded`), the caller's cap in that workspace\n * (`member_cap_exceeded`), the deployment's per-user allowance\n * (`user_allowance_exceeded`).\n */\nexport const CREDIT_CAP_CODES: ReadonlySet<CreditCapCode> = new Set<CreditCapCode>([\n \"budget_exceeded\",\n \"member_cap_exceeded\",\n \"user_allowance_exceeded\",\n])\n\n/**\n * HTTP 402 from a spending cap, not from the caller's own balance: topping up\n * does not help — whoever set the cap (the workspace's owner, the deployment's\n * operator) has to raise it. An {@link InsufficientCreditsError}, so existing\n * catches keep working; `code` says which cap. `available`, when sent, is what\n * the cap has left.\n */\nexport class CreditCapExceededError extends InsufficientCreditsError {\n declare readonly code: CreditCapCode\n\n constructor(code: CreditCapCode, message = \"A credit cap cannot cover this run\", required?: number, available?: number) {\n super(message, required, available, code)\n this.name = \"CreditCapExceededError\"\n }\n}\n\nexport class StorageExceededError extends NodaroError {\n constructor(message = \"Storage exceeded\", public readonly limitBytes?: number) {\n super(message, \"storage_exceeded\", 413)\n this.name = \"StorageExceededError\"\n }\n}\n\n/**\n * Optimistic-concurrency rejection (HTTP 409 `workflow_conflict`): the workflow\n * was written by another tab/device after the state carried in\n * `expectedUpdatedAt`/`expectedVersion` was read. `currentRecord` — when the\n * server includes it — is the full current workflow: merge your changes onto it\n * and retry with its fresh `updatedAt`, no follow-up GET needed.\n */\nexport class WorkflowConflictError extends NodaroError {\n constructor(\n message = \"Workflow was updated by another writer\",\n public readonly currentUpdatedAt?: string,\n public readonly currentVersion?: number,\n public readonly currentRecord?: Record<string, unknown>,\n /**\n * The wire code this conflict actually arrived with.\n *\n * `production_busy` is the studio production routes' own 409: the row\n * changed under a read-modify-write and the server exhausted its retries.\n * It is the same situation and the same remedy — re-read and apply again —\n * so it is the same ERROR, and a caller catching `WorkflowConflictError`\n * handles both. The code stays truthful because a caller that logs or\n * branches on it should see what the server said, not what the class is\n * usually called.\n */\n code: WorkflowConflictCode = \"workflow_conflict\",\n ) {\n super(message, code, 409)\n this.name = \"WorkflowConflictError\"\n }\n}\n\n/** The 409 codes that mean \"somebody else wrote first; re-read and retry\". */\nexport type WorkflowConflictCode = \"workflow_conflict\" | \"production_busy\"\n\n/**\n * A studio operation batch was refused, and the error names WHICH operation\n * (`opIndex`, zero-based) was wrong. Nothing in the batch was written: a batch\n * applies atomically or not at all, so fix that one operation and send the\n * whole batch again.\n *\n * Selected by SHAPE — any 4xx carrying a numeric `opIndex` — not by a list of\n * codes, so a new refusal reason (`op_invalid`, `op_target_missing`, whatever\n * the server adds next) reaches the caller as this error without an SDK\n * release. `code` is whatever the server sent.\n */\nexport class StudioOpError extends NodaroError {\n constructor(\n message: string,\n code: string,\n status: number,\n /** Zero-based index into the `ops` array that was sent. */\n public readonly opIndex: number,\n ) {\n super(message, code, status)\n this.name = \"StudioOpError\"\n }\n}\n\n/** The 409 codes whose answer names the job to turn to instead (a top-level `jobId`). */\nconst CONTINUATION_REFUSAL_CODES: ReadonlySet<string> = new Set([\n \"already_running\",\n \"continuation_superseded\",\n \"render_final_already_rendered\",\n])\n\n/**\n * A 409 that names the job to turn to instead: continuing a use-case run\n * (`client.edit.continueUseCase`) answers `already_running` (a continuation is\n * under way, or one that already completed — follow `jobId`),\n * `continuation_superseded` (a later continuation failed too — continue\n * `jobId` instead) or `render_final_already_rendered` (a Render final with this\n * very edit already completed — `jobId` holds the result). `code` and `status`\n * are what the server sent. Selected for exactly those three codes when the\n * answer carries a top-level `jobId`; every other 409 stays a plain\n * `NodaroError`.\n */\nexport class ContinuationRefusedError extends NodaroError {\n constructor(\n message: string,\n code: string,\n /** The job the refusal names. */\n public readonly jobId: string,\n ) {\n super(message, code, 409)\n this.name = \"ContinuationRefusedError\"\n }\n}\n\n/**\n * The one run that finishes a continuation held at a Preview review (the\n * `next` of {@link ContinuationPreviewPendingError}): pass these three fields\n * to `client.workflows.run`. It continues that execution, runs each held render\n * at Final and each held Tighten Episode continuing the run that made its\n * Preview, then every node after them.\n */\nexport interface HeldFinalRun {\n continueFromExecutionId: string\n /** The nodes it runs, in canvas order. */\n nodeIds: string[]\n /** For this run only: each held render at Final, each held use-case node's `useCaseContinue`. */\n inputOverrides: Record<string, Record<string, unknown>>\n}\n\n/**\n * HTTP 409 `continuation_preview_pending`: a continue-from-failed\n * (`client.workflows.run` with `continueMode: \"from-failed\"`) whose run's\n * newest later continuation completed by stopping at a Preview review, so\n * continuing again would stop there too. `executionId` is that continuation;\n * `renderNodeIds` the Apply EDL renders and `reviewNodeIds` the Tighten Episode\n * nodes holding it; `next` the run that finishes them — send it first\n * (`client.workflows.run(workflowId, error.next)`), then continue. Absent only\n * when the server could not name it. For a single held render, `next` is that\n * render's `client.workflows.renderFinal`.\n */\nexport class ContinuationPreviewPendingError extends NodaroError {\n constructor(\n message: string,\n public readonly executionId: string,\n public readonly renderNodeIds: readonly string[],\n public readonly reviewNodeIds: readonly string[],\n public readonly next?: HeldFinalRun,\n ) {\n super(message, \"continuation_preview_pending\", 409)\n this.name = \"ContinuationPreviewPendingError\"\n }\n}\n\nconst stringList = (v: unknown): string[] => (Array.isArray(v) ? v.filter((id): id is string => typeof id === \"string\") : [])\n\n/** A `next` as the server sends it, or undefined for anything else. */\nfunction heldFinalRunOf(v: unknown): HeldFinalRun | undefined {\n if (!v || typeof v !== \"object\") return undefined\n const r = v as Record<string, unknown>\n if (typeof r.continueFromExecutionId !== \"string\" || !Array.isArray(r.nodeIds)) return undefined\n if (!r.inputOverrides || typeof r.inputOverrides !== \"object\" || Array.isArray(r.inputOverrides)) return undefined\n return {\n continueFromExecutionId: r.continueFromExecutionId,\n nodeIds: stringList(r.nodeIds),\n inputOverrides: r.inputOverrides as Record<string, Record<string, unknown>>,\n }\n}\n\n/**\n * HTTP 409 `already_running` that names the execution under way (a top-level\n * `executionId`): the run you asked to start or continue is still running —\n * follow `executionId` (`client.executions.get`) instead of starting it again.\n * Sent by the workflow run route and by an app run's Retry\n * (`client.apps.resume`). An `already_running` that names a job instead stays\n * {@link ContinuationRefusedError}; one that names nothing, a plain\n * `NodaroError`.\n */\nexport class AlreadyRunningError extends NodaroError {\n constructor(\n message: string,\n /** The execution under way. */\n public readonly executionId: string,\n ) {\n super(message, \"already_running\", 409)\n this.name = \"AlreadyRunningError\"\n }\n}\n\n/**\n * HTTP 409 `app_run_version_changed`: a Retry of a failed app run\n * (`client.apps.resume`) refused because the app is on another version than\n * the one the run ran — continuing would mix them. `runVersion` is the run's\n * version, `appVersion` the one you are on (the `version` you sent, else the\n * app's latest). Start the run over (`client.apps.run`) to run `appVersion`,\n * or send `{ version: runVersion }` to continue on the run's own version.\n * Nothing was written or billed. Selected by code; the two numbers are\n * `undefined` when the answer does not carry them.\n */\nexport class AppRunVersionChangedError extends NodaroError {\n constructor(\n message: string,\n public readonly runVersion?: number,\n public readonly appVersion?: number,\n ) {\n super(message, \"app_run_version_changed\", 409)\n this.name = \"AppRunVersionChangedError\"\n }\n}\n\n/**\n * HTTP 422 `job_blocked`. A job policy registered by this deployment refused\n * the generation **before it ran** — no job was created, nothing was reserved\n * and nothing was charged. `message` is the policy's user-safe text: show it\n * as-is. Do not retry the identical request; whether the same input would be\n * judged differently is the deployment's policy's business.\n *\n * Only occurs on deployments that register a job policy. Selected by `code`,\n * not by status, the same way `workflow_conflict` narrows a 409 above — any\n * other 422 stays a plain `NodaroError`.\n */\nexport class JobBlockedError extends NodaroError {\n constructor(message = \"Blocked by this deployment's content policy\") {\n super(message, \"job_blocked\", 422)\n this.name = \"JobBlockedError\"\n }\n}\n\n/**\n * A job reached a terminal `failed`/`cancelled` status while being awaited by\n * `nodes.runAndWait` / `nodes.runMany`. Not an HTTP-level error (the polls\n * themselves succeeded), so `status` is 0 — distinguish it by type/`code`.\n * Carries the job's own `error_message` (as the message) and `jobId`.\n */\nexport class JobFailedError extends NodaroError {\n constructor(\n message: string,\n public readonly jobId: string,\n /** The terminal status that triggered the failure (`failed` | `cancelled`). */\n public readonly jobStatus: \"failed\" | \"cancelled\" = \"failed\",\n ) {\n super(message, \"job_failed\", 0)\n this.name = \"JobFailedError\"\n }\n}\n\n/**\n * `nodes.runAndWait` polled past its `maxMs` deadline without the job reaching\n * a terminal status. Not an HTTP error — `status` is 0; catch by type/`code`.\n */\nexport class JobTimeoutError extends NodaroError {\n constructor(\n message: string,\n public readonly jobId: string,\n /** The wall-clock deadline (ms) that was exceeded. */\n public readonly timeoutMs: number,\n ) {\n super(message, \"job_timeout\", 0)\n this.name = \"JobTimeoutError\"\n }\n}\n\n/**\n * The caller's `AbortSignal` fired while `nodes.runAndWait` was polling (or it\n * was already aborted on entry). Polling stops and this rejects. Not an HTTP\n * error — `status` is 0; catch by type/`code`.\n */\nexport class JobAbortedError extends NodaroError {\n constructor(message = \"Aborted\", public readonly jobId?: string) {\n super(message, \"job_aborted\", 0)\n this.name = \"JobAbortedError\"\n }\n}\n\n/**\n * A batch preview was asked for and this deployment cannot give one, so\n * NOTHING was sent: the batch is still unapplied and the production untouched.\n *\n * A preview is two requests because the route's body is parsed in strip mode —\n * a deployment that predates the preview silently DROPS the flag and APPLIES\n * the batch. So the SDK asks with an EMPTY batch first and sends the real one\n * only when that answer carries the `dryRun` marker. This is what it throws\n * when the answer does not: whatever the older deployment made of an empty\n * batch, the caller's batch never left.\n *\n * The remedy is a deployment that serves the preview — there is nothing to\n * retry here. To apply the batch instead, send it without the flag.\n *\n * A deployment that REFUSES the empty batch outright throws its own error\n * instead of this one, which is the right way round: the route's message says\n * more than \"unavailable\" does.\n *\n * Not an HTTP error: the request itself succeeded and answered the older shape.\n * `status` is 0; catch by type/`code`.\n */\nexport class StudioPreviewUnavailable extends NodaroError {\n constructor(\n message = \"This deployment does not preview operation batches; nothing was sent\",\n ) {\n super(message, \"studio_preview_unavailable\", 0)\n this.name = \"StudioPreviewUnavailable\"\n }\n}\n\n/**\n * A batch preview was asked for and the batch was APPLIED instead. The\n * production is written; this is the opposite of {@link\n * StudioPreviewUnavailable}, where nothing was sent.\n *\n * How it happens: the preview's proving ping and the batch are two requests,\n * and a fleet mid-rollout can serve them from different deployments. The ping\n * answers the marker, the batch reaches a deployment that predates the preview,\n * parses in strip mode, drops the flag and writes. The SDK cannot recall that\n * request — by the time the answer comes back the change has landed — so it\n * refuses to call the result a preview, which is the only thing still in its\n * gift. `receipts` and `warnings` are on both shapes, so an unchecked reply\n * would have shown a person what ALREADY happened under the heading of what\n * would.\n *\n * `applied` is what the route answered: the ordinary apply reply, whose\n * `production` and `version` are now the truth. Adopt them the way a plain\n * apply's caller does — do NOT re-send the batch, and do not present it for\n * approval.\n *\n * Not an HTTP error: the request succeeded, at the wrong thing. `status` is 0.\n */\nexport class StudioPreviewAppliedError extends NodaroError {\n constructor(\n /**\n * The apply reply the route sent back, as it sent it. An answer this\n * package does not recognise arrives here unchanged rather than being\n * dressed up: it is what the deployment said about a batch it took.\n *\n * `undefined` when the answer carried no body at all — a 204, an empty\n * envelope. The refusal still fires, because a non-preview answer is never\n * handed back as a preview, but there is nothing to report and the SDK will\n * not invent it: whether the batch was applied is unknown from here, and\n * the caller settles it by re-reading the production.\n */\n public readonly applied: StudioOpsResponse | undefined,\n message = applied\n ? \"Asked for a preview and this deployment APPLIED the batch; the change is written — see `applied`\"\n : \"Asked for a preview and this deployment answered with neither one nor a body to read; the batch may have been applied — re-read the production before deciding anything\",\n ) {\n super(message, \"studio_preview_applied\", 0)\n this.name = \"StudioPreviewAppliedError\"\n }\n}\n\n/**\n * The awaited job entered `pending_review`: a job policy registered by this\n * deployment held its output for a human reviewer. `pending_review` is\n * IN-FLIGHT, not terminal, so `nodes.runAndWait` / `nodes.runMany` end the\n * poll on the first tick they observe it rather than burning `maxMs` on a\n * status that no longer moves on its own.\n *\n * This does NOT cancel the job — the output exists, a human is reviewing it,\n * and the credit reservation stays `reserved` for the whole hold. Do not\n * re-run the request (a duplicate would be held too): re-fetch with\n * `jobs.get(jobId)` later, or surface \"awaiting review\" to your user and poll\n * `jobs.getStatus()` yourself. It resolves to `completed` (approved), `failed`\n * (rejected, with `error_hint.kind === \"policy-block\"`) or `cancelled`.\n *\n * Not an HTTP error — `status` is 0; catch by type/`code`.\n */\nexport class JobHeldError extends NodaroError {\n constructor(\n message: string,\n public readonly jobId: string,\n ) {\n super(message, \"job_held\", 0)\n this.name = \"JobHeldError\"\n }\n}\n\n/** The `{ error: { code, message, … } }` envelope every current route sends. */\ninterface ApiErrorEnvelope {\n code?: string\n message?: string\n missingScope?: string\n required?: number\n available?: number\n limitBytes?: number\n opIndex?: number\n [key: string]: unknown\n}\n\ninterface ApiErrorBody {\n /** The envelope — or, on an older route, a bare string (see {@link readErrorBody}). */\n error?: ApiErrorEnvelope | string\n /** A top-level message: an older route's, a bare validation answer's, or the server framework's own. */\n message?: unknown\n /** OAuth's human text (RFC 6749 §5.2), beside a bare-string `error`. */\n error_description?: unknown\n /** A bare validation answer's per-field issues (`{ message, issues }`). */\n issues?: unknown\n /** A refusal that names another job (see {@link ContinuationRefusedError}). */\n jobId?: unknown\n /** `continuation_preview_pending`: the held continuation, what holds it, and the run that finishes it. */\n executionId?: unknown\n renderNodeIds?: unknown\n reviewNodeIds?: unknown\n next?: unknown\n /** The credit guard's 402 sends its figures beside the envelope: what the run needs… */\n required?: unknown\n /** …and what the caller has (withheld on a deployment-paid instance). */\n balance?: unknown\n /** A per-user allowance's 402: what the allowance has left. */\n remaining?: unknown\n /** `app_run_version_changed`: the version the run ran, and the one the caller is on. */\n runVersion?: unknown\n appVersion?: unknown\n}\n\nconst finite = (v: unknown): number | undefined => (typeof v === \"number\" && Number.isFinite(v) ? v : undefined)\n\n/** A machine code as an older route writes it: lower snake_case, never a sentence or a reason phrase. */\nconst BARE_CODE = /^[a-z][a-z0-9_]*$/\n\nconst nonEmpty = (v: unknown): string | undefined => (typeof v === \"string\" && v.length > 0 ? v : undefined)\n\n/**\n * Where a body keeps its code and its human message. Most routes send the\n * envelope `{ error: { code, message } }`; three other shapes reach the SDK\n * too, and each is read for what it says rather than collapsed into\n * `internal_error` / \"Request failed\":\n *\n * - an older route's bare string, `{ error: \"<code>\", message?, … }` (character\n * training, a few profile and billing routes), and OAuth's\n * `{ error: \"<code>\", error_description }`. A snake_case string is the code;\n * a sentence (`\"Profile not found\"`) is the message.\n * - a bare validation answer, `{ message, issues: [...] }`: `validation_error`.\n * - the server framework's own answer, `{ statusCode, error: \"<reason phrase>\",\n * message }` (a route it does not have): the reason phrase is neither, the\n * message is kept — so \"no such route\" stays distinguishable from \"no such\n * resource\".\n *\n * At HTTP 500 and above only the CODE is read from outside the envelope. Text\n * there can be whatever the server failed with: the framework's own answer to\n * an uncaught throw is `{ statusCode: 500, error: \"Internal Server Error\",\n * message: <the raw error> }`, and the server's sanitizer rewrites only the\n * `internal_error` envelope. The envelope's own message is a route's chosen\n * sentence and is read at every status, as before.\n *\n * `message` is undefined when the body carries no human text it may show, so a\n * typed class keeps its own default (\"Not found\").\n */\nfunction readErrorBody(status: number, body: ApiErrorBody): { code: string | undefined; message: string | undefined; envelope: ApiErrorEnvelope } {\n const raw = body.error\n const envelope: ApiErrorEnvelope = raw && typeof raw === \"object\" ? raw : {}\n const bare = typeof raw === \"string\" ? raw : undefined\n const bareCode = bare !== undefined && BARE_CODE.test(bare) ? bare : undefined\n // Words with a space between them are human text: an older route's sentence,\n // or the framework's reason phrase — which always arrives with a real\n // `message`, read first. A single capitalised word (\"Unauthorized\") is a\n // reason phrase alone and says nothing the status does not.\n const bareSentence = bare !== undefined && bareCode === undefined && /\\s/.test(bare.trim()) ? bare : undefined\n const code =\n nonEmpty(envelope.code) ??\n bareCode ??\n (status === 400 && raw === undefined && Array.isArray(body.issues) ? \"validation_error\" : undefined)\n const outside = status >= 500 ? undefined : (nonEmpty(body.message) ?? nonEmpty(body.error_description) ?? bareSentence)\n const message = nonEmpty(envelope.message) ?? outside\n return { code, message, envelope }\n}\n\n/** The envelope's fields other than `code` and `message` (see {@link NodaroError.details}). */\nfunction envelopeDetails(envelope: ApiErrorEnvelope): Record<string, unknown> {\n const out: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(envelope)) {\n if (key !== \"code\" && key !== \"message\") out[key] = value\n }\n return out\n}\n\nexport function throwFromResponse(status: number, body: ApiErrorBody): never {\n try {\n selectError(status, body)\n } catch (err) {\n // Every class carries the envelope's other fields, whichever was chosen.\n if (err instanceof NodaroError) {\n const raw = body && typeof body === \"object\" ? body.error : undefined\n if (raw && typeof raw === \"object\") Object.defineProperty(err, \"details\", { value: envelopeDetails(raw), enumerable: true })\n }\n throw err\n }\n}\n\nfunction selectError(status: number, body: ApiErrorBody): never {\n // A body that is not an object (an empty answer, `null`, a bare string) still\n // throws by its status.\n const parsed: ApiErrorBody = body && typeof body === \"object\" ? body : {}\n const read = readErrorBody(status, parsed)\n const envelope = read.envelope\n const code = read.code ?? \"internal_error\"\n // A typed class falls back to its own default; a generic error to the code\n // it carries, which says more than \"Request failed\" does.\n const message = read.message ?? (read.code ? read.code : \"Request failed\")\n if (status === 401) throw new UnauthorizedError(read.message)\n if (status === 409 && (code === \"workflow_conflict\" || code === \"production_busy\")) {\n throw new WorkflowConflictError(\n read.message,\n envelope.currentUpdatedAt as string | undefined,\n envelope.currentVersion as number | undefined,\n envelope.currentRecord as Record<string, unknown> | undefined,\n code,\n )\n }\n // By shape, not by code — see StudioOpError. Only the studio operations route\n // sends an op index, so this cannot capture anyone else's 400.\n if (status >= 400 && status < 500 && typeof envelope.opIndex === \"number\") {\n throw new StudioOpError(message, code, status, envelope.opIndex)\n }\n if (status === 409 && CONTINUATION_REFUSAL_CODES.has(code) && typeof parsed.jobId === \"string\") {\n throw new ContinuationRefusedError(message, code, parsed.jobId)\n }\n if (status === 409 && code === \"continuation_preview_pending\" && typeof parsed.executionId === \"string\") {\n throw new ContinuationPreviewPendingError(\n message,\n parsed.executionId,\n stringList(parsed.renderNodeIds),\n stringList(parsed.reviewNodeIds),\n heldFinalRunOf(parsed.next),\n )\n }\n if (status === 409 && code === \"already_running\" && typeof parsed.executionId === \"string\") {\n throw new AlreadyRunningError(message, parsed.executionId)\n }\n if (status === 409 && code === \"app_run_version_changed\") {\n throw new AppRunVersionChangedError(message, finite(parsed.runVersion), finite(parsed.appVersion))\n }\n if (status === 422 && code === \"job_blocked\") throw new JobBlockedError(read.message)\n // The model, not the caller — before the scope line, so its own code is\n // kept (a plain ForbiddenError says \"forbidden\" whatever the server sent).\n const modelCode = read.code as ModelUnavailableCode | undefined\n if (status === 403 && modelCode !== undefined && MODEL_UNAVAILABLE_CODES.has(modelCode)) {\n throw new ModelUnavailableError(modelCode, read.message)\n }\n if (status === 403 && code === \"insufficient_scope\") {\n throw new ForbiddenError(read.message, envelope.missingScope)\n }\n if (status === 403) throw new ForbiddenError(read.message)\n // A 404 the framework answered itself (no route at that path) carries its\n // message at the top level, not under `error`; `readErrorBody` keeps it so\n // callers can tell \"no such route\" from \"no such resource\".\n if (status === 404) throw new NotFoundError(read.message)\n if (status === 429) throw new RateLimitedError(read.message)\n if (status === 402) {\n // The credit guard puts `required` / `balance` (an allowance: `remaining`)\n // beside the envelope; an envelope that carries them (`required` /\n // `available`) is read first.\n const required = finite(envelope.required) ?? finite(parsed.required)\n const available = finite(envelope.available) ?? finite(parsed.balance) ?? finite(parsed.remaining)\n const capCode = read.code as CreditCapCode | undefined\n if (capCode !== undefined && CREDIT_CAP_CODES.has(capCode)) {\n throw new CreditCapExceededError(capCode, read.message, required, available)\n }\n throw new InsufficientCreditsError(read.message, required, available, read.code ?? \"insufficient_credits\")\n }\n if (status === 413) throw new StorageExceededError(read.message, envelope.limitBytes)\n throw new NodaroError(message, code, status)\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkFM2KM5TY_cjs = require('./chunk-FM2KM5TY.cjs');
3
+ var chunkZ4B4SZ33_cjs = require('./chunk-Z4B4SZ33.cjs');
4
4
 
5
5
  // src/resources/studio-productions.ts
6
6
  function isStudioGenerateEstimate(result) {
@@ -104,11 +104,11 @@ var StudioProductionsResource = class {
104
104
  this.path(productionId, "/ops"),
105
105
  { body: { ops: [], dryRun: true } }
106
106
  );
107
- if (ping?.data?.dryRun !== true) throw new chunkFM2KM5TY_cjs.StudioPreviewUnavailable();
107
+ if (ping?.data?.dryRun !== true) throw new chunkZ4B4SZ33_cjs.StudioPreviewUnavailable();
108
108
  const res = await this.client.request("POST", this.path(productionId, "/ops"), { body: input });
109
109
  const data = res?.data;
110
110
  if (data?.dryRun !== true) {
111
- throw new chunkFM2KM5TY_cjs.StudioPreviewAppliedError(data);
111
+ throw new chunkZ4B4SZ33_cjs.StudioPreviewAppliedError(data);
112
112
  }
113
113
  return data;
114
114
  }
@@ -321,5 +321,5 @@ var StudioResource = class {
321
321
  exports.StudioProductionsResource = StudioProductionsResource;
322
322
  exports.StudioResource = StudioResource;
323
323
  exports.isStudioGenerateEstimate = isStudioGenerateEstimate;
324
- //# sourceMappingURL=chunk-NKH2UFSD.cjs.map
325
- //# sourceMappingURL=chunk-NKH2UFSD.cjs.map
324
+ //# sourceMappingURL=chunk-4WOT5OAY.cjs.map
325
+ //# sourceMappingURL=chunk-4WOT5OAY.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/resources/studio-productions.ts","../src/resources/studio.ts"],"names":["res","StudioPreviewUnavailable","StudioPreviewAppliedError"],"mappings":";;;;;AAwcO,SAAS,yBACd,MAAA,EACkC;AAClC,EAAA,OAAQ,OAAkC,MAAA,KAAW,IAAA;AACvD;AAmCO,IAAM,4BAAN,MAAgC;AAAA,EACrC,YAAoB,MAAA,EAA0B;AAA1B,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAA2B;AAAA,EAA3B,MAAA;AAAA,EAEZ,IAAA,CAAK,YAAA,EAAsB,MAAA,GAAS,EAAA,EAAY;AACtD,IAAA,OAAO,CAAA,uBAAA,EAA0B,kBAAA,CAAmB,YAAY,CAAC,GAAG,MAAM,CAAA,CAAA;AAAA,EAC5E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,KAAA,GAAsC;AAC1C,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,MAAA,CAAO,OAAA;AAAA,MAC5B,KAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,OAAO,GAAA,CAAI,IAAA;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,aAAa,IAAA,EAAoE;AACrF,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,MAAA,CAAO,OAAA;AAAA,MAC5B,MAAA;AAAA,MACA,iCAAA;AAAA,MACA,EAAE,IAAA,EAAM,EAAE,IAAA,EAAK;AAAE,KACnB;AACA,IAAA,OAAO,GAAA,CAAI,IAAA;AAAA,EACb;AAAA;AAAA,EAGA,MAAM,IAAA,CAAK,IAAA,GAAqC,EAAC,EAA2C;AAC1F,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,MAAA,CAAO,OAAA;AAAA,MAC5B,KAAA;AAAA,MACA,wBAAA;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AAA,UAAA,CAAA,EAAc,EAAE,IAAA,EAAM,IAAI,CAAA;AAAA,EAC1E;AACF","file":"chunk-NKH2UFSD.cjs","sourcesContent":["import type { NodaroClientCore } from \"../core.js\"\nimport { StudioPreviewAppliedError, StudioPreviewUnavailable } from \"../errors.js\"\n\n/**\n * Studio productions — `/v1/studio/productions`.\n *\n * A production is a Nodaro workflow whose `settings.studio` holds the shots:\n * each shot a framed still, an optional animated clip, and the plan, looks,\n * cast bindings and voice that made them. These routes are the platform's own\n * reader and writer of that document, so an agent, a script and the studio app\n * are looking at ONE production rather than three opinions about one row.\n *\n * Two rules run through the whole surface:\n *\n * - **Every change is an OPERATION** ({@link StudioProductionsResource.ops}),\n * addressed by stable key — a shot id, a role slug, a result's job id or url\n * — and never by position. That is what lets two writers hold the same\n * production open: a batch composed against a slightly older version still\n * applies correctly to the newest one, and the response says whether it was\n * rebased.\n * - **Generation is run-then-poll.** A still or clip run returns job ids and\n * records a marker on the production; the results land when anyone — your\n * poll, the app, a later {@link StudioProductionsResource.reconcile} —\n * reports the finished job. Nothing waits minutes inside a request.\n *\n * Reads are `detail: \"summary\"` by default (counts and the active urls);\n * `detail: \"full\"` adds every result with the context that regenerates it.\n *\n * **The ENVELOPES are typed here; the production DOCUMENT is not.** A view, a\n * summary, a shot and an operation are open JSON on this surface\n * ({@link StudioProduction}, `ops: unknown[]`) — their field-level types ship\n * with the studio app, which is the one consumer that narrows them, and a\n * second spelling of that vocabulary in the SDK would drift from it the first\n * time either grew. Everything a caller branches on — `version`, `rebased`,\n * `receipts`, `warnings`, a quote's `credits`, a run's `jobIds` — is typed.\n *\n * Cloud edition only: these routes 404 on deployments that do not serve them.\n * Feature-detect once with `list()` — a deployment without them 404s that too,\n * where a deployment with them answers an empty page.\n */\n\n/**\n * A production, a summary, a shot, a receipt's target: open JSON.\n *\n * Deliberately not narrowed here — see the note at the top of this module.\n */\nexport type StudioProduction = Record<string, unknown>\n\n/** How much of a production a read returns. */\nexport type StudioProductionDetail = \"summary\" | \"full\"\n\n/** One thing wrong with a plan, addressed at the field that is wrong. */\nexport interface StudioPlanIssue {\n path: string\n message: string\n hint?: string\n}\n\n/** `GET …/skill` — the authoring skill, rendered at request time from what is live. */\nexport interface StudioSkillResponse {\n /** The authoring guide. */\n skill: string\n /** Every picker, model and enum, in full. */\n catalog: string\n /** The strict JSON Schema a plan is validated against. */\n schema: Record<string, unknown>\n /** The operating guide: the tool map, the loops, the rules. */\n operating: string\n /** The versions the three were rendered from — bare semver, no package names. */\n generatedFrom: { prompts: string; shared: string; codec: string }\n}\n\nexport interface StudioValidatePlanResponse {\n valid: boolean\n errors: StudioPlanIssue[]\n warnings: StudioPlanIssue[]\n summary?: {\n name?: string\n scenes: number\n shots: number\n cast: number\n /** Cast entries that matched a row in the caller's library. */\n bound: number\n }\n}\n\nexport interface StudioListProductionsResponse {\n data: StudioProduction[]\n nextCursor?: string\n}\n\n/** What a create or an import did, in the words a receipt would use. */\nexport interface StudioImportSummary {\n shotsAdded: number\n castEnrolled: number\n /** Cast entries that resolved to a row in the caller's library. */\n castBound: number\n}\n\nexport interface StudioProductionResponse {\n production: StudioProduction\n warnings?: StudioPlanIssue[]\n summary?: StudioImportSummary\n}\n\nexport interface StudioCreateProductionRequest {\n name?: string\n plan?: Record<string, unknown>\n}\n\n/** The caller's own retry token — 8–128 chars of `A-Za-z0-9_.:-`, never derived. */\nexport type StudioClientRequestId = string\n\n/**\n * A batch of operations, applied atomically.\n *\n * `ops` is `unknown[]`: the operation union is the studio app's vocabulary and\n * the route validates it, refusing the whole batch with the offending index.\n * The served operating guide is the runtime reference for what an operation\n * looks like.\n */\nexport interface StudioOpsRequest {\n /** Applied in order. At most 100 per request. */\n ops: unknown[]\n /**\n * The version the batch was composed against. INFORMATIONAL by default: the\n * operations address by stable KEY, so a batch built on a slightly older\n * document still applies exactly to the newest one, and the response says\n * `rebased: true`. Omitting it means \"apply to whatever is there\".\n */\n baseVersion?: number\n /**\n * Refuse to rebase. With `strict: true` a `baseVersion` older than the stored\n * one is a 409 `workflow_conflict` carrying the current production, instead\n * of a rebased apply — for the rare \"replace exactly what I read\" intent.\n */\n strict?: boolean\n /** Your own token for this batch, so a transport retry is not applied twice. */\n clientRequestId?: StudioClientRequestId\n}\n\n/**\n * What else an operation touched — the work that now has to follow it.\n *\n * Reported by the operations whose effect reaches past the thing they name: a\n * frame review re-opens every frame derived from it and every shot bound to\n * those, a sequence fork mints a whole parallel set. Both lists are always\n * present and either may be empty; ids, never counts, because the caller's job\n * is to go and refresh THOSE.\n */\nexport interface StudioOpsImpact {\n /** Planned frames the operation reaches, the named one first. */\n keyframeIds: string[]\n /** Shots bound to any of those frames. */\n shotIds: string[]\n}\n\n/**\n * A sentence as data: the id of the template a client words it from, and the\n * values that fill the template's slots.\n *\n * It travels beside the English wording, never instead of it. A client that\n * words the sentence in the person's language builds it from `template` and\n * `vars`, and shows the English wording whenever it has no wording for\n * `template` or `vars` does not fill it — so a template id it has never heard of\n * costs nothing. A template id is permanent: a change to its slots or its\n * meaning ships as a new id.\n */\nexport interface StudioOpsText {\n /** The template's id. */\n template: string\n /** What fills the template's slots, by slot name. */\n vars: Record<string, string | number>\n}\n\n/**\n * One line of what an operation did, in the words a change log would use.\n *\n * Past tense, the target named the way the user sees it, the side effect in a\n * trailing parenthetical: `Deleted take 2 of Shot 1 (in the bin).`\n */\nexport interface StudioOpsReceipt {\n /** The operation this line reports, by name. */\n op: string\n /** Past tense, naming the target the way a person would. */\n summary: string\n /**\n * `summary` as data, for a client that words receipts in the person's\n * language. `summary` is always present and always English; read `detail`\n * only when you have wording for its template, and show `summary` when you do\n * not. Absent when the studio service that answered predates it.\n */\n detail?: StudioOpsText\n /** Ids the operation MINTED — never ids the caller supplied. */\n ids?: string[]\n /**\n * The dependency scope, where the operation reports one — absent for the\n * many that touch only what they name. The route projects a receipt ONCE for\n * both answers, so this reads the same on an apply and on a preview.\n */\n impact?: StudioOpsImpact\n}\n\n/** What a batch produced. Adopt `production` whole; do not merge into it. */\nexport interface StudioOpsResponse {\n /** The canonical production AFTER the batch. */\n production: StudioProduction\n /** The version the batch produced. Carry it as the next `baseVersion`. */\n version: number\n /** True when the batch was applied to a newer document than it named. */\n rebased: boolean\n /** One per operation, in order. */\n receipts: StudioOpsReceipt[]\n /**\n * Things worth saying that are not failures — an operation that changed\n * nothing, a rename that rewrote four prompts. A warning never rejects a\n * batch; a refusal does.\n */\n warnings: string[]\n /**\n * `warnings` as data, by position: entry `i` words `warnings[i]`, and `null`\n * means that warning has no wording but the English one. The service sends it\n * only when it is exactly as long as `warnings`, so treat a list of any other\n * length as absent. Absent too when the studio service that answered predates\n * it.\n */\n warningDetails?: Array<StudioOpsText | null>\n}\n\n/**\n * An operation's confirmation class — the vocabulary's own four letters.\n *\n * `S` safe · `D` delete · `P` changes who can reach the work · `$` spends\n * credits. The table that assigns them ships with the production codec and is\n * pinned complete over the operation union there; this is the wire's spelling\n * of its values, not a second table.\n */\nexport type StudioOpClass = \"S\" | \"D\" | \"P\" | \"$\"\n\n/**\n * One line of what an operation WOULD do, for a person deciding whether to let\n * it. Everything {@link StudioOpsReceipt} says — the same summary, the same ids\n * and the same {@link StudioOpsImpact}, read in the conditional — plus the two\n * things the decision turns on and only a preview needs: which kind of change\n * it is, and whether it can be taken back.\n */\nexport interface StudioOpsDryRunReceipt extends StudioOpsReceipt {\n /**\n * The confirmation class, read out of the operation vocabulary's own table:\n * `S` safe, `D` deletes, `P` changes who can reach the work, `$` spends\n * credits. Narrow rather than open, because it is what a caller branches on\n * — a rule like \"never a `D` without asking\" is only writable if the\n * compiler knows the letters.\n */\n class: StudioOpClass\n /**\n * Present, and always `true`, when this operation put something in the bin\n * that can be brought back. ABSENT is the honest answer for everything else,\n * including a delete that destroys: there is no entry to name, so there is no\n * promise to make. Read it as `restorable ?? false`, never as `!restorable`\n * meaning \"kept\".\n */\n restorable?: true\n}\n\n/**\n * What a batch WOULD do. Nothing was written: there is no production here and\n * no new version, because none was produced.\n */\nexport interface StudioOpsDryRunResponse {\n /** Always present, and the marker the two-request protocol reads. */\n dryRun: true\n /** The version the preview was computed against. */\n version: number\n /** One per operation, in order. */\n receipts: StudioOpsDryRunReceipt[]\n /** The same things an apply would have said. */\n warnings: string[]\n /** The same data behind them an apply would have sent: see {@link StudioOpsResponse.warningDetails}. */\n warningDetails?: Array<StudioOpsText | null>\n}\n\n/** What landing the finished jobs did. */\nexport interface StudioReconcileResponse {\n /** Job ids whose media is now on the production. */\n landed: string[]\n /** Job ids still running — their markers stay; call again later. */\n pending: string[]\n /** Job ids that failed or were cancelled; their markers are cleared. */\n failed: string[]\n /** One line per landing that had something to say. */\n warnings: string[]\n /** The production after the landings. */\n production: StudioProduction\n /** Its version — unchanged when nothing landed. */\n version: number\n}\n\n/** `POST …/:id/describe` — a Director run that will land as scenes. */\nexport interface StudioDescribeRequest {\n brief: string\n llmModel: string\n /** `\"append\"` adds the drafted scenes; `\"replace\"` rewrites the film. */\n mode?: \"append\" | \"replace\"\n label?: string\n clientRequestId?: StudioClientRequestId\n}\n\n/**\n * `POST …/:id/generate` — one framing or directing run for one shot.\n *\n * `overrides` is what the CALL owns over what the shot's plan says: the model,\n * the prose, the aspect, the direction ids. Open JSON, because the request\n * builders' own option types are the contract and they ship with the studio.\n */\nexport interface StudioGenerateRequest {\n kind: \"still\" | \"clip\"\n shotId: string\n /** Candidates to fan out (stills); the builder clamps it to the catalog's range. */\n count?: number\n /**\n * The directing input mode for a clip; absent ⇒ derived from the scene's saved\n * inputs (a pinned end frame included). `start` sends ONLY the start frame;\n * `start-end` sends the start and the end frame.\n */\n mode?: \"start\" | \"start-end\" | \"references\"\n /** Price the run and return; nothing is submitted and nothing is written. */\n dryRun?: boolean\n clientRequestId?: StudioClientRequestId\n overrides?: Record<string, unknown>\n}\n\n/** Which video route a directing run went to — chosen from the inputs, never asked for. */\nexport type StudioVideoLane = \"generate-video\" | \"text-to-video\"\n\n/** `dryRun: true` — what this run would cost, and nothing else. */\nexport interface StudioGenerateEstimate {\n dryRun: true\n provider: string\n count: number\n /** `null` when the model is unpriced or the instance runs without credits. */\n credits: number | null\n lane?: StudioVideoLane\n}\n\n/**\n * A started (or already-started) run.\n *\n * `deduped` means the same `clientRequestId` came back and the job ids were\n * answered from the production's own markers — nothing was submitted and\n * nothing was charged, so `production` is absent.\n */\nexport interface StudioGenerateResponse {\n jobIds: string[]\n lane?: StudioVideoLane\n deduped?: true\n production?: StudioProduction\n receipts?: StudioOpsReceipt[]\n warnings?: string[]\n}\n\n/** `POST …/:id/frame` — a still pulled out of the shot's clip. */\nexport interface StudioFrameRequest {\n shotId: string\n mode?: \"first\" | \"last\" | \"timestamp\"\n /** Seconds, when `mode` is `\"timestamp\"`. */\n timestamp?: number\n /** Where the grabbed image lands. `\"new-shot\"` inserts a shot after this one. */\n target?: \"new-shot\" | \"start-frame\" | \"end-frame\" | \"still\"\n clientRequestId?: StudioClientRequestId\n}\n\n/** `POST …/:id/voice` — synthesize a shot's spoken line and record it. */\nexport interface StudioVoiceRequest {\n shotId: string\n text: string\n voiceId?: string\n voiceType?: \"premade\" | \"custom\" | \"library\"\n ttsProvider?: string\n /** The delivery levers; the text-to-speech route owns their bounds. */\n delivery?: Record<string, number>\n clientRequestId?: StudioClientRequestId\n}\n\n/** `POST …/:id/revoice` — recast the voices of the shot's active clip. */\nexport interface StudioRevoiceRequest {\n shotId: string\n /** The speaker-ordered recast plan, forwarded to the voice route verbatim. */\n plan: Record<string, unknown>\n clientRequestId?: StudioClientRequestId\n}\n\n/** `POST …/:id/music` — the film's soundtrack. */\nexport interface StudioMusicRequest {\n prompt: string\n duration?: number\n instrumental?: boolean\n vocalGender?: string\n model?: string\n clientRequestId?: StudioClientRequestId\n}\n\n/**\n * What a route that finished its work answers with: the production as it now\n * stands, plus whatever that route produced.\n *\n * `jobId` is present on the routes that only STARTED something (a revoice, a\n * soundtrack, a draft) — the result lands through its marker.\n */\nexport interface StudioMediaResponse {\n production: StudioProduction\n /** The grabbed frame's url, on the frame route. */\n url?: string\n jobId?: string\n receipts?: StudioOpsReceipt[]\n warnings?: string[]\n}\n\n/**\n * `GET …/:id/export-plan` — the ordered steps an export would run.\n *\n * The caller runs them with the verbs that already exist; a route that chained\n * three minutes-long jobs is the long-lived request every client times out on.\n */\nexport interface StudioExportPlanResponse {\n /** False when the production has fewer than two clips — nothing to stitch. */\n canExport: boolean\n steps: StudioExportStep[]\n /** The step whose output IS the film, or `null` when nothing can run. */\n resultStepId: string | null\n /** Total credits, or `null` when ANY step is unpriced (a partial sum understates). */\n estimate: number | null\n /** The credit models with no price, each named once, in step order. */\n unpriced: string[]\n}\n\nexport interface StudioExportStep {\n /** Stable within one plan and derived from the production, never minted. */\n id: string\n label: string\n /** The node this step runs — `merge-video-audio`, `combine-videos`, `video-upscale`. */\n node: string\n creditModel: string\n credits: number | null\n params: Record<string, unknown>\n}\n\n/** `POST …/:id/clone` — a copy, which always starts private and visible. */\nexport interface StudioCloneRequest {\n name?: string\n}\n\n/** Either arm of a generation reply: the quote, or the run that started. */\nexport type StudioGenerateResult = StudioGenerateEstimate | StudioGenerateResponse\n\n/** True when a generation reply is the `dryRun` QUOTE rather than a started run. */\nexport function isStudioGenerateEstimate(\n result: StudioGenerateResult,\n): result is StudioGenerateEstimate {\n return (result as StudioGenerateEstimate).dryRun === true\n}\n\n/** What a `generateStill` / `generateClip` call decides, beyond `kind` and the shot. */\nexport type StudioGenerateOptions = Omit<StudioGenerateRequest, \"kind\" | \"shotId\">\n\n/**\n * A route that only STARTED something — a draft, a revoice, a soundtrack. Its\n * `jobId` is always there, which is what makes `const { jobId } = await …` and\n * a poll the honest next line.\n *\n * `StudioMediaResponse` leaves `jobId` optional because the routes that FINISH\n * their work (a frame, a voiceover) share the shape and have no job to name.\n */\nexport type StudioJobStartedResponse = StudioMediaResponse & { jobId: string }\n\nexport interface ListStudioProductionsOptions {\n limit?: number\n /** From a previous page's `nextCursor`. */\n cursor?: string\n /** Include the rows the dashboard hides. Off by default. */\n includeArchived?: boolean\n}\n\nexport interface GetProductionOptions {\n detail?: StudioProductionDetail\n /** Read ONE shot — the cheap way to re-read after a generation. */\n shotId?: string\n}\n\nexport interface StudioExportPlanOptions {\n /** Plan the 4K finish too. Expensive, so it is always explicit. */\n upscale?: boolean\n}\n\n/** `client.studio.productions` — see the note at the top of this module. */\nexport class StudioProductionsResource {\n constructor(private client: NodaroClientCore) {}\n\n private path(productionId: string, suffix = \"\"): string {\n return `/v1/studio/productions/${encodeURIComponent(productionId)}${suffix}`\n }\n\n // ── reads ────────────────────────────────────────────────────────────────\n\n /**\n * The authoring guide, the full catalog, the plan's JSON Schema and the\n * operating guide — rendered server-side from the version that is live, so\n * they describe the platform you are actually talking to. Free.\n */\n async skill(): Promise<StudioSkillResponse> {\n const res = await this.client.request<{ data: StudioSkillResponse }>(\n \"GET\",\n \"/v1/studio/productions/skill\",\n )\n return res.data\n }\n\n /**\n * Check a plan before it becomes anything. Free, persists nothing, and\n * resolves cast names against YOUR library — loop on `errors` until\n * `valid: true`, then `create({ plan })`.\n */\n async validatePlan(plan: Record<string, unknown>): Promise<StudioValidatePlanResponse> {\n const res = await this.client.request<{ data: StudioValidatePlanResponse }>(\n \"POST\",\n \"/v1/studio/productions/validate\",\n { body: { plan } },\n )\n return res.data\n }\n\n /** Your productions, newest first. Archived rows are hidden unless asked for. */\n async list(opts: ListStudioProductionsOptions = {}): Promise<StudioListProductionsResponse> {\n const res = await this.client.request<{ data: StudioListProductionsResponse }>(\n \"GET\",\n \"/v1/studio/productions\",\n {\n query: {\n limit: opts.limit,\n cursor: opts.cursor,\n includeArchived: opts.includeArchived,\n },\n },\n )\n return res.data\n }\n\n /**\n * One production. A pure read — it never lands a finished job, so call\n * {@link reconcile} first if you are waiting on one.\n */\n async get(\n productionId: string,\n opts: GetProductionOptions = {},\n ): Promise<StudioProduction> {\n const res = await this.client.request<{ data: { production: StudioProduction } }>(\n \"GET\",\n this.path(productionId),\n { query: { detail: opts.detail, shot_id: opts.shotId } },\n )\n return res.data.production\n }\n\n /**\n * The ordered steps that assemble the film, with what they will cost. Run\n * them yourself with the ordinary verbs — nothing here blocks for minutes,\n * and nothing here spends.\n */\n async exportPlan(\n productionId: string,\n opts: StudioExportPlanOptions = {},\n ): Promise<StudioExportPlanResponse> {\n const res = await this.client.request<{ data: StudioExportPlanResponse }>(\n \"GET\",\n this.path(productionId, \"/export-plan\"),\n { query: { upscale: opts.upscale } },\n )\n return res.data\n }\n\n // ── writes ───────────────────────────────────────────────────────────────\n\n /** A new production, optionally landed from a plan in the same call. */\n async create(input: StudioCreateProductionRequest = {}): Promise<StudioProductionResponse> {\n const res = await this.client.request<{ data: StudioProductionResponse }>(\n \"POST\",\n \"/v1/studio/productions\",\n { body: input },\n )\n return res.data\n }\n\n /**\n * Apply a batch of operations. Atomic: one bad operation refuses the whole\n * batch with a `StudioOpError` naming its index, and nothing is written. On\n * success adopt `production` wholesale and carry `version` forward as the\n * next `baseVersion`.\n *\n * `dryRun: true` — the LITERAL, which is what selects the preview reply —\n * asks what the batch would do, so a person can approve an assistant's edits\n * before they land. Spell it in THIS call's own object literal: a flag passed\n * through a variable widens `true` to `boolean`, which selects the apply\n * overload while the runtime still takes the preview path.\n *\n * A preview is TWO requests, deliberately. The route's body is parsed in\n * strip mode, so a deployment that predates the preview drops the flag and\n * APPLIES the batch: a caller that sent its batch and read the answer\n * afterwards would already have written it. So the flag is proved on an EMPTY\n * batch first and the real batch goes only when that answer carries the\n * marker. An older deployment either answers the apply shape — this throws\n * `StudioPreviewUnavailable`, and the batch never leaves — or refuses the\n * empty batch with its own error, which is passed through as it stands.\n *\n * The ping proves the deployment that answered IT, and a fleet mid-rollout\n * can serve the second request from another one. So the second answer is\n * checked too: when the batch came back APPLIED, this throws\n * `StudioPreviewAppliedError`, which carries that write. The SDK cannot\n * un-send a request; what it can do is refuse to call the result a preview.\n *\n * An apply stays exactly one request.\n */\n ops(\n productionId: string,\n input: StudioOpsRequest & { dryRun: true },\n ): Promise<StudioOpsDryRunResponse>\n ops(productionId: string, input: StudioOpsRequest): Promise<StudioOpsResponse>\n async ops(\n productionId: string,\n input: StudioOpsRequest & { dryRun?: true },\n ): Promise<StudioOpsResponse | StudioOpsDryRunResponse> {\n if (input.dryRun !== true) {\n const res = await this.client.request<{ data: StudioOpsResponse }>(\n \"POST\",\n this.path(productionId, \"/ops\"),\n { body: input },\n )\n return res.data\n }\n\n // The ping carries nothing of the caller's batch, because an old deployment\n // takes whatever it is sent at face value; an empty batch with no\n // `clientRequestId` spends neither the caller's operations nor the retry\n // token that would make a real batch unrepeatable.\n const ping = await this.client.request<{ data?: { dryRun?: unknown } } | undefined>(\n \"POST\",\n this.path(productionId, \"/ops\"),\n { body: { ops: [], dryRun: true } },\n )\n // Read through: an older deployment can answer no envelope at all, or a 204\n // that `request` reads as `undefined`. Absent is a \"no\" like any other, and\n // the caller who catches `NodaroError` should not get a `TypeError`.\n if (ping?.data?.dryRun !== true) throw new StudioPreviewUnavailable()\n\n const res = await this.client.request<\n { data?: StudioOpsDryRunResponse | StudioOpsResponse } | undefined\n >(\"POST\", this.path(productionId, \"/ops\"), { body: input })\n // The answer that matters most: this request may have landed on a different\n // deployment from the ping, and an applied batch is not a preview.\n const data = res?.data\n if ((data as { dryRun?: unknown } | undefined)?.dryRun !== true) {\n throw new StudioPreviewAppliedError(data as StudioOpsResponse)\n }\n return data as StudioOpsDryRunResponse\n }\n\n /**\n * Land every generation that has finished since you last looked, and report\n * what is still running. The one call that turns finished jobs into results\n * without a browser open. It writes only when something actually landed.\n */\n async reconcile(productionId: string): Promise<StudioReconcileResponse> {\n const res = await this.client.request<{ data: StudioReconcileResponse }>(\n \"POST\",\n this.path(productionId, \"/reconcile\"),\n )\n return res.data\n }\n\n /** Add a plan's scenes to a production that already exists. */\n async importPlan(\n productionId: string,\n plan: Record<string, unknown>,\n opts: { mode?: \"append\" } = {},\n ): Promise<StudioProductionResponse> {\n const res = await this.client.request<{ data: StudioProductionResponse }>(\n \"POST\",\n this.path(productionId, \"/import\"),\n { body: { plan, mode: opts.mode ?? \"append\" } },\n )\n return res.data\n }\n\n /**\n * Turn a brief into scenes. The run is a platform job: poll it, and its\n * scenes land through {@link reconcile}. The production comes back with the\n * run recorded on it as a pending draft.\n */\n async describe(\n productionId: string,\n input: StudioDescribeRequest,\n ): Promise<StudioJobStartedResponse> {\n const res = await this.client.request<{ data: StudioJobStartedResponse }>(\n \"POST\",\n this.path(productionId, \"/describe\"),\n { body: input },\n )\n return res.data\n }\n\n // ── generation ───────────────────────────────────────────────────────────\n\n /**\n * Frame or animate one shot.\n *\n * The request is assembled server-side from the shot's own plan, looks and\n * bound references, so a scripted run and a press of the button in the app\n * produce the same media; `overrides` changes THIS run without changing the\n * shot. Prefer {@link generateStill} / {@link generateClip}, which say which\n * kind they mean.\n *\n * `dryRun: true` returns the quote and writes nothing — narrow the reply with\n * {@link isStudioGenerateEstimate}.\n */\n generate(\n productionId: string,\n input: StudioGenerateRequest & { dryRun: true },\n ): Promise<StudioGenerateEstimate>\n generate(\n productionId: string,\n input: StudioGenerateRequest,\n ): Promise<StudioGenerateResult>\n async generate(\n productionId: string,\n input: StudioGenerateRequest,\n ): Promise<StudioGenerateResult> {\n const res = await this.client.request<{ data: StudioGenerateResult }>(\n \"POST\",\n this.path(productionId, \"/generate\"),\n { body: input },\n )\n return res.data\n }\n\n /**\n * Frame a shot: submit `count` candidates and record a pending marker for\n * each. Results ACCUMULATE — a generate never replaces what is there.\n *\n * `clientRequestId` makes a retry safe: the same token answers with the jobs\n * the first call started (`deduped: true`) and submits nothing. Never retry a\n * spend without it.\n */\n generateStill(\n productionId: string,\n shotId: string,\n opts: StudioGenerateOptions & { dryRun: true },\n ): Promise<StudioGenerateEstimate>\n generateStill(\n productionId: string,\n shotId: string,\n opts?: StudioGenerateOptions,\n ): Promise<StudioGenerateResult>\n generateStill(\n productionId: string,\n shotId: string,\n opts: StudioGenerateOptions = {},\n ): Promise<StudioGenerateResult> {\n return this.generate(productionId, { ...opts, kind: \"still\", shotId })\n }\n\n /**\n * Animate a shot. The LANE is chosen from the shot's inputs (a start frame,\n * references, a prompt) — never passed in — and reported back as `lane`.\n */\n generateClip(\n productionId: string,\n shotId: string,\n opts: StudioGenerateOptions & { dryRun: true },\n ): Promise<StudioGenerateEstimate>\n generateClip(\n productionId: string,\n shotId: string,\n opts?: StudioGenerateOptions,\n ): Promise<StudioGenerateResult>\n generateClip(\n productionId: string,\n shotId: string,\n opts: StudioGenerateOptions = {},\n ): Promise<StudioGenerateResult> {\n return this.generate(productionId, { ...opts, kind: \"clip\", shotId })\n }\n\n // ── media on one shot ────────────────────────────────────────────────────\n\n /**\n * Extract a frame from a shot's active clip and put it where `target` says —\n * a new shot after this one (the default), this shot's sticky start or end\n * frame, or another still of the same shot. Seconds, not minutes: this one\n * waits for the job and answers with the changed production.\n */\n async frame(\n productionId: string,\n input: StudioFrameRequest,\n ): Promise<StudioMediaResponse> {\n const res = await this.client.request<{ data: StudioMediaResponse }>(\n \"POST\",\n this.path(productionId, \"/frame\"),\n { body: input },\n )\n return res.data\n }\n\n /** Synthesize a shot's spoken line and record it. Waits for the job. */\n async voice(\n productionId: string,\n input: StudioVoiceRequest,\n ): Promise<StudioMediaResponse> {\n const res = await this.client.request<{ data: StudioMediaResponse }>(\n \"POST\",\n this.path(productionId, \"/voice\"),\n { body: input },\n )\n return res.data\n }\n\n /**\n * Recast the voices of a shot's active clip. Minutes of work, so it answers\n * `jobId` and the new clip lands as a result through its own marker.\n */\n async revoice(\n productionId: string,\n input: StudioRevoiceRequest,\n ): Promise<StudioJobStartedResponse> {\n const res = await this.client.request<{ data: StudioJobStartedResponse }>(\n \"POST\",\n this.path(productionId, \"/revoice\"),\n { body: input },\n )\n return res.data\n }\n\n /** Score the film. The finished track lands through its pending marker. */\n async music(\n productionId: string,\n input: StudioMusicRequest,\n ): Promise<StudioJobStartedResponse> {\n const res = await this.client.request<{ data: StudioJobStartedResponse }>(\n \"POST\",\n this.path(productionId, \"/music\"),\n { body: input },\n )\n return res.data\n }\n\n // ── audience and copies ──────────────────────────────────────────────────\n\n /**\n * Open the share-by-link read. Deliberately its own route rather than an\n * operation: who may see the work is decided by the owner, never as a side\n * effect of a batch that was editing something else.\n */\n async share(productionId: string): Promise<StudioProduction> {\n const res = await this.client.request<{ data: StudioMediaResponse }>(\n \"POST\",\n this.path(productionId, \"/share\"),\n { body: { shared: true } },\n )\n return res.data.production\n }\n\n /** Close it again. Sharing is opt-in AND reversible. */\n async unshare(productionId: string): Promise<StudioProduction> {\n const res = await this.client.request<{ data: StudioMediaResponse }>(\n \"POST\",\n this.path(productionId, \"/unshare\"),\n )\n return res.data.production\n }\n\n /**\n * Copy a production you own or can see into your own Studio project. The\n * copy starts PRIVATE and visible — sharing and archiving never travel — and\n * it is copied through YOUR view of the source, so somebody else's bin does\n * not come with it.\n */\n async clone(\n productionId: string,\n input: StudioCloneRequest = {},\n ): Promise<StudioProduction> {\n const res = await this.client.request<{ data: { production: StudioProduction } }>(\n \"POST\",\n this.path(productionId, \"/clone\"),\n { body: input },\n )\n return res.data.production\n }\n}\n\n","import type { NodaroClientCore } from \"../core.js\"\nimport { StudioProductionsResource } from \"./studio-productions.js\"\nexport * from \"./studio-productions.js\"\n\n/** Public response/transport contracts only; document validation and planning\n * remain in the private Studio codec on the server. */\nexport type StudioDocumentJson = Record<string, unknown>\n\nexport interface StudioProductionCapabilities {\n planVersions: number[]\n operations: {\n readKeyframes: boolean\n saveEditorState?: boolean\n editableSharedCopies?: boolean\n revisionedSharing?: boolean\n cloneLinkedProductions?: boolean\n importPlannedBundles?: boolean\n importLinkedBundles?: boolean\n appendPlannedBundles?: boolean\n appendLinkedBundles?: boolean\n editKeyframes: boolean\n generateKeyframes: boolean\n acceptKeyframes: boolean\n rejectKeyframes?: boolean\n editSequencePlans?: boolean\n generateLinkedClips: boolean\n retakeLinkedClips?: boolean\n /** The host keeps a scene's empty media slots. */\n mediaSlots?: boolean\n /** The host keeps a clip's inputs on its clip slot. */\n clipSlotInputs?: boolean\n }\n sourceFrameReferences: boolean\n automaticAcceptance: false\n unattendedGeneration: false\n}\n\nexport interface StudioKeyframeRecord {\n id: string\n label: string\n revision: number\n nodeId: string\n parentKeyframeId?: string\n previewResultKey: string | null\n previewUrl: string | null\n acceptedResultKey: string | null\n acceptedUrl: string | null\n count: number\n pending: Array<{ jobId: string; startedAt: string }>\n /** Owner-only working state. Recorded acceptance is not an execution grant. */\n plan?: StudioDocumentJson\n acceptance?: StudioDocumentJson\n results?: StudioDocumentJson[]\n}\n\nexport interface StudioProductionRecord {\n id: string\n name: string\n version: number\n updatedAt: string\n thumbnailUrl: string | null\n shared: boolean\n archived: boolean\n requiredCapabilities?: string[]\n keyframes?: StudioKeyframeRecord[]\n sequences?: StudioDocumentJson[]\n shots: StudioDocumentJson[]\n pending: { stills: number; clips: number; keyframes?: number; music: boolean; draft: StudioDocumentJson | null }\n [field: string]: unknown\n}\n\nexport interface StudioProductionReply {\n production: StudioProductionRecord\n capabilities?: StudioProductionCapabilities\n warnings?: unknown[]\n [field: string]: unknown\n}\n\nexport interface StudioEditInput {\n ops: ReadonlyArray<{ op: string; [field: string]: unknown }>\n baseVersion?: number\n strict?: boolean\n clientRequestId?: string\n}\n\nexport interface StudioKeyframeGenerationInput {\n keyframeId: string\n expectedRevision: number\n clientRequestId?: string\n overrides?: StudioDocumentJson\n}\n\nexport interface StudioKeyframeAcceptanceInput {\n keyframeId: string\n expectedRevision: number\n resultKey: string\n expectedAcceptedResultKey: string | null\n requirementChecks: Array<{ requirementId: string; outcome: \"pass\" | \"waived\" }>\n waivedReason?: string\n}\n\nexport interface StudioShotGenerationInput {\n kind: \"still\" | \"clip\"\n shotId: string\n clientRequestId?: string\n count?: number\n mode?: \"start\" | \"start-end\" | \"references\"\n dryRun?: boolean\n /** Linked clips only: require the exact inputs returned by a reviewed quote. */\n expectedInputHash?: string\n /** Retake a native linked take using its original request and retained endpoints. */\n retakeResultKey?: string\n overrides?: StudioDocumentJson\n}\n\nexport type StudioGenerationReply = {\n jobIds: string[]\n production?: StudioProductionRecord\n deduped?: true\n lane?: string\n [field: string]: unknown\n} | {\n dryRun: true; provider: string; count: number; credits: number | null; lane?: string\n /** Linked-clip quotes include normalized settings and accepted endpoint pins. */\n inputHash?: string\n endpointPins?: StudioDocumentJson\n creditIdentifier?: string\n duration?: number\n resolution?: string\n aspectRatio?: string\n sound?: boolean\n}\n\nconst root = \"/v1/studio/productions\"\nconst path = (id: string) => `${root}/${encodeURIComponent(id)}`\n\n/** Cloud plugin routes. Check capabilities before exposing dependency controls.\n * Reads do not reconcile jobs, submit media or accept generated candidates. */\nexport class StudioResource {\n readonly productions: StudioProductionsResource\n\n constructor(private readonly client: NodaroClientCore) {\n this.productions = new StudioProductionsResource(client)\n }\n\n capabilities(): Promise<{ data: StudioProductionCapabilities }> {\n return this.client.request(\"GET\", `${root}/capabilities`)\n }\n\n skill(): Promise<{ data: StudioDocumentJson }> {\n return this.client.request(\"GET\", `${root}/skill`)\n }\n\n list(options: { limit?: number; cursor?: string; includeArchived?: boolean } = {}): Promise<{ data: {\n data: Array<{ id: string; name: string; version: number; updatedAt: string; thumbnailUrl: string | null; shared: boolean; archived: boolean; shotCount: number }>\n nextCursor?: string\n } }> {\n return this.client.request(\"GET\", root, { query: options })\n }\n\n get(id: string, options: { detail?: \"summary\" | \"full\"; shotId?: string } = {}): Promise<{ data: StudioProductionReply }> {\n return this.client.request(\"GET\", path(id), { query: { detail: options.detail, shot_id: options.shotId } })\n }\n\n validatePlan(plan: StudioDocumentJson): Promise<{ data: { valid: boolean; errors: StudioDocumentJson[]; warnings: StudioDocumentJson[]; summary?: StudioDocumentJson } }> {\n return this.client.request(\"POST\", `${root}/validate`, { body: { plan } })\n }\n\n create(input: { name?: string; plan?: StudioDocumentJson }): Promise<{ data: StudioProductionReply }> {\n return this.client.request(\"POST\", root, { body: input })\n }\n\n /** Import a portable document through the compatible server writer.\n * Retained frame media requires an authorized source; acceptance never transfers. */\n importBundle(input: { bundle: StudioDocumentJson; projectId?: string }): Promise<{ data: StudioProductionReply }> {\n return this.client.request(\"POST\", `${root}/import-bundle`, { body: input })\n }\n\n /** Append a bundle's scenes and frame closure under an exact destination revision. */\n appendBundle(id: string, input: { bundle: StudioDocumentJson; expectedVersion: number;\n afterShotId?: string; applyFilm?: boolean }): Promise<{ data: {\n production: StudioProductionRecord; importedShotIds: string[]; importedKeyframeIds: string[];\n } }> {\n return this.client.request(\"POST\", `${path(id)}/import-bundle`, { body: input })\n }\n\n /** Copy a saved production. Linked copies retain verified inputs, remap\n * dependencies and require fresh frame acceptance; they start no media jobs. */\n clone(id: string, input: { name?: string; projectId?: string; expectedVersion?: number } = {}): Promise<{ data: StudioProductionReply }> {\n return this.client.request(\"POST\", `${path(id)}/clone`, { body: input })\n }\n\n edit(id: string, input: StudioEditInput): Promise<{ data: StudioProductionReply & { version: number; rebased: boolean; receipts: StudioDocumentJson[] } }> {\n return this.client.request(\"POST\", `${path(id)}/ops`, { body: input })\n }\n\n /** Audience-authorized sharing; an expected revision prevents publication\n * of concurrent edits the caller has not reviewed. */\n setShared(id: string, input: { shared: boolean; allowEditableCopy?: boolean; expectedVersion?: number }): Promise<{ data: StudioProductionReply }> {\n return this.client.request(\"POST\", `${path(id)}/share`, { body: input })\n }\n\n /** Save ordinary editor fields against the loaded revision. Protected frame\n * and job state can only change through their dedicated semantic actions. */\n saveEditorState(id: string, input: { expectedVersion: number; graph: object; clientRequestId?: string }) {\n return this.edit(id, {\n baseVersion: input.expectedVersion, strict: true,\n ...(input.clientRequestId ? { clientRequestId: input.clientRequestId } : {}),\n ops: [{ op: \"save_editor_state\", expectedVersion: input.expectedVersion, graph: input.graph }],\n })\n }\n\n generateKeyframe(id: string, input: StudioKeyframeGenerationInput): Promise<{ data: Exclude<StudioGenerationReply, { dryRun: true }> }> {\n return this.client.request(\"POST\", `${path(id)}/generate`, { body: { ...input, kind: \"keyframe\" } })\n }\n\n generateShot(id: string, input: StudioShotGenerationInput): Promise<{ data: StudioGenerationReply }> {\n return this.client.request(\"POST\", `${path(id)}/generate`, { body: input })\n }\n\n /** A separate explicit review action; generation never calls this method. */\n acceptKeyframe(id: string, input: StudioKeyframeAcceptanceInput,\n concurrency: Pick<StudioEditInput, \"baseVersion\" | \"strict\" | \"clientRequestId\"> = {}) {\n return this.edit(id, { ...concurrency, ops: [{ ...input, op: \"accept_keyframe_result\" }] })\n }\n\n reconcile(id: string): Promise<{ data: StudioProductionReply & { landed: string[]; pending: string[]; failed: string[]; version: number } }> {\n return this.client.request(\"POST\", `${path(id)}/reconcile`, { body: {} })\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/resources/studio-productions.ts","../src/resources/studio.ts"],"names":["res","StudioPreviewUnavailable","StudioPreviewAppliedError"],"mappings":";;;;;AAwcO,SAAS,yBACd,MAAA,EACkC;AAClC,EAAA,OAAQ,OAAkC,MAAA,KAAW,IAAA;AACvD;AAmCO,IAAM,4BAAN,MAAgC;AAAA,EACrC,YAAoB,MAAA,EAA0B;AAA1B,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAA2B;AAAA,EAA3B,MAAA;AAAA,EAEZ,IAAA,CAAK,YAAA,EAAsB,MAAA,GAAS,EAAA,EAAY;AACtD,IAAA,OAAO,CAAA,uBAAA,EAA0B,kBAAA,CAAmB,YAAY,CAAC,GAAG,MAAM,CAAA,CAAA;AAAA,EAC5E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,KAAA,GAAsC;AAC1C,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,MAAA,CAAO,OAAA;AAAA,MAC5B,KAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,OAAO,GAAA,CAAI,IAAA;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,aAAa,IAAA,EAAoE;AACrF,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,MAAA,CAAO,OAAA;AAAA,MAC5B,MAAA;AAAA,MACA,iCAAA;AAAA,MACA,EAAE,IAA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,GAAG,WAAA,EAAa,GAAA,EAAK,CAAC,EAAE,GAAG,KAAA,EAAO,EAAA,EAAI,wBAAA,EAA0B,GAAG,CAAA;AAAA,EAC5F;AAAA,EAEA,UAAU,EAAA,EAAmI;AAC3I,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,EAAQ,CAAA,EAAG,IAAA,CAAK,EAAE,CAAC,CAAA,UAAA,CAAA,EAAc,EAAE,IAAA,EAAM,IAAI,CAAA;AAAA,EAC1E;AACF","file":"chunk-4WOT5OAY.cjs","sourcesContent":["import type { NodaroClientCore } from \"../core.js\"\nimport { StudioPreviewAppliedError, StudioPreviewUnavailable } from \"../errors.js\"\n\n/**\n * Studio productions — `/v1/studio/productions`.\n *\n * A production is a Nodaro workflow whose `settings.studio` holds the shots:\n * each shot a framed still, an optional animated clip, and the plan, looks,\n * cast bindings and voice that made them. These routes are the platform's own\n * reader and writer of that document, so an agent, a script and the studio app\n * are looking at ONE production rather than three opinions about one row.\n *\n * Two rules run through the whole surface:\n *\n * - **Every change is an OPERATION** ({@link StudioProductionsResource.ops}),\n * addressed by stable key — a shot id, a role slug, a result's job id or url\n * — and never by position. That is what lets two writers hold the same\n * production open: a batch composed against a slightly older version still\n * applies correctly to the newest one, and the response says whether it was\n * rebased.\n * - **Generation is run-then-poll.** A still or clip run returns job ids and\n * records a marker on the production; the results land when anyone — your\n * poll, the app, a later {@link StudioProductionsResource.reconcile} —\n * reports the finished job. Nothing waits minutes inside a request.\n *\n * Reads are `detail: \"summary\"` by default (counts and the active urls);\n * `detail: \"full\"` adds every result with the context that regenerates it.\n *\n * **The ENVELOPES are typed here; the production DOCUMENT is not.** A view, a\n * summary, a shot and an operation are open JSON on this surface\n * ({@link StudioProduction}, `ops: unknown[]`) — their field-level types ship\n * with the studio app, which is the one consumer that narrows them, and a\n * second spelling of that vocabulary in the SDK would drift from it the first\n * time either grew. Everything a caller branches on — `version`, `rebased`,\n * `receipts`, `warnings`, a quote's `credits`, a run's `jobIds` — is typed.\n *\n * Cloud edition only: these routes 404 on deployments that do not serve them.\n * Feature-detect once with `list()` — a deployment without them 404s that too,\n * where a deployment with them answers an empty page.\n */\n\n/**\n * A production, a summary, a shot, a receipt's target: open JSON.\n *\n * Deliberately not narrowed here — see the note at the top of this module.\n */\nexport type StudioProduction = Record<string, unknown>\n\n/** How much of a production a read returns. */\nexport type StudioProductionDetail = \"summary\" | \"full\"\n\n/** One thing wrong with a plan, addressed at the field that is wrong. */\nexport interface StudioPlanIssue {\n path: string\n message: string\n hint?: string\n}\n\n/** `GET …/skill` — the authoring skill, rendered at request time from what is live. */\nexport interface StudioSkillResponse {\n /** The authoring guide. */\n skill: string\n /** Every picker, model and enum, in full. */\n catalog: string\n /** The strict JSON Schema a plan is validated against. */\n schema: Record<string, unknown>\n /** The operating guide: the tool map, the loops, the rules. */\n operating: string\n /** The versions the three were rendered from — bare semver, no package names. */\n generatedFrom: { prompts: string; shared: string; codec: string }\n}\n\nexport interface StudioValidatePlanResponse {\n valid: boolean\n errors: StudioPlanIssue[]\n warnings: StudioPlanIssue[]\n summary?: {\n name?: string\n scenes: number\n shots: number\n cast: number\n /** Cast entries that matched a row in the caller's library. */\n bound: number\n }\n}\n\nexport interface StudioListProductionsResponse {\n data: StudioProduction[]\n nextCursor?: string\n}\n\n/** What a create or an import did, in the words a receipt would use. */\nexport interface StudioImportSummary {\n shotsAdded: number\n castEnrolled: number\n /** Cast entries that resolved to a row in the caller's library. */\n castBound: number\n}\n\nexport interface StudioProductionResponse {\n production: StudioProduction\n warnings?: StudioPlanIssue[]\n summary?: StudioImportSummary\n}\n\nexport interface StudioCreateProductionRequest {\n name?: string\n plan?: Record<string, unknown>\n}\n\n/** The caller's own retry token — 8–128 chars of `A-Za-z0-9_.:-`, never derived. */\nexport type StudioClientRequestId = string\n\n/**\n * A batch of operations, applied atomically.\n *\n * `ops` is `unknown[]`: the operation union is the studio app's vocabulary and\n * the route validates it, refusing the whole batch with the offending index.\n * The served operating guide is the runtime reference for what an operation\n * looks like.\n */\nexport interface StudioOpsRequest {\n /** Applied in order. At most 100 per request. */\n ops: unknown[]\n /**\n * The version the batch was composed against. INFORMATIONAL by default: the\n * operations address by stable KEY, so a batch built on a slightly older\n * document still applies exactly to the newest one, and the response says\n * `rebased: true`. Omitting it means \"apply to whatever is there\".\n */\n baseVersion?: number\n /**\n * Refuse to rebase. With `strict: true` a `baseVersion` older than the stored\n * one is a 409 `workflow_conflict` carrying the current production, instead\n * of a rebased apply — for the rare \"replace exactly what I read\" intent.\n */\n strict?: boolean\n /** Your own token for this batch, so a transport retry is not applied twice. */\n clientRequestId?: StudioClientRequestId\n}\n\n/**\n * What else an operation touched — the work that now has to follow it.\n *\n * Reported by the operations whose effect reaches past the thing they name: a\n * frame review re-opens every frame derived from it and every shot bound to\n * those, a sequence fork mints a whole parallel set. Both lists are always\n * present and either may be empty; ids, never counts, because the caller's job\n * is to go and refresh THOSE.\n */\nexport interface StudioOpsImpact {\n /** Planned frames the operation reaches, the named one first. */\n keyframeIds: string[]\n /** Shots bound to any of those frames. */\n shotIds: string[]\n}\n\n/**\n * A sentence as data: the id of the template a client words it from, and the\n * values that fill the template's slots.\n *\n * It travels beside the English wording, never instead of it. A client that\n * words the sentence in the person's language builds it from `template` and\n * `vars`, and shows the English wording whenever it has no wording for\n * `template` or `vars` does not fill it — so a template id it has never heard of\n * costs nothing. A template id is permanent: a change to its slots or its\n * meaning ships as a new id.\n */\nexport interface StudioOpsText {\n /** The template's id. */\n template: string\n /** What fills the template's slots, by slot name. */\n vars: Record<string, string | number>\n}\n\n/**\n * One line of what an operation did, in the words a change log would use.\n *\n * Past tense, the target named the way the user sees it, the side effect in a\n * trailing parenthetical: `Deleted take 2 of Shot 1 (in the bin).`\n */\nexport interface StudioOpsReceipt {\n /** The operation this line reports, by name. */\n op: string\n /** Past tense, naming the target the way a person would. */\n summary: string\n /**\n * `summary` as data, for a client that words receipts in the person's\n * language. `summary` is always present and always English; read `detail`\n * only when you have wording for its template, and show `summary` when you do\n * not. Absent when the studio service that answered predates it.\n */\n detail?: StudioOpsText\n /** Ids the operation MINTED — never ids the caller supplied. */\n ids?: string[]\n /**\n * The dependency scope, where the operation reports one — absent for the\n * many that touch only what they name. The route projects a receipt ONCE for\n * both answers, so this reads the same on an apply and on a preview.\n */\n impact?: StudioOpsImpact\n}\n\n/** What a batch produced. Adopt `production` whole; do not merge into it. */\nexport interface StudioOpsResponse {\n /** The canonical production AFTER the batch. */\n production: StudioProduction\n /** The version the batch produced. Carry it as the next `baseVersion`. */\n version: number\n /** True when the batch was applied to a newer document than it named. */\n rebased: boolean\n /** One per operation, in order. */\n receipts: StudioOpsReceipt[]\n /**\n * Things worth saying that are not failures — an operation that changed\n * nothing, a rename that rewrote four prompts. A warning never rejects a\n * batch; a refusal does.\n */\n warnings: string[]\n /**\n * `warnings` as data, by position: entry `i` words `warnings[i]`, and `null`\n * means that warning has no wording but the English one. The service sends it\n * only when it is exactly as long as `warnings`, so treat a list of any other\n * length as absent. Absent too when the studio service that answered predates\n * it.\n */\n warningDetails?: Array<StudioOpsText | null>\n}\n\n/**\n * An operation's confirmation class — the vocabulary's own four letters.\n *\n * `S` safe · `D` delete · `P` changes who can reach the work · `$` spends\n * credits. The table that assigns them ships with the production codec and is\n * pinned complete over the operation union there; this is the wire's spelling\n * of its values, not a second table.\n */\nexport type StudioOpClass = \"S\" | \"D\" | \"P\" | \"$\"\n\n/**\n * One line of what an operation WOULD do, for a person deciding whether to let\n * it. Everything {@link StudioOpsReceipt} says — the same summary, the same ids\n * and the same {@link StudioOpsImpact}, read in the conditional — plus the two\n * things the decision turns on and only a preview needs: which kind of change\n * it is, and whether it can be taken back.\n */\nexport interface StudioOpsDryRunReceipt extends StudioOpsReceipt {\n /**\n * The confirmation class, read out of the operation vocabulary's own table:\n * `S` safe, `D` deletes, `P` changes who can reach the work, `$` spends\n * credits. Narrow rather than open, because it is what a caller branches on\n * — a rule like \"never a `D` without asking\" is only writable if the\n * compiler knows the letters.\n */\n class: StudioOpClass\n /**\n * Present, and always `true`, when this operation put something in the bin\n * that can be brought back. ABSENT is the honest answer for everything else,\n * including a delete that destroys: there is no entry to name, so there is no\n * promise to make. Read it as `restorable ?? false`, never as `!restorable`\n * meaning \"kept\".\n */\n restorable?: true\n}\n\n/**\n * What a batch WOULD do. Nothing was written: there is no production here and\n * no new version, because none was produced.\n */\nexport interface StudioOpsDryRunResponse {\n /** Always present, and the marker the two-request protocol reads. */\n dryRun: true\n /** The version the preview was computed against. */\n version: number\n /** One per operation, in order. */\n receipts: StudioOpsDryRunReceipt[]\n /** The same things an apply would have said. */\n warnings: string[]\n /** The same data behind them an apply would have sent: see {@link StudioOpsResponse.warningDetails}. */\n warningDetails?: Array<StudioOpsText | null>\n}\n\n/** What landing the finished jobs did. */\nexport interface StudioReconcileResponse {\n /** Job ids whose media is now on the production. */\n landed: string[]\n /** Job ids still running — their markers stay; call again later. */\n pending: string[]\n /** Job ids that failed or were cancelled; their markers are cleared. */\n failed: string[]\n /** One line per landing that had something to say. */\n warnings: string[]\n /** The production after the landings. */\n production: StudioProduction\n /** Its version — unchanged when nothing landed. */\n version: number\n}\n\n/** `POST …/:id/describe` — a Director run that will land as scenes. */\nexport interface StudioDescribeRequest {\n brief: string\n llmModel: string\n /** `\"append\"` adds the drafted scenes; `\"replace\"` rewrites the film. */\n mode?: \"append\" | \"replace\"\n label?: string\n clientRequestId?: StudioClientRequestId\n}\n\n/**\n * `POST …/:id/generate` — one framing or directing run for one shot.\n *\n * `overrides` is what the CALL owns over what the shot's plan says: the model,\n * the prose, the aspect, the direction ids. Open JSON, because the request\n * builders' own option types are the contract and they ship with the studio.\n */\nexport interface StudioGenerateRequest {\n kind: \"still\" | \"clip\"\n shotId: string\n /** Candidates to fan out (stills); the builder clamps it to the catalog's range. */\n count?: number\n /**\n * The directing input mode for a clip; absent ⇒ derived from the scene's saved\n * inputs (a pinned end frame included). `start` sends ONLY the start frame;\n * `start-end` sends the start and the end frame.\n */\n mode?: \"start\" | \"start-end\" | \"references\"\n /** Price the run and return; nothing is submitted and nothing is written. */\n dryRun?: boolean\n clientRequestId?: StudioClientRequestId\n overrides?: Record<string, unknown>\n}\n\n/** Which video route a directing run went to — chosen from the inputs, never asked for. */\nexport type StudioVideoLane = \"generate-video\" | \"text-to-video\"\n\n/** `dryRun: true` — what this run would cost, and nothing else. */\nexport interface StudioGenerateEstimate {\n dryRun: true\n provider: string\n count: number\n /** `null` when the model is unpriced or the instance runs without credits. */\n credits: number | null\n lane?: StudioVideoLane\n}\n\n/**\n * A started (or already-started) run.\n *\n * `deduped` means the same `clientRequestId` came back and the job ids were\n * answered from the production's own markers — nothing was submitted and\n * nothing was charged, so `production` is absent.\n */\nexport interface StudioGenerateResponse {\n jobIds: string[]\n lane?: StudioVideoLane\n deduped?: true\n production?: StudioProduction\n receipts?: StudioOpsReceipt[]\n warnings?: string[]\n}\n\n/** `POST …/:id/frame` — a still pulled out of the shot's clip. */\nexport interface StudioFrameRequest {\n shotId: string\n mode?: \"first\" | \"last\" | \"timestamp\"\n /** Seconds, when `mode` is `\"timestamp\"`. */\n timestamp?: number\n /** Where the grabbed image lands. `\"new-shot\"` inserts a shot after this one. */\n target?: \"new-shot\" | \"start-frame\" | \"end-frame\" | \"still\"\n clientRequestId?: StudioClientRequestId\n}\n\n/** `POST …/:id/voice` — synthesize a shot's spoken line and record it. */\nexport interface StudioVoiceRequest {\n shotId: string\n text: string\n voiceId?: string\n voiceType?: \"premade\" | \"custom\" | \"library\"\n ttsProvider?: string\n /** The delivery levers; the text-to-speech route owns their bounds. */\n delivery?: Record<string, number>\n clientRequestId?: StudioClientRequestId\n}\n\n/** `POST …/:id/revoice` — recast the voices of the shot's active clip. */\nexport interface StudioRevoiceRequest {\n shotId: string\n /** The speaker-ordered recast plan, forwarded to the voice route verbatim. */\n plan: Record<string, unknown>\n clientRequestId?: StudioClientRequestId\n}\n\n/** `POST …/:id/music` — the film's soundtrack. */\nexport interface StudioMusicRequest {\n prompt: string\n duration?: number\n instrumental?: boolean\n vocalGender?: string\n model?: string\n clientRequestId?: StudioClientRequestId\n}\n\n/**\n * What a route that finished its work answers with: the production as it now\n * stands, plus whatever that route produced.\n *\n * `jobId` is present on the routes that only STARTED something (a revoice, a\n * soundtrack, a draft) — the result lands through its marker.\n */\nexport interface StudioMediaResponse {\n production: StudioProduction\n /** The grabbed frame's url, on the frame route. */\n url?: string\n jobId?: string\n receipts?: StudioOpsReceipt[]\n warnings?: string[]\n}\n\n/**\n * `GET …/:id/export-plan` — the ordered steps an export would run.\n *\n * The caller runs them with the verbs that already exist; a route that chained\n * three minutes-long jobs is the long-lived request every client times out on.\n */\nexport interface StudioExportPlanResponse {\n /** False when the production has fewer than two clips — nothing to stitch. */\n canExport: boolean\n steps: StudioExportStep[]\n /** The step whose output IS the film, or `null` when nothing can run. */\n resultStepId: string | null\n /** Total credits, or `null` when ANY step is unpriced (a partial sum understates). */\n estimate: number | null\n /** The credit models with no price, each named once, in step order. */\n unpriced: string[]\n}\n\nexport interface StudioExportStep {\n /** Stable within one plan and derived from the production, never minted. */\n id: string\n label: string\n /** The node this step runs — `merge-video-audio`, `combine-videos`, `video-upscale`. */\n node: string\n creditModel: string\n credits: number | null\n params: Record<string, unknown>\n}\n\n/** `POST …/:id/clone` — a copy, which always starts private and visible. */\nexport interface StudioCloneRequest {\n name?: string\n}\n\n/** Either arm of a generation reply: the quote, or the run that started. */\nexport type StudioGenerateResult = StudioGenerateEstimate | StudioGenerateResponse\n\n/** True when a generation reply is the `dryRun` QUOTE rather than a started run. */\nexport function isStudioGenerateEstimate(\n result: StudioGenerateResult,\n): result is StudioGenerateEstimate {\n return (result as StudioGenerateEstimate).dryRun === true\n}\n\n/** What a `generateStill` / `generateClip` call decides, beyond `kind` and the shot. */\nexport type StudioGenerateOptions = Omit<StudioGenerateRequest, \"kind\" | \"shotId\">\n\n/**\n * A route that only STARTED something — a draft, a revoice, a soundtrack. Its\n * `jobId` is always there, which is what makes `const { jobId } = await …` and\n * a poll the honest next line.\n *\n * `StudioMediaResponse` leaves `jobId` optional because the routes that FINISH\n * their work (a frame, a voiceover) share the shape and have no job to name.\n */\nexport type StudioJobStartedResponse = StudioMediaResponse & { jobId: string }\n\nexport interface ListStudioProductionsOptions {\n limit?: number\n /** From a previous page's `nextCursor`. */\n cursor?: string\n /** Include the rows the dashboard hides. Off by default. */\n includeArchived?: boolean\n}\n\nexport interface GetProductionOptions {\n detail?: StudioProductionDetail\n /** Read ONE shot — the cheap way to re-read after a generation. */\n shotId?: string\n}\n\nexport interface StudioExportPlanOptions {\n /** Plan the 4K finish too. Expensive, so it is always explicit. */\n upscale?: boolean\n}\n\n/** `client.studio.productions` — see the note at the top of this module. */\nexport class StudioProductionsResource {\n constructor(private client: NodaroClientCore) {}\n\n private path(productionId: string, suffix = \"\"): string {\n return `/v1/studio/productions/${encodeURIComponent(productionId)}${suffix}`\n }\n\n // ── reads ────────────────────────────────────────────────────────────────\n\n /**\n * The authoring guide, the full catalog, the plan's JSON Schema and the\n * operating guide — rendered server-side from the version that is live, so\n * they describe the platform you are actually talking to. Free.\n */\n async skill(): Promise<StudioSkillResponse> {\n const res = await this.client.request<{ data: StudioSkillResponse }>(\n \"GET\",\n \"/v1/studio/productions/skill\",\n )\n return res.data\n }\n\n /**\n * Check a plan before it becomes anything. Free, persists nothing, and\n * resolves cast names against YOUR library — loop on `errors` until\n * `valid: true`, then `create({ plan })`.\n */\n async validatePlan(plan: Record<string, unknown>): Promise<StudioValidatePlanResponse> {\n const res = await this.client.request<{ data: StudioValidatePlanResponse }>(\n \"POST\",\n \"/v1/studio/productions/validate\",\n { body: { plan } },\n )\n return res.data\n }\n\n /** Your productions, newest first. Archived rows are hidden unless asked for. */\n async list(opts: ListStudioProductionsOptions = {}): Promise<StudioListProductionsResponse> {\n const res = await this.client.request<{ data: StudioListProductionsResponse }>(\n \"GET\",\n \"/v1/studio/productions\",\n {\n query: {\n limit: opts.limit,\n cursor: opts.cursor,\n includeArchived: opts.includeArchived,\n },\n },\n )\n return res.data\n }\n\n /**\n * One production. A pure read — it never lands a finished job, so call\n * {@link reconcile} first if you are waiting on one.\n */\n async get(\n productionId: string,\n opts: GetProductionOptions = {},\n ): Promise<StudioProduction> {\n const res = await this.client.request<{ data: { production: StudioProduction } }>(\n \"GET\",\n this.path(productionId),\n { query: { detail: opts.detail, shot_id: opts.shotId } },\n )\n return res.data.production\n }\n\n /**\n * The ordered steps that assemble the film, with what they will cost. Run\n * them yourself with the ordinary verbs — nothing here blocks for minutes,\n * and nothing here spends.\n */\n async exportPlan(\n productionId: string,\n opts: StudioExportPlanOptions = {},\n ): Promise<StudioExportPlanResponse> {\n const res = await this.client.request<{ data: StudioExportPlanResponse }>(\n \"GET\",\n this.path(productionId, \"/export-plan\"),\n { query: { upscale: opts.upscale } },\n )\n return res.data\n }\n\n // ── writes ───────────────────────────────────────────────────────────────\n\n /** A new production, optionally landed from a plan in the same call. */\n async create(input: StudioCreateProductionRequest = {}): Promise<StudioProductionResponse> {\n const res = await this.client.request<{ data: StudioProductionResponse }>(\n \"POST\",\n \"/v1/studio/productions\",\n { body: input },\n )\n return res.data\n }\n\n /**\n * Apply a batch of operations. Atomic: one bad operation refuses the whole\n * batch with a `StudioOpError` naming its index, and nothing is written. On\n * success adopt `production` wholesale and carry `version` forward as the\n * next `baseVersion`.\n *\n * `dryRun: true` — the LITERAL, which is what selects the preview reply —\n * asks what the batch would do, so a person can approve an assistant's edits\n * before they land. Spell it in THIS call's own object literal: a flag passed\n * through a variable widens `true` to `boolean`, which selects the apply\n * overload while the runtime still takes the preview path.\n *\n * A preview is TWO requests, deliberately. The route's body is parsed in\n * strip mode, so a deployment that predates the preview drops the flag and\n * APPLIES the batch: a caller that sent its batch and read the answer\n * afterwards would already have written it. So the flag is proved on an EMPTY\n * batch first and the real batch goes only when that answer carries the\n * marker. An older deployment either answers the apply shape — this throws\n * `StudioPreviewUnavailable`, and the batch never leaves — or refuses the\n * empty batch with its own error, which is passed through as it stands.\n *\n * The ping proves the deployment that answered IT, and a fleet mid-rollout\n * can serve the second request from another one. So the second answer is\n * checked too: when the batch came back APPLIED, this throws\n * `StudioPreviewAppliedError`, which carries that write. The SDK cannot\n * un-send a request; what it can do is refuse to call the result a preview.\n *\n * An apply stays exactly one request.\n */\n ops(\n productionId: string,\n input: StudioOpsRequest & { dryRun: true },\n ): Promise<StudioOpsDryRunResponse>\n ops(productionId: string, input: StudioOpsRequest): Promise<StudioOpsResponse>\n async ops(\n productionId: string,\n input: StudioOpsRequest & { dryRun?: true },\n ): Promise<StudioOpsResponse | StudioOpsDryRunResponse> {\n if (input.dryRun !== true) {\n const res = await this.client.request<{ data: StudioOpsResponse }>(\n \"POST\",\n this.path(productionId, \"/ops\"),\n { body: input },\n )\n return res.data\n }\n\n // The ping carries nothing of the caller's batch, because an old deployment\n // takes whatever it is sent at face value; an empty batch with no\n // `clientRequestId` spends neither the caller's operations nor the retry\n // token that would make a real batch unrepeatable.\n const ping = await this.client.request<{ data?: { dryRun?: unknown } } | undefined>(\n \"POST\",\n this.path(productionId, \"/ops\"),\n { body: { ops: [], dryRun: true } },\n )\n // Read through: an older deployment can answer no envelope at all, or a 204\n // that `request` reads as `undefined`. Absent is a \"no\" like any other, and\n // the caller who catches `NodaroError` should not get a `TypeError`.\n if (ping?.data?.dryRun !== true) throw new StudioPreviewUnavailable()\n\n const res = await this.client.request<\n { data?: StudioOpsDryRunResponse | StudioOpsResponse } | undefined\n >(\"POST\", this.path(productionId, \"/ops\"), { body: input })\n // The answer that matters most: this request may have landed on a different\n // deployment from the ping, and an applied batch is not a preview.\n const data = res?.data\n if ((data as { dryRun?: unknown } | undefined)?.dryRun !== true) {\n throw new StudioPreviewAppliedError(data as StudioOpsResponse)\n }\n return data as StudioOpsDryRunResponse\n }\n\n /**\n * Land every generation that has finished since you last looked, and report\n * what is still running. The one call that turns finished jobs into results\n * without a browser open. It writes only when something actually landed.\n */\n async reconcile(productionId: string): Promise<StudioReconcileResponse> {\n const res = await this.client.request<{ data: StudioReconcileResponse }>(\n \"POST\",\n this.path(productionId, \"/reconcile\"),\n )\n return res.data\n }\n\n /** Add a plan's scenes to a production that already exists. */\n async importPlan(\n productionId: string,\n plan: Record<string, unknown>,\n opts: { mode?: \"append\" } = {},\n ): Promise<StudioProductionResponse> {\n const res = await this.client.request<{ data: StudioProductionResponse }>(\n \"POST\",\n this.path(productionId, \"/import\"),\n { body: { plan, mode: opts.mode ?? \"append\" } },\n )\n return res.data\n }\n\n /**\n * Turn a brief into scenes. The run is a platform job: poll it, and its\n * scenes land through {@link reconcile}. The production comes back with the\n * run recorded on it as a pending draft.\n */\n async describe(\n productionId: string,\n input: StudioDescribeRequest,\n ): Promise<StudioJobStartedResponse> {\n const res = await this.client.request<{ data: StudioJobStartedResponse }>(\n \"POST\",\n this.path(productionId, \"/describe\"),\n { body: input },\n )\n return res.data\n }\n\n // ── generation ───────────────────────────────────────────────────────────\n\n /**\n * Frame or animate one shot.\n *\n * The request is assembled server-side from the shot's own plan, looks and\n * bound references, so a scripted run and a press of the button in the app\n * produce the same media; `overrides` changes THIS run without changing the\n * shot. Prefer {@link generateStill} / {@link generateClip}, which say which\n * kind they mean.\n *\n * `dryRun: true` returns the quote and writes nothing — narrow the reply with\n * {@link isStudioGenerateEstimate}.\n */\n generate(\n productionId: string,\n input: StudioGenerateRequest & { dryRun: true },\n ): Promise<StudioGenerateEstimate>\n generate(\n productionId: string,\n input: StudioGenerateRequest,\n ): Promise<StudioGenerateResult>\n async generate(\n productionId: string,\n input: StudioGenerateRequest,\n ): Promise<StudioGenerateResult> {\n const res = await this.client.request<{ data: StudioGenerateResult }>(\n \"POST\",\n this.path(productionId, \"/generate\"),\n { body: input },\n )\n return res.data\n }\n\n /**\n * Frame a shot: submit `count` candidates and record a pending marker for\n * each. Results ACCUMULATE — a generate never replaces what is there.\n *\n * `clientRequestId` makes a retry safe: the same token answers with the jobs\n * the first call started (`deduped: true`) and submits nothing. Never retry a\n * spend without it.\n */\n generateStill(\n productionId: string,\n shotId: string,\n opts: StudioGenerateOptions & { dryRun: true },\n ): Promise<StudioGenerateEstimate>\n generateStill(\n productionId: string,\n shotId: string,\n opts?: StudioGenerateOptions,\n ): Promise<StudioGenerateResult>\n generateStill(\n productionId: string,\n shotId: string,\n opts: StudioGenerateOptions = {},\n ): Promise<StudioGenerateResult> {\n return this.generate(productionId, { ...opts, kind: \"still\", shotId })\n }\n\n /**\n * Animate a shot. The LANE is chosen from the shot's inputs (a start frame,\n * references, a prompt) — never passed in — and reported back as `lane`.\n */\n generateClip(\n productionId: string,\n shotId: string,\n opts: StudioGenerateOptions & { dryRun: true },\n ): Promise<StudioGenerateEstimate>\n generateClip(\n productionId: string,\n shotId: string,\n opts?: StudioGenerateOptions,\n ): Promise<StudioGenerateResult>\n generateClip(\n productionId: string,\n shotId: string,\n opts: StudioGenerateOptions = {},\n ): Promise<StudioGenerateResult> {\n return this.generate(productionId, { ...opts, kind: \"clip\", shotId })\n }\n\n // ── media on one shot ────────────────────────────────────────────────────\n\n /**\n * Extract a frame from a shot's active clip and put it where `target` says —\n * a new shot after this one (the default), this shot's sticky start or end\n * frame, or another still of the same shot. Seconds, not minutes: this one\n * waits for the job and answers with the changed production.\n */\n async frame(\n productionId: string,\n input: StudioFrameRequest,\n ): Promise<StudioMediaResponse> {\n const res = await this.client.request<{ data: StudioMediaResponse }>(\n \"POST\",\n this.path(productionId, \"/frame\"),\n { body: input },\n )\n return res.data\n }\n\n /** Synthesize a shot's spoken line and record it. Waits for the job. */\n async voice(\n productionId: string,\n input: StudioVoiceRequest,\n ): Promise<StudioMediaResponse> {\n const res = await this.client.request<{ data: StudioMediaResponse }>(\n \"POST\",\n this.path(productionId, \"/voice\"),\n { body: input },\n )\n return res.data\n }\n\n /**\n * Recast the voices of a shot's active clip. Minutes of work, so it answers\n * `jobId` and the new clip lands as a result through its own marker.\n */\n async revoice(\n productionId: string,\n input: StudioRevoiceRequest,\n ): Promise<StudioJobStartedResponse> {\n const res = await this.client.request<{ data: StudioJobStartedResponse }>(\n \"POST\",\n this.path(productionId, \"/revoice\"),\n { body: input },\n )\n return res.data\n }\n\n /** Score the film. The finished track lands through its pending marker. */\n async music(\n productionId: string,\n input: StudioMusicRequest,\n ): Promise<StudioJobStartedResponse> {\n const res = await this.client.request<{ data: StudioJobStartedResponse }>(\n \"POST\",\n this.path(productionId, \"/music\"),\n { body: input },\n )\n return res.data\n }\n\n // ── audience and copies ──────────────────────────────────────────────────\n\n /**\n * Open the share-by-link read. Deliberately its own route rather than an\n * operation: who may see the work is decided by the owner, never as a side\n * effect of a batch that was editing something else.\n */\n async share(productionId: string): Promise<StudioProduction> {\n const res = await this.client.request<{ data: StudioMediaResponse }>(\n \"POST\",\n this.path(productionId, \"/share\"),\n { body: { shared: true } },\n )\n return res.data.production\n }\n\n /** Close it again. Sharing is opt-in AND reversible. */\n async unshare(productionId: string): Promise<StudioProduction> {\n const res = await this.client.request<{ data: StudioMediaResponse }>(\n \"POST\",\n this.path(productionId, \"/unshare\"),\n )\n return res.data.production\n }\n\n /**\n * Copy a production you own or can see into your own Studio project. The\n * copy starts PRIVATE and visible — sharing and archiving never travel — and\n * it is copied through YOUR view of the source, so somebody else's bin does\n * not come with it.\n */\n async clone(\n productionId: string,\n input: StudioCloneRequest = {},\n ): Promise<StudioProduction> {\n const res = await this.client.request<{ data: { production: StudioProduction } }>(\n \"POST\",\n this.path(productionId, \"/clone\"),\n { body: input },\n )\n return res.data.production\n }\n}\n\n","import type { NodaroClientCore } from \"../core.js\"\nimport { StudioProductionsResource } from \"./studio-productions.js\"\nexport * from \"./studio-productions.js\"\n\n/** Public response/transport contracts only; document validation and planning\n * remain in the private Studio codec on the server. */\nexport type StudioDocumentJson = Record<string, unknown>\n\nexport interface StudioProductionCapabilities {\n planVersions: number[]\n operations: {\n readKeyframes: boolean\n saveEditorState?: boolean\n editableSharedCopies?: boolean\n revisionedSharing?: boolean\n cloneLinkedProductions?: boolean\n importPlannedBundles?: boolean\n importLinkedBundles?: boolean\n appendPlannedBundles?: boolean\n appendLinkedBundles?: boolean\n editKeyframes: boolean\n generateKeyframes: boolean\n acceptKeyframes: boolean\n rejectKeyframes?: boolean\n editSequencePlans?: boolean\n generateLinkedClips: boolean\n retakeLinkedClips?: boolean\n /** The host keeps a scene's empty media slots. */\n mediaSlots?: boolean\n /** The host keeps a clip's inputs on its clip slot. */\n clipSlotInputs?: boolean\n }\n sourceFrameReferences: boolean\n automaticAcceptance: false\n unattendedGeneration: false\n}\n\nexport interface StudioKeyframeRecord {\n id: string\n label: string\n revision: number\n nodeId: string\n parentKeyframeId?: string\n previewResultKey: string | null\n previewUrl: string | null\n acceptedResultKey: string | null\n acceptedUrl: string | null\n count: number\n pending: Array<{ jobId: string; startedAt: string }>\n /** Owner-only working state. Recorded acceptance is not an execution grant. */\n plan?: StudioDocumentJson\n acceptance?: StudioDocumentJson\n results?: StudioDocumentJson[]\n}\n\nexport interface StudioProductionRecord {\n id: string\n name: string\n version: number\n updatedAt: string\n thumbnailUrl: string | null\n shared: boolean\n archived: boolean\n requiredCapabilities?: string[]\n keyframes?: StudioKeyframeRecord[]\n sequences?: StudioDocumentJson[]\n shots: StudioDocumentJson[]\n pending: { stills: number; clips: number; keyframes?: number; music: boolean; draft: StudioDocumentJson | null }\n [field: string]: unknown\n}\n\nexport interface StudioProductionReply {\n production: StudioProductionRecord\n capabilities?: StudioProductionCapabilities\n warnings?: unknown[]\n [field: string]: unknown\n}\n\nexport interface StudioEditInput {\n ops: ReadonlyArray<{ op: string; [field: string]: unknown }>\n baseVersion?: number\n strict?: boolean\n clientRequestId?: string\n}\n\nexport interface StudioKeyframeGenerationInput {\n keyframeId: string\n expectedRevision: number\n clientRequestId?: string\n overrides?: StudioDocumentJson\n}\n\nexport interface StudioKeyframeAcceptanceInput {\n keyframeId: string\n expectedRevision: number\n resultKey: string\n expectedAcceptedResultKey: string | null\n requirementChecks: Array<{ requirementId: string; outcome: \"pass\" | \"waived\" }>\n waivedReason?: string\n}\n\nexport interface StudioShotGenerationInput {\n kind: \"still\" | \"clip\"\n shotId: string\n clientRequestId?: string\n count?: number\n mode?: \"start\" | \"start-end\" | \"references\"\n dryRun?: boolean\n /** Linked clips only: require the exact inputs returned by a reviewed quote. */\n expectedInputHash?: string\n /** Retake a native linked take using its original request and retained endpoints. */\n retakeResultKey?: string\n overrides?: StudioDocumentJson\n}\n\nexport type StudioGenerationReply = {\n jobIds: string[]\n production?: StudioProductionRecord\n deduped?: true\n lane?: string\n [field: string]: unknown\n} | {\n dryRun: true; provider: string; count: number; credits: number | null; lane?: string\n /** Linked-clip quotes include normalized settings and accepted endpoint pins. */\n inputHash?: string\n endpointPins?: StudioDocumentJson\n creditIdentifier?: string\n duration?: number\n resolution?: string\n aspectRatio?: string\n sound?: boolean\n}\n\nconst root = \"/v1/studio/productions\"\nconst path = (id: string) => `${root}/${encodeURIComponent(id)}`\n\n/** Cloud plugin routes. Check capabilities before exposing dependency controls.\n * Reads do not reconcile jobs, submit media or accept generated candidates. */\nexport class StudioResource {\n readonly productions: StudioProductionsResource\n\n constructor(private readonly client: NodaroClientCore) {\n this.productions = new StudioProductionsResource(client)\n }\n\n capabilities(): Promise<{ data: StudioProductionCapabilities }> {\n return this.client.request(\"GET\", `${root}/capabilities`)\n }\n\n skill(): Promise<{ data: StudioDocumentJson }> {\n return this.client.request(\"GET\", `${root}/skill`)\n }\n\n list(options: { limit?: number; cursor?: string; includeArchived?: boolean } = {}): Promise<{ data: {\n data: Array<{ id: string; name: string; version: number; updatedAt: string; thumbnailUrl: string | null; shared: boolean; archived: boolean; shotCount: number }>\n nextCursor?: string\n } }> {\n return this.client.request(\"GET\", root, { query: options })\n }\n\n get(id: string, options: { detail?: \"summary\" | \"full\"; shotId?: string } = {}): Promise<{ data: StudioProductionReply }> {\n return this.client.request(\"GET\", path(id), { query: { detail: options.detail, shot_id: options.shotId } })\n }\n\n validatePlan(plan: StudioDocumentJson): Promise<{ data: { valid: boolean; errors: StudioDocumentJson[]; warnings: StudioDocumentJson[]; summary?: StudioDocumentJson } }> {\n return this.client.request(\"POST\", `${root}/validate`, { body: { plan } })\n }\n\n create(input: { name?: string; plan?: StudioDocumentJson }): Promise<{ data: StudioProductionReply }> {\n return this.client.request(\"POST\", root, { body: input })\n }\n\n /** Import a portable document through the compatible server writer.\n * Retained frame media requires an authorized source; acceptance never transfers. */\n importBundle(input: { bundle: StudioDocumentJson; projectId?: string }): Promise<{ data: StudioProductionReply }> {\n return this.client.request(\"POST\", `${root}/import-bundle`, { body: input })\n }\n\n /** Append a bundle's scenes and frame closure under an exact destination revision. */\n appendBundle(id: string, input: { bundle: StudioDocumentJson; expectedVersion: number;\n afterShotId?: string; applyFilm?: boolean }): Promise<{ data: {\n production: StudioProductionRecord; importedShotIds: string[]; importedKeyframeIds: string[];\n } }> {\n return this.client.request(\"POST\", `${path(id)}/import-bundle`, { body: input })\n }\n\n /** Copy a saved production. Linked copies retain verified inputs, remap\n * dependencies and require fresh frame acceptance; they start no media jobs. */\n clone(id: string, input: { name?: string; projectId?: string; expectedVersion?: number } = {}): Promise<{ data: StudioProductionReply }> {\n return this.client.request(\"POST\", `${path(id)}/clone`, { body: input })\n }\n\n edit(id: string, input: StudioEditInput): Promise<{ data: StudioProductionReply & { version: number; rebased: boolean; receipts: StudioDocumentJson[] } }> {\n return this.client.request(\"POST\", `${path(id)}/ops`, { body: input })\n }\n\n /** Audience-authorized sharing; an expected revision prevents publication\n * of concurrent edits the caller has not reviewed. */\n setShared(id: string, input: { shared: boolean; allowEditableCopy?: boolean; expectedVersion?: number }): Promise<{ data: StudioProductionReply }> {\n return this.client.request(\"POST\", `${path(id)}/share`, { body: input })\n }\n\n /** Save ordinary editor fields against the loaded revision. Protected frame\n * and job state can only change through their dedicated semantic actions. */\n saveEditorState(id: string, input: { expectedVersion: number; graph: object; clientRequestId?: string }) {\n return this.edit(id, {\n baseVersion: input.expectedVersion, strict: true,\n ...(input.clientRequestId ? { clientRequestId: input.clientRequestId } : {}),\n ops: [{ op: \"save_editor_state\", expectedVersion: input.expectedVersion, graph: input.graph }],\n })\n }\n\n generateKeyframe(id: string, input: StudioKeyframeGenerationInput): Promise<{ data: Exclude<StudioGenerationReply, { dryRun: true }> }> {\n return this.client.request(\"POST\", `${path(id)}/generate`, { body: { ...input, kind: \"keyframe\" } })\n }\n\n generateShot(id: string, input: StudioShotGenerationInput): Promise<{ data: StudioGenerationReply }> {\n return this.client.request(\"POST\", `${path(id)}/generate`, { body: input })\n }\n\n /** A separate explicit review action; generation never calls this method. */\n acceptKeyframe(id: string, input: StudioKeyframeAcceptanceInput,\n concurrency: Pick<StudioEditInput, \"baseVersion\" | \"strict\" | \"clientRequestId\"> = {}) {\n return this.edit(id, { ...concurrency, ops: [{ ...input, op: \"accept_keyframe_result\" }] })\n }\n\n reconcile(id: string): Promise<{ data: StudioProductionReply & { landed: string[]; pending: string[]; failed: string[]; version: number } }> {\n return this.client.request(\"POST\", `${path(id)}/reconcile`, { body: {} })\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { StudioPreviewUnavailable, StudioPreviewAppliedError } from './chunk-L6T44A3G.js';
1
+ import { StudioPreviewUnavailable, StudioPreviewAppliedError } from './chunk-4VP2GFIZ.js';
2
2
 
3
3
  // src/resources/studio-productions.ts
4
4
  function isStudioGenerateEstimate(result) {
@@ -317,5 +317,5 @@ var StudioResource = class {
317
317
  };
318
318
 
319
319
  export { StudioProductionsResource, StudioResource, isStudioGenerateEstimate };
320
- //# sourceMappingURL=chunk-AUKHMT53.js.map
321
- //# sourceMappingURL=chunk-AUKHMT53.js.map
320
+ //# sourceMappingURL=chunk-BGOZRZHY.js.map
321
+ //# sourceMappingURL=chunk-BGOZRZHY.js.map