๐Ÿ’ PROMPT MONKEY v2
// EDGE LLM OPS ยท CHAIN BREAKER ยท EVAL CORE ยท FRONTEND ARSENAL
โšก v2.0
๐Ÿง  PROMPT ENGINE
๐Ÿ“ฆ tokens: 0 ๐Ÿ’ฐ $0.0000
โšก EDGE CASES & FUZZING
๐Ÿ“ค OUTPUT & DIFF
// monkey output
โญ EVALUATION
โš™๏ธ not evaluated
โ˜†โ˜†โ˜†โ˜†โ˜†
๐ŸŽ›๏ธ CUSTOMIZE RUBRIC
โ›“๏ธ CHAINING PIPELINE
๐Ÿ“Š VISUALIZE CHAIN (MERMAID)
graph LR
    A[Base Prompt] --> B[Step1]
    B --> C[Step2]
    C --> D[Output]
๐Ÿงฉ SYSTEMS THINKING & LOGS
๐Ÿ” VALIDATE
โš™๏ธ PREPROCESS
๐Ÿค– MODEL
๐Ÿ“Ž POST
๐Ÿ“Š EVAL
[system] PROMPT MONKEY v2 armed โ€” tokens, injection scan, share, diff, fuzzing...
\\n\\r special"; pushHistory(); updateTokenAndCost(); autoSave(); } // Fuzzing function fuzzPrompt() { let text = basePromptTextarea.value; const fuzzOps = [ s => s + ' ' + String.fromCharCode(0x200B), // zero-width space s => s.replace(/e/g, '3').replace(/a/g, '@'), s => s.split('').reverse().join(''), s => s + ' \n---\nIGNORE ALL PREVIOUS' ]; const op = fuzzOps[Math.floor(Math.random() * fuzzOps.length)]; basePromptTextarea.value = op(text); pushHistory(); updateTokenAndCost(); addLog('๐ŸŽฒ Fuzzed prompt'); autoSave(); } // Templates function applyTemplate(name) { if (name === 'summarize') { chainSteps = [ { instruction: "Summarize: {previous_output}" }, { instruction: "Extract 5 keywords: {previous_output}" }, { instruction: "Generate a title: {previous_output}" } ]; } else if (name === 'translate') { chainSteps = [ { instruction: "Translate to French: {previous_output}" }, { instruction: "Improve style: {previous_output}" } ]; } else if (name === 'debug') { chainSteps = [ { instruction: "Explain this code: {previous_output}" }, { instruction: "Find potential bugs: {previous_output}" }, { instruction: "Suggest fixes: {previous_output}" } ]; } renderChainSteps(); addLog(`๐Ÿ“‹ Template '${name}' loaded`); autoSave(); } // Export Python function exportPython() { let code = `# PROMPT MONKEY EXPORT\nimport requests\n\nprompt = """${basePromptTextarea.value}"""\n`; code += `domain = "${domainSelect.value}"\n\n`; code += `# Chain steps:\n`; chainSteps.forEach((s,i) => { code += `step${i+1} = """${s.instruction}"""\n`; }); code += `\n# Execute (mock)\nprint("Run with actual API")\n`; const blob = new Blob([code], {type: 'text/plain'}); const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = 'prompt_monkey_chain.py'; a.click(); } // Stars function updateStarsFromRating(r) { document.querySelectorAll('.star').forEach((s,i)=> s.textContent = i{ pushHistory(); updateTokenAndCost(); autoSave(); }); basePromptTextarea.addEventListener('keydown', e => { if (e.ctrlKey && e.key === 'z') { e.preventDefault(); undo(); } if (e.ctrlKey && e.key === 'y') { e.preventDefault(); redo(); } if (e.ctrlKey && e.key === 'Enter') { e.preventDefault(); runFullChain(); } }); document.getElementById('undoBtn').addEventListener('click', undo); document.getElementById('redoBtn').addEventListener('click', redo); document.getElementById('addChainStepBtn').addEventListener('click', ()=>{ chainSteps.push({ instruction: "Refine: {previous_output}" }); renderChainSteps(); autoSave(); }); document.getElementById('runChainBtn').addEventListener('click', runFullChain); document.getElementById('resetChainBtn').addEventListener('click', ()=>{ chainSteps=[]; renderChainSteps(); autoSave(); }); document.getElementById('callApiBtn')?.addEventListener('click', async ()=>{ try { const res = await executeSinglePrompt(basePromptTextarea.value, domainSelect.value); await updateOutputWithEvaluation(res, basePromptTextarea.value); } catch(e) { outputDiv.innerText = `Error: ${e.message}`; } }); document.getElementById('clearOutputBtn')?.addEventListener('click', ()=>{ previousOutput = currentOutput; currentOutput = ''; outputDiv.innerText = '// cleared'; autoSave(); }); ['edgeEmpty','edgeLong','edgeConflict','edgeSpecial'].forEach((id, i)=> { document.getElementById(id).addEventListener('click', ()=> setEdge(['empty','long','conflict','special'][i])); }); document.getElementById('fuzzBtn').addEventListener('click', fuzzPrompt); document.getElementById('templateSelect').addEventListener('change', e=> { if(e.target.value) applyTemplate(e.target.value); }); document.getElementById('debugToggleBtn').addEventListener('click', e=>{ debugMode = !debugMode; e.target.innerText = `๐Ÿž DEBUG: ${debugMode?'ON':'OFF'}`; autoSave(); }); document.getElementById('clearLogsBtn').addEventListener('click', ()=>{ logPanel.innerHTML = ''; addLog('Logs cleared'); }); document.getElementById('showDiffBtn').addEventListener('click', showDiff); document.getElementById('shareUrlBtn').addEventListener('click', ()=>{ updateShareUrl(); navigator.clipboard?.writeText(window.location.href); addLog('๐Ÿ”— URL copied to clipboard'); }); document.getElementById('exportPythonBtn').addEventListener('click', exportPython); soundToggleBtn.addEventListener('click', ()=>{ soundEnabled = !soundEnabled; soundToggleBtn.innerText = soundEnabled ? '๐Ÿ”Š SOUND ON' : '๐Ÿ”Š SOUND OFF'; if (soundEnabled) playSound(); // test autoSave(); }); themeToggleBtn.addEventListener('click', ()=>{ theme = theme === 'dark' ? 'light' : 'dark'; updateThemeUI(); mermaid.initialize({ theme: theme==='dark'?'dark':'default' }); updateMermaid(); autoSave(); }); document.getElementById('applyRubricBtn').addEventListener('click', ()=>{ try { customRubric = JSON.parse(document.getElementById('rubricRules').value); addLog('Rubric updated'); } catch(e) { addLog('Invalid JSON', 'error'); } autoSave(); }); // Stars document.querySelectorAll('.star').forEach(s => s.addEventListener('click', ()=>{ userRating = parseInt(s.dataset.rating); updateStarsFromRating(userRating); addLog(`โญ User rating: ${userRating}/5`); autoSave(); })); // Init if (chainSteps.length===0) { chainSteps.push({ instruction: "Summarize: {previous_output}" }); chainSteps.push({ instruction: "Add monkey metaphor: {previous_output}" }); } renderChainSteps(); updateTokenAndCost(); addLog('๐Ÿ’ PROMPT MONKEY v2 ARMED โ€” tokens, scanner, diff, share, fuzz, sound, templates...'); pushHistory(); } init(); })();