@nodaro/sdk 2.56.0 → 2.57.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 (71) hide show
  1. package/dist/{chunk-3CVWTUK5.cjs → chunk-3Y5TDB5K.cjs} +4 -4
  2. package/dist/{chunk-3CVWTUK5.cjs.map → chunk-3Y5TDB5K.cjs.map} +1 -1
  3. package/dist/{chunk-2LOTDOUV.cjs → chunk-7PYZCNLH.cjs} +5 -5
  4. package/dist/{chunk-2LOTDOUV.cjs.map → chunk-7PYZCNLH.cjs.map} +1 -1
  5. package/dist/{chunk-FTCAT2LK.js → chunk-ALDXFMD7.js} +3 -3
  6. package/dist/{chunk-FTCAT2LK.js.map → chunk-ALDXFMD7.js.map} +1 -1
  7. package/dist/{chunk-OMJ45CW4.cjs → chunk-DOMNKVKA.cjs} +9 -9
  8. package/dist/{chunk-OMJ45CW4.cjs.map → chunk-DOMNKVKA.cjs.map} +1 -1
  9. package/dist/{chunk-WY4QRJZW.js → chunk-DTYN7QAZ.js} +25 -2
  10. package/dist/chunk-DTYN7QAZ.js.map +1 -0
  11. package/dist/{chunk-PQ6G5EM7.js → chunk-EDSODRRY.js} +9 -9
  12. package/dist/{chunk-PQ6G5EM7.js.map → chunk-EDSODRRY.js.map} +1 -1
  13. package/dist/{chunk-DFT4LD2H.cjs → chunk-GDUEOKBF.cjs} +4 -4
  14. package/dist/{chunk-DFT4LD2H.cjs.map → chunk-GDUEOKBF.cjs.map} +1 -1
  15. package/dist/{chunk-Z4B4SZ33.cjs → chunk-GSE7SB3I.cjs} +6 -4
  16. package/dist/chunk-GSE7SB3I.cjs.map +1 -0
  17. package/dist/{chunk-Q7W4QNE5.cjs → chunk-GWTKYJJO.cjs} +22 -22
  18. package/dist/{chunk-Q7W4QNE5.cjs.map → chunk-GWTKYJJO.cjs.map} +1 -1
  19. package/dist/{chunk-4VP2GFIZ.js → chunk-JJMQ2EVL.js} +6 -4
  20. package/dist/chunk-JJMQ2EVL.js.map +1 -0
  21. package/dist/{chunk-RIMDKJSQ.cjs → chunk-JX3GYLV3.cjs} +16 -16
  22. package/dist/{chunk-RIMDKJSQ.cjs.map → chunk-JX3GYLV3.cjs.map} +1 -1
  23. package/dist/{chunk-Q4MFQC2J.cjs → chunk-KU3UITCU.cjs} +5 -5
  24. package/dist/{chunk-Q4MFQC2J.cjs.map → chunk-KU3UITCU.cjs.map} +1 -1
  25. package/dist/{chunk-E6X6BGRO.js → chunk-MUHRK4OI.js} +3 -3
  26. package/dist/{chunk-E6X6BGRO.js.map → chunk-MUHRK4OI.js.map} +1 -1
  27. package/dist/{chunk-VEQLP5TA.js → chunk-ND7JMM5H.js} +3 -3
  28. package/dist/{chunk-VEQLP5TA.js.map → chunk-ND7JMM5H.js.map} +1 -1
  29. package/dist/{chunk-JTOEHQQJ.cjs → chunk-NOZWIS7M.cjs} +25 -2
  30. package/dist/chunk-NOZWIS7M.cjs.map +1 -0
  31. package/dist/{chunk-HK6XP5EN.js → chunk-RCD4HDBI.js} +3 -3
  32. package/dist/{chunk-HK6XP5EN.js.map → chunk-RCD4HDBI.js.map} +1 -1
  33. package/dist/{chunk-37LL6BPM.js → chunk-SOR6K3XZ.js} +4 -4
  34. package/dist/{chunk-37LL6BPM.js.map → chunk-SOR6K3XZ.js.map} +1 -1
  35. package/dist/{chunk-4WOT5OAY.cjs → chunk-TSM3S2QS.cjs} +5 -5
  36. package/dist/{chunk-4WOT5OAY.cjs.map → chunk-TSM3S2QS.cjs.map} +1 -1
  37. package/dist/{chunk-BGOZRZHY.js → chunk-VTL4DBX4.js} +3 -3
  38. package/dist/{chunk-BGOZRZHY.js.map → chunk-VTL4DBX4.js.map} +1 -1
  39. package/dist/{chunk-4FSWJTRS.js → chunk-YYMX3VN7.js} +3 -3
  40. package/dist/{chunk-4FSWJTRS.js.map → chunk-YYMX3VN7.js.map} +1 -1
  41. package/dist/entries/client.cjs +15 -15
  42. package/dist/entries/client.js +10 -10
  43. package/dist/entries/copilot.cjs +4 -4
  44. package/dist/entries/copilot.js +3 -3
  45. package/dist/entries/core.cjs +6 -6
  46. package/dist/entries/core.js +2 -2
  47. package/dist/entries/edit.cjs +7 -7
  48. package/dist/entries/edit.js +2 -2
  49. package/dist/entries/errors.cjs +26 -26
  50. package/dist/entries/errors.d.cts +12 -1
  51. package/dist/entries/errors.d.ts +12 -1
  52. package/dist/entries/errors.js +1 -1
  53. package/dist/entries/media.cjs +4 -4
  54. package/dist/entries/media.js +3 -3
  55. package/dist/entries/nodes.cjs +3 -3
  56. package/dist/entries/nodes.js +2 -2
  57. package/dist/entries/studio.cjs +5 -5
  58. package/dist/entries/studio.js +2 -2
  59. package/dist/entries/uploads.cjs +2 -2
  60. package/dist/entries/uploads.d.cts +41 -1
  61. package/dist/entries/uploads.d.ts +41 -1
  62. package/dist/entries/uploads.js +1 -1
  63. package/dist/index.cjs +53 -53
  64. package/dist/index.d.cts +1 -1
  65. package/dist/index.d.ts +1 -1
  66. package/dist/index.js +10 -10
  67. package/package.json +1 -1
  68. package/dist/chunk-4VP2GFIZ.js.map +0 -1
  69. package/dist/chunk-JTOEHQQJ.cjs.map +0 -1
  70. package/dist/chunk-WY4QRJZW.js.map +0 -1
  71. package/dist/chunk-Z4B4SZ33.cjs.map +0 -1
