Skip to main content
Every async operation in Youka eventually runs as a task, but the primary SDK surface now returns operation handles instead of raw task IDs. Most callers should use client.projects.wait(...) or client.exports.wait(...) and only reach for client.tasks.* when they need low-level task inspection.

client.tasks.get(taskId, options?)

Fetch the current state of a task by ID.

Task statuses

client.tasks.wait(taskId, options?)

Poll a task until it reaches a terminal state. Returns the final task on success, throws YoukaTaskError on failure.

Options

number
Milliseconds between polls. Defaults to 2000.
AbortSignal
Abort the wait. The in-flight request and any pending delay are cancelled immediately.

Errors

client.tasks.wait(...) throws YoukaTaskError when the task ends in failed, cancelled, or timed-out:

client.projects.wait(operation, options?)

Wait for a project-scoped operation to finish, then refetch the project. Returns the operation handle, the terminal task, and the updated project.
ProjectOperation
required
Usually the result of client.projects.create(...), client.projects.separateStems(...), or client.projects.syncLyrics(...).

client.exports.wait(operationOrId, options?)

Wait for a cloud export to reach a terminal state. Pass either the ExportOperation returned by client.exports.create(...) or an exportId string.

Cancellation

Pass an AbortSignal to cancel a long-running wait:
The same signal also cancels the underlying task or export polling request.

What’s next

  • Errors — handle YoukaTaskError and retryable errors
  • Exports — wait for an export to finish
  • API async jobs — the same pattern in raw HTTP