donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
33 lines • 1.62 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.hashTestConfig = hashTestConfig;
const crypto_1 = require("crypto");
const fast_json_stable_stringify_1 = __importDefault(require("fast-json-stable-stringify"));
const toolConstants_1 = require("../tools/toolConstants");
const displayName_1 = require("../utils/displayName");
/**
* Deterministic MD5 of the RunConfig-derived slice of `metadata`, used to
* group orphan flows into a single back-filled test during migration v12 and
* the equivalent cloud ops script. `maxToolCalls` is excluded because it is
* null on deterministic flows and would otherwise split groups along run-mode
* boundaries. MD5 is fine here because the hash is used for grouping, not
* security.
*/
function hashTestConfig(metadata) {
const config = {
name: metadata.name ?? (0, displayName_1.getDisplayName)(metadata, 'Untitled Flow'),
target: metadata.target,
web: metadata.web,
envVars: metadata.envVars,
customTools: metadata.customTools,
overallObjective: metadata.overallObjective,
allowedTools: metadata.allowedTools.filter((tool) => !toolConstants_1.SUPPRESSED_TOOLS_BY_NAME.has(tool)),
resultJsonSchema: metadata.resultJsonSchema,
callbackUrl: metadata.callbackUrl,
};
return (0, crypto_1.createHash)('md5').update((0, fast_json_stable_stringify_1.default)(config)).digest('hex');
}
//# sourceMappingURL=TestConfigHash.js.map