@nodaro/sdk 2.43.0 → 2.44.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 (57) hide show
  1. package/dist/{chunk-6QFTWAQQ.cjs → chunk-3ZZWCHF5.cjs} +12 -12
  2. package/dist/{chunk-6QFTWAQQ.cjs.map → chunk-3ZZWCHF5.cjs.map} +1 -1
  3. package/dist/{chunk-WK7C7TP6.js → chunk-4UPVE662.js} +2 -2
  4. package/dist/chunk-4UPVE662.js.map +1 -0
  5. package/dist/{chunk-F6GENF6R.cjs → chunk-55ZX6TE3.cjs} +12 -9
  6. package/dist/chunk-55ZX6TE3.cjs.map +1 -0
  7. package/dist/{chunk-VACAWIZT.js → chunk-6PI3CI7P.js} +7 -7
  8. package/dist/{chunk-VACAWIZT.js.map → chunk-6PI3CI7P.js.map} +1 -1
  9. package/dist/{chunk-OSX2GVZ2.cjs → chunk-7YHIFCJ4.cjs} +2 -2
  10. package/dist/chunk-7YHIFCJ4.cjs.map +1 -0
  11. package/dist/{chunk-V3KMBQMK.js → chunk-DAGJLS7W.js} +3 -3
  12. package/dist/{chunk-V3KMBQMK.js.map → chunk-DAGJLS7W.js.map} +1 -1
  13. package/dist/{chunk-RQH6IKDC.js → chunk-HKDIIFG2.js} +12 -9
  14. package/dist/chunk-HKDIIFG2.js.map +1 -0
  15. package/dist/{chunk-BLA44UCM.js → chunk-KFZOJBI5.js} +2 -2
  16. package/dist/chunk-KFZOJBI5.js.map +1 -0
  17. package/dist/{chunk-TMRRXQQL.cjs → chunk-MPQQC45L.cjs} +3 -3
  18. package/dist/{chunk-TMRRXQQL.cjs.map → chunk-MPQQC45L.cjs.map} +1 -1
  19. package/dist/{chunk-VADPSFLS.cjs → chunk-QHXLMCBR.cjs} +2 -2
  20. package/dist/chunk-QHXLMCBR.cjs.map +1 -0
  21. package/dist/{chunk-JUON5NXA.js → chunk-RETNLKOC.js} +13 -2
  22. package/dist/chunk-RETNLKOC.js.map +1 -0
  23. package/dist/{chunk-VHSMOBU7.cjs → chunk-VYEGCEZ3.cjs} +13 -2
  24. package/dist/chunk-VYEGCEZ3.cjs.map +1 -0
  25. package/dist/entries/cast-swap.cjs +2 -2
  26. package/dist/entries/cast-swap.d.cts +104 -30
  27. package/dist/entries/cast-swap.d.ts +104 -30
  28. package/dist/entries/cast-swap.js +1 -1
  29. package/dist/entries/client.cjs +11 -11
  30. package/dist/entries/client.js +6 -6
  31. package/dist/entries/core.cjs +5 -5
  32. package/dist/entries/core.js +1 -1
  33. package/dist/entries/picker-catalogs.cjs +2 -2
  34. package/dist/entries/picker-catalogs.d.cts +8 -0
  35. package/dist/entries/picker-catalogs.d.ts +8 -0
  36. package/dist/entries/picker-catalogs.js +1 -1
  37. package/dist/entries/trends.cjs +2 -2
  38. package/dist/entries/trends.d.cts +32 -6
  39. package/dist/entries/trends.d.ts +32 -6
  40. package/dist/entries/trends.js +1 -1
  41. package/dist/entries/workflows.cjs +2 -2
  42. package/dist/entries/workflows.d.cts +65 -1
  43. package/dist/entries/workflows.d.ts +65 -1
  44. package/dist/entries/workflows.js +1 -1
  45. package/dist/index.cjs +16 -16
  46. package/dist/index.d.cts +3 -3
  47. package/dist/index.d.ts +3 -3
  48. package/dist/index.js +6 -6
  49. package/package.json +3 -3
  50. package/dist/chunk-BLA44UCM.js.map +0 -1
  51. package/dist/chunk-F6GENF6R.cjs.map +0 -1
  52. package/dist/chunk-JUON5NXA.js.map +0 -1
  53. package/dist/chunk-OSX2GVZ2.cjs.map +0 -1
  54. package/dist/chunk-RQH6IKDC.js.map +0 -1
  55. package/dist/chunk-VADPSFLS.cjs.map +0 -1
  56. package/dist/chunk-VHSMOBU7.cjs.map +0 -1
  57. package/dist/chunk-WK7C7TP6.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resources/workflows.ts"],"names":[],"mappings":";;;AAyQO,IAAM,gCAAN,MAAoC;AAAA,EACzC,YAAoB,MAAA,EAA0B;AAA1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,EAAO,8BAA8B,CAAA;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,oBAAA,CAAqB,MAAA,GAAqC,EAAC,EAAiC;AAC1F,IAAA,MAAM,QAAgC,EAAC;AACvC,IAAA,IAAI,MAAA,CAAO,KAAA,EAAO,KAAA,CAAM,KAAA,GAAQ,MAAA,CAAO,KAAA;AACvC,IAAA,IAAI,MAAA,CAAO,SAAS,MAAA,EAAQ,KAAA,CAAM,UAAU,MAAA,CAAO,OAAA,CAAQ,KAAK,GAAG,CAAA;AACnE,IAAA,OAAO,KAAK,MAAA,CAAO,OAAA,CAAQ,OAAO,uBAAA,EAAyB,EAAE,OAAO,CAAA;AAAA,EACtE;AACF","file":"chunk-VYEGCEZ3.cjs","sourcesContent":["import type { NodaroClientCore } from \"../core.js\"\nimport type {\n GenericNode,\n GenericEdge,\n} from \"@nodaro/shared/types\"\nimport type {\n WorkflowExport,\n WorkflowImportReport,\n} from \"@nodaro/shared/workflow\"\nimport type {\n WorkflowVisibility,\n CollaboratorRole,\n} from \"@nodaro/shared/organizations\"\n\n/**\n * Workflow metadata + (when fetched as a single record) full nodes/edges/settings.\n *\n * The list endpoint returns metadata only; `get`, `create`, and `update` return the\n * full record. `nodes`, `edges`, `settings`, and `sourcePrompt` are present only on\n * full records and omitted in list responses.\n */\nexport interface Workflow {\n id: string\n projectId: string | null\n userId: string\n name: string\n description?: string | null\n folderId?: string | null\n isTemplate?: boolean\n version?: number\n thumbnailUrl?: string | null\n nodes?: GenericNode[]\n edges?: GenericEdge[]\n settings?: Record<string, unknown>\n sourcePrompt?: string | null\n createdAt: string\n updatedAt: string\n}\n\nexport interface ListWorkflowsParams {\n /** Required — list endpoint is `/v1/projects/:projectId/workflows`. */\n projectId: string\n}\n\nexport interface CreateWorkflowInput {\n /** Required — workflow is created under this project. */\n projectId: string\n name: string\n description?: string\n folderId?: string | null\n nodes?: GenericNode[]\n edges?: GenericEdge[]\n settings?: Record<string, unknown>\n sourcePrompt?: string\n}\n\nexport interface UpdateWorkflowInput {\n name?: string\n description?: string\n folderId?: string | null\n nodes?: GenericNode[]\n edges?: GenericEdge[]\n settings?: Record<string, unknown>\n sourcePrompt?: string\n thumbnailUrl?: string | null\n /**\n * Optimistic concurrency: the `updatedAt` your copy of the workflow was\n * loaded with. When the row has since been written by another tab/device,\n * the update is rejected with HTTP 409 `workflow_conflict`\n * (`WorkflowConflictError`) carrying the current record — re-read/merge and\n * retry instead of last-writer-wins clobbering the other writer's changes.\n * Omit for the legacy unconditional replace.\n */\n expectedUpdatedAt?: string\n /**\n * Optimistic concurrency by monotonic version — preferred over\n * `expectedUpdatedAt` (integer bumped by the DB on every content change).\n */\n expectedVersion?: number\n}\n\nexport interface RunWorkflowParams {\n /**\n * Optional subset of node IDs to execute. Omit to run the full workflow.\n * With `continueMode: \"from-failed\"`, the nodes to consider (default: the\n * nodes the run's chain was first started on, plus every node left failed or\n * held back; see `continueMode`); the run executes only those the failed run\n * did not complete. Every id sent counts as named: a node of work no run of\n * the chain ever ran (each only handed on its saved results) runs and is\n * priced, while a source, trigger, parameter picker or container keeps what\n * the run handed on and a node set to skip never runs.\n */\n nodeIds?: string[]\n /**\n * Per-node field overrides for this run only, `{ [nodeId]: { field: value } }`,\n * shallow-merged over each node's saved data (the node's saved results are\n * not used). A run through the API has nobody to review a Preview render, so\n * a workflow whose Apply EDL render is set to Preview is refused\n * (`preview_review_required`) unless the run sets it to Final:\n * `{ [renderNodeId]: { quality: \"final\" } }`. A node with Review before\n * render on (Tighten Episode, Trailer) is refused the same way (turn its\n * review off). A failed execution records what held it —\n * `preview_review_required` / `preview_render_nested` (a render),\n * `…_review_on` (a review-on node) or `…_mixed` (both); match all six with\n * `isPreviewRefusalCode` from `@nodaro/shared`. A review-on Tighten Episode\n * fed by a List is refused with `use_case_review_list_driven`; a Trailer fed\n * by a List, with `use_case_list_driven`.\n */\n inputOverrides?: Record<string, Record<string, unknown>>\n /**\n * Continue from an earlier execution of this workflow — Render final after a\n * run that stopped at its preview, or (with `continueMode: \"from-failed\"`) a\n * failed run from where it stopped. The run executes `nodeIds` only\n * (required with this field, except with `continueMode`); every other node\n * hands on what that execution produced, not the workflow's saved results,\n * and an Edit Plan hands on its plan with the person's review applied. The\n * execution must be your own `completed` run of this workflow (`failed`,\n * with `continueMode`), not of a published app version. Refused with\n * `continuation_subset_required`, `continuation_not_found` (404),\n * `continuation_workflow_mismatch`, `continuation_version_mismatch` or\n * `continuation_not_completed` (409). A continuation its payer cannot cover\n * (with or without `continueMode`, priced on the nodes it runs) throws\n * `InsufficientCreditsError` before any execution exists, checked as a\n * {@link WorkflowsResource.renderFinal} is.\n */\n continueFromExecutionId?: string\n /**\n * `\"from-failed\"`: continue a FAILED run (`continueFromExecutionId`) from\n * where it stopped. It runs every node that run did not complete — of\n * `nodeIds`, which default to the nodes the run was started on (a run\n * started on named nodes is continued on those, a run of every node on every\n * node; a continuation of a continuation keeps those of the first run of its\n * chain) plus every node the run left failed or held back — and hands on\n * what it completed,\n * never run or charged again. That is per node: a node that failed runs\n * again in full, every list item included. When a later continuation of it\n * completed only part of what it left (a narrower `nodeIds`), the run builds\n * on the newest such one: it is seeded from that run and runs only what is\n * still left ({@link RunWorkflowResult.continuedFrom} names it). A node\n * `nodeIds` names that no run of the chain ever ran runs too, and is priced\n * (see `nodeIds`). A Render\n * final, or a run of named nodes, continuing the newest of those counts as\n * one of them too. Not combinable with {@link renderFinal}. Refused with\n * `continuation_not_failed` (409) for a run that did not fail,\n * `continuation_superseded` (409) when a later continuation supersedes it —\n * the message names that run: one that failed (continue that one instead),\n * or one that completed all this run left (the work is done, and its results\n * are on that run) — `continuation_preview_pending` (409, a\n * `ContinuationPreviewPendingError`) when the newest later continuation\n * stopped at a Preview review of a render or of a Tighten Episode (the error\n * names that run, what holds it, and in `next` the run that finishes it:\n * `client.workflows.run(workflowId, error.next)` first — for a single render,\n * its {@link renderFinal}), and\n * `continuation_subset_required` (409) when nothing is left to run. Send an\n * {@link RunWorkflowOptions.idempotencyKey} with each continuation.\n */\n continueMode?: \"from-failed\"\n}\n\n/** Per-call options for {@link WorkflowsResource.run}. */\nexport interface RunWorkflowOptions {\n /**\n * Sent as the `Idempotency-Key` header (at least 8 characters; the server\n * ignores a shorter one). Reuse the same value when retrying the same\n * request: the server answers the run it already started (`deduped: true`)\n * instead of starting a second one — or, once that run is under way or has\n * superseded the one it continued, refuses with `already_running` (an\n * `AlreadyRunningError` carrying its `executionId`) or\n * `continuation_superseded` naming it. Either way nothing runs twice.\n */\n idempotencyKey?: string\n}\n\nexport interface RunWorkflowResult {\n executionId: string\n status: \"pending\" | \"running\"\n /** `true` when an `idempotencyKey` retry found the run already started: `executionId` is that run. */\n deduped?: boolean\n /**\n * With `continueMode: \"from-failed\"`: the execution the run continued from —\n * its states seed the run. The run asked for (`continueFromExecutionId`), or\n * the newest later continuation of it that completed part of what it left.\n * Absent on any other run, and on a `deduped` answer.\n */\n continuedFrom?: string\n}\n\n/**\n * A Render final: the Apply EDL render at Final for this run only, and every\n * node after it (Camera Switch first, in multicam). The server works out which\n * nodes run — the same rule as the editor's Render final button.\n */\nexport interface RenderFinalParams {\n /** The Apply EDL render node to finalize. */\n renderNodeId: string\n /**\n * The execution that stopped at the preview: your own `completed` run of\n * this workflow. Every node the Render final does not run hands on what it\n * produced (an Edit Plan hands on its plan with the review applied).\n */\n continueFromExecutionId: string\n}\n\n/** What a Render final will run and charge. Nothing is created by the quote. */\nexport interface RenderFinalQuote {\n renderNodeId: string\n /** The nodes the run executes, in canvas order. */\n nodeIds: string[]\n /** The one-shot override it runs with: `{ [renderNodeId]: { quality: \"final\" } }`. */\n inputOverrides: Record<string, Record<string, unknown>>\n /** Estimated credits; `null` in an edition without credits. */\n estimatedCredits: number | null\n /**\n * Present (`true`) when `estimatedCredits` includes an LLM node's estimate:\n * an LLM call is charged its actual usage after it runs, so show `~N`.\n * Absent for a fixed price.\n */\n estimatedCreditsIsEstimate?: true\n /**\n * Whether the payer can cover `estimatedCredits`; `null` in an edition\n * without credits. When `false`, {@link WorkflowsResource.renderFinal} is\n * refused with `InsufficientCreditsError` before any execution exists.\n */\n sufficient: boolean | null\n /**\n * The payer's spendable credits; `null` when it is not yours to see (a\n * deployment's operator pays) or a workspace budget pays.\n */\n available: number | null\n}\n\n/** A person granted access to a workflow. Email is never returned (privacy). */\nexport interface Collaborator {\n userId: string\n name?: string | null\n avatar?: string | null\n role: CollaboratorRole\n}\n\nexport interface AddCollaboratorInput {\n /** Provide exactly one of `userId` or `email`. */\n userId?: string\n email?: string\n role: CollaboratorRole\n}\n\n/** A workflow someone else shared with you, plus the role you hold on it. */\nexport interface SharedWorkflow extends Workflow {\n grantedRole: CollaboratorRole\n}\n\n/** A grant dropped because a move took the workflow out of the workspace the\n * access came from. */\nexport interface DroppedCollaborator {\n userId: string\n name: string | null\n}\n\n/**\n * The people a workflow is shared with — reached as `client.workflows.collaborators`.\n * All four endpoints are served by the organizations feature and exist only when\n * it is enabled server-side; against an install without it they 404\n * (→ `NotFoundError`). The active workspace travels on the request like every\n * other call, so a workspace admin's grants apply automatically.\n */\nexport class WorkflowCollaboratorsResource {\n constructor(private client: NodaroClientCore) {}\n\n /** List a workflow's collaborators (id, name, avatar, role — never email). */\n list(workflowId: string): Promise<{ data: Collaborator[] }> {\n return this.client.request(\n \"GET\",\n `/v1/workflows/${encodeURIComponent(workflowId)}/collaborators`,\n )\n }\n\n /** Add a collaborator by `userId` OR `email` (exactly one), at the given role. */\n add(\n workflowId: string,\n input: AddCollaboratorInput,\n ): Promise<{ data: { userId: string; role: CollaboratorRole } }> {\n return this.client.request(\n \"POST\",\n `/v1/workflows/${encodeURIComponent(workflowId)}/collaborators`,\n { body: input },\n )\n }\n\n /** Change a collaborator's role. */\n update(\n workflowId: string,\n userId: string,\n input: { role: CollaboratorRole },\n ): Promise<{ data: { userId: string; role: CollaboratorRole } }> {\n return this.client.request(\n \"PATCH\",\n `/v1/workflows/${encodeURIComponent(workflowId)}/collaborators/${encodeURIComponent(userId)}`,\n { body: input },\n )\n }\n\n /** Remove a collaborator — or yourself. Returns `{ success: true }`. */\n remove(workflowId: string, userId: string): Promise<{ success: true }> {\n return this.client.request(\n \"DELETE\",\n `/v1/workflows/${encodeURIComponent(workflowId)}/collaborators/${encodeURIComponent(userId)}`,\n )\n }\n}\n\n/** One MCP conversation: a flow its assistant built step by step (`GET /v1/mcp-conversations`). */\nexport interface McpConversation {\n /** The conversation's workflow id — open it with {@link WorkflowsResource.get}. */\n id: string\n projectId: string\n name: string\n /** The source: \"claude\", \"claude-code\", \"chatgpt\", or another client's name in lower case. */\n client: string\n clientLabel: string\n /** The connection's own name, as the connector was named. */\n clientName: string\n startedAt: string\n lastActivityAt: string\n /** Still receiving steps: its last step is less than 30 minutes old. */\n live: boolean\n /** The user's first request, when the assistant passed it. */\n firstRequest: string | null\n nodeCount: number\n counts: { image: number; video: number; audio: number }\n /** Credits charged for its jobs; null where credits are not billed. */\n credits: number | null\n cover: { url: string; kind: \"image\" | \"video\"; setByUser: boolean } | null\n updatedAt: string\n}\n\nexport interface ListMcpConversationsParams {\n /** \"YYYY-MM\". Default: the latest month that has conversations. */\n month?: string\n /** Keep only these sources (\"claude\", \"claude-code\", \"chatgpt\", …). */\n sources?: readonly string[]\n}\n\nexport interface McpConversationList {\n /** The month listed. */\n month: string\n /** Every month that has conversations, newest first, with its count. */\n months: Array<{ month: string; conversations: number }>\n /** The month's sources, with the connection names each one folds in. */\n sources: Array<{ client: string; label: string; conversations: number; connections: Array<{ clientName: string; conversations: number }> }>\n data: McpConversation[]\n}\n\nexport class WorkflowsResource {\n /** The people this workflow is shared with. See {@link WorkflowCollaboratorsResource}. */\n readonly collaborators: WorkflowCollaboratorsResource\n\n constructor(private client: NodaroClientCore) {\n this.collaborators = new WorkflowCollaboratorsResource(client)\n }\n\n /** List workflows for a project. Returns metadata only — `nodes`/`edges` are not included. */\n list(params: ListWorkflowsParams): Promise<{ data: Workflow[] }> {\n return this.client.request(\n \"GET\",\n `/v1/projects/${encodeURIComponent(params.projectId)}/workflows`,\n )\n }\n\n /** Get a workflow including its full nodes/edges/settings. */\n get(id: string): Promise<{ data: Workflow }> {\n return this.client.request(\"GET\", `/v1/workflows/${encodeURIComponent(id)}`)\n }\n\n /**\n * Get a PUBLICLY-SHARED workflow by id (`GET /v1/public/workflows/:id`) — the\n * unauthenticated share-by-link read. Returns the workflow's nodes/edges/\n * settings ONLY when it's opted into sharing server-side (`settings.studio.shared\n * === true`); otherwise the route 404s (→ `NotFoundError`). No auth required —\n * a share viewer has no session; the SDK omits the bearer when no token exists.\n */\n getPublic(id: string): Promise<{ data: Workflow }> {\n return this.client.request(\"GET\", `/v1/public/workflows/${encodeURIComponent(id)}`)\n }\n\n /**\n * Create a workflow under a project. Returns the full record.\n * NOTE: server route is `POST /v1/projects/:projectId/workflows`.\n */\n create(input: CreateWorkflowInput): Promise<{ data: Workflow }> {\n const { projectId, ...body } = input\n return this.client.request(\n \"POST\",\n `/v1/projects/${encodeURIComponent(projectId)}/workflows`,\n { body },\n )\n }\n\n /** Patch a workflow. Returns the full updated record. */\n update(id: string, input: UpdateWorkflowInput): Promise<{ data: Workflow }> {\n return this.client.request(\n \"PATCH\",\n `/v1/workflows/${encodeURIComponent(id)}`,\n { body: input },\n )\n }\n\n /** Delete a workflow. Returns `{ success: true }`. Throws `NotFoundError`\n * when the id doesn't exist or isn't yours (the delete is not silent). */\n delete(id: string): Promise<{ success: true }> {\n return this.client.request(\"DELETE\", `/v1/workflows/${encodeURIComponent(id)}`)\n }\n\n /**\n * Run a workflow. Returns the executionId for polling via\n * `client.executions.get(executionId)`.\n */\n run(id: string, params: RunWorkflowParams = {}, options?: RunWorkflowOptions): Promise<RunWorkflowResult> {\n return this.client.request(\n \"POST\",\n `/v1/workflows/${encodeURIComponent(id)}/run`,\n {\n body: params,\n ...(options?.idempotencyKey ? { headers: { \"Idempotency-Key\": options.idempotencyKey } } : {}),\n },\n )\n }\n\n /**\n * Render final (`renderFinal` on `POST /v1/workflows/:id/run`): run the\n * render at Final for this run only, and every node after it, continuing the\n * execution that stopped at its preview. The server derives the nodes and\n * the override — send nothing else. Quote it first with\n * {@link estimateRenderFinal}. Refused with `render_final_node_not_found`,\n * `render_final_not_a_render`, or a continuation code (see `run`); a run\n * its payer cannot cover throws `InsufficientCreditsError` (with `required`\n * and, when it is yours to see, `available`) before any execution exists.\n */\n renderFinal(id: string, params: RenderFinalParams): Promise<RunWorkflowResult> {\n return this.client.request(\"POST\", `/v1/workflows/${encodeURIComponent(id)}/run`, {\n body: {\n renderFinal: { renderNodeId: params.renderNodeId },\n continueFromExecutionId: params.continueFromExecutionId,\n },\n })\n }\n\n /**\n * Quote a Render final (`POST /v1/workflows/:id/render-final/estimate`): the\n * nodes it will run, the override it runs with and its estimated credits.\n * Nothing is created or charged.\n */\n estimateRenderFinal(id: string, params: RenderFinalParams): Promise<{ data: RenderFinalQuote }> {\n return this.client.request(\"POST\", `/v1/workflows/${encodeURIComponent(id)}/render-final/estimate`, {\n body: { renderNodeId: params.renderNodeId, continueFromExecutionId: params.continueFromExecutionId },\n })\n }\n\n /**\n * Export a workflow as a portable JSON bundle.\n * Pass `opts.assets = true` to include character/object/location entity data.\n */\n export(\n workflowId: string,\n opts?: { assets?: boolean },\n ): Promise<{ data: WorkflowExport }> {\n return this.client.request(\n \"GET\",\n `/v1/workflows/${encodeURIComponent(workflowId)}/export`,\n { query: { assets: opts?.assets ?? false } },\n )\n }\n\n /**\n * Import a `WorkflowExport` bundle into the specified project.\n * Re-creates any bundled assets (characters, objects, creatures, locations)\n * under your account, and re-points BOTH the entity nodes and every `@`-chip\n * (`ConnectedReference`) bound in the graph at the rows it created.\n * Media the bundle references on other hosts is copied onto this instance's\n * storage where reachable; a bundled entity's images are copied whoever\n * hosts them, because they are the exporter's bytes and their lifecycle is\n * not yours. `importReport` says what was copied, what could not be reached\n * and what was skipped (and why); `assetIdMap` maps each bundled entity id\n * to the row created for it (for chips you hold outside the graph), and\n * `assetsSkipped` names the entities your storage quota left uncreated —\n * the workflow itself still lands.\n */\n import(input: WorkflowExport & { projectId: string }): Promise<{ data: Workflow; importReport?: WorkflowImportReport }> {\n const { projectId, ...workflowJson } = input\n return this.client.request(\"POST\", \"/v1/workflows/import\", {\n body: { projectId, workflow_json: workflowJson },\n })\n }\n\n /**\n * Set a workflow's visibility — `\"private\"` (creator + explicit collaborators)\n * or `\"workspace\"` (everyone in its workspace). Only the creator or a workspace\n * admin may change it; anyone else gets HTTP 403. Thin wrapper over `update()`:\n * the visibility lever lives on `PATCH /v1/workflows/:id`.\n */\n setVisibility(id: string, visibility: WorkflowVisibility): Promise<{ data: Workflow }> {\n return this.client.request(\"PATCH\", `/v1/workflows/${encodeURIComponent(id)}`, {\n body: { visibility },\n })\n }\n\n /**\n * Move a workflow to another project (`POST /v1/workflows/:id/move`); its folder\n * is cleared. When the move takes the workflow out of a workspace, collaborator\n * grants that came from that workspace are dropped and returned as\n * `droppedCollaborators`.\n */\n move(\n id: string,\n params: { projectId: string },\n ): Promise<{ data: Workflow; droppedCollaborators: DroppedCollaborator[] }> {\n return this.client.request(\"POST\", `/v1/workflows/${encodeURIComponent(id)}/move`, {\n body: params,\n })\n }\n\n /**\n * Workflows other people shared with you (`GET /v1/workflows/shared-with-me`) —\n * grants on work that is NOT in a workspace you belong to (workspace work already\n * shows in that workspace's own lists). Each carries the `grantedRole` you hold.\n * Empty when the organizations feature is off server-side.\n */\n sharedWithMe(): Promise<{ data: SharedWorkflow[] }> {\n return this.client.request(\"GET\", \"/v1/workflows/shared-with-me\")\n }\n\n /**\n * Your MCP conversations of one month (`GET /v1/mcp-conversations`): each is a\n * flow an assistant built from its steps, newest first. A conversation is a\n * workflow, so open, rename, export or delete it with the other methods here.\n */\n listMcpConversations(params: ListMcpConversationsParams = {}): Promise<McpConversationList> {\n const query: Record<string, string> = {}\n if (params.month) query.month = params.month\n if (params.sources?.length) query.sources = params.sources.join(\",\")\n return this.client.request(\"GET\", \"/v1/mcp-conversations\", { query })\n }\n}\n"]}
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  require('../chunk-RQSGS7ZK.cjs');
4
- var chunkF6GENF6R_cjs = require('../chunk-F6GENF6R.cjs');
4
+ var chunk55ZX6TE3_cjs = require('../chunk-55ZX6TE3.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "CastSwapResource", {
9
9
  enumerable: true,
10
- get: function () { return chunkF6GENF6R_cjs.CastSwapResource; }
10
+ get: function () { return chunk55ZX6TE3_cjs.CastSwapResource; }
11
11
  });
