mirror of
https://github.com/sune-org/store.git
synced 2026-01-13 16:17:58 +00:00
1 line
5.7 KiB
JSON
1 line
5.7 KiB
JSON
[{"id":"cjnh9pp","name":"Agent Control Panel","pinned":false,"avatar":"","url":"gh://sune-org/store/agent.sune","updatedAt":1757424165837,"settings":{"model":"openai/gpt-5-chat","temperature":"","top_p":"","top_k":"","frequency_penalty":"","repetition_penalty":"","min_p":"","top_a":"","verbosity":"","reasoning_effort":"default","system_prompt":"","html":"<div class=\"p-3 sm:p-4\">\n <div\n x-data=\"{\n isActive: false,\n isConsoleOpen: false,\n logs: [],\n storageKey: `sune_agent_panel_active_${window.SUNE.id}`,\n logStorageKey: `sune_agent_panel_logs_${window.SUNE.id}`,\n \n init() {\n this.isActive = localStorage.getItem(this.storageKey) === 'true';\n this.logs = JSON.parse(localStorage.getItem(this.logStorageKey) || '[]');\n\n $watch('isActive', val => localStorage.setItem(this.storageKey, val));\n $watch('logs', val => localStorage.setItem(this.logStorageKey, JSON.stringify(val)));\n \n this.$nextTick(() => this.scrollConsole());\n },\n \n log(type, message) {\n const ts = new Date().toLocaleTimeString();\n this.logs.push(`[${ts} ${type}] ${message}`);\n if (this.logs.length > 50) this.logs.shift();\n this.$nextTick(() => this.scrollConsole());\n },\n\n scrollConsole() {\n const consoleEl = this.$refs.console;\n if (consoleEl) consoleEl.scrollTop = consoleEl.scrollHeight;\n },\n\n handleResponse(event) {\n if (!this.isActive) return;\n const msg = event.detail.message;\n if (!msg || msg.role !== 'assistant' || !Array.isArray(msg.content)) return;\n const txt = msg.content.map(p => p.type === 'text' ? p.text : '').join('\\n');\n const regex = /```(?:javascript|js)\\n([\\s\\S]*?)\\n```/gi;\n let match, executed = false;\n while ((match = regex.exec(txt)) !== null) {\n const code = match[1].trim();\n if (!code) continue;\n this.log('EXEC', 'Executing code block...');\n try {\n (new Function(code)).call(window);\n executed = true;\n } catch (e) {\n console.error('[Sune Agent] Execution Error:', e);\n this.log('ERROR', e.message);\n window.SUNE.log(`Agent Error: ${e.message}`);\n }\n }\n if (executed) this.log('DONE', 'Finished script execution.');\n },\n\n injectContext(event) {\n // Ensure the event is from our specific form before proceeding\n if (event.target.id !== 'composer' || !this.isActive || this.logs.length === 0) return;\n \n const input = document.getElementById('input');\n const currentInput = input.value;\n if (!currentInput.trim()) return;\n \n const logContent = this.logs.join('\\n');\n const context = `[AGENT LOGS]\\n${logContent}\\n[/AGENT LOGS]\\n\\n`;\n \n input.value = context + currentInput;\n this.log('INFO', 'Injected logs into context for next message.');\n },\n\n clearLogs() {\n this.logs = [];\n this.log('INFO', 'Console cleared.');\n }\n }\"\n x-init=\"init()\"\n @sune:newsuneresponse.window=\"handleResponse($event)\"\n @submit.window=\"injectContext($event)\"\n class=\"mx-auto w-full max-w-3xl rounded-xl border border-gray-200 bg-white p-3 shadow-sm\"\n >\n <div class=\"flex items-center justify-between gap-3\">\n <div class=\"flex items-center gap-2\">\n <i data-lucide=\"brain-circuit\" class=\"h-5 w-5 text-gray-600\"></i>\n <span class=\"text-sm font-medium text-gray-800\">Agent Control</span>\n </div>\n <span class=\"text-xs text-gray-400\">v0.4</span>\n </div>\n\n <div class=\"mt-3 flex items-center justify-between rounded-lg bg-gray-100 p-2\">\n <label class=\"cursor-pointer text-sm text-gray-700\" x-text=\"isActive ? 'Status: Active' : 'Status: Inactive'\"></label>\n <button\n type=\"button\"\n role=\"switch\"\n :aria-checked=\"isActive\"\n @click=\"isActive = !isActive; log('SYS', isActive ? 'Agent Activated' : 'Agent Deactivated')\"\n :class=\"isActive ? 'bg-black' : 'bg-gray-300'\"\n class=\"relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none\"\n >\n <span :class=\"isActive ? 'translate-x-5' : 'translate-x-0'\" class=\"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out\"></span>\n </button>\n </div>\n\n <div class=\"mt-2 border-t border-gray-200 pt-2\">\n <button @click=\"isConsoleOpen = !isConsoleOpen\" class=\"flex w-full items-center justify-between text-left text-sm font-medium text-gray-600 hover:text-black\">\n <span>Console</span>\n <i data-lucide=\"chevron-down\" class=\"h-4 w-4 transition-transform\" :class=\"isConsoleOpen && 'rotate-180'\"></i>\n </button>\n <div x-show=\"isConsoleOpen\" x-collapse.duration.200ms class=\"mt-2\">\n <pre x-ref=\"console\" class=\"max-h-48 overflow-y-auto rounded-md bg-gray-900 p-2 text-xs font-mono leading-relaxed text-white\" x-text=\"logs.join('\\n') || 'Console is empty.'\"></pre>\n <button @click=\"clearLogs()\" class=\"mt-2 flex w-full items-center justify-center gap-2 rounded-md bg-gray-100 px-3 py-1.5 text-xs text-gray-600 hover:bg-gray-200\">\n <i data-lucide=\"trash-2\" class=\"h-3 w-3\"></i> Clear Logs\n </button>\n </div>\n </div>\n </div>\n</div>\n","extension_html":"<sune src='https://raw.githubusercontent.com/sune-org/store/refs/heads/main/sync.sune' private />","hide_composer":false},"storage":{}}] |