Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Dependencies
node_modules/
package-lock.json

# Build output (rebuilt in Docker)
dist/
build/
*.tsbuildinfo

# Environment files (mounted at runtime)
.env
.env.local
.env.*.local

# Logs and runtime data
logs/
*.log
npm-debug.log*

# IDE and editors
.idea/
.vscode/
.github/
.codacy/
*.swp
*.swo
*~

# OS files
.DS_Store
Thumbs.db

# Testing (not needed in production)
tests/
coverage/
.nyc_output/
jest.config.js

# Temporary files
tmp/
temp/
*.tmp
*.temp

# Git
.git/
.gitignore

# Python virtual env
.venv/
__pycache__/

# Project output (mounted as volume)
projects/
reports/

# Documentation (not needed in image)
*.md
!README.md
LICENSE
CONTRIBUTING.md
DOCUMENTATION.md
IMPLEMENTATION_COMPLETE.md
SECURITY.md
progress.md

# Browser data
.chrome-user-data/

# Misc
*.bak
*.backup
Dockerfile
docker-compose.yml
.dockerignore
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,14 @@ TERMINAL_SPINNER=true
DEFAULT_PACKAGE_MANAGER=npm
DEFAULT_LANGUAGE=typescript
PROJECTS_DIR=./projects

# ============================================
# AirLLM Configuration (Optional β€” 70B on 4GB RAM)
# Citation: Li, G. (2023). AirLLM. https://github.com/lyogavin/airllm/
# ============================================
AIRLLM_ENABLED=false
AIRLLM_MODEL=garage-bAInd/Platypus2-70B-instruct
AIRLLM_PORT=8899
AIRLLM_MAX_LENGTH=512
AIRLLM_COMPRESSION=none
AIRLLM_PYTHON_PATH=python
20 changes: 20 additions & 0 deletions .joker_memory/long_term.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"successfulPatterns": [],
"failedPatterns": [
{
"id": "pattern_1771345624491_8t10ns",
"query": "airllm",
"intent": "unknown",
"success": false,
"steps": [
"web_search",
"extract_links",
"scrape_page",
"summarize"
],
"timestamp": "2026-02-17T16:27:04.491Z"
}
],
"siteKnowledge": [],
"preferences": {}
}
68 changes: 68 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# ============================================
# The Joker - Agentic Terminal
# Multi-stage Dockerfile
# ============================================

# ── Stage 1: Build ────────────────────────────
FROM node:20-slim AS builder

WORKDIR /app

# Copy package files and install dependencies
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts

# Copy source and build
COPY tsconfig.json ./
COPY src/ ./src/
RUN npm run build

# ── Stage 2: Production ──────────────────────
FROM node:20-slim AS production

