tinyclaw icon indicating copy to clipboard operation
tinyclaw copied to clipboard

Plugin system bug

Open tscott6767 opened this issue 9 months ago • 8 comments

Plugin sysetem seems buggy, TinyClaw can't seem to access it properly to install them.

tscott6767 avatar Feb 24 '26 01:02 tscott6767

Hey @tscott6767 it is indeed buggy at the moment as mentioned here: https://github.com/warengonzaga/tinyclaw/issues/13#issuecomment-3943855647

Right now, when you enable it conversationally, it will not work as expected. We need to fix that. cc: @youhanasheriff

warengonzaga avatar Feb 24 '26 02:02 warengonzaga

Waren, does this help? ```# TinyClaw v2.1.0 — Local llama.cpp Setup Guide

Overview

This documents the full process of setting up TinyClaw v2.1.0 on a fresh Proxmox LXC container (Debian Trixie), connecting it to a local llama.cpp instance instead of the default Ollama Cloud provider.


Environment

  • TinyClaw host: Proxmox LXC, Debian Trixie, IP 192.xxxxxxx
  • LLM backend: llama.cpp running on a separate VM at 192.xxxxxxxxx/v1
  • Model: Qwen3.5-35B-A3B-MXFP4_MOE.gguf
  • Runtime: Bun v1.3.10

Installation Steps

1. Network & DNS

Fresh LXC containers have no IP by default. Fix in Proxmox web UI:

  • Set static IP or enable DHCP on the network interface
  • Add DNS manually if needed:
echo "nameserver 8.8.8.8" > /etc/resolv.conf

2. Install Dependencies & Clone Repo

apt install -y git curl
git clone https://github.com/warengonzaga/tinyclaw.git
cd tinyclaw
git checkout $(git describe --tags --abbrev=0)

3. Install Bun & Add to PATH

curl -fsSL https://bun.sh/install | bash
export PATH="$HOME/.bun/bin:$PATH"
echo 'export PATH="$HOME/.bun/bin:$PATH"' >> ~/.bashrc

4. Install Dependencies & Build

bun install
bun run build

5. Create Global tinyclaw Command

mkdir -p ~/.bun/bin
tee ~/.bun/bin/tinyclaw << 'EOF'
#!/usr/bin/env bun
import "/root/tinyclaw/src/cli/dist/index.js"
EOF
chmod +x ~/.bun/bin/tinyclaw

Bugs Encountered & Fixes

Bug 1: Pre-flight check kills startup when no cloud API key

Problem: TinyClaw always checks the starterBrain (Ollama Cloud) provider on boot, even if a primary local provider is configured. This causes an immediate exit with a 401 error.

Fix: Patch src/cli/src/commands/start.ts to skip the pre-flight check when a primary provider is configured:

const _allProviders = configManager.get<any>('providers');
const _primaryConfig = _allProviders?.primary;
const hasPrimaryProvider = !!(_primaryConfig?.model);
if (!hasPrimaryProvider) {
  try {
    // existing pre-flight check...
  } catch (err) {
    // existing catch...
  }
}

Bug 2: OpenAI plugin doesn't receive baseUrl or model from config

Problem: createProvider() in plugin-provider-openai/src/index.ts only passes secrets — ignoring the configured baseUrl and model.

Fix: Pass configManager and read primary provider config:

async createProvider(secrets: SecretsManagerInterface, configManager?: ConfigManagerInterface) {
  const providers = configManager?.get<{primary?: {baseUrl?: string; model?: string}}>('providers');
  const baseUrl = providers?.primary?.baseUrl;
  const model = providers?.primary?.model;
  return createOpenAIProvider({ secrets, baseUrl, model });
}

Also fix start.ts line 300 to pass configManager:

const provider = await pp.createProvider(secretsManager, configManager);

Bug 3: Secrets engine rejects plain SQLite inserts

Problem: @wgtechlabs/secrets-engine uses AES-256-GCM encryption — you can't insert keys directly via SQLite.

Fix: Make the plugin fall back to 'dummy' when no API key is stored (llama.cpp doesn't require authentication):

// In provider.ts isAvailable():
const apiKey = (await config.secrets.resolveProviderKey('openai')) ?? 'dummy';

// In provider.ts chat():
const apiKey = (await config.secrets.resolveProviderKey('openai')) ?? 'dummy';

Bug 4: Config engine uses nested JSON, not flat dot-notation keys

Problem: Storing providers.primary as a separate SQLite row doesn't work — the config engine reads providers as one JSON blob.

Fix: Embed primary inside the providers JSON object directly:

sqlite3 /root/.tinyclaw/data/config.db "UPDATE config SET value = '{
  \"starterBrain\":{...},
  \"localLlama\":{...},
  \"primary\":{
    \"model\":\"Qwen3.5-35B-A3B-MXFP4_MOE.gguf\",
    \"baseUrl\":\"http://192.xxxxxx\"
  }
}' WHERE key = 'providers';"

Final Working Configuration

Database (/root/.tinyclaw/data/config.db)

{
  "starterBrain": {
    "model": "kimi-k2.5:cloud",
    "baseUrl": "https://ollama.com",
    "apiKeyRef": "provider.ollama.apiKey"
  },
  "localLlama": {
    "type": "openai",
    "baseUrl": "http://192.xxxxxxxx/v1",
    "model": "Qwen3.5-35B-A3B-MXFP4_MOE.gguf"
  },
  "primary": {
    "model": "Qwen3.5-35B-A3B-MXFP4_MOE.gguf",
    "baseUrl": "http://192xxxxxxx"
  }
}

Smart Routing Result

Tier Provider Model
Primary (all tiers) Local llama.cpp Qwen3.5-35B-A3B-MXFP4_MOE.gguf
Fallback Ollama Cloud kimi-k2.5:cloud

Running in Background

screen -S tinyclaw
tinyclaw start
# Detach: Ctrl+A, D
# Reattach: screen -r tinyclaw

Web UI

Access at: http://192.xxxxxx:3000


Notes for the Developer

  1. The pre-flight provider check exits before primary provider logic runs — if no Ollama Cloud key exists, the app is unusable even with a valid local provider configured.
  2. createProvider() needs to accept and use configManager to support custom baseUrl/model for OpenAI-compatible endpoints.
  3. The setup wizard is locked to Ollama Cloud only with no option for custom providers — a local/custom provider option in the wizard would help significantly.
  4. The config engine's dot-notation (providers.primary.model) doesn't map to flat SQLite rows — this is confusing and undocumented.
  5. The secrets engine correctly rejects plain inserts, but there's no CLI tool to manually store a key outside of the agent chat interface.

tscott6767 avatar Feb 27 '26 01:02 tscott6767

@tscott6767 this is not possible setup, the local LLM setup is not yet available with the project it should be come as a plugin and not a replacement to built-in LLM.

warengonzaga avatar Mar 04 '26 12:03 warengonzaga

I'll create a separate issue to add local ollama plugin.

warengonzaga avatar Mar 04 '26 12:03 warengonzaga

Great. Lamma.CPP on remote URL and xAI api too please. I've tried to get both working for days ,multiple ways..no success.

tscott6767 avatar Mar 04 '26 14:03 tscott6767

I added a fix to dev branch with additional enhancements. Please wait for the next release.

warengonzaga avatar Mar 05 '26 16:03 warengonzaga

Hey @tscott6767, I added the issues here: #46 and #45. I chose Ollama over the generic lamma.cpp you mentioned. The goal is to use local models with Tiny Claw. It's Tiny Claw, not TinyClaw.

warengonzaga avatar Mar 06 '26 10:03 warengonzaga

Going to close this now since this is already in the dev branch.

warengonzaga avatar Mar 06 '26 10:03 warengonzaga