applaunchflow 0.3.4 → 0.3.5
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.
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import test from "node:test";
|
|
3
|
-
import { buildPromoVideoCandidateRequest,
|
|
3
|
+
import { buildPromoVideoCandidateRequest, buildPromoVideoDashboardUrl, } from "./tools/promovideo.js";
|
|
4
4
|
test("generate_promo_video requests three transient candidates", () => {
|
|
5
5
|
assert.deepEqual(buildPromoVideoCandidateRequest({ projectId: "project", message: "fresh" }), { projectId: "project", message: "fresh", candidateCount: 3 });
|
|
6
6
|
});
|
|
7
7
|
test("the MCP opens the dashboard candidate picker instead of a saved variant", () => {
|
|
8
|
-
const url = new URL(
|
|
8
|
+
const url = new URL(buildPromoVideoDashboardUrl({
|
|
9
9
|
credentials: { baseUrl: "https://dashboard.applaunchflow.com" },
|
|
10
10
|
}, {
|
|
11
11
|
generationId: "11111111-1111-4111-8111-111111111111",
|
|
12
12
|
candidateKey: "candidate-key",
|
|
13
13
|
replaceVariantId: "22222222-2222-4222-8222-222222222222",
|
|
14
14
|
}));
|
|
15
|
-
assert.equal(url.pathname, "/
|
|
15
|
+
assert.equal(url.pathname, "/promo-video-picker");
|
|
16
16
|
assert.equal(url.searchParams.get("candidateKey"), "candidate-key");
|
|
17
17
|
assert.equal(url.searchParams.get("replaceVariantId"), "22222222-2222-4222-8222-222222222222");
|
|
18
18
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { createHostedReadReceipt, createReadReceiptStore, fail, hostedMcpEnabled, ok, openUrl, verifyHostedReadReceipt, } from "./utils.js";
|
|
3
3
|
const promoReceiptKey = (generationId, variantId) => ["promo-video", generationId, variantId || "active"].join("::");
|
|
4
|
-
export function
|
|
4
|
+
export function buildPromoVideoDashboardUrl(client, args) {
|
|
5
5
|
const params = new URLSearchParams({ projectId: args.generationId });
|
|
6
6
|
if (args.variantId) {
|
|
7
7
|
params.set("variantId", args.variantId);
|
|
@@ -12,7 +12,10 @@ export function buildPromoVideoEditorUrl(client, args) {
|
|
|
12
12
|
if (args.replaceVariantId) {
|
|
13
13
|
params.set("replaceVariantId", args.replaceVariantId);
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
const pathname = args.candidateKey
|
|
16
|
+
? "/promo-video-picker"
|
|
17
|
+
: "/promovideo";
|
|
18
|
+
return `${client.credentials.baseUrl}${pathname}?${params.toString()}`;
|
|
16
19
|
}
|
|
17
20
|
export function buildPromoVideoCandidateRequest(args) {
|
|
18
21
|
return { ...args, candidateCount: 3 };
|
|
@@ -53,26 +56,26 @@ export function registerPromoVideoTools(server, client) {
|
|
|
53
56
|
if (!result?.candidateKey || result?.candidates?.length !== 3) {
|
|
54
57
|
throw new Error("Promo video generation did not return a reusable three-option picker");
|
|
55
58
|
}
|
|
56
|
-
const
|
|
59
|
+
const pickerUrl = buildPromoVideoDashboardUrl(client, {
|
|
57
60
|
generationId: args.projectId,
|
|
58
61
|
candidateKey: result.candidateKey,
|
|
59
62
|
replaceVariantId: args.replaceVariantId,
|
|
60
63
|
});
|
|
61
|
-
await openUrl(server,
|
|
64
|
+
await openUrl(server, pickerUrl, "Compare three personalized promo-video candidates and choose which one to create.", { signal: extra.signal });
|
|
62
65
|
return {
|
|
63
66
|
content: [
|
|
64
67
|
{
|
|
65
68
|
type: "text",
|
|
66
69
|
text: [
|
|
67
70
|
"Prepared three personalized promo-video candidates without creating a saved variant yet.",
|
|
68
|
-
`Candidate picker URL: ${
|
|
71
|
+
`Candidate picker URL: ${pickerUrl}`,
|
|
69
72
|
"The dashboard picker previews all three options. Choosing one creates that variant and opens it in the promo-video editor.",
|
|
70
73
|
].join("\n"),
|
|
71
74
|
},
|
|
72
75
|
],
|
|
73
76
|
structuredContent: {
|
|
74
77
|
success: true,
|
|
75
|
-
data: { ...result, editorUrl },
|
|
78
|
+
data: { ...result, editorUrl: pickerUrl },
|
|
76
79
|
message: "Prepared promo video candidates",
|
|
77
80
|
},
|
|
78
81
|
};
|
|
@@ -92,7 +95,7 @@ export function registerPromoVideoTools(server, client) {
|
|
|
92
95
|
}, async ({ generationId, variantId }) => {
|
|
93
96
|
try {
|
|
94
97
|
const result = await client.getPromoVideo(generationId, variantId);
|
|
95
|
-
const editorUrl =
|
|
98
|
+
const editorUrl = buildPromoVideoDashboardUrl(client, {
|
|
96
99
|
generationId,
|
|
97
100
|
variantId,
|
|
98
101
|
});
|
|
@@ -168,7 +171,7 @@ export function registerPromoVideoTools(server, client) {
|
|
|
168
171
|
const { readReceipt: _readReceipt, ...updateArgs } = args;
|
|
169
172
|
const result = await client.updatePromoVideo(updateArgs);
|
|
170
173
|
promoVideoReadReceipts.consume(receiptArgs);
|
|
171
|
-
const editorUrl =
|
|
174
|
+
const editorUrl = buildPromoVideoDashboardUrl(client, {
|
|
172
175
|
generationId: args.projectId,
|
|
173
176
|
variantId: args.variantId,
|
|
174
177
|
});
|