decklight 0.4.0 → 0.6.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.
package/cli/wizard.mjs CHANGED
@@ -23,8 +23,15 @@
23
23
  *
24
24
  * ## Credentials
25
25
  *
26
- * Pasted in the player, posted to the author server, written `0600` under the
27
- * config home. Loopback-only by construction rather than by check: the author
26
+ * Pasted in the player, posted to the author server, and stored under the
27
+ * config home RESTRICTED TO THE ACCOUNT THAT PASTED THEM — `0600` on POSIX,
28
+ * and on Windows an explicit ACL granting only that user, because `0600` there
29
+ * is a number with no meaning and inheriting whatever the profile hands out is
30
+ * not a decision decklight ever made deliberately (#308). Every sentence
31
+ * decklight prints about this comes from `protectionOf`, which READS THE FILE
32
+ * BACK rather than repeating what the write intended: the one thing worse than
33
+ * a key with weak permissions is a key with weak permissions and a CLI saying
34
+ * otherwise. Loopback-only by construction rather than by check: the author
28
35
  * server refuses every `/edit/*` mutation off-loopback unconditionally
29
36
  * (`allowRemote`), flag or no flag. Never logged, never written into the deck,
30
37
  * never picked up by `bundle` — a key that reached a deck would travel with it.
@@ -39,8 +46,9 @@
39
46
  */
40
47
 
41
48
  import { readFileSync, writeFileSync, mkdirSync, chmodSync, statSync, existsSync } from 'node:fs';
49
+ import { execFileSync } from 'node:child_process';
42
50
  import path, { delimiter } from 'node:path';
43
- import { homedir } from 'node:os';
51
+ import { homedir, userInfo } from 'node:os';
44
52
  import { configHome } from './marketplace.mjs';
45
53
 
46
54
  /** Where credentials live. Beside `marketplaces.json`, same config home. */
@@ -257,19 +265,30 @@ export const BRIDGE_ADDR = '127.0.0.1:8787';
257
265
  * One function so the wording exists once; the player prints both strings
258
266
  * verbatim (as text, never markup) and refuses a schema that lacks them.
259
267
  */
260
- export function provenance(schema, qualified) {
268
+ export function provenance(schema, qualified, { platform = process.platform } = {}) {
261
269
  if (typeof qualified !== 'string' || !/^[^@\s]+@[^@\s]+$/.test(qualified)) {
262
270
  throw new SchemaError('provenance needs the entry\'s qualified registry name, like "elevenlabs@voices"');
263
271
  }
264
272
  const endpoints = [...new Set([schema.validate, schema.install].filter(Boolean))];
273
+ // The protection, named in the terms of the machine reading it. `0600` is
274
+ // the whole of the promise on POSIX and means nothing at all on Windows, and
275
+ // printing it there was decklight claiming a protection it was not providing
276
+ // (#308). `restrictFile` is what makes the Windows half true.
277
+ const where = `~/.decklight/credentials.json (${STORAGE_NOTE[platform === 'win32' ? 'win32' : 'posix']})`;
265
278
  return {
266
279
  askedBy: `asked by ${qualified}`,
267
280
  sentTo: endpoints.length
268
- ? `answers go to its own bridge on this machine (${endpoints.map((p) => BRIDGE_ADDR + p).join(' and ')}), then ~/.decklight/credentials.json (0600)`
269
- : 'answers stay on this machine: ~/.decklight/credentials.json (0600)',
281
+ ? `answers go to its own bridge on this machine (${endpoints.map((p) => BRIDGE_ADDR + p).join(' and ')}), then ${where}`
282
+ : `answers stay on this machine: ${where}`,
270
283
  };
271
284
  }
272
285
 
286
+ /** How the credential file is protected, per platform, in one phrase. */
287
+ export const STORAGE_NOTE = {
288
+ posix: '0600',
289
+ win32: 'locked to your Windows account',
290
+ };
291
+
273
292
  /** Which of a schema's fields are secrets — the only ones that get hidden. */
274
293
  export const secretNames = (schema) =>
275
294
  new Set(schema.fields.filter((f) => f.type === 'secret').map((f) => f.name));
@@ -309,20 +328,166 @@ export function loadCredentials(home = configHome()) {
309
328
  }
310
329
 
311
330
  /**
312
- * Store one engine's answers, `0600`.
331
+ * Cut `file` down to the account that owns it, and say which way it was done.
332
+ *
333
+ * POSIX has `0600` and that IS the protection. Windows does not: `chmodSync`
334
+ * there only toggles the read-only attribute, so a file written with mode
335
+ * `0o600` carries whatever ACL the user profile hands it — usually adequate,
336
+ * and not something decklight did. `icacls /inheritance:r` drops the inherited
337
+ * entries and `/grant:r <user>:F` puts back exactly one, so afterwards the only
338
+ * principal on the file is the person who pasted the key.
339
+ *
340
+ * Returns HOW, never a boolean: the caller's next job is to print a true
341
+ * sentence, and "it worked" is not enough to write one with. A machine where
342
+ * icacls is unavailable or the filesystem has no ACLs (a FAT volume, a network
343
+ * share) is not an error — it is `inherited`, which is what the profile would
344
+ * have given anyway and is said out loud rather than papered over.
345
+ */
346
+ export function restrictFile(file, {
347
+ platform = process.platform, exec = execFileSync, chmod = chmodSync,
348
+ user = () => userInfo().username, env = process.env,
349
+ } = {}) {
350
+ if (platform !== 'win32') {
351
+ // Set on every write, not only on create: a file left world-readable by
352
+ // something else must not stay that way, and `writeFileSync`'s mode
353
+ // argument is ignored for a path that already exists.
354
+ chmod(file, 0o600);
355
+ return { how: 'posix', who: null };
356
+ }
357
+ // Three steps, because `/inheritance:r` is not the blunt instrument the usual
358
+ // one-line recipe assumes. It removes INHERITED entries only, and the Windows
359
+ // runner showed a freshly written file carrying SYSTEM and Administrators as
360
+ // EXPLICIT ones (no `(I)` marker): `/inheritance:r` then had nothing to do,
361
+ // `/grant:r` replaced only this account's own entry, both calls exited 0, and
362
+ // the file looked restricted while everyone it started with could still read
363
+ // it. An explicit entry has to be removed explicitly.
364
+ const run = (args) => exec('icacls', [file, ...args], { stdio: 'pipe' });
365
+ try {
366
+ run(['/inheritance:r']);
367
+ } catch (e) {
368
+ return { how: 'inherited', who: null, why: reason(e) };
369
+ }
370
+ // Two spellings of one account, because icacls fails the whole call on a
371
+ // principal it cannot look up and WHICH one resolves is a property of the
372
+ // machine: `MACHINE\\jo` is what Windows prints and what a domain-joined box
373
+ // wants, a bare `jo` is what a local account often wants.
374
+ let who = null;
375
+ let last = null;
376
+ for (const candidate of new Set([qualifiedUser(user, env), user()])) {
377
+ if (who) break;
378
+ try { run(['/grant:r', `${candidate}:F`]); who = candidate; } catch (e) { last = e; }
379
+ }
380
+ if (!who) {
381
+ // The grant is load-bearing: without it, an inheritance drop that DID
382
+ // remove something leaves a file nobody can read. Put the profile's own
383
+ // permissions back — a weak protection beats an unreadable credential file.
384
+ try { run(['/inheritance:e']); } catch { /* reported below anyway */ }
385
+ return { how: 'inherited', who: null, why: reason(last) };
386
+ }
387
+ // Then everyone else, by name, from the file's own DACL. SYSTEM and the
388
+ // Administrators group go too: an administrator can take ownership whatever
389
+ // this says, so leaving them on buys nothing, and "restricted to the account
390
+ // that pasted it" has to mean that or it is not worth printing. Best effort —
391
+ // an entry that will not come off is not an error here, because the caller
392
+ // reads the file back and reports what is actually on it.
393
+ try {
394
+ const me = bareName(who);
395
+ for (const g of aclGrantees(exec('icacls', [file], { encoding: 'utf8' }), file)) {
396
+ if (bareName(g) === me) continue;
397
+ try { run(['/remove:g', g]); } catch { /* named by the read-back */ }
398
+ }
399
+ } catch { /* likewise */ }
400
+ return { how: 'acl', who, why: null };
401
+ }
402
+
403
+ /**
404
+ * An account name without its domain, lowercased.
405
+ *
406
+ * icacls answers with the fully qualified `MACHINE\\jo` whatever spelling it was
407
+ * granted in, so comparing anything else compares a spelling, not an identity.
408
+ */
409
+ export const bareName = (s) => String(s).toLowerCase().split('\\').pop();
410
+
411
+ /** What icacls said, short enough for a log line. */
412
+ const reason = (e) => String(e?.stderr || e?.message || e).trim().split('\n')[0].slice(0, 200);
413
+
414
+ /**
415
+ * The account name to hand icacls.
416
+ *
417
+ * A bare username is what `os.userInfo()` gives and is usually enough, but it
418
+ * has to RESOLVE — icacls fails the whole call on a principal it cannot look
419
+ * up, and a machine where the bare name is ambiguous would silently keep the
420
+ * profile's permissions. `USERDOMAIN\USERNAME` is the form Windows itself uses
421
+ * and the one that resolves on a domain-joined machine, so it is preferred
422
+ * when the environment supplies it.
423
+ */
424
+ export function qualifiedUser(user = () => userInfo().username, env = process.env) {
425
+ const name = user();
426
+ const domain = env.USERDOMAIN;
427
+ return domain && !name.includes('\\') ? `${domain}\\${name}` : name;
428
+ }
429
+
430
+ /**
431
+ * What the file on disk is ACTUALLY protected by — read back, never assumed.
432
+ *
433
+ * This is the function every user-facing sentence about credential storage
434
+ * comes from, including `report-bug`'s, so that what decklight says and what is
435
+ * true cannot drift apart the way they did in #308.
436
+ */
437
+ export function protectionOf(file, {
438
+ platform = process.platform, exec = execFileSync, stat = statSync,
439
+ exists = existsSync, user = () => userInfo().username,
440
+ } = {}) {
441
+ if (!exists(file)) return { state: 'absent', label: 'nothing stored' };
442
+ if (platform !== 'win32') {
443
+ const mode = stat(file).mode & 0o777;
444
+ return mode === 0o600
445
+ ? { state: 'private', label: '0600' }
446
+ : { state: 'open', label: `0${mode.toString(8)} — readable by more than you` };
447
+ }
448
+ let grantees;
449
+ try {
450
+ grantees = aclGrantees(exec('icacls', [file], { encoding: 'utf8' }), file);
451
+ } catch {
452
+ return { state: 'unknown', label: 'Windows ACL (icacls could not read it)' };
453
+ }
454
+ const me = bareName(user());
455
+ const others = grantees.filter((g) => bareName(g) !== me);
456
+ return others.length
457
+ ? { state: 'open', label: `Windows ACL — also readable by ${others.join(', ')}` }
458
+ : { state: 'private', label: `Windows ACL — restricted to ${user()}` };
459
+ }
460
+
461
+ /**
462
+ * The principals `icacls <file>` lists, from its output.
463
+ *
464
+ * The file's own path is on the first line ahead of the first principal and may
465
+ * contain spaces (`C:\Users\Jo Bloggs\…`), so it is removed by name before
466
+ * anything is parsed rather than guessed at with whitespace.
467
+ */
468
+ export function aclGrantees(out, file) {
469
+ return String(out).replaceAll(file, '').split(/\r?\n/)
470
+ .map((line) => /^\s*(.+?):\(/.exec(line)?.[1]?.trim())
471
+ .filter(Boolean);
472
+ }
473
+
474
+ /**
475
+ * Store one engine's answers, restricted to this account.
313
476
  *
314
- * The mode is set on every write, not only on create: a file that was
315
- * world-readable before this call must not stay world-readable after it, and
316
- * `writeFileSync`'s mode argument is ignored for a path that already exists.
477
+ * Returns `{ file, protection }` — what was written and what it is really
478
+ * protected by, read back off the disk. A caller that wants to say where the
479
+ * key went has both halves and cannot accidentally say only the first.
317
480
  */
318
- export function saveCredentials(engine, answers, home = configHome()) {
481
+ export function saveCredentials(engine, answers, home = configHome(), opts = {}) {
319
482
  const file = credentialsPath(home);
320
483
  mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
321
484
  const all = loadCredentials(home);
322
485
  all[engine] = { ...answers };
323
486
  writeFileSync(file, `${JSON.stringify(all, null, 2)}\n`, { mode: 0o600 });
324
- chmodSync(file, 0o600);
325
- return file;
487
+ // What was attempted, then what is actually true. The second is the answer;
488
+ // the first is why, on a machine where the answer is disappointing.
489
+ const attempted = restrictFile(file, opts);
490
+ return { file, protection: { ...protectionOf(file, opts), why: attempted.why ?? null } };
326
491
  }
327
492
 
328
493
  /** Forget an engine's answers. Returns whether there was anything to forget. */
@@ -332,7 +497,7 @@ export function forgetCredentials(engine, home = configHome()) {
332
497
  if (!(engine in all)) return false;
333
498
  delete all[engine];
334
499
  writeFileSync(credentialsPath(home), `${JSON.stringify(all, null, 2)}\n`, { mode: 0o600 });
335
- chmodSync(credentialsPath(home), 0o600);
500
+ restrictFile(credentialsPath(home));
336
501
  return true;
337
502
  }
338
503
 
@@ -427,6 +592,9 @@ export async function configureEngine(engine, answers, {
427
592
  if (!ok) return { state: REJECTED, schema, reason: `${schema.title} did not accept those answers` };
428
593
  }
429
594
 
430
- const file = save(engine, answers, home);
431
- return { state: CONFIGURED, schema, file, stored: redactAnswers(schema, answers) };
595
+ // Both halves: where the key went, and what is actually protecting it there.
596
+ // The second is read off the disk, so a caller reporting it cannot repeat an
597
+ // intention the filesystem did not honour (#308).
598
+ const { file, protection } = save(engine, answers, home);
599
+ return { state: CONFIGURED, schema, file, protection, stored: redactAnswers(schema, answers) };
432
600
  }
@@ -471,12 +471,185 @@
471
471
  opacity: 0.75;
472
472
  }
473
473
  .decklight-restore .rs-when {
474
- float: right;
475
474
  opacity: 0.55;
476
475
  font-size: 0.85em;
477
476
  padding-left: 0.75em;
478
477
  }
479
478
 
479
+ /* The history door (H) — the same overlay as R, with two additions: a mark on
480
+ commits that exist nowhere but this machine, and the branch's standing under
481
+ the title. */
482
+ .decklight-history .hs-push {
483
+ color: #7fb2ff;
484
+ font-weight: 600;
485
+ margin: 0 6px 0 2px;
486
+ }
487
+ .decklight-restore .hs-remote,
488
+ .decklight-history .hs-remote {
489
+ padding: 6px 12px 8px;
490
+ font-size: .82em;
491
+ opacity: .62;
492
+ font-variant-numeric: tabular-nums;
493
+ border-bottom: 1px solid rgba(128, 128, 128, .18);
494
+ }
495
+
496
+ /* THE PREVIEW IS THE POINT OF THIS OVERLAY, so the rail is built never to
497
+ fight it. A row used to put four things on one line — hash, subject, badges,
498
+ age — which made the column's MIN-CONTENT width the sum of all four; and a
499
+ flex item's default `min-width: auto` forbids shrinking below that, so
500
+ `flex: 0 0 300px` was a suggestion the content could veto. It did: the pane
501
+ collapsed to 57px the moment the title bar got long.
502
+
503
+ Two lines instead. The subject owns the first, the metadata dims underneath,
504
+ and `min-width: 0` on the column means nothing in here wants to be wide —
505
+ the preview's size stops depending on how somebody worded a commit message. */
506
+ .decklight-history .tp-panel { width: min(1100px, 92vw); }
507
+ /* This bar is a static LABEL here, not the live query the picker and finder
508
+ show in it — so it may wrap. That is what finally makes the rail's width
509
+ independent of it: nowrap made the whole sentence the column's min-content
510
+ width (the 57px collapse), and clipping it to an ellipsis would have hidden
511
+ half the keys instead. Wrapping does neither. */
512
+ .decklight-history .tp-filter {
513
+ white-space: normal;
514
+ text-overflow: clip;
515
+ }
516
+ .decklight-history .tp-side {
517
+ flex: 0 0 30%;
518
+ min-width: 0;
519
+ }
520
+ .decklight-history .tp-row {
521
+ display: block;
522
+ white-space: normal;
523
+ }
524
+ .decklight-history .rs-subject {
525
+ display: -webkit-box;
526
+ -webkit-line-clamp: 2; /* two lines, then ellipsis: rows stay a knowable height */
527
+ line-clamp: 2;
528
+ -webkit-box-orient: vertical;
529
+ overflow: hidden;
530
+ }
531
+ .decklight-history .hs-meta {
532
+ display: flex;
533
+ align-items: baseline;
534
+ gap: 0.5em;
535
+ margin-top: 2px;
536
+ font-size: 0.82em;
537
+ opacity: 0.72;
538
+ }
539
+ /* the age to the far right, so the column reads as a timeline down the edge */
540
+ .decklight-history .hs-meta .rs-when {
541
+ margin-left: auto;
542
+ padding-left: 0.5em;
543
+ font-variant-numeric: tabular-nums;
544
+ }
545
+ /* The preview, shaped like the thing it shows. `aspect-ratio` rather than
546
+ `flex: 1` so a slide is never letterboxed into a portrait sliver — the
547
+ leftover height goes to the list, which can use it. */
548
+ .decklight-history .tp-preview {
549
+ /* the slide, its transport and its caption travel together: with the iframe
550
+ on an aspect ratio the column no longer fills its height, and a block
551
+ pinned to the top of a taller box reads as a rendering accident */
552
+ justify-content: center;
553
+ }
554
+ .decklight-history .tp-preview iframe {
555
+ flex: 0 0 auto;
556
+ aspect-ratio: 16 / 9;
557
+ height: auto;
558
+ }
559
+ /* One line, truncating. It spells out what the row's badges abbreviate, and it
560
+ used to wrap to eight lines when the pane collapsed — a caption that can grow
561
+ vertically is a caption that hides the collapse it is a symptom of. */
562
+ .decklight-history .tp-caption {
563
+ white-space: nowrap;
564
+ overflow: hidden;
565
+ text-overflow: ellipsis;
566
+ }
567
+ .decklight-history .hs-stat {
568
+ display: inline-flex;
569
+ align-items: baseline;
570
+ gap: 0.4em;
571
+ font-size: 0.8em;
572
+ font-variant-numeric: tabular-nums;
573
+ }
574
+ /* The slide count reads as a slide: a small landscape box with a number in it,
575
+ which is a different KIND of fact from the two line counts beside it and
576
+ should not be mistaken for a third diff number. */
577
+ .decklight-history .hs-slides {
578
+ border: 1px solid currentColor;
579
+ border-radius: 2px;
580
+ padding: 0 0.35em;
581
+ opacity: 0.5;
582
+ }
583
+ /* Green added, red removed — the colours every diff has used for forty years.
584
+ Fixed hues rather than theme tokens on purpose: a theme is free to make its
585
+ accent red, and "how much did this commit add" must not change meaning with
586
+ the wallpaper. Both are light enough to sit on the picker's dark panel. */
587
+ .decklight-history .hs-add { color: #4ec98a; }
588
+ .decklight-history .hs-del { color: #f2777a; }
589
+
590
+ /* Preview transport. The previewed version is `?embedded`, so its own chrome
591
+ is off and this row is the only way to walk it. */
592
+ .decklight-history .hs-nav {
593
+ display: flex;
594
+ align-items: center;
595
+ justify-content: center;
596
+ gap: 0.35em;
597
+ padding: 6px 0 2px;
598
+ }
599
+ .decklight-history .hs-btn {
600
+ display: inline-flex;
601
+ align-items: center;
602
+ justify-content: center;
603
+ width: 26px;
604
+ height: 26px;
605
+ padding: 0;
606
+ border: 1px solid rgba(128, 128, 128, .28);
607
+ border-radius: 4px;
608
+ background: transparent;
609
+ color: inherit;
610
+ cursor: pointer;
611
+ }
612
+ .decklight-history .hs-btn:hover:not(:disabled) { background: rgba(128, 128, 128, .18); }
613
+ .decklight-history .hs-btn:disabled { opacity: 0.3; cursor: default; }
614
+ .decklight-history .hs-pos {
615
+ min-width: 4.5em;
616
+ text-align: center;
617
+ font-size: 0.82em;
618
+ font-variant-numeric: tabular-nums;
619
+ opacity: 0.6;
620
+ }
621
+
622
+ /* The confirmation. It sits under the list rather than over it, because the
623
+ row it is asking about must stay visible while you answer. */
624
+ .decklight-history .hs-confirm {
625
+ padding: 10px 12px 12px;
626
+ border-top: 1px solid rgba(128, 128, 128, .28);
627
+ font-size: 0.85em;
628
+ white-space: normal;
629
+ }
630
+ .decklight-history .hs-q-hash { font-family: var(--font-mono, ui-monospace, monospace); }
631
+ .decklight-history .hs-q-sub { opacity: 0.7; }
632
+ .decklight-history .hs-why { opacity: 0.6; margin: 0.35em 0 0.7em; line-height: 1.35; }
633
+ .decklight-history .hs-buttons { display: flex; gap: 0.5em; }
634
+ .decklight-history .hs-buttons button {
635
+ font: inherit;
636
+ padding: 0.35em 0.8em;
637
+ border-radius: 4px;
638
+ border: 1px solid rgba(128, 128, 128, .35);
639
+ background: transparent;
640
+ color: inherit;
641
+ cursor: pointer;
642
+ }
643
+ .decklight-history .hs-buttons button.hs-yes {
644
+ background: #e8eaee;
645
+ border-color: #e8eaee;
646
+ color: #16181d;
647
+ font-weight: 600;
648
+ }
649
+ .decklight-history .hs-buttons button.hs-no:hover { background: rgba(255, 255, 255, .14); }
650
+ .decklight-history .hs-buttons button.hs-yes:hover { background: #fff; border-color: #fff; }
651
+ .decklight-history .hs-keys { opacity: 0.45; font-size: 0.9em; margin-top: 0.6em; }
652
+
480
653
  /* ---------- brand logo (SPEC PRESENTING) -------------------------------------------
481
654
  Chrome-level mark on every slide. The engine sets data-canvas="dark|light"
482
655
  on the root from the applied theme's real background luminance; the
@@ -767,7 +940,7 @@
767
940
  padding: 2px 10px;
768
941
  }
769
942
  .decklight-arrow:hover { color: var(--accent, #6af); }
770
- /* progress bar (H) — a hairline along the very bottom edge; its width is the
943
+ /* progress bar (J) — a hairline along the very bottom edge; its width is the
771
944
  position in the deck. Below the captions bar (bottom: 7%, z45), the
772
945
  character overlay (z44) and the corner chrome, so it covers nothing.
773
946
  Track is a translucent neutral (readable on any canvas, like the clock's
@@ -824,6 +997,106 @@
824
997
  user-select: none;
825
998
  }
826
999
  .decklight-clock .clk-elapsed { color: var(--accent, #6af); }
1000
+ /* The element content editor's highlighted layers (author mode). A textarea
1001
+ cannot render markup, so the colour is a <pre> BEHIND a textarea whose own
1002
+ text is transparent.
1003
+
1004
+ EVERY selector here carries `.decklight-narr` — not for tidiness, but because
1005
+ `.decklight-narr .narr-input` (0,2,0) sets this textarea's font, line-height,
1006
+ padding, border and colour, and it OUTRANKS a bare `.edit-code > textarea`
1007
+ (0,1,1). Losing that fight is not cosmetic: the two layers then disagree on
1008
+ line-height and padding, and the caret drifts away from the glyph it is
1009
+ supposed to sit in, further with every line.
1010
+
1011
+ Both layers therefore take every metric from ONE rule below. */
1012
+ .decklight-narr .edit-code {
1013
+ position: relative;
1014
+ display: block;
1015
+ width: 100%;
1016
+ }
1017
+ .decklight-narr .edit-code > pre,
1018
+ .decklight-narr .edit-code > textarea {
1019
+ margin: 0;
1020
+ border: 0;
1021
+ padding: 10px 12px;
1022
+ font: 400 13px/1.55 var(--font-mono, ui-monospace, monospace);
1023
+ letter-spacing: normal;
1024
+ tab-size: 2;
1025
+ white-space: pre-wrap; /* both wrap, or neither does */
1026
+ overflow-wrap: break-word;
1027
+ box-sizing: border-box;
1028
+ min-height: 220px;
1029
+ max-height: 46vh;
1030
+ }
1031
+ .decklight-narr .edit-code > pre {
1032
+ position: absolute;
1033
+ inset: 0;
1034
+ overflow: auto;
1035
+ pointer-events: none; /* the textarea takes every click */
1036
+ background: var(--code-bg, rgba(0, 0, 0, .35));
1037
+ border-radius: 8px;
1038
+ }
1039
+ .decklight-narr .edit-code > textarea {
1040
+ position: relative;
1041
+ display: block;
1042
+ width: 100%;
1043
+ resize: vertical;
1044
+ background: transparent;
1045
+ color: transparent; /* the <pre> paints the glyphs */
1046
+ caret-color: var(--fg, #fff);
1047
+ border-radius: 8px;
1048
+ overflow: auto;
1049
+ }
1050
+ /* The selection has to be visible against transparent text. */
1051
+ .decklight-narr .edit-code > textarea::selection { background: var(--accent, #6af); color: transparent; }
1052
+ .decklight-narr .edit-code > textarea:focus { outline: 2px solid var(--accent, #6af); outline-offset: 1px; }
1053
+ /* Still loading, or refused: there is no highlighted layer to read yet, so the
1054
+ textarea shows its own text rather than an empty-looking box. */
1055
+ .decklight-narr .edit-code > textarea:disabled { color: var(--muted, #9aa); }
1056
+
1057
+ /* "an agent is still working" — author mode only (src/core/editmode.js).
1058
+ BOTTOM CENTRE, which is the one piece of chrome nothing else claims: the
1059
+ logo takes a corner, the clock is top-right, the controls bottom-right and
1060
+ messages top-left, so this can be persistent without ever covering them.
1061
+ Quiet by construction — it reports rather than asks, and nothing about a
1062
+ background job should compete with the slide. */
1063
+ .decklight-agent-chip {
1064
+ position: absolute;
1065
+ left: 50%;
1066
+ bottom: 16px;
1067
+ transform: translateX(-50%);
1068
+ z-index: 42;
1069
+ display: flex;
1070
+ align-items: center;
1071
+ gap: 8px;
1072
+ background: rgba(0, 0, 0, .72);
1073
+ color: #fff;
1074
+ font: 500 14px/1 var(--font-mono, monospace);
1075
+ font-variant-numeric: tabular-nums; /* a ticking clock must not jitter */
1076
+ padding: 7px 13px;
1077
+ border-radius: 999px;
1078
+ border: 1px solid rgba(255, 255, 255, .16);
1079
+ box-shadow: 0 4px 18px rgba(0, 0, 0, .3);
1080
+ pointer-events: none; /* never in the way of a slide click */
1081
+ white-space: nowrap;
1082
+ }
1083
+ .decklight-agent-chip::before {
1084
+ content: '';
1085
+ width: 7px;
1086
+ height: 7px;
1087
+ border-radius: 50%;
1088
+ background: var(--accent, #6af);
1089
+ animation: dl-agent-pulse 1.6s ease-in-out infinite;
1090
+ }
1091
+ @keyframes dl-agent-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
1092
+ /* A pulse is the one thing here that moves. Somebody who asked for less motion
1093
+ still gets the chip and the clock — the information, without the animation. */
1094
+ @media (prefers-reduced-motion: reduce) {
1095
+ .decklight-agent-chip::before { animation: none; }
1096
+ }
1097
+ /* Printing a deck must not print a job that was running when you hit print. */
1098
+ @media print { .decklight-agent-chip { display: none; } }
1099
+
827
1100
  /* touch chrome — shown only where there's no keyboard (see engine.js) */
828
1101
  .decklight-touch-controls { position: absolute; left: 14px; top: 14px; z-index: 41; display: none; gap: 8px; }
829
1102
  .decklight-touch-btn {
@@ -1000,6 +1273,21 @@
1000
1273
  .decklight-narr .narr-row.narr-sel { background: rgba(255, 255, 255, .14); }
1001
1274
  .decklight-narr .narr-row.narr-cur::after { content: ' ✓'; opacity: .7; }
1002
1275
  .decklight-narr .narr-flavor { opacity: .5; font-size: .85em; margin-left: 6px; }
1276
+ /* An engine this machine cannot use is SHOWN, dimmed, with the terminal command
1277
+ that would fix it — hiding it would answer "where did ElevenLabs go?" with
1278
+ silence. The fix wraps onto its own line (the row is a flex box) because it
1279
+ is a command to type, and a command folded into a sentence is a command
1280
+ somebody mis-copies. */
1281
+ .decklight-narr .narr-row.narr-blocked { flex-wrap: wrap; cursor: default; }
1282
+ .decklight-narr .narr-row.narr-blocked .narr-row-label { opacity: .45; }
1283
+ .decklight-narr .narr-fix {
1284
+ flex: 0 0 100%;
1285
+ margin: 2px 0 2px 1.1em;
1286
+ font-family: var(--font-mono, ui-monospace, monospace);
1287
+ font-size: .78em;
1288
+ opacity: .42;
1289
+ overflow-wrap: anywhere;
1290
+ }
1003
1291
  .decklight-narr .narr-input {
1004
1292
  width: 100%;
1005
1293
  box-sizing: border-box;