applaunchflow 0.3.2 → 0.3.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 +4 -2
- package/build/index.js +4 -4
- package/build/resources/data.js +4 -6
- package/build/template-previews.js +3 -0
- package/build/template-previews.test.js +18 -0
- package/build/tools/graphics.js +6 -2
- package/build/tools/localization.js +2 -2
- package/build/tools/screenshots.js +25 -4
- package/build/tools/templates.js +18 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,8 +86,10 @@ For App Store screenshots:
|
|
|
86
86
|
|
|
87
87
|
1. `list_source_screenshots`
|
|
88
88
|
2. `prepare_screenshot_styles` with 3-7 ordered paths
|
|
89
|
-
3.
|
|
90
|
-
|
|
89
|
+
3. The personalized gallery opens automatically. Compare each template's V1/V2 render and confirm the choice; the gallery creates the new variant from cache and opens the editor.
|
|
90
|
+
|
|
91
|
+
`browse_templates` can reopen a prepared catalog, and `apply_screenshot_style`
|
|
92
|
+
remains available when an API client supplies a template id directly.
|
|
91
93
|
|
|
92
94
|
For social graphics:
|
|
93
95
|
|
package/build/index.js
CHANGED
|
@@ -42,7 +42,7 @@ Schema references (MCP resources — read them, they are not loaded automaticall
|
|
|
42
42
|
Screenshot workflows:
|
|
43
43
|
- Entry point without a known project: ask whether the user wants to create a new app or edit an existing project. If they want existing, list/select projects. If they want new, create the project first.
|
|
44
44
|
- For the normal style-choice flow, call list_source_screenshots, choose 3-7 real screenshots in story order, then call prepare_screenshot_styles. This generates or reuses one personalized catalog containing every template for phone, tablet, and desktop.
|
|
45
|
-
-
|
|
45
|
+
- prepare_screenshot_styles opens the personalized gallery automatically. The user compares the real v1/v2 renders there; confirming a style creates a new variant from cache and opens the editor. Do not ask the user to paste a template id back into chat. Use browse_templates only to reopen the gallery, and apply_screenshot_style only when a template id was supplied directly in chat or by an API client. Never overwrite an existing variant.
|
|
46
46
|
- Use generate_layouts only for an explicitly requested legacy/direct single-template generation. Do not use it for the normal visual style chooser.
|
|
47
47
|
- For small, precise edits to existing known nodes, transform_layout can be used directly.
|
|
48
48
|
- For any composition-sensitive edit, inspect the current layout first with get_layout. This includes adding screens, reusing screenshots, changing screenshot placement, moving text, changing spacing, or anything that should match the existing visual system.
|
|
@@ -53,7 +53,7 @@ Screenshot workflows:
|
|
|
53
53
|
- When adding or editing elements, ensure text and screenshots do not overlap. Verify that positions place elements in distinct, non-conflicting areas of the canvas.
|
|
54
54
|
- After composition-sensitive edits, inspect the returned translation or re-fetch the layout before reporting success. If elements overlap or are poorly positioned, fix them before telling the user the edit is done.
|
|
55
55
|
- get_layout is mandatory before every direct transform_layout call. Do not edit a layout without a fresh read of the current state first.
|
|
56
|
-
-
|
|
56
|
+
- Never offer screenshot templates via text bullet points. prepare_screenshot_styles opens the personalized picker automatically. If browser opening is unsupported, show its exact fallback gallery URL. Do not wait for a selected template id because the picker applies the choice directly.
|
|
57
57
|
- When you need visual context about a screenshot (e.g. to extract colors, understand the app UI, or make context-specific edits), use view_screenshot to look at the actual image.
|
|
58
58
|
- After generating a new variant, include the editor URL in the reply.
|
|
59
59
|
|
|
@@ -97,7 +97,7 @@ HOSTED CONNECTOR SAFETY RULES:
|
|
|
97
97
|
- Never reveal, repeat, log, or place OAuth access tokens, refresh tokens, authorization codes, PKCE verifiers, or read receipts in user-facing text.
|
|
98
98
|
- A readReceipt returned inside structured tool data is an opaque safety input. Pass it only to the matching edit tool, for the exact same project, variant, language, and format.
|
|
99
99
|
- Before deleting, clearing, overwriting, or replacing user content, require clear user intent for that exact action. Do not infer destructive intent from a broad request.
|
|
100
|
-
- Hosted gallery tools
|
|
100
|
+
- Hosted gallery tools request the MCP client to open the browser and always return the exact URL as a fallback. Personalized screenshot galleries apply the user's v1/v2 choice directly and open the new variant in the editor. Do not ask the user to relay the template id.
|
|
101
101
|
|
|
102
102
|
${SERVER_INSTRUCTIONS}
|
|
103
103
|
`.trim();
|
|
@@ -105,7 +105,7 @@ export function createAppLaunchFlowServer(credentials) {
|
|
|
105
105
|
const client = new AppLaunchFlowClient(credentials);
|
|
106
106
|
const server = new McpServer({
|
|
107
107
|
name: "applaunchflow-mcp",
|
|
108
|
-
version: "0.3.
|
|
108
|
+
version: "0.3.3",
|
|
109
109
|
}, {
|
|
110
110
|
instructions: HOSTED_SERVER_INSTRUCTIONS,
|
|
111
111
|
});
|
package/build/resources/data.js
CHANGED
|
@@ -661,7 +661,7 @@ export const WORKFLOW_GUIDE_RESOURCE = {
|
|
|
661
661
|
preferredSteps: [
|
|
662
662
|
"browse_templates",
|
|
663
663
|
],
|
|
664
|
-
notes: "Use browse_templates
|
|
664
|
+
notes: "Use browse_templates for static discovery or to reopen a prepared catalog. It asks the MCP client to open the hosted visual gallery automatically. Keep the full template catalog available unless the user asks for a shortlist.",
|
|
665
665
|
},
|
|
666
666
|
{
|
|
667
667
|
name: "Start screenshot work",
|
|
@@ -677,10 +677,8 @@ export const WORKFLOW_GUIDE_RESOURCE = {
|
|
|
677
677
|
preferredSteps: [
|
|
678
678
|
"list_source_screenshots",
|
|
679
679
|
"prepare_screenshot_styles",
|
|
680
|
-
"browse_templates",
|
|
681
|
-
"apply_screenshot_style",
|
|
682
680
|
],
|
|
683
|
-
notes: "Select 3-7 real screenshots in story order and prepare the personalized catalog once.
|
|
681
|
+
notes: "Select 3-7 real screenshots in story order and prepare the personalized catalog once. Preparation opens the personalized v1/v2 gallery automatically; confirming there creates the cached selection as a new phone, tablet, and desktop variant without a second AI call.",
|
|
684
682
|
},
|
|
685
683
|
{
|
|
686
684
|
name: "Prepare and apply personalized social graphics",
|
|
@@ -714,9 +712,9 @@ export const WORKFLOW_GUIDE_RESOURCE = {
|
|
|
714
712
|
"Do not force menu-based interaction when the user already gave a concrete natural-language edit request.",
|
|
715
713
|
"Do not reduce the template catalog to a tiny recommendation list unless the user explicitly asks for that.",
|
|
716
714
|
"Do not describe templates without showing preview resources when template previews are available.",
|
|
717
|
-
"Do not read template previews one by one when browse_templates can
|
|
715
|
+
"Do not read template previews one by one when prepare_screenshot_styles or browse_templates can open the full gallery.",
|
|
718
716
|
"Do not begin a screenshot session with template browsing before the user has chosen create new app or edit existing project.",
|
|
719
|
-
"Do not use legacy generate_layouts or generate_graphics for the normal style chooser. Prepare a personalized catalog and apply the selected cached style
|
|
717
|
+
"Do not use legacy generate_layouts or generate_graphics for the normal style chooser. Prepare a personalized catalog and let its gallery apply the selected cached screenshot style.",
|
|
720
718
|
"Do not invent fresh x/y positions, widths, screenshot scale values, or headline styling for new screens when the user wants to preserve the current design language.",
|
|
721
719
|
"Do not report success for new screens or composition edits without checking that the new nodes match the surrounding screens and do not overlap key content.",
|
|
722
720
|
],
|
|
@@ -39,6 +39,9 @@ export function buildTemplateGalleryUrl(baseUrl, options) {
|
|
|
39
39
|
url.searchParams.set("generationId", options.generationId);
|
|
40
40
|
url.searchParams.set("catalogKey", options.catalogKey);
|
|
41
41
|
}
|
|
42
|
+
if (options?.applySelection) {
|
|
43
|
+
url.searchParams.set("action", "apply");
|
|
44
|
+
}
|
|
42
45
|
return url.toString();
|
|
43
46
|
}
|
|
44
47
|
function decorateTemplate(template, baseUrl) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { buildTemplateGalleryUrl } from "./template-previews.js";
|
|
4
|
+
test("personalized gallery URLs carry the generated catalog and direct-apply action", () => {
|
|
5
|
+
const url = new URL(buildTemplateGalleryUrl("https://dashboard.applaunchflow.com", {
|
|
6
|
+
deviceType: "phone",
|
|
7
|
+
templateIds: ["bold-frame", "minimal-clean"],
|
|
8
|
+
generationId: "11111111-1111-4111-8111-111111111111",
|
|
9
|
+
catalogKey: "catalog-key",
|
|
10
|
+
applySelection: true,
|
|
11
|
+
}));
|
|
12
|
+
assert.equal(url.pathname, "/template-gallery");
|
|
13
|
+
assert.equal(url.searchParams.get("device"), "phone");
|
|
14
|
+
assert.equal(url.searchParams.get("ids"), "bold-frame,minimal-clean");
|
|
15
|
+
assert.equal(url.searchParams.get("generationId"), "11111111-1111-4111-8111-111111111111");
|
|
16
|
+
assert.equal(url.searchParams.get("catalogKey"), "catalog-key");
|
|
17
|
+
assert.equal(url.searchParams.get("action"), "apply");
|
|
18
|
+
});
|
package/build/tools/graphics.js
CHANGED
|
@@ -177,7 +177,7 @@ export function registerGraphicsTools(server, client) {
|
|
|
177
177
|
.optional()
|
|
178
178
|
.describe("Catalog key from prepare_social_graphics_styles. Pass together with generationId."),
|
|
179
179
|
},
|
|
180
|
-
}, async ({ format = "og", templateIds, selectedTemplateId, title, generationId, catalogKey, }) => {
|
|
180
|
+
}, async ({ format = "og", templateIds, selectedTemplateId, title, generationId, catalogKey, }, extra) => {
|
|
181
181
|
try {
|
|
182
182
|
const payload = decorateSocialTemplatePayload(await client.listSocialTemplates(), client.credentials.baseUrl);
|
|
183
183
|
const availableIds = new Set(payload.templates.map((t) => t.id));
|
|
@@ -205,12 +205,15 @@ export function registerGraphicsTools(server, client) {
|
|
|
205
205
|
generationId,
|
|
206
206
|
catalogKey,
|
|
207
207
|
});
|
|
208
|
+
const opened = await openUrl(server, galleryUrl, "Browse personalized social-graphics styles in AppLaunchFlow.", { signal: extra.signal });
|
|
208
209
|
return {
|
|
209
210
|
content: [
|
|
210
211
|
{
|
|
211
212
|
type: "text",
|
|
212
213
|
text: [
|
|
213
|
-
|
|
214
|
+
opened
|
|
215
|
+
? "Opened the social template gallery in the browser."
|
|
216
|
+
: "The client could not open the browser automatically; paste this exact gallery URL into the user-visible reply.",
|
|
214
217
|
`Social template gallery URL: ${galleryUrl}`,
|
|
215
218
|
"After you pick a template, reply with the template name or id.",
|
|
216
219
|
].join("\n"),
|
|
@@ -230,6 +233,7 @@ export function registerGraphicsTools(server, client) {
|
|
|
230
233
|
userFacingUrl: galleryUrl,
|
|
231
234
|
format,
|
|
232
235
|
templateIds: filteredTemplateIds,
|
|
236
|
+
browserOpened: opened,
|
|
233
237
|
},
|
|
234
238
|
message: "Prepared social template gallery",
|
|
235
239
|
},
|
|
@@ -11,8 +11,8 @@ export function registerLocalizationTools(server, client) {
|
|
|
11
11
|
description: "Translate screenshot layouts into one or more target languages using AI. " +
|
|
12
12
|
"This is the PREFERRED way to localize screenshots — do NOT manually edit text nodes for translation. " +
|
|
13
13
|
"The backend translates all text in the layout while preserving positioning, styling, and screenshots. " +
|
|
14
|
-
"Requires a source screenshot layout to already exist — created
|
|
15
|
-
"Pass the variantId
|
|
14
|
+
"Requires a source screenshot layout to already exist — created by the personalized gallery, apply_screenshot_style, or generate_layouts. " +
|
|
15
|
+
"Pass the source variantId when available to translate that exact variant; if omitted, the active variant is used.",
|
|
16
16
|
inputSchema: {
|
|
17
17
|
generationId: z.string().uuid().describe("The project/generation UUID."),
|
|
18
18
|
variantId: z
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { listPublicTemplateIds } from "../catalog.js";
|
|
4
|
+
import { buildTemplateGalleryUrl } from "../template-previews.js";
|
|
4
5
|
import { openUrl, fail, ok, startProgressHeartbeat } from "./utils.js";
|
|
5
6
|
export function registerScreenshotTools(server, client) {
|
|
6
7
|
server.registerTool("prepare_screenshot_styles", {
|
|
7
8
|
title: "Prepare Personalized Screenshot Styles",
|
|
8
9
|
description: "Generate or reuse the project's personalized screenshot-style catalog before the user chooses a style. " +
|
|
9
10
|
"This prepares every screenshot template for phone, tablet, and desktop in one AI call and returns a catalogKey. " +
|
|
10
|
-
"
|
|
11
|
+
"The personalized gallery opens automatically, shows the real v1/v2 renders, and creates the chosen variant directly in the browser. " +
|
|
11
12
|
"Repeating this with the same app context and screenshot paths is a cache hit and does not regenerate AI content.",
|
|
12
13
|
inputSchema: {
|
|
13
14
|
generationId: z.string().uuid().describe("Project/generation UUID."),
|
|
@@ -37,6 +38,14 @@ export function registerScreenshotTools(server, client) {
|
|
|
37
38
|
if (!result.catalogKey || templateIds.length === 0) {
|
|
38
39
|
throw new Error("The screenshot catalog response did not include a cache key and templates");
|
|
39
40
|
}
|
|
41
|
+
const galleryUrl = buildTemplateGalleryUrl(client.credentials.baseUrl, {
|
|
42
|
+
deviceType,
|
|
43
|
+
templateIds,
|
|
44
|
+
generationId,
|
|
45
|
+
catalogKey: result.catalogKey,
|
|
46
|
+
applySelection: true,
|
|
47
|
+
});
|
|
48
|
+
const opened = await openUrl(server, galleryUrl, "Choose a personalized screenshot style. Compare v1 and v2, then create the new variant in the editor.", { signal: extra.signal });
|
|
40
49
|
return {
|
|
41
50
|
content: [
|
|
42
51
|
{
|
|
@@ -47,9 +56,19 @@ export function registerScreenshotTools(server, client) {
|
|
|
47
56
|
: "Prepared personalized screenshot styles for phone, tablet, and desktop.",
|
|
48
57
|
`Catalog key: ${result.catalogKey}`,
|
|
49
58
|
`Available template ids: ${templateIds.join(", ")}`,
|
|
50
|
-
|
|
59
|
+
opened
|
|
60
|
+
? "Opened the personalized style gallery in the browser."
|
|
61
|
+
: `Open the personalized style gallery: ${galleryUrl}`,
|
|
62
|
+
"The gallery renders v1 and v2 from this catalog. Confirming a style creates a new variant and opens it in the editor; no template id needs to be pasted back into chat.",
|
|
51
63
|
].join("\n"),
|
|
52
64
|
},
|
|
65
|
+
{
|
|
66
|
+
type: "resource_link",
|
|
67
|
+
uri: galleryUrl,
|
|
68
|
+
name: "Open Personalized Style Gallery",
|
|
69
|
+
mimeType: "text/html",
|
|
70
|
+
description: "Personalized screenshot previews with v1/v2 palette choices and direct variant creation.",
|
|
71
|
+
},
|
|
53
72
|
],
|
|
54
73
|
structuredContent: {
|
|
55
74
|
success: true,
|
|
@@ -60,6 +79,8 @@ export function registerScreenshotTools(server, client) {
|
|
|
60
79
|
templateIds,
|
|
61
80
|
devices: ["phone", "tablet", "desktop"],
|
|
62
81
|
selectedScreenshotPaths,
|
|
82
|
+
galleryUrl,
|
|
83
|
+
browserOpened: opened,
|
|
63
84
|
},
|
|
64
85
|
message: result.cacheHit
|
|
65
86
|
? "Reused personalized screenshot styles"
|
|
@@ -77,7 +98,7 @@ export function registerScreenshotTools(server, client) {
|
|
|
77
98
|
server.registerTool("apply_screenshot_style", {
|
|
78
99
|
title: "Apply Personalized Screenshot Style",
|
|
79
100
|
description: "Create a new screenshot variant from a previously prepared personalized style catalog without another AI generation. " +
|
|
80
|
-
"
|
|
101
|
+
"Fallback for applying a template id supplied directly in chat or by an API client. The normal prepare_screenshot_styles flow now lets the user compare v1/v2 and create the variant directly in the browser. The new variant includes phone, tablet, and desktop layouts and opens in the editor.",
|
|
81
102
|
inputSchema: {
|
|
82
103
|
generationId: z.string().uuid(),
|
|
83
104
|
catalogKey: z.string().min(1).max(128),
|
|
@@ -138,7 +159,7 @@ export function registerScreenshotTools(server, client) {
|
|
|
138
159
|
});
|
|
139
160
|
server.registerTool("generate_layouts", {
|
|
140
161
|
title: "Generate Layouts",
|
|
141
|
-
description: "Legacy direct generation for a single screenshot template. For the normal user-facing style chooser, prefer prepare_screenshot_styles
|
|
162
|
+
description: "Legacy direct generation for a single screenshot template. For the normal user-facing style chooser, prefer prepare_screenshot_styles so all personalized v1/v2 previews are generated once and the browser applies the chosen style from cache. " +
|
|
142
163
|
"Generate screenshot layouts for a project. " +
|
|
143
164
|
"For existing projects, pass generationId (same as projectId) — the API fetches screenshots from storage automatically. " +
|
|
144
165
|
"Do NOT pass screenshots when using generationId. " +
|
package/build/tools/templates.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { buildTemplateGalleryUrl, TEMPLATE_PREVIEW_DEVICE_TYPES, decorateTemplatePayload, } from "../template-previews.js";
|
|
3
|
-
import { fail } from "./utils.js";
|
|
3
|
+
import { fail, openUrl } from "./utils.js";
|
|
4
4
|
function formatTemplateLine(template, deviceType) {
|
|
5
5
|
const parts = [
|
|
6
6
|
`${template.name} (${template.id})`,
|
|
@@ -98,7 +98,7 @@ function buildTemplateDetailsResult(payload) {
|
|
|
98
98
|
export function registerTemplateTools(server, client) {
|
|
99
99
|
server.registerTool("browse_templates", {
|
|
100
100
|
title: "Browse & Select Template",
|
|
101
|
-
description: "
|
|
101
|
+
description: "Open the visual style gallery. With generationId and catalogKey from prepare_screenshot_styles it renders personalized v1/v2 previews and creates the selected variant directly; without them it provides static style discovery. Never offer templates via text or AskUserQuestion.",
|
|
102
102
|
inputSchema: {
|
|
103
103
|
deviceType: z
|
|
104
104
|
.enum(TEMPLATE_PREVIEW_DEVICE_TYPES)
|
|
@@ -128,8 +128,11 @@ export function registerTemplateTools(server, client) {
|
|
|
128
128
|
.optional()
|
|
129
129
|
.describe("Catalog key from prepare_screenshot_styles. Pass together with generationId."),
|
|
130
130
|
},
|
|
131
|
-
}, async ({ deviceType = "phone", templateIds, selectedTemplateId, title, generationId, catalogKey, }) => {
|
|
131
|
+
}, async ({ deviceType = "phone", templateIds, selectedTemplateId, title, generationId, catalogKey, }, extra) => {
|
|
132
132
|
try {
|
|
133
|
+
if (Boolean(generationId) !== Boolean(catalogKey)) {
|
|
134
|
+
return fail(new Error("generationId and catalogKey must be passed together to open personalized previews."));
|
|
135
|
+
}
|
|
133
136
|
const payload = decorateTemplatePayload(await client.listTemplates(), client.credentials.baseUrl);
|
|
134
137
|
const availableIds = new Set(payload.templates.map((template) => template.id));
|
|
135
138
|
const filteredTemplateIds = templateIds?.filter((templateId) => availableIds.has(templateId)) || [];
|
|
@@ -156,16 +159,23 @@ export function registerTemplateTools(server, client) {
|
|
|
156
159
|
title,
|
|
157
160
|
generationId,
|
|
158
161
|
catalogKey,
|
|
162
|
+
applySelection: Boolean(generationId && catalogKey),
|
|
159
163
|
});
|
|
164
|
+
const opened = await openUrl(server, galleryUrl, generationId && catalogKey
|
|
165
|
+
? "Choose a personalized screenshot style. Compare v1 and v2, then create the new variant in the editor."
|
|
166
|
+
: "Browse screenshot styles in AppLaunchFlow.", { signal: extra.signal });
|
|
160
167
|
return {
|
|
161
168
|
content: [
|
|
162
169
|
{
|
|
163
170
|
type: "text",
|
|
164
171
|
text: [
|
|
165
|
-
|
|
172
|
+
opened
|
|
173
|
+
? "Opened the template gallery in the browser."
|
|
174
|
+
: "The client could not open the browser automatically; paste this exact gallery URL into the user-visible reply.",
|
|
166
175
|
`Template gallery URL: ${galleryUrl}`,
|
|
167
|
-
|
|
168
|
-
|
|
176
|
+
generationId && catalogKey
|
|
177
|
+
? "The gallery shows the personalized v1/v2 renders. Confirming a style creates the variant and opens the editor directly."
|
|
178
|
+
: "Static discovery mode copies the chosen template id.",
|
|
169
179
|
].join("\n"),
|
|
170
180
|
},
|
|
171
181
|
{
|
|
@@ -183,6 +193,8 @@ export function registerTemplateTools(server, client) {
|
|
|
183
193
|
userFacingUrl: galleryUrl,
|
|
184
194
|
deviceType,
|
|
185
195
|
templateIds: filteredTemplateIds,
|
|
196
|
+
browserOpened: opened,
|
|
197
|
+
personalized: Boolean(generationId && catalogKey),
|
|
186
198
|
},
|
|
187
199
|
message: "Prepared template gallery",
|
|
188
200
|
},
|