MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / guard

Function guard

graph-ui/tools/smoke-w15.mjs:153–165  ·  view source on GitHub ↗
(area)

Source from the content-addressed store, hash-verified

151 await page.waitForFunction(() => document.querySelector('[data-testid="atlas-twin"]')?.getAttribute('data-status') === 'ready', undefined, { timeout: 40000 });
152 };
153 const guard = async (area) => {
154 const subject = await page.evaluate((name) => {
155 const seam = name === 'twin' ? globalThis.__atlasTwin : name === 'flow' ? globalThis.__atlasFlow : globalThis.__atlasChatReader;
156 return seam?.subject ?? [];
157 }, area);
158 const refusals = await page.evaluate(({ name, answers }) => {
159 const seam = name === 'twin' ? globalThis.__atlasTwin : name === 'flow' ? globalThis.__atlasFlow : globalThis.__atlasChatReader;
160 if (seam === undefined) throw new Error(`${name} reader guard is unavailable`);
161 return answers.map((answer) => ({ answer, ...seam.validateRewrite(answer) }));
162 }, { name: area, answers: corruptions(subject) });
163 report.guardRefusals += refusals.filter((entry) => !entry.applied && entry.reason.length > 10).length;
164 return { guardIsTheRealOne: true, refusals };
165 };
166 const noAutoRequestDuring = async (area, action) => {
167 const before = sidecarRequests;
168 await action();

Callers 1

exerciseFunction · 0.85

Calls 1

corruptionsFunction · 0.85

Tested by

no test coverage detected