@nodaro/sdk 2.54.0 → 2.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-P6AM42UB.cjs → chunk-2KX5ZE6M.cjs} +2 -2
- package/dist/chunk-2KX5ZE6M.cjs.map +1 -0
- package/dist/{chunk-JOVJAKBT.cjs → chunk-2LOTDOUV.cjs} +6 -6
- package/dist/chunk-2LOTDOUV.cjs.map +1 -0
- package/dist/{chunk-AN36M6HO.js → chunk-37LL6BPM.js} +5 -5
- package/dist/chunk-37LL6BPM.js.map +1 -0
- package/dist/{chunk-22P4X3N5.cjs → chunk-3CVWTUK5.cjs} +26 -8
- package/dist/chunk-3CVWTUK5.cjs.map +1 -0
- package/dist/{chunk-7CUWAVWB.js → chunk-4FSWJTRS.js} +3 -3
- package/dist/{chunk-7CUWAVWB.js.map → chunk-4FSWJTRS.js.map} +1 -1
- package/dist/{chunk-DV6GTEX5.js → chunk-4SZUSZXK.js} +2 -2
- package/dist/{chunk-DV6GTEX5.js.map → chunk-4SZUSZXK.js.map} +1 -1
- package/dist/{chunk-L6T44A3G.js → chunk-4VP2GFIZ.js} +20 -5
- package/dist/chunk-4VP2GFIZ.js.map +1 -0
- package/dist/{chunk-NKH2UFSD.cjs → chunk-4WOT5OAY.cjs} +5 -5
- package/dist/{chunk-NKH2UFSD.cjs.map → chunk-4WOT5OAY.cjs.map} +1 -1
- package/dist/{chunk-W5RMFTPA.cjs → chunk-57GANTLV.cjs} +2 -2
- package/dist/chunk-57GANTLV.cjs.map +1 -0
- package/dist/{chunk-HK5FSTKG.cjs → chunk-A3XA6UNM.cjs} +2 -2
- package/dist/chunk-A3XA6UNM.cjs.map +1 -0
- package/dist/{chunk-AUKHMT53.js → chunk-BGOZRZHY.js} +3 -3
- package/dist/{chunk-AUKHMT53.js.map → chunk-BGOZRZHY.js.map} +1 -1
- package/dist/{chunk-PBFODIFT.js → chunk-CBDUHYTR.js} +2 -2
- package/dist/chunk-CBDUHYTR.js.map +1 -0
- package/dist/{chunk-OSMKIRKI.cjs → chunk-DFT4LD2H.cjs} +4 -4
- package/dist/{chunk-OSMKIRKI.cjs.map → chunk-DFT4LD2H.cjs.map} +1 -1
- package/dist/{chunk-RBX3QTKB.js → chunk-E6X6BGRO.js} +3 -3
- package/dist/{chunk-RBX3QTKB.js.map → chunk-E6X6BGRO.js.map} +1 -1
- package/dist/{chunk-47ULSVO2.js → chunk-FTCAT2LK.js} +3 -3
- package/dist/chunk-FTCAT2LK.js.map +1 -0
- package/dist/{chunk-QGVOAPUI.js → chunk-GIQDM2MH.js} +2 -2
- package/dist/chunk-GIQDM2MH.js.map +1 -0
- package/dist/{chunk-65VIIZEF.cjs → chunk-GJH73EGF.cjs} +2 -2
- package/dist/{chunk-65VIIZEF.cjs.map → chunk-GJH73EGF.cjs.map} +1 -1
- package/dist/{chunk-HAVIVOLO.js → chunk-HFYNZ4SO.js} +2 -2
- package/dist/chunk-HFYNZ4SO.js.map +1 -0
- package/dist/{chunk-THLTFB6I.js → chunk-HJLSOT5C.js} +2 -2
- package/dist/chunk-HJLSOT5C.js.map +1 -0
- package/dist/{chunk-D2ILCSOQ.js → chunk-HK6XP5EN.js} +3 -3
- package/dist/{chunk-D2ILCSOQ.js.map → chunk-HK6XP5EN.js.map} +1 -1
- package/dist/{chunk-HWSYNUSC.js → chunk-HUYI5G3D.js} +2 -2
- package/dist/chunk-HUYI5G3D.js.map +1 -0
- package/dist/{chunk-JVDUGVLX.cjs → chunk-MIXRL6I2.cjs} +2 -2
- package/dist/chunk-MIXRL6I2.cjs.map +1 -0
- package/dist/{chunk-SF2CMKWA.cjs → chunk-OMJ45CW4.cjs} +9 -9
- package/dist/{chunk-SF2CMKWA.cjs.map → chunk-OMJ45CW4.cjs.map} +1 -1
- package/dist/{chunk-DAONQZPI.cjs → chunk-PDX742CC.cjs} +2 -2
- package/dist/chunk-PDX742CC.cjs.map +1 -0
- package/dist/{chunk-EZXFDCII.js → chunk-PQ6G5EM7.js} +15 -15
- package/dist/{chunk-EZXFDCII.js.map → chunk-PQ6G5EM7.js.map} +1 -1
- package/dist/{chunk-FRQJNGJS.cjs → chunk-Q4MFQC2J.cjs} +5 -5
- package/dist/{chunk-FRQJNGJS.cjs.map → chunk-Q4MFQC2J.cjs.map} +1 -1
- package/dist/{chunk-VHTDOACT.cjs → chunk-Q7W4QNE5.cjs} +22 -22
- package/dist/chunk-Q7W4QNE5.cjs.map +1 -0
- package/dist/{chunk-XZRBRXGJ.cjs → chunk-RIMDKJSQ.cjs} +28 -28
- package/dist/{chunk-XZRBRXGJ.cjs.map → chunk-RIMDKJSQ.cjs.map} +1 -1
- package/dist/{chunk-BQAW4RX2.js → chunk-VEQLP5TA.js} +25 -7
- package/dist/chunk-VEQLP5TA.js.map +1 -0
- package/dist/{chunk-I3MEBVLP.js → chunk-XZPSJG2X.js} +2 -2
- package/dist/chunk-XZPSJG2X.js.map +1 -0
- package/dist/{chunk-O74MSMFH.cjs → chunk-XZQ6Z4T6.cjs} +2 -2
- package/dist/chunk-XZQ6Z4T6.cjs.map +1 -0
- package/dist/{chunk-FM2KM5TY.cjs → chunk-Z4B4SZ33.cjs} +21 -4
- package/dist/chunk-Z4B4SZ33.cjs.map +1 -0
- package/dist/{developer-apps-zSQXWmEG.d.ts → developer-apps-CMUzKpE9.d.cts} +2 -0
- package/dist/{developer-apps-zSQXWmEG.d.cts → developer-apps-CMUzKpE9.d.ts} +2 -0
- package/dist/entries/apps.d.cts +1 -1
- package/dist/entries/apps.d.ts +1 -1
- package/dist/entries/audio.d.cts +1 -1
- package/dist/entries/audio.d.ts +1 -1
- package/dist/entries/billing.d.cts +1 -1
- package/dist/entries/billing.d.ts +1 -1
- package/dist/entries/cast-swap.cjs +2 -2
- package/dist/entries/cast-swap.d.cts +13 -1
- package/dist/entries/cast-swap.d.ts +13 -1
- package/dist/entries/cast-swap.js +1 -1
- package/dist/entries/catalogs.d.cts +1 -1
- package/dist/entries/catalogs.d.ts +1 -1
- package/dist/entries/characters.cjs +10 -10
- package/dist/entries/characters.d.cts +11 -3
- package/dist/entries/characters.d.ts +11 -3
- package/dist/entries/characters.js +1 -1
- package/dist/entries/client.cjs +21 -21
- package/dist/entries/client.d.cts +5 -5
- package/dist/entries/client.d.ts +5 -5
- package/dist/entries/client.js +16 -16
- package/dist/entries/collections.d.cts +1 -1
- package/dist/entries/collections.d.ts +1 -1
- package/dist/entries/community.d.cts +1 -1
- package/dist/entries/community.d.ts +1 -1
- package/dist/entries/competitors.d.cts +1 -1
- package/dist/entries/competitors.d.ts +1 -1
- package/dist/entries/copilot.cjs +4 -4
- package/dist/entries/copilot.d.cts +1 -1
- package/dist/entries/copilot.d.ts +1 -1
- package/dist/entries/copilot.js +3 -3
- package/dist/entries/core.cjs +6 -6
- package/dist/entries/core.d.cts +1 -1
- package/dist/entries/core.d.ts +1 -1
- package/dist/entries/core.js +2 -2
- package/dist/entries/creatures.cjs +6 -6
- package/dist/entries/creatures.d.cts +11 -3
- package/dist/entries/creatures.d.ts +11 -3
- package/dist/entries/creatures.js +1 -1
- package/dist/entries/credits.d.cts +1 -1
- package/dist/entries/credits.d.ts +1 -1
- package/dist/entries/developer-apps.d.cts +1 -1
- package/dist/entries/developer-apps.d.ts +1 -1
- package/dist/entries/edit.cjs +7 -7
- package/dist/entries/edit.d.cts +1 -1
- package/dist/entries/edit.d.ts +1 -1
- package/dist/entries/edit.js +2 -2
- package/dist/entries/errors.cjs +32 -24
- package/dist/entries/errors.d.cts +28 -4
- package/dist/entries/errors.d.ts +28 -4
- package/dist/entries/errors.js +1 -1
- package/dist/entries/executions.d.cts +1 -1
- package/dist/entries/executions.d.ts +1 -1
- package/dist/entries/gallery.d.cts +1 -1
- package/dist/entries/gallery.d.ts +1 -1
- package/dist/entries/jobs.cjs +2 -2
- package/dist/entries/jobs.d.cts +7 -4
- package/dist/entries/jobs.d.ts +7 -4
- package/dist/entries/jobs.js +1 -1
- package/dist/entries/keepers.d.cts +1 -1
- package/dist/entries/keepers.d.ts +1 -1
- package/dist/entries/library.d.cts +1 -1
- package/dist/entries/library.d.ts +1 -1
- package/dist/entries/llm.d.cts +1 -1
- package/dist/entries/llm.d.ts +1 -1
- package/dist/entries/locations.cjs +5 -5
- package/dist/entries/locations.d.cts +11 -3
- package/dist/entries/locations.d.ts +11 -3
- package/dist/entries/locations.js +1 -1
- package/dist/entries/media.cjs +4 -4
- package/dist/entries/media.d.cts +34 -5
- package/dist/entries/media.d.ts +34 -5
- package/dist/entries/media.js +3 -3
- package/dist/entries/models.d.cts +1 -1
- package/dist/entries/models.d.ts +1 -1
- package/dist/entries/moodboards.d.cts +1 -1
- package/dist/entries/moodboards.d.ts +1 -1
- package/dist/entries/node-presets.d.cts +1 -1
- package/dist/entries/node-presets.d.ts +1 -1
- package/dist/entries/nodes.cjs +3 -3
- package/dist/entries/nodes.d.cts +3 -3
- package/dist/entries/nodes.d.ts +3 -3
- package/dist/entries/nodes.js +2 -2
- package/dist/entries/oauth.d.cts +1 -1
- package/dist/entries/oauth.d.ts +1 -1
- package/dist/entries/objects.cjs +6 -6
- package/dist/entries/objects.d.cts +11 -3
- package/dist/entries/objects.d.ts +11 -3
- package/dist/entries/objects.js +1 -1
- package/dist/entries/organizations.d.cts +1 -1
- package/dist/entries/organizations.d.ts +1 -1
- package/dist/entries/palettes.d.cts +1 -1
- package/dist/entries/palettes.d.ts +1 -1
- package/dist/entries/picker-catalogs.d.cts +1 -1
- package/dist/entries/picker-catalogs.d.ts +1 -1
- package/dist/entries/pipelines.d.cts +1 -1
- package/dist/entries/pipelines.d.ts +1 -1
- package/dist/entries/projects.d.cts +1 -1
- package/dist/entries/projects.d.ts +1 -1
- package/dist/entries/prompt-helper.d.cts +1 -1
- package/dist/entries/prompt-helper.d.ts +1 -1
- package/dist/entries/recast.d.cts +1 -1
- package/dist/entries/recast.d.ts +1 -1
- package/dist/entries/reduce.d.cts +1 -1
- package/dist/entries/reduce.d.ts +1 -1
- package/dist/entries/saved-posts.d.cts +1 -1
- package/dist/entries/saved-posts.d.ts +1 -1
- package/dist/entries/scene3d.d.cts +4 -4
- package/dist/entries/scene3d.d.ts +4 -4
- package/dist/entries/sessions.d.cts +1 -1
- package/dist/entries/sessions.d.ts +1 -1
- package/dist/entries/shots.d.cts +1 -1
- package/dist/entries/shots.d.ts +1 -1
- package/dist/entries/studio.cjs +5 -5
- package/dist/entries/studio.d.cts +3 -3
- package/dist/entries/studio.d.ts +3 -3
- package/dist/entries/studio.js +2 -2
- package/dist/entries/templates.d.cts +1 -1
- package/dist/entries/templates.d.ts +1 -1
- package/dist/entries/trash.d.cts +1 -1
- package/dist/entries/trash.d.ts +1 -1
- package/dist/entries/trends.cjs +2 -2
- package/dist/entries/trends.d.cts +37 -17
- package/dist/entries/trends.d.ts +37 -17
- package/dist/entries/trends.js +1 -1
- package/dist/entries/tutorials.d.cts +1 -1
- package/dist/entries/tutorials.d.ts +1 -1
- package/dist/entries/uploads.d.cts +1 -1
- package/dist/entries/uploads.d.ts +1 -1
- package/dist/entries/user-settings.d.cts +1 -1
- package/dist/entries/user-settings.d.ts +1 -1
- package/dist/entries/video-pro.d.cts +1 -1
- package/dist/entries/video-pro.d.ts +1 -1
- package/dist/entries/voices.d.cts +1 -1
- package/dist/entries/voices.d.ts +1 -1
- package/dist/entries/webhooks.d.cts +3 -3
- package/dist/entries/webhooks.d.ts +3 -3
- package/dist/entries/workflows.d.cts +1 -1
- package/dist/entries/workflows.d.ts +1 -1
- package/dist/entries/workspaces.d.cts +1 -1
- package/dist/entries/workspaces.d.ts +1 -1
- package/dist/index.cjs +90 -82
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +16 -16
- package/dist/{nodes-DuXF6XVv.d.ts → nodes-1u7MPrD5.d.ts} +11 -1
- package/dist/{nodes-bY51Z1Os.d.cts → nodes-BZavad1T.d.cts} +11 -1
- package/dist/{studio-productions-r2-VZsKj.d.cts → studio-productions-CMiS827q.d.cts} +1 -1
- package/dist/{studio-productions-DtTE8mdl.d.ts → studio-productions-DkI51Z9M.d.ts} +1 -1
- package/dist/{webhooks-BJawEIz8.d.ts → webhooks-C2DZTK4n.d.ts} +1 -1
- package/dist/{webhooks-Dn_DtNTD.d.cts → webhooks-tg3VN39V.d.cts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-22P4X3N5.cjs.map +0 -1
- package/dist/chunk-47ULSVO2.js.map +0 -1
- package/dist/chunk-AN36M6HO.js.map +0 -1
- package/dist/chunk-BQAW4RX2.js.map +0 -1
- package/dist/chunk-DAONQZPI.cjs.map +0 -1
- package/dist/chunk-FM2KM5TY.cjs.map +0 -1
- package/dist/chunk-HAVIVOLO.js.map +0 -1
- package/dist/chunk-HK5FSTKG.cjs.map +0 -1
- package/dist/chunk-HWSYNUSC.js.map +0 -1
- package/dist/chunk-I3MEBVLP.js.map +0 -1
- package/dist/chunk-JOVJAKBT.cjs.map +0 -1
- package/dist/chunk-JVDUGVLX.cjs.map +0 -1
- package/dist/chunk-L6T44A3G.js.map +0 -1
- package/dist/chunk-O74MSMFH.cjs.map +0 -1
- package/dist/chunk-P6AM42UB.cjs.map +0 -1
- package/dist/chunk-PBFODIFT.js.map +0 -1
- package/dist/chunk-QGVOAPUI.js.map +0 -1
- package/dist/chunk-THLTFB6I.js.map +0 -1
- package/dist/chunk-VHTDOACT.cjs.map +0 -1
- package/dist/chunk-W5RMFTPA.cjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resources/locations.ts"],"names":[],"mappings":";;;;;AAuZO,IAAM,oBAAN,MAAwB;AAAA,EAC7B,YAAoB,MAAA,EAA0B;AAA1B,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAA2B;AAAA,EAA3B,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpB,IAAA,CAAK,MAAA,GAA8B,EAAC,EAAmE;AACrG,IAAA,MAAM,QAA4C,EAAC;AACnD,IAAA,IAAI,MAAA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AAE,cAAA,EAAe;AAAE,KAC7B;AAGA,IAAA,OAAO,EAAE,cAAA,EAAgB,GAAA,CAAI,gBAAgB,oBAAA,EAAsB,GAAA,CAAI,wBAAwB,IAAA,EAAK;AAAA,EACtG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,UAAU,EAAA,EAA8C;AACtD,IAAA,OAAO,KAAK,MAAA,CAAO,OAAA;AAAA,MACjB,MAAA;AAAA,MACA,CAAA,cAAA,EAAiB,kBAAA,CAAmB,EAAE,CAAC,CAAA,YAAA;AAAA,KACzC;AAAA,EACF;AACF","file":"chunk-JVDUGVLX.cjs","sourcesContent":["import type { CharacterAspectRatio, SurroundDirection, LocationAssetType, LocationAttachColumn } from \"@nodaro/shared/entities\"\nexport type { LocationAssetType, LocationAttachColumn, CharacterAspectRatio, SurroundDirection } from \"@nodaro/shared/entities\"\nexport { LOCATION_ASSET_TYPES, LOCATION_ATTACH_COLUMNS, SURROUND_DIRECTIONS } from \"@nodaro/shared/entities\"\nimport type { NodaroClientCore } from \"../core.js\"\nimport type { SetKeeperCatalogInput, SetKeeperCatalogResult } from \"./keepers.js\"\nimport type { GenerationSessionParams } from \"./nodes.js\"\n\n/**\n * Re-export the shared `LocationAssetType` / `LocationAttachColumn` unions and\n * their runtime tuples so SDK consumers don't have to add `@nodaro/shared` as a\n * second dependency just to typecheck the `assetType` / `attachToColumn`\n * fields. Single source of truth lives in `@nodaro/shared/entity-prompts`.\n *\n * `CharacterAspectRatio` is re-exported alongside them — `generateMotion`'s\n * `aspectRatio` field reuses the same 4-value enum (1:1 / 3:4 / 16:9 / 9:16)\n * as characters; the route enforces this with `z.enum(CHARACTER_ASPECT_OPTIONS)`.\n */\n\n/**\n * Reference-photo kind discriminator — the mood-board roles a user can attach\n * to a location. Mirrors the `reference_photos.kind` Zod enum in\n * `backend/src/routes/locations.ts`. `other` is the free-form bucket.\n */\nexport type LocationReferencePhotoKind =\n | \"wide\"\n | \"interior\"\n | \"exterior\"\n | \"detail\"\n | \"moodBoard\"\n | \"other\"\n\nexport interface LocationReferencePhoto {\n url: string\n kind: LocationReferencePhotoKind\n}\n\n/**\n * A location record returned by Nodaro's REST API. Mirrors the camelCase\n * shape produced by `backend/src/routes/locations.ts::toCamel()`.\n *\n * Asset buckets (`timeOfDay`, `weather`, `angles`, `lighting`, `seasons`,\n * `atmosphereMotions`) are independent JSONB arrays keyed by a human-readable\n * variant name (e.g. `\"dawn\"`, `\"clear\"`, `\"wide\"`). Each entry's `url` points\n * at an R2-hosted asset.\n *\n * Identity-foundation fields:\n * - `referencePhotos` — caller-supplied mood-board refs (cap 20).\n * - `canonicalDescription` — ~80–120-word LLM-authored visual caption,\n * populated by `approveMainImage()` / `recaption()`. The wire still sends\n * `\"\"` on caption sub-failure (the breaking wire change is deferred to a\n * major bump), but `get()` normalizes `\"\"` → `null` so consumers see the\n * same `string | null` semantics as characters.\n * - `styleLock` — whether asset gens should anchor to the canonical style\n * captured at approval time. Defaults to `true` on new rows.\n */\nexport interface Location {\n id: string\n userId: string\n nodeId: string\n projectId: string | null\n name: string\n description: string | null\n category: string | null\n style: string | null\n sourceImageUrl: string | null\n /** MODEL_CATALOG image-model id the main image was generated with (or `null`).\n * Set on create + editable via the update route. */\n imageProvider: string | null\n timeOfDay: Array<{ name: string; url: string }>\n weather: Array<{ name: string; url: string }>\n angles: Array<{ name: string; url: string }>\n lighting: Array<{ name: string; url: string }>\n seasons: Array<{ name: string; url: string }>\n atmosphereMotions: Array<{ name: string; url: string }>\n /** Named Location Boards — dense reference sheets, one per variant/mood\n * (the `generate-image/location-board` factory preset rendered from the\n * location's images). A first-class bucket: community publish snapshots it\n * and clone hands the consumer their own copy to extend. Defaults to `[]`.\n * `type` marks an image-collage `\"identity\"` sheet vs a plain `\"looks\"`\n * board; `sourceImages` are the R2 URLs it was collaged from. Both optional\n * + backward-compatible (legacy boards have neither). */\n boards?: Array<{ name: string; url: string; type?: \"looks\" | \"identity\"; sourceImages?: string[] }> | null\n referencePhotos: LocationReferencePhoto[]\n /** `null` when no caption is set (or the LLM caption sub-failed) — the wire\n * sends `\"\"`, normalized to `null` in `get()` to match character semantics. */\n canonicalDescription: string | null\n styleLock: boolean\n /** The user's chosen DEFAULT asset take per variant (Studio version history).\n * OPAQUE map: key `\"<bucket>:<variant>\"` (e.g. `\"timeOfDay:dawn\"`) → the chosen\n * asset URL (one already present in that bucket). Stored verbatim — keys are\n * NOT normalized; soft-capped server-side at 200 keys / 2048-char values\n * (overflow dropped silently). Defaults to `{}`. */\n selectedAssetByVariant?: Record<string, string> | null\n deletedAt: string | null\n createdAt: string\n updatedAt: string\n}\n\n/**\n * GET /v1/locations/:id appends a `pendingJobs` bucket the studio uses to\n * rehydrate spinners after a reload. Optional on the SDK surface — it doesn't\n * appear on `list()` rows.\n */\nexport interface LocationDetail extends Location {\n pendingJobs?: Array<{\n jobId: string\n assetType: string\n name: string\n status: string\n }>\n /**\n * Completed candidate main images for this location whose URL differs from\n * the current `sourceImageUrl`, newest first (max 5). Surfaced so a\n * \"pick from N\" UI can offer alternatives the user can promote via\n * `approveMainImage(id, jobId)`; until they pick, the current main image is\n * left untouched. Mirrors `CharacterDetail.previousCandidates`. Optional -\n * absent on `list()` rows, present (possibly empty) on `get()`.\n */\n previousCandidates?: Array<{\n jobId: string\n url: string\n createdAt: string\n }>\n}\n\n/**\n * Body for `client.locations.create()`. Mirrors the INSERT branch of\n * `upsertLocationBody` in `backend/src/routes/locations.ts`. `name` + `nodeId`\n * are required on create.\n */\nexport interface CreateLocationInput {\n nodeId: string\n name: string\n description?: string\n category?: string\n style?: string\n workflowId?: string\n projectId?: string\n sourceImageUrl?: string\n /** Persistent image-model id (a MODEL_CATALOG image model). Validated\n * server-side — unknown / non-image / \"\" is stored as `null`. */\n imageProvider?: string | null\n referencePhotos?: LocationReferencePhoto[]\n canonicalDescription?: string\n styleLock?: boolean\n /** The user's chosen DEFAULT asset take per variant. OPAQUE\n * `\"<bucket>:<variant>\"` → chosen-URL map; a write REPLACES the whole map.\n * Keys stored verbatim; soft-capped server-side at 200 keys / 2048-char values. */\n selectedAssetByVariant?: Record<string, string>\n}\n\n/**\n * Body for `client.locations.update()`. Mirrors the UPDATE branch of\n * `upsertLocationBody` in `backend/src/routes/locations.ts`.\n *\n * Worker-owned asset buckets (`timeOfDay`/`weather`/`angles`/`lighting`/\n * `seasons`/`atmosphereMotions`) are deliberately omitted — the route drops\n * them on UPDATE so a Studio auto-save with a stale snapshot cannot clobber\n * the worker's atomic `append_location_asset()` writes.\n *\n * `expectedUpdatedAt` is the optimistic-concurrency token: when present, the\n * UPDATE only succeeds if the row's `updated_at` still matches; on mismatch\n * the route returns 409 so the studio can re-fetch + merge.\n */\nexport interface UpdateLocationInput {\n name?: string\n description?: string\n category?: string\n style?: string\n sourceImageUrl?: string\n /** Persistent image-model id (a MODEL_CATALOG image model). Validated\n * server-side — unknown / non-image / \"\" is stored as `null`. */\n imageProvider?: string | null\n referencePhotos?: LocationReferencePhoto[]\n canonicalDescription?: string\n styleLock?: boolean\n /** The user's chosen DEFAULT asset take per variant. OPAQUE\n * `\"<bucket>:<variant>\"` → chosen-URL map; a write REPLACES the whole map\n * (omit to leave untouched). Keys stored verbatim; soft-capped server-side\n * at 200 keys / 2048-char values. */\n selectedAssetByVariant?: Record<string, string>\n /** Named Location Boards (see `Location.boards`) — whole-array replace,\n * USER-owned (unlike the worker-owned buckets it flows through UPDATE).\n * Server caps: 24 boards, 200-char names, 30 sourceImages per board. */\n boards?: Array<{ name: string; url: string; type?: \"looks\" | \"identity\"; sourceImages?: string[] }>\n /** ISO-8601 timestamp recording when PII consent was captured for this location. */\n piiConsentAt?: string\n expectedUpdatedAt?: string\n}\n\nexport interface UpdateLocationResult {\n id: string\n updatedAt: string\n}\n\nexport interface ListLocationsParams {\n /** When true, return archived locations instead of active ones. */\n archived?: boolean\n /**\n * Search words: only the locations whose name or description contains\n * every word (split on spaces, the first 5), in any order, ignoring case.\n * Each word is matched as written (`%`, `_` and `*` are not wildcards;\n * punctuation is kept); blank means no search; up to 200 characters.\n * Combines with the other filters and with `cursor` paging.\n */\n q?: string\n /**\n * Max rows to return (cap 500). OPT-IN: omitted, the server returns the\n * full legacy listing with no `nextCursor`; supplied, the response is one\n * page plus `nextCursor` — keep passing it back until it is `null`.\n */\n limit?: number\n /** Opaque cursor from a prior page's `nextCursor` (fetches the next page). */\n cursor?: string\n}\n\n/**\n * Input for `client.locations.generate()` — fires the\n * `POST /v1/generate-location` route. Produces 1–10 candidate\n * establishing shots; each lands as one `jobs` row in `pending` state and\n * is then enqueued for the worker.\n *\n * When `attachToLocationId` is set AND `count === 1`, the worker writes the\n * resulting URL directly to `locations.source_image_url` on completion —\n * caller doesn't need a separate `approveMainImage` call. Multi-candidate\n * batches MUST go through explicit approval so the user picks the winner.\n */\nexport interface GenerateLocationInput extends GenerationSessionParams {\n name: string\n description?: string\n userPrompt?: string\n category?: \"indoor\" | \"outdoor\" | \"urban\" | \"nature\" | \"fantasy\" | \"sci-fi\" | \"historical\" | \"futuristic\" | \"other\"\n style?: \"realistic\" | \"anime\" | \"3d-pixar\" | \"illustration\"\n sourceImageUrl?: string\n provider?: string\n /** Number of candidate images to generate (1–10; server-validated). */\n count?: number\n /** Auto-attach the result to this location row (single-candidate only). */\n attachToLocationId?: string\n /**\n * Credit-affecting quality tier (e.g. `\"high\"` for gpt-image). Priced like\n * generate-image (composite ids such as `gpt-image:high`); values the chosen\n * model doesn't support are ignored server-side, never rejected.\n */\n quality?: string\n /**\n * Credit-affecting output resolution (e.g. `\"2K\"` / `\"4K\"` / `\"2 MP\"`).\n * Priced like generate-image (composite ids such as `nano-banana-pro:4K`);\n * values the chosen model doesn't support are ignored server-side, never\n * rejected.\n */\n resolution?: string\n}\n\n/**\n * `generate()` response — `jobIds` is ALWAYS present (the harmonized contract,\n * matching characters). `jobId` is a deprecated back-compat alias populated only\n * on `count === 1`; prefer `jobIds`. (Will be removed on the next major.)\n */\nexport interface GenerateLocationResult {\n jobIds: string[]\n /** @deprecated count===1 back-compat alias — use `jobIds`. */\n jobId?: string\n}\n\n/**\n * Input for `client.locations.generateAsset()` — fires the\n * `POST /v1/generate-location-asset` route. Produces a single\n * timeOfDay / weather / seasons / angles / lighting / custom variant.\n *\n * When all three studio-path fields are set (`attachToLocationId` +\n * `attachToColumn` + `attachName`), the worker appends\n * `{ name: attachName, url: <result> }` to the named JSONB array column on\n * the user's location row on completion. `attachToColumn` is REQUIRED for\n * `assetType === \"custom\"` — the worker can't infer the bucket from the\n * asset type.\n */\nexport interface GenerateLocationAssetInput extends GenerationSessionParams {\n assetType: LocationAssetType\n variant: string\n name: string\n description?: string\n userPrompt?: string\n category?: string\n style?: \"realistic\" | \"anime\" | \"3d-pixar\" | \"illustration\"\n sourceImageUrl?: string\n provider?: string\n /** Optional framing override (the same 4-value enum as `generateMotion`).\n * Absent = the image model's default. The studio's 360° surround path pins\n * `\"16:9\"` so every ring view matches the establishing shot's frame. */\n aspectRatio?: CharacterAspectRatio\n attachToLocationId?: string\n attachToColumn?: LocationAttachColumn\n attachName?: string\n /**\n * Credit-affecting quality tier (e.g. `\"high\"` for gpt-image). Values the\n * chosen model doesn't support are ignored server-side, never rejected.\n */\n quality?: string\n /**\n * Credit-affecting output resolution (e.g. `\"2K\"` / `\"4K\"` / `\"2 MP\"`).\n * Values the chosen model doesn't support are ignored server-side, never\n * rejected.\n */\n resolution?: string\n}\n\n/**\n * Input for `client.locations.generateSurroundContinuation()` — fires the\n * `POST /v1/generate-surround-continuation` route. Generates one seamless 360°\n * ring view as an image-to-image continuation of `referenceImageUrl` (the\n * previous ring view, or the establishing shot for the first ring).\n *\n * The platform owns the whole pipeline: it builds the half-carry composite\n * server-side (carry the reference's trailing half into the new frame's leading\n * half per `direction`, gray the rest), paints the gray region, then\n * color-harmonizes the painted half to the carried half so there is no tonal\n * seam down the frame's center. The carried half stays pixel-exact, so a\n * panorama viewer stitching adjacent ring views stays geometrically seamless.\n *\n * When the studio path is set (`attachToLocationId` + `attachToColumn` +\n * `attachName`), the worker appends `{ name: attachName, url: <result> }` to the\n * location's bucket (studio uses `attachToColumn: \"angles\"`,\n * `attachName: \"Surround 45°\"`).\n */\nexport interface GenerateSurroundContinuationInput extends GenerationSessionParams {\n /** The previous ring view to continue from (i2i anchor). */\n referenceImageUrl: string\n /** Carry/paint axis: turn right, turn left, tilt up, or tilt down. Tilts\n * render the sky/ground (a thin horizon strip), not a horizontal continuation. */\n direction: SurroundDirection\n /** Ring angle (45, 90, …) — stored on the result as metadata. */\n degrees?: number\n /** Fraction of the frame carried from the reference. Omitted ⇒ per-direction\n * default (0.5 for a pan, 0.12 thin strip for a tilt). */\n carriedFraction?: number\n /** Upscale/denoise the result before it's chained as the next reference, to\n * slow cumulative softening down a long ring chain. Default false. */\n refine?: boolean\n /** Refine model when `refine` is set. `recraft-upscale` (1 cr, default) or\n * `topaz-image-upscale` (3 cr). */\n refineProvider?: \"recraft-upscale\" | \"topaz-image-upscale\"\n /** Optional free-form scene hint woven into the fill prompt. */\n userPrompt?: string\n /** Image model. Defaults to the platform's general image model (`gpt-image-2`). */\n provider?: string\n /** Studio pins `\"16:9\"` so every ring view matches the establishing frame. */\n aspectRatio?: CharacterAspectRatio\n attachToLocationId?: string\n attachToColumn?: LocationAttachColumn\n attachName?: string\n}\n\n/**\n * Input for `client.locations.generateMotion()` — fires the\n * `POST /v1/generate-location-motion` route. Produces a single atmospheric\n * motion clip (drifting fog, snowfall, rolling waves, etc.) animated FROM a\n * static establishing-shot image.\n *\n * Mirrors `client.characters.generateMotion()` minus the character-specific\n * fields (gender / baseOutfit / realLifeRefs). The route hardcodes the attach\n * column to `atmosphere_motions` — callers supply `attachToLocationId` +\n * `attachName` only.\n *\n * `sourceImageUrl` is REQUIRED — image-to-video needs a source frame and the\n * route has no fallback (no `source_image_url` column to pull from on the\n * locations row; the studio path supplies the canonical establishing-shot URL\n * explicitly).\n *\n * When the studio path is set (`attachToLocationId` + `attachName`), the\n * worker appends `{ name: attachName, url: <result> }` to the location row's\n * `atmosphere_motions` JSONB column on completion.\n */\nexport interface GenerateLocationMotionInput extends GenerationSessionParams {\n motionPrompt: string\n sourceImageUrl: string\n provider?: string\n name: string\n category?: string\n style?: \"realistic\" | \"anime\" | \"3d-pixar\" | \"illustration\"\n canonicalDescription?: string\n attachToLocationId?: string\n attachName?: string\n /**\n * Optional aspect ratio override. Defaults to 16:9 server-side via\n * `resolveLocationAspectRatio` (locations are cinematic establishing shots).\n * One of the 4-value `CharacterAspectRatio` union — locations reuse the\n * character aspect enum since the supported ratios are identical.\n */\n aspectRatio?: CharacterAspectRatio\n}\n\nexport interface ApproveMainImageResult {\n sourceImageUrl: string\n /**\n * LLM-authored caption. `null` when the LLM caption sub-failed — the wire\n * sends `\"\"`, normalized to `null` here so consumers see the same\n * `string | null` semantics as characters. The main image is still set; call\n * `recaption()` to retry.\n */\n canonicalDescription: string | null\n}\n\nexport interface RecaptionLocationResult {\n canonicalDescription: string\n}\n\nexport class LocationsResource {\n constructor(private client: NodaroClientCore) {}\n\n /**\n * List the caller's locations. By default returns active locations only;\n * pass `archived: true` to fetch soft-deleted rows for an \"archive\" view,\n * and `q` to keep the ones whose name or description contains it.\n */\n list(params: ListLocationsParams = {}): Promise<{ locations: Location[]; nextCursor?: string | null }> {\n const query: Record<string, string | undefined> = {}\n if (params.archived) query.archived = \"true\"\n if (params.q) query.q = params.q\n if (params.limit !== undefined) query.limit = String(params.limit)\n if (params.cursor) query.cursor = params.cursor\n return this.client.request(\"GET\", \"/v1/locations\", { query })\n }\n\n /**\n * Convenience wrapper for `list({ archived: true })`. Returns soft-deleted\n * rows so callers can drive a UI \"Archived\" tab without re-encoding the\n * query param. Mirrors `ObjectsResource.listArchived`.\n *\n * `archived` is omitted from the param type — it's always set to `true` here.\n */\n listArchived(params: Omit<ListLocationsParams, \"archived\"> = {}): Promise<{ locations: Location[]; nextCursor?: string | null }> {\n return this.list({ ...params, archived: true })\n }\n\n /**\n * Fetch a single location including in-flight asset job state. Soft-deleted\n * (archived) rows are returned by id intentionally so canvas nodes that\n * hold a stale `locationDbId` keep loading.\n */\n async get(id: string): Promise<LocationDetail> {\n const res = await this.client.request<LocationDetail>(\n \"GET\",\n `/v1/locations/${encodeURIComponent(id)}`,\n )\n // Normalize the wire `\"\"` caption (DB null / LLM sub-failure) → null so\n // consumers see the same `string | null` semantics as characters. New\n // object — never mutate the response.\n return { ...res, canonicalDescription: res.canonicalDescription || null }\n }\n\n /**\n * Create a new location. `name` + `nodeId` are required — the route 400s\n * otherwise. Returns the new row's id.\n *\n * Note: the underlying route is the same `POST /v1/locations` upsert that\n * powers `update()`. This convenience wrapper enforces the INSERT-required\n * fields at the type level and never sends an `id`.\n */\n create(data: CreateLocationInput): Promise<{ id: string }> {\n return this.client.request(\"POST\", \"/v1/locations\", { body: data })\n }\n\n /**\n * Update a location. Only the fields you pass are written — undefined keys\n * are NOT touched on the row. Worker-owned asset buckets are intentionally\n * not exposed on this surface (see `UpdateLocationInput` for the rationale).\n *\n * Optimistic-concurrency: pass `expectedUpdatedAt` to require the row's\n * `updated_at` still matches; on mismatch the route returns 409\n * `concurrent_modification`. The SDK surfaces that as a generic\n * `NodaroError` with the same code.\n */\n update(id: string, data: UpdateLocationInput): Promise<UpdateLocationResult> {\n return this.client.request(\"POST\", \"/v1/locations\", {\n body: { id, ...data },\n })\n }\n\n /**\n * Soft-delete (archive) a location. The row is hidden from `list()` by\n * default but still loadable via `get(id)` so canvas nodes pointing at it\n * keep working. Restore with `restore(id)`.\n */\n delete(id: string): Promise<{ success: true; archived: true }> {\n return this.client.request(\"DELETE\", `/v1/locations/${encodeURIComponent(id)}`)\n }\n\n /**\n * Un-archive a location. If the original name now collides (case-\n * insensitive) with an active row, the server auto-suffixes \"(restored)\"\n * and returns the effective name.\n */\n restore(id: string): Promise<{ id: string; name: string }> {\n return this.client.request(\"POST\", `/v1/locations/${encodeURIComponent(id)}/restore`)\n }\n\n /**\n * Admin only: put one of your own locations on the shared Nodaro Keepers\n * shelf (`client.keepers.catalog()`), or take it off. A first-party session\n * or your personal token; `forbidden` for anyone who is not a platform\n * admin, `not_found` for a row that is not yours.\n */\n setCatalog(id: string, input: SetKeeperCatalogInput): Promise<SetKeeperCatalogResult> {\n return this.client.request(\"PUT\", `/v1/locations/${encodeURIComponent(id)}/catalog`, { body: input })\n }\n\n /**\n * Fire `POST /v1/generate-location` to produce one or more candidate main\n * images. With `count > 1`, all jobs are reserved up-front before any\n * is enqueued — mid-batch failures roll back atomically.\n *\n * When `attachToLocationId` is set AND `count === 1`, the worker writes\n * the result directly to the row's `source_image_url`; otherwise you must\n * call `approveMainImage()` after picking a candidate.\n */\n async generate(data: GenerateLocationInput): Promise<GenerateLocationResult> {\n const res = await this.client.request<{ jobId?: string; jobIds?: string[] }>(\n \"POST\", \"/v1/generate-location\", { body: data },\n )\n // Tolerate the legacy `{ jobId }`-only shape (older server): synthesize jobIds.\n const jobIds = res.jobIds ?? (res.jobId ? [res.jobId] : [])\n return res.jobId ? { jobIds, jobId: res.jobId } : { jobIds }\n }\n\n /**\n * Fire `POST /v1/generate-location-asset` to produce a single variant.\n * When the studio path is set (`attachToLocationId` + `attachToColumn` +\n * `attachName`), the worker appends `{ name: attachName, url: <result> }`\n * to the named JSONB array column on completion.\n */\n generateAsset(data: GenerateLocationAssetInput): Promise<{ jobId: string }> {\n return this.client.request(\"POST\", \"/v1/generate-location-asset\", { body: data })\n }\n\n /**\n * Fire `POST /v1/generate-surround-continuation` to produce one seamless 360°\n * ring view as an i2i continuation of `referenceImageUrl`. The platform builds\n * the half-carry composite, paints the missing half, and color-harmonizes it\n * to the carried half (no tonal seam; carried half stays pixel-exact). When the\n * studio path is set, the worker appends the result to the location's bucket.\n */\n generateSurroundContinuation(data: GenerateSurroundContinuationInput): Promise<{ jobId: string }> {\n return this.client.request(\"POST\", \"/v1/generate-surround-continuation\", { body: data })\n }\n\n /**\n * Fire `POST /v1/generate-location-motion` to animate the location's\n * establishing shot into an atmospheric motion clip. Image-to-video, single\n * clip per call; the attach column is hardcoded to `atmosphere_motions`\n * server-side (locations have a single motion bucket so the caller doesn't\n * supply `attachToColumn`). When the studio path is set\n * (`attachToLocationId` + `attachName`), the worker appends\n * `{ name: attachName, url: <result> }` to the row's `atmosphere_motions`\n * column on completion.\n */\n generateMotion(data: GenerateLocationMotionInput): Promise<{ jobId: string }> {\n return this.client.request(\"POST\", \"/v1/generate-location-motion\", { body: data })\n }\n\n /**\n * Atomically remove ONE asset take (every entry matching `url`) from a\n * worker-owned bucket column — `POST /v1/locations/:id/remove-asset`. The\n * worker-owned buckets are deliberately not writable through `update()`\n * (a stale snapshot would race concurrent worker appends), so deleting a\n * take — e.g. a 360° surround view being regenerated — goes through this\n * single-statement server-side filter instead. 404s (`NotFoundError`) when\n * the url isn't in that bucket or the location isn't yours.\n */\n removeAsset(\n id: string,\n data: { column: LocationAttachColumn; url: string },\n ): Promise<{ removed: true }> {\n return this.client.request(\n \"POST\",\n `/v1/locations/${encodeURIComponent(id)}/remove-asset`,\n { body: data },\n )\n }\n\n /**\n * Approve a completed `generate-location` job as the location's main image.\n * Sets `source_image_url` and fires the LLM caption (Claude Sonnet vision)\n * inline. Returns the new main-image URL plus the caption.\n *\n * Caption-failure semantics: the route still sends `\"\"` on LLM sub-failure,\n * but the SDK normalizes `\"\"` → `null` here so `canonicalDescription` carries\n * the same `string | null` semantics as characters. The main image is still\n * set; call `recaption()` to retry.\n */\n async approveMainImage(id: string, candidateJobId: string): Promise<ApproveMainImageResult> {\n const res = await this.client.request<{ sourceImageUrl: string; canonicalDescription: string | null }>(\n \"POST\",\n `/v1/locations/${encodeURIComponent(id)}/approve-main-image`,\n { body: { candidateJobId } },\n )\n // Normalize the wire `\"\"` (LLM sub-failure) → null; build a new object\n // rather than mutating the response.\n return { sourceImageUrl: res.sourceImageUrl, canonicalDescription: res.canonicalDescription || null }\n }\n\n /**\n * Re-fire the LLM caption against the location's current main image. 502s\n * on LLM failure (unlike `approveMainImage` which preserves the side-effect\n * and returns \"\"); returns 400 `no_source_image` if no main image is set\n * yet.\n */\n recaption(id: string): Promise<RecaptionLocationResult> {\n return this.client.request(\n \"POST\",\n `/v1/locations/${encodeURIComponent(id)}/llm-caption`,\n )\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";AAEO,IAAM,WAAA,GAAN,cAA0B,KAAA,CAAM;AAAA,EAUrC,WAAA,CACE,OAAA,EACgB,IAAA,EACA,MAAA,EAChB,OAAA,EACA;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAJG,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AACA,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAIhB,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AACZ,IAAA,IAAI,OAAA,EAAS,IAAA,CAAK,OAAA,GAAU,EAAE,GAAG,OAAA,EAAQ;AAAA,EAC3C;AAAA,EAPkB,IAAA;AAAA,EACA,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EALF,UAA6C,EAAC;AAYhE;AAEO,IAAM,iBAAA,GAAN,cAAgC,WAAA,CAAY;AAAA,EACjD,WAAA,CAAY,UAAU,yBAAA,EAA2B;AAC/C,IAAA,KAAA,CAAM,OAAA,EAAS,gBAAgB,GAAG,CAAA;AAClC,IAAA,IAAA,CAAK,IAAA,GAAO,mBAAA;AAAA,EACd;AACF;AAEO,IAAM,cAAA,GAAN,cAA6B,WAAA,CAAY;AAAA,EAC9C,WAAA,CAAY,OAAA,GAAU,WAAA,EAA6B,YAAA,EAAuB;AACxE,IAAA,KAAA,CAAM,OAAA,EAAS,aAAa,GAAG,CAAA;AADkB,IAAA,IAAA,CAAA,YAAA,GAAA,YAAA;AAEjD,IAAA,IAAA,CAAK,IAAA,GAAO,gBAAA;AAAA,EACd;AAAA,EAHmD,YAAA;AAIrD;AAEO,IAAM,aAAA,GAAN,cAA4B,WAAA,CAAY;AAAA,EAC7C,WAAA,CA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AAiB,GAAA,CAAI,OAAO,CAAA,EAAG;AAC1D,MAAA,MAAM,IAAI,sBAAA,CAAuB,OAAA,EAAS,IAAA,CAAK,OAAA,EAAS,UAAU,SAAS,CAAA;AAAA,IAC7E;AACA,IAAA,MAAM,IAAI,yBAAyB,IAAA,CAAK,OAAA,EAAS,UAAU,SAAA,EAAW,IAAA,CAAK,QAAQ,sBAAsB,CAAA;AAAA,EAC3G;AACA,EAAA,IAAI,MAAA,KAAW,KAAK,MAAM,IAAI,qBAAqB,IAAA,CAAK,OAAA,EAAS,SAAS,UAAU,CAAA;AACpF,EAAA,MAAM,IAAI,WAAA,CAAY,OAAA,EAAS,IAAA,EAAM,MAAM,CAAA;AAC7C","file":"chunk-L6T44A3G.js","sourcesContent":["import type { StudioOpsResponse } from \"./resources/studio-productions.js\"\n\nexport class NodaroError extends Error {\n /**\n * Every other field of the server's error envelope (`{ error: { code,\n * message, … } }`), as it was sent: for example a trend refusal's `slot`, a\n * publish refusal's `reasons`, a validation error's `issues`. Empty when the\n * envelope had nothing else, or for an error the SDK made itself. A copy —\n * changing it changes nothing else.\n */\n public readonly details: Readonly<Record<string, unknown>> = {}\n\n constructor(\n message: string,\n public readonly code: string,\n public readonly status: number,\n details?: Readonly<Record<string, unknown>>,\n ) {\n super(message)\n this.name = \"NodaroError\"\n if (details) this.details = { ...details }\n }\n}\n\nexport class UnauthorizedError extends NodaroError {\n constructor(message = \"Authentication required\") {\n super(message, \"unauthorized\", 401)\n this.name = \"UnauthorizedError\"\n }\n}\n\nexport class ForbiddenError extends NodaroError {\n constructor(message = \"Forbidden\", public readonly missingScope?: string) {\n super(message, \"forbidden\", 403)\n this.name = \"ForbiddenError\"\n }\n}\n\nexport class NotFoundError extends NodaroError {\n constructor(message = \"Not found\") {\n super(message, \"not_found\", 404)\n this.name = \"NotFoundError\"\n }\n}\n\nexport class RateLimitedError extends NodaroError {\n constructor(message = \"Rate limited\") {\n super(message, \"rate_limited\", 429)\n this.name = \"RateLimitedError\"\n }\n}\n\n/**\n * HTTP 402: the run costs more than the caller may spend. `code` is the\n * refusal's own code — `insufficient_credits` for the caller's own balance, or\n * another 402 code such as `free_video_limit`. A spending cap someone else set\n * (a workspace budget, a member cap, a per-user allowance) is the subclass\n * {@link CreditCapExceededError}, so `instanceof InsufficientCreditsError`\n * still catches every 402.\n */\nexport class InsufficientCreditsError extends NodaroError {\n constructor(\n message = \"Insufficient credits\",\n public readonly required?: number,\n public readonly available?: number,\n code = \"insufficient_credits\",\n ) {\n super(message, code, 402)\n this.name = \"InsufficientCreditsError\"\n }\n}\n\n/** The 402 codes of a spending cap set by someone other than the caller. */\nexport type CreditCapCode = \"budget_exceeded\" | \"member_cap_exceeded\" | \"user_allowance_exceeded\"\n\n/**\n * The 402 codes {@link CreditCapExceededError} carries: the workspace's budget\n * (`budget_exceeded`), the caller's cap in that workspace\n * (`member_cap_exceeded`), the deployment's per-user allowance\n * (`user_allowance_exceeded`).\n */\nexport const CREDIT_CAP_CODES: ReadonlySet<CreditCapCode> = new Set<CreditCapCode>([\n \"budget_exceeded\",\n \"member_cap_exceeded\",\n \"user_allowance_exceeded\",\n])\n\n/**\n * HTTP 402 from a spending cap, not from the caller's own balance: topping up\n * does not help — whoever set the cap (the workspace's owner, the deployment's\n * operator) has to raise it. An {@link InsufficientCreditsError}, so existing\n * catches keep working; `code` says which cap. `available`, when sent, is what\n * the cap has left.\n */\nexport class CreditCapExceededError extends InsufficientCreditsError {\n declare readonly code: CreditCapCode\n\n constructor(code: CreditCapCode, message = \"A credit cap cannot cover this run\", required?: number, available?: number) {\n super(message, required, available, code)\n this.name = \"CreditCapExceededError\"\n }\n}\n\nexport class StorageExceededError extends NodaroError {\n constructor(message = \"Storage exceeded\", public readonly limitBytes?: number) {\n super(message, \"storage_exceeded\", 413)\n this.name = \"StorageExceededError\"\n }\n}\n\n/**\n * Optimistic-concurrency rejection (HTTP 409 `workflow_conflict`): the workflow\n * was written by another tab/device after the state carried in\n * `expectedUpdatedAt`/`expectedVersion` was read. `currentRecord` — when the\n * server includes it — is the full current workflow: merge your changes onto it\n * and retry with its fresh `updatedAt`, no follow-up GET needed.\n */\nexport class WorkflowConflictError extends NodaroError {\n constructor(\n message = \"Workflow was updated by another writer\",\n public readonly currentUpdatedAt?: string,\n public readonly currentVersion?: number,\n public readonly currentRecord?: Record<string, unknown>,\n /**\n * The wire code this conflict actually arrived with.\n *\n * `production_busy` is the studio production routes' own 409: the row\n * changed under a read-modify-write and the server exhausted its retries.\n * It is the same situation and the same remedy — re-read and apply again —\n * so it is the same ERROR, and a caller catching `WorkflowConflictError`\n * handles both. The code stays truthful because a caller that logs or\n * branches on it should see what the server said, not what the class is\n * usually called.\n */\n code: WorkflowConflictCode = \"workflow_conflict\",\n ) {\n super(message, code, 409)\n this.name = \"WorkflowConflictError\"\n }\n}\n\n/** The 409 codes that mean \"somebody else wrote first; re-read and retry\". */\nexport type WorkflowConflictCode = \"workflow_conflict\" | \"production_busy\"\n\n/**\n * A studio operation batch was refused, and the error names WHICH operation\n * (`opIndex`, zero-based) was wrong. Nothing in the batch was written: a batch\n * applies atomically or not at all, so fix that one operation and send the\n * whole batch again.\n *\n * Selected by SHAPE — any 4xx carrying a numeric `opIndex` — not by a list of\n * codes, so a new refusal reason (`op_invalid`, `op_target_missing`, whatever\n * the server adds next) reaches the caller as this error without an SDK\n * release. `code` is whatever the server sent.\n */\nexport class StudioOpError extends NodaroError {\n constructor(\n message: string,\n code: string,\n status: number,\n /** Zero-based index into the `ops` array that was sent. */\n public readonly opIndex: number,\n ) {\n super(message, code, status)\n this.name = \"StudioOpError\"\n }\n}\n\n/** The 409 codes whose answer names the job to turn to instead (a top-level `jobId`). */\nconst CONTINUATION_REFUSAL_CODES: ReadonlySet<string> = new Set([\n \"already_running\",\n \"continuation_superseded\",\n \"render_final_already_rendered\",\n])\n\n/**\n * A 409 that names the job to turn to instead: continuing a use-case run\n * (`client.edit.continueUseCase`) answers `already_running` (a continuation is\n * under way, or one that already completed — follow `jobId`),\n * `continuation_superseded` (a later continuation failed too — continue\n * `jobId` instead) or `render_final_already_rendered` (a Render final with this\n * very edit already completed — `jobId` holds the result). `code` and `status`\n * are what the server sent. Selected for exactly those three codes when the\n * answer carries a top-level `jobId`; every other 409 stays a plain\n * `NodaroError`.\n */\nexport class ContinuationRefusedError extends NodaroError {\n constructor(\n message: string,\n code: string,\n /** The job the refusal names. */\n public readonly jobId: string,\n ) {\n super(message, code, 409)\n this.name = \"ContinuationRefusedError\"\n }\n}\n\n/**\n * The one run that finishes a continuation held at a Preview review (the\n * `next` of {@link ContinuationPreviewPendingError}): pass these three fields\n * to `client.workflows.run`. It continues that execution, runs each held render\n * at Final and each held Tighten Episode continuing the run that made its\n * Preview, then every node after them.\n */\nexport interface HeldFinalRun {\n continueFromExecutionId: string\n /** The nodes it runs, in canvas order. */\n nodeIds: string[]\n /** For this run only: each held render at Final, each held use-case node's `useCaseContinue`. */\n inputOverrides: Record<string, Record<string, unknown>>\n}\n\n/**\n * HTTP 409 `continuation_preview_pending`: a continue-from-failed\n * (`client.workflows.run` with `continueMode: \"from-failed\"`) whose run's\n * newest later continuation completed by stopping at a Preview review, so\n * continuing again would stop there too. `executionId` is that continuation;\n * `renderNodeIds` the Apply EDL renders and `reviewNodeIds` the Tighten Episode\n * nodes holding it; `next` the run that finishes them — send it first\n * (`client.workflows.run(workflowId, error.next)`), then continue. Absent only\n * when the server could not name it. For a single held render, `next` is that\n * render's `client.workflows.renderFinal`.\n */\nexport class ContinuationPreviewPendingError extends NodaroError {\n constructor(\n message: string,\n public readonly executionId: string,\n public readonly renderNodeIds: readonly string[],\n public readonly reviewNodeIds: readonly string[],\n public readonly next?: HeldFinalRun,\n ) {\n super(message, \"continuation_preview_pending\", 409)\n this.name = \"ContinuationPreviewPendingError\"\n }\n}\n\nconst stringList = (v: unknown): string[] => (Array.isArray(v) ? v.filter((id): id is string => typeof id === \"string\") : [])\n\n/** A `next` as the server sends it, or undefined for anything else. */\nfunction heldFinalRunOf(v: unknown): HeldFinalRun | undefined {\n if (!v || typeof v !== \"object\") return undefined\n const r = v as Record<string, unknown>\n if (typeof r.continueFromExecutionId !== \"string\" || !Array.isArray(r.nodeIds)) return undefined\n if (!r.inputOverrides || typeof r.inputOverrides !== \"object\" || Array.isArray(r.inputOverrides)) return undefined\n return {\n continueFromExecutionId: r.continueFromExecutionId,\n nodeIds: stringList(r.nodeIds),\n inputOverrides: r.inputOverrides as Record<string, Record<string, unknown>>,\n }\n}\n\n/**\n * HTTP 409 `already_running` that names the execution under way (a top-level\n * `executionId`): the run you asked to start or continue is still running —\n * follow `executionId` (`client.executions.get`) instead of starting it again.\n * Sent by the workflow run route and by an app run's Retry\n * (`client.apps.resume`). An `already_running` that names a job instead stays\n * {@link ContinuationRefusedError}; one that names nothing, a plain\n * `NodaroError`.\n */\nexport class AlreadyRunningError extends NodaroError {\n constructor(\n message: string,\n /** The execution under way. */\n public readonly executionId: string,\n ) {\n super(message, \"already_running\", 409)\n this.name = \"AlreadyRunningError\"\n }\n}\n\n/**\n * HTTP 409 `app_run_version_changed`: a Retry of a failed app run\n * (`client.apps.resume`) refused because the app is on another version than\n * the one the run ran — continuing would mix them. `runVersion` is the run's\n * version, `appVersion` the one you are on (the `version` you sent, else the\n * app's latest). Start the run over (`client.apps.run`) to run `appVersion`,\n * or send `{ version: runVersion }` to continue on the run's own version.\n * Nothing was written or billed. Selected by code; the two numbers are\n * `undefined` when the answer does not carry them.\n */\nexport class AppRunVersionChangedError extends NodaroError {\n constructor(\n message: string,\n public readonly runVersion?: number,\n public readonly appVersion?: number,\n ) {\n super(message, \"app_run_version_changed\", 409)\n this.name = \"AppRunVersionChangedError\"\n }\n}\n\n/**\n * HTTP 422 `job_blocked`. A job policy registered by this deployment refused\n * the generation **before it ran** — no job was created, nothing was reserved\n * and nothing was charged. `message` is the policy's user-safe text: show it\n * as-is. Do not retry the identical request; whether the same input would be\n * judged differently is the deployment's policy's business.\n *\n * Only occurs on deployments that register a job policy. Selected by `code`,\n * not by status, the same way `workflow_conflict` narrows a 409 above — any\n * other 422 stays a plain `NodaroError`.\n */\nexport class JobBlockedError extends NodaroError {\n constructor(message = \"Blocked by this deployment's content policy\") {\n super(message, \"job_blocked\", 422)\n this.name = \"JobBlockedError\"\n }\n}\n\n/**\n * A job reached a terminal `failed`/`cancelled` status while being awaited by\n * `nodes.runAndWait` / `nodes.runMany`. Not an HTTP-level error (the polls\n * themselves succeeded), so `status` is 0 — distinguish it by type/`code`.\n * Carries the job's own `error_message` (as the message) and `jobId`.\n */\nexport class JobFailedError extends NodaroError {\n constructor(\n message: string,\n public readonly jobId: string,\n /** The terminal status that triggered the failure (`failed` | `cancelled`). */\n public readonly jobStatus: \"failed\" | \"cancelled\" = \"failed\",\n ) {\n super(message, \"job_failed\", 0)\n this.name = \"JobFailedError\"\n }\n}\n\n/**\n * `nodes.runAndWait` polled past its `maxMs` deadline without the job reaching\n * a terminal status. Not an HTTP error — `status` is 0; catch by type/`code`.\n */\nexport class JobTimeoutError extends NodaroError {\n constructor(\n message: string,\n public readonly jobId: string,\n /** The wall-clock deadline (ms) that was exceeded. */\n public readonly timeoutMs: number,\n ) {\n super(message, \"job_timeout\", 0)\n this.name = \"JobTimeoutError\"\n }\n}\n\n/**\n * The caller's `AbortSignal` fired while `nodes.runAndWait` was polling (or it\n * was already aborted on entry). Polling stops and this rejects. Not an HTTP\n * error — `status` is 0; catch by type/`code`.\n */\nexport class JobAbortedError extends NodaroError {\n constructor(message = \"Aborted\", public readonly jobId?: string) {\n super(message, \"job_aborted\", 0)\n this.name = \"JobAbortedError\"\n }\n}\n\n/**\n * A batch preview was asked for and this deployment cannot give one, so\n * NOTHING was sent: the batch is still unapplied and the production untouched.\n *\n * A preview is two requests because the route's body is parsed in strip mode —\n * a deployment that predates the preview silently DROPS the flag and APPLIES\n * the batch. So the SDK asks with an EMPTY batch first and sends the real one\n * only when that answer carries the `dryRun` marker. This is what it throws\n * when the answer does not: whatever the older deployment made of an empty\n * batch, the caller's batch never left.\n *\n * The remedy is a deployment that serves the preview — there is nothing to\n * retry here. To apply the batch instead, send it without the flag.\n *\n * A deployment that REFUSES the empty batch outright throws its own error\n * instead of this one, which is the right way round: the route's message says\n * more than \"unavailable\" does.\n *\n * Not an HTTP error: the request itself succeeded and answered the older shape.\n * `status` is 0; catch by type/`code`.\n */\nexport class StudioPreviewUnavailable extends NodaroError {\n constructor(\n message = \"This deployment does not preview operation batches; nothing was sent\",\n ) {\n super(message, \"studio_preview_unavailable\", 0)\n this.name = \"StudioPreviewUnavailable\"\n }\n}\n\n/**\n * A batch preview was asked for and the batch was APPLIED instead. The\n * production is written; this is the opposite of {@link\n * StudioPreviewUnavailable}, where nothing was sent.\n *\n * How it happens: the preview's proving ping and the batch are two requests,\n * and a fleet mid-rollout can serve them from different deployments. The ping\n * answers the marker, the batch reaches a deployment that predates the preview,\n * parses in strip mode, drops the flag and writes. The SDK cannot recall that\n * request — by the time the answer comes back the change has landed — so it\n * refuses to call the result a preview, which is the only thing still in its\n * gift. `receipts` and `warnings` are on both shapes, so an unchecked reply\n * would have shown a person what ALREADY happened under the heading of what\n * would.\n *\n * `applied` is what the route answered: the ordinary apply reply, whose\n * `production` and `version` are now the truth. Adopt them the way a plain\n * apply's caller does — do NOT re-send the batch, and do not present it for\n * approval.\n *\n * Not an HTTP error: the request succeeded, at the wrong thing. `status` is 0.\n */\nexport class StudioPreviewAppliedError extends NodaroError {\n constructor(\n /**\n * The apply reply the route sent back, as it sent it. An answer this\n * package does not recognise arrives here unchanged rather than being\n * dressed up: it is what the deployment said about a batch it took.\n *\n * `undefined` when the answer carried no body at all — a 204, an empty\n * envelope. The refusal still fires, because a non-preview answer is never\n * handed back as a preview, but there is nothing to report and the SDK will\n * not invent it: whether the batch was applied is unknown from here, and\n * the caller settles it by re-reading the production.\n */\n public readonly applied: StudioOpsResponse | undefined,\n message = applied\n ? \"Asked for a preview and this deployment APPLIED the batch; the change is written — see `applied`\"\n : \"Asked for a preview and this deployment answered with neither one nor a body to read; the batch may have been applied — re-read the production before deciding anything\",\n ) {\n super(message, \"studio_preview_applied\", 0)\n this.name = \"StudioPreviewAppliedError\"\n }\n}\n\n/**\n * The awaited job entered `pending_review`: a job policy registered by this\n * deployment held its output for a human reviewer. `pending_review` is\n * IN-FLIGHT, not terminal, so `nodes.runAndWait` / `nodes.runMany` end the\n * poll on the first tick they observe it rather than burning `maxMs` on a\n * status that no longer moves on its own.\n *\n * This does NOT cancel the job — the output exists, a human is reviewing it,\n * and the credit reservation stays `reserved` for the whole hold. Do not\n * re-run the request (a duplicate would be held too): re-fetch with\n * `jobs.get(jobId)` later, or surface \"awaiting review\" to your user and poll\n * `jobs.getStatus()` yourself. It resolves to `completed` (approved), `failed`\n * (rejected, with `error_hint.kind === \"policy-block\"`) or `cancelled`.\n *\n * Not an HTTP error — `status` is 0; catch by type/`code`.\n */\nexport class JobHeldError extends NodaroError {\n constructor(\n message: string,\n public readonly jobId: string,\n ) {\n super(message, \"job_held\", 0)\n this.name = \"JobHeldError\"\n }\n}\n\n/** The `{ error: { code, message, … } }` envelope every current route sends. */\ninterface ApiErrorEnvelope {\n code?: string\n message?: string\n missingScope?: string\n required?: number\n available?: number\n limitBytes?: number\n opIndex?: number\n [key: string]: unknown\n}\n\ninterface ApiErrorBody {\n /** The envelope — or, on an older route, a bare string (see {@link readErrorBody}). */\n error?: ApiErrorEnvelope | string\n /** A top-level message: an older route's, a bare validation answer's, or the server framework's own. */\n message?: unknown\n /** OAuth's human text (RFC 6749 §5.2), beside a bare-string `error`. */\n error_description?: unknown\n /** A bare validation answer's per-field issues (`{ message, issues }`). */\n issues?: unknown\n /** A refusal that names another job (see {@link ContinuationRefusedError}). */\n jobId?: unknown\n /** `continuation_preview_pending`: the held continuation, what holds it, and the run that finishes it. */\n executionId?: unknown\n renderNodeIds?: unknown\n reviewNodeIds?: unknown\n next?: unknown\n /** The credit guard's 402 sends its figures beside the envelope: what the run needs… */\n required?: unknown\n /** …and what the caller has (withheld on a deployment-paid instance). */\n balance?: unknown\n /** A per-user allowance's 402: what the allowance has left. */\n remaining?: unknown\n /** `app_run_version_changed`: the version the run ran, and the one the caller is on. */\n runVersion?: unknown\n appVersion?: unknown\n}\n\nconst finite = (v: unknown): number | undefined => (typeof v === \"number\" && Number.isFinite(v) ? v : undefined)\n\n/** A machine code as an older route writes it: lower snake_case, never a sentence or a reason phrase. */\nconst BARE_CODE = /^[a-z][a-z0-9_]*$/\n\nconst nonEmpty = (v: unknown): string | undefined => (typeof v === \"string\" && v.length > 0 ? v : undefined)\n\n/**\n * Where a body keeps its code and its human message. Most routes send the\n * envelope `{ error: { code, message } }`; three other shapes reach the SDK\n * too, and each is read for what it says rather than collapsed into\n * `internal_error` / \"Request failed\":\n *\n * - an older route's bare string, `{ error: \"<code>\", message?, … }` (character\n * training, a few profile and billing routes), and OAuth's\n * `{ error: \"<code>\", error_description }`. A snake_case string is the code;\n * a sentence (`\"Profile not found\"`) is the message.\n * - a bare validation answer, `{ message, issues: [...] }`: `validation_error`.\n * - the server framework's own answer, `{ statusCode, error: \"<reason phrase>\",\n * message }` (a route it does not have): the reason phrase is neither, the\n * message is kept — so \"no such route\" stays distinguishable from \"no such\n * resource\".\n *\n * At HTTP 500 and above only the CODE is read from outside the envelope. Text\n * there can be whatever the server failed with: the framework's own answer to\n * an uncaught throw is `{ statusCode: 500, error: \"Internal Server Error\",\n * message: <the raw error> }`, and the server's sanitizer rewrites only the\n * `internal_error` envelope. The envelope's own message is a route's chosen\n * sentence and is read at every status, as before.\n *\n * `message` is undefined when the body carries no human text it may show, so a\n * typed class keeps its own default (\"Not found\").\n */\nfunction readErrorBody(status: number, body: ApiErrorBody): { code: string | undefined; message: string | undefined; envelope: ApiErrorEnvelope } {\n const raw = body.error\n const envelope: ApiErrorEnvelope = raw && typeof raw === \"object\" ? raw : {}\n const bare = typeof raw === \"string\" ? raw : undefined\n const bareCode = bare !== undefined && BARE_CODE.test(bare) ? bare : undefined\n // Words with a space between them are human text: an older route's sentence,\n // or the framework's reason phrase — which always arrives with a real\n // `message`, read first. A single capitalised word (\"Unauthorized\") is a\n // reason phrase alone and says nothing the status does not.\n const bareSentence = bare !== undefined && bareCode === undefined && /\\s/.test(bare.trim()) ? bare : undefined\n const code =\n nonEmpty(envelope.code) ??\n bareCode ??\n (status === 400 && raw === undefined && Array.isArray(body.issues) ? \"validation_error\" : undefined)\n const outside = status >= 500 ? undefined : (nonEmpty(body.message) ?? nonEmpty(body.error_description) ?? bareSentence)\n const message = nonEmpty(envelope.message) ?? outside\n return { code, message, envelope }\n}\n\n/** The envelope's fields other than `code` and `message` (see {@link NodaroError.details}). */\nfunction envelopeDetails(envelope: ApiErrorEnvelope): Record<string, unknown> {\n const out: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(envelope)) {\n if (key !== \"code\" && key !== \"message\") out[key] = value\n }\n return out\n}\n\nexport function throwFromResponse(status: number, body: ApiErrorBody): never {\n try {\n selectError(status, body)\n } catch (err) {\n // Every class carries the envelope's other fields, whichever was chosen.\n if (err instanceof NodaroError) {\n const raw = body && typeof body === \"object\" ? body.error : undefined\n if (raw && typeof raw === \"object\") Object.defineProperty(err, \"details\", { value: envelopeDetails(raw), enumerable: true })\n }\n throw err\n }\n}\n\nfunction selectError(status: number, body: ApiErrorBody): never {\n // A body that is not an object (an empty answer, `null`, a bare string) still\n // throws by its status.\n const parsed: ApiErrorBody = body && typeof body === \"object\" ? body : {}\n const read = readErrorBody(status, parsed)\n const envelope = read.envelope\n const code = read.code ?? \"internal_error\"\n // A typed class falls back to its own default; a generic error to the code\n // it carries, which says more than \"Request failed\" does.\n const message = read.message ?? (read.code ? read.code : \"Request failed\")\n if (status === 401) throw new UnauthorizedError(read.message)\n if (status === 409 && (code === \"workflow_conflict\" || code === \"production_busy\")) {\n throw new WorkflowConflictError(\n read.message,\n envelope.currentUpdatedAt as string | undefined,\n envelope.currentVersion as number | undefined,\n envelope.currentRecord as Record<string, unknown> | undefined,\n code,\n )\n }\n // By shape, not by code — see StudioOpError. Only the studio operations route\n // sends an op index, so this cannot capture anyone else's 400.\n if (status >= 400 && status < 500 && typeof envelope.opIndex === \"number\") {\n throw new StudioOpError(message, code, status, envelope.opIndex)\n }\n if (status === 409 && CONTINUATION_REFUSAL_CODES.has(code) && typeof parsed.jobId === \"string\") {\n throw new ContinuationRefusedError(message, code, parsed.jobId)\n }\n if (status === 409 && code === \"continuation_preview_pending\" && typeof parsed.executionId === \"string\") {\n throw new ContinuationPreviewPendingError(\n message,\n parsed.executionId,\n stringList(parsed.renderNodeIds),\n stringList(parsed.reviewNodeIds),\n heldFinalRunOf(parsed.next),\n )\n }\n if (status === 409 && code === \"already_running\" && typeof parsed.executionId === \"string\") {\n throw new AlreadyRunningError(message, parsed.executionId)\n }\n if (status === 409 && code === \"app_run_version_changed\") {\n throw new AppRunVersionChangedError(message, finite(parsed.runVersion), finite(parsed.appVersion))\n }\n if (status === 422 && code === \"job_blocked\") throw new JobBlockedError(read.message)\n if (status === 403 && code === \"insufficient_scope\") {\n throw new ForbiddenError(read.message, envelope.missingScope)\n }\n if (status === 403) throw new ForbiddenError(read.message)\n // A 404 the framework answered itself (no route at that path) carries its\n // message at the top level, not under `error`; `readErrorBody` keeps it so\n // callers can tell \"no such route\" from \"no such resource\".\n if (status === 404) throw new NotFoundError(read.message)\n if (status === 429) throw new RateLimitedError(read.message)\n if (status === 402) {\n // The credit guard puts `required` / `balance` (an allowance: `remaining`)\n // beside the envelope; an envelope that carries them (`required` /\n // `available`) is read first.\n const required = finite(envelope.required) ?? finite(parsed.required)\n const available = finite(envelope.available) ?? finite(parsed.balance) ?? finite(parsed.remaining)\n const capCode = read.code as CreditCapCode | undefined\n if (capCode !== undefined && CREDIT_CAP_CODES.has(capCode)) {\n throw new CreditCapExceededError(capCode, read.message, required, available)\n }\n throw new InsufficientCreditsError(read.message, required, available, read.code ?? \"insufficient_credits\")\n }\n if (status === 413) throw new StorageExceededError(read.message, envelope.limitBytes)\n throw new NodaroError(message, code, status)\n}\n"]}
|
|
@@ -1 +0,0 @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PERSON_DIMENSION_LABELS, type PersonValue } from \"@nodaro/prompts/person\"\nimport type { CharacterAspectRatio, CharacterAttachColumn, EntityStyle } from \"@nodaro/shared/entities\"\nimport type { TtsProvider } from \"@nodaro/shared/models\"\nexport type { EntityStyle, CharacterAspectRatio } from \"@nodaro/shared/entities\"\nexport { CHARACTER_STYLES, CHARACTER_ASPECT_OPTIONS, CHARACTER_ASPECT_DEFAULTS } from \"@nodaro/shared/entities\"\nimport type { NodaroClientCore } from \"../core.js\"\nimport type { GenerationSessionParams, Subject } from \"./nodes.js\"\nimport type { SetKeeperCatalogInput, SetKeeperCatalogResult } from \"./keepers.js\"\n\n/**\n * Re-export the shared `EntityStyle` union (realistic | anime | 3d-pixar |\n * illustration) and `CHARACTER_STYLES` runtime tuple so SDK consumers don't\n * have to add `@nodaro/shared` as a second dependency just to typecheck the\n * `style` field. Single source of truth lives in `@nodaro/shared/entity-prompts`.\n */\n\n/**\n * Re-export the 4-value aspect-ratio union accepted by the generate-character*\n * routes. Single source of truth lives in `@nodaro/shared`. See\n * `CHARACTER_ASPECT_DEFAULTS` for the per-asset-type defaults.\n */\n\n/**\n * Structured Person composer, re-exported from `@nodaro/shared` so SDK\n * consumers can build a detailed person description — Identity, Body, and the\n * Face facial-geometry layer (cheekbones, canthal tilt, eyelid type, lip\n * fullness/shape, nose tip, etc.) — and feed it as `seedPrompt` / `description`\n * to `generate()` / `upsert()` without adding `@nodaro/shared` as a second dep.\n *\n * `buildPersonSeedPrompt` collapses a `PersonValue` into the same comma-joined\n * fragment the editor's Person picker produces (e.g. \"almond-shaped eyes,\n * sharply sculpted high cheekbones, full plump lips\"). Returns \"\" when empty.\n */\n\n\n/**\n * A character record returned by Nodaro's REST API. Mirrors the camelCase\n * shape produced by `backend/src/routes/characters.ts::toCamel()`.\n *\n * `expressions`, `poses`, `motions`, `angles`, `bodyAngles`,\n * `lightingVariations` are independent buckets keyed by a human-readable\n * variant name (e.g. `\"smile\"`, `\"standing\"`, `\"3/4 left\"`). Each entry's\n * `url` points at an R2-hosted asset.\n *\n * Identity-foundation fields:\n * - `referencePhotos` — caller-supplied real-life refs (max one per\n * non-`other` kind; cap 20 total). Drive the i2v / i2i path when a\n * provider supports multi-image conditioning.\n * - `realLifeRefsByVariant` — per-variant reference URLs (cap 20 keys,\n * 5 URLs per key). Keys are lowercased+trimmed.\n * - `referenceVideosByVariant` — per-label user-uploaded reference VIDEO\n * URLs (cap 20 keys, 5 URLs per key, lowercased+trimmed keys). Mirrors\n * `realLifeRefsByVariant` for video clips (e.g. emotion takes). Read the\n * chosen URLs off the row to drive generate-video's `referenceVideoUrls`.\n * - `seedPrompt` — short prompt fragment that scaffolds portrait gen.\n * - `canonicalDescription` — ~80–120-word LLM-authored visual caption,\n * populated by `approvePortrait()` / `recaption()`.\n */\nexport interface Character {\n id: string\n userId: string\n /** Canvas node linkage. `null` only on legacy clone rows that predate the\n * clone-side node_id fix (new clones mint one; creates always had one). */\n nodeId: string | null\n projectId: string | null\n name: string\n description: string | null\n gender: string | null\n style: string | null\n baseOutfit: string | null\n sourceImageUrl: string | null\n /** MODEL_CATALOG image-model id the main image was generated with (or `null`).\n * Set on create (the provider you generated with) + editable via `upsert`. */\n imageProvider: string | null\n expressions: Array<{ name: string; url: string }> | null\n poses: Array<{ name: string; url: string }> | null\n lightingVariations: Array<{ name: string; url: string }> | null\n angles: Array<{ name: string; url: string }> | null\n bodyAngles: Array<{ name: string; url: string }> | null\n motions: Array<{ name: string; url: string }> | null\n /** Named Character Boards — dense reference sheets, one per persona/look\n * (the `generate-image/character-board` factory preset rendered from the\n * character's images). A first-class bucket: community publish snapshots it\n * and clone hands the consumer their own copy to extend. Defaults to `[]`.\n * `type` marks an image-collage `\"identity\"` sheet vs a plain `\"looks\"`\n * board; `sourceImages` are the R2 URLs it was collaged from. Both optional\n * + backward-compatible (legacy boards have neither). */\n boards?: Array<{ name: string; url: string; type?: \"looks\" | \"identity\"; sourceImages?: string[] }> | null\n /** Per-label user-uploaded reference VIDEO URLs (R2), keyed by a\n * caller-owned label (lowercased+trimmed server-side). Mirrors\n * `realLifeRefsByVariant` for video clips; read the chosen URLs off the row\n * to feed generate-video's `referenceVideoUrls`. Defaults to `{}`. */\n referenceVideosByVariant?: Record<string, string[]> | null\n /** The user's chosen DEFAULT asset take per variant (Studio version history).\n * OPAQUE map: key `\"<bucket>:<variant>\"` (e.g. `\"bodyAngles:front\"`,\n * `\"expressions:smile\"`) → the chosen asset URL (one already present in that\n * bucket). Stored verbatim — keys are NOT normalized; soft-capped server-side\n * at 200 keys / 2048-char values (overflow dropped silently). Defaults to `{}`. */\n selectedAssetByVariant?: Record<string, string> | null\n /** `voiceType` records the selected voice's KIND (premade voices are\n * addressed by name; library/custom voices by id at text-to-speech time).\n * `previewUrl` is a playable audio sample (the voice's `preview_url` / clone\n * sample) the studio plays in an `<audio>` element — persisted so Voice Library\n * voices (which have no by-id lookup) stay previewable after reload. Client-\n * played only; the server never fetches it. `ttsProvider` is the library\n * voice's verified TTS provider (see `SharedVoice.recommendedProvider`) —\n * send it as the text-to-speech `provider` so the voice renders on a model\n * it's verified for. All optional — a character may have no voice, or a\n * legacy voice predating these fields. */\n voice: { voiceId: string; voiceName: string; traits: string; voiceType?: \"premade\" | \"library\" | \"custom\"; previewUrl?: string; ttsProvider?: TtsProvider } | null\n personality: {\n mood: string\n speechStyle: string\n movementStyle: string\n behavioralNotes: string\n } | null\n /** ~80–120-word LLM-authored visual caption (approve-portrait / recaption).\n * Optional on the read surface so existing literal consumers don't break;\n * the route always returns it (string | null). */\n canonicalDescription?: string | null\n /** Identity-lock strength for Character Studio asset generation. */\n identityLock?: \"off\" | \"soft\" | \"strict\"\n deletedAt: string | null\n createdAt: string\n updatedAt: string\n}\n\n/**\n * GET /v1/characters/:id appends three live-progress buckets the studio uses\n * to rehydrate spinners after a reload. Optional in the SDK surface — they\n * don't appear on `list()` rows.\n */\nexport interface CharacterDetail extends Character {\n pendingJobs?: Array<{\n jobId: string\n assetType: \"expressions\" | \"poses\" | \"angles\" | \"bodyAngles\" | \"lighting\" | \"motions\"\n name: string\n }>\n portraitCandidates?: Array<{\n jobId: string\n url: string | undefined\n progress: number\n status: string\n }>\n /** Recently completed portrait takes (7 days, newest first): at most 5\n * alternates, never the current portrait — plus, with\n * `get(id, { candidates: \"all\" })`, the current portrait's own take. */\n previousCandidates?: Array<{\n jobId: string\n url: string\n createdAt: string\n /** The image model the take was requested with. */\n provider?: string\n /** The aspect ratio the request sent explicitly; absent when the take\n * used the default ratio. */\n aspectRatio?: string\n /** `true` only on the current portrait's own take (returned with\n * `candidates: \"all\"`); `false` on the alternates. */\n isPortrait?: boolean\n }>\n}\n\n/** Options for `client.characters.get()`. */\nexport interface GetCharacterOptions {\n /**\n * `\"all\"`: `previousCandidates` also carries the current portrait's own\n * take, flagged `isPortrait: true`, when its job is within the 7-day window\n * (the alternates stay at most 5). Default `\"alternates\"`: the current\n * portrait is left out.\n */\n candidates?: \"alternates\" | \"all\"\n}\n\nexport type ReferencePhotoKind =\n | \"frontFace\"\n | \"sideLeft\"\n | \"sideRight\"\n | \"threeQuarterLeft\"\n | \"threeQuarterRight\"\n | \"frontBody\"\n | \"other\"\n\nexport interface ReferencePhoto {\n url: string\n kind: ReferencePhotoKind\n}\n\n/**\n * Body for `client.characters.upsert()`. Mirrors `upsertCharacterBody` in\n * `backend/src/routes/characters.ts`. Omitting `id` triggers an INSERT;\n * supplying it triggers an UPDATE that only writes the fields you pass —\n * undefined keys are NOT touched on the row.\n *\n * `name` is optional at the type level. The route requires `name` on INSERT\n * (id absent) and rejects with `validation_error` otherwise; on UPDATE the\n * route just ignores `name` when omitted, which lets partial updates like\n * `update(id, { gender: \"female\" })` succeed without re-sending the same\n * name the caller already has.\n */\nexport interface UpsertCharacterInput {\n /** UUID of the character row; omit to create. */\n id?: string\n /** Canvas node id the character belongs to. REQUIRED on create (the route\n * 400s without it, like `name`); optional on update — the update branch\n * never touches node_id, so partial updates needn't round-trip it. */\n nodeId?: string\n workflowId?: string\n projectId?: string\n name?: string\n description?: string\n gender?: string\n style?: string\n baseOutfit?: string\n sourceImageUrl?: string\n /** Persistent image-model id (a MODEL_CATALOG image model). Validated\n * server-side — unknown / non-image / \"\" is stored as `null`. */\n imageProvider?: string | null\n expressions?: Array<{ name: string; url: string }>\n poses?: Array<{ name: string; url: string }>\n lightingVariations?: Array<{ name: string; url: string }>\n angles?: Array<{ name: string; url: string }>\n bodyAngles?: Array<{ name: string; url: string }>\n motions?: Array<{ name: string; url: string }>\n /** Named Character Boards (see `Character.boards`) — whole-array replace,\n * like the asset buckets. Server caps: 24 boards, 200-char names, 30\n * sourceImages per board. */\n boards?: Array<{ name: string; url: string; type?: \"looks\" | \"identity\"; sourceImages?: string[] }>\n /** See `Character.voice` — persisted alongside the voice so TTS can resolve a\n * library/custom voice by id, `previewUrl` keeps the sample playable after\n * reload, and `ttsProvider` keeps generation on a model the voice is\n * verified for. All optional. */\n voice?: { voiceId: string; voiceName: string; traits: string; voiceType?: \"premade\" | \"library\" | \"custom\"; previewUrl?: string; ttsProvider?: TtsProvider } | null\n personality?: {\n mood: string\n speechStyle: string\n movementStyle: string\n behavioralNotes: string\n } | null\n seedPrompt?: string\n canonicalDescription?: string\n /** Identity-lock strength for Character Studio asset generation (off/soft/strict). */\n identityLock?: \"off\" | \"soft\" | \"strict\"\n referencePhotos?: ReferencePhoto[]\n /** Per-variant real-life reference URLs. Keys are lowercased+trimmed server-side. */\n realLifeRefsByVariant?: Record<string, string[]>\n /** Per-label user-uploaded reference VIDEO URLs (e.g. emotion takes). Keys\n * are lowercased+trimmed server-side; max 20 keys, 5 URLs each. Stored R2\n * URLs are read back off the row to drive generate-video's\n * `referenceVideoUrls`. */\n referenceVideosByVariant?: Record<string, string[]>\n /** The user's chosen DEFAULT asset take per variant. OPAQUE\n * `\"<bucket>:<variant>\"` → chosen-URL map; a write REPLACES the whole map\n * (the studio sends the full map each save). Omit to leave the row untouched.\n * Keys stored verbatim; soft-capped server-side at 200 keys / 2048-char values. */\n selectedAssetByVariant?: Record<string, string>\n}\n\nexport interface UpsertCharacterResult {\n id: string\n name?: string\n}\n\nexport interface ListCharactersParams {\n /** Restrict to a single project. */\n projectId?: string\n /** When true, return archived characters instead of active ones. */\n archived?: boolean\n /**\n * Search words: only the characters whose name or description contains\n * every word (split on spaces, the first 5), in any order, ignoring case —\n * `\"red car\"` finds \"Car, red\". Each word is matched as written (`%`, `_`\n * and `*` are not wildcards; punctuation is kept); blank means no search; up\n * to 200 characters. Combines with the other filters and with `cursor`\n * paging.\n */\n q?: string\n /**\n * Max rows to return. Server defaults to 100, caps at 500. Omit to take the\n * server default — passing it just narrows further.\n */\n limit?: number\n /** Opaque cursor from a prior page's `nextCursor` (fetches the next page). */\n cursor?: string\n}\n\nexport interface ListCharactersResult {\n characters: Character[]\n /** Pass back as `cursor` for the next page; `null` when there are no more. */\n nextCursor: string | null\n}\n\nexport interface DuplicateCharacterInput {\n /** Optional canvas node id to bind the new row to. */\n nodeId?: string\n /** Optional project to drop the new row into. */\n projectId?: string\n}\n\nexport interface CharacterUsage {\n workflowCount: number\n workflows: Array<{ id: string; name: string }>\n}\n\n/**\n * Input for `client.characters.generate()` — fires the\n * `POST /v1/generate-character` route. Produces 1–10 portrait candidates;\n * each lands as one `jobs` row in `pending` state and is then enqueued for\n * the worker.\n *\n * Provide at least one of `seedPrompt`, `referencePhotos`, or `description`\n * (the backend's refinement rejects empty input with `validation_error`).\n *\n * When `attachToCharacterId` is set, the worker writes the resulting URL\n * directly to `characters.source_image_url` on completion — caller doesn't\n * need a separate `approvePortrait` call for single-candidate runs. Pass\n * `attachPortrait: false` to keep every take a candidate instead.\n */\nexport interface GenerateCharacterInput extends GenerationSessionParams {\n name: string\n description?: string\n userPrompt?: string\n gender?: string\n style?: EntityStyle\n baseOutfit?: string\n sourceImageUrl?: string\n provider?: string\n /** Auto-attach the result to this character row. */\n attachToCharacterId?: string\n /** `false`: the take stays a candidate; only the approve route\n * (`approvePortrait()`) sets the portrait. Omitted/`true`: the finished\n * take is written to the row's portrait. */\n attachPortrait?: boolean\n seedPrompt?: string\n /**\n * WHO the portrait shows — person, styling and props as picker-catalog ids\n * ({@link Subject}, the same type and bounds as `generateImage`'s). The\n * platform writes the wording and folds it into the portrait prompt after\n * `seedPrompt` (or `description`), so send ids rather than phrasing a pick\n * yourself. Not a prompt source on its own: one of `seedPrompt`,\n * `referencePhotos` or `description` is still required.\n */\n subject?: Subject\n referencePhotos?: ReferencePhoto[]\n /** Number of candidate images to generate (1–10; server-validated). */\n count?: number\n /**\n * Explicit aspect ratio. Highest precedence — overrides both the character\n * node toggle and the per-asset-type default (portraits default to `3:4`).\n * Must be one of the 4-value `CharacterAspectRatio` union.\n */\n aspectRatio?: CharacterAspectRatio\n /**\n * Character node toggle (per-canvas-node `defaultAssetAspectRatio`). Wins\n * against the per-asset-type default, loses to `aspectRatio`.\n */\n characterNodeAspectRatio?: CharacterAspectRatio\n /**\n * Credit-affecting quality tier (e.g. `\"high\"` for gpt-image). Priced like\n * generate-image (composite ids such as `gpt-image:high`); values the chosen\n * model doesn't support are ignored server-side, never rejected.\n */\n quality?: string\n /**\n * Credit-affecting output resolution (e.g. `\"2K\"` / `\"4K\"` / `\"2 MP\"`).\n * Priced like generate-image (composite ids such as `nano-banana-pro:4K`);\n * values the chosen model doesn't support are ignored server-side, never\n * rejected.\n */\n resolution?: string\n}\n\nexport interface GenerateCharacterResult {\n /** First job-id; convenience alias for `jobIds[0]`. */\n jobId: string\n /** All job-ids when `count > 1`. */\n jobIds: string[]\n}\n\nexport interface GenerateAssetInput extends GenerationSessionParams {\n assetType:\n | \"expressions\"\n | \"poses\"\n | \"lighting\"\n | \"angles\"\n | \"headAngles\"\n | \"bodyAngles\"\n | \"custom\"\n /** The named variant (e.g. `\"smile\"`, `\"standing\"`, `\"3/4 left\"`). */\n variant: string\n /** Display name of the character; appears in the prompt. */\n name: string\n description?: string\n userPrompt?: string\n gender?: string\n style?: EntityStyle\n baseOutfit?: string\n sourceImageUrl?: string\n /** Real-life reference URLs (cap 5). */\n realLifeRefs?: string[]\n provider?: string\n /** Auto-attach to character row + asset bucket on completion. */\n attachToCharacterId?: string\n /** Shared type — auto-includes new buckets (sheets/detail_closeups/outfit_variations); mirrors objects.ts/locations.ts. */\n attachToColumn?: CharacterAttachColumn\n attachName?: string\n /**\n * Explicit aspect ratio. Highest precedence — overrides both the character\n * node toggle and the per-asset-type default (expressions=1:1, poses=9:16,\n * headAngles=3:4, bodyAngles=9:16, lighting=3:4, angles=3:4, custom=3:4).\n */\n aspectRatio?: CharacterAspectRatio\n /**\n * Character node toggle (per-canvas-node `defaultAssetAspectRatio`). Wins\n * against the per-asset-type default, loses to `aspectRatio`.\n */\n characterNodeAspectRatio?: CharacterAspectRatio\n /**\n * Credit-affecting quality tier (e.g. `\"high\"` for gpt-image). Values the\n * chosen model doesn't support are ignored server-side, never rejected.\n */\n quality?: string\n /**\n * Credit-affecting output resolution (e.g. `\"2K\"` / `\"4K\"` / `\"2 MP\"`).\n * Values the chosen model doesn't support are ignored server-side, never\n * rejected.\n */\n resolution?: string\n}\n\nexport interface GenerateMotionInput extends GenerationSessionParams {\n motionPrompt: string\n /** Optional when `attachToCharacterId` is set — falls back to the row's portrait. */\n sourceImageUrl?: string\n provider?: string\n name: string\n description?: string\n motionDescription?: string\n gender?: string\n style?: EntityStyle\n baseOutfit?: string\n realLifeRefs?: string[]\n attachToCharacterId?: string\n attachName?: string\n /**\n * Explicit aspect ratio. Highest precedence — overrides both the character\n * node toggle and the motions default (`9:16`).\n */\n aspectRatio?: CharacterAspectRatio\n /**\n * Character node toggle (per-canvas-node `defaultAssetAspectRatio`). Wins\n * against the motions default, loses to `aspectRatio`.\n */\n characterNodeAspectRatio?: CharacterAspectRatio\n}\n\nexport interface ApprovePortraitResult {\n portraitUrl: string\n /**\n * LLM-authored caption. `null` when the LLM call failed during the approval\n * — the portrait is still set; call `recaption()` to retry.\n */\n canonicalDescription: string | null\n}\n\nexport interface RecaptionResult {\n canonicalDescription: string\n}\n\n/**\n * Where a character's high-fidelity training stands. `untrained`: nothing was\n * ever trained, the trained model was removed (`deleteLora`), or a training\n * could not be started (`training_dispatch_failed` — refunded; this resets the\n * status even for a character trained before). `queued` / `training`: in\n * flight. `succeeded` / `failed` / `cancelled`: the last training's outcome.\n *\n * Generation uses the trained model only while the status is `succeeded`.\n */\nexport type CharacterTrainingState = \"untrained\" | \"queued\" | \"training\" | \"succeeded\" | \"failed\" | \"cancelled\"\n\n/** `GET /v1/characters/:id/training` — the character's training record. */\nexport interface CharacterTrainingStatus {\n status: CharacterTrainingState\n /** The provider's id for the latest training; `null` before the first one. */\n trainingId: string | null\n /** Why the last training failed, as the user may read it; `null` otherwise. */\n error: string | null\n /**\n * When the last successful training finished (ISO 8601). It stays set through\n * a re-train, a failed or cancelled one, or one that could not be started —\n * but the model is used only while `status` is `succeeded`.\n */\n trainedAt: string | null\n /** The last successful training's model version; set or not, used only while `status` is `succeeded`. */\n version: string | null\n /** The token added to prompts for this character (`TOK_<slug>_<6hex>`); generation adds it for you. */\n triggerWord: string | null\n /** How many images the latest training used. */\n imageCount: number | null\n}\n\n/** Body for `characters.train()`. */\nexport interface TrainCharacterInput {\n /**\n * Train on these of the character's images only (max 200 URLs; at most 20\n * are used). Omitted or empty: every eligible image — the portrait,\n * reference photos, expressions, poses, head and body angles and lighting\n * variations. At least 4 distinct images must remain either way.\n */\n selectedImageUrls?: string[]\n}\n\n/** `POST /v1/characters/:id/train` — answered 202 while the training runs. */\nexport interface TrainCharacterResult {\n /** The training's job; it ends `completed`, `failed` or `cancelled` with the training. */\n jobId: string\n /** The provider's id for this training (also on `trainingStatus().trainingId`). */\n trainingId: string\n /** The token added to prompts for this character once trained. */\n triggerWord: string\n}\n\n/**\n * The `code` of a `NodaroError` `train()` can throw beyond the typed classes\n * (`ForbiddenError` — an app token without `assets:write`, `missingScope`\n * says so; `InsufficientCreditsError`; `RateLimitedError`; `JobBlockedError`;\n * `UnauthorizedError`; …):\n *\n * - `insufficient_training_images` (400) — fewer than 4 distinct images; the\n * message says how many there are.\n * - `validation_error` (400) — a malformed id or `selectedImageUrls`.\n * - `already_training_or_not_found` (409) — a training is already in flight,\n * or the character is not yours / archived.\n * - `claim_failed` (500) — the training slot could not be claimed; nothing\n * started. Retry.\n * - `training_dispatch_failed` (502) — the training could not be started;\n * nothing is charged.\n * - `public_url_not_configured` (503) — the deployment cannot receive the\n * provider's completion call.\n * - `price_not_configured` (503) — the deployment has no price for training.\n * - `dedup_race_winner_unresolvable` (503) — a duplicate of this request was\n * in flight and its outcome could not be read; this one reserved nothing.\n * Read {@link CharactersResource.trainingStatus} before retrying.\n */\nexport type TrainCharacterRefusalCode =\n | \"insufficient_training_images\"\n | \"validation_error\"\n | \"already_training_or_not_found\"\n | \"claim_failed\"\n | \"training_dispatch_failed\"\n | \"public_url_not_configured\"\n | \"price_not_configured\"\n | \"dedup_race_winner_unresolvable\"\n\nexport class CharactersResource {\n constructor(private client: NodaroClientCore) {}\n\n /**\n * List the caller's characters. By default returns active characters only;\n * pass `archived: true` to fetch soft-deleted rows for an \"archive\" view.\n * When `projectId` is set, only characters belonging to that project are\n * returned; `q` keeps the ones whose name or description contains it.\n *\n * Cursor-paginated: a response carrying a non-null `nextCursor` means more\n * rows exist. Pass it back as `cursor` to fetch the next page, and keep going\n * until `nextCursor` is `null` — a single call returns at most `limit` rows\n * (default 100), so treating one call as \"all characters\" silently truncates\n * the list for anyone past that count.\n *\n * ```ts\n * const all: Character[] = []\n * let cursor: string | undefined\n * do {\n * const page = await client.characters.list({ cursor })\n * all.push(...page.characters)\n * cursor = page.nextCursor ?? undefined\n * } while (cursor)\n * ```\n */\n list(params: ListCharactersParams = {}): Promise<ListCharactersResult> {\n const query: Record<string, string | undefined> = {}\n if (params.projectId) query.projectId = params.projectId\n if (params.archived) query.archived = \"true\"\n if (params.q) query.q = params.q\n if (params.limit !== undefined) query.limit = String(params.limit)\n if (params.cursor) query.cursor = params.cursor\n return this.client.request(\"GET\", \"/v1/characters\", { query })\n }\n\n /**\n * Fetch a single character including in-flight portrait / asset job state.\n * Soft-deleted (archived) rows are returned by id intentionally so canvas\n * nodes that hold a stale `characterDbId` keep loading. Pass\n * `{ candidates: \"all\" }` to also get the current portrait's own take in\n * `previousCandidates` (flagged `isPortrait: true`).\n */\n get(id: string, options: GetCharacterOptions = {}): Promise<CharacterDetail> {\n const query: Record<string, string | undefined> = {}\n if (options.candidates) query.candidates = options.candidates\n return this.client.request(\"GET\", `/v1/characters/${encodeURIComponent(id)}`, { query })\n }\n\n /**\n * Create or update a character. Omit `id` to create; supply it to update\n * (only the fields you pass get written — undefined keys are untouched).\n *\n * If the caller-supplied `name` collides with an existing active character\n * for this user, the request returns 409 `name_taken`. To auto-number a\n * placeholder, pass the placeholder name from `@nodaro/shared` and the\n * server will derive \"Untitled character 2\", \"Untitled character 3\", etc.\n */\n upsert(input: UpsertCharacterInput): Promise<UpsertCharacterResult> {\n return this.client.request(\"POST\", \"/v1/characters\", { body: input })\n }\n\n /**\n * Convenience wrapper around `upsert()` for creating new characters.\n * Equivalent to `upsert({ ...input, id: undefined })`. `name` is REQUIRED\n * on create — the route 400s on INSERT-without-name; we narrow the type\n * here so callers fail at compile-time rather than runtime.\n */\n create(\n input: Omit<UpsertCharacterInput, \"id\"> & { name: string },\n ): Promise<UpsertCharacterResult> {\n return this.upsert(input)\n }\n\n /**\n * Convenience wrapper around `upsert()` for updating an existing character.\n * Equivalent to `upsert({ ...input, id })`.\n */\n update(\n id: string,\n input: Omit<UpsertCharacterInput, \"id\">,\n ): Promise<UpsertCharacterResult> {\n return this.upsert({ ...input, id })\n }\n\n /**\n * Soft-delete (archive) a character. The row is hidden from `list()` by\n * default but still loadable via `get(id)` so canvas nodes pointing at it\n * keep working. Restore with `restore(id)`.\n */\n delete(id: string): Promise<{ success: true; archived: true }> {\n return this.client.request(\"DELETE\", `/v1/characters/${encodeURIComponent(id)}`)\n }\n\n /**\n * Un-archive a character. If the original name now collides with an\n * active row, the server auto-suffixes \"(restored)\" and returns the\n * effective name.\n */\n restore(id: string): Promise<{ id: string; name: string }> {\n return this.client.request(\"POST\", `/v1/characters/${encodeURIComponent(id)}/restore`)\n }\n\n /**\n * Duplicate (fork) a character to a new row with a `\"(copy)\"` suffix.\n * Asset URLs are shared by reference — the new row can diverge by\n * regenerating any of them.\n */\n duplicate(id: string, input: DuplicateCharacterInput = {}): Promise<{ id: string; name: string }> {\n return this.client.request(\n \"POST\",\n `/v1/characters/${encodeURIComponent(id)}/duplicate`,\n { body: input },\n )\n }\n\n /**\n * Count of the caller's workflows that reference this character. Powers the\n * library \"Archive\" confirmation modal in the editor.\n */\n usage(id: string): Promise<CharacterUsage> {\n return this.client.request(\"GET\", `/v1/characters/${encodeURIComponent(id)}/usage`)\n }\n\n /**\n * Admin only: put one of your own characters on the shared Nodaro Keepers\n * shelf (`client.keepers.catalog()`), or take it off. A first-party session\n * or your personal token; `forbidden` for anyone who is not a platform\n * admin, `not_found` for a row that is not yours.\n */\n setCatalog(id: string, input: SetKeeperCatalogInput): Promise<SetKeeperCatalogResult> {\n return this.client.request(\"PUT\", `/v1/characters/${encodeURIComponent(id)}/catalog`, { body: input })\n }\n\n /**\n * Fire `POST /v1/generate-character` to produce one or more portrait\n * candidates. With `count > 1`, all jobs are reserved up-front before any\n * is enqueued — mid-batch failures roll back atomically.\n *\n * When `attachToCharacterId` is set, the worker writes the result directly\n * to the row's `source_image_url` (unless `attachPortrait: false`);\n * otherwise you must call `approvePortrait()` after picking a candidate.\n */\n generate(input: GenerateCharacterInput): Promise<GenerateCharacterResult> {\n return this.client.request(\"POST\", \"/v1/generate-character\", { body: input })\n }\n\n /**\n * Fire `POST /v1/generate-character-asset` to produce a single\n * expression / pose / angle / lighting variant. When the studio path is\n * set (`attachToCharacterId` + `attachToColumn` + `attachName`), the\n * worker appends `{ name: attachName, url: <result> }` to the named\n * JSONB array column on completion.\n */\n generateAsset(input: GenerateAssetInput): Promise<{ jobId: string }> {\n return this.client.request(\"POST\", \"/v1/generate-character-asset\", { body: input })\n }\n\n /**\n * Fire `POST /v1/generate-character-motion` to animate the character's\n * portrait into a motion clip. The result is appended to the character's\n * `motions[]` bucket when `attachToCharacterId` is set.\n */\n generateMotion(input: GenerateMotionInput): Promise<{ jobId: string }> {\n return this.client.request(\"POST\", \"/v1/generate-character-motion\", { body: input })\n }\n\n /**\n * Approve a completed `generate-character` job as the character's portrait.\n * Sets `source_image_url` and fires the LLM caption (Claude Sonnet vision)\n * inline. Returns the new portrait URL plus the caption — `canonicalDescription`\n * is `null` if the LLM call sub-failed (portrait still set; retry via `recaption()`).\n */\n approvePortrait(id: string, candidateJobId: string): Promise<ApprovePortraitResult> {\n return this.client.request(\n \"POST\",\n `/v1/characters/${encodeURIComponent(id)}/approve-portrait`,\n { body: { candidateJobId } },\n )\n }\n\n /**\n * Re-fire the LLM caption against the character's current portrait. 502s on\n * LLM failure; returns 400 `no_portrait` if no portrait is set yet.\n */\n recaption(id: string): Promise<RecaptionResult> {\n return this.client.request(\n \"POST\",\n `/v1/characters/${encodeURIComponent(id)}/llm-caption`,\n )\n }\n\n /**\n * Start training a high-fidelity model of the character on its own images\n * (Nodaro Cloud only — other editions answer `NotFoundError`). Reserves the\n * training price up front and refunds it if the training fails or is\n * cancelled. Resolves at once (202); a training takes about 15 minutes —\n * follow it with {@link trainingStatus}. Once it succeeds, a workflow's\n * Generate Image node whose prompt @-mentions this one character runs on the\n * trained model.\n *\n * An OAuth app token needs the `assets:write` scope (`ForbiddenError`\n * otherwise, before anything is reserved); a session or personal API key\n * needs none. Refusals are `NodaroError`s whose `code` is a\n * {@link TrainCharacterRefusalCode}; rate-limited to 3 calls a minute.\n */\n train(id: string, input: TrainCharacterInput = {}): Promise<TrainCharacterResult> {\n return this.client.request(\"POST\", `/v1/characters/${encodeURIComponent(id)}/train`, { body: input })\n }\n\n /**\n * The character's training record (Nodaro Cloud only). Poll it while\n * `status` is `queued` or `training` — every 10 s or so is plenty.\n */\n trainingStatus(id: string): Promise<CharacterTrainingStatus> {\n return this.client.request(\"GET\", `/v1/characters/${encodeURIComponent(id)}/training`)\n }\n\n /**\n * Remove the character's trained model (Nodaro Cloud only): cancels a\n * training in flight and refunds its reservation, deletes the model, and\n * clears the training record (`trainingStatus` then reads `untrained`).\n * Generations go back to reference images. Cannot be undone — a new model\n * means a new, paid training. An OAuth app token needs the `assets:write`\n * scope (`ForbiddenError` otherwise), like deleting the character.\n */\n async deleteLora(id: string): Promise<void> {\n await this.client.request(\"DELETE\", `/v1/characters/${encodeURIComponent(id)}/lora`)\n }\n}\n\n/** Person catalog + hint helpers, re-exported from @nodaro/prompts (FSL-licensed). */\nexport { buildPersonHints, PEOPLE, PERSON_DIMENSION_ORDER, PERSON_DIMENSION_LABELS }\nexport type { PersonValue }\n\n/**\n * Collapse a PersonValue into the comma-joined seed-prompt fragment used by\n * `characters.generate({ seedPrompt })` — same composition the Nodaro editor\n * performs. Powered by @nodaro/prompts.\n */\nexport function buildPersonSeedPrompt(value: PersonValue): string {\n return buildPersonHints(value as Record<string, unknown> & PersonValue).join(\", \")\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resources/jobs.ts"],"names":[],"mappings":";;;AA8SA,SAAS,UAAU,KAAA,EAAmE;AACpF,EAAA,IAAI,KAAA,KAAU,QAAW,OAAO,MAAA;AAChC,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,GAAW,KAAA,GAAQ,KAAA,CAAM,KAAK,GAAG,CAAA;AAC3D;AAgCO,IAAM,eAAN,MAAmB;AAAA,EACxB,YAAoB,MAAA,EAA0B;AAA1B,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAA2B;AAAA,EAA3B,MAAA;AAAA;AAAA,EAGpB,IAAI,EAAA,EAAoC;AACtC,IAAA,OAAO,IAAA,CAAK,OAAO,OAAA,CAAQ,KAAA,EAAO,YAAY,kBAAA,CAAmB,EAAE,CAAC,CAAA,CAAE,CAAA;AAAA,EACxE;AAAA;A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,SAAA,EAAY,kBAAA,CAAmB,EAAE,CAAC,CAAA,OAAA;AAAA,KACpC;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,OAAO,EAAA,EAAsC;AAC3C,IAAA,OAAO,KAAK,MAAA,CAAO,OAAA;AAAA,MACjB,MAAA;AAAA,MACA,CAAA,SAAA,EAAY,kBAAA,CAAmB,EAAE,CAAC,CAAA,OAAA;AAAA,KACpC;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,MAAA,CAAO,EAAA,EAAY,OAAA,GAAiC,EAAC,EAA6B;AAChF,IAAA,OAAO,KAAK,MAAA,CAAO,OAAA;AAAA,MACjB,QAAA;AAAA,MACA,CAAA,SAAA,EAAY,kBAAA,CAAmB,EAAE,CAAC,CAAA,CAAA;AAAA,MAClC,OAAA,CAAQ,UAAU,EAAE,KAAA,EAAO,EAAE,OAAA,EAAS,MAAA,EAAO,EAAE,GAAI;AAAC,KACtD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,QAAQ,EAAA,EAAwC;AAC9C,IAAA,OAAO,IAAA,CAAK,OAAO,OAAA,CAAQ,MAAA,EAAQ,YAAY,kBAAA,CAAmB,EAAE,CAAC,CAAA,QAAA,CAAU,CAAA;AAAA,EACjF;AACF","file":"chunk-P6AM42UB.cjs","sourcesContent":["import type { NodaroClientCore } from \"../core.js\"\n\n/**\n * A job's lifecycle status. Hand-copied mirror of `JOB_STATUSES` in the\n * platform's `backend/src/lib/job-status.ts` — nothing links the two at build\n * time, so a new member has to be added here in the same change.\n *\n * `pending_review` is IN-FLIGHT, NOT TERMINAL: a job policy registered by the\n * deployment held the output for a human reviewer. Treat it like `processing`\n * in a `switch` — keep waiting, do not re-run — and it resolves to `completed`\n * (approved), `failed` (rejected, carrying an `error_hint` with\n * `kind: \"policy-block\"`) or `cancelled` (a held job is cancellable like any\n * in-flight job). `credit_status` reads `\"reserved\"` for the whole hold. Only\n * appears on deployments that register a job policy; `runAndWait` throws\n * {@link JobHeldError} on the first held tick rather than waiting it out.\n */\nexport type JobStatus =\n | \"pending\"\n | \"queued\"\n | \"processing\"\n | \"pending_review\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n\n/**\n * A PROVIDER's verdict: the model's own safety filter refused the output.\n * `class` distinguishes a deterministic block (copyright/likeness — retrying\n * the same request never helps) from `safety`, whose filter is known to be\n * non-deterministic for some models: `retried` says whether the worker\n * already spent its one extra attempt, and `suggestedProvider` — present\n * only when the catalog declares a fallback for the model that failed — is a\n * real model id the SAME prompt/references can be retried on.\n */\nexport type SafetyBlockHint = {\n kind: \"safety-block\"\n class: \"copyright\" | \"likeness\" | \"safety\"\n retried: boolean\n suggestedProvider?: string\n /**\n * Present when the provider refused the INPUT VIDEO itself — not the prompt,\n * a reference image or the output. Sending a different clip is the fix.\n */\n subject?: \"input_video\"\n}\n\n/**\n * A NODARO-side verdict, not a provider's: a job policy registered by the\n * deployment rejected the request (`hookPoint: \"request\"` — nothing ran, and\n * the call itself failed with {@link JobBlockedError}) or the finished output\n * (`hookPoint: \"result\"` — the result was blocked and never published).\n *\n * `reason` is USER-SAFE BY CONTRACT — the platform guarantees the policy's\n * machine text (scores, labels) never reaches it — so show it to the person\n * who made the request as-is. `policyId` identifies the deployment's policy,\n * not a Nodaro product feature. Only occurs on deployments that register a\n * job policy.\n */\nexport type PolicyBlockHint = {\n kind: \"policy-block\"\n policyId: string\n reason: string\n hookPoint: \"request\" | \"result\"\n}\n\n/**\n * The job ran out of credits partway: a step that reserves its own credits\n * (for example, the video a Cast Swap or trend run dispatches) was refused —\n * the balance could not cover it, or a plan or workspace cap was reached. The\n * job failed and its credits were refunded; ask the person to top up (or raise\n * the cap), then run it again.\n *\n * `code` is the refusal's own code, a lowercase snake_case token — for\n * example `insufficient_credits`, `free_video_limit`, `instance_cap_reached`,\n * `budget_exceeded`, `member_cap_exceeded` or `user_allowance_exceeded`. Treat\n * an unknown code like `insufficient_credits`.\n */\nexport type CreditsHint = {\n kind: \"credits\"\n code: string\n}\n\n/**\n * The provider refused the job's input video without naming a content-policy\n * class (its message is about the file, not a policy). Treat it like any\n * other failure — no fallback model is offered — except that the input to\n * change is known: send a different clip.\n */\nexport type InputRefusedHint = {\n kind: \"input-refused\"\n subject: \"input_video\"\n}\n\n/**\n * A job's `jobs.error_hint` (migration 376) — a user-safe, machine-readable\n * failure verdict, so a caller can act on it without parsing `error_message`\n * prose. One column, several verdict sources; `kind` is the discriminant.\n *\n * HAND-COPIED MIRROR of `ErrorHint` in the platform's\n * `backend/src/lib/safety-block.ts` (which names this file in its own\n * comment). Nothing links the two at build time: a new arm there has to be\n * pasted here verbatim in the same change, with a changeset.\n * `packages/client/dist/index.d.ts` is REBUILT, never hand-edited.\n */\nexport type JobErrorHint = SafetyBlockHint | PolicyBlockHint | CreditsHint | InputRefusedHint\n\n/**\n * The billing lifecycle of a job's credit reservation — `usage_logs.status`\n * for the job's `usage_log_id`. `null` when the job has no usage log (e.g. a\n * free run) or hasn't reserved credits yet.\n */\nexport type CreditStatus = \"reserved\" | \"committed\" | \"refunded\"\n\n/** A job owner's rating of their job — set with {@link JobsResource.rate}. */\nexport type JobRating = \"good\" | \"bad\"\n\n/**\n * The `rating` filter of {@link JobsResource.list}: one rating, any rating\n * (`\"rated\"`) or none (`\"unrated\"`).\n */\nexport type JobRatingFilter = JobRating | \"rated\" | \"unrated\"\n\n/**\n * Job record returned to non-admin SDK consumers. Field names are snake_case\n * to match the wire format (per the OpenAPI fix in Phase 1).\n *\n * Sensitive fields stripped server-side for non-admin callers:\n * `provider`, `provider_cost`, `display_cost`, `credits_actual`. USD\n * pricing is admin-only across api/sdk/mcp — non-admin consumers see\n * only the `credits` abstraction. Server-only nested job data (including\n * Recast's private remux base) is stripped for every caller, including admins.\n */\nexport interface Job {\n id: string\n status: JobStatus\n progress: number\n user_id: string\n input_data: unknown\n output_data: unknown\n error_message: string | null\n /** Present on a failed job the worker classified as a provider\n * content-policy block (`kind: \"safety-block\"`) or that a deployment's job\n * policy rejected (`kind: \"policy-block\"`); absent/null otherwise.\n * User-safe by construction — narrow on `kind` before reading the rest. */\n error_hint?: JobErrorHint | null\n /** PR9: the job's credit reservation lifecycle, derived server-side from\n * `usage_logs.status`. `null` when there is no usage log to report. Never\n * changes the meaning of `credits` (the reserved amount) below. */\n credit_status?: CreditStatus | null\n /** The credits the job itself HELD when it was accepted. Never changes — a\n * job can settle below it; read {@link Job.credits_charged} for what it cost. */\n credits: number | null\n /**\n * What the job actually cost once its hold settled, INCLUDING the steps it\n * ran: a job that runs other jobs for you (a Nodaro Motion run's reference\n * preparation, mask and video) is charged for each, and they are not listed\n * on their own. A step adds its charge once it settles. Can be lower than\n * {@link Job.credits_held} (the unused part goes back to the balance). `0`\n * when the run's own hold was refunded, plus any settled steps (a refunded\n * Nodaro Motion run whose reference and mask steps committed reads\n * `credit_status: \"refunded\"` with `credits_charged: 165`). `null` while the\n * job's own hold is still open (even when some steps have settled), when\n * nothing in the run was reserved, or when its steps could not be read for a\n * moment (unknown — never a lower figure). Sum this — not `credits` — to\n * total spend. Returned by `get()` and `list()`.\n */\n credits_charged?: number | null\n /** The run's hold: the job's own `credits` plus its steps' holds (equals `credits` for a job with no steps). */\n credits_held?: number | null\n /** What went back from `credits_held` once every hold in the run settled; `null` until then. */\n credits_released?: number | null\n job_type: string | null\n created_at: string\n started_at: string | null\n completed_at: string | null\n /**\n * Provenance: which kind of caller created the job — one of\n * `\"internal\" | \"mcp\" | \"app\" | \"cli\" | \"sdk\" | \"extension\" | \"web\" | \"api\"`.\n * `source_detail` narrows it (origin host, `extension/<name>` label,\n * `sdk/<version>`, MCP client name, developer-app id). Descriptive only;\n * lets a library view label or filter media by origin.\n */\n source?: string | null\n source_detail?: string | null\n /** The generation session this job was born in (the `sessionId` sent with\n * the generation request), or null. See `client.sessions`. */\n session_id?: string | null\n /**\n * With `list({ withSessions: true })`: every session that holds the job now,\n * each linkable — empty when it is in no session (General). Absent otherwise.\n */\n sessions?: JobSessionRef[]\n /**\n * When the job was deleted, on a job read from the Trash\n * (`client.trash.list()`). A deleted job is left out of every other read, so\n * this is otherwise absent or `null`.\n */\n deleted_at?: string | null\n /**\n * Whether the job's owner favorited it (`client.gallery.toggleFavorite`).\n * Returned by `get()` and `list()`. Absent from an older server, and when\n * the server could not read it for a moment — treat absent as unknown,\n * never as `false`.\n */\n favorited?: boolean\n /**\n * The owner's rating of the job ({@link JobsResource.rate}), or `null` when\n * unrated. Returned by `get()` and `list()`; absent like `favorited`.\n */\n rating?: JobRating | null\n}\n\nexport interface CancelJobResult {\n success: true\n cancelled: number\n /**\n * `true` when the job could not be stopped because its provider call is\n * already running — a metered LLM job's call, an external provider task. It\n * finishes and is charged only what it used.\n */\n inFlight?: boolean\n}\n\n/**\n * The kind of caller that created a job (`Job.source`). Hand-copied mirror of\n * `JOB_SOURCES` in the platform's `backend/src/lib/job-source.ts`.\n */\nexport type JobSource = \"internal\" | \"mcp\" | \"app\" | \"cli\" | \"sdk\" | \"extension\" | \"web\" | \"api\"\n\nexport interface DeleteJobResult {\n success: true\n}\n\n/** A session that holds a job now (`Job.sessions`). */\nexport interface JobSessionRef {\n id: string\n title: string | null\n /** The session's project, or `null` when it has none. */\n projectId: string | null\n}\n\nexport interface ListJobsParams {\n /** One status or several (a job matching any of them). An unknown status is a 400. */\n status?: JobStatus | readonly JobStatus[]\n /** Exact match on `input_data.type` — the route that created the job\n * (`\"llm-structured\"`, `\"video-analysis\"`, …). One value or several (up to 20). */\n type?: string | readonly string[]\n /** Exact match on `input_data.origin` — the client app that sent it. */\n origin?: string\n /** The surface that created the job (`Job.source`): `\"mcp\"` lists what your\n * MCP clients (Claude, ChatGPT, …) made. One value or several. */\n source?: JobSource | readonly JobSource[]\n /** `true`: only jobs you favorited; `false`: only jobs you did not. */\n favorited?: boolean\n /** Your rating: `\"good\"`, `\"bad\"`, any (`\"rated\"`) or none (`\"unrated\"`). */\n rating?: JobRatingFilter\n /** The jobs of one generate-image batch (`count` / `models`) — its `batchId`. */\n batchId?: string\n /**\n * The jobs a session of this project holds now — or, `\"none\"`, a session\n * with no project. Each job once, however many sessions hold it. Not with\n * `inSession: false`.\n */\n projectId?: string | \"none\"\n /**\n * `false`: the jobs no session holds now (General), whatever session they\n * were born in. `true`: the jobs at least one session holds.\n */\n inSession?: boolean\n /** `true`: each job carries `sessions`, the sessions that hold it now. */\n withSessions?: boolean\n /** Page size, 1–100 (server default 50). */\n limit?: number\n /** The previous page's `next`. */\n cursor?: string\n}\n\n/** What {@link JobsResource.rate} answers: the job's rating now. */\nexport interface RateJobResult {\n data: { jobId: string; rating: JobRating | null }\n}\n\n/**\n * {@link JobsResource.fromUpload}'s body: an image edited in the browser,\n * already stored with `client.uploads.upload`, and what it was made from.\n */\nexport interface JobFromUploadParams {\n /** The edited image's `assetId`, as `client.uploads.upload` returned it. */\n assetId: string\n /** The job whose image was edited. */\n sourceJobId?: string\n /** Which of `sourceJobId`'s images was edited, when it made several. Default: its `imageUrl`. */\n sourceImageUrl?: string\n /** The upload that was edited, when the source is not a job. Not with `sourceJobId`. */\n sourceAssetId?: string\n /** The editor's design state, stored with `client.uploads.uploadJson`, so the edit can be reopened. */\n editStateUrl?: string\n /** The generation session to file the job in. */\n sessionId?: string\n}\n\n/** A list filter value as the query string carries it: several are comma-separated. */\nfunction listParam(value: string | readonly string[] | undefined): string | undefined {\n if (value === undefined) return undefined\n return typeof value === \"string\" ? value : value.join(\",\")\n}\n\nexport interface ListJobsPage {\n /**\n * A page may hold fewer than `limit` rows — even none — and still carry a\n * `next`. Page on `next`, never on `data.length`.\n */\n data: Job[]\n /** Pass back as `cursor` for the next page; `null` on the last one. */\n next: string | null\n}\n\n/**\n * Lean job status returned by `GET /v1/jobs/:id/status`. Skips the\n * `input_data` JSONB and cost columns. Its `output_data` still goes\n * through the server-only nested-field redaction. Intended for poll loops that\n * only need progress/output/error, and when the job finished.\n */\nexport interface JobStatusResult {\n id: string\n status: JobStatus\n progress?: number\n output_data?: unknown\n error_message?: string | null\n /** PR9: see {@link Job.error_hint}. */\n error_hint?: JobErrorHint | null\n /** PR9: see {@link Job.credit_status}. */\n credit_status?: CreditStatus | null\n /** When the job finished, on the server's clock; null until it has. */\n completed_at?: string | null\n}\n\nexport class JobsResource {\n constructor(private client: NodaroClientCore) {}\n\n /** Get a single job by ID. */\n get(id: string): Promise<{ data: Job }> {\n return this.client.request(\"GET\", `/v1/jobs/${encodeURIComponent(id)}`)\n }\n\n /**\n * Your jobs, newest first (`GET /v1/jobs`), cursor-paginated. `type` and\n * `origin` filter on the job's own `input_data`, which every job carries —\n * a client app lists its runs with `{ type: \"llm-structured\", origin: \"studio\" }`.\n * `status` and `type` take one value or a list; `favorited` and `rating`\n * filter on your own marks, `source` on the surface that created the job.\n * `projectId` / `inSession` filter on where the job is now (a project's\n * sessions, or General), and `withSessions` says which sessions each job is\n * in — for \"everything in this project\". Every filter combines with AND,\n * and each job carries `favorited` and `rating`. A deleted job is never\n * listed: read the Trash with `client.trash.list()`.\n */\n list(params: ListJobsParams = {}): Promise<ListJobsPage> {\n const { status, type, source, inSession, withSessions, ...rest } = params\n return this.client.request<ListJobsPage>(\"GET\", \"/v1/jobs\", {\n query: {\n ...rest,\n status: listParam(status),\n type: listParam(type),\n source: listParam(source),\n inSession: inSession === undefined ? undefined : String(inSession),\n withSessions: withSessions ? \"true\" : undefined,\n },\n })\n }\n\n /**\n * Record an image edited in the browser as a job (`POST /v1/jobs/from-upload`):\n * a completed, private, free `image-edit` job whose `output_data.imageUrl` is\n * the upload, linked to its source in `input_data` (`sourceJobId` /\n * `sourceAssetId`, `sourceImageUrl`). It then lists, rates, favorites and\n * files into a session like any image job. One upload is one job: the same\n * `assetId` again returns the same job. OAuth apps need the `assets:write`\n * scope. A deployment's job policy can refuse the image ({@link JobBlockedError}).\n */\n fromUpload(params: JobFromUploadParams): Promise<{ data: Job }> {\n return this.client.request<{ data: Job }>(\"POST\", \"/v1/jobs/from-upload\", { body: params })\n }\n\n /**\n * Rate one of your jobs `\"good\"` or `\"bad\"`, or clear the rating with\n * `null` (`PUT /v1/jobs/:id/rating`). Only the job's owner rates it — anyone\n * else's job is a `NotFoundError`. The rating reads back as `Job.rating`\n * and filters {@link list}. OAuth apps need the `assets:write` scope.\n */\n rate(id: string, rating: JobRating | null): Promise<RateJobResult> {\n return this.client.request<RateJobResult>(\"PUT\", `/v1/jobs/${encodeURIComponent(id)}/rating`, {\n body: { rating },\n })\n }\n\n /**\n * Get the lean status of a single job (poll-loop friendly).\n * Hits `GET /v1/jobs/:id/status` — returns only id/status/progress/\n * output_data/error_message, with far less wire/CPU cost than `get()`.\n * Same auth + ownership semantics as {@link get}.\n */\n getStatus(id: string): Promise<{ data: JobStatusResult }> {\n return this.client.request(\n \"GET\",\n `/v1/jobs/${encodeURIComponent(id)}/status`,\n )\n }\n\n /**\n * Cancel a job. Server route is `POST /v1/jobs/:jobId/cancel`.\n * Refunds any reserved credit holds. A running LLM job priced per model\n * (metered) whose call has already started answers\n * `{ success: true, cancelled: 0, inFlight: true }`: it finishes and is\n * charged only what it used. A job stopped before its call starts is\n * refunded, except for what an earlier attempt of the same job already used\n * (a retry after a billed attempt): that is charged.\n */\n cancel(id: string): Promise<CancelJobResult> {\n return this.client.request(\n \"POST\",\n `/v1/jobs/${encodeURIComponent(id)}/cancel`,\n )\n }\n\n /**\n * Delete a job: it goes to the Trash (`client.trash.list()`). It is left out\n * of every read from then on, stays restorable for 30 days ({@link restore},\n * back into the sessions it was in), and is then deleted for good, as a\n * delete always was (a copy saved to the Library stays). `{ forever: true }` deletes a job already in the Trash for good now;\n * on a live job it fails with a 409 `NodaroError` whose `code` is\n * `\"not_in_trash\"`. Only the job's owner (or an admin) may delete it; a job\n * that is still running keeps running — cancel it first when its worker\n * should stop ({@link cancel}). Nothing is refunded. OAuth apps need the\n * `assets:write` scope.\n */\n delete(id: string, options: { forever?: boolean } = {}): Promise<DeleteJobResult> {\n return this.client.request(\n \"DELETE\",\n `/v1/jobs/${encodeURIComponent(id)}`,\n options.forever ? { query: { forever: \"true\" } } : {},\n )\n }\n\n /**\n * Bring a deleted job back from the Trash: it reappears in every read and in\n * every session it was in. A job that is not in the Trash succeeds too.\n * OAuth apps need the `assets:write` scope.\n */\n restore(id: string): Promise<{ success: true }> {\n return this.client.request(\"POST\", `/v1/jobs/${encodeURIComponent(id)}/restore`)\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resources/characters.ts"],"names":[],"mappings":";;;;;AAyiBO,IAAM,qBAAN,MAAyB;AAAA,EAC9B,YAAoB,MAAA,EAA0B;AAA1B,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAA2B;AAAA,EAA3B,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBpB,IAAA,CAAK,MAAA,GAA+B,EAAC,EAAkC;AACrE,IAAA,MAAM,QAA4C,EAAC;AACnD,IAAA,IAAI,MAAA,CAAO,SAAA,EAAW,KAAA,CAAM,SAAA,GAAY,MAAA,CAAO,SAAA;AAC/C,IAAA,IAAI,MAAA,CAAO,QAAA,EAAU,KAAA,CAAM,QAAA,GAAW,MAAA;AACtC,IAAA,IAAI,MAAA,CAAO,CAAA,EAAG,KAAA,CAAM,CAAA,GAAI,MAAA,CAAO,CAAA;AAC/B,IAAA,IAAI,OAAO,KAAA,KAAU,MAAA,QAAiB,KAAA,GAAQ,MAAA,CAAO,OAAO,KAAK,CAAA;AACjE,IAAA,IAAI,MAAA,CAAO,MAAA,EAAQ,KAAA,CAAM,MAAA,GAAS,MAAA,CAAO,MAAA;AACzC,IAAA,OAAO,KAAK,MAAA,CAAO,OAAA,CAAQ,OAAO,gBAAA,EAAkB,EAA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AAA,CAAK,OAAO,OAAA,CAAQ,QAAA,EAAU,kBAAkB,kBAAA,CAAmB,EAAE,CAAC,CAAA,KAAA,CAAO,CAAA;AAAA,EACrF;AACF;AAWO,SAAS,sBAAsB,KAAA,EAA4B;AAChE,EAAA,OAAO,gBAAA,CAAiB,KAA8C,CAAA,CAAE,IAAA,CAAK,IAAI,CAAA;AACnF","file":"chunk-PBFODIFT.js","sourcesContent":["import { buildPersonHints, PEOPLE, PERSON_DIMENSION_ORDER, PERSON_DIMENSION_LABELS, type PersonValue } from \"@nodaro/prompts/person\"\nimport type { CharacterAspectRatio, CharacterAttachColumn, EntityStyle } from \"@nodaro/shared/entities\"\nimport type { TtsProvider } from \"@nodaro/shared/models\"\nexport type { EntityStyle, CharacterAspectRatio } from \"@nodaro/shared/entities\"\nexport { CHARACTER_STYLES, CHARACTER_ASPECT_OPTIONS, CHARACTER_ASPECT_DEFAULTS } from \"@nodaro/shared/entities\"\nimport type { NodaroClientCore } from \"../core.js\"\nimport type { GenerationSessionParams, Subject } from \"./nodes.js\"\nimport type { SetKeeperCatalogInput, SetKeeperCatalogResult } from \"./keepers.js\"\n\n/**\n * Re-export the shared `EntityStyle` union (realistic | anime | 3d-pixar |\n * illustration) and `CHARACTER_STYLES` runtime tuple so SDK consumers don't\n * have to add `@nodaro/shared` as a second dependency just to typecheck the\n * `style` field. Single source of truth lives in `@nodaro/shared/entity-prompts`.\n */\n\n/**\n * Re-export the 4-value aspect-ratio union accepted by the generate-character*\n * routes. Single source of truth lives in `@nodaro/shared`. See\n * `CHARACTER_ASPECT_DEFAULTS` for the per-asset-type defaults.\n */\n\n/**\n * Structured Person composer, re-exported from `@nodaro/shared` so SDK\n * consumers can build a detailed person description — Identity, Body, and the\n * Face facial-geometry layer (cheekbones, canthal tilt, eyelid type, lip\n * fullness/shape, nose tip, etc.) — and feed it as `seedPrompt` / `description`\n * to `generate()` / `upsert()` without adding `@nodaro/shared` as a second dep.\n *\n * `buildPersonSeedPrompt` collapses a `PersonValue` into the same comma-joined\n * fragment the editor's Person picker produces (e.g. \"almond-shaped eyes,\n * sharply sculpted high cheekbones, full plump lips\"). Returns \"\" when empty.\n */\n\n\n/**\n * A character record returned by Nodaro's REST API. Mirrors the camelCase\n * shape produced by `backend/src/routes/characters.ts::toCamel()`.\n *\n * `expressions`, `poses`, `motions`, `angles`, `bodyAngles`,\n * `lightingVariations` are independent buckets keyed by a human-readable\n * variant name (e.g. `\"smile\"`, `\"standing\"`, `\"3/4 left\"`). Each entry's\n * `url` points at an R2-hosted asset.\n *\n * Identity-foundation fields:\n * - `referencePhotos` — caller-supplied real-life refs (max one per\n * non-`other` kind; cap 20 total). Drive the i2v / i2i path when a\n * provider supports multi-image conditioning.\n * - `realLifeRefsByVariant` — per-variant reference URLs (cap 20 keys,\n * 5 URLs per key). Keys are lowercased+trimmed.\n * - `referenceVideosByVariant` — per-label user-uploaded reference VIDEO\n * URLs (cap 20 keys, 5 URLs per key, lowercased+trimmed keys). Mirrors\n * `realLifeRefsByVariant` for video clips (e.g. emotion takes). Read the\n * chosen URLs off the row to drive generate-video's `referenceVideoUrls`.\n * - `seedPrompt` — short prompt fragment that scaffolds portrait gen.\n * - `canonicalDescription` — ~80–120-word LLM-authored visual caption,\n * populated by `approvePortrait()` / `recaption()`.\n */\nexport interface Character {\n id: string\n userId: string\n /** Canvas node linkage. `null` only on legacy clone rows that predate the\n * clone-side node_id fix (new clones mint one; creates always had one). */\n nodeId: string | null\n projectId: string | null\n name: string\n description: string | null\n gender: string | null\n style: string | null\n baseOutfit: string | null\n sourceImageUrl: string | null\n /** MODEL_CATALOG image-model id the main image was generated with (or `null`).\n * Set on create (the provider you generated with) + editable via `upsert`. */\n imageProvider: string | null\n expressions: Array<{ name: string; url: string }> | null\n poses: Array<{ name: string; url: string }> | null\n lightingVariations: Array<{ name: string; url: string }> | null\n angles: Array<{ name: string; url: string }> | null\n bodyAngles: Array<{ name: string; url: string }> | null\n motions: Array<{ name: string; url: string }> | null\n /** Named Character Boards — dense reference sheets, one per persona/look\n * (the `generate-image/character-board` factory preset rendered from the\n * character's images). A first-class bucket: community publish snapshots it\n * and clone hands the consumer their own copy to extend. Defaults to `[]`.\n * `type` marks an image-collage `\"identity\"` sheet vs a plain `\"looks\"`\n * board; `sourceImages` are the R2 URLs it was collaged from. Both optional\n * + backward-compatible (legacy boards have neither). */\n boards?: Array<{ name: string; url: string; type?: \"looks\" | \"identity\"; sourceImages?: string[] }> | null\n /** Per-label user-uploaded reference VIDEO URLs (R2), keyed by a\n * caller-owned label (lowercased+trimmed server-side). Mirrors\n * `realLifeRefsByVariant` for video clips; read the chosen URLs off the row\n * to feed generate-video's `referenceVideoUrls`. Defaults to `{}`. */\n referenceVideosByVariant?: Record<string, string[]> | null\n /** The user's chosen DEFAULT asset take per variant (Studio version history).\n * OPAQUE map: key `\"<bucket>:<variant>\"` (e.g. `\"bodyAngles:front\"`,\n * `\"expressions:smile\"`) → the chosen asset URL (one already present in that\n * bucket). Stored verbatim — keys are NOT normalized; soft-capped server-side\n * at 200 keys / 2048-char values (overflow dropped silently). Defaults to `{}`. */\n selectedAssetByVariant?: Record<string, string> | null\n /** `voiceType` records the selected voice's KIND (premade voices are\n * addressed by name; library/custom voices by id at text-to-speech time).\n * `previewUrl` is a playable audio sample (the voice's `preview_url` / clone\n * sample) the studio plays in an `<audio>` element — persisted so Voice Library\n * voices (which have no by-id lookup) stay previewable after reload. Client-\n * played only; the server never fetches it. `ttsProvider` is the library\n * voice's verified TTS provider (see `SharedVoice.recommendedProvider`) —\n * send it as the text-to-speech `provider` so the voice renders on a model\n * it's verified for. All optional — a character may have no voice, or a\n * legacy voice predating these fields. */\n voice: { voiceId: string; voiceName: string; traits: string; voiceType?: \"premade\" | \"library\" | \"custom\"; previewUrl?: string; ttsProvider?: TtsProvider } | null\n personality: {\n mood: string\n speechStyle: string\n movementStyle: string\n behavioralNotes: string\n } | null\n /** ~80–120-word LLM-authored visual caption (approve-portrait / recaption).\n * Optional on the read surface so existing literal consumers don't break;\n * the route always returns it (string | null). */\n canonicalDescription?: string | null\n /** Identity-lock strength for Character Studio asset generation. */\n identityLock?: \"off\" | \"soft\" | \"strict\"\n deletedAt: string | null\n createdAt: string\n updatedAt: string\n}\n\n/**\n * GET /v1/characters/:id appends three live-progress buckets the studio uses\n * to rehydrate spinners after a reload. Optional in the SDK surface — they\n * don't appear on `list()` rows.\n */\nexport interface CharacterDetail extends Character {\n pendingJobs?: Array<{\n jobId: string\n assetType: \"expressions\" | \"poses\" | \"angles\" | \"bodyAngles\" | \"lighting\" | \"motions\"\n name: string\n }>\n portraitCandidates?: Array<{\n jobId: string\n url: string | undefined\n progress: number\n status: string\n }>\n /** Recently completed portrait takes (7 days, newest first): at most 5\n * alternates, never the current portrait — plus, with\n * `get(id, { candidates: \"all\" })`, the current portrait's own take. */\n previousCandidates?: Array<{\n jobId: string\n url: string\n createdAt: string\n /** The image model the take was requested with. */\n provider?: string\n /** The aspect ratio the request sent explicitly; absent when the take\n * used the default ratio. */\n aspectRatio?: string\n /** `true` only on the current portrait's own take (returned with\n * `candidates: \"all\"`); `false` on the alternates. */\n isPortrait?: boolean\n }>\n}\n\n/** Options for `client.characters.get()`. */\nexport interface GetCharacterOptions {\n /**\n * `\"all\"`: `previousCandidates` also carries the current portrait's own\n * take, flagged `isPortrait: true`, when its job is within the 7-day window\n * (the alternates stay at most 5). Default `\"alternates\"`: the current\n * portrait is left out.\n */\n candidates?: \"alternates\" | \"all\"\n}\n\nexport type ReferencePhotoKind =\n | \"frontFace\"\n | \"sideLeft\"\n | \"sideRight\"\n | \"threeQuarterLeft\"\n | \"threeQuarterRight\"\n | \"frontBody\"\n | \"other\"\n\nexport interface ReferencePhoto {\n url: string\n kind: ReferencePhotoKind\n}\n\n/**\n * Body for `client.characters.upsert()`. Mirrors `upsertCharacterBody` in\n * `backend/src/routes/characters.ts`. Omitting `id` triggers an INSERT;\n * supplying it triggers an UPDATE that only writes the fields you pass —\n * undefined keys are NOT touched on the row.\n *\n * `name` is optional at the type level. The route requires `name` on INSERT\n * (id absent) and rejects with `validation_error` otherwise; on UPDATE the\n * route just ignores `name` when omitted, which lets partial updates like\n * `update(id, { gender: \"female\" })` succeed without re-sending the same\n * name the caller already has.\n */\nexport interface UpsertCharacterInput {\n /** UUID of the character row; omit to create. */\n id?: string\n /** Canvas node id the character belongs to. REQUIRED on create (the route\n * 400s without it, like `name`); optional on update — the update branch\n * never touches node_id, so partial updates needn't round-trip it. */\n nodeId?: string\n workflowId?: string\n projectId?: string\n name?: string\n description?: string\n gender?: string\n style?: string\n baseOutfit?: string\n sourceImageUrl?: string\n /** Persistent image-model id (a MODEL_CATALOG image model). Validated\n * server-side — unknown / non-image / \"\" is stored as `null`. */\n imageProvider?: string | null\n expressions?: Array<{ name: string; url: string }>\n poses?: Array<{ name: string; url: string }>\n lightingVariations?: Array<{ name: string; url: string }>\n angles?: Array<{ name: string; url: string }>\n bodyAngles?: Array<{ name: string; url: string }>\n motions?: Array<{ name: string; url: string }>\n /** Named Character Boards (see `Character.boards`) — whole-array replace,\n * like the asset buckets. Server caps: 24 boards, 200-char names, 30\n * sourceImages per board. */\n boards?: Array<{ name: string; url: string; type?: \"looks\" | \"identity\"; sourceImages?: string[] }>\n /** See `Character.voice` — persisted alongside the voice so TTS can resolve a\n * library/custom voice by id, `previewUrl` keeps the sample playable after\n * reload, and `ttsProvider` keeps generation on a model the voice is\n * verified for. All optional. */\n voice?: { voiceId: string; voiceName: string; traits: string; voiceType?: \"premade\" | \"library\" | \"custom\"; previewUrl?: string; ttsProvider?: TtsProvider } | null\n personality?: {\n mood: string\n speechStyle: string\n movementStyle: string\n behavioralNotes: string\n } | null\n seedPrompt?: string\n canonicalDescription?: string\n /** Identity-lock strength for Character Studio asset generation (off/soft/strict). */\n identityLock?: \"off\" | \"soft\" | \"strict\"\n referencePhotos?: ReferencePhoto[]\n /** Per-variant real-life reference URLs. Keys are lowercased+trimmed server-side. */\n realLifeRefsByVariant?: Record<string, string[]>\n /** Per-label user-uploaded reference VIDEO URLs (e.g. emotion takes). Keys\n * are lowercased+trimmed server-side; max 20 keys, 5 URLs each. Stored R2\n * URLs are read back off the row to drive generate-video's\n * `referenceVideoUrls`. */\n referenceVideosByVariant?: Record<string, string[]>\n /** The user's chosen DEFAULT asset take per variant. OPAQUE\n * `\"<bucket>:<variant>\"` → chosen-URL map; a write REPLACES the whole map\n * (the studio sends the full map each save). Omit to leave the row untouched.\n * Keys stored verbatim; soft-capped server-side at 200 keys / 2048-char values. */\n selectedAssetByVariant?: Record<string, string>\n}\n\nexport interface UpsertCharacterResult {\n id: string\n name?: string\n}\n\nexport interface ListCharactersParams {\n /** Restrict to a single project. */\n projectId?: string\n /** When true, return archived characters instead of active ones. */\n archived?: boolean\n /**\n * Search words: only the characters whose name or description contains\n * every word (split on spaces, the first 5), in any order, ignoring case —\n * `\"red car\"` finds \"Car, red\". Each word is matched as written (`%`, `_`\n * and `*` are not wildcards; punctuation is kept); blank means no search; up\n * to 200 characters. Combines with the other filters and with `cursor`\n * paging.\n */\n q?: string\n /**\n * Max rows to return. Server defaults to 100, caps at 500. Omit to take the\n * server default — passing it just narrows further.\n */\n limit?: number\n /** Opaque cursor from a prior page's `nextCursor` (fetches the next page). */\n cursor?: string\n}\n\nexport interface ListCharactersResult {\n characters: Character[]\n /** Pass back as `cursor` for the next page; `null` when there are no more. */\n nextCursor: string | null\n}\n\nexport interface DuplicateCharacterInput {\n /** Optional canvas node id to bind the new row to. */\n nodeId?: string\n /** Optional project to drop the new row into. */\n projectId?: string\n}\n\nexport interface CharacterUsage {\n workflowCount: number\n workflows: Array<{ id: string; name: string }>\n}\n\n/**\n * Input for `client.characters.generate()` — fires the\n * `POST /v1/generate-character` route. Produces 1–10 portrait candidates;\n * each lands as one `jobs` row in `pending` state and is then enqueued for\n * the worker.\n *\n * Provide at least one of `seedPrompt`, `referencePhotos`, or `description`\n * (the backend's refinement rejects empty input with `validation_error`).\n *\n * When `attachToCharacterId` is set, the worker writes the resulting URL\n * directly to `characters.source_image_url` on completion — caller doesn't\n * need a separate `approvePortrait` call for single-candidate runs. Pass\n * `attachPortrait: false` to keep every take a candidate instead.\n */\nexport interface GenerateCharacterInput extends GenerationSessionParams {\n name: string\n description?: string\n userPrompt?: string\n gender?: string\n style?: EntityStyle\n baseOutfit?: string\n sourceImageUrl?: string\n provider?: string\n /** Auto-attach the result to this character row. */\n attachToCharacterId?: string\n /** `false`: the take stays a candidate; only the approve route\n * (`approvePortrait()`) sets the portrait. Omitted/`true`: the finished\n * take is written to the row's portrait. */\n attachPortrait?: boolean\n seedPrompt?: string\n /**\n * WHO the portrait shows — person, styling and props as picker-catalog ids\n * ({@link Subject}, the same type and bounds as `generateImage`'s). The\n * platform writes the wording and folds it into the portrait prompt after\n * `seedPrompt` (or `description`), so send ids rather than phrasing a pick\n * yourself. Not a prompt source on its own: one of `seedPrompt`,\n * `referencePhotos` or `description` is still required.\n */\n subject?: Subject\n referencePhotos?: ReferencePhoto[]\n /** Number of candidate images to generate (1–10; server-validated). */\n count?: number\n /**\n * Explicit aspect ratio. Highest precedence — overrides both the character\n * node toggle and the per-asset-type default (portraits default to `3:4`).\n * Must be one of the 4-value `CharacterAspectRatio` union.\n */\n aspectRatio?: CharacterAspectRatio\n /**\n * Character node toggle (per-canvas-node `defaultAssetAspectRatio`). Wins\n * against the per-asset-type default, loses to `aspectRatio`.\n */\n characterNodeAspectRatio?: CharacterAspectRatio\n /**\n * Credit-affecting quality tier (e.g. `\"high\"` for gpt-image). Priced like\n * generate-image (composite ids such as `gpt-image:high`); values the chosen\n * model doesn't support are ignored server-side, never rejected.\n */\n quality?: string\n /**\n * Credit-affecting output resolution (e.g. `\"2K\"` / `\"4K\"` / `\"2 MP\"`).\n * Priced like generate-image (composite ids such as `nano-banana-pro:4K`);\n * values the chosen model doesn't support are ignored server-side, never\n * rejected.\n */\n resolution?: string\n}\n\nexport interface GenerateCharacterResult {\n /** First job-id; convenience alias for `jobIds[0]`. */\n jobId: string\n /** All job-ids when `count > 1`. */\n jobIds: string[]\n}\n\nexport interface GenerateAssetInput extends GenerationSessionParams {\n assetType:\n | \"expressions\"\n | \"poses\"\n | \"lighting\"\n | \"angles\"\n | \"headAngles\"\n | \"bodyAngles\"\n | \"custom\"\n /** The named variant (e.g. `\"smile\"`, `\"standing\"`, `\"3/4 left\"`). */\n variant: string\n /** Display name of the character; appears in the prompt. */\n name: string\n description?: string\n userPrompt?: string\n gender?: string\n style?: EntityStyle\n baseOutfit?: string\n sourceImageUrl?: string\n /** Real-life reference URLs (cap 5). */\n realLifeRefs?: string[]\n provider?: string\n /** Auto-attach to character row + asset bucket on completion. */\n attachToCharacterId?: string\n /** Shared type — auto-includes new buckets (sheets/detail_closeups/outfit_variations); mirrors objects.ts/locations.ts. */\n attachToColumn?: CharacterAttachColumn\n attachName?: string\n /**\n * Explicit aspect ratio. Highest precedence — overrides both the character\n * node toggle and the per-asset-type default (expressions=1:1, poses=9:16,\n * headAngles=3:4, bodyAngles=9:16, lighting=3:4, angles=3:4, custom=3:4).\n */\n aspectRatio?: CharacterAspectRatio\n /**\n * Character node toggle (per-canvas-node `defaultAssetAspectRatio`). Wins\n * against the per-asset-type default, loses to `aspectRatio`.\n */\n characterNodeAspectRatio?: CharacterAspectRatio\n /**\n * Credit-affecting quality tier (e.g. `\"high\"` for gpt-image). Values the\n * chosen model doesn't support are ignored server-side, never rejected.\n */\n quality?: string\n /**\n * Credit-affecting output resolution (e.g. `\"2K\"` / `\"4K\"` / `\"2 MP\"`).\n * Values the chosen model doesn't support are ignored server-side, never\n * rejected.\n */\n resolution?: string\n}\n\nexport interface GenerateMotionInput extends GenerationSessionParams {\n motionPrompt: string\n /** Optional when `attachToCharacterId` is set — falls back to the row's portrait. */\n sourceImageUrl?: string\n provider?: string\n name: string\n description?: string\n motionDescription?: string\n gender?: string\n style?: EntityStyle\n baseOutfit?: string\n realLifeRefs?: string[]\n attachToCharacterId?: string\n attachName?: string\n /**\n * Explicit aspect ratio. Highest precedence — overrides both the character\n * node toggle and the motions default (`9:16`).\n */\n aspectRatio?: CharacterAspectRatio\n /**\n * Character node toggle (per-canvas-node `defaultAssetAspectRatio`). Wins\n * against the motions default, loses to `aspectRatio`.\n */\n characterNodeAspectRatio?: CharacterAspectRatio\n}\n\nexport interface ApprovePortraitResult {\n portraitUrl: string\n /**\n * LLM-authored caption. `null` when the LLM call failed during the approval\n * — the portrait is still set; call `recaption()` to retry.\n */\n canonicalDescription: string | null\n}\n\nexport interface RecaptionResult {\n canonicalDescription: string\n}\n\n/**\n * Where a character's high-fidelity training stands. `untrained`: nothing was\n * ever trained, the trained model was removed (`deleteLora`), or a training\n * could not be started (`training_dispatch_failed` — refunded; this resets the\n * status even for a character trained before). `queued` / `training`: in\n * flight. `succeeded` / `failed` / `cancelled`: the last training's outcome.\n *\n * Generation uses the trained model only while the status is `succeeded`.\n */\nexport type CharacterTrainingState = \"untrained\" | \"queued\" | \"training\" | \"succeeded\" | \"failed\" | \"cancelled\"\n\n/** `GET /v1/characters/:id/training` — the character's training record. */\nexport interface CharacterTrainingStatus {\n status: CharacterTrainingState\n /** The provider's id for the latest training; `null` before the first one. */\n trainingId: string | null\n /** Why the last training failed, as the user may read it; `null` otherwise. */\n error: string | null\n /**\n * When the last successful training finished (ISO 8601). It stays set through\n * a re-train, a failed or cancelled one, or one that could not be started —\n * but the model is used only while `status` is `succeeded`.\n */\n trainedAt: string | null\n /** The last successful training's model version; set or not, used only while `status` is `succeeded`. */\n version: string | null\n /** The token added to prompts for this character (`TOK_<slug>_<6hex>`); generation adds it for you. */\n triggerWord: string | null\n /** How many images the latest training used. */\n imageCount: number | null\n}\n\n/** Body for `characters.train()`. */\nexport interface TrainCharacterInput {\n /**\n * Train on these of the character's images only (max 200 URLs; at most 20\n * are used). Omitted or empty: every eligible image — the portrait,\n * reference photos, expressions, poses, head and body angles and lighting\n * variations. At least 4 distinct images must remain either way.\n */\n selectedImageUrls?: string[]\n}\n\n/** `POST /v1/characters/:id/train` — answered 202 while the training runs. */\nexport interface TrainCharacterResult {\n /** The training's job; it ends `completed`, `failed` or `cancelled` with the training. */\n jobId: string\n /** The provider's id for this training (also on `trainingStatus().trainingId`). */\n trainingId: string\n /** The token added to prompts for this character once trained. */\n triggerWord: string\n}\n\n/**\n * The `code` of a `NodaroError` `train()` can throw beyond the typed classes\n * (`ForbiddenError` — an app token without `assets:write`, `missingScope`\n * says so; `InsufficientCreditsError`; `RateLimitedError`; `JobBlockedError`;\n * `UnauthorizedError`; …):\n *\n * - `insufficient_training_images` (400) — fewer than 4 distinct images; the\n * message says how many there are.\n * - `validation_error` (400) — a malformed id or `selectedImageUrls`.\n * - `already_training_or_not_found` (409) — a training is already in flight,\n * or the character is not yours / archived.\n * - `claim_failed` (500) — the training slot could not be claimed; nothing\n * started. Retry.\n * - `training_dispatch_failed` (502) — the training could not be started;\n * nothing is charged.\n * - `public_url_not_configured` (503) — the deployment cannot receive the\n * provider's completion call.\n * - `price_not_configured` (503) — the deployment has no price for training.\n * - `dedup_race_winner_unresolvable` (503) — a duplicate of this request was\n * in flight and its outcome could not be read; this one reserved nothing.\n * Read {@link CharactersResource.trainingStatus} before retrying.\n */\nexport type TrainCharacterRefusalCode =\n | \"insufficient_training_images\"\n | \"validation_error\"\n | \"already_training_or_not_found\"\n | \"claim_failed\"\n | \"training_dispatch_failed\"\n | \"public_url_not_configured\"\n | \"price_not_configured\"\n | \"dedup_race_winner_unresolvable\"\n\nexport class CharactersResource {\n constructor(private client: NodaroClientCore) {}\n\n /**\n * List the caller's characters. By default returns active characters only;\n * pass `archived: true` to fetch soft-deleted rows for an \"archive\" view.\n * When `projectId` is set, only characters belonging to that project are\n * returned; `q` keeps the ones whose name or description contains it.\n *\n * Cursor-paginated: a response carrying a non-null `nextCursor` means more\n * rows exist. Pass it back as `cursor` to fetch the next page, and keep going\n * until `nextCursor` is `null` — a single call returns at most `limit` rows\n * (default 100), so treating one call as \"all characters\" silently truncates\n * the list for anyone past that count.\n *\n * ```ts\n * const all: Character[] = []\n * let cursor: string | undefined\n * do {\n * const page = await client.characters.list({ cursor })\n * all.push(...page.characters)\n * cursor = page.nextCursor ?? undefined\n * } while (cursor)\n * ```\n */\n list(params: ListCharactersParams = {}): Promise<ListCharactersResult> {\n const query: Record<string, string | undefined> = {}\n if (params.projectId) query.projectId = params.projectId\n if (params.archived) query.archived = \"true\"\n if (params.q) query.q = params.q\n if (params.limit !== undefined) query.limit = String(params.limit)\n if (params.cursor) query.cursor = params.cursor\n return this.client.request(\"GET\", \"/v1/characters\", { query })\n }\n\n /**\n * Fetch a single character including in-flight portrait / asset job state.\n * Soft-deleted (archived) rows are returned by id intentionally so canvas\n * nodes that hold a stale `characterDbId` keep loading. Pass\n * `{ candidates: \"all\" }` to also get the current portrait's own take in\n * `previousCandidates` (flagged `isPortrait: true`).\n */\n get(id: string, options: GetCharacterOptions = {}): Promise<CharacterDetail> {\n const query: Record<string, string | undefined> = {}\n if (options.candidates) query.candidates = options.candidates\n return this.client.request(\"GET\", `/v1/characters/${encodeURIComponent(id)}`, { query })\n }\n\n /**\n * Create or update a character. Omit `id` to create; supply it to update\n * (only the fields you pass get written — undefined keys are untouched).\n *\n * If the caller-supplied `name` collides with an existing active character\n * for this user, the request returns 409 `name_taken`. To auto-number a\n * placeholder, pass the placeholder name from `@nodaro/shared` and the\n * server will derive \"Untitled character 2\", \"Untitled character 3\", etc.\n */\n upsert(input: UpsertCharacterInput): Promise<UpsertCharacterResult> {\n return this.client.request(\"POST\", \"/v1/characters\", { body: input })\n }\n\n /**\n * Convenience wrapper around `upsert()` for creating new characters.\n * Equivalent to `upsert({ ...input, id: undefined })`. `name` is REQUIRED\n * on create — the route 400s on INSERT-without-name; we narrow the type\n * here so callers fail at compile-time rather than runtime.\n */\n create(\n input: Omit<UpsertCharacterInput, \"id\"> & { name: string },\n ): Promise<UpsertCharacterResult> {\n return this.upsert(input)\n }\n\n /**\n * Convenience wrapper around `upsert()` for updating an existing character.\n * Equivalent to `upsert({ ...input, id })`.\n */\n update(\n id: string,\n input: Omit<UpsertCharacterInput, \"id\">,\n ): Promise<UpsertCharacterResult> {\n return this.upsert({ ...input, id })\n }\n\n /**\n * Soft-delete (archive) a character. The row is hidden from `list()` by\n * default but still loadable via `get(id)` so canvas nodes pointing at it\n * keep working. Restore with `restore(id)`.\n */\n delete(id: string): Promise<{ success: true; archived: true }> {\n return this.client.request(\"DELETE\", `/v1/characters/${encodeURIComponent(id)}`)\n }\n\n /**\n * Un-archive a character. If the original name now collides with an\n * active row, the server auto-suffixes \"(restored)\" and returns the\n * effective name.\n */\n restore(id: string): Promise<{ id: string; name: string }> {\n return this.client.request(\"POST\", `/v1/characters/${encodeURIComponent(id)}/restore`)\n }\n\n /**\n * Duplicate (fork) a character to a new row with a `\"(copy)\"` suffix.\n * Asset URLs are shared by reference — the new row can diverge by\n * regenerating any of them.\n */\n duplicate(id: string, input: DuplicateCharacterInput = {}): Promise<{ id: string; name: string }> {\n return this.client.request(\n \"POST\",\n `/v1/characters/${encodeURIComponent(id)}/duplicate`,\n { body: input },\n )\n }\n\n /**\n * Count of the caller's workflows that reference this character. Powers the\n * library \"Archive\" confirmation modal in the editor.\n */\n usage(id: string): Promise<CharacterUsage> {\n return this.client.request(\"GET\", `/v1/characters/${encodeURIComponent(id)}/usage`)\n }\n\n /**\n * Admin only: put one of your own characters on the shared Nodaro Keepers\n * shelf (`client.keepers.catalog()`), or take it off. A first-party session\n * or your personal token; `forbidden` for anyone who is not a platform\n * admin, `not_found` for a row that is not yours.\n */\n setCatalog(id: string, input: SetKeeperCatalogInput): Promise<SetKeeperCatalogResult> {\n return this.client.request(\"PUT\", `/v1/characters/${encodeURIComponent(id)}/catalog`, { body: input })\n }\n\n /**\n * Fire `POST /v1/generate-character` to produce one or more portrait\n * candidates. With `count > 1`, all jobs are reserved up-front before any\n * is enqueued — mid-batch failures roll back atomically.\n *\n * When `attachToCharacterId` is set, the worker writes the result directly\n * to the row's `source_image_url` (unless `attachPortrait: false`);\n * otherwise you must call `approvePortrait()` after picking a candidate.\n */\n generate(input: GenerateCharacterInput): Promise<GenerateCharacterResult> {\n return this.client.request(\"POST\", \"/v1/generate-character\", { body: input })\n }\n\n /**\n * Fire `POST /v1/generate-character-asset` to produce a single\n * expression / pose / angle / lighting variant. When the studio path is\n * set (`attachToCharacterId` + `attachToColumn` + `attachName`), the\n * worker appends `{ name: attachName, url: <result> }` to the named\n * JSONB array column on completion.\n */\n generateAsset(input: GenerateAssetInput): Promise<{ jobId: string }> {\n return this.client.request(\"POST\", \"/v1/generate-character-asset\", { body: input })\n }\n\n /**\n * Fire `POST /v1/generate-character-motion` to animate the character's\n * portrait into a motion clip. The result is appended to the character's\n * `motions[]` bucket when `attachToCharacterId` is set.\n */\n generateMotion(input: GenerateMotionInput): Promise<{ jobId: string }> {\n return this.client.request(\"POST\", \"/v1/generate-character-motion\", { body: input })\n }\n\n /**\n * Approve a completed `generate-character` job as the character's portrait.\n * Sets `source_image_url` and fires the LLM caption (Claude Sonnet vision)\n * inline. Returns the new portrait URL plus the caption — `canonicalDescription`\n * is `null` if the LLM call sub-failed (portrait still set; retry via `recaption()`).\n */\n approvePortrait(id: string, candidateJobId: string): Promise<ApprovePortraitResult> {\n return this.client.request(\n \"POST\",\n `/v1/characters/${encodeURIComponent(id)}/approve-portrait`,\n { body: { candidateJobId } },\n )\n }\n\n /**\n * Re-fire the LLM caption against the character's current portrait. 502s on\n * LLM failure; returns 400 `no_portrait` if no portrait is set yet.\n */\n recaption(id: string): Promise<RecaptionResult> {\n return this.client.request(\n \"POST\",\n `/v1/characters/${encodeURIComponent(id)}/llm-caption`,\n )\n }\n\n /**\n * Start training a high-fidelity model of the character on its own images\n * (Nodaro Cloud only — other editions answer `NotFoundError`). Reserves the\n * training price up front and refunds it if the training fails or is\n * cancelled. Resolves at once (202); a training takes about 15 minutes —\n * follow it with {@link trainingStatus}. Once it succeeds, a workflow's\n * Generate Image node whose prompt @-mentions this one character runs on the\n * trained model.\n *\n * An OAuth app token needs the `assets:write` scope (`ForbiddenError`\n * otherwise, before anything is reserved); a session or personal API key\n * needs none. Refusals are `NodaroError`s whose `code` is a\n * {@link TrainCharacterRefusalCode}; rate-limited to 3 calls a minute.\n */\n train(id: string, input: TrainCharacterInput = {}): Promise<TrainCharacterResult> {\n return this.client.request(\"POST\", `/v1/characters/${encodeURIComponent(id)}/train`, { body: input })\n }\n\n /**\n * The character's training record (Nodaro Cloud only). Poll it while\n * `status` is `queued` or `training` — every 10 s or so is plenty.\n */\n trainingStatus(id: string): Promise<CharacterTrainingStatus> {\n return this.client.request(\"GET\", `/v1/characters/${encodeURIComponent(id)}/training`)\n }\n\n /**\n * Remove the character's trained model (Nodaro Cloud only): cancels a\n * training in flight and refunds its reservation, deletes the model, and\n * clears the training record (`trainingStatus` then reads `untrained`).\n * Generations go back to reference images. Cannot be undone — a new model\n * means a new, paid training. An OAuth app token needs the `assets:write`\n * scope (`ForbiddenError` otherwise), like deleting the character.\n */\n async deleteLora(id: string): Promise<void> {\n await this.client.request(\"DELETE\", `/v1/characters/${encodeURIComponent(id)}/lora`)\n }\n}\n\n/** Person catalog + hint helpers, re-exported from @nodaro/prompts (FSL-licensed). */\nexport { buildPersonHints, PEOPLE, PERSON_DIMENSION_ORDER, PERSON_DIMENSION_LABELS }\nexport type { PersonValue }\n\n/**\n * Collapse a PersonValue into the comma-joined seed-prompt fragment used by\n * `characters.generate({ seedPrompt })` — same composition the Nodaro editor\n * performs. Powered by @nodaro/prompts.\n */\nexport function buildPersonSeedPrompt(value: PersonValue): string {\n return buildPersonHints(value as Record<string, unknown> & PersonValue).join(\", \")\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resources/objects.ts"],"names":[],"mappings":";;;AAyYO,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAAoB,MAAA,EAA0B;AAA1B,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAA2B;AAAA,EAA3B,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,E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B,EAAE,CAAC,CAAA,mBAAA,CAAA;AAAA,MACrC,EAAE,IAAA,EAAM,EAAE,cAAA,EAAgB,mBAAkB;AAAE,KAChD;AAGA,IAAA,OAAO,EAAE,cAAA,EAAgB,GAAA,CAAI,gBAAgB,oBAAA,EAAsB,GAAA,CAAI,wBAAwB,IAAA,EAAK;AAAA,EACtG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,UAAU,EAAA,EAA4C;AACpD,IAAA,OAAO,KAAK,MAAA,CAAO,OAAA;AAAA,MACjB,MAAA;AAAA,MACA,CAAA,YAAA,EAAe,kBAAA,CAAmB,EAAE,CAAC,CAAA,YAAA;AAAA,KACvC;AAAA,EACF;AACF","file":"chunk-QGVOAPUI.js","sourcesContent":["import type { ObjectAspectRatio, ObjectAssetType, ObjectAttachColumn } from \"@nodaro/shared/entities\"\nexport type { ObjectAssetType, ObjectAttachColumn, ObjectAspectRatio } from \"@nodaro/shared/entities\"\nexport { OBJECT_ASSET_TYPES, OBJECT_ATTACH_COLUMNS, OBJECT_ASPECT_OPTIONS, OBJECT_ASPECT_DEFAULTS } from \"@nodaro/shared/entities\"\nimport type { NodaroClientCore } from \"../core.js\"\nimport type { SetKeeperCatalogInput, SetKeeperCatalogResult } from \"./keepers.js\"\nimport type { GenerationSessionParams } from \"./nodes.js\"\n\n/**\n * Re-export the shared `ObjectAssetType` / `ObjectAttachColumn` unions and\n * their runtime tuples so SDK consumers don't have to add `@nodaro/shared` as\n * a second dependency just to typecheck the `assetType` / `attachToColumn`\n * fields. Single source of truth lives in `@nodaro/shared/entity-prompts`.\n *\n * `ObjectAspectRatio` is re-exported alongside them — `generateMotion`'s\n * `aspectRatio` field is the 5-value object enum (1:1 / 3:4 / 16:9 / 9:16 /\n * 4:3) from `@nodaro/shared/object-aspect-defaults`. Distinct from\n * `CharacterAspectRatio` because objects support an extra 4:3 framing for\n * product-showcase shots.\n */\n\n/**\n * Reference-photo kind discriminator — the mood-board roles a user can attach\n * to an object. Mirrors the `reference_photos.kind` field accepted by\n * `backend/src/routes/objects.ts` (the route accepts open strings; this SDK\n * type narrows to the 6 canonical roles surfaced by the Studio). `other` is\n * the free-form bucket.\n */\nexport type ObjectReferencePhotoKind =\n | \"front\"\n | \"side\"\n | \"detail\"\n | \"context\"\n | \"moodBoard\"\n | \"other\"\n\nexport interface ObjectReferencePhoto {\n url: string\n kind: ObjectReferencePhotoKind\n}\n\n/**\n * An object record returned by Nodaro's REST API. Mirrors the camelCase\n * shape produced by `backend/src/routes/objects.ts::toCamel()`.\n *\n * Asset buckets (`angles`, `materials`, `variations`, `motionClips`) are\n * independent JSONB arrays keyed by a human-readable variant name (e.g.\n * `\"front\"`, `\"wood\"`, `\"weathered\"`). Each entry's `url` points at an\n * R2-hosted asset.\n *\n * Identity-foundation fields:\n * - `referencePhotos` — caller-supplied mood-board refs (cap 20). Objects\n * do NOT carry a `piiConsentAt` field (location Phase 2 #7 only).\n * - `canonicalDescription` — ~80–120-word LLM-authored visual caption,\n * populated by `approveMainImage()` / `recaption()`. The wire still sends\n * `\"\"` on caption sub-failure (the breaking wire change is deferred to a\n * major bump), but `get()` normalizes `\"\"` → `null` so consumers see the\n * same `string | null` semantics as characters.\n * - `styleLock` — whether asset gens should anchor to the canonical style\n * captured at approval time. Defaults to `true` on new rows.\n *\n * `Object` shadows the JS global, which TypeScript handles cleanly via\n * local-scope resolution. Consumers who need both can alias as\n * `import type { Object as NodaroObject } from \"@nodaro/sdk\"`.\n */\nexport interface Object {\n id: string\n userId: string\n nodeId: string\n projectId: string | null\n name: string\n description: string | null\n category: string | null\n style: string | null\n sourceImageUrl: string | null\n /** MODEL_CATALOG image-model id the main image was generated with (or `null`).\n * Set on create + editable via the update route. */\n imageProvider: string | null\n angles: Array<{ name: string; url: string }>\n materials: Array<{ name: string; url: string }>\n variations: Array<{ name: string; url: string }>\n motionClips: Array<{ name: string; url: string }>\n /** Named Product Boards — dense reference sheets, one per variant/colorway\n * (the `generate-image/product-board` factory preset rendered from the\n * object's images). A first-class bucket: community publish snapshots it\n * and clone hands the consumer their own copy to extend. Defaults to `[]`.\n * `type` marks an image-collage `\"identity\"` sheet vs a plain `\"looks\"`\n * board; `sourceImages` are the R2 URLs it was collaged from. Both optional\n * + backward-compatible (legacy boards have neither). */\n boards?: Array<{ name: string; url: string; type?: \"looks\" | \"identity\"; sourceImages?: string[] }> | null\n referencePhotos: ObjectReferencePhoto[]\n /** `null` when no caption is set (or the LLM caption sub-failed) — the wire\n * sends `\"\"`, normalized to `null` in `get()` to match character semantics. */\n canonicalDescription: string | null\n styleLock: boolean\n /** The user's chosen DEFAULT asset take per variant (Studio version history).\n * OPAQUE map: key `\"<bucket>:<variant>\"` (e.g. `\"angles:front\"`) → the chosen\n * asset URL (one already present in that bucket). Stored verbatim — keys are\n * NOT normalized; soft-capped server-side at 200 keys / 2048-char values\n * (overflow dropped silently). Defaults to `{}`. */\n selectedAssetByVariant?: Record<string, string> | null\n deletedAt: string | null\n createdAt: string\n updatedAt: string\n}\n\n/**\n * GET /v1/objects/:id may append a `pendingJobs` bucket the studio uses to\n * rehydrate spinners after a reload. Optional on the SDK surface — it doesn't\n * appear on `list()` rows.\n */\nexport interface ObjectDetail extends Object {\n pendingJobs?: Array<{\n jobId: string\n assetType: string\n name: string\n status: string\n }>\n}\n\n/**\n * Body for `client.objects.create()`. Mirrors the INSERT branch of\n * `upsertObjectBody` in `backend/src/routes/objects.ts`. `name` + `nodeId`\n * are required on create.\n */\nexport interface CreateObjectInput {\n nodeId: string\n name: string\n description?: string\n category?: ObjectCategory\n style?: string\n workflowId?: string\n projectId?: string\n sourceImageUrl?: string\n /** Persistent image-model id (a MODEL_CATALOG image model). Validated\n * server-side — unknown / non-image / \"\" is stored as `null`. */\n imageProvider?: string | null\n referencePhotos?: ObjectReferencePhoto[]\n canonicalDescription?: string\n styleLock?: boolean\n /** The user's chosen DEFAULT asset take per variant. OPAQUE\n * `\"<bucket>:<variant>\"` → chosen-URL map; a write REPLACES the whole map.\n * Keys stored verbatim; soft-capped server-side at 200 keys / 2048-char values. */\n selectedAssetByVariant?: Record<string, string>\n}\n\n/**\n * The 10-value Object category enum. Mirrors the literal accepted by\n * `POST /v1/generate-object` and surfaced in the Object Studio category\n * picker. Distinct from location's geography-based set.\n */\nexport type ObjectCategory =\n | \"furniture\"\n | \"vehicle\"\n | \"weapon\"\n | \"food\"\n | \"clothing\"\n | \"electronics\"\n | \"nature\"\n | \"tool\"\n | \"animal\"\n | \"other\"\n\n/**\n * Body for `client.objects.update()`. Mirrors the UPDATE branch of\n * `upsertObjectBody` in `backend/src/routes/objects.ts`.\n *\n * Worker-owned asset buckets (`angles` / `materials` / `variations` /\n * `motionClips`) are deliberately omitted — the route drops them on UPDATE\n * so a Studio auto-save with a stale snapshot cannot clobber the worker's\n * atomic `append_object_asset()` writes.\n *\n * `expectedUpdatedAt` is the optimistic-concurrency token: when present, the\n * UPDATE only succeeds if the row's `updated_at` still matches; on mismatch\n * the route returns 409 so the studio can re-fetch + merge.\n */\nexport interface UpdateObjectInput {\n name?: string\n description?: string\n category?: ObjectCategory\n style?: string\n sourceImageUrl?: string\n /** Persistent image-model id (a MODEL_CATALOG image model). Validated\n * server-side — unknown / non-image / \"\" is stored as `null`. */\n imageProvider?: string | null\n referencePhotos?: ObjectReferencePhoto[]\n canonicalDescription?: string\n styleLock?: boolean\n /** The user's chosen DEFAULT asset take per variant. OPAQUE\n * `\"<bucket>:<variant>\"` → chosen-URL map; a write REPLACES the whole map\n * (omit to leave untouched). Keys stored verbatim; soft-capped server-side\n * at 200 keys / 2048-char values. */\n selectedAssetByVariant?: Record<string, string>\n /** Named Product Boards (see `Object.boards`) — whole-array replace,\n * USER-owned (unlike the worker-owned buckets it flows through UPDATE).\n * Server caps: 24 boards, 200-char names, 30 sourceImages per board. */\n boards?: Array<{ name: string; url: string; type?: \"looks\" | \"identity\"; sourceImages?: string[] }>\n expectedUpdatedAt?: string\n}\n\nexport interface UpdateObjectResult {\n id: string\n updatedAt: string\n}\n\n/**\n * Combined create + update body (parameter for both branches). Exported for\n * callers that want to drive a single `upsert` flow without picking between\n * `Create*` and `Update*`. Mirrors the `upsertObjectBody` Zod schema in\n * `backend/src/routes/objects.ts`. `nodeId` + `name` are required on INSERT;\n * `id` flips the route into UPDATE mode.\n */\nexport interface UpsertObjectInput extends CreateObjectInput {\n id?: string\n expectedUpdatedAt?: string\n}\n\nexport type UpsertObjectResult = { id: string } | UpdateObjectResult\n\nexport interface ListObjectsParams {\n /** When true, return archived objects instead of active ones. */\n archived?: boolean\n /** Optional project filter — server-scoped to the caller's user. */\n projectId?: string\n /**\n * Search words: only the objects whose name or description contains every\n * word (split on spaces, the first 5), in any order, ignoring case. Each\n * word is matched as written (`%`, `_` and `*` are not wildcards;\n * punctuation is kept); blank means no search; up to 200 characters.\n * Combines with the other filters and with `cursor` paging.\n */\n q?: string\n /**\n * Max rows to return (cap 500). OPT-IN: omitted, the server returns the\n * full legacy listing with no `nextCursor`; supplied, the response is one\n * page plus `nextCursor` — keep passing it back until it is `null`.\n */\n limit?: number\n /** Opaque cursor from a prior page's `nextCursor` (fetches the next page). */\n cursor?: string\n}\n\n/**\n * Input for `client.objects.generate()` — fires the\n * `POST /v1/generate-object` route. Produces 1–10 candidate\n * main images; each lands as one `jobs` row in `pending` state and is then\n * enqueued for the worker.\n *\n * When `attachToObjectId` is set AND `count === 1`, the worker writes the\n * resulting URL directly to `objects.source_image_url` on completion —\n * caller doesn't need a separate `approveMainImage` call. Multi-candidate\n * batches MUST go through explicit approval so the user picks the winner.\n *\n * `seedPromptHint` (Pass 7 F-77) flows the parameter-picker's prompt fragment\n * through to the worker so a catalog selection (e.g. \"antique brass lantern\")\n * gets appended to the generated prompt context.\n */\nexport interface GenerateObjectInput extends GenerationSessionParams {\n name: string\n description?: string\n userPrompt?: string\n category?: ObjectCategory\n style?: \"realistic\" | \"anime\" | \"3d-pixar\" | \"illustration\"\n sourceImageUrl?: string\n provider?: string\n /** Number of candidate images to generate (1–10; server-validated). */\n count?: number\n /** Auto-attach the result to this object row (single-candidate only). */\n attachToObjectId?: string\n /** Parameter-picker prompt-fragment pass-through. */\n seedPromptHint?: string\n /** Optional name to set on the attached row alongside the main image. */\n attachName?: string\n /** Optimistic-concurrency token for the single-candidate auto-attach path. */\n expectedUpdatedAt?: string\n}\n\n/**\n * `generate()` response — `jobIds` is ALWAYS present (the harmonized contract,\n * matching characters). `jobId` is a deprecated back-compat alias populated only\n * on `count === 1`; prefer `jobIds`. (Will be removed on the next major.)\n */\nexport interface GenerateObjectResult {\n jobIds: string[]\n /** @deprecated count===1 back-compat alias — use `jobIds`. */\n jobId?: string\n}\n\n/**\n * Input for `client.objects.generateAsset()` — fires the\n * `POST /v1/generate-object-asset` route. Produces a single\n * angles / materials / variations / custom variant.\n *\n * When all three studio-path fields are set (`attachToObjectId` +\n * `attachToColumn` + `attachName`), the worker appends\n * `{ name: attachName, url: <result> }` to the named JSONB array column on\n * the user's object row on completion. `attachToColumn` is REQUIRED for\n * `assetType === \"custom\"` — the worker can't infer the bucket from the\n * asset type.\n */\nexport interface GenerateObjectAssetInput extends GenerationSessionParams {\n assetType: ObjectAssetType\n variant: string\n name: string\n description?: string\n userPrompt?: string\n category?: string\n style?: \"realistic\" | \"anime\" | \"3d-pixar\" | \"illustration\"\n sourceImageUrl?: string\n provider?: string\n attachToObjectId?: string\n attachToColumn?: ObjectAttachColumn\n attachName?: string\n /** Parameter-picker prompt-fragment pass-through (Pass 7 F-77). */\n seedPromptHint?: string\n}\n\nexport interface GenerateObjectAssetResult {\n jobId: string\n}\n\n/**\n * Input for `client.objects.generateMotion()` — fires the\n * `POST /v1/generate-object-motion` route. Produces a single motion clip\n * (rotation, orbit, hover, drift, etc.) animated FROM a static product-shot\n * image.\n *\n * Mirrors `client.locations.generateMotion()` minus the location-specific\n * atmospheric fields. The route hardcodes the attach column to `motion_clips`\n * — callers supply `attachToObjectId` + `attachName` only.\n *\n * `sourceImageUrl` is REQUIRED — image-to-video needs a source frame and the\n * route has no fallback (no `source_image_url` column to pull from on the\n * objects row at this point in the flow; the studio path supplies the\n * canonical product-shot URL explicitly).\n *\n * Object-specific defaults vs location:\n * - `provider` defaults to `\"kling-turbo\"` (not location's `\"kling\"`)\n * - `aspectRatio` defaults to `\"1:1\"` server-side via\n * `resolveObjectAspectRatio({ assetType: \"motion\" })` — objects are\n * product-showcase framing, not cinematic establishing shots.\n *\n * When the studio path is set (`attachToObjectId` + `attachName`), the\n * worker appends `{ name: attachName, url: <result> }` to the object row's\n * `motion_clips` JSONB column on completion.\n */\nexport interface GenerateObjectMotionInput extends GenerationSessionParams {\n motionPrompt: string\n sourceImageUrl: string\n provider?: string\n name: string\n /** Source clip URL — when set, worker routes to video-to-video refine. */\n refineFromVideoUrl?: string\n category?: string\n style?: \"realistic\" | \"anime\" | \"3d-pixar\" | \"illustration\"\n canonicalDescription?: string\n /** Parameter-picker prompt-fragment pass-through (Pass 7 F-77). */\n seedPromptHint?: string\n attachToObjectId?: string\n attachName?: string\n /**\n * Optional aspect ratio override. Defaults to 1:1 server-side. One of the\n * 5-value `ObjectAspectRatio` union (1:1 / 3:4 / 16:9 / 9:16 / 4:3) —\n * objects have their own enum (with 4:3 added) vs the character set.\n */\n aspectRatio?: ObjectAspectRatio\n /**\n * Optional clip duration in seconds. Validated server-side against the chosen\n * provider's allowed durations (e.g. kling 5/10, wan-i2v 5/10/15); omitted →\n * the model's own default (no behavior change). Mirrors generate-video's\n * per-model i2v duration lever.\n */\n duration?: number\n}\n\nexport interface GenerateObjectMotionResult {\n jobId: string\n}\n\nexport interface ApproveObjectMainImageResult {\n sourceImageUrl: string\n /**\n * LLM-authored caption. `null` when the LLM caption sub-failed — the wire\n * sends `\"\"`, normalized to `null` here so consumers see the same\n * `string | null` semantics as characters. The main image is still set; call\n * `recaption()` to retry.\n */\n canonicalDescription: string | null\n}\n\nexport interface RecaptionObjectResult {\n canonicalDescription: string\n}\n\nexport class ObjectsResource {\n constructor(private client: NodaroClientCore) {}\n\n /**\n * List the caller's objects. By default returns active objects only;\n * pass `archived: true` to fetch soft-deleted rows for an \"archive\" view.\n * Optional `projectId` scopes the result to a single project; `q` keeps the\n * objects whose name or description contains it.\n */\n list(params: ListObjectsParams = {}): Promise<{ objects: Object[]; nextCursor?: string | null }> {\n const query: Record<string, string | undefined> = {}\n if (params.archived) query.archived = \"true\"\n if (params.projectId) query.projectId = params.projectId\n if (params.q) query.q = params.q\n if (params.limit !== undefined) query.limit = String(params.limit)\n if (params.cursor) query.cursor = params.cursor\n return this.client.request(\"GET\", \"/v1/objects\", { query })\n }\n\n /**\n * Convenience wrapper for `list({ archived: true })`. Returns soft-deleted\n * rows so callers can drive a UI \"Archived\" tab without re-encoding the\n * query param.\n *\n * `archived` is omitted from the param type — it's always set to `true` here.\n */\n listArchived(params: Omit<ListObjectsParams, \"archived\"> = {}): Promise<{ objects: Object[]; nextCursor?: string | null }> {\n return this.list({ ...params, archived: true })\n }\n\n /**\n * Fetch a single object including in-flight asset job state. Soft-deleted\n * (archived) rows are NOT returned by id — the route enforces\n * `deleted_at IS NULL` so archived objects 404 (uniform Pass 10 F-90b\n * \"not_found\" — does not leak the deleted vs non-existent distinction).\n */\n async get(id: string): Promise<ObjectDetail> {\n const res = await this.client.request<ObjectDetail>(\n \"GET\",\n `/v1/objects/${encodeURIComponent(id)}`,\n )\n // Normalize the wire `\"\"` caption (DB null / LLM sub-failure) → null so\n // consumers see the same `string | null` semantics as characters. New\n // object — never mutate the response.\n return { ...res, canonicalDescription: res.canonicalDescription || null }\n }\n\n /**\n * Create a new object. `name` + `nodeId` are required — the route 400s\n * otherwise. Returns the new row's id.\n *\n * Note: the underlying route is the same `POST /v1/objects` upsert that\n * powers `update()`. This convenience wrapper enforces the INSERT-required\n * fields at the type level and never sends an `id`.\n */\n create(data: CreateObjectInput): Promise<{ id: string }> {\n return this.client.request(\"POST\", \"/v1/objects\", { body: data })\n }\n\n /**\n * Update an object. Only the fields you pass are written — undefined keys\n * are NOT touched on the row. Worker-owned asset buckets are intentionally\n * not exposed on this surface (see `UpdateObjectInput` for the rationale).\n *\n * Optimistic-concurrency: pass `expectedUpdatedAt` to require the row's\n * `updated_at` still matches; on mismatch the route returns 409\n * `concurrent_modification` carrying the fresh `updatedAt`. The SDK\n * surfaces that as a generic `NodaroError` with the same code (per Phase\n * E1 calibration finding — error centralization in `throwApiError`).\n */\n update(id: string, data: UpdateObjectInput): Promise<UpdateObjectResult> {\n return this.client.request(\"POST\", \"/v1/objects\", {\n body: { id, ...data },\n })\n }\n\n /**\n * Soft-delete (archive) an object. The row is hidden from `list()` by\n * default but recoverable via `restore(id)` or visible under\n * `listArchived()`. Idempotent — repeating a delete on an already-archived\n * row is a no-op.\n */\n delete(id: string): Promise<{ success: true; archived: true }> {\n return this.client.request(\"DELETE\", `/v1/objects/${encodeURIComponent(id)}`)\n }\n\n /**\n * Hard-delete (permanent) an object — the row + every R2 asset it\n * references. Archived rows ONLY: active objects return 400 `not_archived`.\n * Call `delete()` first to archive, then `permanentDelete()` to destroy.\n *\n * Mirrors the `app_runs` permanent-delete pattern (archive-first) so a\n * stray SDK / curl caller cannot bypass the studio's archive-first UI\n * flow.\n */\n permanentDelete(id: string): Promise<{ success: true; permanent: true }> {\n return this.client.request(\"DELETE\", `/v1/objects/${encodeURIComponent(id)}`, {\n query: { permanent: \"true\" },\n })\n }\n\n /**\n * Un-archive an object. If the original name now collides (case-\n * insensitive) with an active row, the server auto-suffixes \"(restored)\"\n * and returns the effective name.\n */\n restore(id: string): Promise<{ id: string; name: string }> {\n return this.client.request(\"POST\", `/v1/objects/${encodeURIComponent(id)}/restore`)\n }\n\n /**\n * Admin only: put one of your own objects on the shared Nodaro Keepers\n * shelf (`client.keepers.catalog()`), or take it off. A first-party session\n * or your personal token; `forbidden` for anyone who is not a platform\n * admin, `not_found` for a row that is not yours.\n */\n setCatalog(id: string, input: SetKeeperCatalogInput): Promise<SetKeeperCatalogResult> {\n return this.client.request(\"PUT\", `/v1/objects/${encodeURIComponent(id)}/catalog`, { body: input })\n }\n\n /**\n * Fire `POST /v1/generate-object` to produce one or more candidate main\n * images. With `count > 1`, all jobs are reserved up-front before any\n * is enqueued — mid-batch failures roll back atomically.\n *\n * When `attachToObjectId` is set AND `count === 1`, the worker writes\n * the result directly to the row's `source_image_url`; otherwise you must\n * call `approveMainImage()` after picking a candidate.\n */\n async generate(data: GenerateObjectInput): Promise<GenerateObjectResult> {\n const res = await this.client.request<{ jobId?: string; jobIds?: string[] }>(\n \"POST\", \"/v1/generate-object\", { body: data },\n )\n // Tolerate the legacy `{ jobId }`-only shape (older server): synthesize jobIds.\n const jobIds = res.jobIds ?? (res.jobId ? [res.jobId] : [])\n return res.jobId ? { jobIds, jobId: res.jobId } : { jobIds }\n }\n\n /**\n * Fire `POST /v1/generate-object-asset` to produce a single variant.\n * When the studio path is set (`attachToObjectId` + `attachToColumn` +\n * `attachName`), the worker appends `{ name: attachName, url: <result> }`\n * to the named JSONB array column on completion.\n *\n * Note: `attachToColumn` is REQUIRED for `assetType === \"custom\"` — the\n * worker can't infer the bucket from the asset type. For canonical asset\n * types (`angles` / `materials` / `variations` / `motion`), the column is\n * derived automatically by the route.\n */\n generateAsset(\n data: GenerateObjectAssetInput,\n ): Promise<GenerateObjectAssetResult> {\n return this.client.request(\"POST\", \"/v1/generate-object-asset\", { body: data })\n }\n\n /**\n * Fire `POST /v1/generate-object-motion` to animate the object's main\n * image into a motion clip. Image-to-video, single clip per call; the\n * attach column is hardcoded to `motion_clips` server-side (objects have a\n * single motion bucket so the caller doesn't supply `attachToColumn`).\n * When the studio path is set (`attachToObjectId` + `attachName`), the\n * worker appends `{ name: attachName, url: <result> }` to the row's\n * `motion_clips` column on completion.\n *\n * Defaults: `provider` → `\"kling-turbo\"`, `aspectRatio` → `\"1:1\"` (set\n * server-side via `resolveObjectAspectRatio({ assetType: \"motion\" })`).\n */\n generateMotion(\n data: GenerateObjectMotionInput,\n ): Promise<GenerateObjectMotionResult> {\n return this.client.request(\"POST\", \"/v1/generate-object-motion\", { body: data })\n }\n\n /**\n * Approve a completed `generate-object` job as the object's main image.\n * Sets `source_image_url` and fires the LLM caption (Claude Sonnet vision)\n * inline. Returns the new main-image URL plus the caption.\n *\n * Caption-failure semantics: the route still sends `\"\"` on LLM sub-failure,\n * but the SDK normalizes `\"\"` → `null` here so `canonicalDescription` carries\n * the same `string | null` semantics as characters. The main image is still\n * set; call `recaption()` to retry.\n *\n * Optimistic-concurrency: pass `expectedUpdatedAt` to gate the update on\n * the row's current `updated_at`; on mismatch the route returns 409\n * `concurrent_modification` carrying the fresh token.\n */\n async approveMainImage(\n id: string,\n candidateJobId: string,\n expectedUpdatedAt?: string,\n ): Promise<ApproveObjectMainImageResult> {\n const res = await this.client.request<{ sourceImageUrl: string; canonicalDescription: string | null }>(\n \"POST\",\n `/v1/objects/${encodeURIComponent(id)}/approve-main-image`,\n { body: { candidateJobId, expectedUpdatedAt } },\n )\n // Normalize the wire `\"\"` (LLM sub-failure) → null; build a new object\n // rather than mutating the response.\n return { sourceImageUrl: res.sourceImageUrl, canonicalDescription: res.canonicalDescription || null }\n }\n\n /**\n * Re-fire the LLM caption against the object's current main image. 502s\n * on LLM failure (unlike `approveMainImage` which preserves the side-effect\n * and returns \"\"); returns 400 `main_image_required` if no main image is\n * set yet.\n *\n * The route is a pure idempotent retry — it does NOT accept an\n * `expectedUpdatedAt` token (per Phase E1 calibration finding: backend\n * route is idempotent retry, not gated on optimistic-concurrency).\n */\n recaption(id: string): Promise<RecaptionObjectResult> {\n return this.client.request(\n \"POST\",\n `/v1/objects/${encodeURIComponent(id)}/llm-caption`,\n )\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/resources/jobs.ts"],"names":[],"mappings":";AA8SA,SAAS,UAAU,KAAA,EAAmE;AACpF,EAAA,IAAI,KAAA,KAAU,QAAW,OAAO,MAAA;AAChC,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,GAAW,K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ACF","file":"chunk-THLTFB6I.js","sourcesContent":["import type { NodaroClientCore } from \"../core.js\"\n\n/**\n * A job's lifecycle status. Hand-copied mirror of `JOB_STATUSES` in the\n * platform's `backend/src/lib/job-status.ts` — nothing links the two at build\n * time, so a new member has to be added here in the same change.\n *\n * `pending_review` is IN-FLIGHT, NOT TERMINAL: a job policy registered by the\n * deployment held the output for a human reviewer. Treat it like `processing`\n * in a `switch` — keep waiting, do not re-run — and it resolves to `completed`\n * (approved), `failed` (rejected, carrying an `error_hint` with\n * `kind: \"policy-block\"`) or `cancelled` (a held job is cancellable like any\n * in-flight job). `credit_status` reads `\"reserved\"` for the whole hold. Only\n * appears on deployments that register a job policy; `runAndWait` throws\n * {@link JobHeldError} on the first held tick rather than waiting it out.\n */\nexport type JobStatus =\n | \"pending\"\n | \"queued\"\n | \"processing\"\n | \"pending_review\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n\n/**\n * A PROVIDER's verdict: the model's own safety filter refused the output.\n * `class` distinguishes a deterministic block (copyright/likeness — retrying\n * the same request never helps) from `safety`, whose filter is known to be\n * non-deterministic for some models: `retried` says whether the worker\n * already spent its one extra attempt, and `suggestedProvider` — present\n * only when the catalog declares a fallback for the model that failed — is a\n * real model id the SAME prompt/references can be retried on.\n */\nexport type SafetyBlockHint = {\n kind: \"safety-block\"\n class: \"copyright\" | \"likeness\" | \"safety\"\n retried: boolean\n suggestedProvider?: string\n /**\n * Present when the provider refused the INPUT VIDEO itself — not the prompt,\n * a reference image or the output. Sending a different clip is the fix.\n */\n subject?: \"input_video\"\n}\n\n/**\n * A NODARO-side verdict, not a provider's: a job policy registered by the\n * deployment rejected the request (`hookPoint: \"request\"` — nothing ran, and\n * the call itself failed with {@link JobBlockedError}) or the finished output\n * (`hookPoint: \"result\"` — the result was blocked and never published).\n *\n * `reason` is USER-SAFE BY CONTRACT — the platform guarantees the policy's\n * machine text (scores, labels) never reaches it — so show it to the person\n * who made the request as-is. `policyId` identifies the deployment's policy,\n * not a Nodaro product feature. Only occurs on deployments that register a\n * job policy.\n */\nexport type PolicyBlockHint = {\n kind: \"policy-block\"\n policyId: string\n reason: string\n hookPoint: \"request\" | \"result\"\n}\n\n/**\n * The job ran out of credits partway: a step that reserves its own credits\n * (for example, the video a Cast Swap or trend run dispatches) was refused —\n * the balance could not cover it, or a plan or workspace cap was reached. The\n * job failed and its credits were refunded; ask the person to top up (or raise\n * the cap), then run it again.\n *\n * `code` is the refusal's own code, a lowercase snake_case token — for\n * example `insufficient_credits`, `free_video_limit`, `instance_cap_reached`,\n * `budget_exceeded`, `member_cap_exceeded` or `user_allowance_exceeded`. Treat\n * an unknown code like `insufficient_credits`.\n */\nexport type CreditsHint = {\n kind: \"credits\"\n code: string\n}\n\n/**\n * The provider refused the job's input video without naming a content-policy\n * class (its message is about the file, not a policy). Treat it like any\n * other failure — no fallback model is offered — except that the input to\n * change is known: send a different clip.\n */\nexport type InputRefusedHint = {\n kind: \"input-refused\"\n subject: \"input_video\"\n}\n\n/**\n * A job's `jobs.error_hint` (migration 376) — a user-safe, machine-readable\n * failure verdict, so a caller can act on it without parsing `error_message`\n * prose. One column, several verdict sources; `kind` is the discriminant.\n *\n * HAND-COPIED MIRROR of `ErrorHint` in the platform's\n * `backend/src/lib/safety-block.ts` (which names this file in its own\n * comment). Nothing links the two at build time: a new arm there has to be\n * pasted here verbatim in the same change, with a changeset.\n * `packages/client/dist/index.d.ts` is REBUILT, never hand-edited.\n */\nexport type JobErrorHint = SafetyBlockHint | PolicyBlockHint | CreditsHint | InputRefusedHint\n\n/**\n * The billing lifecycle of a job's credit reservation — `usage_logs.status`\n * for the job's `usage_log_id`. `null` when the job has no usage log (e.g. a\n * free run) or hasn't reserved credits yet.\n */\nexport type CreditStatus = \"reserved\" | \"committed\" | \"refunded\"\n\n/** A job owner's rating of their job — set with {@link JobsResource.rate}. */\nexport type JobRating = \"good\" | \"bad\"\n\n/**\n * The `rating` filter of {@link JobsResource.list}: one rating, any rating\n * (`\"rated\"`) or none (`\"unrated\"`).\n */\nexport type JobRatingFilter = JobRating | \"rated\" | \"unrated\"\n\n/**\n * Job record returned to non-admin SDK consumers. Field names are snake_case\n * to match the wire format (per the OpenAPI fix in Phase 1).\n *\n * Sensitive fields stripped server-side for non-admin callers:\n * `provider`, `provider_cost`, `display_cost`, `credits_actual`. USD\n * pricing is admin-only across api/sdk/mcp — non-admin consumers see\n * only the `credits` abstraction. Server-only nested job data (including\n * Recast's private remux base) is stripped for every caller, including admins.\n */\nexport interface Job {\n id: string\n status: JobStatus\n progress: number\n user_id: string\n input_data: unknown\n output_data: unknown\n error_message: string | null\n /** Present on a failed job the worker classified as a provider\n * content-policy block (`kind: \"safety-block\"`) or that a deployment's job\n * policy rejected (`kind: \"policy-block\"`); absent/null otherwise.\n * User-safe by construction — narrow on `kind` before reading the rest. */\n error_hint?: JobErrorHint | null\n /** PR9: the job's credit reservation lifecycle, derived server-side from\n * `usage_logs.status`. `null` when there is no usage log to report. Never\n * changes the meaning of `credits` (the reserved amount) below. */\n credit_status?: CreditStatus | null\n /** The credits the job itself HELD when it was accepted. Never changes — a\n * job can settle below it; read {@link Job.credits_charged} for what it cost. */\n credits: number | null\n /**\n * What the job actually cost once its hold settled, INCLUDING the steps it\n * ran: a job that runs other jobs for you (a Nodaro Motion run's reference\n * preparation, mask and video) is charged for each, and they are not listed\n * on their own. A step adds its charge once it settles. Can be lower than\n * {@link Job.credits_held} (the unused part goes back to the balance). `0`\n * when the run's own hold was refunded, plus any settled steps (a refunded\n * Nodaro Motion run whose reference and mask steps committed reads\n * `credit_status: \"refunded\"` with `credits_charged: 165`). `null` while the\n * job's own hold is still open (even when some steps have settled), when\n * nothing in the run was reserved, or when its steps could not be read for a\n * moment (unknown — never a lower figure). Sum this — not `credits` — to\n * total spend. Returned by `get()` and `list()`.\n */\n credits_charged?: number | null\n /** The run's hold: the job's own `credits` plus its steps' holds (equals `credits` for a job with no steps). */\n credits_held?: number | null\n /** What went back from `credits_held` once every hold in the run settled; `null` until then. */\n credits_released?: number | null\n job_type: string | null\n created_at: string\n started_at: string | null\n completed_at: string | null\n /**\n * Provenance: which kind of caller created the job — one of\n * `\"internal\" | \"mcp\" | \"app\" | \"cli\" | \"sdk\" | \"extension\" | \"web\" | \"api\"`.\n * `source_detail` narrows it (origin host, `extension/<name>` label,\n * `sdk/<version>`, MCP client name, developer-app id). Descriptive only;\n * lets a library view label or filter media by origin.\n */\n source?: string | null\n source_detail?: string | null\n /** The generation session this job was born in (the `sessionId` sent with\n * the generation request), or null. See `client.sessions`. */\n session_id?: string | null\n /**\n * With `list({ withSessions: true })`: every session that holds the job now,\n * each linkable — empty when it is in no session (General). Absent otherwise.\n */\n sessions?: JobSessionRef[]\n /**\n * When the job was deleted, on a job read from the Trash\n * (`client.trash.list()`). A deleted job is left out of every other read, so\n * this is otherwise absent or `null`.\n */\n deleted_at?: string | null\n /**\n * Whether the job's owner favorited it (`client.gallery.toggleFavorite`).\n * Returned by `get()` and `list()`. Absent from an older server, and when\n * the server could not read it for a moment — treat absent as unknown,\n * never as `false`.\n */\n favorited?: boolean\n /**\n * The owner's rating of the job ({@link JobsResource.rate}), or `null` when\n * unrated. Returned by `get()` and `list()`; absent like `favorited`.\n */\n rating?: JobRating | null\n}\n\nexport interface CancelJobResult {\n success: true\n cancelled: number\n /**\n * `true` when the job could not be stopped because its provider call is\n * already running — a metered LLM job's call, an external provider task. It\n * finishes and is charged only what it used.\n */\n inFlight?: boolean\n}\n\n/**\n * The kind of caller that created a job (`Job.source`). Hand-copied mirror of\n * `JOB_SOURCES` in the platform's `backend/src/lib/job-source.ts`.\n */\nexport type JobSource = \"internal\" | \"mcp\" | \"app\" | \"cli\" | \"sdk\" | \"extension\" | \"web\" | \"api\"\n\nexport interface DeleteJobResult {\n success: true\n}\n\n/** A session that holds a job now (`Job.sessions`). */\nexport interface JobSessionRef {\n id: string\n title: string | null\n /** The session's project, or `null` when it has none. */\n projectId: string | null\n}\n\nexport interface ListJobsParams {\n /** One status or several (a job matching any of them). An unknown status is a 400. */\n status?: JobStatus | readonly JobStatus[]\n /** Exact match on `input_data.type` — the route that created the job\n * (`\"llm-structured\"`, `\"video-analysis\"`, …). One value or several (up to 20). */\n type?: string | readonly string[]\n /** Exact match on `input_data.origin` — the client app that sent it. */\n origin?: string\n /** The surface that created the job (`Job.source`): `\"mcp\"` lists what your\n * MCP clients (Claude, ChatGPT, …) made. One value or several. */\n source?: JobSource | readonly JobSource[]\n /** `true`: only jobs you favorited; `false`: only jobs you did not. */\n favorited?: boolean\n /** Your rating: `\"good\"`, `\"bad\"`, any (`\"rated\"`) or none (`\"unrated\"`). */\n rating?: JobRatingFilter\n /** The jobs of one generate-image batch (`count` / `models`) — its `batchId`. */\n batchId?: string\n /**\n * The jobs a session of this project holds now — or, `\"none\"`, a session\n * with no project. Each job once, however many sessions hold it. Not with\n * `inSession: false`.\n */\n projectId?: string | \"none\"\n /**\n * `false`: the jobs no session holds now (General), whatever session they\n * were born in. `true`: the jobs at least one session holds.\n */\n inSession?: boolean\n /** `true`: each job carries `sessions`, the sessions that hold it now. */\n withSessions?: boolean\n /** Page size, 1–100 (server default 50). */\n limit?: number\n /** The previous page's `next`. */\n cursor?: string\n}\n\n/** What {@link JobsResource.rate} answers: the job's rating now. */\nexport interface RateJobResult {\n data: { jobId: string; rating: JobRating | null }\n}\n\n/**\n * {@link JobsResource.fromUpload}'s body: an image edited in the browser,\n * already stored with `client.uploads.upload`, and what it was made from.\n */\nexport interface JobFromUploadParams {\n /** The edited image's `assetId`, as `client.uploads.upload` returned it. */\n assetId: string\n /** The job whose image was edited. */\n sourceJobId?: string\n /** Which of `sourceJobId`'s images was edited, when it made several. Default: its `imageUrl`. */\n sourceImageUrl?: string\n /** The upload that was edited, when the source is not a job. Not with `sourceJobId`. */\n sourceAssetId?: string\n /** The editor's design state, stored with `client.uploads.uploadJson`, so the edit can be reopened. */\n editStateUrl?: string\n /** The generation session to file the job in. */\n sessionId?: string\n}\n\n/** A list filter value as the query string carries it: several are comma-separated. */\nfunction listParam(value: string | readonly string[] | undefined): string | undefined {\n if (value === undefined) return undefined\n return typeof value === \"string\" ? value : value.join(\",\")\n}\n\nexport interface ListJobsPage {\n /**\n * A page may hold fewer than `limit` rows — even none — and still carry a\n * `next`. Page on `next`, never on `data.length`.\n */\n data: Job[]\n /** Pass back as `cursor` for the next page; `null` on the last one. */\n next: string | null\n}\n\n/**\n * Lean job status returned by `GET /v1/jobs/:id/status`. Skips the\n * `input_data` JSONB and cost columns. Its `output_data` still goes\n * through the server-only nested-field redaction. Intended for poll loops that\n * only need progress/output/error, and when the job finished.\n */\nexport interface JobStatusResult {\n id: string\n status: JobStatus\n progress?: number\n output_data?: unknown\n error_message?: string | null\n /** PR9: see {@link Job.error_hint}. */\n error_hint?: JobErrorHint | null\n /** PR9: see {@link Job.credit_status}. */\n credit_status?: CreditStatus | null\n /** When the job finished, on the server's clock; null until it has. */\n completed_at?: string | null\n}\n\nexport class JobsResource {\n constructor(private client: NodaroClientCore) {}\n\n /** Get a single job by ID. */\n get(id: string): Promise<{ data: Job }> {\n return this.client.request(\"GET\", `/v1/jobs/${encodeURIComponent(id)}`)\n }\n\n /**\n * Your jobs, newest first (`GET /v1/jobs`), cursor-paginated. `type` and\n * `origin` filter on the job's own `input_data`, which every job carries —\n * a client app lists its runs with `{ type: \"llm-structured\", origin: \"studio\" }`.\n * `status` and `type` take one value or a list; `favorited` and `rating`\n * filter on your own marks, `source` on the surface that created the job.\n * `projectId` / `inSession` filter on where the job is now (a project's\n * sessions, or General), and `withSessions` says which sessions each job is\n * in — for \"everything in this project\". Every filter combines with AND,\n * and each job carries `favorited` and `rating`. A deleted job is never\n * listed: read the Trash with `client.trash.list()`.\n */\n list(params: ListJobsParams = {}): Promise<ListJobsPage> {\n const { status, type, source, inSession, withSessions, ...rest } = params\n return this.client.request<ListJobsPage>(\"GET\", \"/v1/jobs\", {\n query: {\n ...rest,\n status: listParam(status),\n type: listParam(type),\n source: listParam(source),\n inSession: inSession === undefined ? undefined : String(inSession),\n withSessions: withSessions ? \"true\" : undefined,\n },\n })\n }\n\n /**\n * Record an image edited in the browser as a job (`POST /v1/jobs/from-upload`):\n * a completed, private, free `image-edit` job whose `output_data.imageUrl` is\n * the upload, linked to its source in `input_data` (`sourceJobId` /\n * `sourceAssetId`, `sourceImageUrl`). It then lists, rates, favorites and\n * files into a session like any image job. One upload is one job: the same\n * `assetId` again returns the same job. OAuth apps need the `assets:write`\n * scope. A deployment's job policy can refuse the image ({@link JobBlockedError}).\n */\n fromUpload(params: JobFromUploadParams): Promise<{ data: Job }> {\n return this.client.request<{ data: Job }>(\"POST\", \"/v1/jobs/from-upload\", { body: params })\n }\n\n /**\n * Rate one of your jobs `\"good\"` or `\"bad\"`, or clear the rating with\n * `null` (`PUT /v1/jobs/:id/rating`). Only the job's owner rates it — anyone\n * else's job is a `NotFoundError`. The rating reads back as `Job.rating`\n * and filters {@link list}. OAuth apps need the `assets:write` scope.\n */\n rate(id: string, rating: JobRating | null): Promise<RateJobResult> {\n return this.client.request<RateJobResult>(\"PUT\", `/v1/jobs/${encodeURIComponent(id)}/rating`, {\n body: { rating },\n })\n }\n\n /**\n * Get the lean status of a single job (poll-loop friendly).\n * Hits `GET /v1/jobs/:id/status` — returns only id/status/progress/\n * output_data/error_message, with far less wire/CPU cost than `get()`.\n * Same auth + ownership semantics as {@link get}.\n */\n getStatus(id: string): Promise<{ data: JobStatusResult }> {\n return this.client.request(\n \"GET\",\n `/v1/jobs/${encodeURIComponent(id)}/status`,\n )\n }\n\n /**\n * Cancel a job. Server route is `POST /v1/jobs/:jobId/cancel`.\n * Refunds any reserved credit holds. A running LLM job priced per model\n * (metered) whose call has already started answers\n * `{ success: true, cancelled: 0, inFlight: true }`: it finishes and is\n * charged only what it used. A job stopped before its call starts is\n * refunded, except for what an earlier attempt of the same job already used\n * (a retry after a billed attempt): that is charged.\n */\n cancel(id: string): Promise<CancelJobResult> {\n return this.client.request(\n \"POST\",\n `/v1/jobs/${encodeURIComponent(id)}/cancel`,\n )\n }\n\n /**\n * Delete a job: it goes to the Trash (`client.trash.list()`). It is left out\n * of every read from then on, stays restorable for 30 days ({@link restore},\n * back into the sessions it was in), and is then deleted for good, as a\n * delete always was (a copy saved to the Library stays). `{ forever: true }` deletes a job already in the Trash for good now;\n * on a live job it fails with a 409 `NodaroError` whose `code` is\n * `\"not_in_trash\"`. Only the job's owner (or an admin) may delete it; a job\n * that is still running keeps running — cancel it first when its worker\n * should stop ({@link cancel}). Nothing is refunded. OAuth apps need the\n * `assets:write` scope.\n */\n delete(id: string, options: { forever?: boolean } = {}): Promise<DeleteJobResult> {\n return this.client.request(\n \"DELETE\",\n `/v1/jobs/${encodeURIComponent(id)}`,\n options.forever ? { query: { forever: \"true\" } } : {},\n )\n }\n\n /**\n * Bring a deleted job back from the Trash: it reappears in every read and in\n * every session it was in. A job that is not in the Trash succeeds too.\n * OAuth apps need the `assets:write` scope.\n */\n restore(id: string): Promise<{ success: true }> {\n return this.client.request(\"POST\", `/v1/jobs/${encodeURIComponent(id)}/restore`)\n }\n}\n"]}
|