@intentius/behold 0.29.53 → 0.29.54

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/demos.json CHANGED
@@ -141,7 +141,10 @@
141
141
  "setup": "bash scripts/emulators-up.sh",
142
142
  "serve": {
143
143
  "local": true,
144
- "env": "local"
144
+ "env": "local",
145
+ "processEnv": {
146
+ "GCP_PROJECT_ID": "three-cloud"
147
+ }
145
148
  }
146
149
  },
147
150
  {
package/dist/cli.js CHANGED
@@ -18908,6 +18908,51 @@ function projectLogical(ir) {
18908
18908
  return { ir: { nodes: headline, edges, groups: {} }, byContainer };
18909
18909
  }
18910
18910
 
18911
+ // src/logical-simplify.ts
18912
+ var BOUNDARY_RE = /^(AWS account|Azure subscription|GCP project)\b/;
18913
+ function simplifyNesting(byContainer, members, keep = /* @__PURE__ */ new Set()) {
18914
+ const out = {};
18915
+ for (const [k, v] of Object.entries(byContainer)) out[k] = [...v];
18916
+ const isBox = (id) => Object.prototype.hasOwnProperty.call(out, id);
18917
+ const parentOf = (id) => Object.keys(out).find((k) => out[k].includes(id));
18918
+ const fixed = (k) => BOUNDARY_RE.test(k) || keep.has(k);
18919
+ for (const key3 of Object.keys(out)) {
18920
+ if (fixed(key3)) continue;
18921
+ const member = key3.split(" \xB7 ")[0];
18922
+ if (!members.has(member) || !out[key3].every((c) => !isBox(c))) continue;
18923
+ const parent = parentOf(key3);
18924
+ if (!parent) continue;
18925
+ const at2 = out[parent].indexOf(key3);
18926
+ out[parent].splice(at2, 1, ...out[key3].filter((c) => !out[parent].includes(c)));
18927
+ delete out[key3];
18928
+ }
18929
+ for (let changed = true; changed; ) {
18930
+ changed = false;
18931
+ for (const key3 of Object.keys(out)) {
18932
+ const kids = out[key3];
18933
+ if (!kids || kids.length !== 1 || !isBox(kids[0]) || fixed(key3) || fixed(kids[0])) continue;
18934
+ const inner = kids[0];
18935
+ const merged = `${key3} \u203A ${inner}`;
18936
+ out[merged] = out[inner];
18937
+ delete out[inner];
18938
+ delete out[key3];
18939
+ const parent = parentOf(key3);
18940
+ if (parent) out[parent] = out[parent].map((c) => c === key3 ? merged : c);
18941
+ changed = true;
18942
+ break;
18943
+ }
18944
+ }
18945
+ return out;
18946
+ }
18947
+ function memberPrefixes(nodes) {
18948
+ const out = /* @__PURE__ */ new Set();
18949
+ for (const n of nodes) {
18950
+ const slash = n.id.indexOf("/");
18951
+ if (slash > 0) out.add(n.id.slice(0, slash));
18952
+ }
18953
+ return out;
18954
+ }
18955
+
18911
18956
  // src/composite-deps.ts
18912
18957
  function kebabKind(kind) {
18913
18958
  return kind.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
@@ -34589,6 +34634,8 @@ function validEntry(e) {
34589
34634
  if (d.serve.dirs !== void 0 && (!Array.isArray(d.serve.dirs) || d.serve.dirs.some((x) => typeof x !== "string") || !d.serve.dirs.length)) return false;
34590
34635
  if (d.serve.spawnEnv !== void 0 && (typeof d.serve.spawnEnv !== "object" || d.serve.spawnEnv === null || Array.isArray(d.serve.spawnEnv) || Object.values(d.serve.spawnEnv).some((v) => typeof v !== "string")))
34591
34636
  return false;
34637
+ if (d.serve.processEnv !== void 0 && (typeof d.serve.processEnv !== "object" || d.serve.processEnv === null || Array.isArray(d.serve.processEnv) || Object.values(d.serve.processEnv).some((v) => typeof v !== "string")))
34638
+ return false;
34592
34639
  if (d.serve.terralith !== void 0 && typeof d.serve.terralith !== "boolean") return false;
34593
34640
  if (d.serve.carve !== void 0) {
34594
34641
  const c = d.serve.carve;
@@ -36109,7 +36156,8 @@ function createApp(cfg, broadcaster = new Broadcaster(), frames = new FrameBuffe
36109
36156
  estateRun = applyMemberPasses(ir, { detail: opts.detail });
36110
36157
  if (logical) {
36111
36158
  const logicalBefore = ir.nodes.length;
36112
- const { ir: projected, byContainer, namespaceBoxes } = projectTopology(ir, metaEnv ?? void 0, estateContext, await estateSourceRoots(opts));
36159
+ const { ir: projected, byContainer: joined, namespaceBoxes } = projectTopology(ir, metaEnv ?? void 0, estateContext, await estateSourceRoots(opts));
36160
+ const byContainer = simplifiedEstateNesting(joined, ir, namespaceBoxes);
36113
36161
  const { svg: svg2 } = renderArchitecture(projected, byContainer, { groupMarks: operatorHomeBoxMarks(ir, namespaceBoxes ?? {}), groupBadges: operatorHomeBoxBadges(ir, namespaceBoxes ?? {}), ...cardPrefixesOf(ir) ? { cardPrefixes: cardPrefixesOf(ir) } : {} });
36114
36162
  const tf2 = passNote(estateRun);
36115
36163
  const lensNote = notesFor("logical", projected, void 0, logicalBefore);
@@ -36462,7 +36510,8 @@ function createApp(cfg, broadcaster = new Broadcaster(), frames = new FrameBuffe
36462
36510
  ].join("; ") : void 0;
36463
36511
  if (logical) {
36464
36512
  const logicalBefore = ir2.nodes.length;
36465
- const { ir: projected, byContainer, namespaceBoxes } = projectTopology(ir2, env, boundContext2, await estateSourceRoots(query));
36513
+ const { ir: projected, byContainer: joined, namespaceBoxes } = projectTopology(ir2, env, boundContext2, await estateSourceRoots(query));
36514
+ const byContainer = simplifiedEstateNesting(joined, ir2, namespaceBoxes);
36466
36515
  const { svg: svg3 } = renderArchitecture(projected, byContainer, { groupMarks: operatorHomeBoxMarks(ir2, namespaceBoxes ?? {}), groupBadges: operatorHomeBoxBadges(ir2, namespaceBoxes ?? {}), ...cardPrefixesOf(ir2) ? { cardPrefixes: cardPrefixesOf(ir2) } : {} });
36467
36516
  const note3 = [
36468
36517
  notesFor("logical", projected, void 0, logicalBefore),
@@ -37060,6 +37109,11 @@ async function startServer(cfg) {
37060
37109
  process.exit(1);
37061
37110
  });
37062
37111
  }
37112
+ function simplifiedEstateNesting(byContainer, ir, namespaceBoxes) {
37113
+ const members = memberPrefixes(ir.nodes);
37114
+ if (members.size < 2) return byContainer;
37115
+ return simplifyNesting(byContainer, members, new Set(Object.values(namespaceBoxes ?? {})));
37116
+ }
37063
37117
 
37064
37118
  // src/cli.ts
37065
37119
  init_chant();
@@ -38478,6 +38532,7 @@ async function runDemo(rest) {
38478
38532
  if (entry.serve.local) serveArgs.push("--local");
38479
38533
  if (entry.serve.env) serveArgs.push("--env", entry.serve.env);
38480
38534
  setChoudoufuSpawnEnv(entry.serve.spawnEnv);
38535
+ for (const [k, v] of Object.entries(entry.serve.processEnv ?? {})) process.env[k] ??= v;
38481
38536
  await run3(serveArgs);
38482
38537
  }
38483
38538
  function spawnStep(cmd, args, cwd) {
@@ -35,4 +35,4 @@ npx serve export
35
35
 
36
36
  `cd dns && npx chant run front-door` runs the same steps as an Op.
37
37
 
38
- Needs chant 0.124.36 or newer.
38
+ Needs chant 0.124.37 or newer.
@@ -1 +1,2 @@
1
- export default { lexicons: ["gcp"], sourceDir: "src", environments: ["local"] };
1
+ // The project every gcp resource builds, applies and is read in.
2
+ export default { lexicons: ["gcp"], sourceDir: "src", environments: ["local"], gcp: { project: "three-cloud" } };
@@ -17,10 +17,6 @@ import {
17
17
  // Balancer as production sets it up: a
18
18
  // static address and a forwarding rule, an HTTP proxy, a URL map, a backend
19
19
  // service, and a serverless network endpoint group that names the service.
20
- //
21
- // Each reference is Config Connector's `{ name }`, spelled out: chant 0.124.36
22
- // writes a `.name` reference correctly but its live read can't resolve one
23
- // (reported to chant), and behold joins these by name.
24
20
  const region = "asia-northeast1";
25
21
 
26
22
  export const runtime = new GCPServiceAccount({
@@ -36,7 +32,7 @@ export const subnet = new Subnetwork({
36
32
  metadata: { name: "three-cloud-apps" },
37
33
  region,
38
34
  ipCidrRange: "10.30.0.0/24",
39
- networkRef: { name: "three-cloud-vpc" },
35
+ networkRef: { name: vpc.name },
40
36
  });
41
37
 
42
38
  export const web = CloudRunServiceComposite({
@@ -54,7 +50,7 @@ export const web = CloudRunServiceComposite({
54
50
  template: {
55
51
  vpcAccess: {
56
52
  egress: "PRIVATE_RANGES_ONLY",
57
- networkInterfaces: [{ networkRef: { name: "three-cloud-vpc" }, subnetworkRef: { name: "three-cloud-apps" } }],
53
+ networkInterfaces: [{ networkRef: { name: vpc.name }, subnetworkRef: { name: subnet.name } }],
58
54
  },
59
55
  },
60
56
  },
@@ -65,7 +61,7 @@ export const neg = new RegionNetworkEndpointGroup({
65
61
  metadata: { name: "three-cloud-neg" },
66
62
  region,
67
63
  networkEndpointType: "SERVERLESS",
68
- cloudRun: { serviceRef: { name: "three-cloud-site" } },
64
+ cloudRun: { serviceRef: { name: web.service.name } },
69
65
  });
70
66
 
71
67
  // A backend service over a serverless NEG takes no health check: Cloud Run
@@ -75,19 +71,19 @@ export const backend = new BackendService({
75
71
  location: "global",
76
72
  loadBalancingScheme: "EXTERNAL_MANAGED",
77
73
  protocol: "HTTP",
78
- backend: [{ group: { networkEndpointGroupRef: { name: "three-cloud-neg" } } }],
74
+ backend: [{ group: { networkEndpointGroupRef: { name: neg.name } } }],
79
75
  });
80
76
 
81
77
  export const urlMap = new URLMap({
82
78
  metadata: { name: "three-cloud-map" },
83
79
  location: "global",
84
- defaultService: { backendServiceRef: { name: "three-cloud-backend" } },
80
+ defaultService: { backendServiceRef: { name: backend.name } },
85
81
  });
86
82
 
87
83
  export const proxy = new TargetHTTPProxy({
88
84
  metadata: { name: "three-cloud-proxy" },
89
85
  location: "global",
90
- urlMapRef: { name: "three-cloud-map" },
86
+ urlMapRef: { name: urlMap.name },
91
87
  });
92
88
 
93
89
  export const address = new ComputeAddress({ metadata: { name: "three-cloud-ip" }, location: "global" });
@@ -97,8 +93,8 @@ export const rule = new ForwardingRule({
97
93
  location: "global",
98
94
  loadBalancingScheme: "EXTERNAL_MANAGED",
99
95
  portRange: "80",
100
- ipAddress: { addressRef: { name: "three-cloud-ip" } },
101
- target: { targetHTTPProxyRef: { name: "three-cloud-proxy" } },
96
+ ipAddress: { addressRef: { name: address.name } },
97
+ target: { targetHTTPProxyRef: { name: proxy.name } },
102
98
  });
103
99
 
104
100
  // The dns member reads this as its `gcpEndpoint` parameter: the load
@@ -6,10 +6,10 @@
6
6
  "": {
7
7
  "name": "behold-example-three-cloud",
8
8
  "dependencies": {
9
- "@intentius/chant": "^0.124.36",
10
- "@intentius/chant-lexicon-aws": "^0.124.36",
11
- "@intentius/chant-lexicon-azure": "^0.124.36",
12
- "@intentius/chant-lexicon-gcp": "^0.124.36"
9
+ "@intentius/chant": "^0.124.37",
10
+ "@intentius/chant-lexicon-aws": "^0.124.37",
11
+ "@intentius/chant-lexicon-azure": "^0.124.37",
12
+ "@intentius/chant-lexicon-gcp": "^0.124.37"
13
13
  }
14
14
  },
15
15
  "node_modules/@dagrejs/dagre": {
@@ -444,9 +444,9 @@
444
444
  }
445
445
  },
446
446
  "node_modules/@intentius/chant": {
447
- "version": "0.124.36",
448
- "resolved": "https://registry.npmjs.org/@intentius/chant/-/chant-0.124.36.tgz",
449
- "integrity": "sha512-KcsdALy1O+P5i9bxL2FkIgW546zmyJnwzm0xS556YRSC4EytexW9okRVhv/hwhlj8dtcXJAxoyZmwh8qgznanA==",
447
+ "version": "0.124.37",
448
+ "resolved": "https://registry.npmjs.org/@intentius/chant/-/chant-0.124.37.tgz",
449
+ "integrity": "sha512-yfnf2Bb66kA6UHqBI76T2HM1JczhIY35k4lDsxA5GDuvz33xHRFV+BhpLJD5+uKqLRVYHIp/UqlccY5Q3yjjCw==",
450
450
  "license": "Apache-2.0",
451
451
  "dependencies": {
452
452
  "@dagrejs/dagre": "^3.0.0",
@@ -473,34 +473,34 @@
473
473
  }
474
474
  },
475
475
  "node_modules/@intentius/chant-lexicon-aws": {
476
- "version": "0.124.36",
477
- "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-aws/-/chant-lexicon-aws-0.124.36.tgz",
478
- "integrity": "sha512-AdhC24jnc7gnvdDfFYzDJ+OKmaNJt4tki/oHmxzJkun0TiH12mZjdA/mR6LxK5GJkvNidK9TwyR/LtAwZAnU6Q==",
476
+ "version": "0.124.37",
477
+ "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-aws/-/chant-lexicon-aws-0.124.37.tgz",
478
+ "integrity": "sha512-H79t+Aea1P051sVOfJOBQ1ZlpMmjG7We3p71RG8H99gtFXMyV44MWlBl0eikOyHLBlZu+YU449deWLtcEiFe0Q==",
479
479
  "license": "Apache-2.0",
480
480
  "dependencies": {
481
481
  "fflate": "^0.8.2",
482
482
  "js-yaml": "^4.3.1"
483
483
  },
484
484
  "peerDependencies": {
485
- "@intentius/chant": "^0.124.36"
485
+ "@intentius/chant": "^0.124.37"
486
486
  }
487
487
  },
488
488
  "node_modules/@intentius/chant-lexicon-azure": {
489
- "version": "0.124.36",
490
- "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-azure/-/chant-lexicon-azure-0.124.36.tgz",
491
- "integrity": "sha512-Ge/gqsqceUCCEo628DD7uxWxk35thZk9W1pCrbiwtr1j1IAQsY2hFtzL3PnBpuXpFUh9nAtx73SiNxrur0PGAA==",
489
+ "version": "0.124.37",
490
+ "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-azure/-/chant-lexicon-azure-0.124.37.tgz",
491
+ "integrity": "sha512-hU/q497o+4VTw4E3t6ij5Pu5YSrc9yp5O1jdCYH7p6IHe9EpGmytyVTWhsmsd8B+1i8hU5HkV41+iM4qcA8HiQ==",
492
492
  "license": "Apache-2.0",
493
493
  "dependencies": {
494
494
  "fflate": "^0.8.2"
495
495
  },
496
496
  "peerDependencies": {
497
- "@intentius/chant": "^0.124.36"
497
+ "@intentius/chant": "^0.124.37"
498
498
  }
499
499
  },
500
500
  "node_modules/@intentius/chant-lexicon-gcp": {
501
- "version": "0.124.36",
502
- "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-gcp/-/chant-lexicon-gcp-0.124.36.tgz",
503
- "integrity": "sha512-g1xfRaMpm6bfJLfHkddMv0Y9w1lsCOvPqpsnJ+QwYOBsMSawkTC7Dd/ep8Cfp8AAH24uk7qngMc6MJZFIAcRMw==",
501
+ "version": "0.124.37",
502
+ "resolved": "https://registry.npmjs.org/@intentius/chant-lexicon-gcp/-/chant-lexicon-gcp-0.124.37.tgz",
503
+ "integrity": "sha512-hUojSIF0MCsohc2bgrTFy2nZ/Eoyt0PbtVtlDnAvc4HZKrE2SVamaKQUKslhAGySjGOR8BpQWcMSCT92Bl0JpQ==",
504
504
  "license": "Apache-2.0",
505
505
  "dependencies": {
506
506
  "@types/js-yaml": "^4.0.9",
@@ -508,7 +508,7 @@
508
508
  "js-yaml": "^4.3.1"
509
509
  },
510
510
  "peerDependencies": {
511
- "@intentius/chant": "^0.124.36"
511
+ "@intentius/chant": "^0.124.37"
512
512
  }
513
513
  },
514
514
  "node_modules/@types/js-yaml": {
@@ -8,9 +8,9 @@
8
8
  "front-door": "tsx scripts/front-door.ts all --out export"
9
9
  },
10
10
  "dependencies": {
11
- "@intentius/chant": "^0.124.36",
12
- "@intentius/chant-lexicon-aws": "^0.124.36",
13
- "@intentius/chant-lexicon-azure": "^0.124.36",
14
- "@intentius/chant-lexicon-gcp": "^0.124.36"
11
+ "@intentius/chant": "^0.124.37",
12
+ "@intentius/chant-lexicon-aws": "^0.124.37",
13
+ "@intentius/chant-lexicon-azure": "^0.124.37",
14
+ "@intentius/chant-lexicon-gcp": "^0.124.37"
15
15
  }
16
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/behold",
3
- "version": "0.29.53",
3
+ "version": "0.29.54",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "behold — a live control plane on chant. See your whole estate (every substrate in one graph), coloured by drift; act through delegated, gated Ops.",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@hono/node-server": "^2.0.5",
50
- "@intentius/chant": "^0.124.36",
50
+ "@intentius/chant": "^0.124.37",
51
51
  "@intentius/chant-k8s-client": "^0.124.24",
52
52
  "@intentius/pinhole": "^0.5.0",
53
53
  "ajv": "^8.20.0",
package/web/app.js CHANGED
@@ -372,6 +372,10 @@ const staticMode = !!window.__BEHOLD_STATIC__;
372
372
  const publicMode = !!window.__BEHOLD_PUBLIC__;
373
373
  let manifest = null;
374
374
  if (staticMode) {
375
+ // A snapshot has no live host behind it: the controls that only make sense
376
+ // against one (the lanes view, substrate readiness, the target endpoint,
377
+ // the deploy dial) are hidden by the `static` class (index.html).
378
+ document.documentElement.classList.add("static");
375
379
  try {
376
380
  manifest = await fetch("./manifest.json").then((r) => r.json());
377
381
  } catch {
@@ -1965,6 +1969,7 @@ function renderPanelView() {
1965
1969
  }),
1966
1970
  );
1967
1971
  const lanes = document.createElement("a");
1972
+ lanes.className = "lanes-link";
1968
1973
  lanes.href = "/lanes";
1969
1974
  lanes.textContent = "lanes →";
1970
1975
  lanes.title = "The time-lanes view — captured frames of this graph over time";
@@ -2461,7 +2466,7 @@ function renderPanelScope() {
2461
2466
  );
2462
2467
  }
2463
2468
  }
2464
- if (targets.length) {
2469
+ if (targets.length && !staticMode) {
2465
2470
  host.appendChild(panelHeading("target"));
2466
2471
  const sel = document.createElement("select");
2467
2472
  for (const t of targets) sel.add(new Option(t.endpoint, t.endpoint, false, view.target === t.endpoint));
@@ -8476,7 +8481,9 @@ function render(ir, svg, m) {
8476
8481
  // from /api/project when a route doesn't echo them, e.g. /api/overlay).
8477
8482
  if (m.tier !== undefined) axes.tier = m.tier;
8478
8483
  if (m.target !== undefined) axes.target = m.target;
8479
- const axesTail = `${axes.tier ? " · tier " + axes.tier : ""}${axes.target ? " · target " + axes.target : ""}`;
8484
+ // A snapshot's target is the host it was captured from (a localhost
8485
+ // emulator, usually), which means nothing to whoever reads the page.
8486
+ const axesTail = `${axes.tier ? " · tier " + axes.tier : ""}${axes.target && !staticMode ? " · target " + axes.target : ""}`;
8480
8487
  const metaEl = document.getElementById("meta");
8481
8488
  metaEl.title = m.projectDir || "";
8482
8489
  // #195: the browser tab names the loaded project — with the header gone
@@ -10492,7 +10499,11 @@ async function initActions() {
10492
10499
  pill.title = "An exported, read-only snapshot — no live observe or deploy.";
10493
10500
  pill.style.cssText = "align-self:center;font:var(--t-caption)/1.4 var(--font-mono);color:var(--muted);border:1px solid var(--line);border-radius:var(--r-ctl);padding:2px 8px";
10494
10501
  bar.appendChild(pill);
10495
- mountHistoryPicker(bar); // #510: other commits' views, when ../history.json sits beside this one
10502
+ // #510: other commits' views, when ../history.json sits beside this one.
10503
+ // The deploy tab stays hidden unless there is history to pick from.
10504
+ mountHistoryPicker(bar).then((picker) => {
10505
+ if (picker) document.documentElement.classList.add("static-history");
10506
+ });
10496
10507
  previewMode = true;
10497
10508
  return; // nothing else in the bar is a read
10498
10509
  }
package/web/index.html CHANGED
@@ -557,6 +557,10 @@
557
557
  /* Folded in a frame, the panel is a small pill (⌘K and the expand
558
558
  chevron) in the corner, so the graph has the pane to itself. */
559
559
  .embed #panel.collapsed #panel-tabs button[data-tab] { display: none; }
560
+ /* A static export (behold export) has no live host behind it. */
561
+ .static #panel-tabs button[data-tab="substrates"], .static #panel-body section[data-tab="substrates"],
562
+ .static:not(.static-history) #panel-tabs button[data-tab="deploy"], .static:not(.static-history) #panel-body section[data-tab="deploy"],
563
+ .static .lanes-link { display: none !important; }
560
564
  .embed #panel.collapsed { width: auto; }
561
565
  .embed #panel.collapsed #panel-tabs { gap: var(--s1); padding: 2px var(--s1); }
562
566
  /* #569: ?embed=1&bare=1, the kiosk's frame: the graph alone. Nothing to