@tangle-network/agent-app 0.60.33 → 0.60.35
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/dist/app-auth/index.js +1 -1
- package/dist/{chunk-BF7M3NW2.js → chunk-MCAIZKQ5.js} +1 -1
- package/dist/chunk-MCAIZKQ5.js.map +1 -0
- package/dist/{chunk-OYN2UY3K.js → chunk-WOTWQ2ST.js} +31 -1
- package/dist/{chunk-OYN2UY3K.js.map → chunk-WOTWQ2ST.js.map} +1 -1
- package/dist/email/index.d.ts +1 -1
- package/dist/email/index.js +3 -1
- package/dist/email/templates.d.ts +20 -0
- package/dist/hub-approvals/index.js +1 -1
- package/dist/hub-approvals/types.d.ts +14 -0
- package/dist/hub-approvals-react/index.d.ts +1 -1
- package/dist/hub-approvals-react/index.js +24 -8
- package/dist/hub-approvals-react/index.js.map +1 -1
- package/dist/hub-approvals-react/parts.d.ts +8 -1
- package/package.json +1 -1
- package/dist/chunk-BF7M3NW2.js.map +0 -1
package/dist/app-auth/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hub-approvals/types.ts","../src/hub-approvals/result.ts","../src/hub-approvals/unknown.ts","../src/hub-approvals/present.ts","../src/hub-approvals/index.ts"],"sourcesContent":["/**\n * The vocabulary of a Hub action that waits on a person: where it stands, what\n * it will do in the owner's words, and what it did once it ran.\n */\n\n/** Where one held action stands, as the dock, the list and the transcript show it. */\nexport type HubApprovalPhase =\n /** Held by Hub; the viewer can decide it. */\n | 'waiting'\n /** Held by Hub; someone else (the workspace owner) decides it. */\n | 'blocked'\n /** Approved here; the run has not started. */\n | 'queued'\n /** Approved; Hub is running the call. */\n | 'running'\n | 'done'\n /** Approved, but Hub could not run it. */\n | 'failed'\n /** The provider may have acted; verify there before requesting it again. */\n | 'unknown'\n | 'denied'\n | 'expired'\n\n/** Phases that still need someone's decision. */\nexport const HUB_APPROVAL_OPEN_PHASES: ReadonlySet<HubApprovalPhase> = new Set(['waiting', 'blocked'])\n/** Phases between a decision and its result. */\nexport const HUB_APPROVAL_ACTIVE_PHASES: ReadonlySet<HubApprovalPhase> = new Set(['queued', 'running'])\n\n/** A file a held write changes. Counts stay undefined until someone has read them. */\nexport interface HubActionFile {\n path: string\n /** A rename reads as a modification of its new path. */\n change: 'added' | 'modified' | 'deleted'\n additions?: number\n deletions?: number\n}\n\n/**\n * The change a held call serves, when it is one step of a larger change such\n * as a pull request. The dock then names the change rather than the step.\n */\nexport interface HubActionBundle {\n /** What the whole change does, e.g. `Open PR: Fix the hero on acme/site`. */\n title: string\n steps?: ReadonlyArray<{ label: string; state: 'done' | 'current' | 'upcoming' }>\n}\n\n/** Whether an open call waits for the owner, in the owner's words. */\nexport interface HubApprovalWait {\n /** True when nothing runs until the owner decides; false when a permission runs it. */\n owner: boolean\n /** One sentence: `Publishing always needs your approval.` or `Runs under this conversation’s auto-approve.` */\n reason: string\n /** A stable cause the host can test, e.g. `never_grantable`, `loop_guard`, `daily_cap`. */\n code?: string\n}\n\n/** One held Hub action and its decision, in the form every surface renders. */\nexport interface HubApprovalItem {\n /** Stable within a conversation, such as `<messageId>:<partId>`. */\n id: string\n /** `provider.action`, e.g. `github.pulls.propose`. */\n actionPath: string\n providerId: string\n /** The call's input as Hub received it. */\n input: unknown\n phase: HubApprovalPhase\n /** The connected account the action runs as, e.g. `octocat` or `ops@acme.com`. */\n account?: string | null\n requestedAt?: string | null\n /** When the decision window closes. */\n expiresAt?: string | null\n /** Hub's result, or a bounded projection of it from {@link summarizeHubResult}. */\n result?: unknown\n error?: string | null\n /** The standing permission granted with the approval. */\n grant?: { scope: string; expiresAt: string | null } | null\n /** Set when a permissions mode, not a person, approved it. */\n autoApproved?: string | null\n /**\n * For an open call, what happens next without the viewer: it waits for the\n * owner, and why, or it runs on its own once the agent's reply finishes.\n */\n wait?: HubApprovalWait | null\n /** Files with line counts read by the host, replacing those the input declares. */\n files?: readonly HubActionFile[]\n bundle?: HubActionBundle | null\n}\n\n/** A labelled value on a preview or a receipt. */\nexport interface HubActionField {\n label: string\n value: string\n href?: string\n /** Render in the monospace face: shas, ids, paths. */\n mono?: boolean\n}\n\n/** What a held call will do, shaped for its integration's renderer. */\nexport type HubActionPreview =\n | {\n kind: 'pull-request'\n repository?: string\n title?: string\n body?: string\n head?: string\n base?: string\n draft?: boolean\n files: readonly HubActionFile[]\n }\n | { kind: 'commit'; repository?: string; message?: string; tree?: string; parents: readonly string[] }\n | { kind: 'branch'; repository?: string; branch?: string; sha?: string }\n | { kind: 'files'; repository?: string; files: readonly HubActionFile[] }\n | { kind: 'issue'; repository?: string; number?: number; title?: string; body?: string; verdict?: string }\n | {\n kind: 'email'\n to: readonly string[]\n cc: readonly string[]\n bcc: readonly string[]\n subject?: string\n body?: string\n html: boolean\n reply: boolean\n }\n | {\n kind: 'post'\n channel: 'x' | 'linkedin' | 'slack'\n text: string\n /** The post's place, such as a Slack channel. */\n where?: string\n link?: { url: string; title?: string; description?: string }\n }\n | { kind: 'payment'; label: string; amount?: number; currency?: string; customer?: string; description?: string }\n | { kind: 'speech'; text: string; voice?: string; seconds?: number }\n | { kind: 'call'; to?: string; from?: string; purpose?: string }\n | {\n kind: 'event'\n title?: string\n start?: string\n end?: string\n location?: string\n attendees: readonly string[]\n description?: string\n }\n | { kind: 'fields'; fields: readonly HubActionField[] }\n\n/** A held call in the owner's words. */\nexport interface HubActionPresentation {\n provider: { id: string; name: string }\n /** The imperative, e.g. `Open pull request`. */\n action: string\n /** One line naming the action and its object, e.g. `Open PR: Fix the hero on acme/site`. */\n title: string\n /** Where it acts: a repository, recipients, a channel or a customer. */\n target?: string\n preview: HubActionPreview\n}\n\n/** What a decided call did, as its receipt shows it. */\nexport interface HubActionReceipt {\n provider: { id: string; name: string }\n /** The result in past tense, e.g. `Opened PR #123` or `Sent email to ada@acme.com`. */\n title: string\n /** The result's own page, when it has one: the pull request, the post, the event. */\n href?: string\n status: 'done' | 'unknown' | 'failed' | 'denied' | 'expired' | 'running' | 'waiting'\n fields: readonly HubActionField[]\n files?: readonly HubActionFile[]\n media?: { kind: 'audio'; src: string; seconds?: number }\n error?: string\n /** Guidance for an uncertain outcome, separate from a confirmed failure. */\n warning?: string\n}\n","/**\n * Hub results, read the same way by every receipt: unwrapped from Hub's\n * envelope and bounded before a host persists them.\n */\n\nconst MAX_DEPTH = 4\nconst MAX_KEYS = 24\nconst MAX_ITEMS = 50\nconst MAX_STRING = 600\n\nexport function asRecord(value: unknown): Record<string, unknown> {\n return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {}\n}\n\n/**\n * The provider's own result inside Hub's envelopes. `tools.invoke` answers\n * `{ result: … }` and a connector may wrap its body in `data`; a JSON string,\n * as an older host stored it, is parsed first.\n */\nexport function unwrapHubResult(value: unknown): unknown {\n let current: unknown = value\n if (typeof current === 'string') {\n const text = current\n try {\n current = JSON.parse(text)\n } catch {\n // An older host stored `Hub result: {…}`-style text with a JSON tail.\n const start = text.indexOf('{')\n if (start < 0) return value\n try {\n current = JSON.parse(text.slice(start))\n } catch {\n return value\n }\n }\n }\n for (let depth = 0; depth < 3; depth++) {\n const record = asRecord(current)\n const keys = Object.keys(record)\n const inner = keys.find((key) => key === 'result' || key === 'data')\n // Only a thin envelope is unwrapped; a body that happens to carry a `data`\n // field among its own fields is the result itself.\n if (!inner || keys.length > 3 || record[inner] === null || typeof record[inner] !== 'object') break\n current = record[inner]\n }\n return current\n}\n\nfunction bounded(value: unknown, depth: number): unknown {\n if (value === null || typeof value === 'boolean') return value\n if (typeof value === 'number') return Number.isFinite(value) ? value : null\n if (typeof value === 'string') return value.length > MAX_STRING ? `${value.slice(0, MAX_STRING - 1)}…` : value\n if (depth >= MAX_DEPTH) return undefined\n if (Array.isArray(value)) {\n return value.slice(0, MAX_ITEMS).map((item) => bounded(item, depth + 1)).filter((item) => item !== undefined)\n }\n if (typeof value === 'object') {\n const out: Record<string, unknown> = {}\n for (const [key, entry] of Object.entries(value as Record<string, unknown>).slice(0, MAX_KEYS)) {\n const kept = bounded(entry, depth + 1)\n if (kept !== undefined) out[key] = kept\n }\n return out\n }\n return undefined\n}\n\n/**\n * A bounded copy of a Hub result for a host to store with the decision: the\n * envelope removed, strings, arrays and nesting capped. Receipts read it in\n * place of the full result.\n */\nexport function summarizeHubResult(result: unknown): unknown {\n return bounded(unwrapHubResult(result), 0)\n}\n\n/** The first non-empty string among `keys`, searched one level into nested records. */\nexport function readText(value: unknown, ...keys: string[]): string | undefined {\n const record = asRecord(value)\n for (const key of keys) {\n const found = record[key]\n if (typeof found === 'string' && found.trim()) return found.trim()\n if (typeof found === 'number' && Number.isFinite(found)) return String(found)\n }\n return undefined\n}\n\nexport function readNumber(value: unknown, ...keys: string[]): number | undefined {\n const record = asRecord(value)\n for (const key of keys) {\n const found = record[key]\n if (typeof found === 'number' && Number.isFinite(found)) return found\n }\n return undefined\n}\n\n/** A link a result names for itself, in the order providers use them. */\nexport function resultLink(value: unknown): string | undefined {\n const url = readText(value, 'html_url', 'htmlLink', 'webLink', 'web_url', 'permalink', 'hosted_invoice_url', 'url', 'link')\n return url && /^https:\\/\\//.test(url) ? url : undefined\n}\n","/** Internal safety copy shared by uncertain-outcome surfaces. */\nexport const HUB_APPROVAL_UNKNOWN_WARNING = 'Check the provider before requesting it again'\n","/**\n * Hub actions in an owner's words. Known integrations read as what they do —\n * `github.pulls.propose` is \"Open PR: Fix the hero on acme/site\", `gmail.send`\n * is \"Send email to ada@acme.com\" — and any other Hub action falls back to its\n * own name and its input's scalar fields.\n */\n\nimport { asRecord, readNumber, readText, resultLink, unwrapHubResult } from './result'\nimport { HUB_APPROVAL_UNKNOWN_WARNING } from './unknown'\nimport type {\n HubActionField,\n HubActionFile,\n HubActionPresentation,\n HubActionPreview,\n HubActionReceipt,\n HubApprovalItem,\n} from './types'\n\nconst PROVIDER_NAMES: Record<string, string> = {\n github: 'GitHub',\n gitlab: 'GitLab',\n gmail: 'Gmail',\n google: 'Google',\n 'google-calendar': 'Google Calendar',\n 'microsoft-calendar': 'Outlook Calendar',\n 'outlook-mail': 'Outlook',\n outlook: 'Outlook',\n twitter: 'X',\n x: 'X',\n linkedin: 'LinkedIn',\n stripe: 'Stripe',\n phony: 'ph0ny',\n slack: 'Slack',\n notion: 'Notion',\n hubspot: 'HubSpot',\n linear: 'Linear',\n inkbox: 'Inkbox',\n resend: 'Resend',\n}\n\n/** A provider's display name: `github` is GitHub, `outlook-mail` is Outlook. */\nexport function hubProviderName(id: string): string {\n if (PROVIDER_NAMES[id]) return PROVIDER_NAMES[id]\n const words = id.split(/[-_\\s]+/).filter(Boolean)\n return words.map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(' ') || id\n}\n\n/** `provider.action` split at the first dot. */\nexport function splitHubActionPath(actionPath: string): { provider: string; action: string } {\n const separator = actionPath.indexOf('.')\n return separator < 0 ? { provider: '', action: actionPath } : { provider: actionPath.slice(0, separator), action: actionPath.slice(separator + 1) }\n}\n\nfunction text(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value.trim() : undefined\n}\n\nfunction clipped(value: string, max = 80): string {\n const single = value.replace(/\\s+/g, ' ').trim()\n return single.length > max ? `${single.slice(0, max - 1).trimEnd()}…` : single\n}\n\nfunction list(value: unknown): string[] {\n if (typeof value === 'string') return value.split(/[,;]/).map((entry) => entry.trim()).filter(Boolean)\n if (!Array.isArray(value)) return []\n return value.flatMap((entry) => {\n if (typeof entry === 'string' && entry.trim()) return [entry.trim()]\n const record = asRecord(entry)\n const address = text(record.email) ?? text(record.address) ?? text(asRecord(record.emailAddress).address)\n return address ? [address] : []\n })\n}\n\nfunction people(addresses: readonly string[]): string {\n if (addresses.length === 0) return ''\n if (addresses.length === 1) return addresses[0]!\n return `${addresses[0]} and ${addresses.length - 1} more`\n}\n\nfunction shortSha(sha: string | undefined): string | undefined {\n return sha && /^[0-9a-f]{7,}$/i.test(sha) ? sha.slice(0, 7) : sha\n}\n\n// ---------- verbs ----------\n\nconst PAST: Record<string, string> = {\n add: 'added', approve: 'approved', archive: 'archived', assign: 'assigned', book: 'booked', cancel: 'canceled',\n capture: 'captured', charge: 'charged', clone: 'cloned', close: 'closed', comment: 'commented', create: 'created',\n deactivate: 'deactivated', delete: 'deleted', enroll: 'enrolled', export: 'exported', finalize: 'finalized',\n forward: 'forwarded', import: 'imported', ingest: 'ingested', invite: 'invited', like: 'liked', make: 'made',\n merge: 'merged', move: 'moved', open: 'opened', pay: 'paid', place: 'placed', post: 'posted', provision: 'provisioned',\n publish: 'published', put: 'put', react: 'reacted', refund: 'refunded', remove: 'removed', reply: 'replied',\n retweet: 'reposted', review: 'reviewed', run: 'ran', save: 'saved', schedule: 'scheduled', send: 'sent', set: 'set',\n share: 'shared', start: 'started', stop: 'stopped', submit: 'submitted', subscribe: 'subscribed',\n synthesize: 'synthesized', transfer: 'transferred', translate: 'translated', update: 'updated', upload: 'uploaded',\n upsert: 'saved', void: 'voided', watch: 'watched', write: 'wrote',\n}\n\n/** The past tense of an English verb this vocabulary uses. */\nexport function pastTense(verb: string): string {\n const lower = verb.toLowerCase()\n const past = PAST[lower] ?? (lower.endsWith('e') ? `${lower}d` : `${lower}ed`)\n return verb.charAt(0) === verb.charAt(0).toUpperCase() ? past.charAt(0).toUpperCase() + past.slice(1) : past\n}\n\nfunction words(action: string): string[] {\n return action\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .split(/[._\\-\\s]+/)\n .map((word) => word.toLowerCase())\n .filter(Boolean)\n}\n\nfunction singular(word: string): string {\n if (word.endsWith('ies')) return `${word.slice(0, -3)}y`\n if (word.endsWith('sses') || word.endsWith('ss')) return word\n return word.endsWith('s') && word.length > 3 ? word.slice(0, -1) : word\n}\n\n/** A Hub action's own name as a sentence: `payment-intents.create` is \"Create payment intent\". */\nfunction genericVerb(action: string): { verb: string; noun: string } {\n const parts = words(action)\n const index = parts.findIndex((word) => word in PAST)\n if (index < 0) return { verb: '', noun: parts.join(' ') }\n const noun = [...parts.slice(0, index), ...parts.slice(index + 1)].map(singular).join(' ')\n return { verb: parts[index]!, noun }\n}\n\nfunction sentence(verb: string, noun: string): string {\n const phrase = [verb, noun].filter(Boolean).join(' ')\n return phrase.charAt(0).toUpperCase() + phrase.slice(1)\n}\n\n// ---------- inputs ----------\n\nfunction repository(input: Record<string, unknown>): string | undefined {\n const owner = text(input.owner)\n const repo = text(input.repo)\n if (owner && repo) return `${owner}/${repo}`\n return repo ?? text(input.repository)\n}\n\nfunction branchOf(ref: unknown): string | undefined {\n return text(ref)?.replace(/^refs\\/heads\\//, '')\n}\n\n/** The files a call writes, as its input declares them. */\nexport function hubActionFiles(actionPath: string, input: unknown): HubActionFile[] {\n const fields = asRecord(input)\n const { action } = splitHubActionPath(actionPath)\n const entries = action === 'git.createTree' ? fields.tree : fields.files\n if (!Array.isArray(entries)) return []\n return entries.flatMap((entry): HubActionFile[] => {\n const item = asRecord(entry)\n const path = text(item.path)\n if (!path) return []\n const deleted = item.delete === true || (item.sha === null && item.content === undefined)\n return [{ path, change: deleted ? 'deleted' : 'modified' }]\n })\n}\n\n/** Counted files replace declared ones by path; the declared order stays. */\nfunction mergedFiles(declared: readonly HubActionFile[], counted: readonly HubActionFile[] | undefined): HubActionFile[] {\n if (!counted || counted.length === 0) return [...declared]\n if (declared.length === 0) return [...counted]\n const byPath = new Map(counted.map((file) => [file.path, file]))\n return declared.map((file) => byPath.get(file.path) ?? file)\n}\n\nfunction emailPreview(input: Record<string, unknown>, reply: boolean): HubActionPreview {\n return {\n kind: 'email',\n to: list(input.to ?? input.recipients),\n cc: list(input.cc),\n bcc: list(input.bcc),\n subject: text(input.subject),\n body: text(input.body) ?? text(input.text) ?? text(input.html) ?? text(input.comment),\n html: input.html === true || text(input.bodyType)?.toLowerCase() === 'html' || typeof input.html === 'string',\n reply,\n }\n}\n\nfunction speechSeconds(input: Record<string, unknown>): number | undefined {\n const spoken = text(input.text)\n if (!spoken) return undefined\n const speed = typeof input.speed === 'number' && input.speed > 0 ? input.speed : 1\n // About 2.5 spoken words a second at normal speed.\n return Math.max(1, Math.round(spoken.split(/\\s+/).length / 2.5 / speed))\n}\n\nfunction voiceName(input: Record<string, unknown>): string | undefined {\n const voice = text(input.voiceId)\n // An opaque provider id says nothing to an owner; a named voice does.\n if (voice && !/^[0-9a-f-]{16,}$/i.test(voice) && voice.length <= 32) return voice.charAt(0).toUpperCase() + voice.slice(1)\n return text(input.provider)\n}\n\nconst CURRENCY_DIGITS: Record<string, number> = { jpy: 0, krw: 0, vnd: 0, clp: 0, bhd: 3, kwd: 3, omr: 3 }\n\n/** A Stripe minor-unit amount in its currency: `4900` USD is `$49.00`. */\nexport function formatMinorAmount(amount: number, currency = 'usd'): string {\n const code = currency.toLowerCase()\n const digits = CURRENCY_DIGITS[code] ?? 2\n try {\n return new Intl.NumberFormat('en-US', { style: 'currency', currency: code.toUpperCase(), minimumFractionDigits: digits })\n .format(amount / 10 ** digits)\n } catch {\n return `${(amount / 10 ** digits).toFixed(digits)} ${code.toUpperCase()}`\n }\n}\n\n/** Scalar input fields, for an action no renderer knows. */\nfunction scalarFields(input: Record<string, unknown>, max = 6): HubActionField[] {\n return Object.entries(input).flatMap(([key, value]): HubActionField[] => {\n if (key.startsWith('__')) return []\n if (typeof value === 'string' && value.trim()) return [{ label: labelOf(key), value: clipped(value, 160) }]\n if (typeof value === 'number' || typeof value === 'boolean') return [{ label: labelOf(key), value: String(value) }]\n const strings = Array.isArray(value) ? value.filter((entry): entry is string => typeof entry === 'string') : []\n return strings.length > 0 ? [{ label: labelOf(key), value: clipped(strings.join(', '), 160) }] : []\n }).slice(0, max)\n}\n\nfunction labelOf(key: string): string {\n const spaced = key.replace(/([a-z0-9])([A-Z])/g, '$1 $2').replace(/[_-]+/g, ' ').trim().toLowerCase()\n return spaced.charAt(0).toUpperCase() + spaced.slice(1)\n}\n\n// ---------- presentation ----------\n\ntype Presenter = (input: Record<string, unknown>, item: Pick<HubApprovalItem, 'actionPath' | 'files'>) => Omit<HubActionPresentation, 'provider'>\n\nfunction pullRequest(input: Record<string, unknown>, item: Pick<HubApprovalItem, 'actionPath' | 'files'>): Omit<HubActionPresentation, 'provider'> {\n const repo = repository(input)\n const title = text(input.title) ?? 'Untitled change'\n return {\n action: 'Open pull request',\n title: `Open PR: ${clipped(title)}${repo ? ` on ${repo}` : ''}`,\n ...(repo ? { target: repo } : {}),\n preview: {\n kind: 'pull-request',\n repository: repo,\n title,\n body: text(input.body),\n head: branchOf(input.branch ?? input.head),\n base: text(input.base),\n draft: item.actionPath.endsWith('.propose') ? true : input.draft === true,\n files: mergedFiles(hubActionFiles(item.actionPath, input), item.files),\n },\n }\n}\n\nfunction issueLike(verb: string, noun: string): Presenter {\n return (input) => {\n const repo = repository(input)\n const number = readNumber(input, 'issue_number', 'pull_number', 'number')\n const title = text(input.title)\n const object = number !== undefined ? `${noun} #${number}` : title ? `${noun}: ${clipped(title)}` : noun\n return {\n action: sentence(verb, noun.toLowerCase()),\n title: `${sentence(verb, object)}${repo ? ` on ${repo}` : ''}`,\n ...(repo ? { target: repo } : {}),\n preview: {\n kind: 'issue',\n repository: repo,\n number,\n title,\n body: text(input.body),\n verdict: text(input.event)?.toLowerCase().replace(/_/g, ' '),\n },\n }\n }\n}\n\nfunction sendEmail(verb: 'Send' | 'Save draft', reply = false): Presenter {\n return (input) => {\n const preview = emailPreview(input, reply)\n const recipients = preview.kind === 'email' ? people(preview.to) : ''\n const action = reply ? 'Send reply' : verb === 'Send' ? 'Send email' : 'Save draft'\n return {\n action,\n title: reply ? 'Send reply' : `${action}${recipients ? ` to ${recipients}` : ''}`,\n ...(recipients ? { target: recipients } : {}),\n preview,\n }\n }\n}\n\nfunction post(channel: 'x' | 'linkedin', reply = false): Presenter {\n return (input) => {\n const body = text(input.text) ?? text(input.commentary) ?? ''\n const url = text(input.url)\n const where = channel === 'x' ? 'X' : 'LinkedIn'\n return {\n action: reply ? `Reply on ${where}` : `Post on ${where}`,\n title: `${reply ? 'Reply' : 'Post'} on ${where}${body ? `: “${clipped(body, 60)}”` : ''}`,\n target: where,\n preview: {\n kind: 'post',\n channel,\n text: body,\n ...(url ? { link: { url, title: text(input.title), description: text(input.description) } } : {}),\n },\n }\n }\n}\n\nfunction payment(label: string): Presenter {\n return (input) => {\n const amount = readNumber(input, 'amount')\n const currency = text(input.currency)\n const customer = text(input.customerId) ?? text(input.customer) ?? text(input.email)\n const formatted = amount !== undefined ? formatMinorAmount(amount, currency) : undefined\n const object = formatted ? `${label} of ${formatted}` : label\n return {\n action: sentence('create', label),\n title: `${sentence('create', object)}${customer ? ` for ${customer}` : ''}`,\n ...(customer ? { target: customer } : {}),\n preview: { kind: 'payment', label, amount, currency, customer, description: text(input.description) },\n }\n }\n}\n\nfunction calendarEvent(input: Record<string, unknown>, _item?: Pick<HubApprovalItem, 'actionPath' | 'files'>): Omit<HubActionPresentation, 'provider'> {\n const title = text(input.summary) ?? text(input.title) ?? text(input.subject)\n return {\n action: 'Book event',\n title: title ? `Book “${clipped(title, 60)}”` : 'Book an event',\n preview: {\n kind: 'event',\n title,\n start: text(input.start) ?? text(asRecord(input.start).dateTime),\n end: text(input.end) ?? text(asRecord(input.end).dateTime),\n location: text(input.location) ?? text(asRecord(input.location).displayName),\n attendees: list(input.attendees),\n description: text(input.description),\n },\n }\n}\n\nconst PRESENTERS: Record<string, Presenter> = {\n 'github.pulls.propose': pullRequest,\n 'github.pulls.create': pullRequest,\n 'github.git.createTree': (input, item) => {\n const repo = repository(input)\n const files = mergedFiles(hubActionFiles(item.actionPath, input), item.files)\n return {\n action: 'Write files',\n title: `Write ${files.length === 1 ? files[0]!.path : `${files.length} files`}${repo ? ` to ${repo}` : ''}`,\n ...(repo ? { target: repo } : {}),\n preview: { kind: 'files', repository: repo, files },\n }\n },\n 'github.git.createCommit': (input) => {\n const repo = repository(input)\n const message = text(input.message)\n return {\n action: 'Create commit',\n title: `Commit${message ? ` “${clipped(message, 60)}”` : ''}${repo ? ` to ${repo}` : ''}`,\n ...(repo ? { target: repo } : {}),\n preview: { kind: 'commit', repository: repo, message, tree: text(input.tree), parents: list(input.parents) },\n }\n },\n 'github.git.createRef': (input) => {\n const repo = repository(input)\n const branch = branchOf(input.ref)\n return {\n action: 'Create branch',\n title: `Create branch ${branch ?? ''}${repo ? ` in ${repo}` : ''}`.replace(/\\s+/g, ' ').trim(),\n ...(repo ? { target: repo } : {}),\n preview: { kind: 'branch', repository: repo, branch, sha: text(input.sha) },\n }\n },\n 'github.pulls.merge': issueLike('merge', 'PR'),\n 'github.pulls.reviews.create': issueLike('review', 'PR'),\n 'github.issues.create': issueLike('open', 'Issue'),\n 'github.issues.update': issueLike('update', 'Issue'),\n 'github.issues.createComment': issueLike('comment on', 'Issue'),\n 'gmail.send': sendEmail('Send'),\n 'gmail.send_reply': sendEmail('Send', true),\n 'outlook-mail.send_message': sendEmail('Send'),\n 'outlook-mail.send_draft': sendEmail('Send'),\n 'outlook-mail.create_draft': sendEmail('Save draft'),\n 'outlook-mail.send_reply': sendEmail('Send', true),\n 'inkbox.email.send': sendEmail('Send'),\n 'resend.emails.send': sendEmail('Send'),\n 'resend.emails.reply': sendEmail('Send', true),\n 'twitter.tweets.create': post('x'),\n 'twitter.tweets.reply': post('x', true),\n 'x.tweets.create': post('x'),\n 'linkedin.posts.create': post('linkedin'),\n 'linkedin.shares.create': post('linkedin'),\n 'slack.post_message': (input) => {\n const channel = text(input.channel) ?? text(input.channelId)\n const where = channel ? (channel.startsWith('#') || /^[CDG][A-Z0-9]{6,}$/.test(channel) ? channel : `#${channel}`) : undefined\n return {\n action: 'Post in Slack',\n title: `Post in ${where ?? 'Slack'}`,\n ...(where ? { target: where } : {}),\n preview: { kind: 'post', channel: 'slack', text: text(input.text) ?? '', where },\n }\n },\n 'stripe.payment-intents.create': payment('payment'),\n 'stripe.payment-links.create': payment('payment link'),\n 'stripe.invoices.create': payment('invoice'),\n 'stripe.refunds.create': payment('refund'),\n 'stripe.subscriptions.create': payment('subscription'),\n 'phony.synthesize_speech': (input) => {\n const seconds = speechSeconds(input)\n const voice = voiceName(input)\n const detail = [voice, seconds ? `${seconds} s` : undefined].filter(Boolean)\n return {\n action: 'Create voice memo',\n title: `Create voice memo${detail.length ? ` (${detail.join(', ')})` : ''}`,\n preview: { kind: 'speech', text: text(input.text) ?? '', voice, seconds },\n }\n },\n 'phony.start_outbound_call': (input) => {\n const to = text(input.toNumber) ?? text(input.to)\n const mission = asRecord(input.mission)\n return {\n action: 'Start call',\n title: to ? `Call ${to}` : 'Start an outbound call',\n ...(to ? { target: to } : {}),\n preview: {\n kind: 'call',\n to,\n from: text(input.fromNumber),\n purpose: text(mission.goal) ?? text(mission.objective) ?? text(mission.summary) ?? text(input.missionId),\n },\n }\n },\n 'phony.create_agent': (input) => {\n const name = text(input.name)\n return {\n action: 'Create voice agent',\n title: `Create voice agent${name ? ` “${clipped(name, 60)}”` : ''}`,\n preview: { kind: 'fields', fields: scalarFields(input) },\n }\n },\n 'phony.update_agent': (input) => ({\n action: 'Update voice agent',\n title: 'Update a voice agent',\n preview: { kind: 'fields', fields: scalarFields(input) },\n }),\n 'phony.clone_voice': (input) => {\n const name = text(input.name)\n return {\n action: 'Clone voice',\n title: `Clone your voice${name ? ` as “${clipped(name, 60)}”` : ''}`,\n preview: { kind: 'fields', fields: scalarFields(input) },\n }\n },\n 'google-calendar.create_event': calendarEvent,\n 'google-calendar.book_slot': calendarEvent,\n 'google-calendar.update_event': (input, item) => {\n const event = calendarEvent(input, item)\n const title = event.preview.kind === 'event' ? event.preview.title : undefined\n return { ...event, action: 'Update event', title: title ? `Update “${clipped(title, 60)}”` : 'Update an event' }\n },\n 'microsoft-calendar.book_slot': calendarEvent,\n}\n\n/** A held call in the owner's words, with the preview its integration renders. */\nexport function presentHubAction(item: Pick<HubApprovalItem, 'actionPath' | 'providerId' | 'input' | 'files' | 'bundle'>): HubActionPresentation {\n const { provider: pathProvider, action } = splitHubActionPath(item.actionPath)\n const providerId = item.providerId || pathProvider\n const provider = { id: providerId, name: hubProviderName(providerId) }\n const input = asRecord(item.input)\n const known = PRESENTERS[item.actionPath]\n const presented = known\n ? known(input, item)\n : (() => {\n const { verb, noun } = genericVerb(action)\n const phrase = sentence(verb, noun) || action\n const object = text(input.name) ?? text(input.title) ?? text(input.subject) ?? text(input.label)\n return {\n action: phrase,\n title: object ? `${phrase} “${clipped(object, 60)}”` : phrase,\n preview: { kind: 'fields', fields: scalarFields(input) } as HubActionPreview,\n }\n })()\n return { provider, ...presented, ...(item.bundle ? { title: item.bundle.title } : {}) }\n}\n\n// ---------- receipts ----------\n\nfunction prField(result: Record<string, unknown>): HubActionField | undefined {\n const pull = asRecord(result.pullRequest)\n const number = readNumber(pull, 'number') ?? readNumber(result, 'number')\n if (number === undefined) return undefined\n return { label: 'Pull request', value: `#${number}`, href: resultLink(pull) ?? resultLink(result) }\n}\n\nfunction receiptTitle(item: HubApprovalItem, presentation: HubActionPresentation, result: Record<string, unknown>): string {\n const { action } = splitHubActionPath(item.actionPath)\n const input = asRecord(item.input)\n const pull = asRecord(result.pullRequest)\n const number = readNumber(pull, 'number') ?? readNumber(result, 'number')\n switch (item.actionPath) {\n case 'github.pulls.propose':\n case 'github.pulls.create':\n return number !== undefined ? `Opened PR #${number}` : 'Opened pull request'\n case 'github.git.createCommit': {\n const sha = shortSha(readText(result, 'sha'))\n return sha ? `Created commit ${sha}` : 'Created commit'\n }\n case 'github.git.createTree': {\n const files = hubActionFiles(item.actionPath, input).length\n return `Wrote ${files === 1 ? '1 file' : `${files} files`}`\n }\n case 'github.git.createRef':\n return `Created branch ${branchOf(readText(result, 'ref') ?? input.ref) ?? ''}`.trim()\n case 'github.issues.create':\n return number !== undefined ? `Opened issue #${number}` : 'Opened issue'\n case 'github.issues.createComment': {\n const on = readNumber(input, 'issue_number')\n return on !== undefined ? `Commented on #${on}` : 'Commented'\n }\n case 'github.pulls.reviews.create': {\n const on = readNumber(input, 'pull_number')\n return on !== undefined ? `Reviewed PR #${on}` : 'Reviewed pull request'\n }\n case 'github.pulls.merge': {\n const on = readNumber(input, 'pull_number')\n return on !== undefined ? `Merged PR #${on}` : 'Merged pull request'\n }\n case 'phony.synthesize_speech':\n return 'Created voice memo'\n }\n if (presentation.preview.kind === 'email') {\n const to = people(presentation.preview.to)\n if (presentation.preview.reply) return 'Sent reply'\n return action.includes('draft') && !action.startsWith('send') ? `Saved draft${to ? ` to ${to}` : ''}` : `Sent email${to ? ` to ${to}` : ''}`\n }\n if (presentation.preview.kind === 'post') {\n return presentation.preview.channel === 'slack' ? `Posted in ${presentation.preview.where ?? 'Slack'}` : `Posted on ${presentation.target ?? presentation.provider.name}`\n }\n if (presentation.preview.kind === 'event') {\n const verb = presentation.action === 'Update event' ? 'Updated' : 'Booked'\n return presentation.preview.title ? `${verb} “${clipped(presentation.preview.title, 60)}”` : `${verb} event`\n }\n if (presentation.preview.kind === 'call') return presentation.preview.to ? `Started call to ${presentation.preview.to}` : 'Started call'\n const [first = '', ...rest] = presentation.action.split(' ')\n return [pastTense(first), ...rest].join(' ')\n}\n\nfunction postLink(item: HubApprovalItem, result: Record<string, unknown>): string | undefined {\n const id = readText(result, 'id', 'urn', 'postUrn')\n if (!id) return resultLink(result)\n if (item.providerId === 'twitter' || item.providerId === 'x') return /^\\d+$/.test(id) ? `https://x.com/i/web/status/${id}` : resultLink(result)\n if (item.providerId === 'linkedin') return id.startsWith('urn:li:') ? `https://www.linkedin.com/feed/update/${id}/` : resultLink(result)\n return resultLink(result)\n}\n\nfunction receiptFields(item: HubApprovalItem, presentation: HubActionPresentation, result: Record<string, unknown>): HubActionField[] {\n const fields: HubActionField[] = []\n const preview = presentation.preview\n switch (preview.kind) {\n case 'pull-request': {\n const pr = prField(result)\n if (pr) fields.push(pr)\n const head = readText(result, 'branch') ?? preview.head\n const base = readText(result, 'base') ?? preview.base\n if (head && base) fields.push({ label: 'Branch', value: `${head} → ${base}`, mono: true })\n const commit = asRecord(result.commit)\n const sha = readText(commit, 'sha')\n if (sha) fields.push({ label: 'Commit', value: shortSha(sha)!, href: resultLink(commit), mono: true })\n const repo = readText(result, 'repository') ?? preview.repository\n if (repo) fields.push({ label: 'Repository', value: repo, href: `https://github.com/${repo}` })\n return fields\n }\n case 'commit': {\n const sha = readText(result, 'sha')\n if (sha) fields.push({ label: 'Commit', value: shortSha(sha)!, href: resultLink(result)?.includes('api.github.com') ? undefined : resultLink(result), mono: true })\n if (preview.message) fields.push({ label: 'Message', value: clipped(preview.message, 120) })\n return fields\n }\n case 'branch': {\n const branch = branchOf(readText(result, 'ref')) ?? preview.branch\n if (branch && preview.repository) fields.push({ label: 'Branch', value: branch, href: `https://github.com/${preview.repository}/tree/${branch}`, mono: true })\n return fields\n }\n case 'files': {\n const sha = readText(result, 'sha')\n if (sha) fields.push({ label: 'Tree', value: shortSha(sha)!, mono: true })\n return fields\n }\n case 'email': {\n if (preview.subject) fields.push({ label: 'Subject', value: clipped(preview.subject, 120) })\n if (preview.cc.length) fields.push({ label: 'Cc', value: preview.cc.join(', ') })\n return fields\n }\n case 'payment': {\n const amount = readNumber(result, 'amount', 'amount_total', 'total') ?? preview.amount\n const currency = readText(result, 'currency') ?? preview.currency\n if (amount !== undefined) fields.push({ label: 'Amount', value: formatMinorAmount(amount, currency) })\n const customer = readText(result, 'customer_email', 'customer') ?? preview.customer\n if (customer) fields.push({ label: 'Customer', value: customer, mono: customer.startsWith('cus_') })\n const status = readText(result, 'status')\n if (status) fields.push({ label: 'Status', value: status })\n return fields\n }\n case 'speech': {\n const seconds = readNumber(result, 'durationSeconds', 'duration')\n if (seconds !== undefined) fields.push({ label: 'Length', value: `${Math.round(seconds * 10) / 10} s` })\n if (preview.voice) fields.push({ label: 'Voice', value: preview.voice })\n return fields\n }\n case 'event': {\n if (preview.start) fields.push({ label: 'When', value: formatWhen(preview.start, preview.end) })\n if (preview.attendees.length) fields.push({ label: 'Guests', value: people(preview.attendees) })\n return fields\n }\n case 'call': {\n const status = readText(asRecord(result.call), 'status') ?? readText(result, 'status')\n if (status) fields.push({ label: 'Status', value: status })\n return fields\n }\n default: {\n const id = readText(result, 'id', 'number', 'key')\n if (id) fields.push({ label: 'ID', value: id, mono: true })\n const status = readText(result, 'status', 'state')\n if (status) fields.push({ label: 'Status', value: status })\n const name = readText(result, 'name', 'title')\n if (name) fields.push({ label: 'Name', value: clipped(name, 80) })\n return fields\n }\n }\n}\n\n/** A start and optional end in the viewer's locale: `Tue, Oct 14, 3:00 – 3:30 PM`. */\nexport function formatWhen(start: string, end?: string): string {\n const from = new Date(start)\n if (Number.isNaN(from.getTime())) return end ? `${start} – ${end}` : start\n const day = from.toLocaleDateString(undefined, { weekday: 'short', month: 'short', day: 'numeric' })\n const time = (date: Date) => date.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' })\n const to = end ? new Date(end) : null\n if (!to || Number.isNaN(to.getTime())) return `${day}, ${time(from)}`\n return to.toDateString() === from.toDateString() ? `${day}, ${time(from)} – ${time(to)}` : `${day}, ${time(from)} – ${to.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })}, ${time(to)}`\n}\n\nfunction receiptFiles(result: Record<string, unknown>): HubActionFile[] | undefined {\n if (!Array.isArray(result.files)) return undefined\n return result.files.flatMap((entry): HubActionFile[] => {\n const file = asRecord(entry)\n const path = text(file.path) ?? text(file.filename)\n if (!path) return []\n const status = text(file.status)\n const change = status === 'added' ? 'added' : status === 'removed' || status === 'deleted' ? 'deleted' : 'modified'\n return [{ path, change, additions: readNumber(file, 'additions'), deletions: readNumber(file, 'deletions') }]\n })\n}\n\n/** What a decided call did: its past-tense title, key fields, link, media and files. */\nexport function hubActionReceipt(item: HubApprovalItem): HubActionReceipt {\n const presentation = presentHubAction(item)\n const result = asRecord(unwrapHubResult(item.result))\n const status: HubActionReceipt['status'] = item.phase === 'done' || item.phase === 'unknown' || item.phase === 'failed' || item.phase === 'denied' || item.phase === 'expired'\n ? item.phase\n : item.phase === 'queued' || item.phase === 'running' ? 'running' : 'waiting'\n const base = { provider: presentation.provider, status }\n if (status === 'denied') return { ...base, title: `Denied: ${presentation.title}`, fields: [] }\n if (status === 'expired') return { ...base, title: `Expired: ${presentation.title}`, fields: [] }\n if (status === 'unknown') return { ...base, title: `May have run: ${presentation.title}`, fields: [], warning: HUB_APPROVAL_UNKNOWN_WARNING }\n if (status === 'failed') return { ...base, title: `Could not ${presentation.action.charAt(0).toLowerCase()}${presentation.action.slice(1)}`, fields: [], ...(item.error ? { error: item.error } : {}) }\n if (status !== 'done') return { ...base, title: presentation.title, fields: [] }\n const title = receiptTitle(item, presentation, result)\n const fields = receiptFields(item, presentation, result)\n const pull = asRecord(result.pullRequest)\n const href = presentation.preview.kind === 'post'\n ? postLink(item, result)\n : resultLink(pull) ?? (item.actionPath.startsWith('github.git.') ? undefined : resultLink(result))\n const audio = readText(result, 'audioUrl')\n const seconds = readNumber(result, 'durationSeconds', 'duration')\n const files = receiptFiles(result)\n return {\n ...base,\n title,\n ...(href ? { href } : {}),\n fields,\n ...(files && files.length ? { files } : {}),\n ...(audio && /^https:\\/\\//.test(audio) ? { media: { kind: 'audio' as const, src: audio, ...(seconds !== undefined ? { seconds } : {}) } } : {}),\n }\n}\n","/**\n * `./hub-approvals` — Hub actions that wait on a person, in the owner's words.\n *\n * Pure and browser-safe: a host maps its held calls into {@link HubApprovalItem}s\n * and every surface — the approval dock above the composer, the Approvals list\n * beside the conversation, and the receipts in the transcript — renders the\n * same presentation from them. Servers use {@link summarizeHubResult} to store\n * a bounded result with the decision.\n */\n\nimport type { HubApprovalPhase } from './types'\n\nexport * from './types'\nexport {\n formatMinorAmount,\n formatWhen,\n hubActionFiles,\n hubActionReceipt,\n hubProviderName,\n pastTense,\n presentHubAction,\n splitHubActionPath,\n} from './present'\nexport { summarizeHubResult, unwrapHubResult } from './result'\n\n/** A phase as a status label. */\nexport const HUB_APPROVAL_PHASE_LABELS: Record<HubApprovalPhase, string> = {\n waiting: 'Waiting for you',\n blocked: 'Waiting for the owner',\n queued: 'Queued',\n running: 'Running',\n done: 'Done',\n failed: 'Failed',\n unknown: 'May have run',\n denied: 'Denied',\n expired: 'Expired',\n}\n\n/**\n * The part type marking a user message that resumes the agent after a\n * decision. The message's text goes to the agent unchanged; a transcript\n * renders the decided actions' receipts in its place, never a chat bubble.\n */\nexport const HUB_APPROVAL_RESUME_PART = 'hub-approval-resume'\n\nexport interface HubApprovalResumePart {\n type: typeof HUB_APPROVAL_RESUME_PART\n /** The assistant message whose held calls this resume reports. */\n messageId: string\n}\n\n/** The resume marker among a message's parts, if it carries one. */\nexport function hubApprovalResumePart(parts: ReadonlyArray<Record<string, unknown>> | null | undefined): HubApprovalResumePart | null {\n for (const part of parts ?? []) {\n if (part?.type === HUB_APPROVAL_RESUME_PART && typeof part.messageId === 'string' && part.messageId) {\n return { type: HUB_APPROVAL_RESUME_PART, messageId: part.messageId }\n }\n }\n return null\n}\n"],"mappings":";AAwBO,IAAM,2BAA0D,oBAAI,IAAI,CAAC,WAAW,SAAS,CAAC;AAE9F,IAAM,6BAA4D,oBAAI,IAAI,CAAC,UAAU,SAAS,CAAC;;;ACrBtG,IAAM,YAAY;AAClB,IAAM,WAAW;AACjB,IAAM,YAAY;AAClB,IAAM,aAAa;AAEZ,SAAS,SAAS,OAAyC;AAChE,SAAO,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAAI,QAAmC,CAAC;AAC3G;AAOO,SAAS,gBAAgB,OAAyB;AACvD,MAAI,UAAmB;AACvB,MAAI,OAAO,YAAY,UAAU;AAC/B,UAAMA,QAAO;AACb,QAAI;AACF,gBAAU,KAAK,MAAMA,KAAI;AAAA,IAC3B,QAAQ;AAEN,YAAM,QAAQA,MAAK,QAAQ,GAAG;AAC9B,UAAI,QAAQ,EAAG,QAAO;AACtB,UAAI;AACF,kBAAU,KAAK,MAAMA,MAAK,MAAM,KAAK,CAAC;AAAA,MACxC,QAAQ;AACN,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,WAAS,QAAQ,GAAG,QAAQ,GAAG,SAAS;AACtC,UAAM,SAAS,SAAS,OAAO;AAC/B,UAA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EAAE,KAAK,IAAI,CAAC;AAAA,IACvB;AAAA,IACA,GAAI,SAAS,MAAM,SAAS,EAAE,MAAM,IAAI,CAAC;AAAA,IACzC,GAAI,SAAS,cAAc,KAAK,KAAK,IAAI,EAAE,OAAO,EAAE,MAAM,SAAkB,KAAK,OAAO,GAAI,YAAY,SAAY,EAAE,QAAQ,IAAI,CAAC,EAAG,EAAE,IAAI,CAAC;AAAA,EAC/I;AACF;;;ACjpBO,IAAM,4BAA8D;AAAA,EACzE,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AACX;AAOO,IAAM,2BAA2B;AASjC,SAAS,sBAAsB,OAAgG;AACpI,aAAW,QAAQ,SAAS,CAAC,GAAG;AAC9B,QAAI,MAAM,SAAS,4BAA4B,OAAO,KAAK,cAAc,YAAY,KAAK,WAAW;AACnG,aAAO,EAAE,MAAM,0BAA0B,WAAW,KAAK,UAAU;AAAA,IACrE;AAAA,EACF;AACA,SAAO;AACT;","names":["text","words"]}
|
|
@@ -300,6 +300,35 @@ function approvalEmail(product, input) {
|
|
|
300
300
|
footer: input.footer
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
|
+
function approvalDigestEmail(product, input) {
|
|
304
|
+
const count = input.actions.length;
|
|
305
|
+
if (count === 0) throw new TypeError("approvalDigestEmail needs at least one action");
|
|
306
|
+
const groups = /* @__PURE__ */ new Map();
|
|
307
|
+
for (const action of input.actions) {
|
|
308
|
+
const key = action.conversation ?? "";
|
|
309
|
+
const items2 = groups.get(key) ?? [];
|
|
310
|
+
items2.push({
|
|
311
|
+
title: action.summary,
|
|
312
|
+
...action.detail ? { detail: action.detail } : {},
|
|
313
|
+
...action.url ? { url: action.url } : {},
|
|
314
|
+
...action.approveUrl || action.denyUrl ? { links: [
|
|
315
|
+
...action.approveUrl ? [{ label: "Approve", url: action.approveUrl }] : [],
|
|
316
|
+
...action.denyUrl ? [{ label: "Deny", url: action.denyUrl }] : []
|
|
317
|
+
] } : {}
|
|
318
|
+
});
|
|
319
|
+
groups.set(key, items2);
|
|
320
|
+
}
|
|
321
|
+
const waiting = count === 1 ? "1 request is waiting" : `${count} requests are waiting`;
|
|
322
|
+
return renderEmail(product, {
|
|
323
|
+
subject: emailSubject(count === 1 ? "Approve: 1 request is waiting" : `Approve: ${count} requests are waiting`, product),
|
|
324
|
+
preheader: `${waiting} for your decision.`,
|
|
325
|
+
title: count === 1 ? "1 approval waiting" : `${count} approvals waiting`,
|
|
326
|
+
paragraphs: [`${waiting} for your decision. Each one runs only when you approve it.`],
|
|
327
|
+
sections: [...groups].map(([conversation, items2]) => ({ ...conversation ? { heading: conversation } : {}, items: items2 })),
|
|
328
|
+
primary: { label: "Review all", url: input.reviewUrl },
|
|
329
|
+
footer: input.footer
|
|
330
|
+
});
|
|
331
|
+
}
|
|
303
332
|
function inviteEmail(product, input) {
|
|
304
333
|
const role = input.role.toLowerCase();
|
|
305
334
|
const article = /^[aeiou]/.test(role) ? "an" : "a";
|
|
@@ -439,9 +468,10 @@ export {
|
|
|
439
468
|
emailPreviewHtml,
|
|
440
469
|
emailSender,
|
|
441
470
|
approvalEmail,
|
|
471
|
+
approvalDigestEmail,
|
|
442
472
|
inviteEmail,
|
|
443
473
|
digestEmail,
|
|
444
474
|
noticeEmail,
|
|
445
475
|
lintEmailHtml
|
|
446
476
|
};
|
|
447
|
-
//# sourceMappingURL=chunk-
|
|
477
|
+
//# sourceMappingURL=chunk-WOTWQ2ST.js.map
|
|
@@ -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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qNA+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, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\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\"> ${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(' · ')}</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\"> </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(' · ')] : []),\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 = '͏‌ '.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,0CACN,EAAE,IAAI;AAAA,0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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/Jwrd5WD64rJc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yGPWi4E6kgaSZSqhVI1Uua6OfJGXi+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, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\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\"> ${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(' · ')}</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\"> </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(' · ')] : []),\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 = '͏‌ '.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,YAAY;AAAA,sBACb,EAAE,QAAQ;AAAA,qBACX,EAAE,UAAU;AAAA,4BACL,EAAE,QAAQ;AAAA;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,IAAI,YAAY,EAAE,OAAO,IAAI,EAAE;AAC7C,MAAI,QAAQ,iBAAkB,OAAM,QAAQ,GAAG,KAAK,6BAA6B,gBAAgB,EAAE;AACnG,SAAO;AACT;","names":["entry","items"]}
|
package/dist/email/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/email/index.js
CHANGED
|
@@ -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-
|
|
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;
|