@migma/mcp 1.11.10 → 1.11.12

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 CHANGED
@@ -83,21 +83,23 @@ time alone, `migma_schedule_campaign` prepares a new approval that replaces the
83
83
  as on the hosted server) Migma sends tests only to the account's own inbox: the
84
84
  signed-in user's or the account owner's address.
85
85
 
86
- In hosts that support MCP Apps (Claude on web, desktop and mobile), the three send
87
- tools also show a card (`ui://migma/send-approval`): the email preview, audience,
86
+ In hosts that support MCP Apps (Claude on web, desktop and mobile, and ChatGPT), the
87
+ three send tools also show a card (`ui://migma/send-approval`): the email preview, audience,
88
88
  sender, subject and timing, the live status, and one action, "Review and approve in
89
89
  Migma", which opens the approval link through the host. The card only reads
90
90
  `migma_get_send_approval`; it cannot approve. Hosts without MCP Apps, such as
91
- Claude Code, get the same text result as before. `createOpenAIMcpServer` leaves the
92
- card off, so the surface ChatGPT reviewed does not change; pass `mcpApps: true`
93
- to keep that tool set and add the card, as the hosted server does for Claude.
91
+ Claude Code, get the same text result as before. Cards are on for every profile,
92
+ `createOpenAIMcpServer` included: they add tool `_meta` and `ui://` resources only, never
93
+ a tool, and `mcpApps: false` turns them off. Each card names `https://migma.ai` as the
94
+ dedicated origin ChatGPT requires of a published app (`openai/widgetDomain`).
94
95
 
95
96
  The same hosts show an email card (`ui://migma/email`) on `migma_generate_email`,
96
97
  `migma_get_generation_status`, `migma_edit_email` and `migma_get_email`: the steps
97
98
  while Migma designs or changes an email, then each email as its picture at real width,
98
99
  a series as tabs, full screen where the host has it, "Edit in Migma", and two asks
99
- sent to the chat ("Make it shorter", "Try another version") with their credit cost.
100
- A status check shows one line, or a Ready row that opens in place. The card only reads
100
+ sent to the chat ("Make it shorter", "Try another version").
101
+ A status check shows one line that keeps itself current and turns into a Ready row that
102
+ opens in place (ChatGPT draws only the last card of a reply). The card only reads
101
103
  `migma_get_generation_status`, `migma_get_email_edit_status` and `migma_get_email`.
102
104
  The same `mcpApps` option turns it on or off. When the client draws the card, email
103
105
  results stop asking the assistant to paste previews or check progress in a loop: the
