freebeat-mcp 0.4.1 → 0.4.3
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/README.md +63 -4
- package/dist/capabilities/agents/register.js +5 -0
- package/dist/capabilities/agents/register.js.map +1 -1
- package/dist/capabilities/agents/tools/generate-agent-videos.js +7 -5
- package/dist/capabilities/agents/tools/generate-agent-videos.js.map +1 -1
- package/dist/capabilities/agents/tools/video-session.d.ts +4 -0
- package/dist/capabilities/agents/tools/video-session.js +29 -0
- package/dist/capabilities/agents/tools/video-session.js.map +1 -0
- package/dist/capabilities/effects/tools/list-effects.js +18 -5
- package/dist/capabilities/effects/tools/list-effects.js.map +1 -1
- package/dist/capabilities/media/tools/shared.d.ts +6 -6
- package/dist/capabilities/media/tools/shared.js +2 -2
- package/dist/capabilities/media/tools/shared.js.map +1 -1
- package/dist/capabilities/tasks/tools/get-task-result.js +13 -2
- package/dist/capabilities/tasks/tools/get-task-result.js.map +1 -1
- package/dist/capabilities/tasks/tools/get-task-status.js +10 -6
- package/dist/capabilities/tasks/tools/get-task-status.js.map +1 -1
- package/dist/core/agent-products.d.ts +19 -0
- package/dist/core/agent-products.js.map +1 -1
- package/dist/core/credit-approval.d.ts +3 -3
- package/dist/core/credit-approval.js +1 -1
- package/dist/core/credit-approval.js.map +1 -1
- package/dist/core/model-output.d.ts +2 -2
- package/dist/core/response.d.ts +55 -3
- package/dist/core/response.js +42 -17
- package/dist/core/response.js.map +1 -1
- package/dist/core/task-result.d.ts +3 -3
- package/dist/core/task-status.d.ts +1 -1
- package/dist/core/video-session.d.ts +283 -0
- package/dist/core/video-session.js +192 -0
- package/dist/core/video-session.js.map +1 -0
- package/dist/hosted.d.ts +5 -2
- package/dist/hosted.js +2 -1
- package/dist/hosted.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/server.js.map +1 -1
- package/dist/services/freebeat-api.d.ts +26 -10
- package/dist/services/freebeat-api.js +280 -102
- package/dist/services/freebeat-api.js.map +1 -1
- package/dist/services/remote-media.d.ts +2 -0
- package/dist/services/remote-media.js +1 -1
- package/dist/services/remote-media.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -78,12 +78,37 @@ npx -y freebeat-mcp
|
|
|
78
78
|
|
|
79
79
|
The hosted MCP endpoint is served by freebeat.ai.
|
|
80
80
|
The website mounts `freebeat-mcp/hosted`.
|
|
81
|
+
It supplies `HostedMcpRequestOptions.renderAgentFinalVideo`, an `AgentFinalVideoRenderer`
|
|
82
|
+
exported from that entry point. The callback receives `{ product, threadId, flowIndex, assetVersion, isCurrent }`
|
|
83
|
+
and returns `running`, `completed` with `video_url`, or `failed` with a safe
|
|
84
|
+
`failure: { stage, reason, retryable }`. It closes over the authenticated website
|
|
85
|
+
context; no credentials are passed to the callback. The website owns render
|
|
86
|
+
execution, shared deduplication and bounded waiting. Use `assetVersion` with stable
|
|
87
|
+
composition inputs to identify prepared assets. After preparing, call `isCurrent()`
|
|
88
|
+
immediately before recording or submitting a new render; false means return `running`
|
|
89
|
+
without submitting. MCP owns this check of the active run and final asset version.
|
|
90
|
+
|
|
91
|
+
Polling `get_task_status` or `get_task_result` can render an existing agent's final
|
|
92
|
+
assembly once its latest final asset reports status `102` or `2`; it does not
|
|
93
|
+
regenerate source assets. An active agent run prevents rendering. The client checks
|
|
94
|
+
the thread and selected final flow/version/readiness again after the callback before returning media.
|
|
95
|
+
Missing rendering capability or flow reference returns a `final_render` failure.
|
|
96
|
+
Completed status includes `video_url`; result includes `result.video_url`. An agent
|
|
97
|
+
video still rendering returns `running` with a polling message from either tool.
|
|
98
|
+
While an agent run is active, that message names the latest progress step the agent
|
|
99
|
+
reported for the run (the step freebeat.ai shows), with its percent while the step runs.
|
|
81
100
|
|
|
82
101
|
This package depends on Freebeat online services. Available source platforms, effect templates, and generation capabilities may change with backend updates.
|
|
83
102
|
|
|
84
103
|
## Tools
|
|
85
104
|
|
|
86
|
-
|
|
105
|
+
24 tools are available with full scopes. Successful responses and tool errors are projected through their declared output schemas before both MCP text and structured content are built; undeclared object properties are excluded.
|
|
106
|
+
|
|
107
|
+
Tool errors set `isError: true` and return `success: false`, `error`, and `code`
|
|
108
|
+
in both representations. A rejected credit approval may also include
|
|
109
|
+
`submitted: false`, `quote`, and `max_credits`. Errors omit successful result
|
|
110
|
+
fields. Raw handler text and metadata are excluded; input validation errors return
|
|
111
|
+
fixed `INVALID_PARAMS` guidance without echoing the rejected values.
|
|
87
112
|
|
|
88
113
|
### `get_credit_balance` and `quote_generation`
|
|
89
114
|
|
|
@@ -106,6 +131,10 @@ Missing consent or both consent modes are refused. Never remove or raise a ceili
|
|
|
106
131
|
or switch to unknown-cost consent, without new user approval. Agent videos charge
|
|
107
132
|
per stage; a submission-time check cannot cap the whole run.
|
|
108
133
|
|
|
134
|
+
After the user requests creation with Freebeat and approves the quote or explicitly
|
|
135
|
+
accepts an unknown total, call the appropriate Freebeat generation tool; do not
|
|
136
|
+
substitute another generator.
|
|
137
|
+
|
|
109
138
|
A production diagnosis on 2026-10-27 observed 855 credits for the video step alone
|
|
110
139
|
of a 15-second 720p dance, with planning and images extra: on the order of 1,000
|
|
111
140
|
credits. This is a historical configuration example, not a current quote or ceiling.
|
|
@@ -196,6 +225,16 @@ Lip-sync an existing clip to audio. Provide `video_url`, `video_duration_ms`, an
|
|
|
196
225
|
|
|
197
226
|
### `list_effects`
|
|
198
227
|
|
|
228
|
+
Returns one page of supported effects: `page` starts at `1` (default), and
|
|
229
|
+
`page_size` defaults to `20`, with an allowed range of `1`–`100`. The response
|
|
230
|
+
includes `total`, `page`, `page_size`, and `next_page`; follow `next_page` until it
|
|
231
|
+
is `null`. A page beyond the end returns an empty `effects` array and the actual
|
|
232
|
+
`total`, with `next_page: null`.
|
|
233
|
+
|
|
234
|
+
Each call reads the complete backend catalog within a shared 30-second deadline,
|
|
235
|
+
at most 100 backend pages and 10,000 effects. Exceeding any budget returns an
|
|
236
|
+
error without a partial catalog or total; repeated backend cursors also fail.
|
|
237
|
+
|
|
199
238
|
List supported effects with:
|
|
200
239
|
|
|
201
240
|
- `effect_id`
|
|
@@ -253,11 +292,12 @@ Create dancers performing to a song; people in optional photos become the dancer
|
|
|
253
292
|
|
|
254
293
|
Create animated lyrics timed to a song's vocals. Supports `768P` (default) and `2K`, with optional reference photos.
|
|
255
294
|
|
|
256
|
-
All three tools use the existing agents
|
|
295
|
+
All three tools use the existing agents with a required `auto_mode` choice, usually take 15–60 minutes, and use the user's existing Freebeat credits. Each tool selects its product internally; there is no `product` parameter.
|
|
257
296
|
|
|
258
297
|
Parameters:
|
|
259
298
|
|
|
260
299
|
- `music_id` required, from `upload_audio` or a completed `generate_music` result
|
|
300
|
+
- `auto_mode` required: `true` lets the agent decide and deliver the film; `false` lets ChatGPT/Codex co-create through the session tools when the agent pauses for creative input. Infer the choice from the request or discuss it when needed.
|
|
261
301
|
- `prompt` optional creative direction
|
|
262
302
|
- `start_ms` / `end_ms` optional song window, default the first 15 seconds, or up to the song's end if shorter; the selected window must fit the song and account limits
|
|
263
303
|
- `aspect_ratio` optional, default `16:9`
|
|
@@ -265,7 +305,17 @@ Parameters:
|
|
|
265
305
|
- `image_urls` optional photos from `upload_image`
|
|
266
306
|
- `remove_watermark` optional, default `false`
|
|
267
307
|
|
|
268
|
-
Returns `task_id`, `task_type`, `status`, and `session_url`, the freebeat.ai page for the session. `get_task_status` reports `running`, `completed`, or `action_required`; on `action_required` (for example the account ran out of credits, or the agent needs a decision)
|
|
308
|
+
Returns `task_id`, `task_type`, `status`, and `session_url`, the freebeat.ai page for the session. `get_task_status` reports `running`, `completed`, or `action_required`; on `action_required` (for example the account ran out of credits, or the agent needs a decision) read `get_video_session` and continue the conversation through `send_video_agent_message` with the same `task_id`. Relay credit notices when present.
|
|
309
|
+
|
|
310
|
+
### `get_video_session`
|
|
311
|
+
|
|
312
|
+
Read an existing agent video using its `task_id`. Returns recent conversation and requests, whether it is running or waiting for the person, pipeline statuses, effective `auto_mode`, and artifacts containing labeled readable `fields` and playable/viewable `media` URLs. The read uses the same messages/state/assets endpoints as the website and does not start work or final rendering. It returns at most 20 recent messages, 40 parts per message, 24 current artifacts and 64 stages, with a 60,000-character display budget including entry overhead (24,000 reserved for artifacts). Newest messages and parts take priority; `truncated` identifies shortened or omitted content. Unknown provider/diagnostic metadata and system messages are excluded.
|
|
313
|
+
|
|
314
|
+
### `send_video_agent_message`
|
|
315
|
+
|
|
316
|
+
Send `message` (1–4,000 characters) to an existing agent video's `task_id`. Optional `auto_mode` changes the setting before sending; omit it to retain the setting. The request matches the website chat's `enqueue` strategy: if another run is active, the new message waits for it, without interrupting it. `delivery: "accepted"` means the server accepted the words, not that the agent acted on them. Read `get_video_session` for its reply and current setting. If delivery is uncertain, inspect the session before resending; the auto switch may already have taken effect.
|
|
317
|
+
|
|
318
|
+
On freebeat.ai a person makes a video by chatting with the director agent and seeing what it made. ChatGPT/Codex stands where that person stands: it can give direction, ask for changes, approve, or hand the rest to auto. Whether and how to involve the user follows their intent. Credit consent is given once when starting the video; session messages do not require a new credit approval. The backend's credit notices are still relayed. Reading needs `freebeat:read`; sending needs `freebeat:generate`.
|
|
269
319
|
|
|
270
320
|
### `list_models`
|
|
271
321
|
|
|
@@ -298,6 +348,15 @@ Parameters:
|
|
|
298
348
|
|
|
299
349
|
Freebeat validates the options per model; check `get_model_help` first and read `message` if a request is rejected.
|
|
300
350
|
|
|
351
|
+
For image, image-edit, and video batches, `success: true` means the response was
|
|
352
|
+
retrieved; check `accepted_count` and `items[].accepted` to see what was accepted.
|
|
353
|
+
If Freebeat provides no specific rejection reason, the response says so without
|
|
354
|
+
guessing the cause. Structured required and available credit amounts can provide
|
|
355
|
+
actionable credit guidance. `accepted_credits` describes acceptance, not an actual
|
|
356
|
+
charge. When only accepted credits are reported, including `0`, check
|
|
357
|
+
`get_task_status` billing for actual charges and refunds. Zero-charge statements
|
|
358
|
+
require an explicitly reported charge of `0`.
|
|
359
|
+
|
|
301
360
|
### `generate_text`
|
|
302
361
|
|
|
303
362
|
Ask any text model from `list_models(type=text)` and get its reply. Parameters: `model`, `messages` (`role` and `content`, oldest first), optional `max_tokens` and `temperature`. Usage is billed to the user's Freebeat credits through the user's own gateway token. The response preserves numeric prompt/completion/total token counts and their defined numeric breakdowns, not arbitrary provider usage metadata.
|
|
@@ -306,7 +365,7 @@ Ask any text model from `list_models(type=text)` and get its reply. Parameters:
|
|
|
306
365
|
|
|
307
366
|
Poll a Freebeat async task or Open RPC batch until it reaches a terminal status. Task types are mapped to the MCP task categories, with `unknown` for unrecognized types. Status values are normalized to the MCP status set, including lowercase `pending`, `completed`, and `failed`; unrecognized upstream values become `unknown`.
|
|
308
367
|
|
|
309
|
-
For agent videos, effects, music, singing, and lip-sync tasks, continue polling while the status is still in progress. Agent videos may also report `action_required` with their own last message, any structured credit notice, and a `session_url` for
|
|
368
|
+
For agent videos, effects, music, singing, and lip-sync tasks, continue polling while the status is still in progress. Agent videos may also report `action_required` with their own last message, any structured credit notice, and a `session_url` for viewing. Use `get_video_session` to see the intermediate work and `send_video_agent_message` to continue in either mode. Call `get_task_result` after `completed`, `failed`, or `action_required`. If a task response cannot be read, `get_task_status` reports `unknown` and a viewing link; this is not a generation failure and must not trigger another paid submission.
|
|
310
369
|
|
|
311
370
|
For Open RPC image/video batches, pass the returned `batch_id` as `task_id`. You can also pass `serial_no` to query a single batch item. Completed batch items include result URLs directly in `get_task_status`, so `get_task_result` is not used for Open RPC batches.
|
|
312
371
|
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { ALL_TOOL_ACCESS } from "../../core/scopes.js";
|
|
2
2
|
import { registerGenerateAgentVideoTools } from "./tools/generate-agent-videos.js";
|
|
3
|
+
import { registerGetVideoSessionTool, registerSendVideoAgentMessageTool } from "./tools/video-session.js";
|
|
3
4
|
export function registerAgentTools(server, client, access = ALL_TOOL_ACCESS) {
|
|
4
5
|
if (access.generate)
|
|
5
6
|
registerGenerateAgentVideoTools(server, client);
|
|
7
|
+
if (access.generate)
|
|
8
|
+
registerSendVideoAgentMessageTool(server, client);
|
|
9
|
+
if (access.read)
|
|
10
|
+
registerGetVideoSessionTool(server, client);
|
|
6
11
|
}
|
|
7
12
|
//# sourceMappingURL=register.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/capabilities/agents/register.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAc,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/capabilities/agents/register.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAc,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,iCAAiC,EAAE,MAAM,0BAA0B,CAAC;AAE1G,MAAM,UAAU,kBAAkB,CAChC,MAAiB,EACjB,MAAyB,EACzB,SAAqB,eAAe;IAEpC,IAAI,MAAM,CAAC,QAAQ;QAAE,+BAA+B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrE,IAAI,MAAM,CAAC,QAAQ;QAAE,iCAAiC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvE,IAAI,MAAM,CAAC,IAAI;QAAE,2BAA2B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -2,31 +2,33 @@ import { acceptUnknownCostSchema, CREDIT_APPROVAL_DESCRIPTION, maxCreditsSchema,
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { AGENT_PRODUCTS } from "../../../core/agent-products.js";
|
|
4
4
|
import { formatToolError, toolResult, registerTool } from "../../../core/response.js";
|
|
5
|
+
import { CO_CREATE_DESCRIPTION, autoModeSchema } from "../../../core/video-session.js";
|
|
5
6
|
import { CREATE_TOOL_ANNOTATIONS } from "../../../core/tool-annotations.js";
|
|
6
7
|
const AGENT_VIDEO_TOOLS = {
|
|
7
8
|
music_video: {
|
|
8
9
|
name: "generate_music_video",
|
|
9
10
|
title: "Generate music video",
|
|
10
|
-
description: "Use this for music video generation: the user wants a music video (MV) for a song. Freebeat's music video agent plans scenes and generates and edits a multi-scene video timed to the song; people or characters from optional photos can appear. Requires music_id from upload_audio or a completed generate_music result; optional photos via upload_image. Starts a generation job that uses the user's existing Freebeat credits and usually takes 15–60 minutes; by default it uses the first 15 seconds of the song, or up to the song's end if shorter. Returns task_id and session_url; poll get_task_status every few minutes, call get_task_result after completed; on action_required
|
|
11
|
+
description: "Use this for music video generation: the user wants a music video (MV) for a song. Freebeat's music video agent plans scenes and generates and edits a multi-scene video timed to the song; people or characters from optional photos can appear. Requires music_id from upload_audio or a completed generate_music result; optional photos via upload_image. Starts a generation job that uses the user's existing Freebeat credits and usually takes 15–60 minutes; by default it uses the first 15 seconds of the song, or up to the song's end if shorter. Returns task_id and session_url; poll get_task_status every few minutes, call get_task_result after completed; on action_required read get_video_session and use send_video_agent_message to continue. Do not use for dance videos, lyric videos, short singing-photo clips, lip-sync of an existing clip, standalone video clips without a song, or generating audio.",
|
|
11
12
|
},
|
|
12
13
|
dance: {
|
|
13
14
|
name: "generate_dance_video",
|
|
14
15
|
title: "Generate dance video",
|
|
15
|
-
description: "Use this for dance video generation: the user wants dancers performing to a song. Freebeat's dance video agent plans and generates a dance video timed to the song; people in optional photos become the dancers. Supports vertical 9:16 and 3:4 formats. A 2026-10-27 production diagnosis found 855 credits for the video step alone of a 15-second 720p dance, with planning and images extra: budget on the order of 1,000 credits, not a fixed quote or cap. Requires music_id from upload_audio or a completed generate_music result; optional photos via upload_image. Starts a generation job that uses the user's existing Freebeat credits and usually takes 15–60 minutes; by default it uses the first 15 seconds of the song, or up to the song's end if shorter. Returns task_id and session_url; poll get_task_status every few minutes, call get_task_result after completed; on action_required
|
|
16
|
+
description: "Use this for dance video generation: the user wants dancers performing to a song. Freebeat's dance video agent plans and generates a dance video timed to the song; people in optional photos become the dancers. Supports vertical 9:16 and 3:4 formats. A 2026-10-27 production diagnosis found 855 credits for the video step alone of a 15-second 720p dance, with planning and images extra: budget on the order of 1,000 credits, not a fixed quote or cap. Requires music_id from upload_audio or a completed generate_music result; optional photos via upload_image. Starts a generation job that uses the user's existing Freebeat credits and usually takes 15–60 minutes; by default it uses the first 15 seconds of the song, or up to the song's end if shorter. Returns task_id and session_url; poll get_task_status every few minutes, call get_task_result after completed; on action_required read get_video_session and use send_video_agent_message to continue. Do not use for story-based music videos, lyric videos, short singing-photo clips, lip-sync of an existing clip, standalone video clips without a song, or generating audio.",
|
|
16
17
|
},
|
|
17
18
|
lyric_video: {
|
|
18
19
|
name: "generate_lyric_video",
|
|
19
20
|
title: "Generate lyric video",
|
|
20
|
-
description: "Use this for lyric video generation: the user wants animated lyrics timed to the vocals of a song. Freebeat's lyric video agent plans, generates, and edits the lyric video. Requires music_id from upload_audio or a completed generate_music result; optional reference photos via upload_image. Starts a generation job that uses the user's existing Freebeat credits and usually takes 15–60 minutes; by default it uses the first 15 seconds of the song, or up to the song's end if shorter. Returns task_id and session_url; poll get_task_status every few minutes, call get_task_result after completed; on action_required
|
|
21
|
+
description: "Use this for lyric video generation: the user wants animated lyrics timed to the vocals of a song. Freebeat's lyric video agent plans, generates, and edits the lyric video. Requires music_id from upload_audio or a completed generate_music result; optional reference photos via upload_image. Starts a generation job that uses the user's existing Freebeat credits and usually takes 15–60 minutes; by default it uses the first 15 seconds of the song, or up to the song's end if shorter. Returns task_id and session_url; poll get_task_status every few minutes, call get_task_result after completed; on action_required read get_video_session and use send_video_agent_message to continue. Do not use for story-based music videos, dance videos, short singing-photo clips, lip-sync of an existing clip, standalone video clips without a song, or generating audio.",
|
|
21
22
|
},
|
|
22
23
|
};
|
|
23
24
|
export function registerGenerateAgentVideoTools(server, client) {
|
|
24
25
|
for (const product of Object.keys(AGENT_VIDEO_TOOLS)) {
|
|
25
26
|
const tool = AGENT_VIDEO_TOOLS[product];
|
|
26
27
|
registerTool(server, tool.name, {
|
|
27
|
-
description: CREDIT_APPROVAL_DESCRIPTION + `Generated songs may return preparing with a numeric music_id and retry_after_seconds instead of a task_id. Retry with that music_id and unchanged approved parameters; no paid video starts before readiness. ${tool.description}`,
|
|
28
|
+
description: CREDIT_APPROVAL_DESCRIPTION + CO_CREATE_DESCRIPTION + `Generated songs may return preparing with a numeric music_id and retry_after_seconds instead of a task_id. Retry with that music_id and unchanged approved parameters; no paid video starts before readiness. ${tool.description}`,
|
|
28
29
|
annotations: { title: tool.title, ...CREATE_TOOL_ANNOTATIONS },
|
|
29
30
|
inputSchema: {
|
|
31
|
+
auto_mode: autoModeSchema,
|
|
30
32
|
max_credits: maxCreditsSchema,
|
|
31
33
|
accept_unknown_cost: acceptUnknownCostSchema,
|
|
32
34
|
music_id: z.union([z.number().int().positive(), z.string().regex(/^music:.+/)])
|
|
@@ -96,7 +98,7 @@ export function registerGenerateAgentVideoTools(server, client) {
|
|
|
96
98
|
task_type: result.task_type,
|
|
97
99
|
status: result.status,
|
|
98
100
|
session_url: result.session_url,
|
|
99
|
-
message: "The Freebeat agent started.
|
|
101
|
+
message: "The Freebeat agent started. Read get_video_session to see its work and talk through send_video_agent_message when it waits for input. Poll get_task_status for completion; full videos usually take 15-60 minutes.",
|
|
100
102
|
});
|
|
101
103
|
}
|
|
102
104
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-agent-videos.js","sourceRoot":"","sources":["../../../../src/capabilities/agents/tools/generate-agent-videos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAE7I,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAqB,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAG5E,MAAM,iBAAiB,GAAG;IACxB,WAAW,EAAE;QACX,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"generate-agent-videos.js","sourceRoot":"","sources":["../../../../src/capabilities/agents/tools/generate-agent-videos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAE7I,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAqB,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAG5E,MAAM,iBAAiB,GAAG;IACxB,WAAW,EAAE;QACX,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,u4BAAu4B;KAC14B;IACD,KAAK,EAAE;QACL,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,mmCAAmmC;KACtmC;IACD,WAAW,EAAE;QACX,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,w1BAAw1B;KAC31B;CACO,CAAC;AAEX,MAAM,UAAU,+BAA+B,CAC7C,MAAiB,EACjB,MAAmD;IAEnD,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAmB,EAAE,CAAC;QACvE,MAAM,IAAI,G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AAC;aACjD;SACF,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;YACf,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;gBACrE,IAAI,UAAU,IAAI,MAAM;oBAAE,OAAO,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;gBAC1E,OAAO,UAAU,CAAC;oBAChB,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE,MAAM,CAAC,KAAK;oBACnB,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,SAAS,EAAE,MAAM,CAAC,SAAS;oBAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,WAAW,EAAE,MAAM,CAAC,WAAW;oBAC/B,OAAO,EACL,oNAAoN;iBACvN,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACxB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;YAChC,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;AAEH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { FreebeatApiClient } from "../../../services/freebeat-api.js";
|
|
3
|
+
export declare function registerGetVideoSessionTool(server: McpServer, client: Pick<FreebeatApiClient, "getVideoSession">): void;
|
|
4
|
+
export declare function registerSendVideoAgentMessageTool(server: McpServer, client: Pick<FreebeatApiClient, "sendVideoAgentMessage">): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CO_CREATE_DESCRIPTION, autoModeSchema, videoSessionSchema, videoTaskIdSchema } from "../../../core/video-session.js";
|
|
3
|
+
import { registerTool, toolResult } from "../../../core/response.js";
|
|
4
|
+
import { CREATE_TOOL_ANNOTATIONS, READ_ONLY_TOOL_ANNOTATIONS } from "../../../core/tool-annotations.js";
|
|
5
|
+
export function registerGetVideoSessionTool(server, client) {
|
|
6
|
+
registerTool(server, "get_video_session", {
|
|
7
|
+
description: CO_CREATE_DESCRIPTION + "Read an existing song-driven video session: recent conversation and requests, running or waiting state, pipeline statuses, auto setting, and readable artifacts with viewable or playable media URLs. fields contain labeled display values, media contains their URLs. Results are bounded; truncated means some content was shortened or omitted. This read does not start work or final rendering.",
|
|
8
|
+
annotations: { title: "Get video session", ...READ_ONLY_TOOL_ANNOTATIONS },
|
|
9
|
+
inputSchema: { task_id: videoTaskIdSchema },
|
|
10
|
+
outputSchema: { success: z.literal(true), ...videoSessionSchema.shape },
|
|
11
|
+
}, async ({ task_id }) => toolResult({ success: true, ...await client.getVideoSession(task_id) }));
|
|
12
|
+
}
|
|
13
|
+
export function registerSendVideoAgentMessageTool(server, client) {
|
|
14
|
+
registerTool(server, "send_video_agent_message", {
|
|
15
|
+
description: CO_CREATE_DESCRIPTION + "Send the person's words to an existing video session, with an optional auto setting change applied before the message. Like the website's chat box, it only sends while the agent is not running; during a run it sends nothing and returns an error, so wait until get_task_status is no longer running. An accepted response confirms receipt, not that the agent has acted; read get_video_session for the reply. Changes and continuation can use the session's existing credit authorization. Do not request another credit approval for each message. If delivery is uncertain, read the session before resending.",
|
|
16
|
+
annotations: { title: "Send video agent message", ...CREATE_TOOL_ANNOTATIONS },
|
|
17
|
+
inputSchema: {
|
|
18
|
+
task_id: videoTaskIdSchema,
|
|
19
|
+
message: z.string().trim().min(1).max(4000).describe("What the person wants to say to the director agent, in their own words."),
|
|
20
|
+
auto_mode: autoModeSchema.optional().describe("Optional change of the session's auto setting, applied before sending the message. Omit to keep its current setting."),
|
|
21
|
+
},
|
|
22
|
+
outputSchema: {
|
|
23
|
+
success: z.literal(true), task_id: videoTaskIdSchema, delivery: z.literal("accepted"),
|
|
24
|
+
auto_mode: z.boolean().optional().describe("Auto setting confirmed by PATCH when requested; get_video_session returns the current effective setting."),
|
|
25
|
+
message: z.string(),
|
|
26
|
+
},
|
|
27
|
+
}, async (params) => toolResult({ success: true, ...await client.sendVideoAgentMessage(params) }));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=video-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video-session.js","sourceRoot":"","sources":["../../../../src/capabilities/agents/tools/video-session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC9H,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAGxG,MAAM,UAAU,2BAA2B,CAAC,MAAiB,EAAE,MAAkD;IAC/G,YAAY,CAAC,MAAM,EAAE,mBAAmB,EAAE;QACxC,WAAW,EAAE,qBAAqB,GAAG,uYAAuY;QAC5a,WAAW,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,GAAG,0BAA0B,EAAE;QAC1E,WAAW,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE;QAC3C,YAAY,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,kBAAkB,CAAC,KAAK,EAAE;KACxE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACrG,CAAC;AAED,MAAM,UAAU,iCAAiC,CAAC,MAAiB,EAAE,MAAwD;IAC3H,YAAY,CAAC,MAAM,EAAE,0BAA0B,EAAE;QAC/C,WAAW,EAAE,qBAAqB,GAAG,0lBAA0lB;QAC/nB,WAAW,EAAE,EAAE,KAAK,EAAE,0BAA0B,EAAE,GAAG,uBAAuB,EAAE;QAC9E,WAAW,EAAE;YACX,OAAO,EAAE,iBAAiB;YAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,yEAAyE,CAAC;YAC/H,SAAS,EAAE,cAAc,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sHAAsH,CAAC;SACtK;QACD,YAAY,EAAE;YACZ,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;YACrF,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0GAA0G,CAAC;YACtJ,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;SACpB;KACF,EAAE,KAAK,EAAC,MAAM,EAAC,EAAE,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -14,7 +14,7 @@ function normalizeEffect(effect) {
|
|
|
14
14
|
}
|
|
15
15
|
export function registerListEffectsTool(server, client) {
|
|
16
16
|
registerTool(server, "list_effects", {
|
|
17
|
-
description: "Use this when the user wants effect templates and the metadata needed to select an effect and create an effect task. Each effect includes a default image_url and default_music_id you can use directly. This lists templates rather than generating a video. For song-driven music, dance, or lyric videos, use generate_music_video, generate_dance_video, or generate_lyric_video.",
|
|
17
|
+
description: "Use this when the user wants effect templates and the metadata needed to select an effect and create an effect task. Returns 20 effects per page by default; use page and page_size to browse, and next_page until it is null. Each effect includes a default image_url and default_music_id you can use directly. This lists templates rather than generating a video. For song-driven music, dance, or lyric videos, use generate_music_video, generate_dance_video, or generate_lyric_video.",
|
|
18
18
|
annotations: { title: "List effects", ...READ_ONLY_TOOL_ANNOTATIONS },
|
|
19
19
|
outputSchema: {
|
|
20
20
|
success: z
|
|
@@ -35,18 +35,31 @@ export function registerListEffectsTool(server, client) {
|
|
|
35
35
|
aspect_ratio: z.string().describe("Preview aspect ratio."),
|
|
36
36
|
}))
|
|
37
37
|
.describe("Supported effects with the metadata needed to create an effect task."),
|
|
38
|
+
total: z.number().int().nonnegative().describe("Total number of supported effects across all pages."),
|
|
39
|
+
page: z.number().int().min(1).describe("Requested page number, starting at 1."),
|
|
40
|
+
page_size: z.number().int().min(1).max(100).describe("Requested maximum number of effects per page."),
|
|
41
|
+
next_page: z.number().int().min(1).nullable().describe("Next page number, or null when no further effects are available."),
|
|
38
42
|
message: z
|
|
39
43
|
.string()
|
|
40
44
|
.describe("A human-readable summary of the retrieved effects."),
|
|
41
45
|
},
|
|
42
|
-
inputSchema: {
|
|
43
|
-
|
|
46
|
+
inputSchema: {
|
|
47
|
+
page: z.number().int().min(1).default(1).describe("Page number, starting at 1."),
|
|
48
|
+
page_size: z.number().int().min(1).max(100).default(20).describe("Effects per page, from 1 to 100; defaults to 20."),
|
|
49
|
+
},
|
|
50
|
+
}, async ({ page, page_size }) => {
|
|
44
51
|
try {
|
|
45
52
|
const effects = await client.listEffects();
|
|
53
|
+
const start = (page - 1) * page_size;
|
|
54
|
+
const pageEffects = effects.slice(start, start + page_size);
|
|
46
55
|
return toolResult({
|
|
47
56
|
success: true,
|
|
48
|
-
effects:
|
|
49
|
-
|
|
57
|
+
effects: pageEffects.map(normalizeEffect),
|
|
58
|
+
total: effects.length,
|
|
59
|
+
page,
|
|
60
|
+
page_size,
|
|
61
|
+
next_page: start + page_size < effects.length ? page + 1 : null,
|
|
62
|
+
message: `Retrieved ${pageEffects.length} of ${effects.length} effect(s) (page ${page}).`,
|
|
50
63
|
});
|
|
51
64
|
}
|
|
52
65
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-effects.js","sourceRoot":"","sources":["../../../../src/capabilities/effects/tools/list-effects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAG/E,SAAS,eAAe,CAAC,MAAsB;IAC7C,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,aAAa;QAC/B,YAAY,EAAE,MAAM,CAAC,kBAAkB;QACvC,SAAS,EAAE,MAAM,CAAC,QAAQ;QAC1B,iBAAiB,EAAE,MAAM,CAAC,QAAQ;QAClC,gBAAgB,EAAE,MAAM,CAAC,OAAO;QAChC,kBAAkB,EAAE,MAAM,CAAC,SAAS;QACpC,YAAY,EAAE,MAAM,CAAC,WAAW;KACjC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,MAA8C;IAE9C,YAAY,CAAC,MAAM,EACjB,cAAc,EACd;QACE,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"list-effects.js","sourceRoot":"","sources":["../../../../src/capabilities/effects/tools/list-effects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAG/E,SAAS,eAAe,CAAC,MAAsB;IAC7C,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,aAAa;QAC/B,YAAY,EAAE,MAAM,CAAC,kBAAkB;QACvC,SAAS,EAAE,MAAM,CAAC,QAAQ;QAC1B,iBAAiB,EAAE,MAAM,CAAC,QAAQ;QAClC,gBAAgB,E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AC;gBACzC,KAAK,EAAE,OAAO,CAAC,MAAM;gBACrB,IAAI;gBACJ,SAAS;gBACT,SAAS,EAAE,KAAK,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;gBAC/D,OAAO,EAAE,aAAa,WAAW,CAAC,MAAM,OAAO,OAAO,CAAC,MAAM,oBAAoB,IAAI,IAAI;aAC1F,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -19,13 +19,13 @@ export declare const batchCreateOutputSchema: {
|
|
|
19
19
|
source: z.ZodString;
|
|
20
20
|
message: z.ZodString;
|
|
21
21
|
}, "strip", z.ZodTypeAny, {
|
|
22
|
-
message: string;
|
|
23
22
|
status: "quoted" | "unavailable";
|
|
23
|
+
message: string;
|
|
24
24
|
source: string;
|
|
25
25
|
credits?: number | undefined;
|
|
26
26
|
}, {
|
|
27
|
-
message: string;
|
|
28
27
|
status: "quoted" | "unavailable";
|
|
28
|
+
message: string;
|
|
29
29
|
source: string;
|
|
30
30
|
credits?: number | undefined;
|
|
31
31
|
}>>;
|
|
@@ -46,18 +46,18 @@ export declare const batchCreateOutputSchema: {
|
|
|
46
46
|
code: z.ZodNull;
|
|
47
47
|
message: z.ZodNullable<z.ZodString>;
|
|
48
48
|
}, "strip", z.ZodTypeAny, {
|
|
49
|
-
|
|
49
|
+
status: "unknown" | "running" | "completed" | "failed" | "pending" | "queued" | "accepted" | "processing" | "rejected" | "cancelled" | "action_required" | "partial_failed";
|
|
50
50
|
code: null;
|
|
51
51
|
message: string | null;
|
|
52
|
-
|
|
52
|
+
accepted: boolean;
|
|
53
53
|
business_type: number;
|
|
54
54
|
serial_no: string | null;
|
|
55
55
|
need_credits: number;
|
|
56
56
|
}, {
|
|
57
|
-
|
|
57
|
+
status: "unknown" | "running" | "completed" | "failed" | "pending" | "queued" | "accepted" | "processing" | "rejected" | "cancelled" | "action_required" | "partial_failed";
|
|
58
58
|
code: null;
|
|
59
59
|
message: string | null;
|
|
60
|
-
|
|
60
|
+
accepted: boolean;
|
|
61
61
|
business_type: number;
|
|
62
62
|
serial_no: string | null;
|
|
63
63
|
need_credits: number;
|
|
@@ -15,7 +15,7 @@ const GENERATION_TYPE_NAMES = {
|
|
|
15
15
|
};
|
|
16
16
|
export const batchCreateOutputSchema = {
|
|
17
17
|
quote: creditQuoteSchema.optional(),
|
|
18
|
-
success: z.literal(true).describe("Whether the batch
|
|
18
|
+
success: z.literal(true).describe("Whether the batch response was retrieved; check accepted_count and items[].accepted for acceptance."),
|
|
19
19
|
batch_id: z.string().describe("Open RPC batch ID for get_task_status."),
|
|
20
20
|
batch_status: taskStatusSchema.describe("Initial batch status."),
|
|
21
21
|
total_count: z.number().describe("Total number of submitted items."),
|
|
@@ -58,7 +58,7 @@ export function normalizeBatchCreate(response, noun) {
|
|
|
58
58
|
message: item.message,
|
|
59
59
|
})),
|
|
60
60
|
message: rejected.length === response.items.length
|
|
61
|
-
? `${noun} was
|
|
61
|
+
? `${noun} was not accepted. ${[...new Set(rejected.map((item) => item.message ?? "Freebeat did not provide a specific rejection reason."))].join(" ")}`
|
|
62
62
|
: `${noun} batch queued. Use get_task_status with task_id="${response.batchId}" to check status.`,
|
|
63
63
|
};
|
|
64
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/capabilities/media/tools/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE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,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;SAC9F,CAAC,CAAC;KACJ,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,cAAsB;IACvD,OAAO,qBAAqB,CAAC,cAAc,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -7,6 +7,8 @@ import { AppError } from "../../../core/errors.js";
|
|
|
7
7
|
import { formatToolError, toolResult, registerTool } from "../../../core/response.js";
|
|
8
8
|
import { READ_ONLY_TOOL_ANNOTATIONS } from "../../../core/tool-annotations.js";
|
|
9
9
|
import { EFFECT_TASK_TYPE } from "../../effects/task-type.js";
|
|
10
|
+
import { AGENT_PRODUCTS } from "../../../core/agent-products.js";
|
|
11
|
+
import { decodeCreativeTaskId } from "../../../core/creative-task-id.js";
|
|
10
12
|
import { DANCE_VIDEO_TASK_TYPE, LIP_SYNC_VIDEO_TASK_TYPE, LYRIC_VIDEO_TASK_TYPE, MUSIC_VIDEO_TASK_TYPE, MUSIC_GENERATION_TASK_TYPE, SINGING_VIDEO_TASK_TYPE, } from "../../../core/task-types.js";
|
|
11
13
|
import { mapSessionTypeToTaskType } from "../task-type.js";
|
|
12
14
|
const SUPPORTED_RESULT_TASK_TYPES = new Set([
|
|
@@ -43,6 +45,15 @@ function normalizeTaskResult(result) {
|
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
if (normalizedStatus !== "completed") {
|
|
48
|
+
const creative = decodeCreativeTaskId(result.task_id);
|
|
49
|
+
if (normalizedStatus === "running" && creative && creative.kind in AGENT_PRODUCTS)
|
|
50
|
+
return {
|
|
51
|
+
success: true, task_id: result.task_id, task_type, status: normalizedStatus,
|
|
52
|
+
message: result.message ?? "Freebeat is preparing the final video. Poll again later.",
|
|
53
|
+
billing: result.billing ?? taskOutcome({ usedCredits: result.used_credits }).billing,
|
|
54
|
+
used_credits: result.used_credits, session_url: result.session_url,
|
|
55
|
+
billing_message: "Freebeat has not returned a completed final video yet.",
|
|
56
|
+
};
|
|
46
57
|
throw new AppError(`Task is not completed yet. Current status: ${normalizedStatus}. Call get_task_status until status is completed before calling get_task_result.`, "TASK_NOT_COMPLETED");
|
|
47
58
|
}
|
|
48
59
|
if (!SUPPORTED_RESULT_TASK_TYPES.has(task_type)) {
|
|
@@ -71,8 +82,8 @@ function normalizeTaskResult(result) {
|
|
|
71
82
|
}
|
|
72
83
|
export function registerGetTaskResultTool(server, client) {
|
|
73
84
|
registerTool(server, "get_task_result", {
|
|
74
|
-
description: "Use this when the user needs output or failure and billing details from an existing Freebeat task. Call after get_task_status returns completed, failed, or action_required. Failed or paused tasks return failure and billing even without final media. Song-driven videos from generate_music_video, generate_dance_video, and generate_lyric_video, plus effects, singing, and lip-sync tasks, return result.video_url and usually result.cover_url; music tasks return result.audio_url.
|
|
75
|
-
annotations: { title: "Get task result", ...READ_ONLY_TOOL_ANNOTATIONS },
|
|
85
|
+
description: "Use this when the user needs output or failure and billing details from an existing Freebeat task. Call after get_task_status returns completed, failed, or action_required. Failed or paused tasks return failure and billing even without final media. When an agent video is action_required, read get_video_session and use send_video_agent_message with the same task_id to continue in either mode. Polling a song-driven video may start its final video assembly from already generated assets; it does not regenerate source assets. Song-driven videos from generate_music_video, generate_dance_video, and generate_lyric_video, plus effects, singing, and lip-sync tasks, return result.video_url and usually result.cover_url; music tasks return result.audio_url. Song-driven video assembly still in progress returns running with a message to poll again. Other pending or running tasks return TASK_NOT_COMPLETED. If the task failed, this tool surfaces the backend failure. For Open RPC image/video batches, get result URLs from get_task_status instead.",
|
|
86
|
+
annotations: { title: "Get task result", ...READ_ONLY_TOOL_ANNOTATIONS, readOnlyHint: false },
|
|
76
87
|
outputSchema: {
|
|
77
88
|
success: z
|
|
78
89
|
.literal(true)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-task-result.js","sourceRoot":"","sources":["../../../../src/capabilities/tasks/tools/get-task-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA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QAC7B,MAAM,IAAI,QAAQ,CAChB,iHAAiH,EACjH,kBAAkB,CACnB,CAAC;IACJ,CAAC;IAED,MAAM,aAAa,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IACxD,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,aAAa,CAAC,CAAC;IAChE,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,QAAQ,CAChB,0HAA0H,EAC1H,kBAAkB,CACnB,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,gBAAgB,CAAC,SAAS,IAAI,gBAAgB,CAAC,SAAS,CAAC;IAC5E,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,SAAS;QACT,MAAM,EAAE,gBAAgB;QACxB,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,WAAW,CAAC,EAAC,WAAW,EAAC,MAAM,CAAC,YAAY,EAAC,CAAC,CAAC,OAAO;QACjF,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,eAAe,EAAE,MAAM,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,iEAAiE,CAAC,CAAC,CAAC,oDAAoD;QAC7K,OAAO,EAAE,8BAA8B,UAAU,EAAE;KACpD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,MAAiB,EACjB,MAAgD;IAEhD,YAAY,CAAC,MAAM,EACjB,iBAAiB,EACjB;QACE,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"get-task-result.js","sourceRoot":"","sources":["../../../../src/capabilities/tasks/tools/get-task-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAA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AC,OAAO,CAAC,CAAC;YACnD,OAAO,UAAU,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;QACjD,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { taskTypeSchema } from "../../../core/task-types.js";
|
|
2
2
|
import { normalizeTaskStatus, taskStatusSchema } from "../../../core/task-status.js";
|
|
3
|
+
import { normalizeCreativeResult } from "../../../core/task-result.js";
|
|
3
4
|
import { billingSchema, failureSchema, taskOutcome } from "../../../core/task-outcome.js";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
import { formatToolError, toolResult, registerTool } from "../../../core/response.js";
|
|
@@ -26,13 +27,13 @@ function normalizeBatchStatus(batch) {
|
|
|
26
27
|
task_type: "open_rpc_batch",
|
|
27
28
|
status,
|
|
28
29
|
batch_id: batch.batchId,
|
|
29
|
-
items: batch.items.map((item) => ({
|
|
30
|
+
items: batch.items.map((item, index) => ({
|
|
30
31
|
business_type: item.businessType,
|
|
31
32
|
serial_no: item.serialNo,
|
|
32
33
|
status: normalizeTaskStatus(item.status),
|
|
33
|
-
used_credits:
|
|
34
|
+
used_credits: billings[index].charged,
|
|
34
35
|
failure: item.failure,
|
|
35
|
-
billing:
|
|
36
|
+
billing: billings[index],
|
|
36
37
|
error_code: null,
|
|
37
38
|
error_message: item.errorMessage,
|
|
38
39
|
video_url: item.videoUrl,
|
|
@@ -61,8 +62,8 @@ function summarizeBatchStatus(batch) {
|
|
|
61
62
|
}
|
|
62
63
|
export function registerGetTaskStatusTool(server, client) {
|
|
63
64
|
registerTool(server, "get_task_status", {
|
|
64
|
-
description: "Use this when the user needs the status of an existing asynchronous Freebeat task. Supports task IDs from generate_music_video, generate_dance_video, generate_lyric_video, music, singing, lip-sync, and effect tools, plus Open RPC image/video batch IDs. Song-driven video jobs report running, completed, or action_required;
|
|
65
|
-
annotations: { title: "Get task status", ...READ_ONLY_TOOL_ANNOTATIONS },
|
|
65
|
+
description: "Use this when the user needs the status of an existing asynchronous Freebeat task. Supports task IDs from generate_music_video, generate_dance_video, generate_lyric_video, music, singing, lip-sync, and effect tools, plus Open RPC image/video batch IDs. Polling a song-driven video may start its final video assembly from already generated assets; it does not regenerate source assets. Song-driven video jobs report running, completed, failed, or action_required; while running, relay the latest step named in message; completed videos include video_url, and on action_required read get_video_session with this task_id and use send_video_agent_message to continue the conversation in either auto or co-create mode. For Open RPC batches, result URLs are returned on completed items; do not call get_task_result for these batches. For other tasks call get_task_result after completed, failed, or action_required. On failures or pauses, explain failure.stage, failure.reason, failure.retryable and billing charged/refunded/net/refund_state; null means not reported, and pending refunds are not refunded credits.",
|
|
66
|
+
annotations: { title: "Get task status", ...READ_ONLY_TOOL_ANNOTATIONS, readOnlyHint: false },
|
|
66
67
|
outputSchema: {
|
|
67
68
|
success: z
|
|
68
69
|
.literal(true)
|
|
@@ -90,6 +91,7 @@ export function registerGetTaskStatusTool(server, client) {
|
|
|
90
91
|
.string()
|
|
91
92
|
.optional()
|
|
92
93
|
.describe("For agent videos, the freebeat.ai page where the user can watch, review, or continue the session."),
|
|
94
|
+
video_url: z.string().optional().describe("The playable final video URL when the task is completed."),
|
|
93
95
|
batch_id: z
|
|
94
96
|
.string()
|
|
95
97
|
.optional()
|
|
@@ -99,7 +101,7 @@ export function registerGetTaskStatusTool(server, client) {
|
|
|
99
101
|
business_type: z.number(),
|
|
100
102
|
serial_no: z.string(),
|
|
101
103
|
status: taskStatusSchema,
|
|
102
|
-
used_credits: z.number(),
|
|
104
|
+
used_credits: z.number().nullable(),
|
|
103
105
|
failure: failureSchema.optional(),
|
|
104
106
|
billing: billingSchema,
|
|
105
107
|
error_code: z.null(),
|
|
@@ -144,6 +146,8 @@ export function registerGetTaskStatusTool(server, client) {
|
|
|
144
146
|
task_id: result.task_id,
|
|
145
147
|
task_type,
|
|
146
148
|
status: normalizedStatus,
|
|
149
|
+
video_url: normalizedStatus === "completed" && result.result_payload
|
|
150
|
+
? normalizeCreativeResult(JSON.parse(result.result_payload))?.video_url : undefined,
|
|
147
151
|
error_message: result.error_message,
|
|
148
152
|
message,
|
|
149
153
|
session_url: result.session_url,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-task-status.js","sourceRoot":"","sources":["../../../../src/capabilities/tasks/tools/get-task-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE1F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAK/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,SAAS,mBAAmB,CAAC,MAAc,EAAE,QAAiB;IAC5D,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AACzF,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAgC;IAC5D,MAAM,MAAM,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,MAAM,KAAK,WAAW;QACpC,CAAC,CAAC,+DAA+D;QACjE,CAAC,CAAC,MAAM,KAAK,QAAQ;YACnB,CAAC,CAAC,2DAA2D;YAC7D,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CA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C,CAAC;QACL,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -32,6 +32,25 @@ export declare const AGENT_PRODUCTS: {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
export type AgentProduct = keyof typeof AGENT_PRODUCTS;
|
|
35
|
+
export type AgentFinalVideoRenderer = (input: {
|
|
36
|
+
product: AgentProduct;
|
|
37
|
+
threadId: string;
|
|
38
|
+
flowIndex: string;
|
|
39
|
+
assetVersion: string;
|
|
40
|
+
isCurrent: () => Promise<boolean>;
|
|
41
|
+
}) => Promise<{
|
|
42
|
+
status: "running";
|
|
43
|
+
} | {
|
|
44
|
+
status: "completed";
|
|
45
|
+
video_url: string;
|
|
46
|
+
} | {
|
|
47
|
+
status: "failed";
|
|
48
|
+
failure: {
|
|
49
|
+
stage: string;
|
|
50
|
+
reason: string;
|
|
51
|
+
retryable: boolean | null;
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
35
54
|
export declare const AGENT_PRODUCT_NAMES: [AgentProduct, ...AgentProduct[]];
|
|
36
55
|
export type AgentEndpoints = {
|
|
37
56
|
webHost: string;
|