@clipwright/core 0.70.0 → 0.72.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.
@@ -147,6 +147,7 @@ export interface AgentFailureReport {
147
147
  }
148
148
  export declare const TAKE_UNCHECKED_NEXT_ACTION: string;
149
149
  export declare const UPLOAD_NOT_FINISHED_NEXT_ACTION: string;
150
+ export declare const ASSET_NOT_READY_NEXT_ACTION: string;
150
151
  export declare const UNAUTHORIZED_NEXT_ACTION: string;
151
152
  export declare function refusalNextAction(next: DiyNext): string;
152
153
  export declare function agentFailureReport(failure: ApiFailure): AgentFailureReport;
@@ -264,6 +264,8 @@ export const TAKE_UNCHECKED_NEXT_ACTION = "Do not render yet: each clip the mess
264
264
  export const UPLOAD_NOT_FINISHED_NEXT_ACTION = "Finish the upload first: PUT the file to the put_url from create_upload with the given put_headers, confirm it " +
265
265
  "with get_upload, then repeat this call. If the message says the upload is finishing, the file is already there: " +
266
266
  "wait a few seconds and repeat. Nothing was charged and no run was created.";
267
+ export const ASSET_NOT_READY_NEXT_ACTION = "Wait for the asset the message names: call get_asset with its id until its state is ready, then repeat this same call unchanged. " +
268
+ "If get_asset says it failed, create the asset again. Nothing was charged and no run was created.";
267
269
  export const UNAUTHORIZED_NEXT_ACTION = "STOP. Clipwright did not accept this connection's key or sign-in: it is missing, mistyped or revoked. Nothing was " +
268
270
  `charged. With a key, the human creates a new one at ${PUBLIC_APP_BASE_URL}/api-keys (a new account at ` +
269
271
  `${PUBLIC_APP_BASE_URL}/auth/sign-up comes with trial credits), puts it in the MCP server's environment as ` +
@@ -433,6 +435,15 @@ export function agentFailureReport(failure) {
433
435
  : "STOP. Read the plan and address every issue before purchase. Save the corrected document, obtain approval of its exact revision, then quote it. Approval and a paid launch are separate explicit actions; do not perform them automatically.",
434
436
  };
435
437
  case "client_error":
