MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / runModeComparison

Function runModeComparison

scripts/gen-governance-audit-examples.ts:249–286  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

247}
248
249async function runModeComparison(): Promise<Record<string, Record<string, unknown>>> {
250 const out: Record<string, Record<string, unknown>> = {};
251 for (const mode of ['enforce', 'advisory', 'audit'] as const) {
252 invalidateCache();
253 await clearSessions();
254 const server = createTrainingAgentServer(DEFAULT_CTX);
255 const t = tenant(`apex-mode-${mode}.example`);
256 const planId = `plan_mode_${mode}`;
257
258 await callTool(server, 'sync_plans', {
259 ...t,
260 plans: [{
261 plan_id: planId,
262 brand: { domain: `apex-mode-${mode}.example`, name: 'Apex Athletic' },
263 objectives: 'Demonstrate same denial under different modes.',
264 budget: { total: 300000, currency: 'USD', reallocation_threshold: 30000 },
265 flight: PLAN_FLIGHT,
266 channels: { allowed: ['olv', 'display', 'ctv'] },
267 countries: ['US'],
268 approved_sellers: ['https://ads.seller-approved.example'],
269 mode,
270 }],
271 });
272
273 const { result } = await callTool(server, 'check_governance', {
274 ...t,
275 plan_id: planId,
276 binding: 'committed',
277 caller: 'https://ads.seller-rogue.example',
278 tool: 'create_media_buy',
279 purchase_type: 'media_buy',
280 payload: { total_budget: 100000, currency: 'USD', channels: ['olv'], flight: PLAN_FLIGHT },
281 });
282
283 out[mode] = result;
284 }
285 return out;
286}
287
288async function main() {
289 invalidateCache();

Callers 1

mainFunction · 0.85

Calls 5

invalidateCacheFunction · 0.85
clearSessionsFunction · 0.85
tenantFunction · 0.85
callToolFunction · 0.70

Tested by

no test coverage detected