@intentius/behold 0.29.56 → 0.30.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 +323 -26
- package/THIRD_PARTY.md +21 -0
- package/demos.json +1 -1
- package/dist/cli.js +12393 -8612
- package/example-choudoufu-estate/chant.workspace.json +1 -1
- package/example-terraform-estate/README.md +10 -10
- package/example-terraform-estate/chant.workspace.json +1 -1
- package/example-three-cloud/README.md +17 -9
- package/example-three-cloud/aws/chant.config.ts +1 -1
- package/example-three-cloud/aws/site.component.ts +13 -0
- package/example-three-cloud/azure/chant.config.ts +1 -1
- package/example-three-cloud/azure/src/site.component.ts +13 -0
- package/example-three-cloud/azure/src/site.ts +12 -46
- package/example-three-cloud/dns/chant.config.ts +1 -1
- package/example-three-cloud/dns/src/records.component.ts +14 -0
- package/example-three-cloud/dns/src/route53.ts +8 -39
- package/example-three-cloud/gcp/chant.config.ts +1 -1
- package/example-three-cloud/gcp/src/site.component.ts +13 -0
- package/example-three-cloud/gcp/src/site.ts +12 -92
- package/example-three-cloud/package-lock.json +19 -19
- package/example-three-cloud/package.json +4 -4
- package/example-three-cloud/scripts/front-door.ts +89 -15
- package/licenses/aws-architecture-icons-TERMS.md +19 -0
- package/licenses/azure-architecture-icons-Microsoft_Terms_of_Use.pdf +0 -0
- package/licenses/azure-architecture-icons-TERMS.md +20 -0
- package/licenses/google-cloud-icons-TERMS.md +15 -0
- package/package.json +8 -9
- package/web/agent-move.js +60 -0
- package/web/agent-move.test.js +55 -0
- package/web/app.js +1084 -66
- package/web/dots-lod.js +1 -1
- package/web/edge-weight.d.ts +5 -0
- package/web/edge-weight.js +71 -0
- package/web/edge-weight.test.js +49 -0
- package/web/embed.d.ts +3 -0
- package/web/embed.js +5 -3
- package/web/embed.test.js +8 -0
- package/web/icons/aws/alb.svg +1 -0
- package/web/icons/aws/api-gateway.svg +1 -0
- package/web/icons/aws/app-runner.svg +1 -0
- package/web/icons/aws/appsync.svg +1 -0
- package/web/icons/aws/athena.svg +1 -0
- package/web/icons/aws/auto-scaling.svg +1 -0
- package/web/icons/aws/backup.svg +1 -0
- package/web/icons/aws/batch.svg +1 -0
- package/web/icons/aws/bedrock-agentcore.svg +1 -0
- package/web/icons/aws/bedrock.svg +1 -0
- package/web/icons/aws/certificate-manager.svg +1 -0
- package/web/icons/aws/cloud-map.svg +1 -0
- package/web/icons/aws/cloud.svg +1 -0
- package/web/icons/aws/cloudformation.svg +1 -0
- package/web/icons/aws/cloudfront.svg +1 -0
- package/web/icons/aws/cloudtrail.svg +1 -0
- package/web/icons/aws/cloudwatch-alarm.svg +1 -0
- package/web/icons/aws/cloudwatch-logs.svg +1 -0
- package/web/icons/aws/cloudwatch.svg +1 -0
- package/web/icons/aws/codebuild.svg +1 -0
- package/web/icons/aws/codecommit.svg +1 -0
- package/web/icons/aws/codedeploy.svg +1 -0
- package/web/icons/aws/codepipeline.svg +1 -0
- package/web/icons/aws/cognito.svg +1 -0
- package/web/icons/aws/config.svg +1 -0
- package/web/icons/aws/documentdb.svg +1 -0
- package/web/icons/aws/dynamodb-table.svg +1 -0
- package/web/icons/aws/dynamodb.svg +1 -0
- package/web/icons/aws/ebs-volume.svg +1 -0
- package/web/icons/aws/ec2-instance.svg +1 -0
- package/web/icons/aws/ec2.svg +1 -0
- package/web/icons/aws/ecr-registry.svg +1 -0
- package/web/icons/aws/ecr.svg +1 -0
- package/web/icons/aws/ecs-service.svg +1 -0
- package/web/icons/aws/ecs-task.svg +1 -0
- package/web/icons/aws/ecs.svg +1 -0
- package/web/icons/aws/efs.svg +1 -0
- package/web/icons/aws/eks.svg +1 -0
- package/web/icons/aws/elastic-beanstalk.svg +1 -0
- package/web/icons/aws/elastic-ip.svg +1 -0
- package/web/icons/aws/elasticache.svg +1 -0
- package/web/icons/aws/elb.svg +1 -0
- package/web/icons/aws/emr.svg +1 -0
- package/web/icons/aws/eventbridge.svg +1 -0
- package/web/icons/aws/firehose.svg +1 -0
- package/web/icons/aws/global-accelerator.svg +1 -0
- package/web/icons/aws/glue.svg +1 -0
- package/web/icons/aws/guardduty.svg +1 -0
- package/web/icons/aws/iam.svg +1 -0
- package/web/icons/aws/internet-gateway.svg +1 -0
- package/web/icons/aws/keyspaces.svg +1 -0
- package/web/icons/aws/kinesis.svg +1 -0
- package/web/icons/aws/kms.svg +1 -0
- package/web/icons/aws/lambda-function.svg +1 -0
- package/web/icons/aws/lambda.svg +1 -0
- package/web/icons/aws/mq.svg +1 -0
- package/web/icons/aws/msk.svg +1 -0
- package/web/icons/aws/nat-gateway.svg +1 -0
- package/web/icons/aws/neptune.svg +1 -0
- package/web/icons/aws/network-acl.svg +1 -0
- package/web/icons/aws/network-firewall.svg +1 -0
- package/web/icons/aws/opensearch.svg +1 -0
- package/web/icons/aws/organizations.svg +1 -0
- package/web/icons/aws/rds-instance.svg +1 -0
- package/web/icons/aws/rds.svg +1 -0
- package/web/icons/aws/redshift.svg +1 -0
- package/web/icons/aws/route-53-hosted-zone.svg +1 -0
- package/web/icons/aws/route-53.svg +1 -0
- package/web/icons/aws/router.svg +1 -0
- package/web/icons/aws/s3-bucket.svg +1 -0
- package/web/icons/aws/s3.svg +1 -0
- package/web/icons/aws/sagemaker.svg +1 -0
- package/web/icons/aws/secrets-manager.svg +1 -0
- package/web/icons/aws/ses.svg +1 -0
- package/web/icons/aws/shield.svg +1 -0
- package/web/icons/aws/sns-topic.svg +1 -0
- package/web/icons/aws/sns.svg +1 -0
- package/web/icons/aws/sqs-queue.svg +1 -0
- package/web/icons/aws/sqs.svg +1 -0
- package/web/icons/aws/step-functions.svg +1 -0
- package/web/icons/aws/systems-manager.svg +1 -0
- package/web/icons/aws/transfer-family.svg +1 -0
- package/web/icons/aws/transit-gateway.svg +1 -0
- package/web/icons/aws/vpc-endpoints.svg +1 -0
- package/web/icons/aws/vpc-lattice.svg +1 -0
- package/web/icons/aws/vpc.svg +1 -0
- package/web/icons/aws/vpn-gateway.svg +1 -0
- package/web/icons/aws/waf.svg +1 -0
- package/web/icons/azure/app-service-plan.svg +1 -0
- package/web/icons/azure/app-services.svg +1 -0
- package/web/icons/azure/application-gateway.svg +1 -0
- package/web/icons/azure/container-app.svg +1 -0
- package/web/icons/azure/container-apps-environment.svg +1 -0
- package/web/icons/azure/container-instances.svg +1 -0
- package/web/icons/azure/container-registry.svg +1 -0
- package/web/icons/azure/cosmos-db.svg +1 -0
- package/web/icons/azure/dns-zone.svg +1 -0
- package/web/icons/azure/front-door.svg +1 -0
- package/web/icons/azure/function-app.svg +1 -0
- package/web/icons/azure/kubernetes-service.svg +1 -0
- package/web/icons/azure/load-balancer.svg +1 -0
- package/web/icons/azure/log-analytics.svg +1 -0
- package/web/icons/azure/managed-identity.svg +1 -0
- package/web/icons/azure/mysql.svg +1 -0
- package/web/icons/azure/nat.svg +1 -0
- package/web/icons/azure/network-security-group.svg +1 -0
- package/web/icons/azure/postgresql.svg +1 -0
- package/web/icons/azure/public-ip.svg +1 -0
- package/web/icons/azure/redis.svg +1 -0
- package/web/icons/azure/resource-group.svg +1 -0
- package/web/icons/azure/route-table.svg +1 -0
- package/web/icons/azure/sql-database.svg +1 -0
- package/web/icons/azure/sql-server.svg +1 -0
- package/web/icons/azure/subnet.svg +1 -0
- package/web/icons/azure/subscription.svg +1 -0
- package/web/icons/azure/virtual-machine.svg +1 -0
- package/web/icons/azure/virtual-network-gateway.svg +1 -0
- package/web/icons/azure/virtual-network.svg +1 -0
- package/web/icons/gcp/artifact-registry.svg +1 -0
- package/web/icons/gcp/bigquery.svg +1 -0
- package/web/icons/gcp/bigtable.svg +1 -0
- package/web/icons/gcp/certificate-manager.svg +1 -0
- package/web/icons/gcp/cloud-armor.svg +1 -0
- package/web/icons/gcp/cloud-build.svg +1 -0
- package/web/icons/gcp/cloud-composer.svg +1 -0
- package/web/icons/gcp/cloud-dns.svg +1 -0
- package/web/icons/gcp/cloud-functions.svg +1 -0
- package/web/icons/gcp/cloud-load-balancing.svg +1 -0
- package/web/icons/gcp/cloud-logging.svg +1 -0
- package/web/icons/gcp/cloud-monitoring.svg +1 -0
- package/web/icons/gcp/cloud-nat.svg +1 -0
- package/web/icons/gcp/cloud-router.svg +1 -0
- package/web/icons/gcp/cloud-run.svg +1 -0
- package/web/icons/gcp/cloud-scheduler.svg +1 -0
- package/web/icons/gcp/cloud-spanner.svg +1 -0
- package/web/icons/gcp/cloud-sql.svg +1 -0
- package/web/icons/gcp/cloud-storage.svg +1 -0
- package/web/icons/gcp/cloud-tasks.svg +1 -0
- package/web/icons/gcp/compute-engine.svg +1 -0
- package/web/icons/gcp/dataflow.svg +1 -0
- package/web/icons/gcp/external-ip.svg +1 -0
- package/web/icons/gcp/firestore.svg +1 -0
- package/web/icons/gcp/firewall-rules.svg +1 -0
- package/web/icons/gcp/gke.svg +1 -0
- package/web/icons/gcp/iam.svg +1 -0
- package/web/icons/gcp/kms.svg +1 -0
- package/web/icons/gcp/memorystore.svg +1 -0
- package/web/icons/gcp/persistent-disk.svg +1 -0
- package/web/icons/gcp/project.svg +1 -0
- package/web/icons/gcp/pubsub.svg +1 -0
- package/web/icons/gcp/secret-manager.svg +1 -0
- package/web/icons/gcp/vpc.svg +1 -0
- package/web/index.html +98 -9
- package/web/net-trace.js +649 -0
- package/web/net-trace.test.js +180 -0
- package/web/panel.js +28 -4
- package/web/release.js +6 -4
- package/web/release.test.js +2 -2
- package/web/search-view.d.ts +27 -0
- package/web/search-view.js +213 -0
- package/web/search-view.test.js +144 -0
- package/web/shot-frame.d.ts +5 -0
- package/web/shot-frame.js +116 -0
- package/web/shot-frame.test.js +90 -0
- package/web/themes.js +1 -1
- package/web/view-url.d.ts +18 -0
- package/web/view-url.js +162 -10
- package/web/view-url.test.js +72 -1
|
@@ -3,21 +3,29 @@
|
|
|
3
3
|
* turn Azure off, wait for Route 53 to notice, and export the page.
|
|
4
4
|
*
|
|
5
5
|
* tsx scripts/front-door.ts all --out <dir> every step below, in order
|
|
6
|
-
* tsx scripts/front-door.ts apply
|
|
7
|
-
*
|
|
6
|
+
* tsx scripts/front-door.ts apply run each member's component (gcp, azure, aws, then dns)
|
|
7
|
+
* with `chant run --components`, in a copy of the
|
|
8
|
+
* workspace, and wait until `chant lifecycle health`
|
|
9
|
+
* reads azureCheck healthy
|
|
8
10
|
* tsx scripts/front-door.ts azure-off deactivate the Azure app's active revision
|
|
9
11
|
* tsx scripts/front-door.ts wait until azureCheck reads unhealthy
|
|
10
|
-
* tsx scripts/front-door.ts export --out <dir> behold export, opening on env local at the
|
|
12
|
+
* tsx scripts/front-door.ts export --out <dir> behold export, opening on env local at the components zoom
|
|
11
13
|
*
|
|
12
14
|
* dns/ops/front-door.op.ts runs the same steps as an Op's phases. The emulators
|
|
13
15
|
* are the ones `behold demo three-cloud` boots (chant-floci, chant-floci-az,
|
|
14
16
|
* chant-floci-gcp); FLOCI_CONTAINER, FLOCI_AZ_CONTAINER and FLOCI_GCP_CONTAINER
|
|
15
17
|
* name others, and AWS_ENDPOINT_URL, AZURE_ENDPOINT_URL and GCP_ENDPOINT_URL
|
|
16
18
|
* say where they answer.
|
|
19
|
+
*
|
|
20
|
+
* The components run in a copy of the workspace (.front-door/run) whose git
|
|
21
|
+
* remote is a bare repository beside it (.front-door/run-remote.git). chant
|
|
22
|
+
* records each component's release on that remote's chant/lifecycle branch, so
|
|
23
|
+
* the exported page shows a real last release on every component card, and
|
|
24
|
+
* nothing is pushed anywhere but this directory. The export reads the copy.
|
|
17
25
|
*/
|
|
18
26
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
19
|
-
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
20
|
-
import { dirname, join, resolve } from "node:path";
|
|
27
|
+
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
28
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
21
29
|
import { fileURLToPath } from "node:url";
|
|
22
30
|
import { awsApply, awsDelete } from "@intentius/chant-lexicon-aws/op/activities";
|
|
23
31
|
import { azApply } from "@intentius/chant-lexicon-azure/op/activities";
|
|
@@ -26,6 +34,9 @@ import { gcpApply } from "@intentius/chant-lexicon-gcp/op/activities";
|
|
|
26
34
|
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
27
35
|
const WORK = join(ROOT, ".front-door");
|
|
28
36
|
const CHANT = join(ROOT, "node_modules", ".bin", "chant");
|
|
37
|
+
/** The copy the components run in, and the bare repository it pushes its release records to. */
|
|
38
|
+
const RUN = join(WORK, "run");
|
|
39
|
+
const REMOTE = join(WORK, "run-remote.git");
|
|
29
40
|
|
|
30
41
|
const ENV = "local";
|
|
31
42
|
// The Azure resource group and the GCP project, as chant's live reads find them:
|
|
@@ -209,11 +220,57 @@ async function applyDns(endpoints: Record<string, string>, probes: Record<string
|
|
|
209
220
|
}
|
|
210
221
|
|
|
211
222
|
export async function apply(): Promise<void> {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
223
|
+
workspaceCopy();
|
|
224
|
+
runComponent("gcp", "site");
|
|
225
|
+
runComponent("azure", "site");
|
|
226
|
+
// A run before this one turned Azure off, and applying the same app again leaves its revision inactive.
|
|
227
|
+
await azureOn();
|
|
228
|
+
runComponent("aws", "site");
|
|
229
|
+
runComponent("dns", "records");
|
|
230
|
+
// Before anything is turned off, the check on Azure has to pass: that is
|
|
231
|
+
// what shows the checkers reach floci-az at all.
|
|
232
|
+
await waitFor("healthy");
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** A git, as the copy's commits and pushes need it, with a test identity. */
|
|
236
|
+
function git(args: string[], cwd: string): void {
|
|
237
|
+
const r = spawnSync("git", args, { cwd, encoding: "utf8", env: { ...process.env, GIT_AUTHOR_NAME: "three-cloud demo", GIT_AUTHOR_EMAIL: "demo@three-cloud.test", GIT_COMMITTER_NAME: "three-cloud demo", GIT_COMMITTER_EMAIL: "demo@three-cloud.test" } });
|
|
238
|
+
if (r.status !== 0) throw new Refusal(`git ${args.join(" ")} failed: ${r.stderr || r.stdout}`);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** A fresh copy of the workspace, committed, with a bare repository beside it as its origin. */
|
|
242
|
+
function workspaceCopy(): void {
|
|
243
|
+
rmSync(RUN, { recursive: true, force: true });
|
|
244
|
+
rmSync(REMOTE, { recursive: true, force: true });
|
|
245
|
+
const skip = /(^|[/\\])(node_modules|export|\.front-door|dist|\.git)([/\\]|$)/;
|
|
246
|
+
// Entry by entry: a directory can't be copied into its own .front-door.
|
|
247
|
+
mkdirSync(RUN, { recursive: true });
|
|
248
|
+
for (const e of readdirSync(ROOT)) {
|
|
249
|
+
if (!skip.test(e)) cpSync(join(ROOT, e), join(RUN, e), { recursive: true, filter: (src) => !skip.test(relative(ROOT, src)) });
|
|
250
|
+
}
|
|
251
|
+
symlinkSync(join(ROOT, "node_modules"), join(RUN, "node_modules"));
|
|
252
|
+
git(["init", "-q", "-b", "main"], RUN);
|
|
253
|
+
git(["add", "-A"], RUN);
|
|
254
|
+
git(["commit", "-q", "-m", "three-cloud"], RUN);
|
|
255
|
+
git(["init", "-q", "--bare", REMOTE], WORK);
|
|
256
|
+
git(["remote", "add", "origin", REMOTE], RUN);
|
|
257
|
+
git(["push", "-q", "origin", "main"], RUN);
|
|
258
|
+
say(`run: the workspace copied to ${relative(ROOT, RUN)}, its releases recorded on ${relative(ROOT, REMOTE)}`);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** One member's component, through chant's own deploy steps, against the emulators. */
|
|
262
|
+
function runComponent(member: string, component: string): void {
|
|
263
|
+
say(`${member}: chant run --components ${component} --env ${ENV}`);
|
|
264
|
+
const r = spawnSync(join(RUN, "node_modules", ".bin", "chant"), ["run", "--components", component, "--env", ENV], {
|
|
265
|
+
cwd: join(RUN, member),
|
|
266
|
+
env: { ...childEnv, USER: "three-cloud-demo", GIT_AUTHOR_NAME: "three-cloud demo", GIT_AUTHOR_EMAIL: "demo@three-cloud.test", GIT_COMMITTER_NAME: "three-cloud demo", GIT_COMMITTER_EMAIL: "demo@three-cloud.test" },
|
|
267
|
+
stdio: "inherit",
|
|
268
|
+
});
|
|
269
|
+
if (r.status !== 0) throw new Refusal(`${member}: the ${component} component did not apply (exit ${r.status})`);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** The dns member, with the three endpoints the other members published. */
|
|
273
|
+
async function applyFrontDoor(gcp: string, azure: string, aws: { endpoint: string } | { refused: string }): Promise<void> {
|
|
217
274
|
// An aws stack that doesn't apply leaves its record pointing at a name that
|
|
218
275
|
// doesn't resolve and its check probing an address nothing answers on
|
|
219
276
|
// (192.0.2.1, kept for documentation by RFC 5737), so the page shows AWS
|
|
@@ -237,9 +294,16 @@ export async function apply(): Promise<void> {
|
|
|
237
294
|
},
|
|
238
295
|
);
|
|
239
296
|
say("dns: applied");
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** The dns member alone, reading the three endpoints from what is already applied (its component's step). */
|
|
300
|
+
async function applyFrontDoorFromLive(): Promise<void> {
|
|
301
|
+
const out = await stackOutputs("three-cloud-aws");
|
|
302
|
+
const app = await getJson(`${appUrl()}?api-version=2024-03-01`);
|
|
303
|
+
const azure = (app.properties as { configuration?: { ingress?: { fqdn?: string } } } | undefined)?.configuration?.ingress?.fqdn;
|
|
304
|
+
if (!azure) throw new Refusal("azure: the container app web has no ingress fqdn; apply the azure member first");
|
|
305
|
+
const addr = (await fetch(`${GCP}/compute/v1/projects/${GCP_PROJECT}/global/addresses/three-cloud-ip`).then((r) => (r.ok ? r.json() : {}))) as { address?: string };
|
|
306
|
+
await applyFrontDoor(addr.address ?? "192.0.2.1", azure, out.awsEndpoint ? { endpoint: out.awsEndpoint } : { refused: "the stack has no awsEndpoint output" });
|
|
243
307
|
}
|
|
244
308
|
|
|
245
309
|
// ---------------------------------------------------------------------------
|
|
@@ -309,7 +373,9 @@ export function exportPage(out: string): void {
|
|
|
309
373
|
// BEHOLD names the behold to run (a checkout's `tsx src/cli.ts`, say);
|
|
310
374
|
// by default it is the published one.
|
|
311
375
|
const behold = (process.env.BEHOLD ?? "npx --yes @intentius/behold").split(" ");
|
|
312
|
-
|
|
376
|
+
// The copy the components ran in, when there is one: its remote holds their release records.
|
|
377
|
+
const served = existsSync(join(RUN, "chant.workspace.json")) ? RUN : ROOT;
|
|
378
|
+
const args = [...behold.slice(1), "export", served, "--out", resolve(out), "--open-env", ENV, "--open-zoom", "components", "--note", NOTE];
|
|
313
379
|
say(`export: ${behold[0]} ${args.join(" ")}`);
|
|
314
380
|
const r = spawnSync(behold[0]!, args, { env: childEnv, stdio: "inherit" });
|
|
315
381
|
if (r.status !== 0) throw new Refusal(`behold export exited ${r.status}`);
|
|
@@ -380,6 +446,14 @@ async function main(argv: string[]): Promise<void> {
|
|
|
380
446
|
const outAt = rest.indexOf("--out");
|
|
381
447
|
const out = outAt >= 0 ? rest[outAt + 1] : undefined;
|
|
382
448
|
if (step === "apply") return apply();
|
|
449
|
+
// One member at a time, outside chant: apply-dns is the dns component's step; the others apply as before components ran them.
|
|
450
|
+
if (step === "apply-gcp") return void say(`gcp: the load balancer answers on ${await applyGcp()}`);
|
|
451
|
+
if (step === "apply-azure") return void say(`azure: web answers as ${await applyAzure()}`);
|
|
452
|
+
if (step === "apply-aws") {
|
|
453
|
+
const aws = await applyAws();
|
|
454
|
+
return void say("refused" in aws ? `aws: NOT APPLIED: ${aws.refused}` : `aws: web answers as ${aws.endpoint}`);
|
|
455
|
+
}
|
|
456
|
+
if (step === "apply-dns") return applyFrontDoorFromLive();
|
|
383
457
|
if (step === "azure-off") return azureOff();
|
|
384
458
|
if (step === "wait") return waitFor("unhealthy");
|
|
385
459
|
if (step === "export" || step === "all") {
|
|
@@ -391,7 +465,7 @@ async function main(argv: string[]): Promise<void> {
|
|
|
391
465
|
}
|
|
392
466
|
return exportPage(out);
|
|
393
467
|
}
|
|
394
|
-
throw new Refusal("usage: front-door.ts all|apply|azure-off|wait|export [--out <dir>]");
|
|
468
|
+
throw new Refusal("usage: front-door.ts all|apply|apply-gcp|apply-azure|apply-aws|apply-dns|azure-off|wait|export [--out <dir>]");
|
|
395
469
|
}
|
|
396
470
|
|
|
397
471
|
main(process.argv.slice(2)).catch((e: unknown) => {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# AWS Architecture Icons — terms of use
|
|
2
|
+
|
|
3
|
+
Source: https://aws.amazon.com/architecture/icons/ — the "Icon package" asset
|
|
4
|
+
download, release 2026-07-31 (`Icon-package_07312026.zip`), retrieved
|
|
5
|
+
2026-10-21.
|
|
6
|
+
|
|
7
|
+
The page states:
|
|
8
|
+
|
|
9
|
+
> We allow customers and partners to use these toolkits and assets to create
|
|
10
|
+
> architecture diagrams.
|
|
11
|
+
|
|
12
|
+
> You can also put icons in materials like whitepapers, presentations, data
|
|
13
|
+
> sheets, and posters.
|
|
14
|
+
|
|
15
|
+
behold uses the icons only to draw architecture diagrams of a user's own
|
|
16
|
+
infrastructure: each icon stands for the AWS service or resource it was
|
|
17
|
+
published for, drawn unmodified. "AWS", "Amazon Web Services" and the service
|
|
18
|
+
names are trademarks of Amazon.com, Inc. or its affiliates. The site terms at
|
|
19
|
+
https://aws.amazon.com/terms/ govern the assets.
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Azure architecture icons — terms of use
|
|
2
|
+
|
|
3
|
+
Source: https://learn.microsoft.com/azure/architecture/icons/ — "Download SVG
|
|
4
|
+
icons", `Azure_Public_Service_Icons_V24.zip`, retrieved 2026-10-21. The pack's
|
|
5
|
+
own `Microsoft_Terms_of_Use.pdf` is vendored beside this file.
|
|
6
|
+
|
|
7
|
+
The page's icon terms:
|
|
8
|
+
|
|
9
|
+
> Microsoft permits the use of these icons in architectural diagrams, training
|
|
10
|
+
> materials, or documentation. You can copy, distribute, and display the icons
|
|
11
|
+
> only for the permitted use unless granted explicit permission by Microsoft.
|
|
12
|
+
> Microsoft reserves all other rights.
|
|
13
|
+
|
|
14
|
+
and its guidelines: use the icons to illustrate how products work together;
|
|
15
|
+
don't crop, flip, rotate, distort or change their shape; don't use them to
|
|
16
|
+
represent your own product.
|
|
17
|
+
|
|
18
|
+
behold draws the icons, unmodified, in architecture diagrams of a user's own
|
|
19
|
+
Azure resources, each standing for the service it was published for. Microsoft
|
|
20
|
+
and Azure are trademarks of the Microsoft group of companies.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Google Cloud icons — terms of use
|
|
2
|
+
|
|
3
|
+
Source: https://cloud.google.com/icons — `google-cloud-icons.zip`
|
|
4
|
+
(https://cloud.google.com/static/icons/files/google-cloud-icons.zip), retrieved
|
|
5
|
+
2026-10-21. The pack carries no licence file of its own.
|
|
6
|
+
|
|
7
|
+
Google publishes the icon library for representing Google Cloud products in
|
|
8
|
+
architecture diagrams, and its earlier icon guidance allowed the product logos
|
|
9
|
+
to be used to refer accurately to Google's products, architecture diagrams
|
|
10
|
+
being the example it gave. No current licence text was found at retrieval.
|
|
11
|
+
behold draws each icon,
|
|
12
|
+
unmodified, to stand for the Google Cloud product it was published for, in
|
|
13
|
+
architecture diagrams of a user's own resources. Google Cloud and the product
|
|
14
|
+
names are trademarks of Google LLC. Check https://cloud.google.com/icons for
|
|
15
|
+
the current terms before re-vendoring.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/behold",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
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.",
|
|
@@ -41,27 +41,26 @@
|
|
|
41
41
|
"preview:tour": "tsx scripts/tour-preview.ts",
|
|
42
42
|
"tsc": "tsc --noEmit",
|
|
43
43
|
"test": "vitest run",
|
|
44
|
-
"build": "esbuild src/cli.ts --bundle --platform=node --format=esm --external:hono --external:@hono/node-server --external:@intentius/pinhole --external:@kubernetes/client-node --external:ajv --outfile=dist/cli.js && chmod +x dist/cli.js",
|
|
44
|
+
"build": "esbuild src/cli.ts --bundle --platform=node --format=esm --external:hono --external:@hono/node-server --external:@intentius/pinhole --external:@kubernetes/client-node --external:ajv --external:@modelcontextprotocol/sdk --outfile=dist/cli.js && chmod +x dist/cli.js",
|
|
45
45
|
"prepare": "npm run build",
|
|
46
46
|
"prepublishOnly": "npm run build"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
+
"@cdktn/hcl2json": "^0.24.0",
|
|
49
50
|
"@hono/node-server": "^2.0.5",
|
|
50
|
-
"@intentius/chant": "^0.124.
|
|
51
|
+
"@intentius/chant": "^0.124.46",
|
|
51
52
|
"@intentius/chant-k8s-client": "^0.124.24",
|
|
53
|
+
"@intentius/chant-lexicon-terraform": "^0.124.46",
|
|
52
54
|
"@intentius/pinhole": "^0.5.0",
|
|
55
|
+
"@modelcontextprotocol/sdk": "1.30.1",
|
|
53
56
|
"ajv": "^8.20.0",
|
|
54
57
|
"hono": "^4.13.13"
|
|
55
58
|
},
|
|
56
59
|
"peerDependencies": {
|
|
57
|
-
"
|
|
58
|
-
"@cdktn/hcl2json": "^0.24.0"
|
|
60
|
+
"playwright-core": "^1.62.0"
|
|
59
61
|
},
|
|
60
62
|
"peerDependenciesMeta": {
|
|
61
|
-
"
|
|
62
|
-
"optional": true
|
|
63
|
-
},
|
|
64
|
-
"@cdktn/hcl2json": {
|
|
63
|
+
"playwright-core": {
|
|
65
64
|
"optional": true
|
|
66
65
|
}
|
|
67
66
|
},
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// #914: an agent moved the open tab (POST /api/view, the `view` event on
|
|
2
|
+
// /api/events). Pure logic, no DOM: the banner's words and the history entry
|
|
3
|
+
// a move makes. app.js `agentMove` does the moving.
|
|
4
|
+
|
|
5
|
+
/** How many agent moves in a row get their own history entry. Past it, a move
|
|
6
|
+
* replaces the newest agent entry instead of pushing, so Back still reaches
|
|
7
|
+
* the person's own view after at most this many steps. */
|
|
8
|
+
export const AGENT_STACK_MAX = 20;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The history entry an agent move makes. `state` is history.state of the entry
|
|
12
|
+
* being left; a move pushes a new entry with `beholdMove` on it, numbered by
|
|
13
|
+
* how many agent moves in a row it is. At AGENT_STACK_MAX it replaces instead.
|
|
14
|
+
*/
|
|
15
|
+
export function agentEntry(state, move, max = AGENT_STACK_MAX) {
|
|
16
|
+
const before = state && typeof state === "object" ? state : {};
|
|
17
|
+
const prev = (before.beholdMove && Number(before.beholdMove.depth)) || 0;
|
|
18
|
+
const push = prev < max;
|
|
19
|
+
return { push, state: { ...before, beholdMove: { ...move, depth: push ? prev + 1 : prev } } };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** What clears each key of a question: q, its grouping and its plan depth. */
|
|
23
|
+
export const QUESTION_KEYS = Object.freeze({ q: null, countBy: null, plan: false });
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* An agent's move that asks a question (it carries q or countBy) asks it
|
|
27
|
+
* whole: a question key it leaves out, and the tab still holds, is cleared
|
|
28
|
+
* rather than kept from the view the tab was on. Found in #908's stage 3 run:
|
|
29
|
+
* step 3's countBy=module stayed on step 4's `cap:` query, so the tab showed
|
|
30
|
+
* chant's refusal while the agent's answer was right. env and the rest stay:
|
|
31
|
+
* they are where the tab is, not what it asks.
|
|
32
|
+
*/
|
|
33
|
+
export function wholeQuestion(want, current) {
|
|
34
|
+
if (!want || !("q" in want || "countBy" in want)) return want;
|
|
35
|
+
const out = { ...want };
|
|
36
|
+
for (const [k, clear] of Object.entries(QUESTION_KEYS)) if (!(k in out) && current && current[k]) out[k] = clear;
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** HH:MM:SS in the viewer's clock, or "" for a date that isn't one. */
|
|
41
|
+
export function clockTime(d) {
|
|
42
|
+
if (!(d instanceof Date) || Number.isNaN(d.getTime())) return "";
|
|
43
|
+
const p = (n) => String(n).padStart(2, "0");
|
|
44
|
+
return `${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The banner's line: "Moved by an agent: <by> asked `<q>` at 14:02:11
|
|
49
|
+
* (request 7f3a)." Without a question it says what moved it and when. The
|
|
50
|
+
* label is the caller's own claim (`by`), never checked.
|
|
51
|
+
*/
|
|
52
|
+
export function agentBanner(move, at) {
|
|
53
|
+
const m = move || {};
|
|
54
|
+
const by = typeof m.by === "string" && m.by ? m.by : "an agent";
|
|
55
|
+
const q = typeof m.q === "string" && m.q ? m.q : "";
|
|
56
|
+
const when = clockTime(at);
|
|
57
|
+
const id = typeof m.id === "string" && m.id ? ` (request ${m.id})` : "";
|
|
58
|
+
const asked = q ? ` asked \`${q.length > 120 ? q.slice(0, 120) + "..." : q}\`` : " moved this view";
|
|
59
|
+
return { text: `Moved by an agent: ${by}${asked}${when ? ` at ${when}` : ""}${id}.` };
|
|
60
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { AGENT_STACK_MAX, agentBanner, agentEntry, clockTime, wholeQuestion } from "./agent-move.js";
|
|
3
|
+
|
|
4
|
+
describe("agentBanner (#914)", () => {
|
|
5
|
+
const at = new Date(2026, 9, 23, 14, 2, 11);
|
|
6
|
+
it("says who asked what, when, and which request", () => {
|
|
7
|
+
expect(agentBanner({ by: "claude-code", q: "attr:internetFacing=true", id: "7f3a" }, at).text).toBe(
|
|
8
|
+
"Moved by an agent: claude-code asked `attr:internetFacing=true` at 14:02:11 (request 7f3a).",
|
|
9
|
+
);
|
|
10
|
+
});
|
|
11
|
+
it("without a question, says the view moved", () => {
|
|
12
|
+
expect(agentBanner({ by: "curl/8.7.1", q: "", id: "1" }, at).text).toBe("Moved by an agent: curl/8.7.1 moved this view at 14:02:11 (request 1).");
|
|
13
|
+
expect(agentBanner({}, new Date("nope")).text).toBe("Moved by an agent: an agent moved this view.");
|
|
14
|
+
});
|
|
15
|
+
it("clockTime pads", () => {
|
|
16
|
+
expect(clockTime(new Date(2026, 0, 1, 3, 4, 5))).toBe("03:04:05");
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
describe("agentEntry (#914)", () => {
|
|
21
|
+
it("pushes a numbered entry over the person's own", () => {
|
|
22
|
+
const e = agentEntry({ other: 1 }, { id: "a" });
|
|
23
|
+
expect(e).toEqual({ push: true, state: { other: 1, beholdMove: { id: "a", depth: 1 } } });
|
|
24
|
+
expect(agentEntry(e.state, { id: "b" })).toEqual({ push: true, state: { other: 1, beholdMove: { id: "b", depth: 2 } } });
|
|
25
|
+
expect(agentEntry(null, { id: "c" }).push).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
it("stops pushing at the cap of 20, replacing the newest agent entry instead", () => {
|
|
28
|
+
let state = null;
|
|
29
|
+
let pushes = 0;
|
|
30
|
+
for (let i = 0; i < 30; i++) {
|
|
31
|
+
const e = agentEntry(state, { id: String(i) });
|
|
32
|
+
if (e.push) pushes++;
|
|
33
|
+
state = e.state;
|
|
34
|
+
}
|
|
35
|
+
expect(AGENT_STACK_MAX).toBe(20);
|
|
36
|
+
expect(pushes).toBe(20);
|
|
37
|
+
expect(state.beholdMove).toEqual({ id: "29", depth: 20 });
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe("wholeQuestion (#908 stage 3)", () => {
|
|
42
|
+
it("clears the question keys a question move leaves out and the tab holds", () => {
|
|
43
|
+
const tab = { q: "kind:aws_", countBy: "module", plan: true, env: "prod", zoom: "resources" };
|
|
44
|
+
expect(wholeQuestion({ q: "cap:internet-reachable(22)" }, tab)).toEqual({ q: "cap:internet-reachable(22)", countBy: null, plan: false });
|
|
45
|
+
expect(wholeQuestion({ countBy: "kind" }, tab)).toEqual({ countBy: "kind", q: null, plan: false });
|
|
46
|
+
expect(wholeQuestion({ q: "a", plan: true }, { q: "b", countBy: "kind" })).toEqual({ q: "a", plan: true, countBy: null });
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("leaves a move that asks no question, and keys the tab doesn't hold, as they are", () => {
|
|
50
|
+
const tab = { q: "kind:aws_", countBy: "module" };
|
|
51
|
+
expect(wholeQuestion({ zoom: "attributes" }, tab)).toEqual({ zoom: "attributes" });
|
|
52
|
+
expect(wholeQuestion({ q: "a" }, { zoom: "resources" })).toEqual({ q: "a" });
|
|
53
|
+
expect(wholeQuestion({ q: "a" }, undefined)).toEqual({ q: "a" });
|
|
54
|
+
});
|
|
55
|
+
});
|