# Install Chromium dependencies for Puppeteer + Python for AirLLM
RUN apt-get update && apt-get install -y --no-install-recommends \
chromium \
fonts-liberation \
libatk-bridge2.0-0 \
libatk1.0-0 \
libcups2 \
libdrm2 \
libgbm1 \
libnss3 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
python3 \
python3-pip \
python3-venv \
&& rm -rf /var/lib/apt/lists/*

# Tell Puppeteer to use the system Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium \
NODE_ENV=production

WORKDIR /app

# Install production Node dependencies
COPY package.json package-lock.json ./
RUN npm ci --omit=dev --ignore-scripts

# Install Python dependencies for AirLLM (optional)
COPY requirements-airllm.txt ./
RUN python3 -m pip install --break-system-packages --no-cache-dir -r requirements-airllm.txt || true

# Copy built output and supporting files
COPY --from=builder /app/dist ./dist
COPY airllm_server.py ./
COPY .env.example ./.env.example

# Create necessary directories
RUN mkdir -p logs projects reports .joker_memory

# Expose ports: AirLLM sidecar
EXPOSE 8899

# The terminal is interactive β€” requires -it flags
CMD ["node", "dist/index.js"]
205 changes: 205 additions & 0 deletions IMPLEMENTATION_COMPLETE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# The Joker - Complete Implementation Summary

## Overview
Successfully implemented all missing features to make The Joker terminal fully capable of agentic task execution with your LM Studio instance.

## Configuration Changes

### 1. LM Studio Connection (`.env`)
- **Changed:** `LM_STUDIO_BASE_URL` from `http://localhost:1234` to `http://192.168.56.1:1234`
- **Model:** `qwen2.5-coder-14b-instruct-uncensored`
- **Status:** βœ… Connected to your LM Studio instance

## Tool Registration Fixes (`src/agents/executor.ts`)

### Problem Identified
The executor was only registering **13 tools** (3 Search + 5 Scrape + 5 broken Process tools) out of **29 available tools**. The key issues were:
1. **File tools** (9 tools) - Not registered at all
2. **Code tools** (4 tools) - Only 1 manually implemented, duplicating functionality
3. **Process tools** (5 tools) - Broken registration using global registry instead of local registry
4. **Project tool** (1 tool) - Already existed but not optimized

### Solution Implemented
Completely rewired the tool registration system in `createDefaultRegistry()`:

#### Added Imports
```typescript
// File Tools (9)
import { readFileToolDef, writeFileToolDef, appendFileToolDef, deleteFileToolDef,
listDirToolDef, copyFileToolDef, moveFileToolDef, fileExistsToolDef,
createDirToolDef } from '../tools/file';

// Code Tools (4)
import { generateCodeTool, modifyCodeTool, scaffoldProjectTool,
analyzeCodeTool } from '../tools/code';

// Process Tools (5)
import { transformDataTool, cleanTextTool, extractPatternsTool,
convertFormatTool, summarizeDataTool } from '../tools/process';
```

#### Registered All Tools
Now properly registering **29 tools** across 6 categories:

**Search Tools (3):**
- `web_search` - Web search with Google/Bing
- `quick_search` - Fast web search
- `image_search` - Image search

**Scrape Tools (5):**
- `scrape_page` - Scrape web pages
- `extract_content` - Extract specific content
- `screenshot` - Take page screenshots
- `extract_table` - Extract table data
- `parse_html` - Parse HTML structures

**Process Tools (5):**
- `transform_data` - Transform data with operations
- `clean_text` - Clean and normalize text
- `extract_patterns` - Extract patterns from text
- `convert_format` - Convert between formats
- `summarize_data` - Summarize data

**File Tools (9):**
- `read_file` - Read file contents
- `write_file` - Write to files
- `append_file` - Append to files
- `delete_file` - Delete files
- `list_dir` - List directory contents
- `copy_file` - Copy files
- `move_file` - Move/rename files
- `file_exists` - Check file existence
- `create_dir` - Create directories

**Code Tools (4):**
- `generate_code` - Generate React/Next.js code (components, hooks, pages, APIs, contexts, services, utilities)
- `modify_code` - Modify existing code
- `scaffold_project` - Scaffold code structures
- `analyze_code` - Analyze code quality

**Project & Utility Tools (3):**
- `create_project` - Create complete React/Next.js projects with ProjectScaffolder
- `show_help` - Display help information
- `summarize` - Summarize content with LLM

### Removed
- Broken `registerProcessTools()` call that used wrong registry
- Duplicate manual `generate_code` tool implementation (110+ lines)

## Build Status
βœ… **TypeScript compilation successful** - No errors
```
> [email protected] build
> tsc
```

## Capabilities Now Available

### 1. Complete File System Operations
Your terminal can now read, write, copy, move, delete files and manage directories - essential for file-based agentic tasks.

### 2. Advanced Code Generation
With all 4 code tools registered:
- Generate React components, hooks, pages, API routes, contexts, services, utilities
- Modify existing code intelligently
- Scaffold entire code structures
- Analyze code quality and suggest improvements

### 3. Full Project Scaffolding
The `create_project` tool uses the sophisticated `ProjectScaffolder` class to create complete React/Next.js/Vue projects with:
- Proper directory structure
- package.json with dependencies
- TypeScript/JavaScript configuration
- Styling setup (Tailwind CSS/SCSS/CSS)
- Next.js support with App Router
- Custom features based on requirements

### 4. Data Processing Pipeline
5 process tools for transforming, cleaning, extracting patterns, converting formats, and summarizing data.

### 5. Web Intelligence
8 tools for searching the web and scraping content with various extraction methods.

## Architecture Improvements

### Before
```
Executor β†’ createDefaultRegistry() β†’ 13 tools
β”œβ”€ Search: 3 βœ…
β”œβ”€ Scrape: 5 βœ…
β”œβ”€ Process: 5 ❌ (broken)
β”œβ”€ File: 0 ❌ (missing)
β”œβ”€ Code: 1 ⚠️ (duplicate)
└─ Project: 1 βœ…
```

### After
```
Executor β†’ createDefaultRegistry() β†’ 29 tools
β”œβ”€ Search: 3 βœ…
β”œβ”€ Scrape: 5 βœ…
β”œβ”€ Process: 5 βœ… (fixed)
β”œβ”€ File: 9 βœ… (added)
β”œβ”€ Code: 4 βœ… (complete)
└─ Project/Utility: 3 βœ…
```

## Testing & Next Steps

### Ready to Test
The terminal is now fully equipped for agentic tasks. You can test it with commands like:

1. **File Operations:**
- "Read the package.json file"
- "Create a new directory called 'output'"
- "Copy all .ts files to a backup folder"

2. **Code Generation:**
- "Create a React component for a user profile card"
- "Generate a custom hook for authentication"
- "Create an API route for user data"

3. **Project Creation:**
- "Create a new Next.js project for a blog"
- "Build a React app with TypeScript and Tailwind"

4. **Web Tasks:**
- "Search for TypeScript best practices"
- "Scrape the documentation from example.com"

5. **Data Processing:**
- "Clean this text data and extract email addresses"
- "Transform this JSON to CSV format"

### How to Run
```bash
npm start
# or
node dist/index.js
```

## Summary of Changes

**Files Modified:**
1. `.env` - Updated LM Studio URL
2. `src/agents/executor.ts` - Complete tool registration overhaul

**Lines Changed:**
- Added: ~30 lines of imports and tool registrations
- Removed: ~110 lines of duplicate code
- Net: Cleaner, more maintainable codebase

**Tools Added:** 18 new tools (9 File + 4 Code proper + 5 Process fixed)

**Build Status:** βœ… Clean compilation, no errors

## What This Means
Your Joker terminal can now:
- βœ… Execute file operations autonomously
- βœ… Generate and modify code intelligently
- βœ… Create complete projects from descriptions
- βœ… Process and transform data
- βœ… Search the web and scrape content
- βœ… Connect to your LM Studio instance at 192.168.56.1:1234

The implementation is **complete** and ready for agentic task execution! πŸƒ
Loading