@joenandez/tldr 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/bin/tldr-agent +11 -0
  4. package/hooks/tldr-agent-capture-session-identity.sh +3 -2
  5. package/install/tldr-agent-bootstrap.sh +7 -0
  6. package/package.json +10 -6
  7. package/release/activation-manifest.json +6 -6
  8. package/release/payloads/arm64/TldrAgentAegis.pkg +0 -0
  9. package/release/payloads/arm64/tldr-agent.tar.gz +0 -0
  10. package/release/starport-release.json +14 -9
  11. package/skills/tldr/SKILL.md +43 -31
  12. package/src/lib/aegis_native_distribution.mjs +1 -1
  13. package/src/lib/aegis_protocol.mjs +1 -1
  14. package/src/lib/starport_aegis_package.mjs +53 -6
  15. package/src/lib/starport_onboarding.mjs +303 -6
  16. package/src/lib/starport_orchestrator.mjs +21 -20
  17. package/src/lib/starport_release_contract.mjs +48 -10
  18. package/src/lib/starport_runtime.mjs +131 -13
  19. package/src/lib/tightbeam_channel.mjs +83 -123
  20. package/src/lib/tightbeam_channel_runtime.mjs +131 -33
  21. package/src/lib/tightbeam_email_adapter.mjs +10 -0
  22. package/src/lib/tightbeam_email_delivery_channel.mjs +107 -133
  23. package/src/lib/tightbeam_email_provider_map.mjs +337 -0
  24. package/src/lib/tightbeam_inbound_publish.mjs +84 -0
  25. package/src/lib/tightbeam_welcome_dispatch.mjs +129 -33
  26. package/src/lib/tldr_agent_daemon_health.mjs +2 -1
  27. package/src/lib/tldr_agent_daemon_phase_timeouts.mjs +3 -5
  28. package/src/lib/tldr_agent_diagnostic_schema.mjs +1 -0
  29. package/src/lib/tldr_agent_launchd_definition.mjs +2 -0
  30. package/src/lib/tldr_agent_launchd_lifecycle.mjs +41 -10
  31. package/src/lib/tldr_agent_runtime_identity.mjs +14 -2
  32. package/src/lib/tldr_agent_source_lifecycle.mjs +18 -4
  33. package/src/lib/transports/email/render/email.mjs +66 -180
  34. package/src/lib/transports/email/render/html.mjs +37 -80
  35. package/src/lib/transports/email/render/text.mjs +2 -2
  36. package/src/lib/transports/email/render/tldr.mjs +10 -88
  37. package/src/lib/transports/email/render/tokens.mjs +56 -75
  38. package/src/lib/transports/email/templates.mjs +38 -27
  39. package/src/lib/transports/email.mjs +21 -1
  40. package/src/starport.mjs +12 -0
  41. package/src/lib/transports/email/render/glyphs.mjs +0 -66
@@ -1,20 +1,15 @@
1
- /* tldr; — Markdown tree to email HTML.
1
+ /* Markdown tree to quiet, client-safe email HTML.
2
2
  *
3
3
  * Every block becomes a row in one outer table and carries its whole style in a
4
4
  * style attribute, because a client that strips <style> must still get the
5
5
  * document right. Classes are emitted alongside, and only ever used by the
6
6
  * night-lighting media query.
7
7
  *
8
- * Rules this file exists to hold:
9
- * - flat. A change of plane or a 1px boundary, never a shadow.
10
- * - the reading face sets every sentence; the condensed face sets short
11
- * phrases and meaningful numerals; mono sets things you could type.
12
- * - no citron. The live edge is the envelope's judgment about the message,
13
- * not something the agent's Markdown can reach for. Nothing in this file
14
- * can emit the accent, which is a stronger guarantee than a budget.
8
+ * The body should read like well-formatted correspondence: one native reading
9
+ * face, restrained neutral structure, and blue reserved for actual links.
15
10
  */
16
11
 
17
- import { BODY, DISPLAY, MONO, RADIUS, TYPE } from "./tokens.mjs";
12
+ import { BODY, MONO, RADIUS, TYPE } from "./tokens.mjs";
18
13
  import { parseInline } from "./markdown.mjs";
19
14
 
