Added comprehensive internationalization: - German and French translations via DeepL API - Language-responsive Agent Lightning integration page - Navbar feedback button now translates (DE: "Feedback geben", FR: "Donner son avis") - Translation files: agent-lightning-integration.json (EN/DE/FR) - Data-i18n attributes on all major headings and CTA buttons - i18n scripts loaded on Agent Lightning page Translation coverage: - Hero section - All major section headings - Call-to-action buttons - Navbar feedback menu item Files modified: - public/integrations/agent-lightning.html (i18n scripts + data-i18n attributes) - public/js/components/navbar.js (data-i18n for feedback button) - public/js/i18n-simple.js (page map entry) - public/locales/*/agent-lightning-integration.json (translations) - public/locales/*/common.json (navbar.feedback translations) - scripts/translate-agent-lightning.js (translation automation) - docs/reports/FRAMEWORK_PERFORMANCE_REPORT_2025-11-03.md (framework stats) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
267 lines
14 KiB
JavaScript
Executable file
267 lines
14 KiB
JavaScript
Executable file
#!/usr/bin/env node
|
|
/**
|
|
* Translate Agent Lightning page content to German and French using DeepL API
|
|
*/
|
|
|
|
require('dotenv').config();
|
|
const https = require('https');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const DEEPL_API_KEY = process.env.DEEPL_API_KEY;
|
|
const DEEPL_API_URL = process.env.DEEPL_API_URL || 'https://api.deepl.com/v2';
|
|
|
|
// Translatable content extracted from agent-lightning.html
|
|
const content = {
|
|
"hero": {
|
|
"title": "Agent Lightning Integration",
|
|
"subtitle": "Governance + Performance: Can safety boundaries persist through reinforcement learning optimization?",
|
|
"status": "Status:",
|
|
"status_value": "Preliminary findings (small-scale)",
|
|
"integration_date": "Integration Date:",
|
|
"integration_date_value": "October 2025"
|
|
},
|
|
"what_is": {
|
|
"heading": "What is Agent Lightning?",
|
|
"intro": "<strong>Agent Lightning</strong> is Microsoft's open-source framework for using <strong>reinforcement learning (RL)</strong> to optimize AI agent performance. Instead of static prompts, agents learn and improve through continuous training on real feedback.",
|
|
"traditional_heading": "Traditional AI Agents",
|
|
"traditional_1": "Fixed prompts/instructions",
|
|
"traditional_2": "No learning from mistakes",
|
|
"traditional_3": "Manual tuning required",
|
|
"traditional_4": "Performance plateaus quickly",
|
|
"al_heading": "Agent Lightning",
|
|
"al_1": "Learns from feedback continuously",
|
|
"al_2": "Improves through RL optimization",
|
|
"al_3": "Self-tunes strategy automatically",
|
|
"al_4": "Performance improves over time",
|
|
"problem": "<strong>The Problem:</strong> When agents are learning autonomously, how do you maintain governance boundaries? Traditional policies fail because agents can optimize around them."
|
|
},
|
|
"architecture": {
|
|
"heading": "Tractatus Solution: Two-Layer Architecture",
|
|
"intro": "We separate governance from optimization by running them as <strong>independent architectural layers</strong>. Agent Lightning optimizes performance <em>within</em> governance constraints—not around them.",
|
|
"layer1_heading": "Governance Layer (Tractatus)",
|
|
"layer1_1": "Validates every proposed action",
|
|
"layer1_2": "Blocks constraint violations",
|
|
"layer1_3": "Enforces values boundaries",
|
|
"layer1_4": "Independent of optimization",
|
|
"layer1_5": "Architecturally enforced",
|
|
"layer2_heading": "Performance Layer (Agent Lightning)",
|
|
"layer2_1": "RL-based optimization",
|
|
"layer2_2": "Learns from feedback",
|
|
"layer2_3": "Improves task performance",
|
|
"layer2_4": "Operates within constraints",
|
|
"layer2_5": "Continuous training",
|
|
"principle_title": "🔑 Key Design Principle",
|
|
"principle_text": "Governance checks run <strong>before</strong> AL optimization and <strong>continuously validate</strong> during training loops. Architectural separation prevents optimization from degrading safety boundaries."
|
|
},
|
|
"results": {
|
|
"heading": "Demo 2: Preliminary Results",
|
|
"warning": "<strong>⚠️ Validation Status:</strong> These results are from <strong>1 agent, 5 training rounds, simulated environment</strong>. NOT validated at scale. Scalability testing required before drawing conclusions about production viability.",
|
|
"table_metric": "Metric",
|
|
"table_ungoverned": "Ungoverned",
|
|
"table_governed": "Governed",
|
|
"table_difference": "Difference",
|
|
"metric_performance": "Performance (engagement)",
|
|
"metric_governance": "Governance coverage",
|
|
"metric_violations": "Constraint violations",
|
|
"metric_violations_diff": "-5 (all blocked)",
|
|
"metric_strategy": "Strategy",
|
|
"metric_strategy_ungov": "Clickbait",
|
|
"metric_strategy_gov": "Informative",
|
|
"metric_strategy_diff": "Values-aligned",
|
|
"metric_stability": "Training stability",
|
|
"metric_stability_ungov": "Variable",
|
|
"metric_stability_gov": "Consistent",
|
|
"metric_stability_diff": "More predictable",
|
|
"card1_value": "-5%",
|
|
"card1_label": "Performance cost for governance",
|
|
"card2_value": "100%",
|
|
"card2_label": "Governance coverage maintained",
|
|
"card3_value": "0",
|
|
"card3_label": "Constraint violations (all blocked)",
|
|
"interpretation_title": "What This Means",
|
|
"interpretation_text": "At small scale (1 agent, 5 rounds), architectural governance appears compatible with RL optimization. The 5% performance cost bought 100% constraint adherence and values alignment. <strong>The critical question: does this hold at scale?</strong>"
|
|
},
|
|
"gaps": {
|
|
"heading": "Five Critical Research Gaps",
|
|
"intro": "These are the open questions we're actively investigating. If you're interested in collaborating, we'd love to hear from you.",
|
|
"gap1_title": "1. Scalability of Governance Overhead",
|
|
"gap1_question": "<strong>Question:</strong> Does the ~5% performance cost remain constant as we scale from 1 agent → 10 agents → 1000 agents?",
|
|
"gap1_data": "<strong>Current Data:</strong> 5% cost observed at 1 agent, 5 rounds",
|
|
"gap1_why": "<strong>Why it matters:</strong> If overhead scales linearly, governance becomes prohibitively expensive at scale. If it's constant, governance is practically viable for production systems.",
|
|
"gap1_need": "Research Need: Test with 10 → 100 → 1000 agents at production scale",
|
|
"gap2_title": "2. Long-term Boundary Persistence",
|
|
"gap2_question": "<strong>Question:</strong> Do governance constraints remain effective through hundreds/thousands of RL training rounds?",
|
|
"gap2_data": "<strong>Current Data:</strong> 100% constraint adherence across 5 rounds",
|
|
"gap2_why": "<strong>Why it matters:</strong> Instruction fade is a known problem. If boundaries degrade over time, governance fails silently—potentially catastrophically in production.",
|
|
"gap2_need": "Research Need: Long-term studies (1000+ rounds) tracking constraint drift",
|
|
"gap3_title": "3. Adversarial Resistance",
|
|
"gap3_question": "<strong>Question:</strong> Can agents learn to optimize around governance constraints?",
|
|
"gap3_data": "<strong>Current Data:</strong> No adversarial testing performed",
|
|
"gap3_why": "<strong>Why it matters:</strong> If agents can learn to circumvent boundaries through clever optimization strategies, architectural governance is illusory. This is a critical failure mode.",
|
|
"gap3_need": "Research Need: Stress testing with agents explicitly incentivized to bypass governance",
|
|
"gap4_title": "4. Performance Gap Closure",
|
|
"gap4_question": "<strong>Question:</strong> Does the 5% performance gap close with more training, or is it a persistent trade-off?",
|
|
"gap4_data": "<strong>Current Data:</strong> Gap observed at round 5, no data beyond that point",
|
|
"gap4_why": "<strong>Why it matters:</strong> If the gap persists, we need to quantify the cost-benefit clearly. If it closes, governance may be \"free\" long-term—dramatically changing adoption calculations.",
|
|
"gap4_need": "Research Need: Extended training (100+ rounds) to see if governed agents converge to ungoverned performance",
|
|
"gap5_title": "5. Multi-Agent Coordination Under Governance",
|
|
"gap5_question": "<strong>Question:</strong> How does architectural governance affect emergent coordination in multi-agent systems?",
|
|
"gap5_data": "<strong>Current Data:</strong> Single-agent testing only",
|
|
"gap5_why": "<strong>Why it matters:</strong> Real-world agentic systems are multi-agent (customer service, logistics, research teams). Governance that works for one agent may fail when agents must coordinate. Emergent behaviors are unpredictable.",
|
|
"gap5_need": "Research Need: Test collaborative and competitive multi-agent environments with architectural governance"
|
|
},
|
|
"demo": {
|
|
"heading": "🎯 Live Demonstration: This Page IS the Integration",
|
|
"intro": "The feedback button on this page (bottom right) demonstrates the Tractatus + Agent Lightning integration in production. When you submit feedback, it goes through:",
|
|
"step1_title": "Governance Check",
|
|
"step1_desc": "Tractatus validates: PII detection, sentiment boundaries, compliance requirements",
|
|
"step2_title": "AL Optimization",
|
|
"step2_desc": "Agent Lightning learns patterns: what feedback is most useful, how to improve responses",
|
|
"step3_title": "Continuous Validation",
|
|
"step3_desc": "Every action re-validated. If governance detects drift, action blocked automatically",
|
|
"meta_title": "🔬 Meta-Research Opportunity",
|
|
"meta_desc": "This isn't just a demo—it's a live research deployment. Your feedback helps us understand governance overhead at scale. Every submission is logged (anonymously) for analysis."
|
|
},
|
|
"community": {
|
|
"heading": "Join the Community & Get the Code",
|
|
"tractatus_heading": "Tractatus Discord",
|
|
"tractatus_subtitle": "Governance-focused discussions",
|
|
"tractatus_desc": "Architectural constraints, research gaps, compliance, human agency preservation, multi-stakeholder deliberation.",
|
|
"tractatus_cta": "Join Tractatus Server →",
|
|
"al_heading": "Agent Lightning Discord",
|
|
"al_subtitle": "Technical implementation help",
|
|
"al_desc": "RL optimization, integration support, performance tuning, technical implementation questions.",
|
|
"al_cta": "Join Agent Lightning Server →",
|
|
"code_heading": "📦 View Integration Code",
|
|
"code_desc": "Complete integration including demos, Python governance modules, and Agent Lightning wrapper code. Apache 2.0 licensed on GitHub.",
|
|
"code_cta": "View on GitHub (Apache 2.0) →"
|
|
},
|
|
"cta": {
|
|
"heading": "Collaborate on Open Research Questions",
|
|
"intro": "We're seeking researchers, implementers, and organizations interested in scalability testing, adversarial resistance studies, and multi-agent governance experiments.",
|
|
"feature1": "Integration code and governance modules",
|
|
"feature2": "Technical documentation",
|
|
"feature3": "Research collaboration framework",
|
|
"feature4": "Audit log access (anonymized)",
|
|
"button_collab": "Contact for Collaboration →",
|
|
"button_research": "View Research Context →"
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Translate text using DeepL API
|
|
*/
|
|
async function translateText(text, targetLang) {
|
|
return new Promise((resolve, reject) => {
|
|
const data = new URLSearchParams({
|
|
auth_key: DEEPL_API_KEY,
|
|
text: text,
|
|
target_lang: targetLang.toUpperCase(),
|
|
source_lang: 'EN',
|
|
tag_handling: 'html',
|
|
preserve_formatting: '1'
|
|
});
|
|
|
|
const options = {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
'Content-Length': Buffer.byteLength(data.toString())
|
|
}
|
|
};
|
|
|
|
const req = https.request(`${DEEPL_API_URL}/translate`, options, (res) => {
|
|
let body = '';
|
|
res.on('data', chunk => body += chunk);
|
|
res.on('end', () => {
|
|
try {
|
|
const response = JSON.parse(body);
|
|
if (response.translations && response.translations[0]) {
|
|
resolve(response.translations[0].text);
|
|
} else {
|
|
reject(new Error(`Translation failed: ${body}`));
|
|
}
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
});
|
|
});
|
|
|
|
req.on('error', reject);
|
|
req.write(data.toString());
|
|
req.end();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Translate entire object recursively
|
|
*/
|
|
async function translateObject(obj, targetLang, prefix = '') {
|
|
const result = {};
|
|
|
|
for (const [key, value] of Object.entries(obj)) {
|
|
const fullKey = prefix ? `${prefix}.${key}` : key;
|
|
|
|
if (typeof value === 'object' && value !== null) {
|
|
console.log(` Translating section: ${fullKey}...`);
|
|
result[key] = await translateObject(value, targetLang, fullKey);
|
|
} else if (typeof value === 'string') {
|
|
try {
|
|
console.log(` Translating: ${fullKey}`);
|
|
const translated = await translateText(value, targetLang);
|
|
result[key] = translated;
|
|
// Rate limiting
|
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
} catch (error) {
|
|
console.error(` ERROR translating ${fullKey}:`, error.message);
|
|
result[key] = value; // Fallback to original
|
|
}
|
|
} else {
|
|
result[key] = value;
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Main execution
|
|
*/
|
|
async function main() {
|
|
console.log('═══════════════════════════════════════════════════════════');
|
|
console.log(' AGENT LIGHTNING PAGE TRANSLATION (DeepL API)');
|
|
console.log('═══════════════════════════════════════════════════════════\n');
|
|
|
|
// Create output directory
|
|
const outputDir = path.join(__dirname, '../public/locales');
|
|
|
|
// Save English version
|
|
const enPath = path.join(outputDir, 'en/agent-lightning-integration.json');
|
|
fs.writeFileSync(enPath, JSON.stringify(content, null, 2));
|
|
console.log(`✓ English saved: ${enPath}\n`);
|
|
|
|
// Translate to German
|
|
console.log('Translating to German (DE)...');
|
|
const deContent = await translateObject(content, 'DE');
|
|
const dePath = path.join(outputDir, 'de/agent-lightning-integration.json');
|
|
fs.writeFileSync(dePath, JSON.stringify(deContent, null, 2));
|
|
console.log(`✓ German saved: ${dePath}\n`);
|
|
|
|
// Translate to French
|
|
console.log('Translating to French (FR)...');
|
|
const frContent = await translateObject(content, 'FR');
|
|
const frPath = path.join(outputDir, 'fr/agent-lightning-integration.json');
|
|
fs.writeFileSync(frPath, JSON.stringify(frContent, null, 2));
|
|
console.log(`✓ French saved: ${frPath}\n`);
|
|
|
|
console.log('═══════════════════════════════════════════════════════════');
|
|
console.log(' TRANSLATION COMPLETE');
|
|
console.log('═══════════════════════════════════════════════════════════');
|
|
console.log('\nFiles created:');
|
|
console.log(` ${enPath}`);
|
|
console.log(` ${dePath}`);
|
|
console.log(` ${frPath}`);
|
|
}
|
|
|
|
main().catch(console.error);
|