# file

id: 7c64ae60-2991-4302-b3ae-e400b1d4b134
user_id: c49db2a8-83d7-4afc-bae1-ce9dcbce333f
filename: image.png
data: {}
path: /app/backend/data/uploads/7c64ae60-2991-4302-b3ae-e400b1d4b134_image.png
meta:
  {"name": "image.png", "content_type": "image/png", "size": 1674891, "file_hash": "7ee1d3f987114a24355b621cd721c873d3baaddea0ffb8193b4a1eb241be769b", "data": {}}


# tool

id: hermes-agent-bridge
user_id: c49db2a8-83d7-4afc-bae1-ce9dcbce333f
name: Hermes Agent Bridge
specs: []
content:
  """
  Hermes Agent Bridge — delegate complex tasks to Hermes Agent's full AI agent
  capabilities (terminal, web search, file ops, code execution, and more).

  Configure via Valves or env vars:
    - HERMES_API_KEY: required
    - HERMES_API_URL: default http://host.docker.internal:18789
  """

  import json
  import os
  import urllib.error
  import urllib.request
  from typing import Optional


  async def hermes_agent_task(
      task: str,
      model: Optional[str] = None,
      __user__: Optional[dict] = None,
  ) -> str:
      """
      Delegate a complex multi-step task to Hermes Agent.

      Hermes is an autonomous AI agent with access to: terminal/shell commands,
      web search, file reading/writing, code execution, web browsing, GitHub,
      and many more tools. Use this for tasks that require multiple steps,
      research, or tool usage beyond what the current model can do directly.

      Args:
          task: Full description of the task for Hermes Agent. Be specific about what you need.
          model: Model to use (default: gemma-12b). Options: gemma-12b, qwen36-35b-mtp, qwen35-9b-mtp, qwopus-9b, gemma-26b

      Returns:
          Hermes Agent's complete response
      """
      api_key = os.environ.get("HERMES_API_KEY", "")
      if not api_key:
          return (
              "Error: HERMES_API_KEY not set. "
              "Configure it in Admin Settings → Environment Variables or add"
              " HERMES_API_KEY to the docker-compose environment."
          )

      base_url = os.environ.get(
          "HERMES_API_URL", "http://host.docker.internal:18789"
      )
      url = f"{base_url}/v1/chat/completions"

      payload = json.dumps({
          "model": model or "gemma-12b",
          "messages": [{"role": "user", "content": task}],
          "max_tokens": 8192,
          "temperature": 0.2,
      }).encode("utf-8")

      req = urllib.request.Request(url, data=payload)
      req.add_header("Authorization", f"Bearer {api_key}")
      req.add_header("Content-Type", "application/json")

      try:
          resp = urllib.request.urlopen(req, timeout=300)
          result = json.loads(resp.read())
          content = result["choices"][0]["message"]["content"]
          model_used = result.get("model", model or "gemma-12b")
          usage = result.get("usage", {})
          tok_info = ""
          if usage:
              tok_info = (
                  f" (prompt={usage.get('prompt_tokens','?')}, "
                  f"completion={usage.get('completion_tokens','?')})"
              )
          return (
              f"Hermes Agent [{model_used}] response:{tok_info}\n\n{content}"
          )
      except urllib.error.HTTPError as e:
          body = e.read().decode()
          return f"HTTP {e.code} from Hermes API: {body}"
      except Exception as e:
          return f"Error calling Hermes Agent: {e}"

meta:
  {"description": "Delegate complex tasks to Hermes Agent (terminal, web search, file ops, code execution)", "manifest": {}}


