@monster-orange/den 0.2.5 → 0.2.6

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.
@@ -12,9 +12,11 @@
12
12
 
13
13
  import {
14
14
  composeHealthTarget,
15
+ containerCheckLabel,
15
16
  type ComposeHealthTarget,
17
+ type ContainerHealthTarget,
16
18
  } from "../../shared/stacks/compose-health.js";
17
- import { healthCheckFields } from "./health-row.js";
19
+ import { healthCheckFields, type HealthCheckType } from "./health-row.js";
18
20
  import { hasRuntime, repoKind } from "../../shared/repo-kind.js";
19
21
  import * as http from "http";
20
22
  import * as fs from "fs";
@@ -62,6 +64,8 @@ import {
62
64
  isSafeServiceName,
63
65
  } from "./log-history.js";
64
66
  import {
67
+ containerTarget,
68
+ pingContainerCheck,
65
69
  pingHttp,
66
70
  pingShellCheck,
67
71
  TimeoutStreaks,
@@ -926,7 +930,7 @@ async function handleRequest(
926
930
  repo: string;
927
931
  service: string;
928
932
  label: string;
929
- checkType: "http" | "shell" | "none";
933
+ checkType: HealthCheckType;
930
934
  target: string;
931
935
  repoPath: string;
932
936
  mode: "dev-managed" | "managed";
@@ -941,6 +945,8 @@ async function handleRequest(
941
945
  expect?: Expect;
942
946
  /** pingShell options (Den's own `stack health` can report unknown). */
943
947
  compose: ComposeHealthTarget | null;
948
+ /** A `type: container` check: answered from the shared listing. */
949
+ container: ContainerHealthTarget | null;
944
950
  meta: Pick<HealthResult, "runs" | "target">;
945
951
  }> = [];
946
952
  let edgeDomain: string | null = null;
@@ -974,6 +980,7 @@ async function handleRequest(
974
980
  links: [],
975
981
  org: orgOf(resolved.repoName, catalog),
976
982
  compose: null,
983
+ container: null,
977
984
  meta: { runs: "none", target: null },
978
985
  });
979
986
  continue;
@@ -1020,14 +1027,16 @@ async function handleRequest(
1020
1027
  service: resolved.subsystem,
1021
1028
  label: plan.label ?? healthCfg?.label ?? resolved.subsystem,
1022
1029
  checkType: healthCfg
1023
- ? healthCfg.type === "shell"
1024
- ? "shell"
1030
+ ? healthCfg.type === "shell" || healthCfg.type === "container"
1031
+ ? healthCfg.type
1025
1032
  : "http"
1026
1033
  : "none",
1027
1034
  target: healthCfg
1028
1035
  ? healthCfg.type === "shell"
1029
1036
  ? healthCfg.cmd
1030
- : healthCfg.url
1037
+ : healthCfg.type === "container"
1038
+ ? containerCheckLabel(containerTarget(healthCfg))
1039
+ : healthCfg.url
1031
1040
  : "",
1032
1041
  repoPath: resolved.repoPath,
1033
1042
  mode: resolved.mode,
@@ -1048,14 +1057,15 @@ async function handleRequest(
1048
1057
  subsystem: resolved.subsystem,
1049
1058
  repoName: resolved.repoName,
1050
1059
  env,
1051
- healthUrl:
1052
- healthCfg && healthCfg.type !== "shell" ? healthCfg.url : null,
1060
+ healthUrl: healthCfg && "url" in healthCfg ? healthCfg.url : null,
1053
1061
  edgeDomain,
1054
1062
  }),
1055
1063
  links: linksFor(manifest, resolved.subsystem, env),
1056
1064
  org: orgOf(resolved.repoName, catalog),
1057
1065
  ...(plan.expect ? { expect: plan.expect } : {}),
1058
1066
  compose,
1067
+ container:
1068
+ healthCfg?.type === "container" ? containerTarget(healthCfg) : null,
1059
1069
  meta: { runs: plan.placement.runs, target: plan.placement.target },
1060
1070
  });
1061
1071
  }
@@ -1086,6 +1096,7 @@ async function handleRequest(
1086
1096
  meta,
1087
1097
  expect,
1088
1098
  compose,
1099
+ container,
1089
1100
  }) => {
1090
1101
  if (checkType !== "none") {
1091
1102
  const started = Date.now();
@@ -1097,13 +1108,15 @@ async function handleRequest(
1097
1108
  repoPath,
1098
1109
  compose,
1099
1110
  )
1100
- : await pingHttp(
1101
- target,
1102
- env === "local" && meta.runs !== "remote"
1103
- ? HEALTH_CHECK_TIMEOUT_MS
1104
- : HOSTED_HEALTH_CHECK_TIMEOUT_MS,
1105
- expect,
1106
- );
1111
+ : checkType === "container" && container
1112
+ ? await pingContainerCheck(container)
1113
+ : await pingHttp(
1114
+ target,
1115
+ env === "local" && meta.runs !== "remote"
1116
+ ? HEALTH_CHECK_TIMEOUT_MS
1117
+ : HOSTED_HEALTH_CHECK_TIMEOUT_MS,
1118
+ expect,
1119
+ );
1107
1120
  return {
1108
1121
  repo,
1109
1122
  service,
@@ -2373,6 +2386,11 @@ async function handleRequest(
2373
2386
  port: PORT,
2374
2387
  // Den's version: the MCP server compares it with the routes it needs.
2375
2388
  version: engineVersion() ?? null,
2389
+ // Whose server this is: `<cli> web up|down`, `mcp connect` and
2390
+ // `service install` compare both with their own and never act on
2391
+ // another distribution's server (see cli/server-identity.ts).
2392
+ root: ROOT,
2393
+ product: product().name,
2376
2394
  startedAt: new Date(SERVER_STARTED_AT).toISOString(),
2377
2395
  uptimeMs: Date.now() - SERVER_STARTED_AT,
2378
2396
  stale,