@intentius/behold 0.30.2 → 0.32.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/AGENTS.md +791 -16
- package/README.md +78 -23
- package/THIRD_PARTY.md +6 -5
- package/demos.json +14 -9
- package/dist/cli.js +51926 -20221
- package/example-carve/README.md +19 -23
- package/example-carve/app/package.json +1 -1
- package/example-carve/app/src/carved.ts +3 -3
- package/example-carve/carve-report.json +1 -1
- package/example-carve/{legacy-tf → tf-root}/terraform.tfstate +1 -1
- package/example-choudoufu-estate/README.md +7 -0
- package/example-choudoufu-estate/chant.workspace.json +1 -1
- package/example-choudoufu-estate/scripts/choudoufu-down.sh +2 -1
- package/example-choudoufu-estate/scripts/choudoufu-up.sh +10 -3
- package/example-terraform-estate/README.md +32 -5
- package/example-terraform-estate/chant.workspace.json +1 -1
- package/example-terraform-estate/recorded/adoption/platform.json +72 -0
- package/example-terraform-estate/recorded/adoption/prod.json +224 -0
- package/example-three-cloud/README.md +111 -18
- package/example-three-cloud/aws/Pulumi.yaml +15 -0
- package/example-three-cloud/aws/index.ts +174 -0
- package/example-three-cloud/aws/package-lock.json +2725 -0
- package/example-three-cloud/aws/package.json +14 -0
- package/example-three-cloud/aws/tsconfig.json +17 -0
- package/example-three-cloud/azure/main.tf +48 -0
- package/example-three-cloud/azure/site.tf +104 -0
- package/example-three-cloud/chant.config.json +9 -0
- package/example-three-cloud/chant.workspace.json +30 -4
- package/example-three-cloud/dns/chant.config.ts +26 -1
- package/example-three-cloud/dns/src/records.component.ts +32 -6
- package/example-three-cloud/package-lock.json +48 -27
- package/example-three-cloud/package.json +8 -6
- package/example-three-cloud/scripts/emulators-up.sh +28 -1
- package/example-three-cloud/scripts/front-door.ts +679 -86
- package/package.json +26 -8
- package/schemas/graph/v1/graph.schema.json +140 -0
- package/web/adopt-pulumi.js +114 -0
- package/web/adopt-pulumi.test.js +28 -0
- package/web/adopt.js +203 -0
- package/web/adopt.test.js +27 -0
- package/web/app.js +367 -14
- package/web/boot-motion.js +6 -0
- package/web/carve-steps.js +1 -1
- package/web/carve-steps.test.js +2 -2
- package/web/change-set-overlay.js +12 -5
- package/web/change-set-overlay.test.js +22 -0
- package/web/cut-around.d.ts +30 -0
- package/web/cut-around.js +138 -0
- package/web/drift-stream.js +241 -0
- package/web/drift-stream.test.js +146 -0
- package/web/edge-weight.d.ts +8 -2
- package/web/edge-weight.js +38 -4
- package/web/edge-weight.test.js +55 -1
- package/web/graph-query.js +180 -0
- package/web/graph-query.test.js +49 -0
- package/web/graph.html +107 -0
- package/web/index-diff.js +109 -0
- package/web/index-diff.test.js +39 -0
- package/web/index.html +45 -20
- package/web/kiosk-ask-tips.js +15 -5
- package/web/kiosk-ask-tips.test.js +14 -1
- package/web/kiosk-estate-scene.js +72 -8
- package/web/kiosk-light-frame.js +1 -0
- package/web/kiosk-light.js +41 -3
- package/web/kiosk-member-kind.test.js +140 -0
- package/web/kiosk-popover.js +4 -1
- package/web/kiosk-side.js +296 -0
- package/web/kiosk-side.test.js +249 -0
- package/web/kiosk-watch.js +12 -0
- package/web/kiosk-watch.test.js +15 -1
- package/web/kiosk.html +47 -1
- package/web/kiosk.js +106 -7
- package/web/member-kind.js +31 -0
- package/web/neighbourhood.js +105 -0
- package/web/neighbourhood.test.js +131 -0
- package/web/outside-refs.js +515 -0
- package/web/outside-refs.test.js +249 -0
- package/web/template-apps.js +245 -0
- package/web/template-apps.test.js +252 -0
- package/web/templates.js +285 -0
- package/web/templates.test.js +155 -0
- package/web/terragucci-lifecycle.js +112 -62
- package/web/terragucci-lifecycle.test.js +29 -1
- package/web/terragucci-timeline.js +39 -2
- package/web/terragucci-timeline.test.js +42 -1
- package/web/theme-paint.js +14 -0
- package/example-three-cloud/aws/chant.config.ts +0 -8
- package/example-three-cloud/aws/site.component.ts +0 -13
- package/example-three-cloud/aws/src/site.ts +0 -27
- package/example-three-cloud/azure/chant.config.ts +0 -1
- package/example-three-cloud/azure/src/site.component.ts +0 -13
- package/example-three-cloud/azure/src/site.ts +0 -18
- /package/example-carve/{legacy-tf → tf-root}/cdn.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/compute.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/floci-override.tf.disabled +0 -0
- /package/example-carve/{legacy-tf → tf-root}/modules/cdn/main.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/naming.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/network.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/observability.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/outputs.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/storage.tf +0 -0
- /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";
|
|
@@ -41,10 +42,10 @@ 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";
|
|
43
44
|
import { drawLight as klDraw } from "./kiosk-light-frame.js"; // behold#937
|
|
44
|
-
import { badgeWords as klBadge, planOf as klPlanOf } from "./kiosk-light.js"; // behold#940
|
|
45
|
+
import { badgeWords as klBadge, planOf as klPlanOf, reportedRunView as klReported } from "./kiosk-light.js"; // behold#940
|
|
45
46
|
import { composedRun } from "./kiosk-light.js";
|
|
46
47
|
import { graphMayShow, keepsSceneInAsk, mayTellDrawn, refusalHoldsScene } from "./kiosk-graph-pane.js";
|
|
47
|
-
import { askDeltas, clearScene, drawScene, sceneModel, slotCounts as klSlotCounts } from "./kiosk-estate-scene.js"; // behold#940
|
|
48
|
+
import { askDeltas, clearScene, drawScene, sceneModel, slotCounts as klSlotCounts, waitingModel } from "./kiosk-estate-scene.js"; // behold#940
|
|
48
49
|
import { cardProgress as tgCardProgress, progressLines as tgProgressLines, progressSection as tgProgressSection, stampProgress as tgStampProgress } from "./terragucci-progress.js";
|
|
49
50
|
import { seconds, whyQuery, whyView } from "./why.js";
|
|
50
51
|
import { edgeKey, edgeLabel, edgeLegend, edgeTitle, isCiKind, viaIndex } from "./edge-kind.js";
|
|
@@ -53,6 +54,7 @@ import { networkFindings, OUTSIDE, traceRoute } from "./net-trace.js";
|
|
|
53
54
|
import { readCostLine } from "./read-cost.js";
|
|
54
55
|
import { mountHistoryPicker } from "./history-picker.js";
|
|
55
56
|
import { applyMemberFrame, createMemberFrames, pendingLine, stillPending } from "./pending.js";
|
|
57
|
+
import { applyDriftFrame, driftLine, memberAddresses } from "./drift-stream.js";
|
|
56
58
|
import { initTheme, setTheme, mountThemePicker, readableOn, inkOn, colorForCategory, onThemeChange, getTokens, getTheme, pinTokensFor, barVarFor } from "./theme.js";
|
|
57
59
|
// #399 M2 / #401 M4 of #397: the colour-by modes' arithmetic and the
|
|
58
60
|
// provenance badge's wording — every decision the behaviour overlay makes,
|
|
@@ -79,6 +81,8 @@ import {
|
|
|
79
81
|
totalsText,
|
|
80
82
|
deltaRows,
|
|
81
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";
|
|
82
86
|
import { addPanelTab, initPanel, setPanelTab, togglePanelCollapsed, isPanelCollapsed, foldPanelOnPhone } from "./panel.js";
|
|
83
87
|
// #254: the carve walkthrough's stepper — everything it DECIDES is a pure
|
|
84
88
|
// function in there; this file owns the fetches, the graph selection, and the
|
|
@@ -1271,6 +1275,20 @@ function inspect(node) {
|
|
|
1271
1275
|
panel.appendChild(p);
|
|
1272
1276
|
}
|
|
1273
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
|
+
});
|
|
1274
1292
|
// #681: what the open change set would do to this card, entry by entry.
|
|
1275
1293
|
const csEntries = csAnswer && csOn ? csEntriesFor(csAnswer, node.id) : [];
|
|
1276
1294
|
if (csEntries.length) {
|
|
@@ -1581,10 +1599,69 @@ function inspect(node) {
|
|
|
1581
1599
|
}
|
|
1582
1600
|
}
|
|
1583
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
|
+
|
|
1584
1660
|
// Declared attributes — the source-of-truth values / cross-resource refs.
|
|
1585
1661
|
// The `release` chip is the card's abbreviation of the section above, not a
|
|
1586
1662
|
// declared value, so it stays out of this list when the section rendered.
|
|
1587
|
-
const
|
|
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")));
|
|
1588
1665
|
if (attrKeys.length) {
|
|
1589
1666
|
const decl = section("declared");
|
|
1590
1667
|
// #393 item 10: a choudoufu card that can be adopted leads with the write
|
|
@@ -2334,6 +2411,14 @@ function renderPanelView() {
|
|
|
2334
2411
|
lanes.title = "The time-lanes view — captured frames of this graph over time";
|
|
2335
2412
|
lanes.style.cssText = "color:var(--pending);text-decoration:none;font-size:var(--t-body)";
|
|
2336
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);
|
|
2337
2422
|
tools.appendChild(row);
|
|
2338
2423
|
// #882: the picture's options: its scale, and whether a heading and the key go in.
|
|
2339
2424
|
const png = document.createElement("div");
|
|
@@ -4338,6 +4423,74 @@ function markPendingCards(ir) {
|
|
|
4338
4423
|
}
|
|
4339
4424
|
}
|
|
4340
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
|
+
|
|
4341
4494
|
/**
|
|
4342
4495
|
* The marker-vs-derived mark on each choudoufu card the live overlay bound
|
|
4343
4496
|
* (`attrs._identity`, src/choudoufu-live.ts): a small tag badge on the card's
|
|
@@ -4647,7 +4800,7 @@ let klCtx = null;
|
|
|
4647
4800
|
const klPulsed = { token: null };
|
|
4648
4801
|
function klRedraw() {
|
|
4649
4802
|
if (!klCtx || !klMsg || !klCtx.svg.isConnected) return;
|
|
4650
|
-
klDraw(klCtx.svg, klMsg, klCtx.drawnAnswer,
|
|
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") });
|
|
4651
4804
|
klTellLit();
|
|
4652
4805
|
}
|
|
4653
4806
|
// behold#tips-yield: where the lit cards are on screen (frame pixels), so the kiosk's tip card never covers what the
|
|
@@ -4721,10 +4874,12 @@ function klArrange(svg) {
|
|
|
4721
4874
|
}
|
|
4722
4875
|
return;
|
|
4723
4876
|
}
|
|
4724
|
-
const progress =
|
|
4877
|
+
const progress = klProgress();
|
|
4725
4878
|
const plan = klPlanOf(answer, progress);
|
|
4726
4879
|
const open = klRoom();
|
|
4727
|
-
|
|
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);
|
|
4728
4883
|
if (model) {
|
|
4729
4884
|
const first = !klArranged;
|
|
4730
4885
|
drawScene(svg, model);
|
|
@@ -4749,6 +4904,11 @@ function klArrange(svg) {
|
|
|
4749
4904
|
renderLayout();
|
|
4750
4905
|
klArranged = true;
|
|
4751
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
|
+
}
|
|
4752
4912
|
// #568: the reads edges between roots of one repo, drawn over the card view.
|
|
4753
4913
|
// #569: drawn so the view shows the change without the panel: each read is a
|
|
4754
4914
|
// line from the reader (its data card when the checkout draws one, else its
|
|
@@ -4957,7 +5117,7 @@ function drawTgReads() {
|
|
|
4957
5117
|
// Filled when something happened or waits on the root; an outline when nothing has yet.
|
|
4958
5118
|
const solid = st.state !== "outside" && st.state !== "not-started" && st.state !== "unchanged";
|
|
4959
5119
|
// behold#940: in ask mode the badge says the step's own word, with no wave.
|
|
4960
|
-
const askWords = embedOpts.bare && document.documentElement.classList.contains("kiosk-ask") ? klBadge(st, r.path,
|
|
5120
|
+
const askWords = embedOpts.bare && document.documentElement.classList.contains("kiosk-ask") ? klBadge(st, r.path, klProgress()) : null;
|
|
4961
5121
|
const badgeText = askWords || st.words;
|
|
4962
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" : "" });
|
|
4963
5123
|
badge.g.appendChild(make("title", {}, [badgeText, ...st.facts].join("\n") + "\n(from terragucci's reports, not live)"));
|
|
@@ -6261,6 +6421,7 @@ function markTerragucciCards() {
|
|
|
6261
6421
|
g.append(title, tag);
|
|
6262
6422
|
}
|
|
6263
6423
|
drawTgReads(); // #568
|
|
6424
|
+
drawAppFrames(); // behold#1036: a frame's drift count follows the marks
|
|
6264
6425
|
}
|
|
6265
6426
|
// --- behold#571: the kiosk frame's popover, root colours and hover links -------
|
|
6266
6427
|
// The kiosk frames this page bare, with no Inspect pane. Pointing at a card
|
|
@@ -6637,7 +6798,9 @@ function kioskShotBox() {
|
|
|
6637
6798
|
// behold#736: a story's stage (fan-out-choudoufu, a chapter-carrying scenario, behold#741) is never held: it keeps
|
|
6638
6799
|
// the story's own look, its result card, #745's pills and #748's outside mark.
|
|
6639
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.
|
|
6640
|
-
|
|
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)) {
|
|
6641
6804
|
kioskHeld = heldFrame(kioskHeld, { key: graph, pane, insets: docked, target: whole });
|
|
6642
6805
|
writeHeld(kioskHeld);
|
|
6643
6806
|
document.documentElement.classList.add("kiosk-held");
|
|
@@ -7287,6 +7450,160 @@ async function initLocalRuns() {
|
|
|
7287
7450
|
}
|
|
7288
7451
|
initLocalRuns();
|
|
7289
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
|
+
|
|
7290
7607
|
// --- #683: feature flags, on or off per environment ---------------------------
|
|
7291
7608
|
// The Flags tab reads /api/workspace/flags when it is opened: each flag of the
|
|
7292
7609
|
// workspace with its owner, work item and value per environment, a flip
|
|
@@ -8088,7 +8405,7 @@ initTerragucciEstate({ fetchUrl: apiFetch, copy: copyToClipboard });
|
|
|
8088
8405
|
function renderPanelCarve() {
|
|
8089
8406
|
if (!carveMode()) return;
|
|
8090
8407
|
if (!carveHost) {
|
|
8091
|
-
carveHost = addPanelTab("carve", "Carve", "The
|
|
8408
|
+
carveHost = addPanelTab("carve", "Carve", "The carve walkthrough: advise → pick → emit → bridge → handoff → done.");
|
|
8092
8409
|
if (!carveHost) return;
|
|
8093
8410
|
carveHost.id = "tab-carve";
|
|
8094
8411
|
}
|
|
@@ -8254,6 +8571,10 @@ function tgStoryRemember(marks) {
|
|
|
8254
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.
|
|
8255
8572
|
const tgPacer = createProgressPacer();
|
|
8256
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
|
+
}
|
|
8257
8578
|
function tgPacedProgress() {
|
|
8258
8579
|
const p = tgPacer.progress(tgProgress);
|
|
8259
8580
|
if (tgPacer.pending && !tgPaceTimer) {
|
|
@@ -9035,7 +9356,7 @@ function wireEdgeHighlight(svgEl, ir) {
|
|
|
9035
9356
|
// itself; this fills it in where it did not.
|
|
9036
9357
|
const viaOf = viaIndex(ir.edges || []);
|
|
9037
9358
|
// #878: each reference weighed by how it was found (web/edge-weight.js).
|
|
9038
|
-
lastEdgeWeights = edgeWeights(ir.edges || [], new Map((ir.nodes || []).map((n) => [n.id, n.kind])));
|
|
9359
|
+
lastEdgeWeights = edgeWeights(ir.edges || [], new Map((ir.nodes || []).map((n) => [n.id, n.kind])), ir.catalog && ir.catalog.rules);
|
|
9039
9360
|
for (const g of edges) {
|
|
9040
9361
|
const w = lastEdgeWeights.get(`${g.getAttribute("data-edge-from")}→${g.getAttribute("data-edge-to")}`);
|
|
9041
9362
|
if (w) g.setAttribute("data-edge-weight", w);
|
|
@@ -9048,6 +9369,8 @@ function wireEdgeHighlight(svgEl, ir) {
|
|
|
9048
9369
|
if (via) g.setAttribute("data-edge-via", via); // drives the dashed style
|
|
9049
9370
|
const cross = g.getAttribute("data-edge-cross") === "true";
|
|
9050
9371
|
if (!g.querySelector("path")) relabelEdgeChip(g, kind, via);
|
|
9372
|
+
// behold#1080: an edge the catalog drew arrives with its tooltip, which names the rule.
|
|
9373
|
+
if (g.querySelector(":scope > title")) continue;
|
|
9051
9374
|
const title = document.createElementNS(SVGNS, "title");
|
|
9052
9375
|
title.textContent = edgeTitle(from, to, { kind, via, cross });
|
|
9053
9376
|
g.insertBefore(title, g.firstChild);
|
|
@@ -9725,6 +10048,7 @@ function render(ir, svg, m) {
|
|
|
9725
10048
|
markIdentityCards(ir); // the identity mark: a tag badge on the card's top-right edge
|
|
9726
10049
|
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
|
|
9727
10050
|
markPendingCards(ir); // #422: and the cards whose member has not answered yet
|
|
10051
|
+
markStreamedDrift(ir); // behold#998: and the cards a drift stream coloured or is still reading
|
|
9728
10052
|
markTerragucciCards(); // #490: and what terragucci's reports found, dated
|
|
9729
10053
|
markYodelCards(); // #526: and SQL Yodeler's drift, dated
|
|
9730
10054
|
if (csAnswer) markChangeSetCards(); // #681: and the change set a gate binds, as a preview
|
|
@@ -9733,6 +10057,7 @@ function render(ir, svg, m) {
|
|
|
9733
10057
|
syncHealth(m); // #825: and runtime health, with the records out of rotation
|
|
9734
10058
|
applyLayout(); // #228: last, so the hand-placed deltas ride on top of every other pass
|
|
9735
10059
|
drawTgReads(); // #568: after the layout, so the reads lines meet the cards where they now sit
|
|
10060
|
+
drawAppFrames(); // behold#1036: and the apps' frames, around the cards where they now sit
|
|
9736
10061
|
renderDial();
|
|
9737
10062
|
}
|
|
9738
10063
|
|
|
@@ -11311,6 +11636,24 @@ events.addEventListener("member", (e) => {
|
|
|
11311
11636
|
renderStatusbar();
|
|
11312
11637
|
});
|
|
11313
11638
|
|
|
11639
|
+
// behold#998: one frame per drift line, as chant prints it (src/drift-stream.ts).
|
|
11640
|
+
// Payload-carrying like `member`: the cards are on screen, and each frame
|
|
11641
|
+
// repaints the cards it moved and nothing else, so they change one by one.
|
|
11642
|
+
events.addEventListener("drift", (e) => {
|
|
11643
|
+
let frame;
|
|
11644
|
+
try {
|
|
11645
|
+
frame = JSON.parse(e.data);
|
|
11646
|
+
} catch {
|
|
11647
|
+
return;
|
|
11648
|
+
}
|
|
11649
|
+
if (!lastGraphIr) return;
|
|
11650
|
+
const { moved, reading } = applyDriftFrame(lastGraphIr, frame);
|
|
11651
|
+
if (moved.length) markStreamedDrift(lastGraphIr, moved);
|
|
11652
|
+
const line = driftLine(frame, reading);
|
|
11653
|
+
if (line) nowline(line);
|
|
11654
|
+
if (frame.kind === "end") renderGraphLegend();
|
|
11655
|
+
});
|
|
11656
|
+
|
|
11314
11657
|
// #914: an agent's POST /api/view.
|
|
11315
11658
|
events.addEventListener("view", (e) => agentMove(e.data));
|
|
11316
11659
|
|
|
@@ -11846,9 +12189,12 @@ async function initActions() {
|
|
|
11846
12189
|
bar.appendChild(pill);
|
|
11847
12190
|
// #510: other commits' views, when ../history.json sits beside this one.
|
|
11848
12191
|
// The deploy tab stays hidden unless there is history to pick from.
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
12192
|
+
// behold#1068: only when the manifest says a history.json was published; any other export would log a 404.
|
|
12193
|
+
if (manifest && manifest.history) {
|
|
12194
|
+
mountHistoryPicker(bar).then((picker) => {
|
|
12195
|
+
if (picker) document.documentElement.classList.add("static-history");
|
|
12196
|
+
});
|
|
12197
|
+
}
|
|
11852
12198
|
previewMode = true;
|
|
11853
12199
|
return; // nothing else in the bar is a read
|
|
11854
12200
|
}
|
|
@@ -12279,6 +12625,13 @@ function paletteCommands() {
|
|
|
12279
12625
|
if (!staticMode && !publicMode && !view.env && projectInfo && (projectInfo.memberKinds || []).includes("terraform")) {
|
|
12280
12626
|
c.push(["Read the plan on the Terraform roots (replaces, forcing attributes, unknowns, drift)", () => readTerraformPlan()]);
|
|
12281
12627
|
}
|
|
12628
|
+
// behold#998: stream one member's drift, card by card. A read, but a POST.
|
|
12629
|
+
if (!staticMode && !publicMode && projectInfo && projectInfo.workspace) {
|
|
12630
|
+
for (const m of projectInfo.workspace.members || []) {
|
|
12631
|
+
if (m.repo || m.kind === "other") continue;
|
|
12632
|
+
c.push([`Stream drift card by card: ${m.name}${m.kind === "choudoufu" ? " (one resource at a time)" : ""}`, () => startDriftStream(m.name)]);
|
|
12633
|
+
}
|
|
12634
|
+
}
|
|
12282
12635
|
c.push(["Fit graph to view", () => fitGraph()]);
|
|
12283
12636
|
c.push(["Export: current graph as SVG", () => exportSvg()]);
|
|
12284
12637
|
const inspectCollapsed = document.getElementById("app").classList.contains("inspect-collapsed");
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// behold#725: the shared beat paused in a hidden tab, and the shared tooltip for the graph's badges.
|
|
2
|
+
// A file rather than an inline module (behold#1068): a webview's content security policy blocks inline scripts.
|
|
3
|
+
import { installMotion } from "./motion.js";
|
|
4
|
+
import { installTooltips } from "./tooltip.js";
|
|
5
|
+
installMotion();
|
|
6
|
+
installTooltips(document);
|
package/web/carve-steps.js
CHANGED
|
@@ -21,7 +21,7 @@ export const CARVE_STEPS = [
|
|
|
21
21
|
{
|
|
22
22
|
id: "advise",
|
|
23
23
|
label: "Advise",
|
|
24
|
-
blurb: "chant scored every resource in the Terraform
|
|
24
|
+
blurb: "chant scored every resource in the Terraform root. Green hands over cheaply; grey stays in Terraform.",
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
id: "pick",
|
package/web/carve-steps.test.js
CHANGED
|
@@ -301,14 +301,14 @@ const CARVE_STATE = {
|
|
|
301
301
|
stage: "emitted",
|
|
302
302
|
graduated: false,
|
|
303
303
|
note: "emitted — typed chant source exists, and the surviving Terraform still reads the resource directly. `carve bridge` is next.",
|
|
304
|
-
applyCommand: "chant carve apply --from
|
|
304
|
+
applyCommand: "chant carve apply --from tf-root --output app/carveout --env <env> --stack <stack> --write-source",
|
|
305
305
|
},
|
|
306
306
|
{
|
|
307
307
|
target: "aws_s3_bucket.assets",
|
|
308
308
|
stage: "applied",
|
|
309
309
|
graduated: true,
|
|
310
310
|
note: "graduated — `carve apply` recorded the ownership marker (stack assets, env prod). chant owns it.",
|
|
311
|
-
applyCommand: "chant carve apply --from
|
|
311
|
+
applyCommand: "chant carve apply --from tf-root --output app/carveout --env prod --stack assets --write-source",
|
|
312
312
|
},
|
|
313
313
|
],
|
|
314
314
|
apply: { human: true, note: "behold has no apply endpoint and no apply button, by design." },
|
|
@@ -64,12 +64,17 @@ export function actionWords(actions) {
|
|
|
64
64
|
return order.filter((k) => actions && actions[k]).map((k) => (actions[k] === 1 ? k : `${actions[k]} ${k}`)).join(", ");
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
/** The
|
|
67
|
+
/** The entries on one card: its own, and on a counted block its instances' (#996). */
|
|
68
|
+
const onCard = (a, id) => a.entries.filter((e) => e.node === id || e.block === id);
|
|
69
|
+
|
|
70
|
+
/** The marks to draw: per node id, its colour, its tag and its tooltip. A
|
|
71
|
+
* counted block's mark is the rollup of its instances' (#996), and each
|
|
72
|
+
* instance card has its own. */
|
|
68
73
|
export function nodeMarks(a) {
|
|
69
74
|
const out = {};
|
|
70
75
|
if (!a || a.error || a.refusal || !a.nodes) return out;
|
|
71
76
|
for (const [id, n] of Object.entries(a.nodes)) {
|
|
72
|
-
const entries = a
|
|
77
|
+
const entries = onCard(a, id);
|
|
73
78
|
out[id] = {
|
|
74
79
|
bucket: n.bucket,
|
|
75
80
|
color: bucketColor(n.bucket),
|
|
@@ -116,19 +121,21 @@ export function entryLines(e) {
|
|
|
116
121
|
/** The entries on one card, for the inspect pane. */
|
|
117
122
|
export function entriesFor(a, id) {
|
|
118
123
|
if (!a || a.error || a.refusal || !a.entries) return [];
|
|
119
|
-
return a
|
|
124
|
+
return onCard(a, id).map(entryLines);
|
|
120
125
|
}
|
|
121
126
|
|
|
122
127
|
/**
|
|
123
128
|
* The entries a reader would not see on the graph: those chant mapped to no
|
|
124
129
|
* node, and those whose node this view does not draw (another lens, or a
|
|
125
|
-
* member not on screen). `drawn` is the set of node ids on the canvas.
|
|
130
|
+
* member not on screen). `drawn` is the set of node ids on the canvas. An
|
|
131
|
+
* instance whose card is not drawn is on the graph all the same when its
|
|
132
|
+
* block card is: the block's rollup outline carries it (#996).
|
|
126
133
|
*/
|
|
127
134
|
export function offGraph(a, drawn) {
|
|
128
135
|
if (!a || a.error || a.refusal || !a.entries) return { noNode: [], notDrawn: [] };
|
|
129
136
|
return {
|
|
130
137
|
noNode: a.entries.filter((e) => !e.node).map(entryLines),
|
|
131
|
-
notDrawn: a.entries.filter((e) => e.node && drawn && !drawn.has(e.node)).map((e) => ({ ...entryLines(e), node: e.node })),
|
|
138
|
+
notDrawn: a.entries.filter((e) => e.node && drawn && !drawn.has(e.node) && !(e.block && drawn.has(e.block))).map((e) => ({ ...entryLines(e), node: e.node })),
|
|
132
139
|
};
|
|
133
140
|
}
|
|
134
141
|
|