438
+ if (failure.status === 409 && (failure.code === "film_asset_not_ready" || failure.code === "asset_not_ready"))
439
+ return {
440
+ ...base,
441
+ status: "RETRY_LATER",
442
+ code: failure.code,
443
+ retryable: true,
444
+ ...(failure.next && { next: failure.next }),
445
+ next_action: ASSET_NOT_READY_NEXT_ACTION,
446
+ };
436
447
  return {
437
448
  ...base,
438
449
  status: "FAILED",
package/dist/errors.d.ts CHANGED
@@ -271,7 +271,7 @@ export type EditCeilingReachedError = z.infer<typeof editCeilingReachedError>;
271
271
  export declare function editCeilingReachedBody(args: Omit<EditCeilingReachedError["error"], "code" | "message">, counting?: "revision" | "candidate"): EditCeilingReachedError;
272
272
  export declare function unusableSourceMessage(errorClass: string, detail: string): string;
273
273
  export declare const MALFORMED_BODY_MESSAGE: string;
274
- declare const BARE_ERROR_CODES: readonly ["analysis_enqueue_failed", "aspect_conflict", "actor_unavailable", "actor_format_unavailable", "actor_storage_unavailable", "actor_generation_disabled", "actor_in_use", "ad_limited", "ad_not_found", "ad_slot_in_use", "ad_slot_unchecked", "asset_cap_exceeded", "asset_ingest_cap_exceeded", "asset_not_found", "asset_not_ready", "assets_disabled", "creator_profile_limited", "creator_profile_not_found", "creator_url_unsupported", "cut_limited", "cut_not_found", "cut_preview_limited", "cut_slot_in_use", "deletion_held", "editing_window_not_set", "explainer_busy", "feedback_limited", "film_draft_limited", "film_draft_not_found", "film_draft_stale", "film_hero_limited", "film_run_not_found", "film_voice_not_ready", "generations_disabled", "generations_marking_pending", "idempotency_key_required", "idempotency_key_reused", "ingest_enqueue_failed", "insufficient_scope", "internal_error", "invalid_image", "invalid_request", "malformed_body", "no_changes", "not_found", "own_agent_disabled", "own_agent_marking_pending", "paid_render_disabled", "payload_too_large", "reference_analysis_disabled", "reference_analysis_limited", "reference_analysis_not_found", "reference_not_analyzable", "reference_not_usable", "reference_url_unsupported", "revision_needs_generated_unit", "rights_not_confirmed", "run_media_in_use", "run_not_finished", "run_not_found", "source_aspect_mismatch", "source_not_usable", "take_check_limited", "take_frames_limited", "trend_page_unavailable", "trend_search_limited", "trend_search_not_found", "trends_unavailable", "unauthorized", "unsupported_combination", "unsupported_media_type", "unusable_source", "upload_cap_exceeded", "upload_digest_mismatch", "upload_expired", "upload_in_use", "upload_not_finished", "upload_size_mismatch", "upstream_error", "url_fetch_busy", "url_fetch_failed", "url_fetch_rate_limited", "url_fetch_refused", "url_import_disabled"];
274
+ declare const BARE_ERROR_CODES: readonly ["analysis_enqueue_failed", "aspect_conflict", "actor_unavailable", "actor_format_unavailable", "actor_storage_unavailable", "actor_generation_disabled", "actor_in_use", "ad_limited", "ad_not_found", "ad_slot_in_use", "ad_slot_unchecked", "asset_cap_exceeded", "asset_ingest_cap_exceeded", "asset_not_found", "asset_not_ready", "assets_disabled", "creator_profile_limited", "creator_profile_not_found", "creator_url_unsupported", "cut_limited", "cut_not_found", "cut_preview_limited", "cut_slot_in_use", "deletion_held", "editing_window_not_set", "explainer_busy", "feedback_limited", "film_asset_not_ready", "film_draft_limited", "film_draft_not_found", "film_draft_stale", "film_hero_limited", "film_run_not_found", "film_voice_not_ready", "generations_disabled", "generations_marking_pending", "idempotency_key_required", "idempotency_key_reused", "ingest_enqueue_failed", "insufficient_scope", "internal_error", "invalid_image", "invalid_request", "malformed_body", "no_changes", "not_found", "own_agent_disabled", "own_agent_marking_pending", "paid_render_disabled", "payload_too_large", "reference_analysis_disabled", "reference_analysis_limited", "reference_analysis_not_found", "reference_not_analyzable", "reference_not_usable", "reference_url_unsupported", "revision_needs_generated_unit", "rights_not_confirmed", "run_media_in_use", "run_not_finished", "run_not_found", "source_aspect_mismatch", "source_not_usable", "take_check_limited", "take_frames_limited", "trend_page_unavailable", "trend_search_limited", "trend_search_not_found", "trends_unavailable", "unauthorized", "unsupported_combination", "unsupported_media_type", "unusable_source", "upload_cap_exceeded", "upload_digest_mismatch", "upload_expired", "upload_in_use", "upload_not_finished", "upload_size_mismatch", "upstream_error", "url_fetch_busy", "url_fetch_failed", "url_fetch_rate_limited", "url_fetch_refused", "url_import_disabled"];
275
275
  export type BareApiErrorCode = (typeof BARE_ERROR_CODES)[number];
276
276
  export declare const API_ERROR_CODES: readonly string[];
277
277
  export declare function apiErrorBody(args: {
package/dist/errors.js CHANGED
@@ -322,6 +322,7 @@ const BARE_ERROR_CODES = [
322
322
  "editing_window_not_set",
323
323
  "explainer_busy",
324
324
  "feedback_limited",
325
+ "film_asset_not_ready",
325
326
  "film_draft_limited",
326
327
  "film_draft_not_found",
327
328
  "film_draft_stale",
@@ -220,8 +220,8 @@ export declare const TAKE_MOTION_TARGETS: Record<TakeMotionFormat, {
220
220
  }>;
221
221
  export declare const TAKE_SHAKE_LIMIT = 4;
222
222
  export declare const takeFramesInput: z.ZodObject<{
223
- run_id: z.ZodOptional<z.ZodString>;
224
223
  asset_id: z.ZodOptional<z.ZodString>;
224
+ run_id: z.ZodOptional<z.ZodString>;
225
225
  fps: z.ZodDefault<z.ZodNumber>;
226
226
  from: z.ZodOptional<z.ZodNumber>;
227
227
  to: z.ZodOptional<z.ZodNumber>;
@@ -278,7 +278,12 @@ export declare const takeCheckInput: z.ZodObject<{
278
278
  rights_confirmed: z.ZodOptional<z.ZodBoolean>;
279
279
  asset_id: z.ZodOptional<z.ZodString>;
280
280
  }, z.core.$strict>>;
281
- product_image: z.ZodOptional<z.ZodString>;
281
+ product_image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
282
+ run_id: z.ZodOptional<z.ZodString>;
283
+ upload_id: z.ZodOptional<z.ZodString>;
284
+ rights_confirmed: z.ZodOptional<z.ZodBoolean>;
285
+ asset_id: z.ZodOptional<z.ZodString>;
286
+ }, z.core.$strict>]>>;
282
287
  moves: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
283
288
  ad_id: z.ZodOptional<z.ZodString>;
284
289
  cut_id: z.ZodOptional<z.ZodString>;
@@ -163,6 +163,8 @@ const oneTake = (take) => (take.run_id === undefined) !== (take.asset_id === und
163
163
  const ONE_TAKE = "name the take by run_id or by asset_id, one of them";
164
164
  export const takeFramesInput = z.strictObject({
165
165
  ...takeSource,
166
+ run_id: runId.optional().describe("The take: a delivered generate_video run of this account, or a delivered render_edit run to read the " +
167
+ "finished edit"),
166
168
  fps: z.number().int().min(TAKE_FRAMES_MIN_FPS).max(TAKE_FRAMES_MAX_FPS).default(TAKE_FRAMES_DEFAULT_FPS)
167
169
  .describe("Frames a second: 8 to read the whole take, 12 to 24 on a contact"),
168
170
  from: takeSecond.optional().describe("The second of the take the frames start at; omitted, its start"),
@@ -198,8 +200,9 @@ export const takeCheckInput = z.strictObject({
198
200
  .describe("With against picture: the look a colour outside it is named against"),
199
201
  picture: filmCutPicture.optional().describe("With against picture: the picture the take is checked against; needed only when the take " +
200
202
  "was not made from a first frame, and it must be that first frame when it was"),
201
- product_image: qualifiedImageUrl.optional()
202
- .describe("https picture of the product as it really is (your upload or a saved asset): the take's product is compared with it"),
203
+ product_image: z.union([qualifiedImageUrl, filmCutPicture]).optional()
204
+ .describe("The product as it really is, the take's product compared with it: an https link to your upload or a saved asset, or the " +
205
+ "picture by run_id (a delivered generate_image run of this account, such as a product sheet), upload_id or asset_id"),
203
206
  moves: z.array(takeSecond).max(TAKE_CHECK_MAX_MOVES).optional()
204
207
  .describe("Seconds of the take where a hand meets the product (a grip, a lid, a set-down): looked at first"),
205
208
  ad_id: adId.optional().describe("With slot: the ad record the verdict joins, as a take of that slot"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clipwright/core",
3
- "version": "0.70.0",
3
+ "version": "0.72.0",
4
4
  "description": "Zod schemas and the shared request/response contract of the Clipwright UGC video API",
5
5
  "repository": {
6
6
  "type": "git",