mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 10:43:30 +00:00
Serve retained capture Evidence as a bounded MCP replay environment with discovery. Preserve default stdio, caller-selected facts and complete source Evidence. Fix numeric fidelity, argument identity, startup cancellation and bounded discovery, query/path matching and output metadata. Verify real recorded API data and public CLI/MCP workflows; preserve explicit gaps for Windows and third-party hosts. Co-authored-by: Edgar Arakelyan <edgar.arakelyan@scale.com> Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1000 B
TypeScript
31 lines
1000 B
TypeScript
import { z } from "zod";
|
|
|
|
import { ConfigurationError } from "../domain/configurationErrors.js";
|
|
import { err, ok, type Result } from "../domain/result.js";
|
|
|
|
export const ENVIRONMENT_NAME_CONSTRAINT =
|
|
"ENVIRONMENT_NAME must be a non-empty name when set.";
|
|
|
|
const environmentNameSchema = z.string().trim().min(1);
|
|
|
|
/** The served environment name override, or undefined when the manifest name applies. */
|
|
export const parseEnvironmentName = (
|
|
environment: Readonly<NodeJS.ProcessEnv>,
|
|
): Result<string | undefined, ConfigurationError> => {
|
|
const value = environment.ENVIRONMENT_NAME;
|
|
if (value === undefined) return ok(undefined);
|
|
const parsed = environmentNameSchema.safeParse(value);
|
|
return parsed.success
|
|
? ok(parsed.data)
|
|
: err(
|
|
new ConfigurationError(ENVIRONMENT_NAME_CONSTRAINT, {
|
|
settings: [
|
|
{
|
|
setting: "ENVIRONMENT_NAME",
|
|
constraint: ENVIRONMENT_NAME_CONSTRAINT,
|
|
},
|
|
],
|
|
}),
|
|
);
|
|
};
|