id: terminal
user_id: c49db2a8-83d7-4afc-bae1-ce9dcbce333f
name: Terminal
specs: []
meta: {"description": "Execute shell commands on the server", "manifest": {}}
content:
  """
  Terminal — execute shell commands on the server.

  WARNING: This tool runs commands directly on the host. Only enable for trusted users.
  """

  import subprocess
  import shlex
  from typing import Optional


  async def run_command(
      command: str,
      timeout: Optional[int] = 30,
      workdir: Optional[str] = "/tmp",
  ) -> str:
      """
      Execute a shell command on the server and return its output.

      Use this for file operations, git commands, package management,
      system administration, running scripts, and any other shell tasks.

      Args:
          command: The shell command to execute
          timeout: Maximum execution time in seconds (default: 30, max: 120)
          workdir: Working directory (default: /tmp)

      Returns:
          Command output (stdout + stderr combined)
      """
      timeout = min(timeout or 30, 120)
      cwd = workdir or "/tmp"

      try:
          result = subprocess.run(
              command,
              shell=True,
              capture_output=True,
              text=True,
              timeout=timeout,
              cwd=cwd,
          )
          output = result.stdout
          if result.stderr:
              if output:
                  output += "\n"
              output += result.stderr
          if result.returncode != 0:
              output += f"\n--- exit code: {result.returncode} ---"
          return output.strip() or f"(empty — exit code {result.returncode})"

      except subprocess.TimeoutExpired:
          return f"Error: command timed out after {timeout}s"
      except FileNotFoundError:
          return f"Error: working directory not found: {cwd}"
      except PermissionError:
          return f"Error: permission denied in {cwd}"
      except Exception as e:
          return f"Error: {e}"


# config

key: openai.api_configs
value:
  {"0": {"name": "llama-swap", "model_ids": ["gemma-26b-200k", "ornith-35b-q6-mtp", "ornith-9b-mtp-q5", "qwen36-35b-mtp", "qwythos-9b-mtp-q6"], "api": "openai", "keys": []}}


key: terminal_server.connections
value:
  [{"id": "debian-terminal", "name": "Debian Terminal", "enabled": true, "url": "http://host.docker.internal:8000", "path": "/openapi.json", "key": "wuF7CugRfNJJOc1zG_-hWomh63wO29f4QdDnPZOagUw", "auth_type": "bearer", "config": null, "server_type": "terminal", "policy_id": null, "policy": null}]


key: rag.template
value:
  "### Task:\nRespond to the user query using the provided context, incorporating inline citations in the format [id] **only when the <source> tag includes an explicit id attribute** (e.g., <source id=\"1\">).\n\n### Guidelines:\n- If you don't know the answer, clearly state that.\n- If uncertain, ask the user for clarification.\n- Respond in the same language as the user's query.\n- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.\n- If the answer isn't present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.\n- **Only include inline citations using [id] (e.g., [1], [2]) when the <source> tag includes an id attribute.**\n- Do not cite if the <source> tag does not contain an id attribute.\n- Do not use XML tags in your response.\n- Ensure citations are concise and directly related to the information provided.\n\n### Example of Citation:\nIf the user asks about a specific topic and the information is found in a source with a provided id attribute, the response should include the citation like in the following example:\n* \"According to the study, the proposed method increases efficiency by 20% [1].\"\n\n### Output:\nProvide a clear and direct response to the user's query, including inline citations in the format [id] only when the <source> tag with id attribute is present in the context.\n\n<context>\n{{CONTEXT}}\n</context>\n"


