@intentius/behold 0.30.1 → 0.31.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 (129) hide show
  1. package/AGENTS.md +475 -16
  2. package/README.md +25 -19
  3. package/demos.json +14 -9
  4. package/dist/cli.js +54900 -26771
  5. package/example-carve/README.md +19 -23
  6. package/example-carve/app/package.json +1 -1
  7. package/example-carve/app/src/carved.ts +3 -3
  8. package/example-carve/carve-report.json +1 -1
  9. package/example-carve/{legacy-tf → tf-root}/terraform.tfstate +1 -1
  10. package/example-choudoufu-estate/README.md +7 -0
  11. package/example-choudoufu-estate/chant.workspace.json +1 -1
  12. package/example-choudoufu-estate/scripts/choudoufu-down.sh +2 -1
  13. package/example-choudoufu-estate/scripts/choudoufu-up.sh +10 -3
  14. package/example-terraform-estate/README.md +32 -5
  15. package/example-terraform-estate/chant.workspace.json +1 -1
  16. package/example-terraform-estate/recorded/adoption/platform.json +72 -0
  17. package/example-terraform-estate/recorded/adoption/prod.json +224 -0
  18. package/example-terralith/README.md +1 -1
  19. package/example-three-cloud/README.md +111 -18
  20. package/example-three-cloud/aws/Pulumi.yaml +15 -0
  21. package/example-three-cloud/aws/index.ts +174 -0
  22. package/example-three-cloud/aws/package-lock.json +2725 -0
  23. package/example-three-cloud/aws/package.json +14 -0
  24. package/example-three-cloud/aws/tsconfig.json +17 -0
  25. package/example-three-cloud/azure/main.tf +48 -0
  26. package/example-three-cloud/azure/site.tf +104 -0
  27. package/example-three-cloud/chant.config.json +9 -0
  28. package/example-three-cloud/chant.workspace.json +30 -4
  29. package/example-three-cloud/dns/chant.config.ts +26 -1
  30. package/example-three-cloud/dns/src/records.component.ts +32 -6
  31. package/example-three-cloud/package-lock.json +48 -27
  32. package/example-three-cloud/package.json +8 -6
  33. package/example-three-cloud/scripts/emulators-up.sh +28 -1
  34. package/example-three-cloud/scripts/front-door.ts +679 -86
  35. package/package.json +13 -6
  36. package/web/adopt-pulumi.js +114 -0
  37. package/web/adopt-pulumi.test.js +28 -0
  38. package/web/adopt.js +203 -0
  39. package/web/adopt.test.js +27 -0
  40. package/web/app.js +614 -19
  41. package/web/carve-steps.js +1 -1
  42. package/web/carve-steps.test.js +2 -2
  43. package/web/change-set-overlay.js +12 -5
  44. package/web/change-set-overlay.test.js +22 -0
  45. package/web/drift-stream.js +241 -0
  46. package/web/drift-stream.test.js +146 -0
  47. package/web/edge-weight.d.ts +1 -1
  48. package/web/edge-weight.js +5 -1
  49. package/web/edge-weight.test.js +19 -0
  50. package/web/embed.js +2 -2
  51. package/web/event-help-modal.js +18 -12
  52. package/web/event-help-modal.test.js +28 -1
  53. package/web/graph-query.js +180 -0
  54. package/web/graph-query.test.js +49 -0
  55. package/web/graph.html +107 -0
  56. package/web/index-diff.js +109 -0
  57. package/web/index-diff.test.js +39 -0
  58. package/web/index.html +55 -0
  59. package/web/kiosk-ask-layout.js +85 -0
  60. package/web/kiosk-ask-layout.test.js +83 -0
  61. package/web/kiosk-ask-tips.js +477 -0
  62. package/web/kiosk-ask-tips.test.js +372 -0
  63. package/web/kiosk-ask.js +774 -0
  64. package/web/kiosk-ask.test.js +593 -0
  65. package/web/kiosk-banner.js +108 -0
  66. package/web/kiosk-banner.test.js +72 -0
  67. package/web/kiosk-center-cards.test.js +110 -0
  68. package/web/kiosk-estate-scene.js +267 -0
  69. package/web/kiosk-estate-scene.test.js +21 -0
  70. package/web/kiosk-event-help.js +4 -1
  71. package/web/kiosk-graph-pane.js +63 -0
  72. package/web/kiosk-graph-pane.test.js +105 -0
  73. package/web/kiosk-light-frame.js +197 -0
  74. package/web/kiosk-light.js +547 -0
  75. package/web/kiosk-light.test.js +297 -0
  76. package/web/kiosk-member-kind.test.js +140 -0
  77. package/web/kiosk-metrics.js +7 -4
  78. package/web/kiosk-modal-sticky.test.js +2 -1
  79. package/web/kiosk-popover.js +4 -1
  80. package/web/kiosk-refit.test.js +81 -0
  81. package/web/kiosk-reset.js +49 -0
  82. package/web/kiosk-reset.test.js +11 -0
  83. package/web/kiosk-shot.js +40 -2
  84. package/web/kiosk-shot.test.js +23 -1
  85. package/web/kiosk-side.js +296 -0
  86. package/web/kiosk-side.test.js +249 -0
  87. package/web/kiosk-vendor.js +85 -7
  88. package/web/kiosk-vendor.test.js +9 -9
  89. package/web/kiosk-watch.js +20 -4
  90. package/web/kiosk-watch.test.js +15 -1
  91. package/web/kiosk.html +153 -1
  92. package/web/kiosk.js +252 -27
  93. package/web/kiosk.test.js +25 -1
  94. package/web/member-kind.js +31 -0
  95. package/web/small-stage.test.js +4 -0
  96. package/web/template-apps.js +245 -0
  97. package/web/template-apps.test.js +252 -0
  98. package/web/templates.js +285 -0
  99. package/web/templates.test.js +155 -0
  100. package/web/terragucci-change.js +30 -13
  101. package/web/terragucci-lifecycle.js +112 -62
  102. package/web/terragucci-lifecycle.test.js +29 -1
  103. package/web/terragucci-timeline.js +39 -2
  104. package/web/terragucci-timeline.test.js +42 -1
  105. package/web/tool-mark.js +4 -4
  106. package/web/tool-mark.test.js +1 -1
  107. package/web/vendors/atmos.svg +1 -0
  108. package/web/vendors/chant.svg +1 -0
  109. package/web/vendors/choudoufu.svg +1 -0
  110. package/web/vendors/terragrunt.svg +9 -0
  111. package/web/vendors/terragucci.svg +1 -0
  112. package/example-three-cloud/aws/chant.config.ts +0 -8
  113. package/example-three-cloud/aws/site.component.ts +0 -13
  114. package/example-three-cloud/aws/src/site.ts +0 -27
  115. package/example-three-cloud/azure/chant.config.ts +0 -1
  116. package/example-three-cloud/azure/src/site.component.ts +0 -13
  117. package/example-three-cloud/azure/src/site.ts +0 -18
  118. package/web/vendors/choudoufu-128.png +0 -0
  119. package/web/vendors/choudoufu-64.png +0 -0
  120. /package/example-carve/{legacy-tf → tf-root}/cdn.tf +0 -0
  121. /package/example-carve/{legacy-tf → tf-root}/compute.tf +0 -0
  122. /package/example-carve/{legacy-tf → tf-root}/floci-override.tf.disabled +0 -0
  123. /package/example-carve/{legacy-tf → tf-root}/modules/cdn/main.tf +0 -0
  124. /package/example-carve/{legacy-tf → tf-root}/naming.tf +0 -0
  125. /package/example-carve/{legacy-tf → tf-root}/network.tf +0 -0
  126. /package/example-carve/{legacy-tf → tf-root}/observability.tf +0 -0
  127. /package/example-carve/{legacy-tf → tf-root}/outputs.tf +0 -0
  128. /package/example-carve/{legacy-tf → tf-root}/storage.tf +0 -0
  129. /package/example-carve/{legacy-tf → tf-root}/versions.tf +0 -0