package/build/index.d.ts CHANGED
@@ -13,11 +13,12 @@ export type CreateMigmaMcpServerOptions = {
13
13
  /**
14
14
  * MCP Apps views on the tools that have one: the send approval card (approval stays on
15
15
  * migma.ai) and the email card on generate, generation status, edit and get email. On by
16
- * default for the general profile, off for the openai profile so the surface ChatGPT
17
- * reviewed does not change. Pass true only for a client that draws the views (Claude's apps,
18
- * not Claude Code): email results then leave the pictures to the card instead of asking for
19
- * pasted previews and progress loops. Left unset, that follows the client's own
20
- * `io.modelcontextprotocol/ui` capability. A host that keeps the openai tool set but shows the views (Claude) passes true.
16
+ * default on every profile: the views add only tool `_meta` and `ui://` resources, which a
17
+ * client without MCP Apps ignores, and ChatGPT and Claude both draw them. False turns them off.
18
+ * Pass true only for a client known to draw the views (Claude's apps, not Claude Code): email
19
+ * results then leave the pictures to the card instead of asking for pasted previews and
20
+ * progress loops. Left unset, results follow the client's own `io.modelcontextprotocol/ui`
21
+ * capability, so they keep the Previews list wherever the client never said it draws cards.
21
22
  */
22
23
  mcpApps?: boolean;
23
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA4BrD,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,KAAK,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,C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OAAO,GAAE,IAAI,CAAC,2BAA2B,EAAE,SAAS,CAAM,GAAG,SAAS,CAE3G;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAEzD;AAGD,wBAAgB,mBAAmB,cAOlC"}
package/build/index.js CHANGED
@@ -60,7 +60,7 @@ export function createMigmaMcpServer(options = {}) {
60
60
  const config = completeConfig(options.config);
61
61
  const lazyClient = options.client || createLazyClient(config, options.getClient);
62
62
  const { permissions, profile = "general" } = options;
63
- const card = options.mcpApps ?? profile !== "openai";
63
+ const card = options.mcpApps !== false;
64
64
  // Whether this client draws the cards: the host vouches for it (mcpApps: true, as the stateless
65
65
  // hosted server does for Claude), or the client said so when it connected.
66
66
  const vouched = options.mcpApps === true;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE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I,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -39,6 +39,9 @@ test("the four email tools open the email card; polls the card makes itself do n
39
39
  const content = read.contents[0];
40
40
  assert.equal(content.mimeType, "text/html;profile=mcp-app");
41
41
  assert.deepEqual(content._meta.ui.csp.resourceDomains, IMAGE_ORIGINS);
42
+ // OpenAI holds tools whose card CSP is missing or too broad: exact hosts only, and no network calls.
43
+ assert.deepEqual(IMAGE_ORIGINS, ["https://cdn.migma.ai"]);
44
+ assert.deepEqual(content._meta.ui.csp.connectDomains, []);
42
45
  assert.equal(content._meta.ui.prefersBorder, true);
43
46
  });
44
47
  test("the card only reads, and talks to nothing but the host", async () => {
@@ -100,6 +103,12 @@ test("results stay the same unless the client draws the card", async () => {
100
103
  const { nextStep: _b, ...was } = jsonOf(before) ?? {};
101
104
  assert.deepEqual(data, was, `${name}: same data`);
102
105
  }
106
+ // ChatGPT (reviewed profile, not vouched): same results as without the card, so text-only surfaces keep the Previews list.
107
+ const reviewed = (profileOptions) => createOpenAIMcpServer({ client: client, config: { apiKey: "sk_test", projectId: "brand-1" }, ...profileOptions })._registeredTools;
108
+ const [chatgpt, reviewedOff] = [reviewed({}), reviewed({ mcpApps: false })];
109
+ for (const [name, args] of CALLS) {
110
+ assert.deepEqual(await chatgpt[name].handler(chatgpt[name].inputSchema.parse(args), {}), await reviewedOff[name].handler(reviewedOff[name].inputSchema.parse(args), {}), `${name} on the reviewed profile`);
111
+ }
103
112
  const started = await off.migma_generate_email.handler({ prompt: "A beach party" }, {});
104
113
  assert.equal(textsOf(started)[0], "Generation started. migma_get_generation_status reports progress, then returns each email's preview image and editor link.");
105
114
  });
@@ -165,15 +174,46 @@ test("server instructions name the card only where Migma vouches the client draw
165
174
  assert.match(await listedInstructions(createOpenAIMcpServer), /Show every Previews image/);
166
175
  assert.match(await listedInstructions(createMigmaMcpServer), /Show every Previews image/);
167
176
  });
168
- test("no email card without email reads, nor on the reviewed ChatGPT surface", async () => {
177
+ test("no email card without email reads or with mcpApps false; ChatGPT and Claude both get it", async () => {
169
178
  const sendOnly = await listed(createMigmaMcpServer, { permissions: ["email:send"] });
170
179
  assert.equal(sendOnly.resources.some((r) => r.uri === EMAIL_CARD_URI), false);
171
- const reviewed = await listed(createOpenAIMcpServer);
172
- assert.equal(reviewed.resources.length, 0);
173
- for (const name of EMAIL_TOOLS)
174
- assert.equal(uiOf(reviewed.tools.find((t) => t.name === name)), undefined, name);
175
- const claude = await listed(createOpenAIMcpServer, { mcpApps: true });
180
+ const off = await listed(createOpenAIMcpServer, { mcpApps: false });
181
+ assert.equal(off.resources.length, 0);
176
182
  for (const name of EMAIL_TOOLS)
177
- assert.equal(uiOf(claude.tools.find((t) => t.name === name)), EMAIL_CARD_URI, name);
183
+ assert.equal(uiOf(off.tools.find((t) => t.name === name)), undefined, name);
184
+ for (const options of [{}, { mcpApps: true }]) {
185
+ const host = await listed(createOpenAIMcpServer, options);
186
+ for (const name of EMAIL_TOOLS)
187
+ assert.equal(uiOf(host.tools.find((t) => t.name === name)), EMAIL_CARD_URI, name);
188
+ }
189
+ });
190
+ test("every host gets the same cards: one HTML for Claude, ChatGPT and other MCP Apps hosts", async () => {
191
+ const read = async (create, options = {}) => {
192
+ const server = create({ client: {}, config: { apiKey: "sk_test" }, ...options });
193
+ const mcp = new Client({ name: "host", version: "1" });
194
+ const [a, b] = InMemoryTransport.createLinkedPair();
195
+ await server.connect(b);
196
+ await mcp.connect(a);
197
+ try {
198
+ const { resources } = await mcp.listResources();
199
+ return await Promise.all(resources.map(async (r) => (await mcp.readResource({ uri: r.uri })).contents[0]));
200
+ }
201
+ finally {
202
+ await mcp.close();
203
+ await server.close();
204
+ }
205
+ };
206
+ // ChatGPT (reviewed profile, not vouched), Claude (reviewed profile, vouched), Cursor and local clients (general profile).
207
+ const [chatgpt, claude, general] = await Promise.all([read(createOpenAIMcpServer), read(createOpenAIMcpServer, { mcpApps: true }), read(createMigmaMcpServer)]);
208
+ assert.equal(chatgpt.length, 2);
209
+ assert.deepEqual(claude, chatgpt);
210
+ assert.deepEqual(general, chatgpt);
211
+ for (const card of chatgpt) {
212
+ const text = String(card.text);
213
+ // A host's own extras are optional calls, never a branch on which host this is.
214
+ assert.doesNotMatch(text, /userAgent|navigator\.vendor/, card.uri);
215
+ for (const use of text.match(/window\.openai[^\s(]*/g) ?? [])
216
+ assert.match(use, /^window\.openai\?\./, card.uri);
217
+ }
178
218
  });
179
219
  //# sourceMappingURL=email-card.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"email-card.test.js","sourceRoot":"","sources":["../../../src/tools/__tests__/email-card.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,GAAG,CAAC,sBAAsB,EAAE,6BAA6B,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;AACnH,MAAM,UAAU,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,CAAC"}
@@ -120,23 +120,31 @@ test("send tool text stays the same for hosts without MCP Apps", async () => {
120
120
  assert.equal(JSON.parse(result.content[0].text).approval.approvalUrl, view.approvalUrl);
121
121
  });
122
122
  });
123
- test("the ChatGPT profile keeps its reviewed surface: no card", async () => {
124
- const { tools, resources } = await listed(createOpenAIMcpServer);
123
+ test("mcpApps false leaves the reviewed profile without cards", async () => {
124
+ const { tools, resources } = await listed(createOpenAIMcpServer, { mcpApps: false });
125
125
  assert.equal(resources.length, 0);
126
126
  for (const name of Object.keys(CARD_FOR))
127
127
  assert.equal(tools.find((t) => t.name === name)?._meta?.ui, undefined, name);
128
128
  });
129
- test("Claude keeps the reviewed tool set and adds only the cards", async () => {
130
- const reviewed = await listed(createOpenAIMcpServer);
131
- const claude = await listed(createOpenAIMcpServer, { mcpApps: true });
132
- assert.deepEqual(claude.tools.map((t) => t.name), reviewed.tools.map((t) => t.name));
133
- assert.deepEqual(claude.resources.map((r) => r.uri).sort(), [EMAIL_CARD_URI, SEND_APPROVAL_CARD_URI].sort());
134
- for (const tool of claude.tools) {
135
- const card = CARD_FOR[tool.name];
136
- assert.equal(tool._meta?.ui?.resourceUri, card, tool.name);
137
- const { _meta: _a, ...rest } = tool;
138
- const { _meta: _b, ...before } = reviewed.tools.find((t) => t.name === tool.name);
139
- assert.deepEqual(rest, before, `${tool.name} is unchanged apart from the card`);
129
+ test("ChatGPT and Claude keep the reviewed tool set and add only the cards", async () => {
130
+ const reviewed = await listed(createOpenAIMcpServer, { mcpApps: false });
131
+ for (const options of [{}, { mcpApps: true }]) {
132
+ const host = await listed(createOpenAIMcpServer, options);
133
+ assert.deepEqual(host.tools.map((t) => t.name), reviewed.tools.map((t) => t.name));
134
+ assert.deepEqual(host.resources.map((r) => r.uri).sort(), [EMAIL_CARD_URI, SEND_APPROVAL_CARD_URI].sort());
135
+ for (const tool of host.tools) {
136
+ const card = CARD_FOR[tool.name];
137
+ assert.equal(tool._meta?.ui?.resourceUri, card, tool.name);
138
+ const { _meta: _a, ...rest } = tool;
139
+ const { _meta: _b, ...before } = reviewed.tools.find((t) => t.name === tool.name);
140
+ assert.deepEqual(rest, before, `${tool.name} is unchanged apart from the card`);
141
+ }
140
142
  }
141
143
  });
144
+ test("each card names the dedicated origin ChatGPT requires of a published app", async () => {
145
+ const { resources, read } = await listed(createOpenAIMcpServer);
146
+ for (const resource of resources)
147
+ assert.equal(resource._meta?.["openai/widgetDomain"], "https://migma.ai", resource.uri);
148
+ assert.equal(read.contents[0]._meta?.["openai/widgetDomain"], "https://migma.ai");
149
+ });
142
150
  //# sourceMappingURL=send-approval.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"send-approval.test.js","sourceRoot":"","sources":["../../../src/tools/__tests__/send-approval.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,SAAS,KAAK,CAAC,WAAsB;IACnC,MAAM,MAAM,GAAG,oBAAoB,CAAC;QAClC,MAAM,EAAE,EAAsB;QAC9B,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,qBAAqB,EAAE;QACnF,WAAW;KACZ,CAAC,CAAC;IACH,OAAQ,MAAgE,CAAC,gBAAgB,CAAC;AAC5F,CAAC;AAED,MAAM,IAAI,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,6BAA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AI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC9G,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;YACpC,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAE,CAAC;YACnF,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,mCAAmC,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,0EAA0E,EAAE,KAAK,IAAI,EAAE;IAC1F,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAChE,KAAK,MAAM,QAAQ,IAAI,SAAS;QAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,qBAAqB,CAAC,EAAE,kBAAkB,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC1H,MAAM,CAAC,KAAK,CAAC,IAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,qBAAqB,CAAC,EAAE,kBAAkB,CAAC,CAAC;AACrF,CAAC,CAAC,CAAC"}
@@ -10,5 +10,5 @@ export declare const EMAIL_CARD_URI = "ui://migma/email";
10
10
  /** Tool `_meta` that links an email tool to the card, when the server shows it. */
11
11
  export declare function emailCardMeta(card: boolean): Record<string, unknown> | undefined;
12
12
  export declare function registerEmailCard(server: McpServer, card: boolean): void;
13
- export declare const EMAIL_CARD_HTML = "<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<meta name=\"color-scheme\" content=\"light dark\">\n<title>Email</title>\n<style>\n :root {\n color-scheme: light dark;\n --surface: var(--color-background-primary, light-dark(#ffffff, #30302e));\n --muted: var(--color-background-secondary, light-dark(#f5f4ed, #262624));\n --muted-2: var(--color-background-tertiary, light-dark(#ebe9df, #3a3a37));\n --text: var(--color-text-primary, light-dark(#141413, #faf9f5));\n --text-2: var(--color-text-secondary, light-dark(#3d3d3a, #c2c0b6));\n --text-3: var(--color-text-tertiary, light-dark(#73726c, #9c9a92));\n --line: var(--color-border-tertiary, light-dark(rgb(31 30 29 / 15%), rgb(222 220 209 / 15%)));\n --line-2: var(--color-border-secondary, light-dark(rgb(31 30 29 / 30%), rgb(222 220 209 / 30%)));\n --inverse: var(--color-background-inverse, light-dark(#141413, #faf9f5));\n --on-inverse: var(--color-text-inverse, light-dark(#ffffff, #141413));\n --info: var(--color-border-info, light-dark(#4682d5, #6c9be0));\n --success: var(--color-border-success, light-dark(#437426, #7fb05b));\n --danger: var(--color-border-danger, light-dark(#a73d39, #d1615c));\n --danger-text: var(--color-text-danger, light-dark(#7f2c28, #ee8884));\n --warning-text: var(--color-text-warning, light-dark(#5a4815, #d1a041));\n --radius: var(--border-radius-lg, 10px);\n --radius-md: var(--border-radius-md, 8px);\n }\n * { box-sizing: border-box; }\n html, body { margin: 0; background: transparent; }\n body {\n font-family: var(--font-sans, system-ui, -apple-system, sans-serif);\n font-size: var(--font-text-sm-size, 14px);\n line-height: var(--font-text-sm-line-height, 1.4);\n color: var(--text);\n -webkit-font-smoothing: antialiased;\n }\n p, h1, ul { margin: 0; }\n button { font: inherit; cursor: pointer; }\n button:focus-visible, .stage:focus-visible { outline: 2px solid var(--color-ring-primary, var(--info)); outline-offset: 2px; }\n button[disabled] { cursor: default; opacity: .5; }\n main {\n container-type: inline-size;\n padding: calc(16px + var(--inset-top, 0px)) calc(16px + var(--inset-right, 0px)) calc(16px + var(--inset-bottom, 0px)) calc(16px + var(--inset-left, 0px));\n }\n .i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }\n .i.big { width: 24px; height: 24px; }\n\n .head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }\n .title { min-width: 0; }\n h1 { font-size: var(--font-heading-md-size, 16px); line-height: var(--font-heading-md-line-height, 1.4); font-weight: var(--font-weight-semibold, 600); overflow-wrap: anywhere; }\n .pre { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n .icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-2); }\n .icon-btn:hover { background: var(--muted); }\n\n .stage { position: relative; margin-top: 12px; height: var(--stage-h, 520px); border-radius: var(--radius); background: var(--muted); overflow: auto; overscroll-behavior: contain; display: flex; justify-content: center; align-items: flex-start; padding: 16px; scrollbar-width: thin; }\n .stage.short { height: 240px; overflow: hidden; }\n .shot { width: min(600px, 100%); flex: none; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 0.5px var(--line); background: var(--surface); }\n .shot img { display: block; width: 100%; height: auto; }\n .shot.dim { opacity: .45; }\n .skel { width: min(600px, 100%); height: 100%; min-height: 200px; flex: none; border-radius: 4px; background: var(--surface); box-shadow: 0 0 0 0.5px var(--line); padding: 28px; display: flex; flex-direction: column; gap: 14px; overflow: hidden; }\n .sk { background: var(--muted-2); border-radius: 6px; flex: none; }\n .stage-note { position: absolute; inset: 0; margin: auto; height: fit-content; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; color: var(--text-2); text-align: center; max-width: 340px; }\n .pill { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 0.5px var(--line); color: var(--text-2); }\n\n .tabs { display: flex; gap: 4px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; }\n .tab { display: inline-flex; gap: 8px; align-items: center; height: 36px; max-width: 220px; flex: none; padding: 0 12px 0 8px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-2); font-size: 13px; }\n .tab .n { display: grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 50%; background: var(--muted); font-size: 12px; font-weight: 600; }\n .tab .t { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }\n .tab .d { color: var(--text-3); flex: none; }\n .tab[aria-selected=\"true\"] { background: var(--muted); color: var(--text); }\n .tab[aria-selected=\"true\"] .n { background: var(--inverse); color: var(--on-inverse); }\n\n .foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }\n .asks { display: flex; gap: 6px; flex-wrap: wrap; }\n .chip { display: inline-flex; gap: 6px; align-items: center; min-height: 32px; padding: 0 12px; border: 0.5px solid var(--line-2); border-radius: 999px; background: transparent; color: var(--text); font-size: 13px; font-weight: var(--font-weight-medium, 500); }\n .chip:hover { background: var(--muted); }\n .chip small { color: var(--text-3); font-size: 12px; font-weight: 400; }\n .primary, .ghost { display: inline-flex; gap: 6px; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; border-radius: var(--radius-md); white-space: nowrap; font-weight: var(--font-weight-semibold, 600); }\n .primary { border: 0; background: var(--inverse); color: var(--on-inverse); margin-left: auto; }\n .ghost { border: 0.5px solid var(--line-2); background: transparent; color: var(--text); font-weight: var(--font-weight-medium, 500); margin-left: auto; }\n .ghost:hover { background: var(--muted); }\n @container (max-width: 420px) { .foot .primary, .foot .ghost { width: 100%; } }\n\n .status { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; color: var(--text-2); font-weight: var(--font-weight-medium, 500); }\n .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }\n .dot.info { background: var(--info); } .dot.ok { background: var(--success); } .dot.bad { background: var(--danger); }\n .time { margin-left: auto; color: var(--text-3); font-variant-numeric: tabular-nums; font-weight: 400; }\n .steps { list-style: none; padding: 0; margin-top: 12px; display: grid; gap: 6px; }\n .steps li { display: flex; gap: 8px; align-items: center; color: var(--text-3); min-width: 0; }\n .steps li span:nth-child(2) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }\n .steps li.now { color: var(--text); }\n .mark { display: grid; place-items: center; width: 16px; height: 16px; flex: none; }\n .ring { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line-2); }\n .now .ring { border-color: var(--info); background: var(--info); }\n .note { margin-top: 12px; color: var(--text-2); overflow-wrap: anywhere; }\n .note.bad { color: var(--danger-text); }\n .note.warn { margin-top: 4px; color: var(--warning-text); }\n .note.small { color: var(--text-3); font-size: 13px; }\n\n .slots { display: flex; gap: 12px; margin-top: 12px; overflow-x: auto; }\n .slot { flex: 1 0 72px; min-width: 0; max-width: 200px; display: flex; flex-direction: column; gap: 8px; }\n .slot .frame { aspect-ratio: 3 / 4; border-radius: var(--radius-md); background: var(--muted); display: grid; place-items: center; color: var(--text-3); }\n .slot.done .frame { color: var(--success); }\n .slot .lab { display: flex; flex-wrap: wrap; column-gap: 6px; color: var(--text-2); font-size: 13px; }\n .slot .lab span:last-child { color: var(--text-3); margin-left: auto; }\n\n .line { display: flex; gap: 8px; align-items: center; min-height: 28px; color: var(--text-2); min-width: 0; }\n .line .t { color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }\n .line .s { color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }\n .line .thumb { width: 40px; height: 40px; flex: none; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 0.5px var(--line); background: var(--muted); }\n .line .thumb img { display: block; width: 100%; }\n .line .ghost, .line .primary { min-height: 30px; padding: 0 10px; font-size: 13px; margin-left: 0; }\n .line .ghost:first-of-type { margin-left: auto; }\n @container (max-width: 420px) { .line { flex-wrap: wrap; } .line .ghost:first-of-type { margin-left: 48px; } }\n\n :root:has(.fs), :root:has(.fs) body { height: 100%; }\n main:has(.fs) { height: 100%; padding: 0; }\n .fs { height: 100%; display: flex; flex-direction: column; }\n .fs > .head { padding: calc(14px + var(--inset-top, 0px)) calc(20px + var(--inset-right, 0px)) 14px calc(20px + var(--inset-left, 0px)); border-bottom: 0.5px solid var(--line); }\n .fs-body { flex: 1; display: flex; min-height: 0; }\n .rail { width: 200px; flex: none; padding: 16px; display: flex; flex-direction: column; gap: 12px; border-right: 0.5px solid var(--line); overflow-y: auto; }\n .rail-item { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: var(--radius); border: 0; background: transparent; text-align: left; color: var(--text-2); font-size: 13px; }\n .rail-item .thumb { height: 140px; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 0.5px var(--line); background: var(--muted); display: grid; place-items: center; color: var(--text-3); }\n .rail-item .thumb img { display: block; width: 100%; align-self: start; }\n .rail-item[aria-current=\"true\"] { background: var(--muted); color: var(--text); }\n .fs .stage { flex: 1; height: auto; margin: 0; border-radius: 0; padding: 24px; }\n .fs .foot { margin: 0; padding: 12px calc(20px + var(--inset-right, 0px)) calc(12px + var(--inset-bottom, 0px)) calc(20px + var(--inset-left, 0px)); border-top: 0.5px solid var(--line); }\n .fs .note { margin: 0; padding: 0 20px 12px; }\n .step-btn { position: absolute; top: 50%; margin-top: -18px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0.5px solid var(--line); background: var(--surface); color: var(--text); }\n .step-btn.prev { left: 16px; } .step-btn.next { right: 16px; }\n .fs-wrap { flex: 1; position: relative; display: flex; min-width: 0; }\n .fs .tabs { display: none; margin: 0; padding: 8px calc(20px + var(--inset-right, 0px)) 8px calc(20px + var(--inset-left, 0px)); border-bottom: 0.5px solid var(--line); }\n /* Narrow full screen (Claude's side panel): tabs replace the rail and the arrows over the email. */\n @container (max-width: 720px) { .rail, .step-btn { display: none; } .fs .tabs { display: flex; } }\n\n @media (prefers-reduced-motion: no-preference) {\n .sk, .now .ring { animation: pulse 1.4s ease-in-out infinite; }\n @keyframes pulse { 50% { opacity: .55; } }\n }\n</style>\n</head>\n<body>\n<main id=\"card\" aria-busy=\"true\">\n <div class=\"sk\" style=\"height:16px;width:40%\"></div>\n <div class=\"sk\" style=\"height:12px;width:70%;margin-top:8px\"></div>\n <div class=\"stage short\"></div>\n</main>\n<script type=\"module\">\n const ICON = {\n expand: '<path d=\"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7\"/>',\n collapse: '<path d=\"M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7\"/>',\n out: '<path d=\"M7 17L17 7M8 7h9v9\"/>',\n check: '<path d=\"M5 12l5 5L20 7\"/>',\n prev: '<path d=\"M15 18l-6-6 6-6\"/>',\n next: '<path d=\"M9 18l6-6-6-6\"/>',\n image: '<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"9\" cy=\"9\" r=\"2\"/><path d=\"M21 15l-5-5L5 21\"/>',\n alert: '<circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M12 8v4M12 16h.01\"/>',\n };\n const EDIT_STEPS = [[\"Checking the email\", [\"queued\", \"checking\"]], [\"Changing it\", [\"editing\"]], [\"Saving\", [\"saved\"]]];\n const PICTURE_TRIES = 4;\n const $ = (id) => document.getElementById(id);\n const el = (tag, text, attrs = {}) => Object.assign(document.createElement(tag), { textContent: text ?? \"\" }, attrs);\n function icon(name, big) {\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"class\", big ? \"i big\" : \"i\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"aria-hidden\", \"true\");\n svg.innerHTML = ICON[name];\n return svg;\n }\n function button(className, label, onclick, attrs = {}) {\n const b = el(\"button\", label, { type: \"button\", className, ...attrs });\n b.addEventListener(\"click\", onclick);\n return b;\n }\n const https = (url) => (typeof url === \"string\" && url.startsWith(\"https://\") ? url : \"\");\n\n let host = {}, caps = {}, input = {}, s = null, sel = 0, nextId = 1, timer = 0, ticker = 0, delay = 3000, tries = 0, busy = false;\n const pending = new Map();\n\n function send(msg) { window.parent.postMessage({ jsonrpc: \"2.0\", ...msg }, \"*\"); }\n function request(method, params, ms) {\n const id = nextId++;\n send({ id, method, params });\n return new Promise((resolve, reject) => {\n pending.set(id, { resolve, reject });\n // A host that never answers must not stall the card's reads.\n if (ms) setTimeout(() => pending.delete(id) && reject(new Error(\"timeout\")), ms);\n });\n }\n\n window.addEventListener(\"message\", (event) => {\n if (event.source !== window.parent) return;\n const msg = event.data;\n if (!msg || msg.jsonrpc !== \"2.0\") return;\n if (msg.id !== undefined && !msg.method) {\n const waiter = pending.get(msg.id);\n pending.delete(msg.id);\n if (waiter) msg.error ? waiter.reject(msg.error) : waiter.resolve(msg.result);\n return;\n }\n if (msg.id !== undefined) {\n // Host requests (ping, teardown) need an answer; this card holds no state to save.\n send({ id: msg.id, result: {} });\n return;\n }\n if (msg.method === \"ui/notifications/tool-input\") input = msg.params?.arguments ?? {};\n if (msg.method === \"ui/notifications/tool-result\") onResult(msg.params);\n if (msg.method === \"ui/notifications/host-context-changed\") { applyHost(msg.params); if (s) render(); }\n });\n\n function applyHost(ctx = {}) {\n host = { ...host, ...ctx };\n const root = document.documentElement;\n if (ctx.theme) { root.dataset.theme = ctx.theme; root.style.colorScheme = ctx.theme; }\n for (const [key, value] of Object.entries(ctx.styles?.variables ?? {})) if (value) root.style.setProperty(key, value);\n if (ctx.styles?.css?.fonts && !$(\"host-fonts\")) document.head.append(el(\"style\", ctx.styles.css.fonts, { id: \"host-fonts\" }));\n const inset = ctx.safeAreaInsets;\n if (inset) for (const side of [\"top\", \"right\", \"bottom\", \"left\"]) root.style.setProperty(\"--inset-\" + side, (inset[side] || 0) + \"px\");\n root.dataset.mode = host.displayMode || \"inline\";\n // Inline, the email scrolls inside the card; keep the card within the height the host allows.\n const max = host.containerDimensions?.maxHeight;\n root.style.setProperty(\"--stage-h\", (max ? Math.max(240, Math.min(520, max - 200)) : innerWidth < 480 ? 420 : 520) + \"px\");\n }\n\n // Each tool puts its JSON in one text item among others (a lead sentence, guidance, the Previews list).\n const texts = (result) => (result?.content ?? []).filter((c) => c.type === \"text\").map((c) => c.text);\n function json(result) {\n for (const text of texts(result)) {\n try { const value = JSON.parse(text); if (value && typeof value === \"object\" && !Array.isArray(value)) return value; } catch {}\n }\n return null;\n }\n function toEmail(e = {}, link = \"\") {\n return {\n emailId: e.emailId || e.id || \"\",\n subject: e.subject || \"\",\n preheader: e.preheader || e.previewText || \"\",\n picture: https(e.screenshotFullUrl) || https(e.screenshotUrl) || https(e.thumbnailUrl),\n appUrl: https(e.appUrl) || link,\n failed: e.status === \"failed\",\n day: typeof e.sendOffsetDays === \"number\" ? e.sendOffsetDays : null,\n };\n }\n\n function onResult(result) {\n clearTimeout(timer);\n sel = 0; tries = 0;\n const data = json(result);\n if (result?.isError || !data || (data.error && !data.conversationId && !data.editId)) {\n const mode = input.emailId && input.prompt ? \"edit\" : input.prompt ? \"create\" : \"email\";\n // Refused before anything started (no credits, a locked email): trying again would only repeat it.\n s = { mode, phase: \"failed\", refused: true, emailId: input.emailId, count: input.count, error: (typeof data?.error === \"string\" && data.error) || (!data && texts(result)[0]) || \"Migma could not do this.\" };\n render();\n if (mode === \"edit\") readBefore();\n return;\n }\n if (data.editId) {\n s = { mode: \"edit\", phase: \"working\", emailId: data.emailId, editId: data.editId, appUrl: https(data.appUrl), createdAt: data.createdAt, stage: data.stage };\n delay = data.pollAfterMs || 2000;\n render();\n readBefore();\n poll();\n } else if (data.emailId && \"subject\" in data) {\n s = { mode: \"email\", phase: \"ready\", emails: [toEmail(data)] };\n render();\n if (missingPicture()) retryPicture();\n } else if (data.conversationId) {\n // A status check is a snapshot: one line, or a Ready row that opens in place. The card the\n // generate call drew stays live, so these never poll unless opened.\n s = { mode: \"create\", phase: \"working\", compact: !!data.createdAt && !input.prompt, checkedAt: Date.now(), conversationId: data.conversationId, appUrl: https(data.appUrl), count: data.count || input.count };\n applyStatus(data);\n delay = 3000;\n render();\n if (!s.compact) poll();\n }\n }\n\n function applyStatus(d) {\n if (d.createdAt) s.createdAt = d.createdAt;\n if (d.status === \"failed\") { s.phase = \"failed\"; s.error = d.error || \"Migma could not create this email.\"; return; }\n if (d.status === \"completed\") {\n const r = d.result || {};\n const rows = Array.isArray(r.emails) && r.emails.length ? r.emails : [r];\n s.emails = rows.map((e) => toEmail(e, s.appUrl));\n s.phase = \"ready\";\n return;\n }\n const p = d.progress || {};\n const events = Array.isArray(p.events) ? p.events.filter((e) => e?.label) : [];\n const done = [...new Set(events.filter((e) => e.status === \"complete\").map((e) => e.label))];\n const live = p.now?.label && (p.now.status === \"start\" || p.now.status === \"progress\") ? p.now.label : \"\";\n s.now = live || events.filter((e) => e.status === \"processing\").pop()?.label || s.now || \"\";\n s.steps = done.filter((label) => label !== s.now).slice(-3);\n if (Array.isArray(p.slots) && p.slots.length) s.slots = p.slots;\n }\n\n function applyEdit(d) {\n if (d.createdAt) s.createdAt = d.createdAt;\n s.stage = d.stage || s.stage;\n if (d.status === \"completed\") {\n s.mode = \"email\"; s.phase = \"ready\";\n s.emails = [unchanged(toEmail(d.result || { emailId: s.emailId, subject: s.before?.subject }, s.before?.appUrl || s.appUrl), s.before?.picture)];\n } else if (d.status === \"failed\") {\n s.phase = \"failed\"; s.error = d.error || \"Migma could not change this email.\"; s.mayHaveSaved = !!d.changesMayHaveBeenSaved;\n }\n }\n\n // Right after a change the email can still carry its old picture until Migma captures the new\n // one: wait for a different picture, and show the old one only once the retries run out.\n function unchanged(e, old) {\n if (e.picture && e.picture === old) { e.stale = e.picture; e.picture = \"\"; }\n return e;\n }\n\n // Tried even when the host does not list serverTools or openLinks: a refusal falls back.\n async function read(name, args) {\n try {\n const result = await request(\"tools/call\", { name, arguments: args }, 30000);\n return result?.isError ? null : json(result);\n } catch { return null; }\n }\n\n async function readBefore() {\n if (!s?.emailId) return;\n const d = await read(\"migma_get_email\", { emailId: s.emailId });\n if (d?.emailId && s.mode !== \"email\") { s.before = toEmail(d); render(); }\n }\n\n async function poll() {\n clearTimeout(timer);\n if (!s || s.compact || s.phase !== \"working\" || busy || document.visibilityState !== \"visible\") return;\n busy = true;\n if (s.mode === \"create\") {\n const d = await read(\"migma_get_generation_status\", { conversationId: s.conversationId });\n if (d?.conversationId) applyStatus(d);\n } else {\n const d = await read(\"migma_get_email_edit_status\", { emailId: s.emailId, editId: s.editId });\n if (d?.status) applyEdit(d);\n }\n busy = false;\n render();\n if (s.phase === \"working\") {\n // ponytail: backoff to one read every 15 s; a push from Migma would replace polling if hosts add it.\n timer = setTimeout(poll, delay);\n delay = Math.min(delay * 1.4, 15000);\n } else if (missingPicture()) retryPicture();\n }\n\n const missingPicture = () => s?.phase === \"ready\" && s.emails.some((e) => !e.failed && !e.picture);\n // The picture is captured after the email is saved. Each read returns every picture of the\n // run, so try a few times, further apart, then say it is ready in Migma.\n function retryPicture() {\n clearTimeout(timer);\n if (tries >= PICTURE_TRIES) {\n for (const e of s.emails) if (!e.picture && e.stale) e.picture = e.stale;\n s.noPicture = true;\n return render();\n }\n timer = setTimeout(async () => {\n tries++;\n if (s.mode === \"create\") {\n const d = await read(\"migma_get_generation_status\", { conversationId: s.conversationId });\n if (d?.status === \"completed\") applyStatus(d);\n } else {\n const d = await read(\"migma_get_email\", { emailId: s.emails[0].emailId });\n if (d?.emailId) s.emails = [unchanged(toEmail(d, s.emails[0].appUrl), s.emails[0].stale)];\n }\n render();\n if (missingPicture()) retryPicture();\n }, 4000 * 2 ** tries);\n }\n\n function refreshSoon() { if (s?.phase === \"working\") { delay = 3000; poll(); } }\n document.addEventListener(\"visibilitychange\", () => document.visibilityState === \"visible\" && refreshSoon());\n window.addEventListener(\"focus\", refreshSoon);\n\n function elapsed() {\n const start = Date.parse(s.createdAt);\n if (!start) return \"\";\n const secs = Math.max(0, Math.round(((s.compact ? s.checkedAt : Date.now()) - start) / 1000));\n return Math.floor(secs / 60) + \":\" + String(secs % 60).padStart(2, \"0\");\n }\n function tick() {\n clearInterval(ticker);\n if (s.phase !== \"working\" || s.compact || !s.createdAt) return;\n ticker = setInterval(() => document.querySelectorAll(\".time\").forEach((t) => { t.textContent = elapsed(); }), 1000);\n }\n\n // ---- actions ----\n async function openLink(url) {\n if (!url) return;\n try { const r = await request(\"ui/open-link\", { url }); if (!r?.isError) return; } catch {}\n s.note = \"Could not open the link. Copy it: \" + url;\n render();\n }\n async function ask(text) {\n try {\n const r = await request(\"ui/message\", { role: \"user\", content: [{ type: \"text\", text }] });\n if (r?.isError) throw new Error();\n } catch {\n s.note = \"Could not send that to Claude. Type it in the chat instead.\";\n render();\n }\n }\n async function displayMode(mode) {\n try { const r = await request(\"ui/request-display-mode\", { mode }); applyHost({ displayMode: r?.mode || host.displayMode }); } catch {}\n render();\n }\n const canFullScreen = () => (host.availableDisplayModes || []).includes(\"fullscreen\");\n const fullScreen = () => host.displayMode === \"fullscreen\" && s.phase === \"ready\" && !s.compact;\n function select(i) {\n sel = Math.max(0, Math.min(s.emails.length - 1, i));\n render();\n document.querySelector('[aria-selected=\"true\"], [aria-current=\"true\"]')?.focus();\n }\n document.addEventListener(\"keydown\", (event) => {\n if (!s || !fullScreen() || s.emails.length < 2 || event.target.closest?.('[role=\"tab\"]')) return;\n if (event.key === \"ArrowLeft\") select(sel - 1);\n if (event.key === \"ArrowRight\") select(sel + 1);\n });\n\n // ---- pieces ----\n const series = () => s.emails.length > 1;\n const quoted = (e) => (e.subject ? \"\u201C\" + e.subject + \"\u201D\" : \"this email\");\n const named = (e, i) => (series() ? \"email \" + (i + 1) + \" of the series, \" + quoted(e) + \",\" : quoted(e));\n function chip(label, cost, text) {\n const b = button(\"chip\", label, () => ask(text));\n if (cost) b.append(el(\"small\", cost));\n return b;\n }\n function asks(list) {\n const box = el(\"div\", \"\", { className: \"asks\" });\n if (caps.message) box.append(...list.map(([label, cost, text]) => chip(label, cost, text)));\n return box;\n }\n function linkButton(url, primary) {\n if (!url) return el(\"span\", \"\");\n const b = button(primary ? \"primary\" : \"ghost\", primary ? \"Edit in Migma\" : \"Open in Migma\", () => openLink(url));\n b.append(icon(\"out\"));\n return b;\n }\n function foot(list, url, primary) {\n const f = el(\"div\", \"\", { className: \"foot\" });\n f.append(asks(list), linkButton(url, primary));\n return f;\n }\n function head(title, pre, tools = []) {\n const h = el(\"div\", \"\", { className: \"head\" });\n const t = el(\"div\", \"\", { className: \"title\" });\n t.append(el(\"h1\", title));\n if (pre) t.append(el(\"p\", pre, { className: \"pre\", title: pre }));\n h.append(t);\n if (tools.length) { const box = el(\"div\", \"\", { className: \"tools\" }); box.append(...tools); h.append(box); }\n return h;\n }\n function statusLine(label, tone) {\n const p = el(\"p\", \"\", { className: \"status\" });\n p.append(el(\"span\", \"\", { className: \"dot \" + tone }), el(\"span\", label));\n return p;\n }\n function steps(items) {\n const ul = el(\"ul\", \"\", { className: \"steps\" });\n ul.setAttribute(\"aria-live\", \"polite\");\n for (const [label, state] of items) {\n const li = el(\"li\", \"\", { className: state });\n const mark = el(\"span\", \"\", { className: \"mark\" });\n mark.append(state === \"done\" ? icon(\"check\") : el(\"span\", \"\", { className: \"ring\" }));\n li.append(mark, el(\"span\", label));\n if (state === \"now\") li.append(el(\"span\", elapsed(), { className: \"time\" }));\n ul.append(li);\n }\n return ul;\n }\n function skeleton() {\n const box = el(\"div\", \"\", { className: \"skel\" });\n for (const [h, w, m] of [[14, 30, 0], [56, 85, 16], [56, 60, 0], [200, 100, 8]]) {\n box.append(el(\"div\", \"\", { className: \"sk\", style: \"height:\" + h + \"px;width:\" + w + \"%;margin-top:\" + m + \"px\" }));\n }\n return box;\n }\n function picture(e, dim) {\n const shot = el(\"div\", \"\", { className: dim ? \"shot dim\" : \"shot\" });\n const img = el(\"img\", \"\", { alt: (e.subject || \"Email\") + (dim ? \", before the change\" : \"\") });\n img.addEventListener(\"error\", () => { e.picture = \"\"; render(); if (missingPicture()) retryPicture(); }, { once: true });\n img.src = e.picture;\n shot.append(img);\n return shot;\n }\n function stageNote(iconName, text) {\n const note = el(\"div\", \"\", { className: \"stage-note\" });\n note.append(icon(iconName, true), el(\"p\", text));\n return note;\n }\n function stage(e, opts = {}) {\n const box = el(\"div\", \"\", { className: opts.short ? \"stage short\" : \"stage\" });\n if (e?.failed) {\n const ready = s.emails.filter((x) => !x.failed).length;\n box.append(stageNote(\"alert\", \"Migma could not create this email.\" + (ready ? \" The other \" + (ready === 1 ? \"one is\" : ready + \" are\") + \" ready.\" : \"\")));\n } else if (e?.picture) {\n box.append(picture(e, opts.dim));\n box.tabIndex = 0;\n box.setAttribute(\"aria-label\", (e.subject || \"Email\") + \", scroll to read\");\n } else if (opts.short || !s.noPicture || !e) {\n box.append(skeleton());\n if (e && !opts.short) {\n const note = el(\"p\", \"\", { className: \"stage-note\", role: \"status\" });\n const pill = el(\"span\", \"\", { className: \"pill\" });\n pill.append(el(\"span\", \"\", { className: \"dot info\" }), el(\"span\", \"Preparing the picture\"));\n note.append(pill);\n box.append(note);\n }\n } else {\n box.append(stageNote(\"image\", \"No picture of this email yet. It is ready in Migma.\"));\n }\n return box;\n }\n function tabs() {\n const list = el(\"div\", \"\", { className: \"tabs\", role: \"tablist\" });\n list.setAttribute(\"aria-label\", \"Emails in this series\");\n s.emails.forEach((e, i) => {\n const tab = button(\"tab\", \"\", () => select(i), { role: \"tab\" });\n tab.setAttribute(\"aria-selected\", String(i === sel));\n tab.tabIndex = i === sel ? 0 : -1;\n tab.append(el(\"span\", String(i + 1), { className: \"n\" }), el(\"span\", e.failed ? \"Not created\" : e.subject || \"Email \" + (i + 1), { className: \"t\" }));\n if (e.failed) tab.append(el(\"span\", \"\", { className: \"dot bad\" }));\n else if (e.day !== null) tab.append(el(\"span\", \"Day \" + e.day, { className: \"d\" }));\n tab.addEventListener(\"keydown\", (event) => {\n if (event.key === \"ArrowLeft\") select(i - 1);\n if (event.key === \"ArrowRight\") select(i + 1);\n });\n list.append(tab);\n });\n return list;\n }\n function readyAsks(e, i) {\n if (e.failed) return [[\"Try this email again\", \"1 credit\", \"Try creating email \" + (i + 1) + \" of the series again.\"]];\n return [\n [\"Make it shorter\", \"0.5 credit\", \"Make \" + named(e, i) + \" shorter.\"],\n [\"Try another version\", \"1 credit\", \"Make another version of \" + named(e, i).replace(/,$/, \"\") + \".\"],\n ];\n }\n\n // ---- views ----\n function compactView() {\n const line = el(\"div\", \"\", { className: \"line\", role: \"status\" });\n const many = (s.count || s.slots?.length || s.emails?.length || 1) > 1;\n if (s.phase === \"working\") {\n line.append(el(\"span\", \"\", { className: \"dot info\" }), el(\"span\", many ? \"Designing \" + (s.count || s.slots.length) + \" emails\" : \"Designing your email\", { className: \"t\" }));\n if (s.now) line.append(el(\"span\", s.now, { className: \"s\" }));\n line.append(el(\"span\", elapsed(), { className: \"time\" }));\n } else if (s.phase === \"failed\") {\n line.append(el(\"span\", \"\", { className: \"dot bad\" }), el(\"span\", \"Not created\", { className: \"t\" }), el(\"span\", s.error, { className: \"s\" }));\n } else {\n const first = s.emails.find((e) => e.picture);\n const thumb = el(\"span\", \"\", { className: \"thumb\" });\n if (first) thumb.append(el(\"img\", \"\", { src: first.picture, alt: \"\" }));\n line.append(thumb, el(\"span\", many ? s.emails.length + \" emails\" : s.emails[0].subject || \"Your email\", { className: \"t\" }), el(\"span\", \"Ready\", { className: \"s\" }));\n const show = button(\"ghost\", \"Show\", () => { s.compact = false; render(); if (missingPicture()) retryPicture(); });\n show.setAttribute(\"aria-expanded\", \"false\");\n line.append(show, linkButton(s.emails[0].appUrl || s.appUrl, true));\n }\n return [line];\n }\n\n function workingView() {\n if (s.mode === \"edit\") {\n const at = Math.max(0, EDIT_STEPS.findIndex(([, stages]) => stages.includes(s.stage)));\n return [\n head(s.before?.subject || \"Changing your email\", input.prompt),\n steps(EDIT_STEPS.map(([label], i) => [label, i < at ? \"done\" : i === at ? \"now\" : \"todo\"])),\n s.before?.picture ? stage(s.before, { dim: true }) : stage(null, { short: true }),\n foot([], s.before?.appUrl || s.appUrl, false),\n ];\n }\n const count = s.count || s.slots?.length || 1;\n const parts = [\n head(count > 1 ? \"Designing \" + count + \" emails\" : \"Designing your email\", input.prompt),\n steps([...(s.steps || []).map((label) => [label, \"done\"]), [s.now || \"Starting\", \"now\"]]),\n ];\n if (count > 1) {\n const slots = el(\"div\", \"\", { className: \"slots\" });\n for (let i = 0; i < count; i++) {\n const done = s.slots?.[i] && !s.slots[i].pending;\n const slot = el(\"div\", \"\", { className: done ? \"slot done\" : \"slot\" });\n const frame = el(\"div\", \"\", { className: \"frame\" });\n frame.append(done ? icon(\"check\", true) : el(\"span\", \"\", { className: \"dot info\" }));\n const lab = el(\"div\", \"\", { className: \"lab\" });\n lab.append(el(\"span\", \"Email \" + (i + 1)), el(\"span\", done ? \"Done\" : \"Designing\"));\n slot.append(frame, lab);\n slots.append(slot);\n }\n parts.push(slots);\n } else {\n parts.push(stage(null, { short: true }));\n }\n parts.push(foot([], s.appUrl, false));\n return parts;\n }\n\n function failedView() {\n if (s.mode === \"edit\") {\n const e = s.before;\n const parts = [statusLine(\"Not changed\", \"bad\"), head(e?.subject || \"Your email\", input.prompt), el(\"p\", s.error, { className: \"note bad\" })];\n if (s.mayHaveSaved) parts.push(el(\"p\", \"Some changes may have been saved. Check the email in Migma before you try again.\", { className: \"note warn\" }));\n if (e?.picture) parts.push(stage(e));\n parts.push(foot(input.prompt && !s.refused ? [[\"Try again\", \"0.5 credit\", \"Try that change to \" + (e ? quoted(e) : \"the email\") + \" again.\"]] : [], e?.appUrl || s.appUrl, true));\n return parts;\n }\n if (s.mode === \"email\") return [statusLine(\"Could not show this email\", \"bad\"), el(\"p\", s.error, { className: \"note bad\" })];\n const many = (s.count || 1) > 1;\n return [\n statusLine(\"Not created\", \"bad\"),\n head(many ? \"Your emails\" : \"Your email\", input.prompt),\n el(\"p\", s.error, { className: \"note bad\" }),\n foot(input.prompt && !s.refused ? [[\"Try again\", many ? s.count + \" credits\" : \"1 credit\", many ? \"Try creating those emails again.\" : \"Try creating that email again.\"]] : [], s.appUrl, false),\n ];\n }\n\n function readyView() {\n const e = s.emails[sel];\n const full = canFullScreen() ? [button(\"icon-btn\", \"\", () => displayMode(\"fullscreen\"), { ariaLabel: \"Full screen\" })] : [];\n full[0]?.append(icon(\"expand\"));\n const title = e.failed ? \"Email \" + (sel + 1) + \" was not created\" : e.subject || \"Your email\";\n const parts = [head(title, e.failed ? \"\" : e.preheader, full)];\n if (series()) parts.push(tabs());\n parts.push(stage(e), foot(readyAsks(e, sel), e.appUrl || s.appUrl, true));\n return parts;\n }\n\n function fullScreenView() {\n const e = s.emails[sel];\n const back = button(\"icon-btn\", \"\", () => displayMode(\"inline\"), { ariaLabel: \"Back to the chat\" });\n back.append(icon(\"collapse\"));\n const box = el(\"section\", \"\", { className: \"fs\" });\n const body = el(\"div\", \"\", { className: \"fs-body\" });\n if (series()) {\n const rail = el(\"nav\", \"\", { className: \"rail\" });\n rail.setAttribute(\"aria-label\", \"Emails in this series\");\n s.emails.forEach((x, i) => {\n const item = button(\"rail-item\", \"\", () => select(i));\n if (i === sel) item.setAttribute(\"aria-current\", \"true\");\n const thumb = el(\"div\", \"\", { className: \"thumb\" });\n thumb.append(x.picture ? el(\"img\", \"\", { src: x.picture, alt: \"\" }) : icon(x.failed ? \"alert\" : \"image\", true));\n item.append(thumb, el(\"span\", (i + 1) + (x.failed ? \" \u00B7 Not created\" : x.day !== null ? \" \u00B7 Day \" + x.day : \"\")));\n rail.append(item);\n });\n body.append(rail);\n }\n const wrap = el(\"div\", \"\", { className: \"fs-wrap\" });\n wrap.append(stage(e));\n if (series()) {\n const prev = button(\"step-btn prev\", \"\", () => select(sel - 1), { ariaLabel: \"Previous email\", disabled: sel === 0 });\n const next = button(\"step-btn next\", \"\", () => select(sel + 1), { ariaLabel: \"Next email\", disabled: sel === s.emails.length - 1 });\n prev.append(icon(\"prev\")); next.append(icon(\"next\"));\n wrap.append(prev, next);\n }\n body.append(wrap);\n box.append(head(e.failed ? \"Email \" + (sel + 1) + \" was not created\" : e.subject || \"Your email\", e.failed ? \"\" : e.preheader, [back]));\n if (series()) box.append(tabs());\n box.append(body, foot(readyAsks(e, sel), e.appUrl || s.appUrl, true));\n if (s.note) box.append(el(\"p\", s.note, { className: \"note small\" }));\n return [box];\n }\n\n function render() {\n const main = $(\"card\");\n main.setAttribute(\"aria-busy\", String(s.phase === \"working\" && !s.compact));\n let parts;\n if (s.compact) parts = compactView();\n else if (fullScreen()) parts = fullScreenView();\n else parts = s.phase === \"working\" ? workingView() : s.phase === \"failed\" ? failedView() : readyView();\n if (s.note && !fullScreen()) parts.push(el(\"p\", s.note, { className: \"note small\" }));\n main.replaceChildren(...parts);\n tick();\n }\n\n new ResizeObserver(() => send({ method: \"ui/notifications/size-changed\", params: { height: Math.ceil(document.documentElement.getBoundingClientRect().height) } }))\n .observe(document.documentElement);\n\n const init = await request(\"ui/initialize\", {\n appInfo: { name: \"Migma email\", version: \"1.0.0\" },\n appCapabilities: { availableDisplayModes: [\"inline\", \"fullscreen\"] },\n protocolVersion: \"2026-01-26\",\n });\n caps = init?.hostCapabilities ?? {};\n applyHost(init?.hostContext);\n send({ method: \"ui/notifications/initialized\", params: {} });\n</script>\n</body>\n</html>\n";
13
+ export declare const EMAIL_CARD_HTML = "<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<meta name=\"color-scheme\" content=\"light dark\">\n<title>Email</title>\n<style>\n :root {\n color-scheme: light dark;\n --surface: var(--color-background-primary, light-dark(#ffffff, #30302e));\n --muted: var(--color-background-secondary, light-dark(#f5f4ed, #262624));\n --muted-2: var(--color-background-tertiary, light-dark(#ebe9df, #3a3a37));\n --text: var(--color-text-primary, light-dark(#141413, #faf9f5));\n --text-2: var(--color-text-secondary, light-dark(#3d3d3a, #c2c0b6));\n --text-3: var(--color-text-tertiary, light-dark(#73726c, #9c9a92));\n --line: var(--color-border-tertiary, light-dark(rgb(31 30 29 / 15%), rgb(222 220 209 / 15%)));\n --line-2: var(--color-border-secondary, light-dark(rgb(31 30 29 / 30%), rgb(222 220 209 / 30%)));\n --inverse: var(--color-background-inverse, light-dark(#141413, #faf9f5));\n --on-inverse: var(--color-text-inverse, light-dark(#ffffff, #141413));\n --info: var(--color-border-info, light-dark(#4682d5, #6c9be0));\n --success: var(--color-border-success, light-dark(#437426, #7fb05b));\n --danger: var(--color-border-danger, light-dark(#a73d39, #d1615c));\n --danger-text: var(--color-text-danger, light-dark(#7f2c28, #ee8884));\n --warning-text: var(--color-text-warning, light-dark(#5a4815, #d1a041));\n --radius: var(--border-radius-lg, 10px);\n --radius-md: var(--border-radius-md, 8px);\n }\n * { box-sizing: border-box; }\n html, body { margin: 0; background: transparent; }\n body {\n font-family: var(--font-sans, system-ui, -apple-system, sans-serif);\n font-size: var(--font-text-sm-size, 14px);\n line-height: var(--font-text-sm-line-height, 1.4);\n color: var(--text);\n -webkit-font-smoothing: antialiased;\n }\n p, h1, ul { margin: 0; }\n button { font: inherit; cursor: pointer; }\n button:focus-visible, .stage:focus-visible { outline: 2px solid var(--color-ring-primary, var(--info)); outline-offset: 2px; }\n button[disabled] { cursor: default; opacity: .5; }\n main {\n container-type: inline-size;\n padding: calc(16px + var(--inset-top, 0px)) calc(16px + var(--inset-right, 0px)) calc(16px + var(--inset-bottom, 0px)) calc(16px + var(--inset-left, 0px));\n }\n .i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }\n .i.big { width: 24px; height: 24px; }\n\n .head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }\n .title { min-width: 0; }\n h1 { font-size: var(--font-heading-md-size, 16px); line-height: var(--font-heading-md-line-height, 1.4); font-weight: var(--font-weight-semibold, 600); overflow-wrap: anywhere; }\n .pre { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n .icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-2); }\n .icon-btn:hover { background: var(--muted); }\n\n .stage { position: relative; margin-top: 12px; height: var(--stage-h, 520px); border-radius: var(--radius); background: var(--muted); overflow: auto; overscroll-behavior: contain; display: flex; justify-content: center; align-items: flex-start; padding: 16px; scrollbar-width: thin; }\n .stage.short { height: 240px; overflow: hidden; }\n .shot { width: min(600px, 100%); flex: none; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 0.5px var(--line); background: var(--surface); }\n .shot img { display: block; width: 100%; height: auto; }\n .shot.dim { opacity: .45; }\n .skel { width: min(600px, 100%); height: 100%; min-height: 200px; flex: none; border-radius: 4px; background: var(--surface); box-shadow: 0 0 0 0.5px var(--line); padding: 28px; display: flex; flex-direction: column; gap: 14px; overflow: hidden; }\n .sk { background: var(--muted-2); border-radius: 6px; flex: none; }\n .stage-note { position: absolute; inset: 0; margin: auto; height: fit-content; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; color: var(--text-2); text-align: center; max-width: 340px; }\n .pill { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 0.5px var(--line); color: var(--text-2); }\n\n .tabs { display: flex; gap: 4px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; }\n .tab { display: inline-flex; gap: 8px; align-items: center; height: 36px; max-width: 220px; flex: none; padding: 0 12px 0 8px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-2); font-size: 13px; }\n .tab .n { display: grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 50%; background: var(--muted); font-size: 12px; font-weight: 600; }\n .tab .t { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }\n .tab .d { color: var(--text-3); flex: none; }\n .tab[aria-selected=\"true\"] { background: var(--muted); color: var(--text); }\n .tab[aria-selected=\"true\"] .n { background: var(--inverse); color: var(--on-inverse); }\n\n .foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }\n .asks { display: flex; gap: 6px; flex-wrap: wrap; }\n .chip { display: inline-flex; gap: 6px; align-items: center; min-height: 32px; padding: 0 12px; border: 0.5px solid var(--line-2); border-radius: 999px; background: transparent; color: var(--text); font-size: 13px; font-weight: var(--font-weight-medium, 500); }\n .chip:hover { background: var(--muted); }\n .primary, .ghost { display: inline-flex; gap: 6px; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; border-radius: var(--radius-md); white-space: nowrap; font-weight: var(--font-weight-semibold, 600); }\n .primary { border: 0; background: var(--inverse); color: var(--on-inverse); margin-left: auto; }\n .ghost { border: 0.5px solid var(--line-2); background: transparent; color: var(--text); font-weight: var(--font-weight-medium, 500); margin-left: auto; }\n .ghost:hover { background: var(--muted); }\n @container (max-width: 420px) { .foot .primary, .foot .ghost { width: 100%; } }\n\n .status { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; color: var(--text-2); font-weight: var(--font-weight-medium, 500); }\n .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }\n .dot.info { background: var(--info); } .dot.ok { background: var(--success); } .dot.bad { background: var(--danger); }\n .time { margin-left: auto; color: var(--text-3); font-variant-numeric: tabular-nums; font-weight: 400; }\n .steps { list-style: none; padding: 0; margin-top: 12px; display: grid; gap: 6px; }\n .steps li { display: flex; gap: 8px; align-items: center; color: var(--text-3); min-width: 0; }\n .steps li span:nth-child(2) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }\n .steps li.now { color: var(--text); }\n .mark { display: grid; place-items: center; width: 16px; height: 16px; flex: none; }\n .ring { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line-2); }\n .now .ring { border-color: var(--info); background: var(--info); }\n .note { margin-top: 12px; color: var(--text-2); overflow-wrap: anywhere; }\n .note.bad { color: var(--danger-text); }\n .note.warn { margin-top: 4px; color: var(--warning-text); }\n .note.small { color: var(--text-3); font-size: 13px; }\n\n .slots { display: flex; gap: 12px; margin-top: 12px; overflow-x: auto; }\n .slot { flex: 1 0 72px; min-width: 0; max-width: 200px; display: flex; flex-direction: column; gap: 8px; }\n .slot .frame { aspect-ratio: 3 / 4; border-radius: var(--radius-md); background: var(--muted); display: grid; place-items: center; color: var(--text-3); }\n .slot.done .frame { color: var(--success); }\n .slot .lab { display: flex; flex-wrap: wrap; column-gap: 6px; color: var(--text-2); font-size: 13px; }\n .slot .lab span:last-child { color: var(--text-3); margin-left: auto; }\n\n .line { display: flex; gap: 8px; align-items: center; min-height: 28px; color: var(--text-2); min-width: 0; }\n .line .t { color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }\n .line .s { color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }\n .line .thumb { width: 40px; height: 40px; flex: none; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 0.5px var(--line); background: var(--muted); }\n .line .thumb img { display: block; width: 100%; }\n .line .ghost, .line .primary { min-height: 30px; padding: 0 10px; font-size: 13px; margin-left: 0; }\n .line .ghost:first-of-type { margin-left: auto; }\n @container (max-width: 420px) { .line { flex-wrap: wrap; } .line .ghost:first-of-type { margin-left: 48px; } }\n\n :root:has(.fs), :root:has(.fs) body { height: 100%; }\n main:has(.fs) { height: 100%; padding: 0; }\n .fs { height: 100%; display: flex; flex-direction: column; }\n .fs > .head { padding: calc(14px + var(--inset-top, 0px)) calc(20px + var(--inset-right, 0px)) 14px calc(20px + var(--inset-left, 0px)); border-bottom: 0.5px solid var(--line); }\n .fs-body { flex: 1; display: flex; min-height: 0; }\n .rail { width: 200px; flex: none; padding: 16px; display: flex; flex-direction: column; gap: 12px; border-right: 0.5px solid var(--line); overflow-y: auto; }\n .rail-item { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: var(--radius); border: 0; background: transparent; text-align: left; color: var(--text-2); font-size: 13px; }\n .rail-item .thumb { height: 140px; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 0.5px var(--line); background: var(--muted); display: grid; place-items: center; color: var(--text-3); }\n .rail-item .thumb img { display: block; width: 100%; align-self: start; }\n .rail-item[aria-current=\"true\"] { background: var(--muted); color: var(--text); }\n .fs .stage { flex: 1; height: auto; margin: 0; border-radius: 0; padding: 24px; }\n .fs .foot { margin: 0; padding: 12px calc(20px + var(--inset-right, 0px)) calc(12px + var(--inset-bottom, 0px)) calc(20px + var(--inset-left, 0px)); border-top: 0.5px solid var(--line); }\n .fs .note { margin: 0; padding: 0 20px 12px; }\n .step-btn { position: absolute; top: 50%; margin-top: -18px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0.5px solid var(--line); background: var(--surface); color: var(--text); }\n .step-btn.prev { left: 16px; } .step-btn.next { right: 16px; }\n .fs-wrap { flex: 1; position: relative; display: flex; min-width: 0; }\n .fs .tabs { display: none; margin: 0; padding: 8px calc(20px + var(--inset-right, 0px)) 8px calc(20px + var(--inset-left, 0px)); border-bottom: 0.5px solid var(--line); }\n /* Narrow full screen (Claude's side panel): tabs replace the rail and the arrows over the email. */\n @container (max-width: 720px) { .rail, .step-btn { display: none; } .fs .tabs { display: flex; } }\n\n @media (prefers-reduced-motion: no-preference) {\n .sk, .now .ring { animation: pulse 1.4s ease-in-out infinite; }\n @keyframes pulse { 50% { opacity: .55; } }\n }\n</style>\n</head>\n<body>\n<main id=\"card\" aria-busy=\"true\">\n <div class=\"sk\" style=\"height:16px;width:40%\"></div>\n <div class=\"sk\" style=\"height:12px;width:70%;margin-top:8px\"></div>\n <div class=\"stage short\"></div>\n</main>\n<script type=\"module\">\n const ICON = {\n expand: '<path d=\"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7\"/>',\n collapse: '<path d=\"M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7\"/>',\n out: '<path d=\"M7 17L17 7M8 7h9v9\"/>',\n check: '<path d=\"M5 12l5 5L20 7\"/>',\n prev: '<path d=\"M15 18l-6-6 6-6\"/>',\n next: '<path d=\"M9 18l6-6-6-6\"/>',\n image: '<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><circle cx=\"9\" cy=\"9\" r=\"2\"/><path d=\"M21 15l-5-5L5 21\"/>',\n alert: '<circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M12 8v4M12 16h.01\"/>',\n };\n const EDIT_STEPS = [[\"Checking the email\", [\"queued\", \"checking\"]], [\"Changing it\", [\"editing\"]], [\"Saving\", [\"saved\"]]];\n const PICTURE_TRIES = 4;\n const $ = (id) => document.getElementById(id);\n const el = (tag, text, attrs = {}) => Object.assign(document.createElement(tag), { textContent: text ?? \"\" }, attrs);\n function icon(name, big) {\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"class\", big ? \"i big\" : \"i\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"aria-hidden\", \"true\");\n svg.innerHTML = ICON[name];\n return svg;\n }\n function button(className, label, onclick, attrs = {}) {\n const b = el(\"button\", label, { type: \"button\", className, ...attrs });\n b.addEventListener(\"click\", onclick);\n return b;\n }\n const https = (url) => (typeof url === \"string\" && url.startsWith(\"https://\") ? url : \"\");\n\n let host = {}, caps = {}, input = {}, s = null, sel = 0, nextId = 1, timer = 0, ticker = 0, delay = 3000, tries = 0, busy = false;\n const pending = new Map();\n\n function send(msg) { window.parent.postMessage({ jsonrpc: \"2.0\", ...msg }, \"*\"); }\n function request(method, params, ms) {\n const id = nextId++;\n send({ id, method, params });\n return new Promise((resolve, reject) => {\n pending.set(id, { resolve, reject });\n // A host that never answers must not stall the card's reads.\n if (ms) setTimeout(() => pending.delete(id) && reject(new Error(\"timeout\")), ms);\n });\n }\n\n window.addEventListener(\"message\", (event) => {\n if (event.source !== window.parent) return;\n const msg = event.data;\n if (!msg || msg.jsonrpc !== \"2.0\") return;\n if (msg.id !== undefined && !msg.method) {\n const waiter = pending.get(msg.id);\n pending.delete(msg.id);\n if (waiter) msg.error ? waiter.reject(msg.error) : waiter.resolve(msg.result);\n return;\n }\n if (msg.id !== undefined) {\n // Host requests (ping, teardown) need an answer; this card holds no state to save.\n send({ id: msg.id, result: {} });\n return;\n }\n if (msg.method === \"ui/notifications/tool-input\") input = msg.params?.arguments ?? {};\n if (msg.method === \"ui/notifications/tool-result\") onResult(msg.params);\n if (msg.method === \"ui/notifications/host-context-changed\") { applyHost(msg.params); if (s) render(); }\n });\n\n function applyHost(ctx = {}) {\n host = { ...host, ...ctx };\n const root = document.documentElement;\n if (ctx.theme) { root.dataset.theme = ctx.theme; root.style.colorScheme = ctx.theme; }\n for (const [key, value] of Object.entries(ctx.styles?.variables ?? {})) if (value) root.style.setProperty(key, value);\n if (ctx.styles?.css?.fonts && !$(\"host-fonts\")) document.head.append(el(\"style\", ctx.styles.css.fonts, { id: \"host-fonts\" }));\n const inset = ctx.safeAreaInsets;\n if (inset) for (const side of [\"top\", \"right\", \"bottom\", \"left\"]) root.style.setProperty(\"--inset-\" + side, (inset[side] || 0) + \"px\");\n root.dataset.mode = host.displayMode || \"inline\";\n // Inline, the email scrolls inside the card; keep the card within the height the host allows.\n const max = host.containerDimensions?.maxHeight;\n root.style.setProperty(\"--stage-h\", (max ? Math.max(240, Math.min(520, max - 200)) : innerWidth < 480 ? 420 : 520) + \"px\");\n }\n\n // Each tool puts its JSON in one text item among others (a lead sentence, guidance, the Previews list).\n const texts = (result) => (result?.content ?? []).filter((c) => c.type === \"text\").map((c) => c.text);\n function json(result) {\n for (const text of texts(result)) {\n try { const value = JSON.parse(text); if (value && typeof value === \"object\" && !Array.isArray(value)) return value; } catch {}\n }\n return null;\n }\n function toEmail(e = {}, link = \"\") {\n return {\n emailId: e.emailId || e.id || \"\",\n subject: e.subject || \"\",\n preheader: e.preheader || e.previewText || \"\",\n picture: https(e.screenshotFullUrl) || https(e.screenshotUrl) || https(e.thumbnailUrl),\n appUrl: https(e.appUrl) || link,\n failed: e.status === \"failed\",\n day: typeof e.sendOffsetDays === \"number\" ? e.sendOffsetDays : null,\n };\n }\n\n function onResult(result) {\n clearTimeout(timer);\n sel = 0; tries = 0;\n const data = json(result);\n if (result?.isError || !data || (data.error && !data.conversationId && !data.editId)) {\n const mode = input.emailId && input.prompt ? \"edit\" : input.prompt ? \"create\" : \"email\";\n // Refused before anything started (no credits, a locked email): trying again would only repeat it.\n s = { mode, phase: \"failed\", refused: true, emailId: input.emailId, count: input.count, error: (typeof data?.error === \"string\" && data.error) || (!data && texts(result)[0]) || \"Migma could not do this.\" };\n render();\n if (mode === \"edit\") readBefore();\n return;\n }\n if (data.editId) {\n s = { mode: \"edit\", phase: \"working\", emailId: data.emailId, editId: data.editId, appUrl: https(data.appUrl), createdAt: data.createdAt, stage: data.stage };\n delay = data.pollAfterMs || 2000;\n render();\n readBefore();\n poll();\n } else if (data.emailId && \"subject\" in data) {\n s = { mode: \"email\", phase: \"ready\", emails: [toEmail(data)] };\n render();\n if (missingPicture()) retryPicture();\n } else if (data.conversationId) {\n // A status check draws one line that turns into a Ready row, which opens in place. It keeps\n // itself current: ChatGPT shows only the last card of a reply, so the generate call's card may\n // never be seen.\n s = { mode: \"create\", phase: \"working\", compact: !!data.createdAt && !input.prompt, conversationId: data.conversationId, appUrl: https(data.appUrl), count: data.count || input.count };\n applyStatus(data);\n // Slower than the full card: several status lines can poll at once, and hosted MCP allows 100 calls a minute.\n delay = s.compact ? 6000 : 3000;\n render();\n poll();\n }\n }\n\n function applyStatus(d) {\n if (d.createdAt) s.createdAt = d.createdAt;\n if (d.status === \"failed\") { s.phase = \"failed\"; s.error = d.error || \"Migma could not create this email.\"; return; }\n if (d.status === \"completed\") {\n const r = d.result || {};\n const rows = Array.isArray(r.emails) && r.emails.length ? r.emails : [r];\n s.emails = rows.map((e) => toEmail(e, s.appUrl));\n s.phase = \"ready\";\n return;\n }\n const p = d.progress || {};\n const events = Array.isArray(p.events) ? p.events.filter((e) => e?.label) : [];\n const done = [...new Set(events.filter((e) => e.status === \"complete\").map((e) => e.label))];\n const live = p.now?.label && (p.now.status === \"start\" || p.now.status === \"progress\") ? p.now.label : \"\";\n s.now = live || events.filter((e) => e.status === \"processing\").pop()?.label || s.now || \"\";\n s.steps = done.filter((label) => label !== s.now).slice(-3);\n if (Array.isArray(p.slots) && p.slots.length) s.slots = p.slots;\n }\n\n function applyEdit(d) {\n if (d.createdAt) s.createdAt = d.createdAt;\n s.stage = d.stage || s.stage;\n if (d.status === \"completed\") {\n s.mode = \"email\"; s.phase = \"ready\";\n s.emails = [unchanged(toEmail(d.result || { emailId: s.emailId, subject: s.before?.subject }, s.before?.appUrl || s.appUrl), s.before?.picture)];\n } else if (d.status === \"failed\") {\n s.phase = \"failed\"; s.error = d.error || \"Migma could not change this email.\"; s.mayHaveSaved = !!d.changesMayHaveBeenSaved;\n }\n }\n\n // Right after a change the email can still carry its old picture until Migma captures the new\n // one: wait for a different picture, and show the old one only once the retries run out.\n function unchanged(e, old) {\n if (e.picture && e.picture === old) { e.stale = e.picture; e.picture = \"\"; }\n return e;\n }\n\n // Tried even when the host does not list serverTools or openLinks: a refusal falls back.\n async function read(name, args) {\n try {\n const result = await request(\"tools/call\", { name, arguments: args }, 30000);\n return result?.isError ? null : json(result);\n } catch { return null; }\n }\n\n async function readBefore() {\n if (!s?.emailId) return;\n const d = await read(\"migma_get_email\", { emailId: s.emailId });\n if (d?.emailId && s.mode !== \"email\") { s.before = toEmail(d); render(); }\n }\n\n async function poll() {\n clearTimeout(timer);\n if (!s || s.phase !== \"working\" || busy || document.visibilityState !== \"visible\") return;\n busy = true;\n if (s.mode === \"create\") {\n const d = await read(\"migma_get_generation_status\", { conversationId: s.conversationId });\n if (d?.conversationId) applyStatus(d);\n } else {\n const d = await read(\"migma_get_email_edit_status\", { emailId: s.emailId, editId: s.editId });\n if (d?.status) applyEdit(d);\n }\n busy = false;\n render();\n if (s.phase === \"working\") {\n // ponytail: backoff to one read every 15 s; a push from Migma would replace polling if hosts add it.\n timer = setTimeout(poll, delay);\n delay = Math.min(delay * 1.4, 15000);\n } else if (missingPicture()) retryPicture();\n }\n\n const missingPicture = () => s?.phase === \"ready\" && s.emails.some((e) => !e.failed && !e.picture);\n // The picture is captured after the email is saved. Each read returns every picture of the\n // run, so try a few times, further apart, then say it is ready in Migma.\n function retryPicture() {\n clearTimeout(timer);\n if (tries >= PICTURE_TRIES) {\n for (const e of s.emails) if (!e.picture && e.stale) e.picture = e.stale;\n s.noPicture = true;\n return render();\n }\n timer = setTimeout(async () => {\n tries++;\n if (s.mode === \"create\") {\n const d = await read(\"migma_get_generation_status\", { conversationId: s.conversationId });\n if (d?.status === \"completed\") applyStatus(d);\n } else {\n const d = await read(\"migma_get_email\", { emailId: s.emails[0].emailId });\n if (d?.emailId) s.emails = [unchanged(toEmail(d, s.emails[0].appUrl), s.emails[0].stale)];\n }\n render();\n if (missingPicture()) retryPicture();\n }, 4000 * 2 ** tries);\n }\n\n function refreshSoon() { if (s?.phase === \"working\") { delay = 3000; poll(); } }\n document.addEventListener(\"visibilitychange\", () => document.visibilityState === \"visible\" && refreshSoon());\n window.addEventListener(\"focus\", refreshSoon);\n\n function elapsed() {\n const start = Date.parse(s.createdAt);\n if (!start) return \"\";\n const secs = Math.max(0, Math.round((Date.now() - start) / 1000));\n return Math.floor(secs / 60) + \":\" + String(secs % 60).padStart(2, \"0\");\n }\n function tick() {\n clearInterval(ticker);\n if (s.phase !== \"working\" || !s.createdAt) return;\n ticker = setInterval(() => document.querySelectorAll(\".time\").forEach((t) => { t.textContent = elapsed(); }), 1000);\n }\n\n // ---- actions ----\n async function openLink(url) {\n if (!url) return;\n try { const r = await request(\"ui/open-link\", { url }); if (!r?.isError) return; } catch {}\n s.note = \"Could not open the link. Copy it: \" + url;\n render();\n }\n async function ask(text) {\n try {\n const r = await request(\"ui/message\", { role: \"user\", content: [{ type: \"text\", text }] });\n if (r?.isError) throw new Error();\n } catch {\n s.note = \"Could not send that to the chat. Type it there instead.\";\n render();\n }\n }\n async function displayMode(mode) {\n try { const r = await request(\"ui/request-display-mode\", { mode }); applyHost({ displayMode: r?.mode || host.displayMode }); } catch {}\n render();\n }\n const canFullScreen = () => (host.availableDisplayModes || []).includes(\"fullscreen\");\n const fullScreen = () => host.displayMode === \"fullscreen\" && s.phase === \"ready\" && !s.compact;\n function select(i) {\n sel = Math.max(0, Math.min(s.emails.length - 1, i));\n render();\n document.querySelector('[aria-selected=\"true\"], [aria-current=\"true\"]')?.focus();\n }\n document.addEventListener(\"keydown\", (event) => {\n if (!s || !fullScreen() || s.emails.length < 2 || event.target.closest?.('[role=\"tab\"]')) return;\n if (event.key === \"ArrowLeft\") select(sel - 1);\n if (event.key === \"ArrowRight\") select(sel + 1);\n });\n\n // ---- pieces ----\n const series = () => s.emails.length > 1;\n const quoted = (e) => (e.subject ? \"\u201C\" + e.subject + \"\u201D\" : \"this email\");\n const named = (e, i) => (series() ? \"email \" + (i + 1) + \" of the series, \" + quoted(e) + \",\" : quoted(e));\n const chip = (label, text) => button(\"chip\", label, () => ask(text));\n function asks(list) {\n const box = el(\"div\", \"\", { className: \"asks\" });\n if (caps.message) box.append(...list.map(([label, text]) => chip(label, text)));\n return box;\n }\n function linkButton(url, primary) {\n if (!url) return el(\"span\", \"\");\n const b = button(primary ? \"primary\" : \"ghost\", primary ? \"Edit in Migma\" : \"Open in Migma\", () => openLink(url));\n b.append(icon(\"out\"));\n return b;\n }\n function foot(list, url, primary) {\n const f = el(\"div\", \"\", { className: \"foot\" });\n f.append(asks(list), linkButton(url, primary));\n return f;\n }\n function head(title, pre, tools = []) {\n const h = el(\"div\", \"\", { className: \"head\" });\n const t = el(\"div\", \"\", { className: \"title\" });\n t.append(el(\"h1\", title));\n if (pre) t.append(el(\"p\", pre, { className: \"pre\", title: pre }));\n h.append(t);\n if (tools.length) { const box = el(\"div\", \"\", { className: \"tools\" }); box.append(...tools); h.append(box); }\n return h;\n }\n function statusLine(label, tone) {\n const p = el(\"p\", \"\", { className: \"status\" });\n p.append(el(\"span\", \"\", { className: \"dot \" + tone }), el(\"span\", label));\n return p;\n }\n function steps(items) {\n const ul = el(\"ul\", \"\", { className: \"steps\" });\n ul.setAttribute(\"aria-live\", \"polite\");\n for (const [label, state] of items) {\n const li = el(\"li\", \"\", { className: state });\n const mark = el(\"span\", \"\", { className: \"mark\" });\n mark.append(state === \"done\" ? icon(\"check\") : el(\"span\", \"\", { className: \"ring\" }));\n li.append(mark, el(\"span\", label));\n if (state === \"now\") li.append(el(\"span\", elapsed(), { className: \"time\" }));\n ul.append(li);\n }\n return ul;\n }\n function skeleton() {\n const box = el(\"div\", \"\", { className: \"skel\" });\n for (const [h, w, m] of [[14, 30, 0], [56, 85, 16], [56, 60, 0], [200, 100, 8]]) {\n box.append(el(\"div\", \"\", { className: \"sk\", style: \"height:\" + h + \"px;width:\" + w + \"%;margin-top:\" + m + \"px\" }));\n }\n return box;\n }\n function picture(e, dim) {\n const shot = el(\"div\", \"\", { className: dim ? \"shot dim\" : \"shot\" });\n const img = el(\"img\", \"\", { alt: (e.subject || \"Email\") + (dim ? \", before the change\" : \"\") });\n img.addEventListener(\"error\", () => { e.picture = \"\"; render(); if (missingPicture()) retryPicture(); }, { once: true });\n img.src = e.picture;\n shot.append(img);\n return shot;\n }\n function stageNote(iconName, text) {\n const note = el(\"div\", \"\", { className: \"stage-note\" });\n note.append(icon(iconName, true), el(\"p\", text));\n return note;\n }\n function stage(e, opts = {}) {\n const box = el(\"div\", \"\", { className: opts.short ? \"stage short\" : \"stage\" });\n if (e?.failed) {\n const ready = s.emails.filter((x) => !x.failed).length;\n box.append(stageNote(\"alert\", \"Migma could not create this email.\" + (ready ? \" The other \" + (ready === 1 ? \"one is\" : ready + \" are\") + \" ready.\" : \"\")));\n } else if (e?.picture) {\n box.append(picture(e, opts.dim));\n box.tabIndex = 0;\n box.setAttribute(\"aria-label\", (e.subject || \"Email\") + \", scroll to read\");\n } else if (opts.short || !s.noPicture || !e) {\n box.append(skeleton());\n if (e && !opts.short) {\n const note = el(\"p\", \"\", { className: \"stage-note\", role: \"status\" });\n const pill = el(\"span\", \"\", { className: \"pill\" });\n pill.append(el(\"span\", \"\", { className: \"dot info\" }), el(\"span\", \"Preparing the picture\"));\n note.append(pill);\n box.append(note);\n }\n } else {\n box.append(stageNote(\"image\", \"No picture of this email yet. It is ready in Migma.\"));\n }\n return box;\n }\n function tabs() {\n const list = el(\"div\", \"\", { className: \"tabs\", role: \"tablist\" });\n list.setAttribute(\"aria-label\", \"Emails in this series\");\n s.emails.forEach((e, i) => {\n const tab = button(\"tab\", \"\", () => select(i), { role: \"tab\" });\n tab.setAttribute(\"aria-selected\", String(i === sel));\n tab.tabIndex = i === sel ? 0 : -1;\n tab.append(el(\"span\", String(i + 1), { className: \"n\" }), el(\"span\", e.failed ? \"Not created\" : e.subject || \"Email \" + (i + 1), { className: \"t\" }));\n if (e.failed) tab.append(el(\"span\", \"\", { className: \"dot bad\" }));\n else if (e.day !== null) tab.append(el(\"span\", \"Day \" + e.day, { className: \"d\" }));\n tab.addEventListener(\"keydown\", (event) => {\n if (event.key === \"ArrowLeft\") select(i - 1);\n if (event.key === \"ArrowRight\") select(i + 1);\n });\n list.append(tab);\n });\n return list;\n }\n function readyAsks(e, i) {\n if (e.failed) return [[\"Try this email again\", \"Try creating email \" + (i + 1) + \" of the series again.\"]];\n return [\n [\"Make it shorter\", \"Make \" + named(e, i) + \" shorter.\"],\n [\"Try another version\", \"Make another version of \" + named(e, i).replace(/,$/, \"\") + \".\"],\n ];\n }\n\n // ---- views ----\n function compactView() {\n const line = el(\"div\", \"\", { className: \"line\", role: \"status\" });\n const many = (s.count || s.slots?.length || s.emails?.length || 1) > 1;\n if (s.phase === \"working\") {\n line.append(el(\"span\", \"\", { className: \"dot info\" }), el(\"span\", many ? \"Designing \" + (s.count || s.slots.length) + \" emails\" : \"Designing your email\", { className: \"t\" }));\n if (s.now) line.append(el(\"span\", s.now, { className: \"s\" }));\n line.append(el(\"span\", elapsed(), { className: \"time\" }));\n } else if (s.phase === \"failed\") {\n line.append(el(\"span\", \"\", { className: \"dot bad\" }), el(\"span\", \"Not created\", { className: \"t\" }), el(\"span\", s.error, { className: \"s\" }));\n } else {\n const first = s.emails.find((e) => e.picture);\n const thumb = el(\"span\", \"\", { className: \"thumb\" });\n if (first) thumb.append(el(\"img\", \"\", { src: first.picture, alt: \"\" }));\n line.append(thumb, el(\"span\", many ? s.emails.length + \" emails\" : s.emails[0].subject || \"Your email\", { className: \"t\" }), el(\"span\", \"Ready\", { className: \"s\" }));\n const show = button(\"ghost\", \"Show\", () => { s.compact = false; render(); if (missingPicture()) retryPicture(); });\n show.setAttribute(\"aria-expanded\", \"false\");\n line.append(show, linkButton(s.emails[0].appUrl || s.appUrl, true));\n }\n return [line];\n }\n\n function workingView() {\n if (s.mode === \"edit\") {\n const at = Math.max(0, EDIT_STEPS.findIndex(([, stages]) => stages.includes(s.stage)));\n return [\n head(s.before?.subject || \"Changing your email\", input.prompt),\n steps(EDIT_STEPS.map(([label], i) => [label, i < at ? \"done\" : i === at ? \"now\" : \"todo\"])),\n s.before?.picture ? stage(s.before, { dim: true }) : stage(null, { short: true }),\n foot([], s.before?.appUrl || s.appUrl, false),\n ];\n }\n const count = s.count || s.slots?.length || 1;\n const parts = [\n head(count > 1 ? \"Designing \" + count + \" emails\" : \"Designing your email\", input.prompt),\n steps([...(s.steps || []).map((label) => [label, \"done\"]), [s.now || \"Starting\", \"now\"]]),\n ];\n if (count > 1) {\n const slots = el(\"div\", \"\", { className: \"slots\" });\n for (let i = 0; i < count; i++) {\n const done = s.slots?.[i] && !s.slots[i].pending;\n const slot = el(\"div\", \"\", { className: done ? \"slot done\" : \"slot\" });\n const frame = el(\"div\", \"\", { className: \"frame\" });\n frame.append(done ? icon(\"check\", true) : el(\"span\", \"\", { className: \"dot info\" }));\n const lab = el(\"div\", \"\", { className: \"lab\" });\n lab.append(el(\"span\", \"Email \" + (i + 1)), el(\"span\", done ? \"Done\" : \"Designing\"));\n slot.append(frame, lab);\n slots.append(slot);\n }\n parts.push(slots);\n } else {\n parts.push(stage(null, { short: true }));\n }\n parts.push(foot([], s.appUrl, false));\n return parts;\n }\n\n function failedView() {\n if (s.mode === \"edit\") {\n const e = s.before;\n const parts = [statusLine(\"Not changed\", \"bad\"), head(e?.subject || \"Your email\", input.prompt), el(\"p\", s.error, { className: \"note bad\" })];\n if (s.mayHaveSaved) parts.push(el(\"p\", \"Some changes may have been saved. Check the email in Migma before you try again.\", { className: \"note warn\" }));\n if (e?.picture) parts.push(stage(e));\n parts.push(foot(input.prompt && !s.refused ? [[\"Try again\", \"Try that change to \" + (e ? quoted(e) : \"the email\") + \" again.\"]] : [], e?.appUrl || s.appUrl, true));\n return parts;\n }\n if (s.mode === \"email\") return [statusLine(\"Could not show this email\", \"bad\"), el(\"p\", s.error, { className: \"note bad\" })];\n const many = (s.count || 1) > 1;\n return [\n statusLine(\"Not created\", \"bad\"),\n head(many ? \"Your emails\" : \"Your email\", input.prompt),\n el(\"p\", s.error, { className: \"note bad\" }),\n foot(input.prompt && !s.refused ? [[\"Try again\", many ? \"Try creating those emails again.\" : \"Try creating that email again.\"]] : [], s.appUrl, false),\n ];\n }\n\n function readyView() {\n const e = s.emails[sel];\n const full = canFullScreen() ? [button(\"icon-btn\", \"\", () => displayMode(\"fullscreen\"), { ariaLabel: \"Full screen\" })] : [];\n full[0]?.append(icon(\"expand\"));\n const title = e.failed ? \"Email \" + (sel + 1) + \" was not created\" : e.subject || \"Your email\";\n const parts = [head(title, e.failed ? \"\" : e.preheader, full)];\n if (series()) parts.push(tabs());\n parts.push(stage(e), foot(readyAsks(e, sel), e.appUrl || s.appUrl, true));\n return parts;\n }\n\n function fullScreenView() {\n const e = s.emails[sel];\n const back = button(\"icon-btn\", \"\", () => displayMode(\"inline\"), { ariaLabel: \"Back to the chat\" });\n back.append(icon(\"collapse\"));\n const box = el(\"section\", \"\", { className: \"fs\" });\n const body = el(\"div\", \"\", { className: \"fs-body\" });\n if (series()) {\n const rail = el(\"nav\", \"\", { className: \"rail\" });\n rail.setAttribute(\"aria-label\", \"Emails in this series\");\n s.emails.forEach((x, i) => {\n const item = button(\"rail-item\", \"\", () => select(i));\n if (i === sel) item.setAttribute(\"aria-current\", \"true\");\n const thumb = el(\"div\", \"\", { className: \"thumb\" });\n thumb.append(x.picture ? el(\"img\", \"\", { src: x.picture, alt: \"\" }) : icon(x.failed ? \"alert\" : \"image\", true));\n item.append(thumb, el(\"span\", (i + 1) + (x.failed ? \" \u00B7 Not created\" : x.day !== null ? \" \u00B7 Day \" + x.day : \"\")));\n rail.append(item);\n });\n body.append(rail);\n }\n const wrap = el(\"div\", \"\", { className: \"fs-wrap\" });\n wrap.append(stage(e));\n if (series()) {\n const prev = button(\"step-btn prev\", \"\", () => select(sel - 1), { ariaLabel: \"Previous email\", disabled: sel === 0 });\n const next = button(\"step-btn next\", \"\", () => select(sel + 1), { ariaLabel: \"Next email\", disabled: sel === s.emails.length - 1 });\n prev.append(icon(\"prev\")); next.append(icon(\"next\"));\n wrap.append(prev, next);\n }\n body.append(wrap);\n box.append(head(e.failed ? \"Email \" + (sel + 1) + \" was not created\" : e.subject || \"Your email\", e.failed ? \"\" : e.preheader, [back]));\n if (series()) box.append(tabs());\n box.append(body, foot(readyAsks(e, sel), e.appUrl || s.appUrl, true));\n if (s.note) box.append(el(\"p\", s.note, { className: \"note small\" }));\n return [box];\n }\n\n function render() {\n const main = $(\"card\");\n main.setAttribute(\"aria-busy\", String(s.phase === \"working\" && !s.compact));\n let parts;\n if (s.compact) parts = compactView();\n else if (fullScreen()) parts = fullScreenView();\n else parts = s.phase === \"working\" ? workingView() : s.phase === \"failed\" ? failedView() : readyView();\n if (s.note && !fullScreen()) parts.push(el(\"p\", s.note, { className: \"note small\" }));\n main.replaceChildren(...parts);\n // ChatGPT's own \"Open in\" button in full screen opens this card's page unless told otherwise.\n const link = s.emails?.[sel]?.appUrl || s.before?.appUrl || s.appUrl;\n if (link) window.openai?.setOpenInAppUrl?.({ href: link });\n tick();\n }\n\n new ResizeObserver(() => send({ method: \"ui/notifications/size-changed\", params: { height: Math.ceil(document.documentElement.getBoundingClientRect().height) } }))\n .observe(document.documentElement);\n\n const init = await request(\"ui/initialize\", {\n appInfo: { name: \"Migma email\", version: \"1.0.0\" },\n appCapabilities: { availableDisplayModes: [\"inline\", \"fullscreen\"] },\n protocolVersion: \"2026-01-26\",\n });\n caps = init?.hostCapabilities ?? {};\n applyHost(init?.hostContext);\n send({ method: \"ui/notifications/initialized\", params: {} });\n</script>\n</body>\n</html>\n";
14
14
  //# sourceMappingURL=email-card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"email-card.d.ts","sourceRoot":"","sources":["../../src/tools/email-card.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE;;;;;;GAMG;AAEH,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAEjD,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAEhF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,QAQjE;AAED,eAAO,MAAM,eAAe,wtsCAorB3B,CAAC"}
1
+ {"version":3,"file":"email-card.d.ts","sourceRoot":"","sources":["../../src/tools/email-card.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE;;;;;;GAMG;AAEH,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAEjD,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAEhF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,QAQjE;AAED,eAAO,MAAM,eAAe,+wsCAorB3B,CAAC"}
@@ -98,7 +98,6 @@ export const EMAIL_CARD_HTML = `<!doctype html>
98
98
  .asks { display: flex; gap: 6px; flex-wrap: wrap; }
99
99
  .chip { display: inline-flex; gap: 6px; align-items: center; min-height: 32px; padding: 0 12px; border: 0.5px solid var(--line-2); border-radius: 999px; background: transparent; color: var(--text); font-size: 13px; font-weight: var(--font-weight-medium, 500); }
100
100
  .chip:hover { background: var(--muted); }
101
- .chip small { color: var(--text-3); font-size: 12px; font-weight: 400; }
102
101
  .primary, .ghost { display: inline-flex; gap: 6px; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; border-radius: var(--radius-md); white-space: nowrap; font-weight: var(--font-weight-semibold, 600); }
103
102
  .primary { border: 0; background: var(--inverse); color: var(--on-inverse); margin-left: auto; }
104
103
  .ghost { border: 0.5px solid var(--line-2); background: transparent; color: var(--text); font-weight: var(--font-weight-medium, 500); margin-left: auto; }
@@ -290,13 +289,15 @@ export const EMAIL_CARD_HTML = `<!doctype html>
290
289
  render();
291
290
  if (missingPicture()) retryPicture();
292
291
  } else if (data.conversationId) {
293
- // A status check is a snapshot: one line, or a Ready row that opens in place. The card the
294
- // generate call drew stays live, so these never poll unless opened.
295
- s = { mode: "create", phase: "working", compact: !!data.createdAt && !input.prompt, checkedAt: Date.now(), conversationId: data.conversationId, appUrl: https(data.appUrl), count: data.count || input.count };
292
+ // A status check draws one line that turns into a Ready row, which opens in place. It keeps
293
+ // itself current: ChatGPT shows only the last card of a reply, so the generate call's card may
294
+ // never be seen.
295
+ s = { mode: "create", phase: "working", compact: !!data.createdAt && !input.prompt, conversationId: data.conversationId, appUrl: https(data.appUrl), count: data.count || input.count };
296
296
  applyStatus(data);
297
- delay = 3000;
297
+ // Slower than the full card: several status lines can poll at once, and hosted MCP allows 100 calls a minute.
298
+ delay = s.compact ? 6000 : 3000;
298
299
  render();
299
- if (!s.compact) poll();
300
+ poll();
300
301
  }
301
302
  }
302
303
 
@@ -353,7 +354,7 @@ export const EMAIL_CARD_HTML = `<!doctype html>
353
354
 
354
355
  async function poll() {
355
356
  clearTimeout(timer);
356
- if (!s || s.compact || s.phase !== "working" || busy || document.visibilityState !== "visible") return;
357
+ if (!s || s.phase !== "working" || busy || document.visibilityState !== "visible") return;
357
358
  busy = true;
358
359
  if (s.mode === "create") {
359
360
  const d = await read("migma_get_generation_status", { conversationId: s.conversationId });
@@ -402,12 +403,12 @@ export const EMAIL_CARD_HTML = `<!doctype html>
402
403
  function elapsed() {
403
404
  const start = Date.parse(s.createdAt);
404
405
  if (!start) return "";
405
- const secs = Math.max(0, Math.round(((s.compact ? s.checkedAt : Date.now()) - start) / 1000));
406
+ const secs = Math.max(0, Math.round((Date.now() - start) / 1000));
406
407
  return Math.floor(secs / 60) + ":" + String(secs % 60).padStart(2, "0");
407
408
  }
408
409
  function tick() {
409
410
  clearInterval(ticker);
410
- if (s.phase !== "working" || s.compact || !s.createdAt) return;
411
+ if (s.phase !== "working" || !s.createdAt) return;
411
412
  ticker = setInterval(() => document.querySelectorAll(".time").forEach((t) => { t.textContent = elapsed(); }), 1000);
412
413
  }
413
414
 
@@ -423,7 +424,7 @@ export const EMAIL_CARD_HTML = `<!doctype html>
423
424
  const r = await request("ui/message", { role: "user", content: [{ type: "text", text }] });
424
425
  if (r?.isError) throw new Error();
425
426
  } catch {
426
- s.note = "Could not send that to Claude. Type it in the chat instead.";
427
+ s.note = "Could not send that to the chat. Type it there instead.";
427
428
  render();
428
429
  }
429
430
  }
@@ -448,14 +449,10 @@ export const EMAIL_CARD_HTML = `<!doctype html>
448
449
  const series = () => s.emails.length > 1;
449
450
  const quoted = (e) => (e.subject ? "“" + e.subject + "”" : "this email");
450
451
  const named = (e, i) => (series() ? "email " + (i + 1) + " of the series, " + quoted(e) + "," : quoted(e));
451
- function chip(label, cost, text) {
452
- const b = button("chip", label, () => ask(text));
453
- if (cost) b.append(el("small", cost));
454
- return b;
455
- }
452
+ const chip = (label, text) => button("chip", label, () => ask(text));
456
453
  function asks(list) {
457
454
  const box = el("div", "", { className: "asks" });
458
- if (caps.message) box.append(...list.map(([label, cost, text]) => chip(label, cost, text)));
455
+ if (caps.message) box.append(...list.map(([label, text]) => chip(label, text)));
459
456
  return box;
460
457
  }
461
458
  function linkButton(url, primary) {
@@ -558,10 +555,10 @@ export const EMAIL_CARD_HTML = `<!doctype html>
558
555
  return list;
559
556
  }
560
557
  function readyAsks(e, i) {
561
- if (e.failed) return [["Try this email again", "1 credit", "Try creating email " + (i + 1) + " of the series again."]];
558
+ if (e.failed) return [["Try this email again", "Try creating email " + (i + 1) + " of the series again."]];
562
559
  return [
563
- ["Make it shorter", "0.5 credit", "Make " + named(e, i) + " shorter."],
564
- ["Try another version", "1 credit", "Make another version of " + named(e, i).replace(/,$/, "") + "."],
560
+ ["Make it shorter", "Make " + named(e, i) + " shorter."],
561
+ ["Try another version", "Make another version of " + named(e, i).replace(/,$/, "") + "."],
565
562
  ];
566
563
  }
567
564
 
@@ -628,7 +625,7 @@ export const EMAIL_CARD_HTML = `<!doctype html>
628
625
  const parts = [statusLine("Not changed", "bad"), head(e?.subject || "Your email", input.prompt), el("p", s.error, { className: "note bad" })];
629
626
  if (s.mayHaveSaved) parts.push(el("p", "Some changes may have been saved. Check the email in Migma before you try again.", { className: "note warn" }));
630
627
  if (e?.picture) parts.push(stage(e));
631
- parts.push(foot(input.prompt && !s.refused ? [["Try again", "0.5 credit", "Try that change to " + (e ? quoted(e) : "the email") + " again."]] : [], e?.appUrl || s.appUrl, true));
628
+ parts.push(foot(input.prompt && !s.refused ? [["Try again", "Try that change to " + (e ? quoted(e) : "the email") + " again."]] : [], e?.appUrl || s.appUrl, true));
632
629
  return parts;
633
630
  }
634
631
  if (s.mode === "email") return [statusLine("Could not show this email", "bad"), el("p", s.error, { className: "note bad" })];
@@ -637,7 +634,7 @@ export const EMAIL_CARD_HTML = `<!doctype html>
637
634
  statusLine("Not created", "bad"),
638
635
  head(many ? "Your emails" : "Your email", input.prompt),
639
636
  el("p", s.error, { className: "note bad" }),
640
- foot(input.prompt && !s.refused ? [["Try again", many ? s.count + " credits" : "1 credit", many ? "Try creating those emails again." : "Try creating that email again."]] : [], s.appUrl, false),
637
+ foot(input.prompt && !s.refused ? [["Try again", many ? "Try creating those emails again." : "Try creating that email again."]] : [], s.appUrl, false),
641
638
  ];
642
639
  }
643
640
 
@@ -696,6 +693,9 @@ export const EMAIL_CARD_HTML = `<!doctype html>
696
693
  else parts = s.phase === "working" ? workingView() : s.phase === "failed" ? failedView() : readyView();
697
694
  if (s.note && !fullScreen()) parts.push(el("p", s.note, { className: "note small" }));
698
695
  main.replaceChildren(...parts);
696
+ // ChatGPT's own "Open in" button in full screen opens this card's page unless told otherwise.
697
+ const link = s.emails?.[sel]?.appUrl || s.before?.appUrl || s.appUrl;
698
+ if (link) window.openai?.setOpenInAppUrl?.({ href: link });
699
699
  tick();
700
700
  }
701
701
 
@@ -6,6 +6,7 @@ export declare const IMAGE_ORIGINS: string[];
6
6
  export declare function clientDrawsCards(server: McpServer): boolean;
7
7
  /** Tool `_meta` that links a tool to a card, when the server shows cards. */
8
8
  export declare function mcpAppMeta(uri: string, card: boolean): Record<string, unknown> | undefined;
9
+ export declare const CHATGPT_WIDGET_DOMAIN = "https://migma.ai";
9
10
  export declare function registerMcpApp(server: McpServer, app: {
10
11
  name: string;
11
12
  uri: string;
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-apps.d.ts","sourceRoot":"","sources":["../../src/tools/mcp-apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,0HAA0H;AAE1H,eAAO,MAAM,iBAAiB,8BAA8B,CAAC;AAG7D,eAAO,MAAM,aAAa,UAAkF,CAAC;AAE7G,gHAAgH;AAChH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAI3D;AAED,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAG1F;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,QAStE"}
1
+ {"version":3,"file":"mcp-apps.d.ts","sourceRoot":"","sources":["../../src/tools/mcp-apps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,0HAA0H;AAE1H,eAAO,MAAM,iBAAiB,8BAA8B,CAAC;AAI7D,eAAO,MAAM,aAAa,UAA2B,CAAC;AAEtD,gHAAgH;AAChH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAI3D;AAED,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAG1F;AAID,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAExD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,QAYtE"}
@@ -1,7 +1,8 @@
1
1
  /** What every Migma MCP Apps card shares: the MIME type, the picture hosts its CSP allows, and how a tool links to it. */
2
2
  export const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
3
- // Image hosts isAllowedScreenshotUrl (email-images.ts) accepts, as CSP origins.
4
- export const IMAGE_ORIGINS = ["https://cdn.migma.ai", "https://*.cloudfront.net", "https://*.amazonaws.com"];
3
+ // The one host email and send pictures come from. Exact, no wildcards: OpenAI's review holds a card
4
+ // whose CSP is "too broad", and a card shows no picture rather than load one from elsewhere.
5
+ export const IMAGE_ORIGINS = ["https://cdn.migma.ai"];
5
6
  /** True when the connected client said it draws MCP Apps cards (the `io.modelcontextprotocol/ui` extension). */
6
7
  export function clientDrawsCards(server) {
7
8
  const capabilities = server.server.getClientCapabilities();
@@ -14,8 +15,14 @@ export function mcpAppMeta(uri, card) {
14
15
  return undefined;
15
16
  return { ui: { resourceUri: uri }, "ui/resourceUri": uri };
16
17
  }
18
+ // ChatGPT requires a dedicated origin for a published app's views. Set under ChatGPT's own key,
19
+ // not the shared `ui.domain`, whose format each host defines for itself.
20
+ export const CHATGPT_WIDGET_DOMAIN = "https://migma.ai";
17
21
  export function registerMcpApp(server, app) {
18
- const ui = { csp: { resourceDomains: IMAGE_ORIGINS }, prefersBorder: true };
19
- server.registerResource(app.name, app.uri, { title: app.name, description: app.description, mimeType: MCP_APP_MIME_TYPE, _meta: { ui } }, async () => ({ contents: [{ uri: app.uri, mimeType: MCP_APP_MIME_TYPE, text: app.html, _meta: { ui } }] }));
22
+ const _meta = {
23
+ ui: { csp: { connectDomains: [], resourceDomains: IMAGE_ORIGINS }, prefersBorder: true },
24
+ "openai/widgetDomain": CHATGPT_WIDGET_DOMAIN,
25
+ };
26
+ server.registerResource(app.name, app.uri, { title: app.name, description: app.description, mimeType: MCP_APP_MIME_TYPE, _meta }, async () => ({ contents: [{ uri: app.uri, mimeType: MCP_APP_MIME_TYPE, text: app.html, _meta }] }));
20
27
  }
21
28
  //# sourceMappingURL=mcp-apps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-apps.js","sourceRoot":"","sources":["../../src/tools/mcp-apps.ts"],"names":[],"mappings":"AAEA,0HAA0H;AAE1H,MAAM,CAAC,MAAM,iBAAiB,GAAG,2BAA2B,CAAC;AAE7D,gFAAgF;AAChF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,sBAAsB,EAAE,0BAA0B,EAAE,yBAAyB,CAAC,CAAC;AAE7G,gHAAgH;AAChH,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAA0E,CAAC;IACnI,MAAM,SAAS,GAAG,YAAY,EAAE,UAAU,EAAE,CAAC,4BAA4B,CAA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EAAE,CAAC,EAAE,CAAC,CACnG,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@migma/mcp",
3
- "version": "1.11.10",
3
+ "version": "1.11.12",
4
4
  "description": "Migma MCP server — generate, send, validate, and export AI-powered emails from any MCP-compatible client",
5
5
  "type": "module",
6
6
  "bin": {