key: image_generation.comfyui.workflow
value:
  "\n{\n  \"3\": {\n    \"inputs\": {\n      \"seed\": 0,\n      \"steps\": 20,\n      \"cfg\": 8,\n      \"sampler_name\": \"euler\",\n      \"scheduler\": \"normal\",\n      \"denoise\": 1,\n      \"model\": [\n        \"4\",\n        0\n      ],\n      \"positive\": [\n        \"6\",\n        0\n      ],\n      \"negative\": [\n        \"7\",\n        0\n      ],\n      \"latent_image\": [\n        \"5\",\n        0\n      ]\n    },\n    \"class_type\": \"KSampler\",\n    \"_meta\": {\n      \"title\": \"KSampler\"\n    }\n  },\n  \"4\": {\n    \"inputs\": {\n      \"ckpt_name\": \"model.safetensors\"\n    },\n    \"class_type\": \"CheckpointLoaderSimple\",\n    \"_meta\": {\n      \"title\": \"Load Checkpoint\"\n    }\n  },\n  \"5\": {\n    \"inputs\": {\n      \"width\": 512,\n      \"height\": 512,\n      \"batch_size\": 1\n    },\n    \"class_type\": \"EmptyLatentImage\",\n    \"_meta\": {\n      \"title\": \"Empty Latent Image\"\n    }\n  },\n  \"6\": {\n    \"inputs\": {\n      \"text\": \"Prompt\",\n      \"clip\": [\n        \"4\",\n        1\n      ]\n    },\n    \"class_type\": \"CLIPTextEncode\",\n    \"_meta\": {\n      \"title\": \"CLIP Text Encode (Prompt)\"\n    }\n  },\n  \"7\": {\n    \"inputs\": {\n      \"text\": \"\",\n      \"clip\": [\n        \"4\",\n        1\n      ]\n    },\n    \"class_type\": \"CLIPTextEncode\",\n    \"_meta\": {\n      \"title\": \"CLIP Text Encode (Prompt)\"\n    }\n  },\n  \"8\": {\n    \"inputs\": {\n      \"samples\": [\n        \"3\",\n        0\n      ],\n      \"vae\": [\n        \"4\",\n        2\n      ]\n    },\n    \"class_type\": \"VAEDecode\",\n    \"_meta\": {\n      \"title\": \"VAE Decode\"\n    }\n  },\n  \"9\": {\n    \"inputs\": {\n      \"filename_prefix\": \"ComfyUI\",\n      \"images\": [\n        \"8\",\n        0\n      ]\n    },\n    \"class_type\": \"SaveImage\",\n    \"_meta\": {\n      \"title\": \"Save Image\"\n    }\n  }\n}\n"


key: ui.prompt_suggestions
value:
  [{"title": ["Help me study", "vocabulary for a college entrance exam"], "content": "Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option."}, {"title": ["Give me ideas", "for what to do with my kids' art"], "content": "What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter."}, {"title": ["Tell me a fun fact", "about the Roman Empire"], "content": "Tell me a random fun fact about the Roman Empire"}, {"title": ["Show me a code snippet", "of a website's sticky header"], "content": "Show me a code snippet of a website's sticky header in CSS and JavaScript."}, {"title": ["Explain options trading", "if I'm familiar with buying and selling stocks"], "content": "Explain options trading in simple terms if I'm familiar with buying and selling stocks."}, {"title": ["Overcome procrastination", "give me tips"], "content": "Could you start by asking me about instances when I procrastinate the most and then give me some suggestions to overcome it?"}]


key: user.permissions
value:
  {"workspace": {"models": false, "knowledge": false, "prompts": false, "tools": false, "skills": false, "models_import": false, "models_export": false, "prompts_import": false, "prompts_export": false, "tools_import": false, "tools_export": false, "skills_import": false, "skills_export": false}, "sharing": {"models": false, "public_models": false, "knowledge": false, "public_knowledge": false, "prompts": false, "public_prompts": false, "tools": false, "public_tools": false, "skills": false, "public_skills": false, "notes": false, "public_notes": false, "folders": false, "public_chats": false, "public_calendars": false}, "access_grants": {"allow_users": true}, "chat": {"controls": true, "valves": true, "system_prompt": true, "params": true, "file_upload": true, "web_upload": true, "delete": true, "delete_message": true, "continue_response": true, "regenerate_response": true, "rate_response": true, "edit": true, "share": true, "export": true, "import": true, "stt": true, "tts": true, "call": true, "multiple_models": true, "temporary": true, "temporary_enforced": false}, "features": {"api_keys": false, "notes": true, "folders": true, "channels": true, "direct_tool_servers": false, "web_search": true, "image_generation": true, "code_interpreter": true, "memories": true, "automations": false, "calendar": true, "webhooks": false}, "settings": {"interface": true}}