12
12
  //# sourceMappingURL=cast-swap.cjs.map
13
13
  //# sourceMappingURL=cast-swap.cjs.map
@@ -14,6 +14,12 @@ import '@nodaro/shared/organizations';
14
14
  * photos if it fails, and is turned off with `prepareReferences: false`.
15
15
  * Locations are not prepared.
16
16
  *
17
+ * Engines: a run is made on Seedance 2.5 (`engine` left out, or
18
+ * `"seedance-2-5"`) or Kling 4 (`"kling-4"`). Kling 4 renders 720p (its
19
+ * default) or 1080p and has no draft; it makes a new take guided by the clip
20
+ * and pictures, so its Full Quality is a new take at 1080p rather than the
21
+ * same take re-rendered (`CastSwapFullQualityEstimate.kind`).
22
+ *
17
23
  * Cloud edition only: `/v1/cast-swap` is served by the cloud plugin and 404s
18
24
  * on self-hosted installs. `run()` answers 202 with a job id; follow it with
19
25
  * `client.jobs.get(jobId)` / `client.jobs.getStatus(jobId)` like any other job.
@@ -29,18 +35,39 @@ import '@nodaro/shared/organizations';
29
35
  * no reference and no `prePrompt` or `postPrompt`, more roles of a kind
30
36
  * than allowed, more than 30 images in all, `draft: true` above 480p, a