package/web/app.js CHANGED
@@ -21,10 +21,11 @@ import { cssString, hoverCss, hoverFromMessage, hoverLinks, hoverMessage, isLigh
21
21
  import { gateCards } from "./workspace-gates.js";
22
22
  import { cornerOf, estateLine, hrefOf as tgHref, legend as tgLegend, markLine, rootRows as tgRootRows, waveCards } from "./terragucci.js";
23
23
  import { laneElement as tgLane, rootOfCard as tgRootOfCard, historyElement as tgHistoryLane } from "./terragucci-timeline.js";
24
- import { renderLane } from "./terragucci-lifecycle.js";
24
+ import { gateCardElement, renderLane } from "./terragucci-lifecycle.js";
25
25
  import { renderReleases } from "./releases.js";
26
26
  import { renderTrunkLane } from "./trunk-lane.js";
27
27
  import { startLocalRuns } from "./local-run.js";
28
+ import { startAdopt } from "./adopt.js";
28
29
  import { entriesFor as csEntriesFor, gapLines as csGapLines, inspectHeading as csInspectHeading, nodeMarks as csNodeMarks, offGraph as csOffGraph, overlayHeader as csHeader, overlayLegend as csLegend, PREVIEW_NOTE as CS_PREVIEW_NOTE } from "./change-set-overlay.js";
29
30
  import { collisionFilter as coFilter, collisionHeader as coHeader, collisionMarks as coMarks, collisionsFor as coFor, COLLISION_NOTE as CO_NOTE, FILES_NOTE as CO_FILES_NOTE, FILTER_OFF as CO_FILTER_OFF, FILTER_ON as CO_FILTER_ON, gapLines as coGapLines, hideEdge as coHideEdge, itemRow as coItemRow, nodeRow as coNodeRow, sideLines as coSideLines } from "./collision-marks.js";
30
31
  import { dimEdge as hmDimEdge, HEALTH_NOTE as HM_NOTE, healthHeader as hmHeader, healthLegendRows as hmLegendRows, healthMarks as hmMarks, healthRows as hmRows, memberLines as hmMemberLines } from "./health-marks.js";
@@ -40,6 +41,11 @@ import { FORGES, MARK, componentsForge, forgeOfName, iconSvg, markLink, markTitl
40
41
  import { TOOLS, orderTools } from "./tool-mark.js";
41
42
  import { STATE_WORDS as tgStateWords, changeSection as tgChangeSection, readCardIds as tgReadCardIds, readEdges as tgReadEdges, readLabel as tgReadLabel, readLine as tgReadLine, readTag as tgReadTag, rootStates as tgRootStates, viewCaption as tgViewCaption, pinnedAnswer as tgPinnedAnswer, pinnedCaption as tgPinnedCaption, pinsCommit as tgPinsCommit, pinWaits as tgPinWaits } from "./terragucci-change.js";
42
43
  import { auditLines as yrAuditLines, cornerText as yrCorner, datedWords as yrDated, environmentLines as yrEnvLines, joinMarks as yrJoin, legend as yrLegend, markLine as yrMarkLine } from "./yodel-report.js";
44
+ import { drawLight as klDraw } from "./kiosk-light-frame.js"; // behold#937
45
+ import { badgeWords as klBadge, planOf as klPlanOf, reportedRunView as klReported } from "./kiosk-light.js"; // behold#940
46
+ import { composedRun } from "./kiosk-light.js";
47
+ import { graphMayShow, keepsSceneInAsk, mayTellDrawn, refusalHoldsScene } from "./kiosk-graph-pane.js";
48
+ import { askDeltas, clearScene, drawScene, sceneModel, slotCounts as klSlotCounts, waitingModel } from "./kiosk-estate-scene.js"; // behold#940
43
49
  import { cardProgress as tgCardProgress, progressLines as tgProgressLines, progressSection as tgProgressSection, stampProgress as tgStampProgress } from "./terragucci-progress.js";
44
50
  import { seconds, whyQuery, whyView } from "./why.js";
45
51
  import { edgeKey, edgeLabel, edgeLegend, edgeTitle, isCiKind, viaIndex } from "./edge-kind.js";
@@ -48,6 +54,7 @@ import { networkFindings, OUTSIDE, traceRoute } from "./net-trace.js";
48
54
  import { readCostLine } from "./read-cost.js";
49
55
  import { mountHistoryPicker } from "./history-picker.js";
50
56
  import { applyMemberFrame, createMemberFrames, pendingLine, stillPending } from "./pending.js";
57
+ import { applyDriftFrame, driftLine, memberAddresses } from "./drift-stream.js";
51
58
  import { initTheme, setTheme, mountThemePicker, readableOn, inkOn, colorForCategory, onThemeChange, getTokens, getTheme, pinTokensFor, barVarFor } from "./theme.js";
52
59
  // #399 M2 / #401 M4 of #397: the colour-by modes' arithmetic and the
53
60
  // provenance badge's wording — every decision the behaviour overlay makes,
@@ -74,6 +81,8 @@ import {
74
81
  totalsText,
75
82
  deltaRows,
76
83
  } from "./behaviour-scale.js";
84
+ import { startTemplates } from "./templates.js";
85
+ import { appFrames, appRows as tplAppRows, frameOf as tplFrameOf, postAction, postUpgrade, renderAppSection } from "./template-apps.js";
77
86
  import { addPanelTab, initPanel, setPanelTab, togglePanelCollapsed, isPanelCollapsed, foldPanelOnPhone } from "./panel.js";
78
87
  // #254: the carve walkthrough's stepper — everything it DECIDES is a pure
79
88
  // function in there; this file owns the fetches, the graph selection, and the
@@ -129,7 +138,7 @@ import { danglingFor, danglingRows, danglingHeading, DANGLING_EXPLAINED } from "
129
138
  import { comparisonRow, comparisonSummary } from "./cross-env.js";
130
139
  // The marker-vs-derived mark on a choudoufu card: how its identity was found.
131
140
  import { identityMark, tagGlyphSvg } from "./identity-mark.js";
132
- import { shotFromMessage, shotViewBox, tweenViewBox, unionBox, sameViewBox, heldFrame, heldInsets, heldTarget, holdsStage, medianWidth, smallStage } from "./kiosk-shot.js"; // behold#571: Watch's camera
141
+ import { ASK_MAX_SCALE, afterFrames, debounced, shotFromMessage, shotViewBox, tweenViewBox, unionBox, sameViewBox, heldFrame, heldInsets, heldTarget, holdsStage, medianWidth, smallStage } from "./kiosk-shot.js"; // behold#571: Watch's camera
133
142
  import { SHOT_ATTR, SHOT_CAPTION_PX, SHOT_DIM, queryFrame, readShotFrame, shotCaption, shotLit, shotProvenance, shotState } from "./shot-frame.js"; // behold#915: the page `behold shot` photographs
134
143
  import { countsLine, groupLabel, groupMarks, queryLine, queryMarks, searchKey, searchUrl, stackIndex, uncapturedLine } from "./search-view.js"; // behold#913: `q` drawn; behold#922: groups
135
144
  // #712, #715: the dots layer, the zoom past the cards. Mounted for a live
@@ -1266,6 +1275,20 @@ function inspect(node) {
1266
1275
  panel.appendChild(p);
1267
1276
  }
1268
1277
  }
1278
+ // behold#1036: the app this card is part of, and the requests that change it.
1279
+ const tplFrame = tplFrameOf(tplFrames, node.id);
1280
+ if (tplFrame)
1281
+ renderAppSection(panel, tplFrame, tplAppUi, {
1282
+ publicMode,
1283
+ embed: !!embedOpts.embed,
1284
+ staticMode,
1285
+ said: tplSaid[tplFrame.app.app],
1286
+ // behold#1037: the app's actions, their gate cards from chant/lifecycle and their history from the audit record.
1287
+ actionSaid: tplActionSaid[tplFrame.app.app],
1288
+ actionRefusal: tplActionRefusal,
1289
+ lane: tgLifecycle,
1290
+ timeline: tgTimeline,
1291
+ });
1269
1292
  // #681: what the open change set would do to this card, entry by entry.
1270
1293
  const csEntries = csAnswer && csOn ? csEntriesFor(csAnswer, node.id) : [];
1271
1294
  if (csEntries.length) {
@@ -1576,10 +1599,69 @@ function inspect(node) {
1576
1599
  }
1577
1600
  }
1578
1601
 
1602
+ // #997: a choudoufu or terraform member's one card. chant records no
1603
+ // release for it, so its last apply is the run index's newest apply of the
1604
+ // member that passed, and the run after it that did not pass, if any.
1605
+ if (node.lexicon === "member-runs") {
1606
+ const runs = section("runs");
1607
+ const last = node.attrs._lastApply;
1608
+ if (last) {
1609
+ if (last.url) {
1610
+ const a = document.createElement("a");
1611
+ a.href = last.url;
1612
+ a.textContent = `${last.runId} · ${last.forge}`;
1613
+ a.target = "_blank";
1614
+ a.rel = "noreferrer noopener";
1615
+ a.title = `${last.url}, the address the run index entry itself carries. behold never invents this link.`;
1616
+ runs("last apply", a);
1617
+ } else {
1618
+ runs("last apply", `${last.runId} · ${last.forge}`);
1619
+ }
1620
+ runs("commit", last.commit);
1621
+ runs("ended", last.ended);
1622
+ } else {
1623
+ runs("last apply", "none in the run index");
1624
+ }
1625
+ const since = node.attrs._runSince;
1626
+ if (since) {
1627
+ runs("since", `${since.job} ${since.status === "fail" ? "failed" : since.status} at ${since.commit.slice(0, 12)}`);
1628
+ runs("", `run ${since.runId}, ended ${since.ended}, ${since.member ? `for ${since.member}` : "for the whole workspace"}.`);
1629
+ } else if (typeof node.attrs.runs === "string") {
1630
+ runs("", node.attrs.runs === "no run index read" ? "behold was given no run index (--ci-report-url), so it has no run of this member to show." : `${node.attrs.runs}: chant's run index names no apply of this member.`);
1631
+ }
1632
+ // behold#1010: the TerraformApplyOp runs on a machine that applied this
1633
+ // member's root, from chant's Op run ledger (`chant ledger runs --where
1634
+ // root_member=<member>`), newest first. A run whose root chant does not
1635
+ // know is on no card.
1636
+ const localApplies = node.attrs._localApplies;
1637
+ if (Array.isArray(localApplies)) {
1638
+ const local = section("local applies");
1639
+ if (!localApplies.length) local("", "chant's Op run ledger names no run that applied this member's root.");
1640
+ for (const r of localApplies) {
1641
+ const when = r.ended || r.started || "";
1642
+ const words = `${r.status}${r.gitSha ? ` at ${r.gitSha.slice(0, 12)}` : ""}${when ? `, ${when}` : ""}`;
1643
+ const label = r.root || r.op || r.runId;
1644
+ if (r.url) {
1645
+ const a = document.createElement("a");
1646
+ a.href = r.url;
1647
+ a.textContent = words;
1648
+ a.target = "_blank";
1649
+ a.rel = "noreferrer noopener";
1650
+ a.title = `${r.url}, the address the run record itself carries. behold never invents this link.`;
1651
+ local(label, a);
1652
+ } else {
1653
+ local(label, words);
1654
+ }
1655
+ local("", `run ${r.runId} of ${r.op || "an Op"}${r.declaredBy ? ` declared in ${r.declaredBy}` : ""}${r.env ? `, env ${r.env}` : ""}.`);
1656
+ }
1657
+ }
1658
+ }
1659
+
1579
1660
  // Declared attributes — the source-of-truth values / cross-resource refs.
1580
1661
  // The `release` chip is the card's abbreviation of the section above, not a
1581
1662
  // declared value, so it stays out of this list when the section rendered.
1582
- const attrKeys = Object.keys(node.attrs || {}).filter((k) => !k.startsWith("_") && !((k === "release" || k === "since") && release));
1663
+ const memberRuns = node.lexicon === "member-runs";
1664
+ const attrKeys = Object.keys(node.attrs || {}).filter((k) => !k.startsWith("_") && !((k === "release" || k === "since") && release) && !(memberRuns && (k === "apply" || k === "since" || k === "runs" || k === "local")));
1583
1665
  if (attrKeys.length) {
1584
1666
  const decl = section("declared");
1585
1667
  // #393 item 10: a choudoufu card that can be adopted leads with the write
@@ -2181,6 +2263,10 @@ function ensureViewToggles(host) {
2181
2263
  host.appendChild(bar);
2182
2264
  }
2183
2265
  bar.innerHTML = "";
2266
+ if (document.documentElement.classList.contains("kiosk-ask")) {
2267
+ bar.style.display = "none"; // behold#940: ask mode shows the graph and the prompt alone
2268
+ return;
2269
+ }
2184
2270
  if (isEstate()) {
2185
2271
  const b = button("▦ stack alike", "vt" + (view.alike && alikeZoom() ? " active" : ""), toggleAlike);
2186
2272
  b.title = ALIKE_TITLE;
@@ -2325,6 +2411,14 @@ function renderPanelView() {
2325
2411
  lanes.title = "The time-lanes view — captured frames of this graph over time";
2326
2412
  lanes.style.cssText = "color:var(--pending);text-decoration:none;font-size:var(--t-body)";
2327
2413
  row.appendChild(lanes);
2414
+ // behold#1027: the graph pane, every member's graph and every index in one LadybugDB, asked in Cypher.
2415
+ const cypher = document.createElement("a");
2416
+ cypher.className = "lanes-link";
2417
+ cypher.href = "/graph";
2418
+ cypher.textContent = "cypher →";
2419
+ cypher.title = "The graph pane: ask every member's graph and every index in Cypher, or start from a resource name or cloud id";
2420
+ cypher.style.cssText = "color:var(--pending);text-decoration:none;font-size:var(--t-body);margin-left:10px";
2421
+ row.appendChild(cypher);
2328
2422
  tools.appendChild(row);
2329
2423
  // #882: the picture's options: its scale, and whether a heading and the key go in.
2330
2424
  const png = document.createElement("div");
@@ -4329,6 +4423,74 @@ function markPendingCards(ir) {
4329
4423
  }
4330
4424
  }
4331
4425
 
4426
+ /**
4427
+ * behold#998: the cards a drift stream reached (web/drift-stream.js). A card
4428
+ * a record coloured wears its tone on the bar and the outline, with
4429
+ * `data-drift-status` naming the record's status; a card a started read has
4430
+ * not reported yet is `data-drift-reading`, dimmed and dashed, and its fill
4431
+ * is left alone, since reading is not a status. The same post-render stamp
4432
+ * as markPendingCards, for the same reason. `only`, when given, limits the
4433
+ * pass to those ids, so a frame repaints the cards it moved and no others.
4434
+ */
4435
+ function markStreamedDrift(ir, only) {
4436
+ const svg = document.querySelector("#graph svg");
4437
+ if (!svg) return;
4438
+ const ids = only ? new Set(only) : null;
4439
+ for (const n of (ir && ir.nodes) || []) {
4440
+ if (ids && !ids.has(n.id)) continue;
4441
+ const a = n.attrs || {};
4442
+ if (!a._drift && !a._driftReading && !ids) continue;
4443
+ const g = svg.querySelector('[data-node-id="' + CSS.escape(n.id) + '"]');
4444
+ if (!g) continue;
4445
+ g.toggleAttribute("data-drift-reading", !!a._driftReading);
4446
+ let tip = g.querySelector("title[data-drift]");
4447
+ if (a._driftReading) {
4448
+ if (!tip) {
4449
+ tip = document.createElementNS("http://www.w3.org/2000/svg", "title");
4450
+ tip.setAttribute("data-drift", "1");
4451
+ g.prepend(tip);
4452
+ }
4453
+ tip.textContent = "reading: the drift read has started and has not reported this card yet";
4454
+ }
4455
+ if (!a._drift) {
4456
+ if (tip) tip.remove();
4457
+ continue;
4458
+ }
4459
+ g.setAttribute("data-drift-status", a._drift.status);
4460
+ g.setAttribute("data-drift-tone", a._status || "neutral");
4461
+ // behold#995: a status or read outside the (status, read) table is neutral, and the card says it is unknown.
4462
+ g.toggleAttribute("data-drift-unknown", !!a._drift.unknown);
4463
+ if (a._drift.notReached) g.setAttribute("data-drift-not-reached", "");
4464
+ else g.removeAttribute("data-drift-not-reached");
4465
+ const tone = a._status || "neutral";
4466
+ const bar = g.querySelector('rect[width="4"]');
4467
+ if (bar) bar.setAttribute("fill", tone === "runtime" ? "var(--runtime)" : `var(--pin-${tone}Bar)`);
4468
+ const card = g.querySelector("rect");
4469
+ if (card && card !== bar) card.setAttribute("stroke", `var(--pin-${tone}Stroke)`);
4470
+ if (!a._driftReading) {
4471
+ if (!tip) {
4472
+ tip = document.createElementNS("http://www.w3.org/2000/svg", "title");
4473
+ tip.setAttribute("data-drift", "1");
4474
+ g.prepend(tip);
4475
+ }
4476
+ tip.textContent = `${a._drift.label} (${a._drift.read} read)`;
4477
+ }
4478
+ }
4479
+ }
4480
+
4481
+ /** behold#998: ask the server to stream one member's drift. Frames arrive on /api/events. */
4482
+ async function startDriftStream(member) {
4483
+ const m = declaredMember(member);
4484
+ const body = { member, ...(m && m.kind === "choudoufu" ? { addresses: memberAddresses(lastGraphIr, member) } : {}) };
4485
+ try {
4486
+ const r = await fetch("/api/workspace/drift/stream", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body) });
4487
+ const j = await r.json().catch(() => ({}));
4488
+ if (!r.ok) showToast(j.error || `the drift stream did not start (${r.status})`, false);
4489
+ } catch (e) {
4490
+ showToast(`the drift stream did not start: ${e.message}`, false);
4491
+ }
4492
+ }
4493
+
4332
4494
  /**
4333
4495
  * The marker-vs-derived mark on each choudoufu card the live overlay bound
4334
4496
  * (`attrs._identity`, src/choudoufu-live.ts): a small tag badge on the card's
@@ -4532,6 +4694,8 @@ async function loadTerragucci({ fresh = false } = {}) {
4532
4694
  .then((r) => r.json())
4533
4695
  .catch((e) => ({ error: String(e), code: "terragucci-report", remedy: "" }));
4534
4696
  tgAnswer = answer;
4697
+ sceneInPlaceOfRefusal();
4698
+ klGate();
4535
4699
  // #506: the timeline, whole; the inspect pane filters it by a card's root.
4536
4700
  tgTimeline = await apiFetch(`/api/terragucci/timeline${fresh ? "?fresh=1" : ""}`)
4537
4701
  .then((r) => r.json())
@@ -4559,6 +4723,7 @@ async function refreshTgAnswer() {
4559
4723
  .then((r) => r.json())
4560
4724
  .catch((e) => ({ error: String(e), code: "terragucci-report", remedy: "" }));
4561
4725
  if (!answer.error || !tgAnswer) tgAnswer = answer;
4726
+ sceneInPlaceOfRefusal();
4562
4727
  renderTerragucciPanel();
4563
4728
  markTerragucciCards();
4564
4729
  drawTgReads();
@@ -4608,11 +4773,142 @@ function tgPushFits(answer) {
4608
4773
  function tgAnswerDrawn() {
4609
4774
  return tgPinnedAnswer(tgAnswer, view.run, view.pull || null);
4610
4775
  }
4776
+ // A prompt-driven step holds the graph from the moment its prompt starts until its reply is done or its status shows
4777
+ // (the kiosk posts behold:hold, then a behold:light): progress that lands in between is queued, the latest one drawn then.
4778
+ let klHold = null;
4779
+ let klHeldPaint = false;
4780
+ function klReleaseHold() {
4781
+ if (klHold) clearTimeout(klHold);
4782
+ klHold = null;
4783
+ if (klHeldPaint) {
4784
+ klHeldPaint = false;
4785
+ paintTgProgress();
4786
+ }
4787
+ }
4611
4788
  function paintTgProgress() {
4789
+ if (klHold) {
4790
+ klHeldPaint = true;
4791
+ return;
4792
+ }
4612
4793
  tgStampProgress(document.querySelector("#graph svg"), tgProgress, new Date());
4613
4794
  drawTgReads(); // #568: the run view's reads, once the change merged
4614
4795
  renderTerragucciPanel();
4615
4796
  }
4797
+ // behold#937: the kiosk's last `behold:light` message and what draws it (web/kiosk-light-frame.js).
4798
+ let klMsg = null;
4799
+ let klCtx = null;
4800
+ const klPulsed = { token: null };
4801
+ function klRedraw() {
4802
+ if (!klCtx || !klMsg || !klCtx.svg.isConnected) return;
4803
+ klDraw(klCtx.svg, klMsg, klCtx.drawnAnswer, klProgress(), { cardsOf: klCtx.cardsOf, rootBox: klCtx.rootBox, boxHost: klCtx.boxHost, compMode: klCtx.compMode, pulsed: klCtx.pulsed, below: document.documentElement.classList.contains("kiosk-ask") });
4804
+ klTellLit();
4805
+ }
4806
+ // behold#tips-yield: where the lit cards are on screen (frame pixels), so the kiosk's tip card never covers what the
4807
+ // prompt talks about. Told when the lighting is drawn and again whenever the boxes move (a fit, a zoom), only on change.
4808
+ let klLitSaid = "";
4809
+ function klTellLit() {
4810
+ if (!embedOpts.host || window.parent === window || !document.documentElement.classList.contains("kiosk-ask")) return;
4811
+ const rects = [...document.querySelectorAll('#graph [data-kl="lit"]')]
4812
+ .map((g) => g.getBoundingClientRect())
4813
+ .filter((r) => r.width > 0 && r.height > 0)
4814
+ .map((r) => [Math.round(r.left), Math.round(r.top), Math.round(r.width), Math.round(r.height)]);
4815
+ const said = JSON.stringify(rects);
4816
+ if (said === klLitSaid) return;
4817
+ klLitSaid = said;
4818
+ try {
4819
+ window.parent.postMessage({ type: "behold:lit-rects", rects }, embedOpts.host);
4820
+ } catch {
4821
+ /* the parent went away */
4822
+ }
4823
+ }
4824
+ setInterval(klTellLit, 400);
4825
+ // behold#940: the kiosk's word that ask mode is on, which holds between the shots (the frame's class follows it or a shot's `ask`).
4826
+ let klAskFlag = false;
4827
+ let klAskHeard = false;
4828
+ let klArranged = false;
4829
+ function klSetAsk(on) {
4830
+ const root = document.documentElement.classList;
4831
+ const was = root.contains("kiosk-ask");
4832
+ root.toggle("kiosk-ask", on);
4833
+ klGate();
4834
+ if (was !== on && embedOpts.bare) drawTgReads();
4835
+ }
4836
+ /** The room the graph has in ask mode, in the pane's own pixels: the pane less what the prompt covers. */
4837
+ function klRoom() {
4838
+ const host = document.getElementById("graph");
4839
+ if (!host) return null;
4840
+ const pane = host.getBoundingClientRect();
4841
+ const i = kioskShot ? kioskPaneInsets(kioskShot) : { top: 0, right: 0, bottom: 0, left: 0 };
4842
+ const width = pane.width - i.left - i.right;
4843
+ const height = pane.height - i.top - i.bottom;
4844
+ return width > 0 && height > 0 ? { width, height } : { width: pane.width, height: pane.height };
4845
+ }
4846
+ /**
4847
+ * Ask mode lays the roots out for the room (web/kiosk-ask-layout.js): stacked, upstream on top, so the cards fill a
4848
+ * wide screen. A composed choudoufu run has none of its resources in the graph, so its scene is drawn from the run's
4849
+ * reports in place of the graph's cards (web/kiosk-estate-scene.js). Left, the graph goes back as it was drawn.
4850
+ * Idempotent: each call paints from what the graph drew.
4851
+ */
4852
+ function sceneUpOn(svg) {
4853
+ return !!(svg && svg.querySelector(":scope > [data-kl-scene]"));
4854
+ }
4855
+ /** The frame may show its svg (web/kiosk-graph-pane.js graphMayShow), and the class that lets it (kiosk.html: hidden otherwise in ask mode). */
4856
+ function klGate() {
4857
+ const svg = document.querySelector("#graph svg");
4858
+ const settled = !!(tgAnswer && !tgAnswer.error && Array.isArray(tgAnswer.roots));
4859
+ const mayShow = graphMayShow({ askOn: document.documentElement.classList.contains("kiosk-ask"), components: !!view.components, sceneUp: sceneUpOn(svg), answerSettled: settled, answerHasScene: settled && !!tgAnswer.estateScene });
4860
+ document.documentElement.classList.toggle("kl-show", mayShow);
4861
+ return { mayShow };
4862
+ }
4863
+ function klArrange(svg) {
4864
+ const on = document.documentElement.classList.contains("kiosk-ask") && !view.components;
4865
+ const answer = on ? tgAnswerDrawn() : null;
4866
+ if (!on || !answer || answer.error || !Array.isArray(answer.roots) || !answer.roots.length) {
4867
+ // Ask mode still on and a scene up: a read that is stale or failed for a moment (the reports as they are written)
4868
+ // keeps the last drawn scene. A composed run's graph has no cards of its own, so going back to it would be blank.
4869
+ if (keepsSceneInAsk({ askOn: on, sceneUp: sceneUpOn(svg) })) return;
4870
+ if (klArranged) {
4871
+ clearScene(svg);
4872
+ reloadLayoutDeltas();
4873
+ klArranged = false;
4874
+ }
4875
+ return;
4876
+ }
4877
+ const progress = klProgress();
4878
+ const plan = klPlanOf(answer, progress);
4879
+ const open = klRoom();
4880
+ // The pin hides the plan for now (a pull request being planned, the reset): the estates' boxes, each waiting for
4881
+ // its cards, in place of a dark pane or the last act's cards.
4882
+ const model = sceneModel(answer, plan, progress, open) || klWaitingModel(answer, progress, open);
4883
+ if (model) {
4884
+ const first = !klArranged;
4885
+ drawScene(svg, model);
4886
+ klArranged = true;
4887
+ klGate();
4888
+ // The first draw: fit to it at once (no swoop from the graph's own framing), and again once layout and paint settle.
4889
+ if (first) {
4890
+ refitNow();
4891
+ afterFrames(requestAnimationFrame, refitNow);
4892
+ }
4893
+ return;
4894
+ }
4895
+ // Ask mode: the plain graph never paints. A scene up stays when the pin hides the plan for a moment, and with none up
4896
+ // yet the graph's own drawing is held back (klPlainGate) until the scene comes.
4897
+ if (sceneUpOn(svg) || !klGate().mayShow) return;
4898
+ if (svg.__klStash) clearScene(svg);
4899
+ if (!layoutIndex) return;
4900
+ const extras = Object.fromEntries(Object.entries(klSlotCounts(plan)).map(([id, n]) => [id, n * 22 + 6]));
4901
+ const got = askDeltas({ roots: answer.roots, nodes: layoutIndex.nodes, boxes: layoutIndex.boxes, extras, edges: plan.edges, open });
4902
+ if (!got) return;
4903
+ layoutDeltas = got.deltas;
4904
+ renderLayout();
4905
+ klArranged = true;
4906
+ }
4907
+ /** behold: the waiting scene, from the unpinned reports' estates, when the pinned answer is the same run's with its plan held back. */
4908
+ function klWaitingModel(pinned, progress, open) {
4909
+ if (!tgAnswer || tgAnswer.error || pinned.estateScene) return null;
4910
+ return waitingModel(tgAnswer, klPlanOf(tgAnswer, progress), open);
4911
+ }
4616
4912
  // #568: the reads edges between roots of one repo, drawn over the card view.