@@ -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,kB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AAK,EAAE,CAAC,CAAA,SAAA,CAAA,EAAa,EAAE,MAAM,EAAE,GAAG,OAAO,IAAA,EAAM,UAAA,IAAc,CAAA;AAAA,EACrG;AAAA,EAEA,YAAA,CAAa,IAAY,KAAA,EAA4E;AACnG,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,EAAQ,CAAA,EAAG,IAAA,CAAK,EAAE,CAAC,CAAA,SAAA,CAAA,EAAa,EAAE,IAAA,EAAM,KAAA,EAAO,CAAA;AAAA,EAC5E;AAAA;AAAA,EAGA,cAAA,CAAe,EAAA,EAAY,KAAA,EACzB,WAAA,GAAmF,EAAC,EAAG;AACvF,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,EAAA,EAAI,EAAE,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
+ {"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,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AAA,EAAI,mBAAA,EAAqB,eAAA,EAAiB,KAAA,CAAM,eAAA,EAAiB,KAAA,EAAO,KAAA,CAAM,KAAA,EAAO;AAAA,KAC9F,CAAA;AAAA,EACH;AAAA,EAEA,gBAAA,CAAiB,IAAY,KAAA,EAA2G;AACtI,IAAA,OAAO,KAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,EAAQ,CAAA,EAAG,KAAK,EAAE,CAAC,CAAA,SAAA,CAAA,EAAa,EAAE,MAAM,EAAE,GAAG,OAAO,IAAA,EAAM,UAAA,IAAc,CAAA;AAAA,EACrG;AAAA,EAEA,YAAA,CAAa,IAAY,KAAA,EAA4E;AACnG,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,EAAQ,CAAA,EAAG,IAAA,CAAK,EAAE,CAAC,CAAA,SAAA,CAAA,EAAa,EAAE,IAAA,EAAM,KAAA,EAAO,CAAA;AAAA,EAC5E;AAAA;AAAA,EAGA,cAAA,CAAe,EAAA,EAAY,KAAA,EACzB,WAAA,GAAmF,EAAC,EAAG;AACvF,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,EAAA,EAAI,EAAE,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-TSM3S2QS.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-4VP2GFIZ.js';
1
+ import { StudioPreviewUnavailable, StudioPreviewAppliedError } from './chunk-JJMQ2EVL.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-BGOZRZHY.js.map
321
- //# sourceMappingURL=chunk-BGOZRZHY.js.map
320
+ //# sourceMappingURL=chunk-VTL4DBX4.js.map
321
+ //# sourceMappingURL=chunk-VTL4DBX4.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/resources/studio-productions.ts","../src/resources/studio.ts"],"names":["res"],"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;A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EAAO,CAAA;AAAA,EAC5E;AAAA;AAAA,EAGA,cAAA,CAAe,EAAA,EAAY,KAAA,EACzB,WAAA,GAAmF,EAAC,EAAG;AACvF,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,EAAA,EAAI,EAAE,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-BGOZRZHY.js","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"],"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;AA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AAA;AAAA,EACrG;AAAA,EAEA,YAAA,CAAa,IAAY,KAAA,EAA4E;AACnG,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAQ,MAAA,EAAQ,CAAA,EAAG,IAAA,CAAK,EAAE,CAAC,CAAA,SAAA,CAAA,EAAa,EAAE,IAAA,EAAM,KAAA,EAAO,CAAA;AAAA,EAC5E;AAAA;AAAA,EAGA,cAAA,CAAe,EAAA,EAAY,KAAA,EACzB,WAAA,GAAmF,EAAC,EAAG;AACvF,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,EAAA,EAAI,EAAE,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-VTL4DBX4.js","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 { throwFromResponse, NodaroError } from './chunk-4VP2GFIZ.js';
1
+ import { throwFromResponse, NodaroError } from './chunk-JJMQ2EVL.js';
2
2
 
3
3
  // src/sse.ts
4
4
  async function* readSseStream(res, opts = {}) {
@@ -42,5 +42,5 @@ async function* readSseStream(res, opts = {}) {
42
42
  }
43
43
 
44
44
  export { readSseStream };
45
- //# sourceMappingURL=chunk-4FSWJTRS.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AAG,CAAA;AACjC,QAAA,MAAA,GAAS,MAAA,CAAO,KAAA,CAAM,GAAA,GAAM,CAAC,CAAA;AAC7B,QAAA,KAAA,MAAW,IAAA,IAAQ,KAAA,CAAM,KAAA,CAAM,IAAI,CAAA,EAAG;AACpC,UAAA,IAAI,CAAC,IAAA,CAAK,UAAA,CAAW,OAAO,CAAA,EAAG;AAC/B,UAAA,IAAI;AACF,YAAA,MAAM,KAAK,KAAA,CAAM,IAAA,CAAK,MAAM,CAAC,CAAA,CAAE,MAAM,CAAA;AAAA,UACvC,CAAA,CAAA,MAAQ;AAAA,UAER;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAA,SAAE;AAEA,IAAA,MAAA,CAAO,WAAA,EAAY;AACnB,IAAA,MAAM,GAAA,CAAI,IAAA,CAAK,MAAA,EAAO,CAAE,MAAM,MAAM;AAAA,IAAC,CAAC,CAAA;AAAA,EACxC;AACF","file":"chunk-4FSWJTRS.js","sourcesContent":["import { NodaroError, throwFromResponse } from \"./errors.js\"\n\n/**\n * The ONE server-sent-event reader in this package.\n *\n * Every streaming route here writes the same minimal shape — `data: <json>\\n\\n`\n * frames, with the event kind INSIDE the JSON rather than on an `event:` line —\n * so one reader serves them all, and a second hand-rolled parse loop is the\n * thing this file exists to prevent. Deliberately minimal, matching the\n * server's writer rather than the whole SSE grammar: split on blank lines,\n * JSON-parse each `data:` line on its own, skip what does not parse (the next\n * frame re-reports state), and ignore every other line — keepalive comments\n * (`: keepalive`) included.\n *\n * Frames are separated by a bare `\\n\\n` and each `data:` line is parsed on its\n * own, exactly as the server writes them. Both halves are literal: a stream\n * whose frames arrive CRLF-terminated, or whose JSON was split across two\n * `data:` lines, yields NOTHING rather than erroring — so an intermediary that\n * normalises line endings would show up as an empty stream, not a parse\n * failure. The server's writer produces neither shape.\n *\n * No timeout is applied. The caller owns the lifetime: pass the `AbortSignal`\n * to the `fetch` that produced `res`, or just stop iterating — the `finally`\n * cancels the body, which ends the HTTP request.\n */\nexport async function* readSseStream<T>(\n res: Response,\n opts: {\n /** Names the stream in the \"no response body\" error. */\n label?: string\n } = {},\n): AsyncGenerator<T, void, undefined> {\n if (!res.ok) {\n let errBody: Record<string, unknown> = {}\n try {\n errBody = (await res.json()) as Record<string, unknown>\n } catch {\n // Empty/non-JSON body — fall through with empty errBody\n }\n throwFromResponse(res.status, errBody)\n }\n if (!res.body) {\n throw new NodaroError(`${opts.label ?? \"event stream\"} has no response body`, \"empty_stream\", res.status)\n }\n\n const reader = res.body.getReader()\n const decoder = new TextDecoder()\n let buffer = \"\"\n try {\n for (;;) {\n const { done, value } = await reader.read()\n if (done) break\n buffer += decoder.decode(value, { stream: true })\n let sep: number\n while ((sep = buffer.indexOf(\"\\n\\n\")) >= 0) {\n const frame = buffer.slice(0, sep)\n buffer = buffer.slice(sep + 2)\n for (const line of frame.split(\"\\n\")) {\n if (!line.startsWith(\"data:\")) continue\n try {\n yield JSON.parse(line.slice(5).trim()) as T\n } catch {\n // Skip malformed frames — the next tick re-reports full state.\n }\n }\n }\n }\n } finally {\n // Ends the HTTP request when the consumer breaks out of the loop early.\n reader.releaseLock()\n await res.body.cancel().catch(() => {})\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/sse.ts"],"names":[],"mappings":";;;AAyBA,gBAAuB,aAAA,CACrB,GAAA,EACA,IAAA,GAGI,EAAC,EAC+B;AACpC,EAAA,IAAI,CAAC,IAAI,EAAA,EAAI;AACX,IAAA,IAAI,UAAmC,EAAC;AACxC,IAAA,IAAI;AACF,MAAA,OAAA,GAAW,MAAM,IAAI,IAAA,EAAK;AAAA,IAC5B,CAAA,CAAA,MAAQ;AAAA,IAER;AACA,IAAA,iBAAA,CAAkB,GAAA,CAAI,QAAQ,OAAO,CAAA;AAAA,EACvC;AACA,EAAA,IAAI,CAAC,IAAI,IAAA,EAAM;AACb,IAAA,MAAM,IAAI,YAAY,CAAA,EAAG,IAAA,CAAK,SAAS,cAAc,CAAA,qBAAA,CAAA,EAAyB,cA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ponse } from \"./errors.js\"\n\n/**\n * The ONE server-sent-event reader in this package.\n *\n * Every streaming route here writes the same minimal shape — `data: <json>\\n\\n`\n * frames, with the event kind INSIDE the JSON rather than on an `event:` line —\n * so one reader serves them all, and a second hand-rolled parse loop is the\n * thing this file exists to prevent. Deliberately minimal, matching the\n * server's writer rather than the whole SSE grammar: split on blank lines,\n * JSON-parse each `data:` line on its own, skip what does not parse (the next\n * frame re-reports state), and ignore every other line — keepalive comments\n * (`: keepalive`) included.\n *\n * Frames are separated by a bare `\\n\\n` and each `data:` line is parsed on its\n * own, exactly as the server writes them. Both halves are literal: a stream\n * whose frames arrive CRLF-terminated, or whose JSON was split across two\n * `data:` lines, yields NOTHING rather than erroring — so an intermediary that\n * normalises line endings would show up as an empty stream, not a parse\n * failure. The server's writer produces neither shape.\n *\n * No timeout is applied. The caller owns the lifetime: pass the `AbortSignal`\n * to the `fetch` that produced `res`, or just stop iterating — the `finally`\n * cancels the body, which ends the HTTP request.\n */\nexport async function* readSseStream<T>(\n res: Response,\n opts: {\n /** Names the stream in the \"no response body\" error. */\n label?: string\n } = {},\n): AsyncGenerator<T, void, undefined> {\n if (!res.ok) {\n let errBody: Record<string, unknown> = {}\n try {\n errBody = (await res.json()) as Record<string, unknown>\n } catch {\n // Empty/non-JSON body — fall through with empty errBody\n }\n throwFromResponse(res.status, errBody)\n }\n if (!res.body) {\n throw new NodaroError(`${opts.label ?? \"event stream\"} has no response body`, \"empty_stream\", res.status)\n }\n\n const reader = res.body.getReader()\n const decoder = new TextDecoder()\n let buffer = \"\"\n try {\n for (;;) {\n const { done, value } = await reader.read()\n if (done) break\n buffer += decoder.decode(value, { stream: true })\n let sep: number\n while ((sep = buffer.indexOf(\"\\n\\n\")) >= 0) {\n const frame = buffer.slice(0, sep)\n buffer = buffer.slice(sep + 2)\n for (const line of frame.split(\"\\n\")) {\n if (!line.startsWith(\"data:\")) continue\n try {\n yield JSON.parse(line.slice(5).trim()) as T\n } catch {\n // Skip malformed frames — the next tick re-reports full state.\n }\n }\n }\n }\n } finally {\n // Ends the HTTP request when the consumer breaks out of the loop early.\n reader.releaseLock()\n await res.body.cancel().catch(() => {})\n }\n}\n"]}