31
37
  * `prePrompt` or `postPrompt` over 4,000 characters, a `faceMasking` setting
32
- * out of range), `raw_reference_token` (also in a reference's `line`),
38
+ * out of range); on Kling 4, `draft_unsupported` (`draft: true`),
39
+ * `resolution_unsupported` (480p), `output_format_unsupported` (a MOV edit
40
+ * output) and `too_many_images` (more than 10 images in the run, across every
41
+ * role and fixed reference); `raw_reference_token` (also in a reference's `line`),
33
42
  * `invalid_role_mention` (also any `{role:N}` in a reference's `line`),
34
43
  * `unsafe_url`, `video_unreadable`, `clip_out_of_range` (4–30 s),
35
44
  * `preview_out_of_range`, `no_roles_in_preview` (a preview with every role
36
45
  * `inPreview: false`, always refused even with a prompt, or with no role kept
37
46
  * in it that has images and no `prePrompt` or `postPrompt`), `prompt_too_long`
38
47
  * (the prompt would build too long: a `{role:N}` reads as the role's name when
39
- * it sends no images); 401; 402 `insufficient_credits` (`run()` only); 404
48
+ * it sends no images; Kling 4's cap is 8,000 characters); 401; 402 `insufficient_credits` (`run()` only); 404
40
49
  * (a `sessionId` you may not use, `run()` only); 422 `job_blocked` (`run()`
41
50
  * only); 503 `host_too_old` (both); 503 `estimate_unavailable` (`estimate()`
42
51
  * only).
43
52
  */
53
+ /**
54
+ * The video engine a Cast Swap run is made on. Left out = `"seedance-2-5"`.
55
+ *
56
+ * - `"seedance-2-5"`: 480p (the default, a draft unless `draft: false`), 720p
57
+ * or 1080p; Full Quality re-renders a draft's own take at 1080p.
58
+ * - `"kling-4"`: 720p (the default) or 1080p, never a draft (`draft: true`
59
+ * answers 400 `draft_unsupported`); Full Quality makes a new take at 1080p
60
+ * from a completed 720p run's inputs. A preview is still 4 s from
61
+ * `previewStart`.
62
+ */
63
+ type CastSwapEngine = "seedance-2-5" | "kling-4";
64
+ /**
65
+ * Where a Kling 4 run cuts the clip to whole seconds (Kling renders whole
66
+ * seconds; asked for more than the clip, it would stretch the motion):
67
+ * - `"cut-end"` (the default): drop the fraction of a second at its end;
68
+ * - `"cut-start"`: drop it at its start.
69
+ */
70
+ type CastSwapKlingLength = "cut-end" | "cut-start";
44
71
  /** Whether a swapped subject takes this trait from the references (`"new"`) or keeps the video's (`"original"`). */
45
72
  type CastSwapTraitSource = "new" | "original";
46
73
  /**
@@ -220,11 +247,28 @@ interface CastSwapParams {
220
247
  preview?: boolean;
221
248
  /** Where the preview starts, in seconds. Default 0. */
222
249
  previewStart?: number;
223
- /** The output resolution. Default `"480p"`. */
250
+ /**
251
+ * The video engine (see {@link CastSwapEngine}). Default `"seedance-2-5"`.
252
+ * The job records it in `input_data.engine`, and a completed job's output
253
+ * in its `engine`. A Cast Swap engine older than Kling 4 support ignores
254
+ * the field and runs Seedance 2.5: a Kling 4 quote names `engine:
255
+ * "kling-4"`, so check the estimate's `engine` before running.
256
+ */
257
+ engine?: CastSwapEngine;
258
+ /**
259
+ * Kling 4 only (Seedance 2.5 ignores it): which end of the clip is cut to
260
+ * whole seconds (see {@link CastSwapKlingLength}). Default `"cut-end"`.
261
+ */
262
+ klingLength?: CastSwapKlingLength;
263
+ /**
264
+ * The output resolution. Seedance 2.5: `"480p"` (default), `"720p"` or
265
+ * `"1080p"`. Kling 4: `"720p"` (default) or `"1080p"`; `"480p"` answers 400.
266
+ */
224
267
  resolution?: "480p" | "720p" | "1080p";
225
268
  /**
226
- * Render as a draft. Defaults to `true` at 480p and `false` above it; `true`
227
- * with `"720p"` or `"1080p"` answers 400 (draft is 480p only).
269
+ * Render as a draft (Seedance 2.5 only). Defaults to `true` at 480p and
270
+ * `false` above it; `true` with `"720p"` or `"1080p"` answers 400 (draft is
271
+ * 480p only). Kling 4 has no draft: `true` answers 400 `draft_unsupported`.
228
272
  */
229
273
  draft?: boolean;
230
274
  /**
@@ -248,10 +292,16 @@ interface CastSwapParams {
248
292
  }
249
293
  /** What a run would cost, in credits. */
250
294
  interface CastSwapEstimate {
295
+ /**
296
+ * The engine the run would use. Sent by an engine that knows Kling 4 on a
297
+ * Kling 4 quote (`"kling-4"`); absent = Seedance 2.5.
298
+ */
299
+ engine?: CastSwapEngine;
251
300
  /**
252
301
  * What is held when the run starts: `breakdown.castSwap +
253
- * breakdown.seedance + breakdown.references`, plus `breakdown.masking` with
254
- * face masking `"always"`. The run is charged what it actually costs, which
302
+ * breakdown.seedance + breakdown.references` (on Kling 4,
303
+ * `breakdown.kling` in place of `breakdown.seedance`), plus
304
+ * `breakdown.masking` with face masking `"always"`. The run is charged what it actually costs, which
255
305
  * is expected to be `expectedCredits`.
256
306
  */
257
307
  totalCredits: number;
@@ -264,7 +314,9 @@ interface CastSwapEstimate {
264
314
  * `totalCredits` is what is held when the run starts; the run is charged
265
315
  * what it actually costs.
266
316
  *
267
- * Absent from an older Cast Swap engine: read `totalCredits` then.
317
+ * Absent from an older Cast Swap engine: read `totalCredits` then. On
318
+ * Kling 4 it equals `totalCredits` (Kling renders exactly the length asked
319
+ * for, so the hold is what it settles at).
268
320
  */
269
321
  expectedCredits?: number;
270
322
  /**
@@ -276,6 +328,8 @@ interface CastSwapEstimate {
276
328
  * clip in and about as much out), never above `seedance`. It takes
277
329
  * `seedance`'s place in `expectedCredits`; it is not added to it. Absent
278
330
  * from an older Cast Swap engine, like `expectedCredits`;
331
+ * - `kling`: Kling 4 only, in place of `seedance` and `seedanceExpected`:
332
+ * what the Kling take costs (held and charged alike);
279
333
  * - `references`: preparing the reference pictures (0 when
280
334
  * `prepareReferences` is off or there is nothing to prepare);
281
335
  * - `masking`: masking the faces, present only when `faceMasking` is on.
@@ -287,9 +341,10 @@ interface CastSwapEstimate {
287
341
  */
288
342
  breakdown: {
289
343
  castSwap: number;
290
- seedance: number;
344
+ seedance?: number;
291
345
  references: number;
292
346
  seedanceExpected?: number;
347
+ kling?: number;
293
348
  masking?: number;
294
349
  };
295
350
  /**
@@ -300,9 +355,9 @@ interface CastSwapEstimate {
300
355
  */
301
356
  maskingCredits?: number;
302
357
  /**
303
- * `true` when the video is made at Auto length (every run today): the final
304
- * charge is expected to come out lower than `totalCredits`, at about
305
- * `expectedCredits`.
358
+ * `true` when the video is made at Auto length (every Seedance 2.5 run): the
359
+ * final charge is expected to come out lower than `totalCredits`, at about
360
+ * `expectedCredits`. `false` on Kling 4.
306
361
  */
307
362
  settlesLower: boolean;
308
363
  }
@@ -319,22 +374,37 @@ interface CastSwapRunOptions {
319
374
  idempotencyKey?: string;
320
375
  }
321
376
  /**
322
- * What finishing a draft at Full Quality would cost
323
- * (`POST /v1/cast-swap/:jobId/full-quality/estimate`).
377
+ * What a Full Quality version would be: `"same-take"` re-renders a Seedance
378
+ * 2.5 draft's own take at 1080p; `"new-take"` makes a new Kling 4 take at
379
+ * 1080p from a 720p run's inputs (it will not match the 720p run frame for
380
+ * frame). The 720p run or draft stays either way.
381
+ */
382
+ type CastSwapFullQualityKind = "same-take" | "new-take";
383
+ /**
384
+ * What a Full Quality version of a run would cost
385
+ * (`POST /v1/cast-swap/:jobId/full-quality/estimate`): a Seedance 2.5 draft,
386
+ * or a completed Kling 4 run at 720p.
324
387
  */
325
388
  interface CastSwapFullQualityEstimate {
326
- /** The quote in credits: `breakdown.castSwap + breakdown.seedanceHd`. */
389
+ /**
390
+ * Which Full Quality this is ({@link CastSwapFullQualityKind}), so it can
391
+ * be worded right. Absent from an older Cast Swap engine: `"same-take"`.
392
+ */
393
+ kind?: CastSwapFullQualityKind;
394
+ /** The quote in credits: `breakdown.castSwap` + `breakdown.seedanceHd` (same take) or `breakdown.kling` (new take). */
327
395
  totalCredits: number;
328
396
  /**
329
- * `castSwap`: the Full Quality job's own steps; `seedanceHd`: the 1080p
330
- * render of the draft's take (0 when an earlier try of this draft already
331
- * finished that render, which is then reused).
397
+ * `castSwap`: the Full Quality job's own steps; `seedanceHd` (a same take):
398
+ * the 1080p render of the draft's take (0 when an earlier try of this draft
399
+ * already finished that render, which is then reused); `kling` (a new take,
400
+ * in place of `seedanceHd`): the new Kling 4 take at 1080p.
332
401
  */
333
402
  breakdown: {
334
403
  castSwap: number;
335
- seedanceHd: number;
404
+ seedanceHd?: number;
405
+ kling?: number;
336
406
  };
337
- /** ISO time until which the draft can be finished at Full Quality (7 days after it completed). */
407
+ /** ISO time until which the run can be finished at Full Quality (7 days after it completed). */
338
408
  availableUntil: string;
339
409
  }
340
410
  /** Options for {@link CastSwapResource.fullQuality}. */
@@ -345,7 +415,7 @@ interface CastSwapFullQualityParams {
345
415
  /** The Full Quality job (`POST /v1/cast-swap/:jobId/full-quality`). */
346
416
  interface CastSwapFullQualityResult {
347
417
  jobId: string;
348
- /** `true` when this draft's Full Quality was already running or done: that job is answered, nothing new is started or charged. */
418
+ /** `true` when this run's Full Quality was already running or done: that job is answered, nothing new is started or charged. */
349
419
  existing?: boolean;
350
420
  }
351
421
  /**
@@ -355,7 +425,8 @@ interface CastSwapFullQualityResult {
355
425
  * - `not_found` (404): not your job, or not a Cast Swap run; also a
356
426
  * `sessionId` you may not use;
357
427
  * - `not_completed` (409): the run has not finished;
358
- * - `not_a_draft` (409): the run was not made as a draft;
428
+ * - `not_a_draft` (409): the run is neither a Seedance 2.5 draft nor a
429
+ * Kling 4 run at 720p (a Kling 4 run at 1080p is already Full Quality);
359
430
  * - `draft_expired` (410): more than 7 days after the draft completed, or
360
431
  * the draft can no longer be finished at Full Quality;
361
432
  * - `full_quality_pending` (409, `details.retryable: true`): not final — an
@@ -392,21 +463,24 @@ declare class CastSwapResource {
392
463
  /** Quote a run before starting it (`POST /v1/cast-swap/estimate`); spends nothing. */
393
464
  estimate(params: CastSwapParams): Promise<CastSwapEstimate>;
394
465
  /**
395
- * Quote finishing a draft at Full Quality (`POST
466
+ * Quote finishing a run at Full Quality (`POST
396
467
  * /v1/cast-swap/:jobId/full-quality/estimate`); spends nothing. `jobId` is a
397
- * finished DRAFT run (a Cast Swap or trend run made as a draft). The quote
468
+ * finished Seedance 2.5 DRAFT run, or a finished Kling 4 run at 720p (a Cast
469
+ * Swap or trend run); the quote's `kind` says whether it is the same take
470
+ * re-rendered or a new take. The quote
398
471
  * does not look for a Full Quality already running: when one is,
399
472
  * {@link fullQuality} answers it (`existing: true`) and charges nothing.
400
473
  * Refusals: {@link CastSwapFullQualityRefusalCode}.
401
474
  */
402
475
  fullQualityEstimate(jobId: string): Promise<CastSwapFullQualityEstimate>;
403
476
  /**
404
- * Finish a draft at Full Quality (`POST /v1/cast-swap/:jobId/full-quality`):
405
- * the same take re-rendered at 1080p, with the clip's audio, as a new job
406
- * linked to the draft. SPENDS CREDITS: quote it first with
477
+ * Finish a run at Full Quality (`POST /v1/cast-swap/:jobId/full-quality`):
478
+ * at 1080p, with the clip's audio, as a new job linked to the run — a
479
+ * Seedance 2.5 draft's own take re-rendered, or a new Kling 4 take from a
480
+ * 720p run's inputs (the quote's `kind`). SPENDS CREDITS: quote it first with
407
481
  * {@link fullQualityEstimate}. Answers 202 `{ jobId }`, or 200
408
- * `{ jobId, existing: true }` when this draft's Full Quality is already
409
- * running or done (one per draft; a failed one may be asked again). Follow
482
+ * `{ jobId, existing: true }` when this run's Full Quality is already
483
+ * running or done (one per run; a failed one may be asked again). Follow
410
484
  * the job with `client.jobs.get(jobId)`. No `Idempotency-Key` is taken: the
411
485
  * server keys the job by the draft. The new job keeps the draft's origin.
412
486
  * Refusals: {@link CastSwapFullQualityRefusalCode}.
@@ -414,4 +488,4 @@ declare class CastSwapResource {
414
488
  fullQuality(jobId: string, params?: CastSwapFullQualityParams): Promise<CastSwapFullQualityResult>;
415
489
  }
416
490
 
417
- export { type CastSwapEstimate, type CastSwapFaceMasking, type CastSwapFaceMaskingZone, type CastSwapFullQualityEstimate, type CastSwapFullQualityParams, type CastSwapFullQualityRefusalCode, type CastSwapFullQualityResult, type CastSwapLocationRole, type CastSwapParams, type CastSwapPersonRole, type CastSwapPetRole, type CastSwapProductRole, type CastSwapReference, CastSwapResource, type CastSwapRole, type CastSwapRolePreviewSettings, type CastSwapRunOptions, type CastSwapTraitSource };
491
+ export { type CastSwapEngine, type CastSwapEstimate, type CastSwapFaceMasking, type CastSwapFaceMaskingZone, type CastSwapFullQualityEstimate, type CastSwapFullQualityKind, type CastSwapFullQualityParams, type CastSwapFullQualityRefusalCode, type CastSwapFullQualityResult, type CastSwapKlingLength, type CastSwapLocationRole, type CastSwapParams, type CastSwapPersonRole, type CastSwapPetRole, type CastSwapProductRole, type CastSwapReference, CastSwapResource, type CastSwapRole, type CastSwapRolePreviewSettings, type CastSwapRunOptions, type CastSwapTraitSource };
@@ -14,6 +14,12 @@ import '@nodaro/shared/organizations';
14
14
  * photos if it fails, and is turned off with `prepareReferences: false`.
15
15
  * Locations are not prepared.
16
16
  *
17
+ * Engines: a run is made on Seedance 2.5 (`engine` left out, or
18
+ * `"seedance-2-5"`) or Kling 4 (`"kling-4"`). Kling 4 renders 720p (its
19
+ * default) or 1080p and has no draft; it makes a new take guided by the clip
20
+ * and pictures, so its Full Quality is a new take at 1080p rather than the
21
+ * same take re-rendered (`CastSwapFullQualityEstimate.kind`).
22
+ *
17
23
  * Cloud edition only: `/v1/cast-swap` is served by the cloud plugin and 404s
18
24
  * on self-hosted installs. `run()` answers 202 with a job id; follow it with
19
25
  * `client.jobs.get(jobId)` / `client.jobs.getStatus(jobId)` like any other job.
@@ -29,18 +35,39 @@ import '@nodaro/shared/organizations';
29
35
  * no reference and no `prePrompt` or `postPrompt`, more roles of a kind
30
36
  * than allowed, more than 30 images in all, `draft: true` above 480p, a
31
37
  * `prePrompt` or `postPrompt` over 4,000 characters, a `faceMasking` setting
32
- * out of range), `raw_reference_token` (also in a reference's `line`),
38
+ * out of range); on Kling 4, `draft_unsupported` (`draft: true`),
39
+ * `resolution_unsupported` (480p), `output_format_unsupported` (a MOV edit
40
+ * output) and `too_many_images` (more than 10 images in the run, across every
41
+ * role and fixed reference); `raw_reference_token` (also in a reference's `line`),
33
42
  * `invalid_role_mention` (also any `{role:N}` in a reference's `line`),
34
43
  * `unsafe_url`, `video_unreadable`, `clip_out_of_range` (4–30 s),
35
44
  * `preview_out_of_range`, `no_roles_in_preview` (a preview with every role
36
45
  * `inPreview: false`, always refused even with a prompt, or with no role kept
37
46
  * in it that has images and no `prePrompt` or `postPrompt`), `prompt_too_long`
38
47
  * (the prompt would build too long: a `{role:N}` reads as the role's name when
39
- * it sends no images); 401; 402 `insufficient_credits` (`run()` only); 404
48
+ * it sends no images; Kling 4's cap is 8,000 characters); 401; 402 `insufficient_credits` (`run()` only); 404
40
49
  * (a `sessionId` you may not use, `run()` only); 422 `job_blocked` (`run()`
41
50
  * only); 503 `host_too_old` (both); 503 `estimate_unavailable` (`estimate()`
42
51
  * only).
43
52
  */
53
+ /**
54
+ * The video engine a Cast Swap run is made on. Left out = `"seedance-2-5"`.
55
+ *
56
+ * - `"seedance-2-5"`: 480p (the default, a draft unless `draft: false`), 720p
57
+ * or 1080p; Full Quality re-renders a draft's own take at 1080p.
58
+ * - `"kling-4"`: 720p (the default) or 1080p, never a draft (`draft: true`
59
+ * answers 400 `draft_unsupported`); Full Quality makes a new take at 1080p
60
+ * from a completed 720p run's inputs. A preview is still 4 s from
61
+ * `previewStart`.
62
+ */
63
+ type CastSwapEngine = "seedance-2-5" | "kling-4";
64
+ /**
65
+ * Where a Kling 4 run cuts the clip to whole seconds (Kling renders whole
66
+ * seconds; asked for more than the clip, it would stretch the motion):
67
+ * - `"cut-end"` (the default): drop the fraction of a second at its end;
68
+ * - `"cut-start"`: drop it at its start.
69
+ */
70
+ type CastSwapKlingLength = "cut-end" | "cut-start";
44
71
  /** Whether a swapped subject takes this trait from the references (`"new"`) or keeps the video's (`"original"`). */
45
72
  type CastSwapTraitSource = "new" | "original";
46
73
  /**
@@ -220,11 +247,28 @@ interface CastSwapParams {
220
247
  preview?: boolean;
221
248
  /** Where the preview starts, in seconds. Default 0. */
222
249
  previewStart?: number;
223
- /** The output resolution. Default `"480p"`. */
250
+ /**
251
+ * The video engine (see {@link CastSwapEngine}). Default `"seedance-2-5"`.
252
+ * The job records it in `input_data.engine`, and a completed job's output
253
+ * in its `engine`. A Cast Swap engine older than Kling 4 support ignores
254
+ * the field and runs Seedance 2.5: a Kling 4 quote names `engine:
255
+ * "kling-4"`, so check the estimate's `engine` before running.
256
+ */
257
+ engine?: CastSwapEngine;
258
+ /**
259
+ * Kling 4 only (Seedance 2.5 ignores it): which end of the clip is cut to
260
+ * whole seconds (see {@link CastSwapKlingLength}). Default `"cut-end"`.
261
+ */
262
+ klingLength?: CastSwapKlingLength;
263
+ /**
264
+ * The output resolution. Seedance 2.5: `"480p"` (default), `"720p"` or
265
+ * `"1080p"`. Kling 4: `"720p"` (default) or `"1080p"`; `"480p"` answers 400.
266
+ */
224
267
  resolution?: "480p" | "720p" | "1080p";
225
268
  /**
226
- * Render as a draft. Defaults to `true` at 480p and `false` above it; `true`
227
- * with `"720p"` or `"1080p"` answers 400 (draft is 480p only).
269
+ * Render as a draft (Seedance 2.5 only). Defaults to `true` at 480p and
270
+ * `false` above it; `true` with `"720p"` or `"1080p"` answers 400 (draft is
271
+ * 480p only). Kling 4 has no draft: `true` answers 400 `draft_unsupported`.
228
272
  */
229
273
  draft?: boolean;
230
274
  /**
@@ -248,10 +292,16 @@ interface CastSwapParams {
248
292
  }
249
293
  /** What a run would cost, in credits. */
250
294
  interface CastSwapEstimate {
295
+ /**
296
+ * The engine the run would use. Sent by an engine that knows Kling 4 on a
297
+ * Kling 4 quote (`"kling-4"`); absent = Seedance 2.5.
298
+ */
299
+ engine?: CastSwapEngine;
251
300
  /**
252
301
  * What is held when the run starts: `breakdown.castSwap +
253
- * breakdown.seedance + breakdown.references`, plus `breakdown.masking` with
254
- * face masking `"always"`. The run is charged what it actually costs, which
302
+ * breakdown.seedance + breakdown.references` (on Kling 4,
303
+ * `breakdown.kling` in place of `breakdown.seedance`), plus
304
+ * `breakdown.masking` with face masking `"always"`. The run is charged what it actually costs, which
255
305
  * is expected to be `expectedCredits`.
256
306
  */
257
307
  totalCredits: number;
@@ -264,7 +314,9 @@ interface CastSwapEstimate {
264
314
  * `totalCredits` is what is held when the run starts; the run is charged
265
315
  * what it actually costs.
266
316
  *
267
- * Absent from an older Cast Swap engine: read `totalCredits` then.
317
+ * Absent from an older Cast Swap engine: read `totalCredits` then. On
318
+ * Kling 4 it equals `totalCredits` (Kling renders exactly the length asked
319
+ * for, so the hold is what it settles at).
268
320
  */
269
321
  expectedCredits?: number;
270
322
  /**
@@ -276,6 +328,8 @@ interface CastSwapEstimate {
276
328
  * clip in and about as much out), never above `seedance`. It takes
277
329
  * `seedance`'s place in `expectedCredits`; it is not added to it. Absent
278
330
  * from an older Cast Swap engine, like `expectedCredits`;
331
+ * - `kling`: Kling 4 only, in place of `seedance` and `seedanceExpected`:
332
+ * what the Kling take costs (held and charged alike);
279
333
  * - `references`: preparing the reference pictures (0 when
280
334
  * `prepareReferences` is off or there is nothing to prepare);
281
335
  * - `masking`: masking the faces, present only when `faceMasking` is on.
@@ -287,9 +341,10 @@ interface CastSwapEstimate {
287
341
  */
288
342
  breakdown: {
289
343
  castSwap: number;
290
- seedance: number;
344
+ seedance?: number;
291
345
  references: number;
292
346
  seedanceExpected?: number;
347
+ kling?: number;
293
348
  masking?: number;
294
349
  };
295
350
  /**
@@ -300,9 +355,9 @@ interface CastSwapEstimate {
300
355
  */
301
356
  maskingCredits?: number;
302
357
  /**
303
- * `true` when the video is made at Auto length (every run today): the final
304
- * charge is expected to come out lower than `totalCredits`, at about
305
- * `expectedCredits`.
358
+ * `true` when the video is made at Auto length (every Seedance 2.5 run): the
359
+ * final charge is expected to come out lower than `totalCredits`, at about
360
+ * `expectedCredits`. `false` on Kling 4.
306
361
  */
307
362
  settlesLower: boolean;
308
363
  }
@@ -319,22 +374,37 @@ interface CastSwapRunOptions {
319
374
  idempotencyKey?: string;
320
375
  }
321
376
  /**
322
- * What finishing a draft at Full Quality would cost
323
- * (`POST /v1/cast-swap/:jobId/full-quality/estimate`).
377
+ * What a Full Quality version would be: `"same-take"` re-renders a Seedance
378
+ * 2.5 draft's own take at 1080p; `"new-take"` makes a new Kling 4 take at
379
+ * 1080p from a 720p run's inputs (it will not match the 720p run frame for
380
+ * frame). The 720p run or draft stays either way.
381
+ */
382
+ type CastSwapFullQualityKind = "same-take" | "new-take";
383
+ /**
384
+ * What a Full Quality version of a run would cost
385
+ * (`POST /v1/cast-swap/:jobId/full-quality/estimate`): a Seedance 2.5 draft,
386
+ * or a completed Kling 4 run at 720p.
324
387
  */
325
388
  interface CastSwapFullQualityEstimate {
326
- /** The quote in credits: `breakdown.castSwap + breakdown.seedanceHd`. */
389
+ /**
390
+ * Which Full Quality this is ({@link CastSwapFullQualityKind}), so it can
391
+ * be worded right. Absent from an older Cast Swap engine: `"same-take"`.
392
+ */
393
+ kind?: CastSwapFullQualityKind;
394
+ /** The quote in credits: `breakdown.castSwap` + `breakdown.seedanceHd` (same take) or `breakdown.kling` (new take). */
327
395
  totalCredits: number;
328
396
  /**
329
- * `castSwap`: the Full Quality job's own steps; `seedanceHd`: the 1080p
330
- * render of the draft's take (0 when an earlier try of this draft already
331
- * finished that render, which is then reused).
397
+ * `castSwap`: the Full Quality job's own steps; `seedanceHd` (a same take):
398
+ * the 1080p render of the draft's take (0 when an earlier try of this draft
399
+ * already finished that render, which is then reused); `kling` (a new take,
400
+ * in place of `seedanceHd`): the new Kling 4 take at 1080p.
332
401
  */
333
402
  breakdown: {
334
403
  castSwap: number;
335
- seedanceHd: number;
404
+ seedanceHd?: number;
405
+ kling?: number;
336
406
  };
337
- /** ISO time until which the draft can be finished at Full Quality (7 days after it completed). */
407
+ /** ISO time until which the run can be finished at Full Quality (7 days after it completed). */
338
408
  availableUntil: string;
339
409
  }
340
410
  /** Options for {@link CastSwapResource.fullQuality}. */
@@ -345,7 +415,7 @@ interface CastSwapFullQualityParams {
345
415
  /** The Full Quality job (`POST /v1/cast-swap/:jobId/full-quality`). */
346
416
  interface CastSwapFullQualityResult {
347
417
  jobId: string;
348
- /** `true` when this draft's Full Quality was already running or done: that job is answered, nothing new is started or charged. */
418
+ /** `true` when this run's Full Quality was already running or done: that job is answered, nothing new is started or charged. */
349
419
  existing?: boolean;
350
420
  }
351
421
  /**
@@ -355,7 +425,8 @@ interface CastSwapFullQualityResult {
355
425
  * - `not_found` (404): not your job, or not a Cast Swap run; also a
356
426
  * `sessionId` you may not use;
357
427
  * - `not_completed` (409): the run has not finished;
358
- * - `not_a_draft` (409): the run was not made as a draft;
428
+ * - `not_a_draft` (409): the run is neither a Seedance 2.5 draft nor a
429
+ * Kling 4 run at 720p (a Kling 4 run at 1080p is already Full Quality);
359
430
  * - `draft_expired` (410): more than 7 days after the draft completed, or
360
431
  * the draft can no longer be finished at Full Quality;
361
432
  * - `full_quality_pending` (409, `details.retryable: true`): not final — an
@@ -392,21 +463,24 @@ declare class CastSwapResource {
392
463
  /** Quote a run before starting it (`POST /v1/cast-swap/estimate`); spends nothing. */
393
464
  estimate(params: CastSwapParams): Promise<CastSwapEstimate>;
394
465
  /**
395
- * Quote finishing a draft at Full Quality (`POST
466
+ * Quote finishing a run at Full Quality (`POST
396
467
  * /v1/cast-swap/:jobId/full-quality/estimate`); spends nothing. `jobId` is a
397
- * finished DRAFT run (a Cast Swap or trend run made as a draft). The quote
468
+ * finished Seedance 2.5 DRAFT run, or a finished Kling 4 run at 720p (a Cast
469
+ * Swap or trend run); the quote's `kind` says whether it is the same take
470
+ * re-rendered or a new take. The quote
398
471
  * does not look for a Full Quality already running: when one is,
399
472
  * {@link fullQuality} answers it (`existing: true`) and charges nothing.
400
473
  * Refusals: {@link CastSwapFullQualityRefusalCode}.
401
474
  */
402
475
  fullQualityEstimate(jobId: string): Promise<CastSwapFullQualityEstimate>;
403
476
  /**
404
- * Finish a draft at Full Quality (`POST /v1/cast-swap/:jobId/full-quality`):
405
- * the same take re-rendered at 1080p, with the clip's audio, as a new job
406
- * linked to the draft. SPENDS CREDITS: quote it first with
477
+ * Finish a run at Full Quality (`POST /v1/cast-swap/:jobId/full-quality`):
478
+ * at 1080p, with the clip's audio, as a new job linked to the run — a
479
+ * Seedance 2.5 draft's own take re-rendered, or a new Kling 4 take from a
480
+ * 720p run's inputs (the quote's `kind`). SPENDS CREDITS: quote it first with
407
481
  * {@link fullQualityEstimate}. Answers 202 `{ jobId }`, or 200
408
- * `{ jobId, existing: true }` when this draft's Full Quality is already
409
- * running or done (one per draft; a failed one may be asked again). Follow
482
+ * `{ jobId, existing: true }` when this run's Full Quality is already
483
+ * running or done (one per run; a failed one may be asked again). Follow
410
484
  * the job with `client.jobs.get(jobId)`. No `Idempotency-Key` is taken: the
411
485
  * server keys the job by the draft. The new job keeps the draft's origin.
412
486
  * Refusals: {@link CastSwapFullQualityRefusalCode}.
@@ -414,4 +488,4 @@ declare class CastSwapResource {
414
488
  fullQuality(jobId: string, params?: CastSwapFullQualityParams): Promise<CastSwapFullQualityResult>;
415
489
  }
416
490
 
417
- export { type CastSwapEstimate, type CastSwapFaceMasking, type CastSwapFaceMaskingZone, type CastSwapFullQualityEstimate, type CastSwapFullQualityParams, type CastSwapFullQualityRefusalCode, type CastSwapFullQualityResult, type CastSwapLocationRole, type CastSwapParams, type CastSwapPersonRole, type CastSwapPetRole, type CastSwapProductRole, type CastSwapReference, CastSwapResource, type CastSwapRole, type CastSwapRolePreviewSettings, type CastSwapRunOptions, type CastSwapTraitSource };
491
+ export { type CastSwapEngine, type CastSwapEstimate, type CastSwapFaceMasking, type CastSwapFaceMaskingZone, type CastSwapFullQualityEstimate, type CastSwapFullQualityKind, type CastSwapFullQualityParams, type CastSwapFullQualityRefusalCode, type CastSwapFullQualityResult, type CastSwapKlingLength, type CastSwapLocationRole, type CastSwapParams, type CastSwapPersonRole, type CastSwapPetRole, type CastSwapProductRole, type CastSwapReference, CastSwapResource, type CastSwapRole, type CastSwapRolePreviewSettings, type CastSwapRunOptions, type CastSwapTraitSource };
@@ -1,4 +1,4 @@
1
1
  import '../chunk-KARJ7P7Y.js';
2
- export { CastSwapResource } from '../chunk-RQH6IKDC.js';
2
+ export { CastSwapResource } from '../chunk-HKDIIFG2.js';
3
3
  //# sourceMappingURL=cast-swap.js.map
4
4
  //# sourceMappingURL=cast-swap.js.map