4617
4913
  // #569: drawn so the view shows the change without the panel: each read is a
4618
4914
  // line from the reader (its data card when the checkout draws one, else its
@@ -4627,6 +4923,7 @@ const TG_TONE = { plan: "var(--frame-pending, var(--pending))", wait: "var(--fra
4627
4923
  /** The same, for words on a card: read on the card's own ground. */
4628
4924
  const TG_CARD_TONE = Object.fromEntries(Object.entries(TG_TONE).map(([k, v]) => [k, v.replace("--frame-", "--frame-card-")]));
4629
4925
  function drawTgReads() {
4926
+ klGate();
4630
4927
  if (embedOpts.bare) queueMicrotask(kioskDecorate); // behold#571: once this draw is done
4631
4928
  if (embedOpts.bare) queueMicrotask(() => (kioskShot ? applyKioskShot(false) : kioskTellBoxes())); // behold#571: the marks moved the boxes
4632
4929
  if (embedOpts.bare) queueMicrotask(kioskTellDrawn); // behold#571: the kiosk swaps a reloaded frame in once it has drawn
@@ -4668,6 +4965,7 @@ function drawTgReads() {
4668
4965
  // Report minor 34: last draw's cone lights go; drawConeLights sets this draw's.
4669
4966
  if (chantMode || !tgAnswer || tgAnswer.error || !tgAnswer.roots) drawConeLights(svg, { stage: null });
4670
4967
  if (!chantMode && (!tgAnswer || tgAnswer.error || !tgAnswer.roots)) return;
4968
+ if (embedOpts.bare && !chantMode) klArrange(svg); // behold#940
4671
4969
  const toSvg = svg.getScreenCTM && svg.getScreenCTM();
4672
4970
  if (!toSvg) return;
4673
4971
  const inv = toSvg.inverse();
@@ -4712,6 +5010,16 @@ function drawTgReads() {
4712
5010
  const rect = groupRect(path);
4713
5011
  return (rect && boxOf(rect)) || union(cardsOf(path).map(boxOf).filter(Boolean));
4714
5012
  };
5013
+ // behold#940: the box's own group and rect, in the group's own units, for a label that rides with the box.
5014
+ const boxHost = (path) => {
5015
+ const rect = groupRect(path);
5016
+ const parent = rect && rect.parentNode;
5017
+ if (!parent || !parent.hasAttribute || !parent.hasAttribute("data-layout-box")) return null;
5018
+ const x = parseFloat(rect.getAttribute("x"));
5019
+ const y = parseFloat(rect.getAttribute("y"));
5020
+ const h = parseFloat(rect.getAttribute("height"));
5021
+ return Number.isFinite(x) && Number.isFinite(y) && h > 0 ? { parent, x, y, y2: y + h } : null;
5022
+ };
4715
5023
  const NS = "http://www.w3.org/2000/svg";
4716
5024
  const make = (tag, attrs, text) => {
4717
5025
  const n = document.createElementNS(NS, tag);
@@ -4793,7 +5101,9 @@ function drawTgReads() {
4793
5101
  layer.parentNode.insertBefore(mark, layer);
4794
5102
  // The badge: on the box's top border, right-aligned, like a tab; the "N
4795
5103
  // resources" count in the header row under it gives way.
4796
- const local = rect.getBBox();
5104
+ // In the svg's own units, where the box is now: a box moved by a layout delta sits in a group that carries its offset.
5105
+ const placed = boxOf(rect);
5106
+ const local = placed ? { x: placed.x, y: placed.y, width: placed.x2 - placed.x, height: placed.y2 - placed.y } : rect.getBBox();
4797
5107
  const headY = local.y + 23;
4798
5108
  const tabY = local.y;
4799
5109
  for (const t of svg.querySelectorAll("text")) {
@@ -4806,8 +5116,11 @@ function drawTgReads() {
4806
5116
  }
4807
5117
  // Filled when something happened or waits on the root; an outline when nothing has yet.
4808
5118
  const solid = st.state !== "outside" && st.state !== "not-started" && st.state !== "unchanged";
4809
- const badge = pill(mark, local.x + local.width - 16, tabY, st.words, { stroke: tone, fill: solid ? tone : "var(--panel)", color: solid ? "var(--bg)" : "var(--fg)", size: 14, weight: 700, anchor: "end", cls: st.state === "applying" ? "pin-pulse" : "" });
4810
- badge.g.appendChild(make("title", {}, [st.words, ...st.facts].join("\n") + "\n(from terragucci's reports, not live)"));
5119
+ // behold#940: in ask mode the badge says the step's own word, with no wave.
5120
+ const askWords = embedOpts.bare && document.documentElement.classList.contains("kiosk-ask") ? klBadge(st, r.path, klProgress()) : null;
5121
+ const badgeText = askWords || st.words;
5122
+ const badge = pill(mark, local.x + local.width - 16, tabY, badgeText, { stroke: tone, fill: solid ? tone : "var(--panel)", color: solid ? "var(--bg)" : "var(--fg)", size: 14, weight: 700, anchor: "end", cls: st.state === "applying" ? "pin-pulse" : "" });
5123
+ badge.g.appendChild(make("title", {}, [badgeText, ...st.facts].join("\n") + "\n(from terragucci's reports, not live)"));
4811
5124
  // The facts under it, at the box's bottom right: the plan a wave waits on, its changes.
4812
5125
  // Packed into one line that fits the box, most telling first; the rest is in the badge's tooltip.
4813
5126
  if (st.facts.length) {
@@ -4841,7 +5154,7 @@ function drawTgReads() {
4841
5154
  const shown = lines.slice(0, 1);
4842
5155
  if (lines.length > 1) shown[0] += " …";
4843
5156
  shown.forEach((t, i) => {
4844
- mark.appendChild(make("text", { x: local.x + local.width - 14, y: local.y + local.height - 10 - (shown.length - 1 - i) * 15, "text-anchor": "end", "font-size": 12.5, "font-weight": 600, fill }, t));
5157
+ mark.appendChild(make("text", { x: local.x + local.width - 14, y: local.y + local.height - 10 - (shown.length - 1 - i) * 15, "text-anchor": "end", "font-size": 12.5, "font-weight": 600, fill, "data-tg-box-facts": "1" }, t));
4845
5158
  });
4846
5159
  }
4847
5160
  }
@@ -5069,6 +5382,11 @@ function drawTgReads() {
5069
5382
  }
5070
5383
  tgReadEdgesNow = edges;
5071
5384
  tgReadShow(svg);
5385
+ // behold#937: a demo step's lighting, the states' files and looks, the unknown slots, over the marks just drawn.
5386
+ if (embedOpts.bare) {
5387
+ klCtx = { svg, drawnAnswer, rootBox, boxHost, compMode, cardsOf, pulsed: klPulsed };
5388
+ klRedraw();
5389
+ }
5072
5390
 
5073
5391
  // Which run the marks come from, above the boxes.
5074
5392
  // #569: a pin that holds the view off every plan says why in its own words.
@@ -5479,6 +5797,9 @@ function ensureTgReadStyle() {
5479
5797
  #graph g[data-tg-read-pill].tg-flash { animation: tg-read-flash 6s linear both; }
5480
5798
  #graph line[data-tg-read].tg-hot { stroke-width: 5; filter: drop-shadow(0 0 3px var(--bg)); }
5481
5799
  #graph g[data-tg-read-covers] { display: none !important; }
5800
+ /* Ask mode never paints the checkout's plain resource graph: the svg is held (kl-show) until the estate scene is drawn. */
5801
+ html.kiosk-ask:not(.kl-show) #graph svg { visibility: hidden; }
5802
+ html.kiosk-ask #view-toggles, html.kiosk-ask #graph text[data-tg-reads="caption"], html.kiosk-ask #graph text[data-tg-root="wave-fact"], html.kiosk-ask #graph text[data-tg-box-facts] { display: none; }
5482
5803
  @keyframes tg-read-flash { 0% { opacity: 0; } 4%, 80% { opacity: 1; } 100% { opacity: 0; } }
5483
5804
  @keyframes tg-read-flash-step { 0%, 99.9% { opacity: 1; } 100% { opacity: 0; } }
5484
5805
  @media (prefers-reduced-motion: reduce) {
@@ -5812,7 +6133,7 @@ function chantKioskWaves(svg, boxOf, size) {
5812
6133
  else path.setAttribute("marker-end", "url(#k-then-arrow)");
5813
6134
  }
5814
6135
  // The bottom box says which way the waves go, once.
5815
- if (!svg.querySelector("text[data-kiosk-upward]")) {
6136
+ if (!svg.querySelector("text[data-kiosk-upward]") && !composedRun(tgAnswer, tgProgress)) {
5816
6137
  const boxes = [...svg.querySelectorAll("rect[data-group-id]")].filter((r) => tgWaveOfKey(r.getAttribute("data-group-id")) !== null);
5817
6138
  const low = boxes.map((r) => ({ r, b: boxOf(r) })).filter((x) => x.b).sort((a, b) => b.b.y2 - a.b.y2)[0];
5818
6139
  if (low) {
@@ -6100,6 +6421,7 @@ function markTerragucciCards() {
6100
6421
  g.append(title, tag);
6101
6422
  }
6102
6423
  drawTgReads(); // #568
6424
+ drawAppFrames(); // behold#1036: a frame's drift count follows the marks
6103
6425
  }
6104
6426
  // --- behold#571: the kiosk frame's popover, root colours and hover links -------
6105
6427
  // The kiosk frames this page bare, with no Inspect pane. Pointing at a card
@@ -6382,8 +6704,10 @@ function userBoxOf(svg, el) {
6382
6704
  } catch {
6383
6705
  return null;
6384
6706
  }
6385
- const ctm = el.getCTM && el.getCTM();
6386
- const root = svg.getCTM && svg.getCTM();
6707
+ // getScreenCTM on both: svg.getCTM() is the viewBox's matrix in Chrome but the identity in Firefox, which put every box off
6708
+ // screen there. The screen matrices both include the viewBox, so root^-1 * el is the element's matrix in the svg's user units.
6709
+ const ctm = el.getScreenCTM && el.getScreenCTM();
6710
+ const root = svg.getScreenCTM && svg.getScreenCTM();
6387
6711
  if (!ctm || !root || !(b.width > 0 || b.height > 0)) return null;
6388
6712
  const m = root.inverse().multiply(ctm);
6389
6713
  const pts = [[b.x, b.y], [b.x + b.width, b.y + b.height]].map(([x, y]) => new DOMPoint(x, y).matrixTransform(m));
@@ -6391,14 +6715,23 @@ function userBoxOf(svg, el) {
6391
6715
  }
6392
6716
 
6393
6717
  /** What a shot frames, in svg units: its roots' cards and the reads between them, its waves' boxes, else the whole graph. */
6718
+ /** What hangs under the lowest box in ask mode: its state label. */
6719
+ const ASK_LABEL_ROOM = 32;
6394
6720
  function kioskShotTarget(svg, shot) {
6395
6721
  if (!vbInit) return null;
6396
6722
  const boxes = [];
6397
6723
  if (shot.whole) {
6398
6724
  // The whole graph is what is drawn: the boxes, the cards and the reads, not pinhole's margins round them.
6399
6725
  // behold#744: not the reads' pills, which show and go while the shot stays.
6400
- for (const n of svg.querySelectorAll("rect[data-group-id], [data-node-id], [data-tg-reads] > g:not([data-tg-read-pill]), line[data-tg-read-from], text[data-tg-reads='caption']")) boxes.push(userBoxOf(svg, n));
6401
- return unionBox(boxes) || { x: vbInit[0], y: vbInit[1], x2: vbInit[0] + vbInit[2], y2: vbInit[1] + vbInit[3] };
6726
+ for (const n of svg.querySelectorAll("rect[data-group-id], [data-node-id], [data-tg-reads] > g:not([data-tg-read-pill]), line[data-tg-read-from], text[data-tg-reads='caption'], g[data-kl-state]")) boxes.push(userBoxOf(svg, n));
6727
+ const u = unionBox(boxes);
6728
+ // Ask mode: each box's state label hangs under it, and may not have drawn yet; the fit always leaves room for it, so the
6729
+ // stack sits the same before and after the labels (and centred, not low).
6730
+ if (u && shot.ask) {
6731
+ const low = Math.max(...[...svg.querySelectorAll("rect[data-group-id]")].map((r) => (userBoxOf(svg, r) || { y2: -Infinity }).y2));
6732
+ if (Number.isFinite(low)) u.y2 = Math.max(u.y2, low + ASK_LABEL_ROOM);
6733
+ }
6734
+ return u || { x: vbInit[0], y: vbInit[1], x2: vbInit[0] + vbInit[2], y2: vbInit[1] + vbInit[3] };
6402
6735
  }
6403
6736
  const named = (tgComponentFacets && tgComponentFacets.roots) || {};
6404
6737
  const roots = new Set(shot.roots);
@@ -6464,7 +6797,10 @@ function kioskShotBox() {
6464
6797
  // Only an estate on choudoufu's live backend (the cone scenario's) is held; every other keeps a shot per step, as on main.
6465
6798
  // behold#736: a story's stage (fan-out-choudoufu, a chapter-carrying scenario, behold#741) is never held: it keeps
6466
6799
  // the story's own look, its result card, #745's pills and #748's outside mark.
6467
- if (whole && !tgStoryOn() && holdsStage(tgAnswer && !tgAnswer.error ? tgAnswer.binaries : null) && smallStage(whole, pane, held ? held.insets : docked, cardW)) {
6800
+ // Ask mode is never held: the held framing is the union of every target it has seen (the graph before the scene drew included), which leaves the scene off-centre. It is fitted to the scene as drawn, every time.
6801
+ // Nor while the kiosk says ask mode is on (klAskFlag): a shot between its prompts, or a reset's, frames the scene too,
6802
+ // and never restores a framing this tab's session kept from an earlier graph.
6803
+ if (whole && !kioskShot.ask && !klAskFlag && !tgStoryOn() && holdsStage(tgAnswer && !tgAnswer.error ? tgAnswer.binaries : null) && smallStage(whole, pane, held ? held.insets : docked, cardW)) {
6468
6804
  kioskHeld = heldFrame(kioskHeld, { key: graph, pane, insets: docked, target: whole });
6469
6805
  writeHeld(kioskHeld);
6470
6806
  document.documentElement.classList.add("kiosk-held");
@@ -6474,7 +6810,8 @@ function kioskShotBox() {
6474
6810
  }
6475
6811
  kioskHeld = null;
6476
6812
  document.documentElement.classList.remove("kiosk-held");
6477
- return shotViewBox(kioskShotTarget(svg, kioskShot), pane, { ...insets, right: Math.max(insets.right, railInset(pane)) });
6813
+ // behold#939: a prompt-driven step fills the room above the pane (the graph is small, and the pane says the rest).
6814
+ return shotViewBox(kioskShotTarget(svg, kioskShot), pane, { ...insets, right: Math.max(insets.right, railInset(pane)) }, kioskShot.ask ? { maxScale: ASK_MAX_SCALE } : undefined);
6478
6815
  }
6479
6816
  /** The whole-graph framing Watch holds on a small stage while the graph and the pane stay (web/kiosk-shot.js heldFrame); null on a bigger one. */
6480
6817
  var kioskHeld = null;
@@ -6512,6 +6849,14 @@ function kioskPaneInsets(shot) {
6512
6849
 
6513
6850
  /** Move to the shot: a pan and zoom over its time, or at once (a re-render, a resize, reduced motion). */
6514
6851
  function applyKioskShot(animate) {
6852
+ // "now": a refit (a resize, the fonts, the first draw settling) sets the view directly, over any move under way.
6853
+ if (animate === "now") {
6854
+ animate = false;
6855
+ if (shotAnim) {
6856
+ cancelAnimationFrame(shotAnim.raf);
6857
+ shotAnim = null;
6858
+ }
6859
+ }
6515
6860
  // #715: while a live carve runs, its director has the camera; the shot waits for it to end.
6516
6861
  if (dotsCarving()) return kioskTellBoxes();
6517
6862
  const to = kioskShotBox();
@@ -6627,6 +6972,8 @@ function kioskTellDrawn() {
6627
6972
  if (drawnTold || !embedOpts.host || window.parent === window) return;
6628
6973
  const drawnState = graphDrawnState();
6629
6974
  if (!drawnState) return;
6975
+ // Ask mode: not drawn until the estate scene is (or the kiosk's word that ask mode is on has not come in a while: a failed draw says so at once).
6976
+ if (drawnState !== "failed" && !mayTellDrawn({ askHeard: klAskHeard, waitedMs: performance.now(), askOn: document.documentElement.classList.contains("kiosk-ask"), mayShow: klGate().mayShow })) return;
6630
6977
  const failed = drawnState === "failed";
6631
6978
  drawnTold = true;
6632
6979
  try {
@@ -6738,10 +7085,13 @@ window.addEventListener("message", (e) => {
6738
7085
  shotAnim = null;
6739
7086
  kioskShot = null;
6740
7087
  document.documentElement.classList.remove("kiosk-held"); // Inspect: the zoom rail is the viewer's again
7088
+ klSetAsk(klAskFlag);
6741
7089
  fitGraph();
6742
7090
  return;
6743
7091
  }
6744
7092
  kioskShot = shot;
7093
+ klAskHeard = true;
7094
+ klSetAsk(!!shot.ask || klAskFlag);
6745
7095
  applyKioskShot(true);
6746
7096
  });
6747
7097
 
@@ -6808,6 +7158,38 @@ function wireKioskFrame() {
6808
7158
  window.addEventListener("message", (e) => {
6809
7159
  if (!embedOpts.host || e.origin !== embedOpts.host) return;
6810
7160
  if (e.data && e.data.type === "behold:unpin") return kioskPopEvent({ type: "outside" });
7161
+ // behold#937: the demo step's lighting from the kiosk (web/kiosk-light.js lightMessage).
7162
+ if (e.data && e.data.type === "behold:hold") {
7163
+ if (klHold) clearTimeout(klHold);
7164
+ klHold = setTimeout(klReleaseHold, 120000); // slow typing and queued steps hold it for a while; a step that never finishes does not freeze the graph for good
7165
+ return;
7166
+ }
7167
+ if (e.data && e.data.type === "behold:light") {
7168
+ const wasHeld = !!klHold;
7169
+ if (klHold) {
7170
+ clearTimeout(klHold);
7171
+ klHold = null;
7172
+ }
7173
+ klMsg = { labels: e.data.labels === true, lit: e.data.lit === true, ids: Array.isArray(e.data.ids) ? e.data.ids.filter((x) => typeof x === "string") : [], roots: Array.isArray(e.data.roots) ? e.data.roots.filter((x) => typeof x === "string") : [], ghost: e.data.ghost === true, token: e.data.token ?? null };
7174
+ klRedraw();
7175
+ if (wasHeld && klHeldPaint) {
7176
+ klHeldPaint = false;
7177
+ paintTgProgress();
7178
+ }
7179
+ // behold#940: drawn at once from what the frame holds, and again as soon as its reads are fresh: never at a poll's turn.
7180
+ if (!staticMode && tgAnswer) {
7181
+ void refreshTgAnswer();
7182
+ void loadTgProgress({ fresh: true });
7183
+ }
7184
+ return;
7185
+ }
7186
+ // behold#940: ask mode is on or off for this step, whatever the shots say between prompts.
7187
+ if (e.data && e.data.type === "behold:ask") {
7188
+ klAskFlag = e.data.on === true;
7189
+ klAskHeard = true;
7190
+ klSetAsk(klAskFlag || !!(kioskShot && kioskShot.ask));
7191
+ return;
7192
+ }
6811
7193
  // behold#571: the kiosk's theme picker moved; follow it here without a reload.
6812
7194
  if (e.data && e.data.type === "behold:theme" && typeof e.data.name === "string") return void setTheme(e.data.name, { persist: false });
6813
7195
  // behold#741: the scenario carries chapters (or stopped carrying them): the kiosk's look, and the wave blocks, follow.
@@ -7068,6 +7450,160 @@ async function initLocalRuns() {
7068
7450
  }
7069
7451
  initLocalRuns();
7070
7452
 
7453
+ // --- behold#999: adopt a stock member into its engine tier --------------------
7454
+ // A Terraform root into choudoufu: promote's dry-run report per root and the
7455
+ // gated command. A Pulumi stack into plunge: plunge stack adopt's
7456
+ // classification and the confirm command. Start runs a command, so the tab is
7457
+ // drawn only where Local is: a served workspace, never in a public view, an
7458
+ // embed, a static export or a guarded repo. Preview draws it with Start
7459
+ // disabled (the route refuses it there too).
7460
+ async function initAdopt() {
7461
+ if (staticMode || publicMode || embedOpts.embed) return;
7462
+ const project = await apiFetch("/api/project").then((r) => r.json()).catch(() => ({}));
7463
+ if (!project.workspace || project.publicMode || project.terragucci || project.sqlYodeler) return;
7464
+ const offer = await apiFetch("/api/adopt").then((r) => r.json()).catch(() => ({}));
7465
+ if (!Array.isArray(offer.offers) || !offer.offers.length) return;
7466
+ const host = addPanelTab("adopt", "Adopt", "Adopt a stock member into its engine tier: a Terraform root into choudoufu with chant workspace promote, a Pulumi stack into plunge with plunge stack adopt. Each is gated; nothing is written before a person approves or confirms.");
7467
+ if (!host) return;
7468
+ host.id = "tab-adopt";
7469
+ let started = false;
7470
+ const start = () => {
7471
+ if (started) return;
7472
+ started = true;
7473
+ startAdopt(host, { fetchJson: (url, init) => fetch(url, init).then((r) => r.json()), events, toast: showToast });
7474
+ };
7475
+ const tab = document.querySelector('#panel-tabs button[data-tab="adopt"]');
7476
+ if (tab) tab.addEventListener("click", start);
7477
+ if (host.classList.contains("active")) start();
7478
+ }
7479
+ initAdopt();
7480
+
7481
+ // --- behold#1035: apps from a terragucci repo's templates ---------------------
7482
+ // The opposite of the guarded-repo rule: drawn only on a terragucci repo whose
7483
+ // terragucci.yml sets templates (/api/project's terragucciTemplates). Request
7484
+ // dispatches terragucci's request workflow, which opens the pull request in
7485
+ // CI; behold writes nothing. Never in a public view, an embed or a static export.
7486
+ async function initTemplates() {
7487
+ if (staticMode || publicMode || embedOpts.embed) return;
7488
+ const project = await apiFetch("/api/project").then((r) => r.json()).catch(() => ({}));
7489
+ if (!project.terragucciTemplates || project.publicMode) return;
7490
+ tplActionRefusal = project.terragucciActionRefusal || null;
7491
+ const host = addPanelTab("templates", "Templates", "Apps this repo can make from a template: fill in a form, and terragucci opens the pull request that adds the app.");
7492
+ if (!host) return;
7493
+ host.id = "tab-templates";
7494
+ let started = null;
7495
+ const start = () => {
7496
+ started ??= startTemplates(host, { fetchJson: (url, init) => fetch(url, init).then((r) => r.json()), events, toast: showToast });
7497
+ return started;
7498
+ };
7499
+ const tab = document.querySelector('#panel-tabs button[data-tab="templates"]');
7500
+ if (tab) tab.addEventListener("click", start);
7501
+ if (host.classList.contains("active")) start();
7502
+ // behold#1036: an app's Add an add-on opens this tab on its add-on templates.
7503
+ tplOpenAddons = (app) => {
7504
+ setPanelTab("templates");
7505
+ start().ui.forApp(app);
7506
+ };
7507
+ await loadTemplateApps();
7508
+ }
7509
+ initTemplates();
7510
+
7511
+ // --- behold#1036: apps made from templates, framed on the graph ---------------
7512
+ // GET /api/templates/apps names each app's root, template and add-ons. Their
7513
+ // cards (module.app and each add-on's module) draw inside one frame, titled
7514
+ // with the app and its template, whose header counts the cards terragucci's
7515
+ // reports mark as drifted. The marks stay on the cards. A card in a frame
7516
+ // shows the app's requests in the inspect pane; behold dispatches, the
7517
+ // pipeline plans and applies.
7518
+ var tplApps = null; // var: render() may draw before this line is reached
7519
+ var tplFrames = [];
7520
+ var tplSaid = {};
7521
+ var tplOpenAddons = null;
7522
+ var tplActionSaid = {}; // behold#1037: the last action press's answer, by app
7523
+ var tplActionRefusal = null; // ruling E: /api/project's terragucciActionRefusal
7524
+ var tplAppUi = {
7525
+ // behold#1037: an action button dispatches terragucci's action workflow; the gate card then shows the approve line for someone else.
7526
+ action: async (app, b) => {
7527
+ if (b.disabled) return;
7528
+ const answer = await postAction((url, init) => fetch(url, init).then((r) => r.json()), b.body);
7529
+ tplActionSaid[app.app] = answer;
7530
+ if (answer && answer.error) showToast(`✗ ${b.label} on ${app.root}: ${answer.error}`, false);
7531
+ else showToast(`▶ ${b.label} on ${app.root} asked for; it waits for someone else's approval`, true);
7532
+ loadTerragucciLane({ fresh: true });
7533
+ const panel = document.getElementById("inspect-body");
7534
+ const shown = panel && panel.dataset.node && lastGraphIr && lastGraphIr.nodes.find((n) => n.id === panel.dataset.node);
7535
+ if (shown) inspect(shown);
7536
+ },
7537
+ gateCard: (card) => gateCardElement(card, { button, copy: copyToClipboard, link: tgLink }),
7538
+ addAddon: (app) => tplOpenAddons && tplOpenAddons(app.app),
7539
+ upgrade: async (app, body) => {
7540
+ const answer = await postUpgrade((url, init) => fetch(url, init).then((r) => r.json()), body);
7541
+ tplSaid[app.app] = answer;
7542
+ if (answer && answer.error) showToast(`✗ upgrade ${app.app}: ${answer.error}`, false);
7543
+ else showToast(`▶ upgrade of ${app.template} to ${body.version} started`, true);
7544
+ const panel = document.getElementById("inspect-body");
7545
+ const shown = panel && panel.dataset.node && lastGraphIr && lastGraphIr.nodes.find((n) => n.id === panel.dataset.node);
7546
+ if (shown) inspect(shown);
7547
+ },
7548
+ };
7549
+ async function loadTemplateApps() {
7550
+ if (staticMode || publicMode || embedOpts.embed) return;
7551
+ const a = await apiFetch("/api/templates/apps").then((r) => r.json()).catch(() => null);
7552
+ tplApps = a && !a.error ? a : null;
7553
+ drawAppFrames();
7554
+ }
7555
+ function drawAppFrames() {
7556
+ const svg = document.querySelector("#graph svg");
7557
+ if (!svg) return;
7558
+ for (const old of svg.querySelectorAll("[data-tpl-app]")) old.remove();
7559
+ const apps = tplAppRows(tplApps);
7560
+ if (!apps.length) return void (tplFrames = []);
7561
+ const byId = new Map(((lastGraphIr && lastGraphIr.nodes) || []).map((n) => [n.id, n]));
7562
+ const drawn = [...svg.querySelectorAll("[data-node-id]")].map((g) => g.getAttribute("data-node-id") || "");
7563
+ const nodes = drawn.map((id) => byId.get(id) || { id });
7564
+ tplFrames = appFrames(apps, nodes, { roots: (tgAnswer && !tgAnswer.error && tgAnswer.roots) || [], cards: (tgAnswer && tgAnswer.cards) || {} });
7565
+ const toSvg = svg.getScreenCTM && svg.getScreenCTM();
7566
+ if (!toSvg) return;
7567
+ const inv = toSvg.inverse();
7568
+ const boxOf = (g) => {
7569
+ let b;
7570
+ try {
7571
+ b = g.getBBox();
7572
+ } catch {
7573
+ return null;
7574
+ }
7575
+ const ctm = g.getScreenCTM && g.getScreenCTM();
7576
+ if (!ctm || !b.width) return null;
7577
+ const m = inv.multiply(ctm);
7578
+ const pts = [[b.x, b.y], [b.x + b.width, b.y + b.height]].map(([x, y]) => new DOMPoint(x, y).matrixTransform(m));
7579
+ return { x: Math.min(pts[0].x, pts[1].x), y: Math.min(pts[0].y, pts[1].y), x2: Math.max(pts[0].x, pts[1].x), y2: Math.max(pts[0].y, pts[1].y) };
7580
+ };
7581
+ const NS = "http://www.w3.org/2000/svg";
7582
+ const make = (tag, attrs, text) => {
7583
+ const n = document.createElementNS(NS, tag);
7584
+ for (const [k, v] of Object.entries(attrs)) n.setAttribute(k, String(v));
7585
+ if (text !== undefined) n.textContent = text;
7586
+ return n;
7587
+ };
7588
+ // Under the cards, so a card keeps its pointer and the frame never covers one.
7589
+ let under = svg.querySelector("[data-node-id]");
7590
+ while (under && under.parentNode !== svg) under = under.parentNode;
7591
+ for (const f of tplFrames) {
7592
+ const boxes = f.ids.map((id) => svg.querySelector(`[data-node-id="${CSS.escape(id)}"]`)).filter(Boolean).map(boxOf).filter(Boolean);
7593
+ if (!boxes.length) continue;
7594
+ const pad = 14;
7595
+ const b = { x: Math.min(...boxes.map((x) => x.x)) - pad, y: Math.min(...boxes.map((x) => x.y)) - pad - 22, x2: Math.max(...boxes.map((x) => x.x2)) + pad, y2: Math.max(...boxes.map((x) => x.y2)) + pad };
7596
+ const g = make("g", { "data-tpl-app": f.app.app, "pointer-events": "none" });
7597
+ g.appendChild(make("rect", { x: b.x, y: b.y, width: b.x2 - b.x, height: b.y2 - b.y, rx: 10, fill: "none", stroke: f.drifted ? "var(--frame-degraded, var(--degraded))" : "var(--rule)", "stroke-width": 1.5, "stroke-dasharray": "6 4" }));
7598
+ const title = make("text", { x: b.x + 10, y: b.y + 15, "font-size": 12, "font-weight": 700, fill: "var(--fg)" }, f.title);
7599
+ g.appendChild(title);
7600
+ if (f.drift) g.appendChild(make("text", { x: b.x2 - 10, y: b.y + 15, "text-anchor": "end", "font-size": 12, "font-weight": 700, fill: "var(--frame-degraded, var(--degraded))" }, f.drift));
7601
+ g.appendChild(make("title", {}, `${f.header}\n${f.app.root}: the app and its add-ons are one root, planned and applied together`));
7602
+ if (under) svg.insertBefore(g, under);
7603
+ else svg.appendChild(g);
7604
+ }
7605
+ }
7606
+
7071
7607
  // --- #683: feature flags, on or off per environment ---------------------------
7072
7608
  // The Flags tab reads /api/workspace/flags when it is opened: each flag of the
7073
7609
  // workspace with its owner, work item and value per environment, a flip
@@ -7869,7 +8405,7 @@ initTerragucciEstate({ fetchUrl: apiFetch, copy: copyToClipboard });
7869
8405
  function renderPanelCarve() {
7870
8406
  if (!carveMode()) return;
7871
8407
  if (!carveHost) {
7872
- carveHost = addPanelTab("carve", "Carve", "The peel walkthrough: advise → pick → emit → bridge → handoff → done.");
8408
+ carveHost = addPanelTab("carve", "Carve", "The carve walkthrough: advise → pick → emit → bridge → handoff → done.");
7873
8409
  if (!carveHost) return;
7874
8410
  carveHost.id = "tab-carve";
7875
8411
  }
@@ -8035,6 +8571,10 @@ function tgStoryRemember(marks) {
8035
8571
  // behold#741: the run view's waves at the pace chant's are played (web/terragucci-live-pace.js), while the story is on.
8036
8572
  const tgPacer = createProgressPacer();
8037
8573
  let tgPaceTimer = null;
8574
+ /** Ask mode's run view: the paced one in a story, and a reporting-only pipeline's apply reports where its commit has none. */
8575
+ function klProgress() {
8576
+ return klReported(tgStoryOn() ? tgPacedProgress() : tgProgress, tgAnswerDrawn());
8577
+ }
8038
8578
  function tgPacedProgress() {
8039
8579
  const p = tgPacer.progress(tgProgress);
8040
8580
  if (tgPacer.pending && !tgPaceTimer) {
@@ -9506,6 +10046,7 @@ function render(ir, svg, m) {
9506
10046
  markIdentityCards(ir); // the identity mark: a tag badge on the card's top-right edge
9507
10047
  markDriftedCards(ir); // #404: same, for a bound card the plan would change — after the carve/operator stamps, so it can see and yield to them
9508
10048
  markPendingCards(ir); // #422: and the cards whose member has not answered yet
10049
+ markStreamedDrift(ir); // behold#998: and the cards a drift stream coloured or is still reading
9509
10050
  markTerragucciCards(); // #490: and what terragucci's reports found, dated
9510
10051
  markYodelCards(); // #526: and SQL Yodeler's drift, dated
9511
10052
  if (csAnswer) markChangeSetCards(); // #681: and the change set a gate binds, as a preview
@@ -9514,6 +10055,7 @@ function render(ir, svg, m) {
9514
10055
  syncHealth(m); // #825: and runtime health, with the records out of rotation
9515
10056
  applyLayout(); // #228: last, so the hand-placed deltas ride on top of every other pass
9516
10057
  drawTgReads(); // #568: after the layout, so the reads lines meet the cards where they now sit
10058
+ drawAppFrames(); // behold#1036: and the apps' frames, around the cards where they now sit
9517
10059
  renderDial();
9518
10060
  }
9519
10061
 
@@ -9728,10 +10270,20 @@ function fitGraph() {
9728
10270
  let vbAtFit = false;
9729
10271
  function watchPaneForFit(host) {
9730
10272
  if (typeof ResizeObserver === "undefined") return;
9731
- new ResizeObserver(() => {
9732
- if (kioskShot) applyKioskShot(false);
9733
- else if (vbAtFit) fitGraph();
9734
- }).observe(host);
10273
+ // The refit waits for the last size change and sets the view directly: no swoop, and a resize burst fits once.
10274
+ // It moves the viewBox, never the host's box, so the observer cannot trigger itself.
10275
+ // Each change also sets the view at once, so a box is never off screen on the old framing while the burst lasts.
10276
+ const refit = debounced(refitNow);
10277
+ const onSize = () => (refitNow(), refit());
10278
+ new ResizeObserver(onSize).observe(host);
10279
+ window.addEventListener("resize", onSize);
10280
+ // Web fonts change the text's width, and with it the boxes.
10281
+ if (document.fonts && document.fonts.ready) document.fonts.ready.then(refitNow, () => {});
10282
+ }
10283
+ /** Fit again as things stand, at once. Idempotent: a fit that is already right sets nothing. */
10284
+ function refitNow() {
10285
+ if (kioskShot) applyKioskShot("now");
10286
+ else if (vbAtFit) fitGraph();
9735
10287
  }
9736
10288
 
9737
10289
  // --- #396 item 7b: box titles and badges that survive the fit ---------------
@@ -10704,6 +11256,21 @@ function renderPreconditionError(body) {
10704
11256
  host.appendChild(card);
10705
11257
  }
10706
11258
 
11259
+ // A kiosk frame's graph refused its checkout (a precondition: a chant project whose packages the view never
11260
+ // installed fails lint). A composed run's scene is drawn from the run's reports in place of the graph's cards
11261
+ // (web/kiosk-estate-scene.js), so it needs none of the graph: once the reports hold a scene, the frame draws it on an
11262
+ // empty svg instead of the refusal's card. A frame whose reports hold no scene keeps the card.
11263
+ let graphRefusal = null;
11264
+ const SCENE_ONLY_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600" width="800" height="600"></svg>';
11265
+ function sceneInPlaceOfRefusal() {
11266
+ if (!refusalHoldsScene({ refusal: graphRefusal, bare: embedOpts.bare, answer: tgAnswer })) return false;
11267
+ const note = `the graph is not drawn (${graphRefusal.code}): the run's reports draw the scene`;
11268
+ graphRefusal = null;
11269
+ render({ nodes: [], edges: [], groups: [] }, SCENE_ONLY_SVG, { note, noteShort: note });
11270
+ afterPaint({ nodes: [] });
11271
+ return true;
11272
+ }
11273
+
10707
11274
  // Fetch the current view (source graph, or the picked env's live overlay).
10708
11275
  const load = createRefreshQueue(loadOnce);
10709
11276
  async function loadOnce(opts = {}, isCurrent = () => true) {
@@ -10832,6 +11399,8 @@ async function loadOnce(opts = {}, isCurrent = () => true) {
10832
11399
  // tier that needs credentials) gets the calmer entry/error card instead
10833
11400
  // of the generic red error box — see renderPreconditionError().
10834
11401
  if (body.code) {
11402
+ graphRefusal = embedOpts.bare ? body : null;
11403
+ if (sceneInPlaceOfRefusal()) return;
10835
11404
  renderPreconditionError(body);
10836
11405
  meta.textContent = body.code === "tier" ? `tier ${view.tier} unavailable here` : "error";
10837
11406
  renderDial();
@@ -10857,6 +11426,7 @@ async function loadOnce(opts = {}, isCurrent = () => true) {
10857
11426
  pendingMembers = body.meta && body.meta.mode === "progressive" ? [...(body.meta.pending || [])] : [];
10858
11427
  pendingTotal = pendingMembers.length;
10859
11428
  if (view.components) takeTerragucciFacets(body.meta);
11429
+ graphRefusal = null;
10860
11430
  render(body.ir, body.svg, body.meta);
10861
11431
  afterPaint(body.ir);
10862
11432
  if (progressive) replayMemberFrames(frameLoad);
@@ -11064,6 +11634,24 @@ events.addEventListener("member", (e) => {
11064
11634
  renderStatusbar();
11065
11635
  });
11066
11636
 
11637
+ // behold#998: one frame per drift line, as chant prints it (src/drift-stream.ts).
11638
+ // Payload-carrying like `member`: the cards are on screen, and each frame
11639
+ // repaints the cards it moved and nothing else, so they change one by one.
11640
+ events.addEventListener("drift", (e) => {
11641
+ let frame;
11642
+ try {
11643
+ frame = JSON.parse(e.data);
11644
+ } catch {
11645
+ return;
11646
+ }
11647
+ if (!lastGraphIr) return;
11648
+ const { moved, reading } = applyDriftFrame(lastGraphIr, frame);
11649
+ if (moved.length) markStreamedDrift(lastGraphIr, moved);
11650
+ const line = driftLine(frame, reading);
11651
+ if (line) nowline(line);
11652
+ if (frame.kind === "end") renderGraphLegend();
11653
+ });
11654
+
11067
11655
  // #914: an agent's POST /api/view.
11068
11656
  events.addEventListener("view", (e) => agentMove(e.data));
11069
11657
 
@@ -12032,6 +12620,13 @@ function paletteCommands() {
12032
12620
  if (!staticMode && !publicMode && !view.env && projectInfo && (projectInfo.memberKinds || []).includes("terraform")) {
12033
12621
  c.push(["Read the plan on the Terraform roots (replaces, forcing attributes, unknowns, drift)", () => readTerraformPlan()]);
12034
12622
  }
12623
+ // behold#998: stream one member's drift, card by card. A read, but a POST.
12624
+ if (!staticMode && !publicMode && projectInfo && projectInfo.workspace) {
12625
+ for (const m of projectInfo.workspace.members || []) {
12626
+ if (m.repo || m.kind === "other") continue;
12627
+ c.push([`Stream drift card by card: ${m.name}${m.kind === "choudoufu" ? " (one resource at a time)" : ""}`, () => startDriftStream(m.name)]);
12628
+ }
12629
+ }
12035
12630
  c.push(["Fit graph to view", () => fitGraph()]);
12036
12631
  c.push(["Export: current graph as SVG", () => exportSvg()]);
12037
12632
  const inspectCollapsed = document.getElementById("app").classList.contains("inspect-collapsed");