feat: add JD01 YAML-first deployment support

This commit is contained in:
Codex
2026-06-29 08:13:34 +00:00
parent fe917bec4a
commit 076c4b643d
49 changed files with 10909 additions and 5223 deletions
@@ -2,6 +2,7 @@
// Responsibility: Resolve YAML-first web-probe sentinel registry entries into one selected sentinel config graph.
import { existsSync, readFileSync } from "node:fs";
import { rootPath } from "./config";
import { readWebProbeSentinelConfigRefTarget, type WebProbeSentinelTemplateContext } from "./hwlab-node-web-sentinel-config-ref";
import { HWLAB_WEB_PROBE_SENTINEL_CONFIG_REF_KEYS, type HwlabRuntimeLaneSpec, type HwlabRuntimeWebProbeSentinelConfigRefKey, type HwlabRuntimeWebProbeSentinelRegistryItemSpec } from "./hwlab-node-lanes";
export interface ResolvedWebProbeSentinel {
@@ -110,7 +111,7 @@ function resolveRegistrySentinel(spec: HwlabRuntimeLaneSpec, registry: readonly
const ids = registry.map((item) => item.id).join(", ");
throw new Error(`unknown web-probe sentinel ${sentinelId ?? "-"} for ${spec.nodeId}/${spec.lane}; available: ${ids}`);
}
const target = readConfigRefRecord(selected.configRef);
const target = readConfigRefRecord(selected.configRef, spec);
const targetId = optionalStringAt(target, "id") ?? selected.id;
if (targetId !== selected.id) {
throw new Error(`${selected.configRef}.id=${targetId} does not match registry id ${selected.id}`);
@@ -151,13 +152,14 @@ function normalizeSentinelConfigRefs(target: Record<string, unknown>, ref: strin
return Object.fromEntries(HWLAB_WEB_PROBE_SENTINEL_CONFIG_REF_KEYS.map((key) => [key, normalized[key]])) as Record<HwlabRuntimeWebProbeSentinelConfigRefKey, string>;
}
function readConfigRefRecord(ref: string): Record<string, unknown> {
const target = readConfigRefTarget(ref);
function readConfigRefRecord(ref: string, context: WebProbeSentinelTemplateContext): Record<string, unknown> {
const target = readConfigRefTarget(ref, context);
if (!isRecord(target)) throw new Error(`${ref} must point to a YAML object`);
return target;
}
export function readConfigRefTarget(ref: string): unknown {
export function readConfigRefTarget(ref: string, context?: WebProbeSentinelTemplateContext): unknown {
if (context !== undefined) return readWebProbeSentinelConfigRefTarget(context, ref);
const [file, path, extra] = ref.split("#");
if (extra !== undefined || file === undefined || path === undefined || file.length === 0 || path.length === 0) {
throw new Error(`${ref} must use path/to/file.yaml#object.path syntax`);