@tangle-network/agent-app 0.60.32 → 0.60.34

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.
Files changed (53) hide show
  1. package/dist/app-auth/index.js +1 -1
  2. package/dist/assistant/index.js +7 -7
  3. package/dist/chat-react/index.js +3 -3
  4. package/dist/chat-routes/index.js +15 -12
  5. package/dist/chat-routes/index.js.map +1 -1
  6. package/dist/chat-routes/turn-routes.d.ts +2 -0
  7. package/dist/chat-routes/wire.d.ts +2 -0
  8. package/dist/chat-store/index.js +4 -4
  9. package/dist/chat-store/parts.d.ts +2 -0
  10. package/dist/{chunk-HWJOTTEI.js → chunk-4EVEBEJX.js} +9 -4
  11. package/dist/chunk-4EVEBEJX.js.map +1 -0
  12. package/dist/{chunk-FCON65I2.js → chunk-6VQCFJWP.js} +3 -3
  13. package/dist/{chunk-FCON65I2.js.map → chunk-6VQCFJWP.js.map} +1 -1
  14. package/dist/{chunk-WTGSLW5X.js → chunk-FPCIJCS3.js} +3 -3
  15. package/dist/chunk-FPCIJCS3.js.map +1 -0
  16. package/dist/{chunk-H6MKILMQ.js → chunk-FZJRATBY.js} +4 -4
  17. package/dist/{chunk-NJA6X7JI.js → chunk-GBGSC42G.js} +2 -2
  18. package/dist/{chunk-GYDFGEJ2.js → chunk-HOZMP3AR.js} +1 -1
  19. package/dist/chunk-HOZMP3AR.js.map +1 -0
  20. package/dist/{chunk-BF7M3NW2.js → chunk-MCAIZKQ5.js} +1 -1
  21. package/dist/chunk-MCAIZKQ5.js.map +1 -0
  22. package/dist/{chunk-DECJLOS4.js → chunk-TCPRFFZK.js} +2 -2
  23. package/dist/{chunk-6VRVRWYN.js → chunk-UKZMJND6.js} +2 -2
  24. package/dist/{chunk-OYN2UY3K.js → chunk-WOTWQ2ST.js} +31 -1
  25. package/dist/{chunk-OYN2UY3K.js.map → chunk-WOTWQ2ST.js.map} +1 -1
  26. package/dist/{chunk-N56FWDSP.js → chunk-ZGUXI5SI.js} +2 -2
  27. package/dist/email/index.d.ts +1 -1
  28. package/dist/email/index.js +3 -1
  29. package/dist/email/templates.d.ts +20 -0
  30. package/dist/hub-approvals/index.js +1 -1
  31. package/dist/hub-approvals/types.d.ts +14 -0
  32. package/dist/hub-approvals-react/index.d.ts +1 -1
  33. package/dist/hub-approvals-react/index.js +24 -8
  34. package/dist/hub-approvals-react/index.js.map +1 -1
  35. package/dist/hub-approvals-react/parts.d.ts +8 -1
  36. package/dist/interactions/contract.d.ts +3 -1
  37. package/dist/interactions/index.js +2 -2
  38. package/dist/operator/chat-adapter.d.ts +6 -1
  39. package/dist/operator/index.js +4 -2
  40. package/dist/operator/index.js.map +1 -1
  41. package/dist/public-consultation/index.js +6 -6
  42. package/dist/stream/index.js +2 -2
  43. package/dist/web-react/index.js +7 -7
  44. package/package.json +1 -1
  45. package/dist/chunk-BF7M3NW2.js.map +0 -1
  46. package/dist/chunk-GYDFGEJ2.js.map +0 -1
  47. package/dist/chunk-HWJOTTEI.js.map +0 -1
  48. package/dist/chunk-WTGSLW5X.js.map +0 -1
  49. /package/dist/{chunk-H6MKILMQ.js.map → chunk-FZJRATBY.js.map} +0 -0
  50. /package/dist/{chunk-NJA6X7JI.js.map → chunk-GBGSC42G.js.map} +0 -0
  51. /package/dist/{chunk-DECJLOS4.js.map → chunk-TCPRFFZK.js.map} +0 -0
  52. /package/dist/{chunk-6VRVRWYN.js.map → chunk-UKZMJND6.js.map} +0 -0
  53. /package/dist/{chunk-N56FWDSP.js.map → chunk-ZGUXI5SI.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/email/mark.generated.ts","../src/email/palette.ts","../src/email/layout.ts","../src/email/templates.ts","../src/email/lint.ts"],"sourcesContent":["// GENERATED by scripts/email-mark.mjs from @tangle-network/brand TangleKnot; do not edit.\n/** The Tangle knot as a 84px transparent PNG (base64), shown at 28px in email headers. */\nexport const TANGLE_MARK_PNG_BASE64 =\n 'iVBORw0KGgoAAAANSUhEUgAAA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5QipCTKrRDejPiJkZ4Zv9HoFeXC4SAvvKRWfhBqoZoYq2tBKl/rKOGvc77MkzsogFvKRmS8j06tzFsEmwvJmxgjlRpCh2e+NJqdN2FX4mifov8qFyupt3VPGdIR8zAxNU1e7O5879vv88yLu5UzuVSGNIEVSX/2FoQWkngNDQ07LPMi7r2YCqG/hpWQ0pMph/HVGl03fE2DhbzygF8vkPLx9HKecx83QSTJpAp8C+d2kSYbWmSYZWmeaZGidaZKhdaZJhtaZJhlaZ/o/AAAA//8mfCa5AAAABklEQVQDAPyiOFzVbOpbAAAAAElFTkSuQmCC'\n","/**\n * The Brand roles the email layout paints with, as literal hex. Email clients\n * cannot read CSS variables, and importing `@tangle-network/brand` at runtime\n * would load React into a server-only renderer, so the values live here and\n * `tests/email/palette.test.ts` fails when they drift from Brand's `palettes`.\n */\nexport const EMAIL_PALETTE = {\n light: {\n canvas: '#eceef3',\n card: '#ffffff',\n well: '#f6f7fa',\n hairline: '#c7c6d6',\n ink: '#2d2d2d',\n inkSecondary: '#3f3f3f',\n inkMuted: '#4c4c4c',\n accent: '#4c3fc5',\n onAccent: '#ffffff',\n accentText: '#3c32e9',\n },\n dark: {\n canvas: '#0a0a14',\n card: '#191826',\n well: '#12111f',\n hairline: '#2a293d',\n ink: '#e6e6e6',\n inkSecondary: '#c7c7c7',\n inkMuted: '#b5b5b5',\n accent: '#4c3fc5',\n onAccent: '#ffffff',\n accentText: '#a5b4fc',\n },\n} as const\n\n/**\n * Brand's `--font-sans` stack with the system faces email clients actually\n * have. No client used for this mail loads web fonts reliably, so Inter shows\n * only where it is installed and the platform UI face carries the rest.\n */\nexport const EMAIL_FONT_STACK =\n \"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif\"\n","import { TANGLE_MARK_PNG_BASE64 } from './mark.generated'\nimport { EMAIL_FONT_STACK, EMAIL_PALETTE } from './palette'\n\n/** The app an email comes from. */\nexport interface EmailProduct {\n /**\n * The product name, e.g. `GTM Agent`. The header reads `Tangle GTM Agent`;\n * subjects and the sender use the name alone. A name that already starts\n * with `Tangle` (`Tangle Sandbox`) is not doubled.\n */\n name: string\n /** The app's absolute origin; app-relative links resolve against it. */\n url: string\n}\n\n/** Why the recipient got the email and where they control it. */\nexport interface EmailFooter {\n /** The workspace the email concerns. */\n workspaceName?: string\n /** One sentence, e.g. `You own this workspace.` */\n reason: string\n /** Where the recipient changes which emails they get; absolute or app-relative. */\n manageUrl?: string\n /**\n * Turns this kind of email off in one request, without signing in; absolute\n * or app-relative. Adds an Unsubscribe link and the RFC 8058\n * `List-Unsubscribe` headers, so the endpoint must accept a POST.\n */\n unsubscribeUrl?: string\n /**\n * The sender's postal address, for marketing mail such as a digest. Leave it\n * unset on transactional mail (approvals, invites, sign-in), which does not\n * need one.\n */\n postalAddress?: string\n}\n\n/** A button. `url` is absolute or app-relative. */\nexport interface EmailAction {\n label: string\n url: string\n}\n\n/** One row in a list box: an approval request or a digest entry. */\nexport interface EmailItem {\n title: string\n detail?: string\n /** Makes the title a link; absolute or app-relative. */\n url?: string\n /** Links under the row, such as one item's own Approve and Deny. */\n links?: readonly EmailAction[]\n}\n\n/** An inline image the HTML references by `cid:`; the mail client must send it with the message. */\nexport interface EmailAttachment {\n filename: string\n /** Base64 file content, the form Resend and SES accept. */\n content: string\n contentType: string\n contentId: string\n}\n\n/** A rendered email, ready for any transport. */\nexport interface EmailMessage {\n subject: string\n /** The inbox preview line. */\n preheader: string\n html: string\n text: string\n /** Pass these through to the mail client; the header mark is one of them. */\n attachments: EmailAttachment[]\n /** Extra message headers, such as `List-Unsubscribe`; pass them through too. */\n headers: Record<string, string>\n}\n\n/** A titled list box; a template with one list leaves `heading` unset. */\nexport interface EmailSection {\n heading?: string\n items: readonly EmailItem[]\n}\n\n/** What a template places in the shared layout. */\ninterface EmailContent {\n subject: string\n preheader: string\n title: string\n paragraphs: readonly string[]\n sections?: readonly EmailSection[]\n primary?: EmailAction\n secondary?: EmailAction\n /** Print the primary link under the buttons for clients that strip them. */\n showPrimaryLink?: boolean\n /** A short line under the buttons, e.g. an expiry. */\n note?: string\n footer: EmailFooter\n}\n\nconst MARK_CONTENT_ID = 'tangle-mark'\nconst MARK_ATTACHMENT: EmailAttachment = {\n filename: 'tangle.png',\n content: TANGLE_MARK_PNG_BASE64,\n contentType: 'image/png',\n contentId: MARK_CONTENT_ID,\n}\n\nconst L = EMAIL_PALETTE.light\nconst D = EMAIL_PALETTE.dark\nconst FONT = EMAIL_FONT_STACK\n\n// Inline styles carry the light design; this block only adapts it for clients\n// that honor dark mode or narrow screens. A client that drops <style> still\n// renders the complete light email.\nconst STYLE = `\n@media (prefers-color-scheme: dark) {\n .t-bg { background-color: ${D.canvas} !important; }\n .t-card { background-color: ${D.card} !important; border-color: ${D.hairline} !important; }\n .t-well { background-color: ${D.well} !important; }\n .t-rule { border-color: ${D.hairline} !important; }\n .t-ink { color: ${D.ink} !important; }\n .t-ink2 { color: ${D.inkSecondary} !important; }\n .t-muted { color: ${D.inkMuted} !important; }\n .t-link { color: ${D.accentText} !important; }\n .t-btn2 { border-color: ${D.hairline} !important; }\n}\n@media (max-width: 600px) {\n .t-outer { padding: 20px 8px !important; }\n .t-card { padding: 28px 22px 24px !important; }\n}\n[data-ogsb] .t-bg { background-color: ${D.canvas} !important; }\n[data-ogsb] .t-card { background-color: ${D.card} !important; }\n[data-ogsb] .t-well { background-color: ${D.well} !important; }\n[data-ogsc] .t-ink { color: ${D.ink} !important; }\n[data-ogsc] .t-ink2 { color: ${D.inkSecondary} !important; }\n[data-ogsc] .t-muted { color: ${D.inkMuted} !important; }\n[data-ogsc] .t-link { color: ${D.accentText} !important; }\n`.trim()\n\n/** Escape text for HTML element content and quoted attribute values. */\nfunction escapeHtml(value: string): string {\n return value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;')\n}\n\n/** An absolute http(s) URL; app-relative paths resolve against the product origin. */\nfunction resolveEmailUrl(url: string, product: EmailProduct): string {\n const resolved = new URL(url, product.url)\n if (resolved.protocol !== 'https:' && resolved.protocol !== 'http:') {\n throw new TypeError(`Email links must be http(s): ${resolved.protocol}`)\n }\n return resolved.toString()\n}\n\n/** `Title — Product`, the one subject shape every Tangle email uses. */\nexport function emailSubject(subject: string, product: EmailProduct): string {\n return `${subject} — ${product.name}`\n}\n\nfunction paragraph(text: string, margin: string): string {\n return `<p class=\"t-ink2\" style=\"margin:${margin};font-family:${FONT};font-size:15px;line-height:24px;color:${L.inkSecondary}\">${escapeHtml(text)}</p>`\n}\n\nfunction link(label: string, href: string, style: string): string {\n return `<a class=\"t-link\" href=\"${escapeHtml(href)}\" style=\"color:${L.accentText};text-decoration:none;${style}\">${escapeHtml(label)}</a>`\n}\n\n/** The product name after the `Tangle` logotype: `GTM Agent`, or `Sandbox` for `Tangle Sandbox`. */\nfunction productSuffix(product: EmailProduct): string {\n return product.name.replace(/^Tangle\\s+/i, '')\n}\n\n// Brand's lockup: the knot, `Tangle` in the logotype's bold, then the product\n// name at a lighter weight, as the product site headers set it.\nfunction header(product: EmailProduct): string {\n const type = `font-family:${FONT};font-size:17px;line-height:20px;letter-spacing:-0.01em;color:${L.ink}`\n return [\n '<table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">',\n '<tr>',\n `<td style=\"padding:0 10px 0 0;vertical-align:middle\"><img src=\"cid:${MARK_CONTENT_ID}\" width=\"28\" height=\"28\" alt=\"\" style=\"display:block;width:28px;height:28px;border:0;outline:none;text-decoration:none\"></td>`,\n `<td class=\"t-ink\" style=\"vertical-align:middle;white-space:nowrap;${type}\">`,\n `<span class=\"t-ink\" style=\"${type};font-weight:700\">Tangle</span>`,\n `<span class=\"t-ink\" style=\"${type};font-weight:500\">&nbsp;${escapeHtml(productSuffix(product))}</span>`,\n '</td>',\n '</tr>',\n '</table>',\n ].join('')\n}\n\nfunction section(entry: EmailSection, product: EmailProduct): string {\n if (entry.items.length === 0) return ''\n const heading = entry.heading\n ? `<p class=\"t-ink\" style=\"margin:20px 0 6px;font-family:${FONT};font-size:13px;line-height:18px;font-weight:600;color:${L.ink}\">${escapeHtml(entry.heading)}</p>`\n : ''\n return heading + items(entry.items, product)\n}\n\nfunction items(list: readonly EmailItem[], product: EmailProduct): string {\n const rows = list.map((item, index) => {\n const rule = index === 0 ? '' : `border-top:1px solid ${L.hairline};`\n const title = item.url\n ? link(item.title, resolveEmailUrl(item.url, product), 'font-weight:600')\n : escapeHtml(item.title)\n const detail = item.detail\n ? `<p class=\"t-muted\" style=\"margin:2px 0 0;font-family:${FONT};font-size:13px;line-height:20px;color:${L.inkMuted}\">${escapeHtml(item.detail)}</p>`\n : ''\n const links = item.links && item.links.length > 0\n ? `<p class=\"t-muted\" style=\"margin:6px 0 0;font-family:${FONT};font-size:14px;line-height:20px;color:${L.inkMuted}\">${item.links\n .map((entry) => link(entry.label, resolveEmailUrl(entry.url, product), 'font-weight:600'))\n .join('&nbsp;&nbsp;·&nbsp;&nbsp;')}</p>`\n : ''\n return [\n `<tr><td class=\"t-rule\" style=\"padding:14px 16px;${rule}\">`,\n `<p class=\"t-ink\" style=\"margin:0;font-family:${FONT};font-size:15px;line-height:22px;font-weight:600;color:${L.ink}\">${title}</p>`,\n detail,\n links,\n '</td></tr>',\n ].join('')\n })\n return [\n `<table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t-well\" bgcolor=\"${L.well}\" style=\"background-color:${L.well};border-radius:8px;margin:4px 0 8px\">`,\n ...rows,\n '</table>',\n ].join('')\n}\n\nfunction primaryButton(action: EmailAction, href: string): string {\n return [\n `<td bgcolor=\"${L.accent}\" style=\"border-radius:8px;background-color:${L.accent};mso-padding-alt:12px 22px\">`,\n `<a href=\"${escapeHtml(href)}\" style=\"display:inline-block;padding:12px 22px;font-family:${FONT};font-size:15px;line-height:20px;font-weight:600;color:${L.onAccent};text-decoration:none;border-radius:8px\">${escapeHtml(action.label)}</a>`,\n '</td>',\n ].join('')\n}\n\nfunction secondaryButton(action: EmailAction, href: string): string {\n return [\n `<td class=\"t-btn2\" style=\"border:1px solid ${L.hairline};border-radius:8px;mso-padding-alt:11px 21px\">`,\n `<a class=\"t-ink\" href=\"${escapeHtml(href)}\" style=\"display:inline-block;padding:11px 21px;font-family:${FONT};font-size:15px;line-height:20px;font-weight:600;color:${L.ink};text-decoration:none;border-radius:8px\">${escapeHtml(action.label)}</a>`,\n '</td>',\n ].join('')\n}\n\nfunction buttons(content: EmailContent, product: EmailProduct): string {\n const cells: string[] = []\n if (content.primary) cells.push(primaryButton(content.primary, resolveEmailUrl(content.primary.url, product)))\n if (content.secondary) {\n if (cells.length > 0) cells.push('<td style=\"width:10px;font-size:0;line-height:0\">&nbsp;</td>')\n cells.push(secondaryButton(content.secondary, resolveEmailUrl(content.secondary.url, product)))\n }\n if (cells.length === 0) return ''\n return `<table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin:20px 0 0\"><tr>${cells.join('')}</tr></table>`\n}\n\nfunction small(html: string, margin: string, size = 13): string {\n return `<p class=\"t-muted\" style=\"margin:${margin};font-family:${FONT};font-size:${size}px;line-height:${size + 7}px;color:${L.inkMuted}\">${html}</p>`\n}\n\nfunction footerLines(footer: EmailFooter, product: EmailProduct): { html: string[]; text: string[] } {\n const where = footer.workspaceName ? `${footer.workspaceName} · ${product.name}` : product.name\n const manage = footer.manageUrl ? resolveEmailUrl(footer.manageUrl, product) : null\n const unsubscribe = footer.unsubscribeUrl ? resolveEmailUrl(footer.unsubscribeUrl, product) : null\n const links = [\n ...(manage ? [link('Manage notifications', manage, 'text-decoration:underline')] : []),\n ...(unsubscribe ? [link('Unsubscribe', unsubscribe, 'text-decoration:underline')] : []),\n ]\n const html = [\n escapeHtml(where),\n escapeHtml(footer.reason),\n ...(links.length > 0 ? [links.join(' &middot; ')] : []),\n ...(footer.postalAddress ? [escapeHtml(footer.postalAddress)] : []),\n ]\n const text = [\n where,\n footer.reason,\n ...(manage ? [`Manage notifications: ${manage}`] : []),\n ...(unsubscribe ? [`Unsubscribe: ${unsubscribe}`] : []),\n ...(footer.postalAddress ? [footer.postalAddress] : []),\n ]\n return { html, text }\n}\n\n// Keeps the body text that follows out of the inbox preview line.\nconst PREHEADER_SPACER = '&#847;&zwnj;&nbsp;'.repeat(40)\n\nfunction renderHtml(content: EmailContent, product: EmailProduct): string {\n const primaryHref = content.primary ? resolveEmailUrl(content.primary.url, product) : null\n const footer = footerLines(content.footer, product)\n const body = [\n `<h1 class=\"t-ink\" style=\"margin:0 0 12px;font-family:${FONT};font-size:22px;line-height:28px;font-weight:600;letter-spacing:-0.01em;color:${L.ink}\">${escapeHtml(content.title)}</h1>`,\n ...content.paragraphs.map((text) => paragraph(text, '0 0 12px')),\n ...(content.sections ?? []).map((entry) => section(entry, product)),\n buttons(content, product),\n content.showPrimaryLink && primaryHref\n ? small(`Or open this link: ${link(primaryHref, primaryHref, 'word-break:break-all')}`, '20px 0 0')\n : '',\n content.note ? small(escapeHtml(content.note), content.showPrimaryLink ? '8px 0 0' : '20px 0 0') : '',\n ].join('')\n\n return [\n '<!DOCTYPE html>',\n '<html lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\">',\n '<head>',\n '<meta charset=\"utf-8\">',\n '<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">',\n '<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">',\n '<meta name=\"x-apple-disable-message-reformatting\">',\n '<meta name=\"format-detection\" content=\"telephone=no, date=no, address=no, email=no, url=no\">',\n '<meta name=\"color-scheme\" content=\"light dark\">',\n '<meta name=\"supported-color-schemes\" content=\"light dark\">',\n `<title>${escapeHtml(content.subject)}</title>`,\n '<!--[if mso]><noscript><xml><o:OfficeDocumentSettings><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml></noscript><![endif]-->',\n `<style>\\n${STYLE}\\n</style>`,\n '</head>',\n `<body class=\"t-bg\" style=\"margin:0;padding:0;width:100%;background-color:${L.canvas};-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%\">`,\n `<div style=\"display:none;font-size:1px;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all\">${escapeHtml(content.preheader)}${PREHEADER_SPACER}</div>`,\n `<table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t-bg\" bgcolor=\"${L.canvas}\" style=\"background-color:${L.canvas}\">`,\n '<tr><td class=\"t-outer\" align=\"center\" style=\"padding:32px 12px\">',\n '<!--[if mso]><table role=\"presentation\" width=\"560\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"><tr><td><![endif]-->',\n '<table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"max-width:560px;margin:0 auto\">',\n `<tr><td style=\"padding:0 4px 20px\">${header(product)}</td></tr>`,\n `<tr><td class=\"t-card\" bgcolor=\"${L.card}\" style=\"background-color:${L.card};border:1px solid ${L.hairline};border-radius:12px;padding:36px 36px 32px\">${body}</td></tr>`,\n `<tr><td style=\"padding:24px 4px 0\">${footer.html.map((line, index) => small(line, index === 0 ? '0' : '4px 0 0', 12)).join('')}</td></tr>`,\n '</table>',\n '<!--[if mso]></td></tr></table><![endif]-->',\n '</td></tr>',\n '</table>',\n '</body>',\n '</html>',\n ].join('\\n')\n}\n\nfunction renderText(content: EmailContent, product: EmailProduct): string {\n const blocks: string[] = [`Tangle ${productSuffix(product)}`, content.title, ...content.paragraphs]\n for (const entry of content.sections ?? []) {\n if (entry.items.length === 0) continue\n const list = entry.items.map((item) => {\n const lines = [`- ${item.title}`]\n if (item.detail) lines.push(` ${item.detail}`)\n if (item.url) lines.push(` ${resolveEmailUrl(item.url, product)}`)\n for (const entry of item.links ?? []) lines.push(` ${entry.label}: ${resolveEmailUrl(entry.url, product)}`)\n return lines.join('\\n')\n }).join('\\n')\n blocks.push(entry.heading ? `${entry.heading}\\n${list}` : list)\n }\n const actions = [content.primary, content.secondary]\n .filter((action): action is EmailAction => Boolean(action))\n .map((action) => `${action.label}: ${resolveEmailUrl(action.url, product)}`)\n if (actions.length > 0) blocks.push(actions.join('\\n'))\n if (content.note) blocks.push(content.note)\n blocks.push(['--', ...footerLines(content.footer, product).text].join('\\n'))\n return `${blocks.join('\\n\\n')}\\n`\n}\n\n/** Place a template's content in the shared Tangle layout. */\nexport function renderEmail(product: EmailProduct, content: EmailContent): EmailMessage {\n return {\n subject: content.subject,\n preheader: content.preheader,\n html: renderHtml(content, product),\n text: renderText(content, product),\n attachments: [MARK_ATTACHMENT],\n headers: content.footer.unsubscribeUrl\n ? {\n 'List-Unsubscribe': `<${resolveEmailUrl(content.footer.unsubscribeUrl, product)}>`,\n 'List-Unsubscribe-Post': 'List-Unsubscribe=One-Click',\n }\n : {},\n }\n}\n\n/**\n * The HTML with inline images embedded as data URIs, for browser previews and\n * screenshots. Mail clients get `cid:` references and the attachments instead.\n */\nexport function emailPreviewHtml(message: Pick<EmailMessage, 'html' | 'attachments'>): string {\n return message.attachments.reduce(\n (html, attachment) => html.split(`cid:${attachment.contentId}`).join(`data:${attachment.contentType};base64,${attachment.content}`),\n message.html,\n )\n}\n\n/**\n * The From header for an app's mail: `GTM Agent · Tangle <noreply@tangle.tools>`.\n * The product leads because inbox sender columns truncate; `· Tangle` ties\n * every app to the company and the sending domain.\n */\nexport function emailSender(productName: string, address: string): string {\n if (!/^[^\\s<>@]+@[^\\s<>@]+\\.[^\\s<>@]+$/.test(address)) throw new TypeError(`Not an email address: ${address}`)\n const name = /\\bTangle\\b/i.test(productName) ? productName : `${productName} · Tangle`\n return `${name} <${address}>`\n}\n","import {\n emailSubject,\n renderEmail,\n type EmailAction,\n type EmailFooter,\n type EmailItem,\n type EmailMessage,\n type EmailProduct,\n type EmailSection,\n} from './layout'\n\n/** Sentence case to mid-sentence: `Create agent` → `create agent`; acronyms such as `API key` keep their case. */\nfunction midSentence(text: string): string {\n const first = text.split(/\\s/, 1)[0] ?? ''\n if ((first.match(/[A-Z]/g) ?? []).length > 1) return text\n return text.charAt(0).toLowerCase() + text.slice(1)\n}\n\nfunction day(date: Date): string {\n return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric', timeZone: 'UTC' })\n}\n\n/** One action an agent is waiting to run. */\nexport interface ApprovalEmailAction {\n /** What runs, in plain language and sentence case: `Create agent “Quinn”`. */\n summary: string\n /** Where it runs and until when, e.g. `ph0ny · open until Oct 9, 3:40 PM UTC`. */\n detail?: string\n /**\n * This action's own decision pages. Each must open a confirmation page that\n * decides only on its POST: link scanners open every link in an email.\n */\n approveUrl?: string\n denyUrl?: string\n}\n\n/** Input for {@link approvalEmail}. */\nexport interface ApprovalEmailInput {\n /** At least one action, in the order the agent asked. */\n actions: readonly ApprovalEmailAction[]\n /** The conversation the agent paused in. */\n conversation?: string\n /** Opens the decision, e.g. the chat with the approval card. */\n approveUrl: string\n /** Opens the context, e.g. every request waiting in the workspace. */\n reviewUrl: string\n footer: EmailFooter\n}\n\n/**\n * An agent paused until someone approves what it wants to do. No link decides\n * anything when opened: link scanners open email links. The buttons lead to\n * the app, and an action's own Approve and Deny lead to a confirmation page\n * whose button decides. With one action that has its own approve link, the\n * Approve button opens it.\n */\nexport function approvalEmail(product: EmailProduct, input: ApprovalEmailInput): EmailMessage {\n const [first, ...rest] = input.actions\n if (!first) throw new TypeError('approvalEmail needs at least one action')\n const what = rest.length === 0\n ? midSentence(first.summary)\n : `${midSentence(first.summary)} and ${rest.length} more`\n const where = input.conversation ? ` in “${input.conversation}”` : ''\n return renderEmail(product, {\n subject: emailSubject(`Approve: ${what}`, product),\n preheader: `The agent paused${where} until you decide.`,\n title: rest.length === 0 ? 'Approval needed' : `${input.actions.length} approvals needed`,\n paragraphs: [`The agent paused${where} until you decide. Nothing runs until you approve.`],\n sections: [{ items: input.actions.map((action): EmailItem => ({\n title: action.summary,\n ...(action.detail ? { detail: action.detail } : {}),\n ...(action.approveUrl || action.denyUrl ? { links: [\n ...(action.approveUrl ? [{ label: 'Approve', url: action.approveUrl }] : []),\n ...(action.denyUrl ? [{ label: 'Deny', url: action.denyUrl }] : []),\n ] } : {}),\n })) }],\n primary: { label: 'Approve', url: rest.length === 0 && first.approveUrl ? first.approveUrl : input.approveUrl },\n secondary: { label: 'Review', url: input.reviewUrl },\n footer: input.footer,\n })\n}\n\n/** Input for {@link inviteEmail}. */\nexport interface InviteEmailInput {\n workspaceName: string\n /** Who sent the invitation: a name or an email address. */\n inviter: string\n /** The role the invitation grants, e.g. `editor`. */\n role: string\n acceptUrl: string\n expiresAt: Date\n}\n\n/** Someone invited the recipient to a workspace. */\nexport function inviteEmail(product: EmailProduct, input: InviteEmailInput): EmailMessage {\n const role = input.role.toLowerCase()\n const article = /^[aeiou]/.test(role) ? 'an' : 'a'\n return renderEmail(product, {\n subject: emailSubject(`Join ${input.workspaceName}`, product),\n preheader: `${input.inviter} invited you to ${input.workspaceName}.`,\n title: `Join ${input.workspaceName}`,\n paragraphs: [`${input.inviter} invited you to ${input.workspaceName} on ${product.name} as ${article} ${role}.`],\n primary: { label: 'Accept invitation', url: input.acceptUrl },\n showPrimaryLink: true,\n note: `This invitation expires on ${day(input.expiresAt)}.`,\n footer: {\n workspaceName: input.workspaceName,\n reason: `You received this because ${input.inviter} invited this address.`,\n },\n })\n}\n\n/** Input for {@link digestEmail}. */\nexport interface DigestEmailInput {\n workspaceName: string\n /** The day the digest covers, in the workspace's own date. */\n date: Date\n /** The most useful facts in a few words, for the subject and preview: `2 approvals waiting, 14 turns`. */\n headline: string\n /** What happened and what waits, most important first; empty sections are left out. */\n sections: readonly EmailSection[]\n /** Opens the workspace. */\n openUrl: string\n footer: EmailFooter\n}\n\n/** What happened in a workspace over a day, and what waits on the recipient. */\nexport function digestEmail(product: EmailProduct, input: DigestEmailInput): EmailMessage {\n const date = input.date.toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric', timeZone: 'UTC' })\n return renderEmail(product, {\n subject: emailSubject(`${input.workspaceName}: ${input.headline}`, product),\n preheader: `${input.headline}.`,\n title: `Your day in ${input.workspaceName}`,\n paragraphs: [`${date}: ${input.headline}.`],\n sections: input.sections,\n primary: { label: `Open ${product.name}`, url: input.openUrl },\n footer: input.footer,\n })\n}\n\n/** Input for {@link noticeEmail}. */\nexport interface NoticeEmailInput {\n /** Short; the product name is appended. */\n subject: string\n title: string\n /** One or two short paragraphs. */\n body: string | readonly string[]\n action?: EmailAction\n secondaryAction?: EmailAction\n /** Print the action's link too, for one-time links such as sign-in. */\n showLink?: boolean\n note?: string\n /** Inbox preview line. Defaults to the first paragraph. */\n preheader?: string\n footer: EmailFooter\n}\n\n/** Any other transactional message: one title, a short body and at most two buttons. */\nexport function noticeEmail(product: EmailProduct, input: NoticeEmailInput): EmailMessage {\n const paragraphs = typeof input.body === 'string' ? [input.body] : [...input.body]\n return renderEmail(product, {\n subject: emailSubject(input.subject, product),\n preheader: input.preheader ?? paragraphs[0] ?? input.title,\n title: input.title,\n paragraphs,\n ...(input.action ? { primary: input.action } : {}),\n ...(input.secondaryAction ? { secondary: input.secondaryAction } : {}),\n ...(input.showLink ? { showPrimaryLink: true } : {}),\n ...(input.note ? { note: input.note } : {}),\n footer: input.footer,\n })\n}\n","/** One way an email's HTML would break in Gmail or Outlook. */\nexport interface EmailLintIssue {\n rule:\n | 'document'\n | 'external-css'\n | 'style-block'\n | 'unsupported-element'\n | 'unsupported-css'\n | 'layout-table'\n | 'inline-style'\n | 'image'\n | 'link'\n | 'size'\n message: string\n}\n\n// Gmail clips a message body larger than about 102 KB behind \"View entire message\".\nconst GMAIL_CLIP_BYTES = 102_000\n\nconst tags = (html: string, name: string): string[] =>\n html.match(new RegExp(`<${name}\\\\b[^>]*>`, 'gi')) ?? []\n\nconst attribute = (tag: string, name: string): string | null => {\n const match = new RegExp(`\\\\s${name}=\"([^\"]*)\"`, 'i').exec(tag)\n return match ? match[1]! : null\n}\n\n/** Top-level rules of a stylesheet: their selector or at-rule preludes. */\nfunction preludes(css: string): string[] {\n const out: string[] = []\n let depth = 0\n let start = 0\n for (let i = 0; i < css.length; i++) {\n if (css[i] === '{') {\n if (depth === 0) out.push(css.slice(start, i).trim())\n depth++\n } else if (css[i] === '}') {\n depth--\n if (depth === 0) start = i + 1\n }\n }\n return out\n}\n\n/**\n * Check rendered email HTML against what Gmail and Outlook render: a complete\n * document, layout in presentation tables, styles inline (a `<style>` block may\n * only add dark-mode and narrow-screen overrides), images with alt text and\n * fixed size, absolute links, and a body small enough that Gmail does not clip.\n */\nexport function lintEmailHtml(html: string): EmailLintIssue[] {\n const issues: EmailLintIssue[] = []\n const issue = (rule: EmailLintIssue['rule'], message: string) => issues.push({ rule, message })\n const visible = html.replace(/<!--[\\s\\S]*?-->/g, '')\n\n if (!/^<!DOCTYPE html>/i.test(html)) issue('document', 'Missing <!DOCTYPE html>')\n if (!/<html\\b[^>]*\\slang=\"[^\"]+\"/i.test(html)) issue('document', 'Missing <html lang>')\n if (!/<meta charset=\"utf-8\">/i.test(html)) issue('document', 'Missing <meta charset=\"utf-8\">')\n if (!/<title>[^<]+<\\/title>/i.test(html)) issue('document', 'Missing <title>')\n\n if (/<link\\b[^>]*rel=\"?stylesheet/i.test(visible)) issue('external-css', 'Linked stylesheets are stripped')\n if (/@import\\b/i.test(visible)) issue('external-css', '@import is stripped')\n\n for (const block of visible.match(/<style\\b[^>]*>([\\s\\S]*?)<\\/style>/gi) ?? []) {\n const css = block.replace(/<\\/?style\\b[^>]*>/gi, '').replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')\n for (const prelude of preludes(css)) {\n if (!prelude.startsWith('@media') && !prelude.startsWith('[data-og')) {\n issue('style-block', `<style> may only hold overrides; \"${prelude}\" must be inline`)\n }\n }\n }\n\n for (const name of ['script', 'form', 'input', 'button', 'svg', 'iframe', 'video', 'audio', 'object', 'embed']) {\n if (tags(visible, name).length > 0) issue('unsupported-element', `<${name}> is stripped or unsupported`)\n }\n\n for (const pattern of [\n /display\\s*:\\s*(?:flex|grid|inline-flex)/i,\n /position\\s*:/i,\n /float\\s*:/i,\n /var\\(/i,\n /calc\\(/i,\n /rgba?\\(|hsla?\\(/i,\n /background-image\\s*:|url\\(/i,\n ]) {\n if (pattern.test(visible)) issue('unsupported-css', `Outlook does not render ${pattern.source}`)\n }\n\n for (const table of tags(visible, 'table')) {\n if (attribute(table, 'role') !== 'presentation') issue('layout-table', `Layout table without role=\"presentation\": ${table.slice(0, 80)}`)\n for (const name of ['cellpadding', 'cellspacing', 'border']) {\n if (attribute(table, name) !== '0') issue('layout-table', `Layout table without ${name}=\"0\": ${table.slice(0, 80)}`)\n }\n }\n for (const div of tags(visible, 'div')) {\n const style = attribute(div, 'style') ?? ''\n if (!/display\\s*:\\s*none/i.test(style) && /(?:^|;)\\s*(?:max-)?width\\s*:/i.test(style)) {\n issue('layout-table', 'Outlook ignores <div> widths; size with a table cell')\n }\n }\n\n for (const name of ['p', 'h1', 'h2', 'h3', 'a', 'span']) {\n for (const tag of tags(visible, name)) {\n const style = attribute(tag, 'style') ?? ''\n if (!/(?:^|;)\\s*color\\s*:/i.test(style) || !/font-(?:family|size)\\s*:/i.test(style) && name !== 'a') {\n issue('inline-style', `<${name}> without inline color and font: ${tag.slice(0, 80)}`)\n }\n }\n }\n\n for (const img of tags(visible, 'img')) {\n // alt=\"\" is valid for a decorative image, such as a mark beside its own wordmark.\n if (attribute(img, 'alt') === null) issue('image', `Image without alt text: ${img.slice(0, 80)}`)\n if (!attribute(img, 'width') || !attribute(img, 'height')) issue('image', `Image without width and height: ${img.slice(0, 80)}`)\n const src = attribute(img, 'src') ?? ''\n if (!/^(?:https:|cid:)/.test(src)) issue('image', `Image source must be https: or cid: (${src.slice(0, 40)})`)\n }\n\n for (const anchor of tags(visible, 'a')) {\n const href = attribute(anchor, 'href') ?? ''\n if (!/^(?:https:\\/\\/|mailto:|http:\\/\\/(?:localhost|127\\.0\\.0\\.1)[:/])/.test(href)) {\n issue('link', `Links must be absolute https: ${href.slice(0, 60)}`)\n }\n }\n\n const bytes = new TextEncoder().encode(html).length\n if (bytes > GMAIL_CLIP_BYTES) issue('size', `${bytes} bytes; Gmail clips above ${GMAIL_CLIP_BYTES}`)\n return issues\n}\n"],"mappings":";AAEO,IAAM,yBACX;;;ACGK,IAAM,gBAAgB;AAAA,EAC3B,OAAO;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,IACV,KAAK;AAAA,IACL,cAAc;AAAA,IACd,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EACA,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,IACV,KAAK;AAAA,IACL,cAAc;AAAA,IACd,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AACF;AAOO,IAAM,mBACX;;;AC0DF,IAAM,kBAAkB;AACxB,IAAM,kBAAmC;AAAA,EACvC,UAAU;AAAA,EACV,SAAS;AAAA,EACT,aAAa;AAAA,EACb,WAAW;AACb;AAEA,IAAM,IAAI,cAAc;AACxB,IAAM,IAAI,cAAc;AACxB,IAAM,OAAO;AAKb,IAAM,QAAQ;AAAA;AAAA,8BAEgB,EAAE,MAAM;AAAA,gCACN,EAAE,IAAI,8BAA8B,EAAE,QAAQ;AAAA,gCAC9C,EAAE,IAAI;AAAA,4BACV,EAAE,QAAQ;AAAA,oBAClB,EAAE,GAAG;AAAA,qBACJ,EAAE,YAAY;AAAA,sBACb,EAAE,QAAQ;AAAA,qBACX,EAAE,UAAU;AAAA,4BACL,EAAE,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAME,EAAE,MAAM;AAAA,0CAC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AACT;","names":["entry"]}
1
+ {"version":3,"sources":["../src/email/mark.generated.ts","../src/email/palette.ts","../src/email/layout.ts","../src/email/templates.ts","../src/email/lint.ts"],"sourcesContent":["// GENERATED by scripts/email-mark.mjs from @tangle-network/brand TangleKnot; do not edit.\n/** The Tangle knot as a 84px transparent PNG (base64), shown at 28px in email headers. */\nexport const TANGLE_MARK_PNG_BASE64 =\n 'iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAYAAAAcaxDBAAAQAElEQVR4nOxcDZBV1X3//8+9971dVvkwEhR1GuvEatIY09hmOklTCU2bMQYnH3ZMTAmRZRdpqIAYgV3Iy35CgAUEBBGcBNskliSmTZqPjtox6dhJaGY61NFGpfEDSBRBgbjsvnfv+fd/P86959x73+5b9r26mdm/Luede+/5uP/zO//z/zjnCpikupKASaorTTK0zjTJ0DrTJEPrTJMMrTNNMrTOZMM4qWuxewsBXsVDcxEBzSQUBQAJ4VhxilHq/6sPHyY/SU+NIeYriFw6TMMnMC6Rfj5oFVVrOfWh+Wx0zUWiEyTwZeHRrzauL+yFcRDCOVDPYu8LHtICr4Dv8oAK/rsGr+q/PMkgDfPccWJ281sSpxCl4f2QScF1xSztepwnGV0PLxv1CAzrj8qF7afykG3PzMuofyE3+L5nS/FL8OChLb1OF4yRamZoaSlNtctyo2vTpz0LzlcvTVpNlKqZ4pRiJgPo+QhpGD0YvKQql0Ji1FPCpH7Qn9DqBwy5Q1p9RntR9ZTqJwCY7REO2S78gCrunVvXNz8PNVBNDO1tc1vLNm4nC5oyI28gJWFGMvIJ8vKQotejIy9TLrgPoABt1JNCqn59xPaNctFMoFBK6eUECldUaNfWLueOaLTOnaFd7fIx15FzgkeNkU8hSqux2ogbyPCvoyYT09MdakCQfl/dUUhF9STG7ZhMrb3fYV95PD16XkBh7tYS/i9UoRFX+e52+aRryzkYvbSfKmT5QxnmAVC1qkZY6w1FyFW8CkYeomkfCq3kOT0P0TRV9UepWZ8qpzFT5UljYlRvjHQw6437jar9ZPBV3k/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DH/SPmIDPWJQyGPWi4E6kgaSZSqhVI1Uua6OfJGXi+n1Z+eGWb7pCE9FdNKIZvy+q3nc/utI5OZ6dCRs0Vv7s5SFpladaOT/3VGa1hsZ6A05XmuQaCGWMUkiB0suUiBbFw/g/Aqcf0MEqMPuUANp030AF86rh+vEal9AFxelpvkAwNdThvgOL/OqMiPgjpI97PqNA+CyE5Sgz7CGdQayFSkIzV5OfNlR0ImpBCtkKlJ5QipCTKrRDejPiJkZ4Zv9HoFeXC4SAvvKRWfhBqoZoYq2tBKl/rKOGvc77MkzsogFvKRmS8j06tzFsEmwvJmxgjlRpCh2e+NJqdN2FX4mifov8qFyupt3VPGdIR8zAxNU1e7O5879vv88yLu5UzuVSGNIEVSX/2FoQWkngNDQ07LPMi7r2YCqG/hpWQ0pMph/HVGl03fE2DhbzygF8vkPLx9HKecx83QSTJpAp8C+d2kSYbWmSYZWmeaZGidaZKhdaZJhtaZJhlaZ/o/AAAA//8mfCa5AAAABklEQVQDAPyiOFzVbOpbAAAAAElFTkSuQmCC'\n","/**\n * The Brand roles the email layout paints with, as literal hex. Email clients\n * cannot read CSS variables, and importing `@tangle-network/brand` at runtime\n * would load React into a server-only renderer, so the values live here and\n * `tests/email/palette.test.ts` fails when they drift from Brand's `palettes`.\n */\nexport const EMAIL_PALETTE = {\n light: {\n canvas: '#eceef3',\n card: '#ffffff',\n well: '#f6f7fa',\n hairline: '#c7c6d6',\n ink: '#2d2d2d',\n inkSecondary: '#3f3f3f',\n inkMuted: '#4c4c4c',\n accent: '#4c3fc5',\n onAccent: '#ffffff',\n accentText: '#3c32e9',\n },\n dark: {\n canvas: '#0a0a14',\n card: '#191826',\n well: '#12111f',\n hairline: '#2a293d',\n ink: '#e6e6e6',\n inkSecondary: '#c7c7c7',\n inkMuted: '#b5b5b5',\n accent: '#4c3fc5',\n onAccent: '#ffffff',\n accentText: '#a5b4fc',\n },\n} as const\n\n/**\n * Brand's `--font-sans` stack with the system faces email clients actually\n * have. No client used for this mail loads web fonts reliably, so Inter shows\n * only where it is installed and the platform UI face carries the rest.\n */\nexport const EMAIL_FONT_STACK =\n \"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif\"\n","import { TANGLE_MARK_PNG_BASE64 } from './mark.generated'\nimport { EMAIL_FONT_STACK, EMAIL_PALETTE } from './palette'\n\n/** The app an email comes from. */\nexport interface EmailProduct {\n /**\n * The product name, e.g. `GTM Agent`. The header reads `Tangle GTM Agent`;\n * subjects and the sender use the name alone. A name that already starts\n * with `Tangle` (`Tangle Sandbox`) is not doubled.\n */\n name: string\n /** The app's absolute origin; app-relative links resolve against it. */\n url: string\n}\n\n/** Why the recipient got the email and where they control it. */\nexport interface EmailFooter {\n /** The workspace the email concerns. */\n workspaceName?: string\n /** One sentence, e.g. `You own this workspace.` */\n reason: string\n /** Where the recipient changes which emails they get; absolute or app-relative. */\n manageUrl?: string\n /**\n * Turns this kind of email off in one request, without signing in; absolute\n * or app-relative. Adds an Unsubscribe link and the RFC 8058\n * `List-Unsubscribe` headers, so the endpoint must accept a POST.\n */\n unsubscribeUrl?: string\n /**\n * The sender's postal address, for marketing mail such as a digest. Leave it\n * unset on transactional mail (approvals, invites, sign-in), which does not\n * need one.\n */\n postalAddress?: string\n}\n\n/** A button. `url` is absolute or app-relative. */\nexport interface EmailAction {\n label: string\n url: string\n}\n\n/** One row in a list box: an approval request or a digest entry. */\nexport interface EmailItem {\n title: string\n detail?: string\n /** Makes the title a link; absolute or app-relative. */\n url?: string\n /** Links under the row, such as one item's own Approve and Deny. */\n links?: readonly EmailAction[]\n}\n\n/** An inline image the HTML references by `cid:`; the mail client must send it with the message. */\nexport interface EmailAttachment {\n filename: string\n /** Base64 file content, the form Resend and SES accept. */\n content: string\n contentType: string\n contentId: string\n}\n\n/** A rendered email, ready for any transport. */\nexport interface EmailMessage {\n subject: string\n /** The inbox preview line. */\n preheader: string\n html: string\n text: string\n /** Pass these through to the mail client; the header mark is one of them. */\n attachments: EmailAttachment[]\n /** Extra message headers, such as `List-Unsubscribe`; pass them through too. */\n headers: Record<string, string>\n}\n\n/** A titled list box; a template with one list leaves `heading` unset. */\nexport interface EmailSection {\n heading?: string\n items: readonly EmailItem[]\n}\n\n/** What a template places in the shared layout. */\ninterface EmailContent {\n subject: string\n preheader: string\n title: string\n paragraphs: readonly string[]\n sections?: readonly EmailSection[]\n primary?: EmailAction\n secondary?: EmailAction\n /** Print the primary link under the buttons for clients that strip them. */\n showPrimaryLink?: boolean\n /** A short line under the buttons, e.g. an expiry. */\n note?: string\n footer: EmailFooter\n}\n\nconst MARK_CONTENT_ID = 'tangle-mark'\nconst MARK_ATTACHMENT: EmailAttachment = {\n filename: 'tangle.png',\n content: TANGLE_MARK_PNG_BASE64,\n contentType: 'image/png',\n contentId: MARK_CONTENT_ID,\n}\n\nconst L = EMAIL_PALETTE.light\nconst D = EMAIL_PALETTE.dark\nconst FONT = EMAIL_FONT_STACK\n\n// Inline styles carry the light design; this block only adapts it for clients\n// that honor dark mode or narrow screens. A client that drops <style> still\n// renders the complete light email.\nconst STYLE = `\n@media (prefers-color-scheme: dark) {\n .t-bg { background-color: ${D.canvas} !important; }\n .t-card { background-color: ${D.card} !important; border-color: ${D.hairline} !important; }\n .t-well { background-color: ${D.well} !important; }\n .t-rule { border-color: ${D.hairline} !important; }\n .t-ink { color: ${D.ink} !important; }\n .t-ink2 { color: ${D.inkSecondary} !important; }\n .t-muted { color: ${D.inkMuted} !important; }\n .t-link { color: ${D.accentText} !important; }\n .t-btn2 { border-color: ${D.hairline} !important; }\n}\n@media (max-width: 600px) {\n .t-outer { padding: 20px 8px !important; }\n .t-card { padding: 28px 22px 24px !important; }\n}\n[data-ogsb] .t-bg { background-color: ${D.canvas} !important; }\n[data-ogsb] .t-card { background-color: ${D.card} !important; }\n[data-ogsb] .t-well { background-color: ${D.well} !important; }\n[data-ogsc] .t-ink { color: ${D.ink} !important; }\n[data-ogsc] .t-ink2 { color: ${D.inkSecondary} !important; }\n[data-ogsc] .t-muted { color: ${D.inkMuted} !important; }\n[data-ogsc] .t-link { color: ${D.accentText} !important; }\n`.trim()\n\n/** Escape text for HTML element content and quoted attribute values. */\nfunction escapeHtml(value: string): string {\n return value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;')\n}\n\n/** An absolute http(s) URL; app-relative paths resolve against the product origin. */\nfunction resolveEmailUrl(url: string, product: EmailProduct): string {\n const resolved = new URL(url, product.url)\n if (resolved.protocol !== 'https:' && resolved.protocol !== 'http:') {\n throw new TypeError(`Email links must be http(s): ${resolved.protocol}`)\n }\n return resolved.toString()\n}\n\n/** `Title — Product`, the one subject shape every Tangle email uses. */\nexport function emailSubject(subject: string, product: EmailProduct): string {\n return `${subject} — ${product.name}`\n}\n\nfunction paragraph(text: string, margin: string): string {\n return `<p class=\"t-ink2\" style=\"margin:${margin};font-family:${FONT};font-size:15px;line-height:24px;color:${L.inkSecondary}\">${escapeHtml(text)}</p>`\n}\n\nfunction link(label: string, href: string, style: string): string {\n return `<a class=\"t-link\" href=\"${escapeHtml(href)}\" style=\"color:${L.accentText};text-decoration:none;${style}\">${escapeHtml(label)}</a>`\n}\n\n/** The product name after the `Tangle` logotype: `GTM Agent`, or `Sandbox` for `Tangle Sandbox`. */\nfunction productSuffix(product: EmailProduct): string {\n return product.name.replace(/^Tangle\\s+/i, '')\n}\n\n// Brand's lockup: the knot, `Tangle` in the logotype's bold, then the product\n// name at a lighter weight, as the product site headers set it.\nfunction header(product: EmailProduct): string {\n const type = `font-family:${FONT};font-size:17px;line-height:20px;letter-spacing:-0.01em;color:${L.ink}`\n return [\n '<table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">',\n '<tr>',\n `<td style=\"padding:0 10px 0 0;vertical-align:middle\"><img src=\"cid:${MARK_CONTENT_ID}\" width=\"28\" height=\"28\" alt=\"\" style=\"display:block;width:28px;height:28px;border:0;outline:none;text-decoration:none\"></td>`,\n `<td class=\"t-ink\" style=\"vertical-align:middle;white-space:nowrap;${type}\">`,\n `<span class=\"t-ink\" style=\"${type};font-weight:700\">Tangle</span>`,\n `<span class=\"t-ink\" style=\"${type};font-weight:500\">&nbsp;${escapeHtml(productSuffix(product))}</span>`,\n '</td>',\n '</tr>',\n '</table>',\n ].join('')\n}\n\nfunction section(entry: EmailSection, product: EmailProduct): string {\n if (entry.items.length === 0) return ''\n const heading = entry.heading\n ? `<p class=\"t-ink\" style=\"margin:20px 0 6px;font-family:${FONT};font-size:13px;line-height:18px;font-weight:600;color:${L.ink}\">${escapeHtml(entry.heading)}</p>`\n : ''\n return heading + items(entry.items, product)\n}\n\nfunction items(list: readonly EmailItem[], product: EmailProduct): string {\n const rows = list.map((item, index) => {\n const rule = index === 0 ? '' : `border-top:1px solid ${L.hairline};`\n const title = item.url\n ? link(item.title, resolveEmailUrl(item.url, product), 'font-weight:600')\n : escapeHtml(item.title)\n const detail = item.detail\n ? `<p class=\"t-muted\" style=\"margin:2px 0 0;font-family:${FONT};font-size:13px;line-height:20px;color:${L.inkMuted}\">${escapeHtml(item.detail)}</p>`\n : ''\n const links = item.links && item.links.length > 0\n ? `<p class=\"t-muted\" style=\"margin:6px 0 0;font-family:${FONT};font-size:14px;line-height:20px;color:${L.inkMuted}\">${item.links\n .map((entry) => link(entry.label, resolveEmailUrl(entry.url, product), 'font-weight:600'))\n .join('&nbsp;&nbsp;·&nbsp;&nbsp;')}</p>`\n : ''\n return [\n `<tr><td class=\"t-rule\" style=\"padding:14px 16px;${rule}\">`,\n `<p class=\"t-ink\" style=\"margin:0;font-family:${FONT};font-size:15px;line-height:22px;font-weight:600;color:${L.ink}\">${title}</p>`,\n detail,\n links,\n '</td></tr>',\n ].join('')\n })\n return [\n `<table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t-well\" bgcolor=\"${L.well}\" style=\"background-color:${L.well};border-radius:8px;margin:4px 0 8px\">`,\n ...rows,\n '</table>',\n ].join('')\n}\n\nfunction primaryButton(action: EmailAction, href: string): string {\n return [\n `<td bgcolor=\"${L.accent}\" style=\"border-radius:8px;background-color:${L.accent};mso-padding-alt:12px 22px\">`,\n `<a href=\"${escapeHtml(href)}\" style=\"display:inline-block;padding:12px 22px;font-family:${FONT};font-size:15px;line-height:20px;font-weight:600;color:${L.onAccent};text-decoration:none;border-radius:8px\">${escapeHtml(action.label)}</a>`,\n '</td>',\n ].join('')\n}\n\nfunction secondaryButton(action: EmailAction, href: string): string {\n return [\n `<td class=\"t-btn2\" style=\"border:1px solid ${L.hairline};border-radius:8px;mso-padding-alt:11px 21px\">`,\n `<a class=\"t-ink\" href=\"${escapeHtml(href)}\" style=\"display:inline-block;padding:11px 21px;font-family:${FONT};font-size:15px;line-height:20px;font-weight:600;color:${L.ink};text-decoration:none;border-radius:8px\">${escapeHtml(action.label)}</a>`,\n '</td>',\n ].join('')\n}\n\nfunction buttons(content: EmailContent, product: EmailProduct): string {\n const cells: string[] = []\n if (content.primary) cells.push(primaryButton(content.primary, resolveEmailUrl(content.primary.url, product)))\n if (content.secondary) {\n if (cells.length > 0) cells.push('<td style=\"width:10px;font-size:0;line-height:0\">&nbsp;</td>')\n cells.push(secondaryButton(content.secondary, resolveEmailUrl(content.secondary.url, product)))\n }\n if (cells.length === 0) return ''\n return `<table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"margin:20px 0 0\"><tr>${cells.join('')}</tr></table>`\n}\n\nfunction small(html: string, margin: string, size = 13): string {\n return `<p class=\"t-muted\" style=\"margin:${margin};font-family:${FONT};font-size:${size}px;line-height:${size + 7}px;color:${L.inkMuted}\">${html}</p>`\n}\n\nfunction footerLines(footer: EmailFooter, product: EmailProduct): { html: string[]; text: string[] } {\n const where = footer.workspaceName ? `${footer.workspaceName} · ${product.name}` : product.name\n const manage = footer.manageUrl ? resolveEmailUrl(footer.manageUrl, product) : null\n const unsubscribe = footer.unsubscribeUrl ? resolveEmailUrl(footer.unsubscribeUrl, product) : null\n const links = [\n ...(manage ? [link('Manage notifications', manage, 'text-decoration:underline')] : []),\n ...(unsubscribe ? [link('Unsubscribe', unsubscribe, 'text-decoration:underline')] : []),\n ]\n const html = [\n escapeHtml(where),\n escapeHtml(footer.reason),\n ...(links.length > 0 ? [links.join(' &middot; ')] : []),\n ...(footer.postalAddress ? [escapeHtml(footer.postalAddress)] : []),\n ]\n const text = [\n where,\n footer.reason,\n ...(manage ? [`Manage notifications: ${manage}`] : []),\n ...(unsubscribe ? [`Unsubscribe: ${unsubscribe}`] : []),\n ...(footer.postalAddress ? [footer.postalAddress] : []),\n ]\n return { html, text }\n}\n\n// Keeps the body text that follows out of the inbox preview line.\nconst PREHEADER_SPACER = '&#847;&zwnj;&nbsp;'.repeat(40)\n\nfunction renderHtml(content: EmailContent, product: EmailProduct): string {\n const primaryHref = content.primary ? resolveEmailUrl(content.primary.url, product) : null\n const footer = footerLines(content.footer, product)\n const body = [\n `<h1 class=\"t-ink\" style=\"margin:0 0 12px;font-family:${FONT};font-size:22px;line-height:28px;font-weight:600;letter-spacing:-0.01em;color:${L.ink}\">${escapeHtml(content.title)}</h1>`,\n ...content.paragraphs.map((text) => paragraph(text, '0 0 12px')),\n ...(content.sections ?? []).map((entry) => section(entry, product)),\n buttons(content, product),\n content.showPrimaryLink && primaryHref\n ? small(`Or open this link: ${link(primaryHref, primaryHref, 'word-break:break-all')}`, '20px 0 0')\n : '',\n content.note ? small(escapeHtml(content.note), content.showPrimaryLink ? '8px 0 0' : '20px 0 0') : '',\n ].join('')\n\n return [\n '<!DOCTYPE html>',\n '<html lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\">',\n '<head>',\n '<meta charset=\"utf-8\">',\n '<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">',\n '<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">',\n '<meta name=\"x-apple-disable-message-reformatting\">',\n '<meta name=\"format-detection\" content=\"telephone=no, date=no, address=no, email=no, url=no\">',\n '<meta name=\"color-scheme\" content=\"light dark\">',\n '<meta name=\"supported-color-schemes\" content=\"light dark\">',\n `<title>${escapeHtml(content.subject)}</title>`,\n '<!--[if mso]><noscript><xml><o:OfficeDocumentSettings><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml></noscript><![endif]-->',\n `<style>\\n${STYLE}\\n</style>`,\n '</head>',\n `<body class=\"t-bg\" style=\"margin:0;padding:0;width:100%;background-color:${L.canvas};-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%\">`,\n `<div style=\"display:none;font-size:1px;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;mso-hide:all\">${escapeHtml(content.preheader)}${PREHEADER_SPACER}</div>`,\n `<table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t-bg\" bgcolor=\"${L.canvas}\" style=\"background-color:${L.canvas}\">`,\n '<tr><td class=\"t-outer\" align=\"center\" style=\"padding:32px 12px\">',\n '<!--[if mso]><table role=\"presentation\" width=\"560\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"><tr><td><![endif]-->',\n '<table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"max-width:560px;margin:0 auto\">',\n `<tr><td style=\"padding:0 4px 20px\">${header(product)}</td></tr>`,\n `<tr><td class=\"t-card\" bgcolor=\"${L.card}\" style=\"background-color:${L.card};border:1px solid ${L.hairline};border-radius:12px;padding:36px 36px 32px\">${body}</td></tr>`,\n `<tr><td style=\"padding:24px 4px 0\">${footer.html.map((line, index) => small(line, index === 0 ? '0' : '4px 0 0', 12)).join('')}</td></tr>`,\n '</table>',\n '<!--[if mso]></td></tr></table><![endif]-->',\n '</td></tr>',\n '</table>',\n '</body>',\n '</html>',\n ].join('\\n')\n}\n\nfunction renderText(content: EmailContent, product: EmailProduct): string {\n const blocks: string[] = [`Tangle ${productSuffix(product)}`, content.title, ...content.paragraphs]\n for (const entry of content.sections ?? []) {\n if (entry.items.length === 0) continue\n const list = entry.items.map((item) => {\n const lines = [`- ${item.title}`]\n if (item.detail) lines.push(` ${item.detail}`)\n if (item.url) lines.push(` ${resolveEmailUrl(item.url, product)}`)\n for (const entry of item.links ?? []) lines.push(` ${entry.label}: ${resolveEmailUrl(entry.url, product)}`)\n return lines.join('\\n')\n }).join('\\n')\n blocks.push(entry.heading ? `${entry.heading}\\n${list}` : list)\n }\n const actions = [content.primary, content.secondary]\n .filter((action): action is EmailAction => Boolean(action))\n .map((action) => `${action.label}: ${resolveEmailUrl(action.url, product)}`)\n if (actions.length > 0) blocks.push(actions.join('\\n'))\n if (content.note) blocks.push(content.note)\n blocks.push(['--', ...footerLines(content.footer, product).text].join('\\n'))\n return `${blocks.join('\\n\\n')}\\n`\n}\n\n/** Place a template's content in the shared Tangle layout. */\nexport function renderEmail(product: EmailProduct, content: EmailContent): EmailMessage {\n return {\n subject: content.subject,\n preheader: content.preheader,\n html: renderHtml(content, product),\n text: renderText(content, product),\n attachments: [MARK_ATTACHMENT],\n headers: content.footer.unsubscribeUrl\n ? {\n 'List-Unsubscribe': `<${resolveEmailUrl(content.footer.unsubscribeUrl, product)}>`,\n 'List-Unsubscribe-Post': 'List-Unsubscribe=One-Click',\n }\n : {},\n }\n}\n\n/**\n * The HTML with inline images embedded as data URIs, for browser previews and\n * screenshots. Mail clients get `cid:` references and the attachments instead.\n */\nexport function emailPreviewHtml(message: Pick<EmailMessage, 'html' | 'attachments'>): string {\n return message.attachments.reduce(\n (html, attachment) => html.split(`cid:${attachment.contentId}`).join(`data:${attachment.contentType};base64,${attachment.content}`),\n message.html,\n )\n}\n\n/**\n * The From header for an app's mail: `GTM Agent · Tangle <noreply@tangle.tools>`.\n * The product leads because inbox sender columns truncate; `· Tangle` ties\n * every app to the company and the sending domain.\n */\nexport function emailSender(productName: string, address: string): string {\n if (!/^[^\\s<>@]+@[^\\s<>@]+\\.[^\\s<>@]+$/.test(address)) throw new TypeError(`Not an email address: ${address}`)\n const name = /\\bTangle\\b/i.test(productName) ? productName : `${productName} · Tangle`\n return `${name} <${address}>`\n}\n","import {\n emailSubject,\n renderEmail,\n type EmailAction,\n type EmailFooter,\n type EmailItem,\n type EmailMessage,\n type EmailProduct,\n type EmailSection,\n} from './layout'\n\n/** Sentence case to mid-sentence: `Create agent` → `create agent`; acronyms such as `API key` keep their case. */\nfunction midSentence(text: string): string {\n const first = text.split(/\\s/, 1)[0] ?? ''\n if ((first.match(/[A-Z]/g) ?? []).length > 1) return text\n return text.charAt(0).toLowerCase() + text.slice(1)\n}\n\nfunction day(date: Date): string {\n return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric', timeZone: 'UTC' })\n}\n\n/** One action an agent is waiting to run. */\nexport interface ApprovalEmailAction {\n /** What runs, in plain language and sentence case: `Create agent “Quinn”`. */\n summary: string\n /** Where it runs and until when, e.g. `ph0ny · open until Oct 9, 3:40 PM UTC`. */\n detail?: string\n /**\n * This action's own decision pages. Each must open a confirmation page that\n * decides only on its POST: link scanners open every link in an email.\n */\n approveUrl?: string\n denyUrl?: string\n}\n\n/** Input for {@link approvalEmail}. */\nexport interface ApprovalEmailInput {\n /** At least one action, in the order the agent asked. */\n actions: readonly ApprovalEmailAction[]\n /** The conversation the agent paused in. */\n conversation?: string\n /** Opens the decision, e.g. the chat with the approval card. */\n approveUrl: string\n /** Opens the context, e.g. every request waiting in the workspace. */\n reviewUrl: string\n footer: EmailFooter\n}\n\n/**\n * An agent paused until someone approves what it wants to do. No link decides\n * anything when opened: link scanners open email links. The buttons lead to\n * the app, and an action's own Approve and Deny lead to a confirmation page\n * whose button decides. With one action that has its own approve link, the\n * Approve button opens it.\n */\nexport function approvalEmail(product: EmailProduct, input: ApprovalEmailInput): EmailMessage {\n const [first, ...rest] = input.actions\n if (!first) throw new TypeError('approvalEmail needs at least one action')\n const what = rest.length === 0\n ? midSentence(first.summary)\n : `${midSentence(first.summary)} and ${rest.length} more`\n const where = input.conversation ? ` in “${input.conversation}”` : ''\n return renderEmail(product, {\n subject: emailSubject(`Approve: ${what}`, product),\n preheader: `The agent paused${where} until you decide.`,\n title: rest.length === 0 ? 'Approval needed' : `${input.actions.length} approvals needed`,\n paragraphs: [`The agent paused${where} until you decide. Nothing runs until you approve.`],\n sections: [{ items: input.actions.map((action): EmailItem => ({\n title: action.summary,\n ...(action.detail ? { detail: action.detail } : {}),\n ...(action.approveUrl || action.denyUrl ? { links: [\n ...(action.approveUrl ? [{ label: 'Approve', url: action.approveUrl }] : []),\n ...(action.denyUrl ? [{ label: 'Deny', url: action.denyUrl }] : []),\n ] } : {}),\n })) }],\n primary: { label: 'Approve', url: rest.length === 0 && first.approveUrl ? first.approveUrl : input.approveUrl },\n secondary: { label: 'Review', url: input.reviewUrl },\n footer: input.footer,\n })\n}\n\n/** Input for {@link approvalDigestEmail}. */\nexport interface ApprovalDigestEmailInput {\n /** Every request still waiting, in the order the agent asked; at least one. */\n actions: ReadonlyArray<ApprovalEmailAction & {\n /** The conversation it waits in; requests group under it. */\n conversation?: string\n /** Opens the request in that conversation. */\n url?: string\n }>\n /** Opens every request waiting in the workspace. */\n reviewUrl: string\n footer: EmailFooter\n}\n\n/**\n * One email with every request still waiting on the owner, grouped by\n * conversation, each with its own Approve and Deny. Sent on a schedule in\n * place of one email per request. As with {@link approvalEmail}, the links\n * open confirmation pages; nothing decides when opened.\n */\nexport function approvalDigestEmail(product: EmailProduct, input: ApprovalDigestEmailInput): EmailMessage {\n const count = input.actions.length\n if (count === 0) throw new TypeError('approvalDigestEmail needs at least one action')\n const groups = new Map<string, EmailItem[]>()\n for (const action of input.actions) {\n const key = action.conversation ?? ''\n const items = groups.get(key) ?? []\n items.push({\n title: action.summary,\n ...(action.detail ? { detail: action.detail } : {}),\n ...(action.url ? { url: action.url } : {}),\n ...(action.approveUrl || action.denyUrl ? { links: [\n ...(action.approveUrl ? [{ label: 'Approve', url: action.approveUrl }] : []),\n ...(action.denyUrl ? [{ label: 'Deny', url: action.denyUrl }] : []),\n ] } : {}),\n })\n groups.set(key, items)\n }\n const waiting = count === 1 ? '1 request is waiting' : `${count} requests are waiting`\n return renderEmail(product, {\n subject: emailSubject(count === 1 ? 'Approve: 1 request is waiting' : `Approve: ${count} requests are waiting`, product),\n preheader: `${waiting} for your decision.`,\n title: count === 1 ? '1 approval waiting' : `${count} approvals waiting`,\n paragraphs: [`${waiting} for your decision. Each one runs only when you approve it.`],\n sections: [...groups].map(([conversation, items]) => ({ ...(conversation ? { heading: conversation } : {}), items })),\n primary: { label: 'Review all', url: input.reviewUrl },\n footer: input.footer,\n })\n}\n\n/** Input for {@link inviteEmail}. */\nexport interface InviteEmailInput {\n workspaceName: string\n /** Who sent the invitation: a name or an email address. */\n inviter: string\n /** The role the invitation grants, e.g. `editor`. */\n role: string\n acceptUrl: string\n expiresAt: Date\n}\n\n/** Someone invited the recipient to a workspace. */\nexport function inviteEmail(product: EmailProduct, input: InviteEmailInput): EmailMessage {\n const role = input.role.toLowerCase()\n const article = /^[aeiou]/.test(role) ? 'an' : 'a'\n return renderEmail(product, {\n subject: emailSubject(`Join ${input.workspaceName}`, product),\n preheader: `${input.inviter} invited you to ${input.workspaceName}.`,\n title: `Join ${input.workspaceName}`,\n paragraphs: [`${input.inviter} invited you to ${input.workspaceName} on ${product.name} as ${article} ${role}.`],\n primary: { label: 'Accept invitation', url: input.acceptUrl },\n showPrimaryLink: true,\n note: `This invitation expires on ${day(input.expiresAt)}.`,\n footer: {\n workspaceName: input.workspaceName,\n reason: `You received this because ${input.inviter} invited this address.`,\n },\n })\n}\n\n/** Input for {@link digestEmail}. */\nexport interface DigestEmailInput {\n workspaceName: string\n /** The day the digest covers, in the workspace's own date. */\n date: Date\n /** The most useful facts in a few words, for the subject and preview: `2 approvals waiting, 14 turns`. */\n headline: string\n /** What happened and what waits, most important first; empty sections are left out. */\n sections: readonly EmailSection[]\n /** Opens the workspace. */\n openUrl: string\n footer: EmailFooter\n}\n\n/** What happened in a workspace over a day, and what waits on the recipient. */\nexport function digestEmail(product: EmailProduct, input: DigestEmailInput): EmailMessage {\n const date = input.date.toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric', timeZone: 'UTC' })\n return renderEmail(product, {\n subject: emailSubject(`${input.workspaceName}: ${input.headline}`, product),\n preheader: `${input.headline}.`,\n title: `Your day in ${input.workspaceName}`,\n paragraphs: [`${date}: ${input.headline}.`],\n sections: input.sections,\n primary: { label: `Open ${product.name}`, url: input.openUrl },\n footer: input.footer,\n })\n}\n\n/** Input for {@link noticeEmail}. */\nexport interface NoticeEmailInput {\n /** Short; the product name is appended. */\n subject: string\n title: string\n /** One or two short paragraphs. */\n body: string | readonly string[]\n action?: EmailAction\n secondaryAction?: EmailAction\n /** Print the action's link too, for one-time links such as sign-in. */\n showLink?: boolean\n note?: string\n /** Inbox preview line. Defaults to the first paragraph. */\n preheader?: string\n footer: EmailFooter\n}\n\n/** Any other transactional message: one title, a short body and at most two buttons. */\nexport function noticeEmail(product: EmailProduct, input: NoticeEmailInput): EmailMessage {\n const paragraphs = typeof input.body === 'string' ? [input.body] : [...input.body]\n return renderEmail(product, {\n subject: emailSubject(input.subject, product),\n preheader: input.preheader ?? paragraphs[0] ?? input.title,\n title: input.title,\n paragraphs,\n ...(input.action ? { primary: input.action } : {}),\n ...(input.secondaryAction ? { secondary: input.secondaryAction } : {}),\n ...(input.showLink ? { showPrimaryLink: true } : {}),\n ...(input.note ? { note: input.note } : {}),\n footer: input.footer,\n })\n}\n","/** One way an email's HTML would break in Gmail or Outlook. */\nexport interface EmailLintIssue {\n rule:\n | 'document'\n | 'external-css'\n | 'style-block'\n | 'unsupported-element'\n | 'unsupported-css'\n | 'layout-table'\n | 'inline-style'\n | 'image'\n | 'link'\n | 'size'\n message: string\n}\n\n// Gmail clips a message body larger than about 102 KB behind \"View entire message\".\nconst GMAIL_CLIP_BYTES = 102_000\n\nconst tags = (html: string, name: string): string[] =>\n html.match(new RegExp(`<${name}\\\\b[^>]*>`, 'gi')) ?? []\n\nconst attribute = (tag: string, name: string): string | null => {\n const match = new RegExp(`\\\\s${name}=\"([^\"]*)\"`, 'i').exec(tag)\n return match ? match[1]! : null\n}\n\n/** Top-level rules of a stylesheet: their selector or at-rule preludes. */\nfunction preludes(css: string): string[] {\n const out: string[] = []\n let depth = 0\n let start = 0\n for (let i = 0; i < css.length; i++) {\n if (css[i] === '{') {\n if (depth === 0) out.push(css.slice(start, i).trim())\n depth++\n } else if (css[i] === '}') {\n depth--\n if (depth === 0) start = i + 1\n }\n }\n return out\n}\n\n/**\n * Check rendered email HTML against what Gmail and Outlook render: a complete\n * document, layout in presentation tables, styles inline (a `<style>` block may\n * only add dark-mode and narrow-screen overrides), images with alt text and\n * fixed size, absolute links, and a body small enough that Gmail does not clip.\n */\nexport function lintEmailHtml(html: string): EmailLintIssue[] {\n const issues: EmailLintIssue[] = []\n const issue = (rule: EmailLintIssue['rule'], message: string) => issues.push({ rule, message })\n const visible = html.replace(/<!--[\\s\\S]*?-->/g, '')\n\n if (!/^<!DOCTYPE html>/i.test(html)) issue('document', 'Missing <!DOCTYPE html>')\n if (!/<html\\b[^>]*\\slang=\"[^\"]+\"/i.test(html)) issue('document', 'Missing <html lang>')\n if (!/<meta charset=\"utf-8\">/i.test(html)) issue('document', 'Missing <meta charset=\"utf-8\">')\n if (!/<title>[^<]+<\\/title>/i.test(html)) issue('document', 'Missing <title>')\n\n if (/<link\\b[^>]*rel=\"?stylesheet/i.test(visible)) issue('external-css', 'Linked stylesheets are stripped')\n if (/@import\\b/i.test(visible)) issue('external-css', '@import is stripped')\n\n for (const block of visible.match(/<style\\b[^>]*>([\\s\\S]*?)<\\/style>/gi) ?? []) {\n const css = block.replace(/<\\/?style\\b[^>]*>/gi, '').replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')\n for (const prelude of preludes(css)) {\n if (!prelude.startsWith('@media') && !prelude.startsWith('[data-og')) {\n issue('style-block', `<style> may only hold overrides; \"${prelude}\" must be inline`)\n }\n }\n }\n\n for (const name of ['script', 'form', 'input', 'button', 'svg', 'iframe', 'video', 'audio', 'object', 'embed']) {\n if (tags(visible, name).length > 0) issue('unsupported-element', `<${name}> is stripped or unsupported`)\n }\n\n for (const pattern of [\n /display\\s*:\\s*(?:flex|grid|inline-flex)/i,\n /position\\s*:/i,\n /float\\s*:/i,\n /var\\(/i,\n /calc\\(/i,\n /rgba?\\(|hsla?\\(/i,\n /background-image\\s*:|url\\(/i,\n ]) {\n if (pattern.test(visible)) issue('unsupported-css', `Outlook does not render ${pattern.source}`)\n }\n\n for (const table of tags(visible, 'table')) {\n if (attribute(table, 'role') !== 'presentation') issue('layout-table', `Layout table without role=\"presentation\": ${table.slice(0, 80)}`)\n for (const name of ['cellpadding', 'cellspacing', 'border']) {\n if (attribute(table, name) !== '0') issue('layout-table', `Layout table without ${name}=\"0\": ${table.slice(0, 80)}`)\n }\n }\n for (const div of tags(visible, 'div')) {\n const style = attribute(div, 'style') ?? ''\n if (!/display\\s*:\\s*none/i.test(style) && /(?:^|;)\\s*(?:max-)?width\\s*:/i.test(style)) {\n issue('layout-table', 'Outlook ignores <div> widths; size with a table cell')\n }\n }\n\n for (const name of ['p', 'h1', 'h2', 'h3', 'a', 'span']) {\n for (const tag of tags(visible, name)) {\n const style = attribute(tag, 'style') ?? ''\n if (!/(?:^|;)\\s*color\\s*:/i.test(style) || !/font-(?:family|size)\\s*:/i.test(style) && name !== 'a') {\n issue('inline-style', `<${name}> without inline color and font: ${tag.slice(0, 80)}`)\n }\n }\n }\n\n for (const img of tags(visible, 'img')) {\n // alt=\"\" is valid for a decorative image, such as a mark beside its own wordmark.\n if (attribute(img, 'alt') === null) issue('image', `Image without alt text: ${img.slice(0, 80)}`)\n if (!attribute(img, 'width') || !attribute(img, 'height')) issue('image', `Image without width and height: ${img.slice(0, 80)}`)\n const src = attribute(img, 'src') ?? ''\n if (!/^(?:https:|cid:)/.test(src)) issue('image', `Image source must be https: or cid: (${src.slice(0, 40)})`)\n }\n\n for (const anchor of tags(visible, 'a')) {\n const href = attribute(anchor, 'href') ?? ''\n if (!/^(?:https:\\/\\/|mailto:|http:\\/\\/(?:localhost|127\\.0\\.0\\.1)[:/])/.test(href)) {\n issue('link', `Links must be absolute https: ${href.slice(0, 60)}`)\n }\n }\n\n const bytes = new TextEncoder().encode(html).length\n if (bytes > GMAIL_CLIP_BYTES) issue('size', `${bytes} bytes; Gmail clips above ${GMAIL_CLIP_BYTES}`)\n return issues\n}\n"],"mappings":";AAEO,IAAM,yBACX;;;ACGK,IAAM,gBAAgB;AAAA,EAC3B,OAAO;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,IACV,KAAK;AAAA,IACL,cAAc;AAAA,IACd,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EACA,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,IACV,KAAK;AAAA,IACL,cAAc;AAAA,IACd,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AACF;AAOO,IAAM,mBACX;;;AC0DF,IAAM,kBAAkB;AACxB,IAAM,kBAAmC;AAAA,EACvC,UAAU;AAAA,EACV,SAAS;AAAA,EACT,aAAa;AAAA,EACb,WAAW;AACb;AAEA,IAAM,IAAI,cAAc;AACxB,IAAM,IAAI,cAAc;AACxB,IAAM,OAAO;AAKb,IAAM,QAAQ;AAAA;AAAA,8BAEgB,EAAE,MAAM;AAAA,gCACN,EAAE,IAAI,8BAA8B,EAAE,QAAQ;AAAA,gCAC9C,EAAE,IAAI;AAAA,4BACV,EAAE,QAAQ;AAAA,oBAClB,EAAE,GAAG;AAAA,qBACJ,EAAE,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,iCAAiC,KAAK,MAAM,GAAG,EAAE,CAAC,EAAE;AAAA,IACpE;AAAA,EACF;AAEA,QAAM,QAAQ,IAAI,YAAY,EAAE,OAAO,IAAI,EAAE;AAC7C,MAAI,QAAQ,iBAAkB,OAAM,QAAQ,GAAG,KAAK,6BAA6B,gBAAgB,EAAE;AACnG,SAAO;AACT;","names":["entry","items"]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  canTransitionInteractionStatus,
3
3
  persistedPartToInteraction
4
- } from "./chunk-FCON65I2.js";
4
+ } from "./chunk-6VQCFJWP.js";
5
5
  import {
6
6
  canTransitionPlanStatus,
7
7
  persistedPartToPlan,
@@ -406,4 +406,4 @@ export {
406
406
  terminalizeDanglingAssistantToolUpdates,
407
407
  encodeEvent
408
408
  };
409
- //# sourceMappingURL=chunk-N56FWDSP.js.map
409
+ //# sourceMappingURL=chunk-ZGUXI5SI.js.map
@@ -27,5 +27,5 @@
27
27
  * `emailPreviewHtml` embeds the inline images for a browser preview.
28
28
  */
29
29
  export { emailPreviewHtml, emailSender, type EmailAction, type EmailAttachment, type EmailFooter, type EmailItem, type EmailMessage, type EmailProduct, type EmailSection, } from './layout';
30
- export { approvalEmail, digestEmail, inviteEmail, noticeEmail, type ApprovalEmailAction, type ApprovalEmailInput, type DigestEmailInput, type InviteEmailInput, type NoticeEmailInput, } from './templates';
30
+ export { approvalDigestEmail, approvalEmail, digestEmail, inviteEmail, noticeEmail, type ApprovalDigestEmailInput, type ApprovalEmailAction, type ApprovalEmailInput, type DigestEmailInput, type InviteEmailInput, type NoticeEmailInput, } from './templates';
31
31
  export { lintEmailHtml, type EmailLintIssue } from './lint';
@@ -1,4 +1,5 @@
1
1
  import {
2
+ approvalDigestEmail,
2
3
  approvalEmail,
3
4
  digestEmail,
4
5
  emailPreviewHtml,
@@ -6,8 +7,9 @@ import {
6
7
  inviteEmail,
7
8
  lintEmailHtml,
8
9
  noticeEmail
9
- } from "../chunk-OYN2UY3K.js";
10
+ } from "../chunk-WOTWQ2ST.js";
10
11
  export {
12
+ approvalDigestEmail,
11
13
  approvalEmail,
12
14
  digestEmail,
13
15
  emailPreviewHtml,
@@ -32,6 +32,26 @@ export interface ApprovalEmailInput {
32
32
  * Approve button opens it.
33
33
  */
34
34
  export declare function approvalEmail(product: EmailProduct, input: ApprovalEmailInput): EmailMessage;
35
+ /** Input for {@link approvalDigestEmail}. */
36
+ export interface ApprovalDigestEmailInput {
37
+ /** Every request still waiting, in the order the agent asked; at least one. */
38
+ actions: ReadonlyArray<ApprovalEmailAction & {
39
+ /** The conversation it waits in; requests group under it. */
40
+ conversation?: string;
41
+ /** Opens the request in that conversation. */
42
+ url?: string;
43
+ }>;
44
+ /** Opens every request waiting in the workspace. */
45
+ reviewUrl: string;
46
+ footer: EmailFooter;
47
+ }
48
+ /**
49
+ * One email with every request still waiting on the owner, grouped by
50
+ * conversation, each with its own Approve and Deny. Sent on a schedule in
51
+ * place of one email per request. As with {@link approvalEmail}, the links
52
+ * open confirmation pages; nothing decides when opened.
53
+ */
54
+ export declare function approvalDigestEmail(product: EmailProduct, input: ApprovalDigestEmailInput): EmailMessage;
35
55
  /** Input for {@link inviteEmail}. */
36
56
  export interface InviteEmailInput {
37
57
  workspaceName: string;
@@ -14,7 +14,7 @@ import {
14
14
  splitHubActionPath,
15
15
  summarizeHubResult,
16
16
  unwrapHubResult
17
- } from "../chunk-BF7M3NW2.js";
17
+ } from "../chunk-MCAIZKQ5.js";
18
18
  export {
19
19
  HUB_APPROVAL_ACTIVE_PHASES,
20
20
  HUB_APPROVAL_OPEN_PHASES,
@@ -40,6 +40,15 @@ export interface HubActionBundle {
40
40
  state: 'done' | 'current' | 'upcoming';
41
41
  }>;
42
42
  }
43
+ /** Whether an open call waits for the owner, in the owner's words. */
44
+ export interface HubApprovalWait {
45
+ /** True when nothing runs until the owner decides; false when a permission runs it. */
46
+ owner: boolean;
47
+ /** One sentence: `Publishing always needs your approval.` or `Runs under this conversation’s auto-approve.` */
48
+ reason: string;
49
+ /** A stable cause the host can test, e.g. `never_grantable`, `loop_guard`, `daily_cap`. */
50
+ code?: string;
51
+ }
43
52
  /** One held Hub action and its decision, in the form every surface renders. */
44
53
  export interface HubApprovalItem {
45
54
  /** Stable within a conversation, such as `<messageId>:<partId>`. */
@@ -65,6 +74,11 @@ export interface HubApprovalItem {
65
74
  } | null;
66
75
  /** Set when a permissions mode, not a person, approved it. */
67
76
  autoApproved?: string | null;
77
+ /**
78
+ * For an open call, what happens next without the viewer: it waits for the
79
+ * owner, and why, or it runs on its own once the agent's reply finishes.
80
+ */
81
+ wait?: HubApprovalWait | null;
68
82
  /** Files with line counts read by the host, replacing those the input declares. */
69
83
  files?: readonly HubActionFile[];
70
84
  bundle?: HubActionBundle | null;
@@ -19,4 +19,4 @@ export { HubApprovalsList, type HubApprovalsListProps } from './list';
19
19
  export { HubApprovalRow, type HubApprovalRowProps } from './row';
20
20
  export { HubActionReceiptCard, HubApprovalReceipts, type HubActionReceiptCardProps, type HubApprovalReceiptsProps } from './receipt';
21
21
  export { HubActionPreviewView } from './preview';
22
- export { HubApprovalPhasePill, HubProviderMark } from './parts';
22
+ export { HubApprovalPhasePill, HubApprovalWaitNote, HubProviderMark, openPhaseLabel } from './parts';
@@ -7,7 +7,7 @@ import {
7
7
  formatWhen,
8
8
  hubActionReceipt,
9
9
  presentHubAction
10
- } from "../chunk-BF7M3NW2.js";
10
+ } from "../chunk-MCAIZKQ5.js";
11
11
 
12
12
  // src/hub-approvals-react/dock.tsx
13
13
  import { useEffect, useMemo, useRef, useState as useState2 } from "react";
@@ -16,7 +16,7 @@ import { Button as Button2, Label, RadioGroup, RadioGroupItem } from "@tangle-ne
16
16
 
17
17
  // src/hub-approvals-react/parts.tsx
18
18
  import { useState } from "react";
19
- import { ChevronRight } from "lucide-react";
19
+ import { ChevronRight, Clock, Zap } from "lucide-react";
20
20
  import { ProviderIcon } from "@tangle-network/sandbox-ui/integrations";
21
21
  import { Button, StatusPill } from "@tangle-network/ui/primitives";
22
22
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -34,6 +34,18 @@ var PHASE_TONES = {
34
34
  function HubApprovalPhasePill({ phase, label }) {
35
35
  return /* @__PURE__ */ jsx(StatusPill, { tone: PHASE_TONES[phase], size: "md", className: "shrink-0 whitespace-nowrap", children: label ?? HUB_APPROVAL_PHASE_LABELS[phase] });
36
36
  }
37
+ function openPhaseLabel(item, blocked = "Owner decides") {
38
+ if (item.phase === "blocked") return blocked;
39
+ if (item.phase !== "waiting") return void 0;
40
+ return item.wait?.owner === false ? "Runs on its own" : "Waiting";
41
+ }
42
+ function HubApprovalWaitNote({ wait, className = "" }) {
43
+ const Icon = wait.owner ? Clock : Zap;
44
+ return /* @__PURE__ */ jsxs("p", { "data-hub-approval-wait": wait.code ?? (wait.owner ? "owner" : "auto"), className: `flex items-start gap-2 text-sm ${wait.owner ? "text-muted-foreground" : "text-[var(--surface-info-text)]"} ${className}`, children: [
45
+ /* @__PURE__ */ jsx(Icon, { "aria-hidden": true, className: "mt-0.5 size-4 shrink-0" }),
46
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 break-words", children: wait.reason })
47
+ ] });
48
+ }
37
49
  function HubProviderMark({ providerId, name, size = 28 }) {
38
50
  const inner = Math.round(size * 0.64);
39
51
  return /* @__PURE__ */ jsx(
@@ -480,7 +492,8 @@ function HubApprovalDock({ items, onDecide, permissions, onOpen, focusId, classN
480
492
  ] }),
481
493
  /* @__PURE__ */ jsx3(Progress, { item: active }),
482
494
  error?.id === active.id && active.phase === "waiting" && /* @__PURE__ */ jsx3("p", { role: "alert", className: "text-sm text-[var(--surface-danger-text)]", children: error.message }),
483
- active.phase === "blocked" && /* @__PURE__ */ jsx3("p", { className: "text-sm text-muted-foreground", children: "The workspace owner approves this request." }),
495
+ HUB_APPROVAL_OPEN_PHASES.has(active.phase) && active.wait && /* @__PURE__ */ jsx3(HubApprovalWaitNote, { wait: active.wait }),
496
+ active.phase === "blocked" && !active.wait && /* @__PURE__ */ jsx3("p", { className: "text-sm text-muted-foreground", children: "The workspace owner approves this request." }),
484
497
  decidable && permissionsOpen && scopes.length > 0 && /* @__PURE__ */ jsxs3("fieldset", { className: "space-y-2 rounded-xl border border-border bg-muted/30 px-3 py-3", children: [
485
498
  /* @__PURE__ */ jsx3("legend", { className: "sr-only", children: "Standing permission" }),
486
499
  scopes.length > 1 && /* @__PURE__ */ jsx3(
@@ -513,7 +526,7 @@ function HubApprovalDock({ items, onDecide, permissions, onOpen, focusId, classN
513
526
  " Dismiss"
514
527
  ] }),
515
528
  /* @__PURE__ */ jsx3("span", { className: "flex-1" }),
516
- decidable && choices && "never" in choices && /* @__PURE__ */ jsx3("span", { className: "text-sm text-muted-foreground", children: choices.never }),
529
+ decidable && choices && "never" in choices && !active.wait && /* @__PURE__ */ jsx3("span", { className: "text-sm text-muted-foreground", children: choices.never }),
517
530
  onOpen && /* @__PURE__ */ jsx3(Button2, { variant: "ghost", onClick: () => onOpen(active), children: "View in chat" })
518
531
  ] }),
519
532
  waitingCount > 0 && queue.length > 1 && active.phase !== "waiting" && /* @__PURE__ */ jsx3("p", { className: "text-sm text-muted-foreground", children: waitingCount === 1 ? "1 more request is waiting." : `${waitingCount} more requests are waiting.` })
@@ -581,10 +594,11 @@ function HubApprovalsList({ items, onSelect, selectedId, className = "" }) {
581
594
  /* @__PURE__ */ jsxs4("span", { className: "min-w-0 flex-1", children: [
582
595
  /* @__PURE__ */ jsx4("span", { className: "line-clamp-2 text-sm font-medium leading-5 text-foreground", children: title }),
583
596
  /* @__PURE__ */ jsx4("span", { className: "mt-0.5 block truncate text-sm text-muted-foreground", children: detail }),
584
- item.phase === "unknown" && /* @__PURE__ */ jsx4("span", { className: "mt-1 block text-sm text-[var(--surface-warning-text)]", children: HUB_APPROVAL_UNKNOWN_WARNING })
597
+ item.phase === "unknown" && /* @__PURE__ */ jsx4("span", { className: "mt-1 block text-sm text-[var(--surface-warning-text)]", children: HUB_APPROVAL_UNKNOWN_WARNING }),
598
+ (item.phase === "waiting" || item.phase === "blocked") && item.wait && /* @__PURE__ */ jsx4("span", { className: "mt-1 line-clamp-2 block text-sm text-muted-foreground", children: item.wait.reason })
585
599
  ] }),
586
600
  /* @__PURE__ */ jsxs4("span", { className: "flex shrink-0 items-center gap-1", children: [
587
- /* @__PURE__ */ jsx4(HubApprovalPhasePill, { phase: item.phase, label: item.phase === "waiting" ? "Waiting" : item.phase === "blocked" ? "Owner" : void 0 }),
601
+ /* @__PURE__ */ jsx4(HubApprovalPhasePill, { phase: item.phase, label: openPhaseLabel(item, "Owner") }),
588
602
  /* @__PURE__ */ jsx4(ChevronRight3, { "aria-hidden": true, className: "size-4 text-muted-foreground" })
589
603
  ] })
590
604
  ]
@@ -692,7 +706,7 @@ function HubApprovalRow({ item, expanded: controlled, onExpandedChange, onReview
692
706
  children: [
693
707
  /* @__PURE__ */ jsx6(HubProviderMark, { providerId: presentation.provider.id, name: presentation.provider.name, size: 24 }),
694
708
  /* @__PURE__ */ jsx6("span", { className: "min-w-0 flex-1 truncate text-sm font-medium text-foreground", children: title }),
695
- /* @__PURE__ */ jsx6(HubApprovalPhasePill, { phase: item.phase, label: item.phase === "waiting" ? "Waiting" : item.phase === "blocked" ? "Owner decides" : void 0 }),
709
+ /* @__PURE__ */ jsx6(HubApprovalPhasePill, { phase: item.phase, label: openPhaseLabel(item) }),
696
710
  /* @__PURE__ */ jsx6(ChevronDown2, { "aria-hidden": true, className: `size-4 shrink-0 text-muted-foreground transition-transform ${expanded ? "rotate-180" : ""}` })
697
711
  ]
698
712
  }
@@ -718,7 +732,9 @@ export {
718
732
  HubApprovalPhasePill,
719
733
  HubApprovalReceipts,
720
734
  HubApprovalRow,
735
+ HubApprovalWaitNote,
721
736
  HubApprovalsList,
722
- HubProviderMark
737
+ HubProviderMark,
738
+ openPhaseLabel
723
739
  };
724
740
  //# sourceMappingURL=index.js.map