20
15
  export function esc(value) {
@@ -42,18 +37,9 @@ export function inlineHtml(nodes, t) {
42
37
  case "softbreak":
43
38
  return " ";
44
39
  case "code":
45
- /* Identifiers, flags and file paths — the densest thing in agent
46
- * prose, six to a paragraph in a real handoff.
47
- *
48
- * The chip is a fill and not a bounded box. A 1px boundary around
49
- * every identifier puts four hard edges into the middle of a sentence
50
- * and the paragraph stops being readable; the powder fill separates
51
- * the token just as clearly with no edge at all. A code block is a
52
- * slab and gets the boundary; an identifier is a word and gets a
53
- * highlight. */
54
40
  return (
55
41
  `<code class="tl-code" style="font-family:${MONO};font-size:.95em;` +
56
- `background:${t.field};color:${t.ink};border-radius:${RADIUS.sm};` +
42
+ `background:${t.raised};color:${t.ink};border-radius:${RADIUS.sm};` +
57
43
  `padding:1px 4px;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;">${esc(node.value)}</code>`
58
44
  );
59
45
  case "strong":
@@ -63,8 +49,6 @@ export function inlineHtml(nodes, t) {
63
49
  case "strike":
64
50
  return `<span class="tl-muted" style="text-decoration:line-through;color:${t.muted};">${inlineHtml(node.children, t)}</span>`;
65
51
  case "link":
66
- /* Link blue, underlined, always. The identity colour is the one the
67
- * whole world already reads as "this goes somewhere". */
68
52
  return (
69
53
  `<a class="tl-link" href="${esc(node.href)}" style="color:${t.link};` +
70
54
  `text-decoration:underline;overflow-wrap:anywhere;word-break:break-word;">${inlineHtml(node.children, t)}</a>`
@@ -89,7 +73,7 @@ function imagePlaceholder(node, t) {
89
73
  `<a class="tl-muted" href="${esc(node.href)}" style="color:${t.muted};text-decoration:underline;">${esc(node.href)}</a></div>`
90
74
  : "";
91
75
  return (
92
- `<div class="tl-raised" style="border:1px solid ${t.line};border-radius:${RADIUS.sm};background:${t.raised};padding:14px 16px;">` +
76
+ `<div class="tl-raised" style="border:1px solid ${t.line};border-radius:${RADIUS.sm};background:${t.raised};padding:12px 14px;">` +
93
77
  `<div class="tl-muted" style="${TYPE.tag}color:${t.muted};text-transform:uppercase;padding-bottom:6px;">Image — not loaded</div>` +
94
78
  `<div class="tl-ink" style="${TYPE.small}color:${t.ink};">${esc(label)}</div>${href}</div>`
95
79
  );
@@ -97,18 +81,16 @@ function imagePlaceholder(node, t) {
97
81
 
98
82
  /* ---------------------------------------------------------------- blocks */
99
83
 
100
- /* The declared spacing scale. A normal transition is 24; a major reading
101
- * section separates by 40; a heading always takes more space above than below. */
102
84
  const GAP = {
103
- paragraph: 16,
104
- heading: 40,
105
- subheading: 28,
106
- list: 16,
107
- code: 24,
108
- table: 24,
109
- quote: 24,
110
- rule: 24,
111
- image: 24,
85
+ paragraph: 14,
86
+ heading: 28,
87
+ subheading: 22,
88
+ list: 14,
89
+ code: 20,
90
+ table: 20,
91
+ quote: 20,
92
+ rule: 20,
93
+ image: 20,
112
94
  };
113
95
 
114
96
  export function blocksHtml(nodes, t, { first = true } = {}) {
@@ -116,7 +98,7 @@ export function blocksHtml(nodes, t, { first = true } = {}) {
116
98
  let isFirst = first;
117
99
 
118
100
  const rows = nodes.map((node) => {
119
- const gap = isFirst ? 0 : afterHeading ? 12 : GAP[gapKey(node)];
101
+ const gap = isFirst ? 0 : afterHeading ? 8 : GAP[gapKey(node)];
120
102
  isFirst = false;
121
103
  afterHeading = node.type === "heading";
122
104
  return `<tr><td style="padding:${gap}px 0 0 0;">${blockHtml(node, t)}</td></tr>`;
@@ -177,24 +159,18 @@ function onlyImage(node) {
177
159
  : null;
178
160
  }
179
161
 
180
- /* The subject owns the top of the document, so `#` is a section rather than a
181
- * competing title. Sections are where the condensed face does its work: a short
182
- * phrase at 21px over a 1px link-blue rule. */
183
162
  function headingHtml(node, t) {
184
163
  const text = inlineText(node.text, t);
185
164
  if (node.level <= 2) {
186
- return table(
187
- `<tr><td class="tl-ink" style="${TYPE.section}color:${t.ink};padding:0 0 8px 0;">${text}</td></tr>` +
188
- `<tr><td style="padding:0;"><div class="tl-hair-link" style="height:1px;background:${t.link};font-size:0;line-height:1px;">&nbsp;</div></td></tr>`,
189
- );
165
+ return `<div class="tl-ink" style="${TYPE.section}color:${t.ink};">${text}</div>`;
190
166
  }
191
- return `<div class="tl-muted" style="${TYPE.sub}color:${t.muted};">${text}</div>`;
167
+ return `<div class="tl-ink" style="${TYPE.sub}color:${t.ink};">${text}</div>`;
192
168
  }
193
169
 
194
170
  /* Fenced code with an info string takes a muted label above the field. It is how
195
171
  * you know at a glance whether you are looking at a shell, a diff or a config. */
196
172
  function codeHtml(node, t) {
197
- const lang = node.lang ? node.lang.toUpperCase() : "";
173
+ const lang = node.lang ? node.lang : "";
198
174
  const label = lang
199
175
  ? `<tr><td class="tl-muted" style="${TYPE.tag}color:${t.muted};padding:0 0 6px 0;">${esc(lang)}</td></tr>`
200
176
  : "";
@@ -207,20 +183,17 @@ function codeHtml(node, t) {
207
183
  return table(
208
184
  label +
209
185
  `<tr><td class="tl-raised" style="border:1px solid ${t.line};border-radius:${RADIUS.sm};background:${t.raised};` +
210
- `padding:14px 16px;${TYPE.code}color:${t.ink};white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;">${body}</td></tr>`,
186
+ `padding:12px 14px;${TYPE.code}color:${t.ink};white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-all;">${body}</td></tr>`,
211
187
  );
212
188
  }
213
189
 
214
- /* No red and no green, anywhere. A diff is weighted instead: additions at full
215
- * ink and bold, removals receded, hunk headers set as labels. It survives a
216
- * monochrome print and a colour-blind reader unchanged. */
217
190
  function diffLine(line, t) {
218
191
  const safe = esc(line) || "&nbsp;";
219
192
  if (line.startsWith("@@")) {
220
193
  return `<span class="tl-muted" style="color:${t.muted};letter-spacing:.04em;">${safe}</span>`;
221
194
  }
222
195
  if (line.startsWith("+")) {
223
- return `<span class="tl-ink" style="color:${t.ink};font-weight:700;">${safe}</span>`;
196
+ return `<span class="tl-ink" style="color:${t.ink};font-weight:600;">${safe}</span>`;
224
197
  }
225
198
  return `<span class="tl-muted" style="color:${t.muted};">${safe}</span>`;
226
199
  }
@@ -250,7 +223,7 @@ function quoteHtml(node, t) {
250
223
  if (band) return bandHtml(band.label, blocksHtml(band.children, t), t);
251
224
  return table(
252
225
  `<tr><td width="1" class="tl-hair" style="background:${t.line};width:1px;font-size:0;line-height:1px;">&nbsp;</td>` +
253
- `<td class="tl-muted" style="padding:0 0 0 16px;color:${t.muted};">${quoteInner(node.children, t)}</td></tr>`,
226
+ `<td class="tl-muted" style="padding:0 0 0 14px;color:${t.muted};">${quoteInner(node.children, t)}</td></tr>`,
254
227
  );
255
228
  }
256
229
 
@@ -263,38 +236,27 @@ function quoteInner(children, t) {
263
236
  );
264
237
  }
265
238
 
266
- /* The banded box: a solid identity-plane tab over a bounded field. Bands are
267
- * told apart by the word, never by a colour — there is no warning amber and no
268
- * error red in this system, and a reader who cannot separate two hues still
269
- * reads CAUTION and ABORT perfectly. */
270
239
  export function bandHtml(label, innerHtml, t) {
271
240
  return table(
272
- `<tr><td style="padding:0;"><span class="tl-tab" style="display:inline-block;background:${t.solid};` +
273
- `color:${t.onSolid};${TYPE.chip}text-transform:uppercase;border-radius:${RADIUS.sm} ${RADIUS.sm} 0 0;padding:5px 10px;">${esc(label)}</span></td></tr>` +
274
- `<tr><td class="tl-raised" style="border:1px solid ${t.line};border-radius:0 ${RADIUS.sm} ${RADIUS.sm} ${RADIUS.sm};` +
275
- `background:${t.raised};padding:14px 16px;">${innerHtml}</td></tr>`,
241
+ `<tr><td class="tl-raised" style="border:1px solid ${t.strongLine};border-radius:${RADIUS.sm};` +
242
+ `background:${t.raised};padding:12px 14px;">` +
243
+ `<div class="tl-ink" style="${TYPE.label}color:${t.ink};padding:0 0 8px 0;">${esc(label)}</div>` +
244
+ `${innerHtml}</td></tr>`,
276
245
  );
277
246
  }
278
247
 
279
- /* Lists are tables. Real <ul>/<ol> lose their indentation in Outlook, and the
280
- * numerals belong in a fixed gutter anyway. */
281
248
  function listHtml(node, t) {
282
249
  const rows = node.items.map((item, index) => {
283
250
  const marker =
284
251
  item.checked === null
285
252
  ? node.ordered
286
- ? /* The numeral device: an oversized condensed figure indexing a real
287
- * step. Numerals are never decorative and never invented. */
288
- `<span class="tl-link" style="${TYPE.numeral}color:${t.link};">${node.start + index}</span>`
289
- : `<span class="tl-line" style="font-family:${BODY};font-size:16px;line-height:1;color:${t.line};">&#8212;</span>`
253
+ ? `<span class="tl-muted" style="font-family:${BODY};font-size:13px;line-height:1.4;color:${t.muted};">${node.start + index}.</span>`
254
+ : `<span class="tl-muted" style="font-family:${BODY};font-size:13.5px;line-height:1;color:${t.muted};">&bull;</span>`
290
255
  : checkbox(item.checked, t);
291
256
 
292
- const gutter = node.ordered ? 30 : 22;
293
- const pad = node.loose ? 6 : 3;
294
- /* A 20px numeral and a 16px body line do not share a baseline on their own,
295
- * and a checkbox is a block in a line box rather than a glyph on a baseline.
296
- * Each marker gets the offset that seats it optically. */
297
- const top = item.checked === null ? pad + (node.ordered ? 1 : 5) : pad + 5;
257
+ const gutter = node.ordered ? 24 : 18;
258
+ const pad = node.loose ? 5 : 3;
259
+ const top = item.checked === null ? pad + (node.ordered ? 2 : 4) : pad + 4;
298
260
  return (
299
261
  `<tr><td width="${gutter}" align="${node.ordered ? "right" : "left"}" valign="top" ` +
300
262
  `style="padding:${top}px 10px ${pad}px 0;line-height:1;">${marker}</td>` +
@@ -304,26 +266,21 @@ function listHtml(node, t) {
304
266
  return table(rows.join(""));
305
267
  }
306
268
 
307
- /* Completion has no colour of its own: a done item is a solid identity-plane box
308
- * with the check reversed out of it, so if a client drops the glyph the filled
309
- * box still reads as done. */
310
269
  function checkbox(checked, t) {
311
270
  const box = `display:inline-block;width:13px;height:13px;line-height:13px;text-align:center;border-radius:${RADIUS.sm};`;
312
271
  return checked
313
- ? `<span class="tl-check-on" style="${box}background:${t.solid};color:${t.onSolid};font-family:${BODY};font-size:10px;font-weight:700;">&#10003;</span>`
314
- : `<span class="tl-check-off" style="${box}border:1px solid ${t.line};">&nbsp;</span>`;
272
+ ? `<span class="tl-check-on" style="${box}background:${t.ink};color:${t.stock};font-family:${BODY};font-size:10px;font-weight:600;">&#10003;</span>`
273
+ : `<span class="tl-check-off" style="${box}border:1px solid ${t.strongLine};">&nbsp;</span>`;
315
274
  }
316
275
 
317
- /* A ledger, not a grid: condensed caps heads over a solid rule, 1px separators
318
- * between rows, no cell borders and no zebra. */
319
276
  function tableHtml(node, t) {
320
277
  const last = node.headers.length - 1;
321
278
  const head = node.headers
322
279
  .map(
323
280
  (cell, i) =>
324
281
  `<td align="${node.align[i]}" class="tl-ink" style="${TYPE.tableHead}color:${t.ink};` +
325
- `text-transform:uppercase;padding:0 ${i === last ? 0 : 14}px 8px 0;` +
326
- `border-bottom:1px solid ${t.ink};vertical-align:bottom;">${inlineText(cell, t)}</td>`,
282
+ `padding:0 ${i === last ? 0 : 12}px 7px 0;` +
283
+ `border-bottom:1px solid ${t.strongLine};vertical-align:bottom;">${inlineText(cell, t)}</td>`,
327
284
  )
328
285
  .join("");
329
286
 
@@ -334,7 +291,7 @@ function tableHtml(node, t) {
334
291
  .map(
335
292
  (cell, i) =>
336
293
  `<td align="${node.align[i]}" class="tl-ink tl-ruled" style="${TYPE.tableCell}color:${t.ink};` +
337
- `padding:9px ${i === last ? 0 : 14}px 9px 0;border-bottom:1px solid ${t.line};vertical-align:top;">` +
294
+ `padding:8px ${i === last ? 0 : 12}px 8px 0;border-bottom:1px solid ${t.line};vertical-align:top;">` +
338
295
  `${inlineText(cell, t)}</td>`,
339
296
  )
340
297
  .join("")}</tr>`,
@@ -344,4 +301,4 @@ function tableHtml(node, t) {
344
301
  return table(`<tr>${head}</tr>${body}`);
345
302
  }
346
303
 
347
- export { table as presentationTable, imagePlaceholder, DISPLAY, BODY, MONO };
304
+ export { table as presentationTable, imagePlaceholder, BODY, MONO };
@@ -2,8 +2,8 @@
2
2
  *
3
3
  * The plain-text twin is an equal document, not a stripped fallback. It comes
4
4
  * off the same tree as the HTML, so the two cannot say different things, and it
5
- * keeps the structure the HTML carries: the TLDR block, banded boxes, ledger
6
- * tables, a numbered gutter.
5
+ * keeps the structure the HTML carries: headings, callouts, ledger tables and
6
+ * list gutters. Product metadata stays below a conventional signature divider.
7
7
  *
8
8
  * Fixed 72-column measure. Wider wraps badly in the clients that show plain text
9
9
  * at all, and narrower breaks the tables.
@@ -1,25 +1,12 @@
1
- /* tldr; — the TLDR block.
1
+ /* Message semantics retained independently from presentation.
2
2
  *
3
- * The product's name made literal, and the one place this system speaks above
4
- * the agent. It carries the result, the owner action and the next moment, and it
5
- * invents none of them.
6
- *
7
- * The subject's grammar is already "state word, colon, the decision", so the
8
- * state word becomes the action and the decision becomes the result. The block
9
- * sets a structure that was always in the string; it does not add a claim to it.
10
- * That is also why the subject is never printed twice — a card that repeats its
11
- * own subject above a summary of its own subject has spent the owner's first two
12
- * seconds saying one thing three times.
13
- *
14
- * THE LIVE EDGE lives here. Citron means the point where attention is active, so
15
- * it appears on the action chip when the message needs the owner and nowhere at
16
- * all when it does not. Seeing citron in an inbox has to mean something.
3
+ * State/action resolution still supports callers and future optional summaries,
4
+ * but the ordinary correspondence renderer does not turn it into a branded
5
+ * panel or badge. The agent's words own the visible hierarchy.
17
6
  */
18
7
 
19
- import { RADIUS, TYPE } from "./tokens.mjs";
8
+ import { inlineHtml } from "./html.mjs";
20
9
  import { parseInline, parseMarkdown } from "./markdown.mjs";
21
- import { bandOf, esc, inlineHtml, presentationTable as pt } from "./html.mjs";
22
- import { glyph } from "./glyphs.mjs";
23
10
 
24
11
  export const ACTION = Object.freeze({
25
12
  now: "Needs you now",
@@ -27,22 +14,10 @@ export const ACTION = Object.freeze({
27
14
  none: "Nothing needed",
28
15
  });
29
16
 
30
- /* State words an agent actually writes, mapped to what they mean for the owner.
31
- * A word on neither list resolves to "later", which is the only honest default:
32
- * the message is not shouting, and claiming nothing is needed would be this
33
- * system putting words in the agent's mouth. */
34
17
  const NOW_STATES =
35
18
  /^(needs you|needs text|blocked|can[’']?t resume|action needed|verify)/i;
36
19
  const NONE_STATES =
37
20
  /^(done|got it|complete|completed|finished|delivered|text only)/i;
38
-
39
- /* Lifting the state word off the front leaves the decision starting in lower
40
- * case, and the decision is about to be set as the loudest line in the message.
41
- * It gets a capital.
42
- *
43
- * Not when the first word is an identifier, though: `org_id`, a path, a flag or
44
- * a version string is a thing with a spelling, and capitalising it would be this
45
- * renderer editing the agent's fact rather than its sentence. */
46
21
  const IDENTIFIER = /^[^\s]*[_/.\-@][^\s]*/;
47
22
 
48
23
  const sentenceCase = (value) =>
@@ -50,7 +25,6 @@ const sentenceCase = (value) =>
50
25
  ? value
51
26
  : value[0].toUpperCase() + value.slice(1);
52
27
 
53
- /* The subject's fixed grammar, split into the two things it already contains. */
54
28
  export function splitSubject(subject) {
55
29
  const match = /^([^:]{2,24}):\s*(.+)$/s.exec(String(subject).trim());
56
30
  if (!match) return { state: null, result: String(subject).trim() };
@@ -61,8 +35,9 @@ export function resolveAction(spec) {
61
35
  if (spec.action && ACTION[spec.action]) return spec.action;
62
36
 
63
37
  const raised = parseMarkdown(spec.body ?? "").some((node) => {
64
- const band = node.type === "quote" ? bandOf(node) : null;
65
- return band?.label === "CAUTION" || band?.label === "ABORT";
38
+ if (node.type !== "quote") return false;
39
+ const text = node.children?.[0]?.text?.trim() ?? "";
40
+ return /^\*\*(CAUTION|ABORT)\*\*/.test(text);
66
41
  });
67
42
  if (raised) return "now";
68
43
 
@@ -72,59 +47,6 @@ export function resolveAction(spec) {
72
47
  return "later";
73
48
  }
74
49
 
75
- /* Exactly one element may be citron, and only when something is live. */
76
50
  export const isLive = (spec) => resolveAction(spec) === "now";
77
-
78
- function chipHtml(action, t) {
79
- const label = ACTION[action];
80
- if (action === "none") {
81
- return `<span class="tl-muted" style="${TYPE.chip}color:${t.muted};text-transform:uppercase;">${label}</span>`;
82
- }
83
- const live = action === "now";
84
- return (
85
- `<span class="${live ? "tl-chip-live" : "tl-chip-wait"}" style="display:inline-block;` +
86
- `background:${live ? t.accent : t.solid};color:${live ? t.onAccent : t.onSolid};` +
87
- `${TYPE.chip}text-transform:uppercase;border-radius:${RADIUS.sm};padding:5px 9px;">${label}</span>`
88
- );
89
- }
90
-
91
- /* The reply sentence is written by this system, and it writes Markdown in it —
92
- * the recovery state's line is "Run `tldr status` for the next repair step."
93
- * Escaping it would ship literal backticks in the one sentence that says what to
94
- * do. Parsing is not a licence to emit markup: it goes through the same inline
95
- * parser as the body, which escapes text and only ever emits our own tags. */
96
- export const inlineMarkdownHtml = (value, t) =>
97
- inlineHtml(parseInline(value), t);
98
-
99
- export function tldrHtml(spec, t, reply) {
100
- const { result } = splitSubject(spec.subject);
101
- const action = resolveAction(spec);
102
-
103
- const head = pt(
104
- `<tr>` +
105
- `<td class="tl-link" style="${TYPE.tldrLabel}color:${t.link};text-transform:uppercase;vertical-align:middle;">TLDR</td>` +
106
- `<td align="right" style="vertical-align:middle;padding-left:12px;">${chipHtml(action, t)}</td>` +
107
- `</tr>`,
108
- );
109
-
110
- /* The one instruction in the message, marked by the one glyph in the system. */
111
- const next = pt(
112
- `<tr>` +
113
- `<td width="28" valign="top" style="padding:5px 12px 0 0;">${glyph("reply", t.link, "tl-fill-link")}</td>` +
114
- `<td class="tl-ink" style="${TYPE.small}color:${t.ink};">${inlineMarkdownHtml(reply, t)}</td>` +
115
- `</tr>`,
116
- );
117
-
118
- return pt(
119
- `<tr><td class="tl-bar" style="background:${t.link};height:2px;line-height:2px;font-size:0;` +
120
- `border-radius:${RADIUS.md} ${RADIUS.md} 0 0;">&nbsp;</td></tr>` +
121
- `<tr><td class="tl-field" style="background:${t.field};padding:18px 20px 20px 20px;` +
122
- `border-radius:0 0 ${RADIUS.md} ${RADIUS.md};">` +
123
- pt(
124
- `<tr><td>${head}</td></tr>` +
125
- `<tr><td class="tl-ink" style="${TYPE.result}color:${t.ink};padding:14px 0 0 0;">${esc(result)}</td></tr>` +
126
- `<tr><td style="padding:16px 0 0 0;">${next}</td></tr>`,
127
- ) +
128
- `</td></tr>`,
129
- );
130
- }
51
+ export const inlineMarkdownHtml = (value, tokens) =>
52
+ inlineHtml(parseInline(value), tokens);
@@ -1,91 +1,72 @@
1
- /* tldr; — email tokens.
1
+ /* Email-specific reading tokens.
2
2
  *
3
- * Mirrors docs/brand/tokens.css. Duplicated here because an email cannot load a
4
- * stylesheet: every value has to be baked into a style attribute, so the
5
- * renderer needs the numbers in JavaScript. tokens.css stays the source of
6
- * truth; if a value changes there it changes here, and nowhere else.
7
- *
8
- * Tokens are named for the job rather than the colour. `solid` means "the
9
- * identity plane", and in night lighting that plane is not #0000EE — a renderer
10
- * that asked for "blue" would get the wrong answer in one of the two modes.
11
- *
12
- * Every pairing these produce is declared and measured in
13
- * docs/brand/check-contrast.mjs. Thirty pairings, thirty passing.
3
+ * The wider tldr; identity is deliberately not the visual world of an owner
4
+ * conversation. Email should feel like careful correspondence between a person
5
+ * and their agent. Brand colour is reserved for links and the final semicolon
6
+ * in the quiet footer signature.
14
7
  */
15
8
 
9
+ /* Off-white rather than #FFFFFF: clients that auto-invert dark mode (classic
10
+ * Outlook, Windows Mail) override pure white/black but leave near values to the
11
+ * author, so the day document survives inversion heuristics intact. */
16
12
  export const DAY = Object.freeze({
17
13
  mode: "day",
18
- stock: "#F8FAFC",
19
- raised: "#FFFFFF",
20
- ink: "#20242C",
21
- muted: "#465365",
22
- link: "#0000EE",
23
- field: "#AFCFF5",
24
- solid: "#0000EE",
25
- onSolid: "#F8FAFC",
26
- onSolidMuted: "#AFCFF5",
27
- line: "#6A7DA5",
28
- accent: "#D9FF00",
29
- onAccent: "#20242C",
14
+ page: "#FDFDFD",
15
+ stock: "#FDFDFD",
16
+ raised: "#F4F5F7",
17
+ ink: "#24262B",
18
+ muted: "#626770",
19
+ link: "#315ECA",
20
+ line: "#DADDE2",
21
+ strongLine: "#C5C9D0",
30
22
  });
31
23
 
32
24
  export const NIGHT = Object.freeze({
33
25
  mode: "night",
34
- stock: "#101520",
35
- raised: "#19202E",
36
- ink: "#E9EDF5",
37
- muted: "#A6B3C9",
38
- link: "#93AEFF",
39
- field: "#1C2A45",
40
- solid: "#2440E8",
41
- onSolid: "#EAEFFF",
42
- onSolidMuted: "#C8D4FB",
43
- line: "#5A6880",
44
- accent: "#D9FF00",
45
- onAccent: "#20242C",
26
+ page: "#17181B",
27
+ stock: "#17181B",
28
+ raised: "#222429",
29
+ ink: "#ECEDEF",
30
+ muted: "#A8ACB4",
31
+ link: "#9AAFF0",
32
+ line: "#373A41",
33
+ strongLine: "#50545D",
46
34
  });
47
35
 
48
- /* No webfont will ever load in a mail client, so these are the faces actually
49
- * present on the machine. That is the design, not a concession.
50
- *
51
- * The condensed face is the brand's voice and it is doing real work here: a
52
- * subject line holds about three more words per line in Arial Narrow than in the
53
- * reading face at the same size, and subjects are the one string in this system
54
- * whose length nobody controls. */
55
- export const DISPLAY =
56
- "'Arial Narrow','Aptos Narrow','Helvetica Neue Condensed',Arial,sans-serif";
57
- export const BODY = "Verdana,Geneva,Tahoma,sans-serif";
36
+ /* Native UI faces make the email feel authored in the reader's environment,
37
+ * not typeset by a product. These are installed defaults, so nothing is fetched
38
+ * and every major client has a compatible fallback. */
39
+ export const BODY =
40
+ "-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif";
41
+ export const DISPLAY = BODY;
58
42
  export const MONO =
59
- "ui-monospace,SFMono-Regular,Menlo,Consolas,'Courier New',monospace";
43
+ "ui-monospace,SFMono-Regular,Menlo,Consolas,'Liberation Mono','Courier New',monospace";
60
44
 
61
- /* The condensed face carries short phrases and meaningful numerals only. It
62
- * never sets a paragraph — that is what the reading face is for, at a 16px floor
63
- * because the primary reading device is a phone held at arm's length at 3am. */
45
+ /* 14px/1.5 body is the density of mail people actually write to each other —
46
+ * Outlook composes at ~14.7px, Gmail and Apple Mail read smaller. The 16–18px
47
+ * convention belongs to marketing mail read at a glance, not correspondence.
48
+ * Headings stay within ~1.3× body: a colleague bolds a line, they do not set
49
+ * display type. */
64
50
  export const TYPE = Object.freeze({
65
- /* The TLDR result. The largest thing in the message, and the only display
66
- * string long enough to wrap. */
67
- result: `font-family:${DISPLAY};font-size:26px;line-height:1.12;font-weight:700;letter-spacing:-.02em;`,
68
- tldrLabel: `font-family:${DISPLAY};font-size:12px;line-height:1.2;font-weight:700;letter-spacing:.14em;`,
69
- chip: `font-family:${DISPLAY};font-size:11px;line-height:1.2;font-weight:700;letter-spacing:.1em;`,
70
- body: `font-family:${BODY};font-size:16px;line-height:1.55;`,
71
- small: `font-family:${BODY};font-size:13px;line-height:1.5;`,
72
- label: `font-family:${BODY};font-size:12px;line-height:1.25;font-weight:700;letter-spacing:.02em;`,
73
- context: `font-family:${MONO};font-size:12px;line-height:1.5;`,
74
- section: `font-family:${DISPLAY};font-size:21px;line-height:1.15;font-weight:700;letter-spacing:-.01em;`,
75
- sub: `font-family:${DISPLAY};font-size:16px;line-height:1.2;font-weight:700;letter-spacing:.02em;`,
76
- /* The numeral device: oversized condensed figures indexing a real step. */
77
- numeral: `font-family:${DISPLAY};font-size:20px;line-height:1;font-weight:700;`,
78
- code: `font-family:${MONO};font-size:13px;line-height:1.5;`,
79
- tag: `font-family:${MONO};font-size:11px;line-height:1.2;letter-spacing:.08em;`,
80
- tableHead: `font-family:${DISPLAY};font-size:12px;line-height:1.2;font-weight:700;letter-spacing:.08em;`,
81
- tableCell: `font-family:${BODY};font-size:14px;line-height:1.5;`,
82
- /* The system bar. */
83
- stamp: `font-family:${DISPLAY};font-size:12px;line-height:1.2;font-weight:700;letter-spacing:.1em;`,
51
+ body: `font-family:${BODY};font-size:14px;line-height:1.5;font-weight:400;`,
52
+ small: `font-family:${BODY};font-size:12.5px;line-height:1.5;font-weight:400;`,
53
+ label: `font-family:${BODY};font-size:12px;line-height:1.45;font-weight:600;`,
54
+ context: `font-family:${BODY};font-size:11.5px;line-height:1.5;font-weight:400;`,
55
+ section: `font-family:${BODY};font-size:17px;line-height:1.4;font-weight:600;letter-spacing:-.01em;`,
56
+ sub: `font-family:${BODY};font-size:15px;line-height:1.45;font-weight:600;`,
57
+ code: `font-family:${MONO};font-size:12.5px;line-height:1.55;font-weight:400;`,
58
+ tag: `font-family:${BODY};font-size:11px;line-height:1.4;font-weight:600;`,
59
+ tableHead: `font-family:${BODY};font-size:12.5px;line-height:1.45;font-weight:600;`,
60
+ tableCell: `font-family:${BODY};font-size:13.5px;line-height:1.5;font-weight:400;`,
61
+ systemLabel: `font-family:${BODY};font-size:11.5px;line-height:1.45;font-weight:500;`,
62
+ systemTitle: `font-family:${BODY};font-size:19px;line-height:1.35;font-weight:600;letter-spacing:-.01em;`,
63
+ codePlate: `font-family:${MONO};font-size:28px;line-height:1.3;font-weight:500;letter-spacing:.12em;`,
64
+ colophon: `font-family:${BODY};font-size:11px;line-height:1.45;font-weight:400;`,
84
65
  });
85
66
 
86
- /* One reading column. */
87
- export const CARD_WIDTH = 600;
88
-
89
- /* Radius is 0, 2 or 4. Four is the maximum in the system and the TLDR block is
90
- * where it is spent; code takes two; nothing is a rounded card. */
91
- export const RADIUS = Object.freeze({ sm: "2px", md: "4px" });
67
+ /* 640 sits inside the ~650px ceiling Outlook and Yahoo render comfortably and,
68
+ * with 24px gutters, gives prose a 592px measure — the width of a note in a
69
+ * desktop reading pane rather than a mobile-first promotional column. */
70
+ export const CARD_WIDTH = 640;
71
+ export const GUTTER = 24;
72
+ export const RADIUS = Object.freeze({ sm: "4px", md: "6px" });