Compare commits

..
Author SHA1 Message Date
Luciano Castillo c84182b2e4 feat(ActionGraph): implement async layout calculation for large graphs
- Enhanced the ActionGraph component to support asynchronous layout calculations for large graphs, improving UI responsiveness during layout updates.
- Introduced a loading overlay to indicate layout processing and initial hydration states, providing better user feedback.
- Added a new `isHydrating` prop to manage loading states effectively when fetching graph data.
2026-01-30 16:40:41 -05:00
Luciano Castillo 80ddf4d821 style(ActionGraph): enhance follow mode button appearance
- Updated the styling of the follow mode button in the ActionGraphInner component to include a backdrop blur effect, improving visual feedback for users when the mode is active.
2026-01-30 11:53:56 -05:00
Luciano Castillo 5af254087c feat(graph-layout): implement caching for spawn Y positions to prevent jitter
- Introduced a caching mechanism for spawn Y positions of child sessions to maintain stability during parent action accumulation.
- Updated the layoutGraph function to utilize cached values, reducing recalculation and improving layout consistency.
- Added cleanup logic to remove entries from the cache for sessions that no longer exist, ensuring efficient memory usage.
2026-01-30 11:46:42 -05:00
Luciano Castillo f9dbd9b0bf feat(monitor): implement follow mode in ActionGraph for new nodes
- Added a follow mode feature that automatically pans the viewport to new nodes in the ActionGraph.
- Introduced a button to toggle follow mode, enhancing user experience by allowing users to track new nodes easily.
- Updated the ActionGraphInner component to manage viewport changes and node tracking effectively.
2026-01-30 10:46:07 -05:00
50 changed files with 475 additions and 9120 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24
node-version: 22
cache: npm
- name: Install dependencies
@@ -33,7 +33,7 @@ jobs:
- name: Create build artifact
run: |
tar -czvf crabwalk-${{ github.ref_name }}.tar.gz .output bin package.json
tar -czvf crabwalk-${{ github.ref_name }}.tar.gz dist
- name: Upload build to release
uses: softprops/action-gh-release@v1
-3
View File
@@ -37,6 +37,3 @@ documents/*
# Persistence data
data/
# coding agent plans
plans/
+3 -3
View File
@@ -36,15 +36,15 @@ Full-stack React app using TanStack Start (file-based routing, SSR).
**TanStack DB pattern:** Create collections, use `useLiveQuery()` for reactive reads, `createTransaction()` for writes.
## OpenClaw (Clawdbot) Monitor
## Moltbot (Clawdbot) Monitor
Real-time agent activity monitor at `/monitor`.
**Key paths:**
- `src/integrations/openclaw/` - gateway client, protocol types, parser, collections
- `src/integrations/clawdbot/` - gateway client, protocol types, parser, collections
- `src/components/monitor/` - ReactFlow graph, session list, custom nodes
- `src/routes/monitor/index.tsx` - main monitor page
**Data flow:** openclaw gateway (ws://127.0.0.1:18789) -> TanStack Start server (WS client) -> tRPC -> browser (TanStack DB collections -> ReactFlow)
**Data flow:** clawdbot gateway (ws://127.0.0.1:18789) -> TanStack Start server (WS client) -> tRPC -> browser (TanStack DB collections -> ReactFlow)
**Config:** Set `CLAWDBOT_API_TOKEN` env var for gateway auth.
-4
View File
@@ -13,10 +13,6 @@ WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000
ENV HOST=0.0.0.0
ENV HOME=/root
# Create workspace directory for volume mounting
RUN mkdir -p /root/.openclaw/workspace
COPY --from=builder /app/.output ./.output
+17 -99
View File
@@ -1,6 +1,6 @@
# 🦀 Crabwalk
Real-time companion monitor for [OpenClaw (Clawdbot)](https://github.com/openclaw/openclaw) agents by [@luccasveg](https://x.com/luccasveg).
Real-time companion monitor for [Moltbot (Clawdbot)](https://github.com/moltbot/moltbot) agents by [@luccasveg](https://x.com/luccasveg).
Watch your AI agents work across WhatsApp, Telegram, Discord, and Slack in a live node graph. See thinking states, tool calls, and response chains as they happen.
@@ -12,70 +12,12 @@ Watch your AI agents work across WhatsApp, Telegram, Discord, and Slack in a liv
- **Live activity graph** - ReactFlow visualization of agent sessions and action chains
- **Multi-platform** - Monitor agents across all messaging platforms simultaneously
- **Real-time streaming** - WebSocket connection to openclaw gateway
- **Real-time streaming** - WebSocket connection to clawdbot gateway
- **Action tracing** - Expand nodes to inspect tool args and payloads
- **Session filtering** - Filter by platform, search by recipient
## Installation
### Via OpenClaw Agent
Paste this link to your OpenClaw agent and ask it to install/update Crabwalk:
```
https://raw.githubusercontent.com/luccast/crabwalk/master/public/skill.md
```
### CLI Install
```bash
VERSION=$(curl -s https://api.github.com/repos/luccast/crabwalk/releases/latest | grep '"tag_name"' | cut -d'"' -f4)
mkdir -p ~/.crabwalk ~/.local/bin
curl -sL "https://github.com/luccast/crabwalk/releases/download/${VERSION}/crabwalk-${VERSION}.tar.gz" | tar -xz -C ~/.crabwalk
cp ~/.crabwalk/bin/crabwalk ~/.local/bin/
chmod +x ~/.local/bin/crabwalk
```
## CLI Usage
### Commands
```bash
crabwalk # Start server (default: 0.0.0.0:3000)
crabwalk start --daemon # Run in background
crabwalk stop # Stop background server
crabwalk status # Check if running
crabwalk update # Update to latest version
```
### Options
```
-p, --port <port> Server port (default: 3000)
-H, --host <host> Bind address (default: 0.0.0.0)
-g, --gateway <url> Gateway WebSocket URL (default: ws://127.0.0.1:18789)
-t, --token <token> Gateway auth token
-d, --daemon Run in background
-v, --version Show version
```
### Examples
```bash
crabwalk -p 8080 # Custom port
crabwalk -t mytoken123 # Explicit token
crabwalk -g ws://192.168.1.50:18789 # Remote gateway
crabwalk start -d -p 8080 # Daemon on port 8080
```
### Auto-detection
The CLI automatically detects your gateway token from `~/.openclaw/openclaw.json` - no config needed if you're running OpenClaw locally.
### QR Code
On startup, Crabwalk displays a QR code you can scan to open the monitor on your phone. Requires `qrencode` installed (the installer adds it automatically).
### Docker (recommended)
```bash
@@ -83,46 +25,19 @@ docker run -d \
-p 3000:3000 \
-e CLAWDBOT_API_TOKEN=your-token \
-e CLAWDBOT_URL=ws://host.docker.internal:18789 \
-v ~/.openclaw/workspace:/root/.openclaw/workspace \
ghcr.io/luccast/crabwalk:latest
```
> Note: When running Crabwalk in Docker, the OpenClaw gateway typically runs on the _host_.
> Note: When running Crabwalk in Docker, the Moltbot gateway typically runs on the _host_.
> Use `CLAWDBOT_URL=ws://host.docker.internal:18789` so the container can connect.
> If you're running OpenClaw with `bind: loopback` and `tailscale serve` for secure tailnet-only access, you'll need to run the crabwalk container with host networking - replace `p:3000:3000` with `--network host`
> If you're running Moltbot with `bind: loopback` and `tailscale serve` for secure tailnet-only access, you'll need to run the crabwalk container with host networking - replace `p:3000:3000` with `--network host`
> This allows the container to reach 127.0.0.1:18789 while maintaining the security benefits of loopback-only binding.
#### Workspace Access
The workspace explorer needs access to your local files. By default, it looks for files at `~/.openclaw/workspace`. In Docker, mount your host workspace to the same path in the container:
```bash
# Default workspace path (recommended)
docker run -d \
-p 3000:3000 \
-e CLAWDBOT_API_TOKEN=your-token \
-v ~/.openclaw/workspace:/root/.openclaw/workspace \
ghcr.io/luccast/crabwalk:latest
# Custom workspace path on host
docker run -d \
-p 3000:3000 \
-e CLAWDBOT_API_TOKEN=your-token \
-v /path/to/your/workspace:/root/.openclaw/workspace \
ghcr.io/luccast/crabwalk:latest
```
Or with docker-compose:
```bash
curl -O https://raw.githubusercontent.com/luccast/crabwalk/master/docker-compose.yml
CLAWDBOT_API_TOKEN=your-token docker-compose up -d
```
To use a custom workspace path with docker-compose, set the `WORKSPACE_HOST_PATH` environment variable:
```bash
WORKSPACE_HOST_PATH=/path/to/your/workspace CLAWDBOT_API_TOKEN=your-token docker-compose up -d
CLAWDBOT_API_TOKEN=your-token CLAWDBOT_URL=ws://host.docker.internal:18789 docker-compose up -d
```
> If gateway is `bind: loopback` only, you will need to edit the `docker-compose.yml` to add `network_mode: host`
@@ -140,24 +55,27 @@ Open `http://localhost:3000/monitor`
## Configuration
Requires OpenClaw gateway running on the same machine.
Requires clawdbot gateway running on the same machine.
### Gateway Token
The CLI auto-detects your token from `~/.openclaw/openclaw.json` (at `gateway.auth.token`). No manual config needed for local setups.
To find your token manually:
Find your token in the clawdbot config file:
```bash
jq '.gateway.auth.token' ~/.openclaw/openclaw.json
# Look for gateway.auth.token
cat ~/.clawdbot/clawdbot.json | rg "gateway\.auth\.token"
```
Or set it explicitly:
Or with jq:
```bash
crabwalk -t your-token
# or
export CLAWDBOT_API_TOKEN=your-token
jq '.gateway.auth.token' ~/.clawdbot/clawdbot.json
```
Or copy it directly:
```bash
export CLAWDBOT_API_TOKEN=$(python3 -c "import json,os; print(json.load(open(os.path.expanduser('~/.clawdbot/clawdbot.json')))['gateway']['auth']['token'])")
```
## Stack
-297
View File
@@ -1,297 +0,0 @@
#!/usr/bin/env bash
# 🦀 Crabwalk CLI
set -e
CRABWALK_HOME="${CRABWALK_HOME:-$HOME/.crabwalk}"
PID_FILE="$CRABWALK_HOME/crabwalk.pid"
LOG_FILE="$CRABWALK_HOME/crabwalk.log"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Get version from package.json
get_version() {
cat "$CRABWALK_HOME/package.json" 2>/dev/null | grep '"version"' | cut -d'"' -f4
}
# Auto-detect token from OpenClaw config
auto_token() {
if [ -f "$HOME/.openclaw/openclaw.json" ]; then
python3 -c "import json,os; print(json.load(open(os.path.expanduser('~/.openclaw/openclaw.json')))['gateway']['auth']['token'])" 2>/dev/null || true
fi
}
# Get network IPs
get_network_ips() {
if command -v hostname &>/dev/null; then
hostname -I 2>/dev/null | tr ' ' '\n' | grep -v '^$' || true
elif command -v ip &>/dev/null; then
ip -4 addr show 2>/dev/null | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '127.0.0.1' || true
fi
}
# Show QR code for URL
show_qr() {
local url="$1"
if command -v qrencode &>/dev/null; then
echo ""
qrencode -t ANSIUTF8 -m 2 "$url" 2>/dev/null || true
fi
}
# Check if running
is_running() {
if [ -f "$PID_FILE" ]; then
local pid=$(cat "$PID_FILE")
if kill -0 "$pid" 2>/dev/null; then
echo "$pid"
return 0
fi
fi
return 1
}
# Show startup banner
show_banner() {
local port="${1:-3000}"
local host="${2:-0.0.0.0}"
local version=$(get_version)
local network_url=""
echo ""
echo -e "🦀 ${GREEN}Crabwalk${NC} v${version}"
echo ""
if [ "$host" = "0.0.0.0" ]; then
echo -e " ➜ Local: ${CYAN}http://localhost:${port}/monitor${NC}"
for ip in $(get_network_ips); do
# Use first IPv4 for QR code
if [ -z "$network_url" ] && [[ "$ip" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
network_url="http://${ip}:${port}/monitor"
fi
echo -e " ➜ Network: ${CYAN}http://${ip}:${port}/monitor${NC}"
done
else
network_url="http://${host}:${port}/monitor"
echo -e " ➜ Server: ${CYAN}${network_url}${NC}"
fi
# Show QR code for network access
if [ -n "$network_url" ]; then
show_qr "$network_url"
fi
echo ""
}
# Show help
show_help() {
local version=$(get_version)
echo "🦀 Crabwalk v${version:-unknown}"
echo ""
echo "Usage: crabwalk <command> [options]"
echo ""
echo "Commands:"
echo " start Start server (default)"
echo " stop Stop running server"
echo " status Check if server is running"
echo " update Update to latest version"
echo " help Show this help"
echo ""
echo "Options:"
echo " -p, --port <port> Server port (default: 3000)"
echo " -H, --host <host> Bind address (default: 0.0.0.0)"
echo " -g, --gateway <url> Gateway WebSocket URL"
echo " -t, --token <token> Gateway auth token"
echo " -d, --daemon Run in background"
echo " -v, --version Show version"
echo " -h, --help Show help"
echo ""
echo "Examples:"
echo " crabwalk # Start on 0.0.0.0:3000"
echo " crabwalk start --daemon # Run in background"
echo " crabwalk start -p 8080 # Custom port"
echo " crabwalk stop # Stop daemon"
echo " crabwalk status # Check status"
echo " crabwalk update # Update to latest"
}
# Start command
cmd_start() {
local port="${PORT:-3000}"
local host="${HOST:-0.0.0.0}"
local daemon=false
local token="${CLAWDBOT_API_TOKEN}"
local gateway="${CLAWDBOT_URL}"
# Parse args
while [[ $# -gt 0 ]]; do
case $1 in
-p|--port) port="$2"; shift 2 ;;
-H|--host) host="$2"; shift 2 ;;
-t|--token) token="$2"; shift 2 ;;
-g|--gateway) gateway="$2"; shift 2 ;;
-d|--daemon) daemon=true; shift ;;
*) shift ;;
esac
done
# Auto-detect token if not provided
if [ -z "$token" ]; then
token=$(auto_token)
fi
# Check if already running
if pid=$(is_running); then
echo -e "🦀 Crabwalk is already running (PID $pid)"
echo -e " Use ${YELLOW}crabwalk stop${NC} first"
exit 1
fi
# Check if crabwalk is installed
if [ ! -f "$CRABWALK_HOME/.output/server/index.mjs" ]; then
echo -e "${RED}Error:${NC} Crabwalk not found at $CRABWALK_HOME"
echo "Install with: https://raw.githubusercontent.com/luccast/crabwalk/master/public/skill.md"
exit 1
fi
# Build env vars
export PORT="$port"
export HOST="$host"
[ -n "$token" ] && export CLAWDBOT_API_TOKEN="$token"
[ -n "$gateway" ] && export CLAWDBOT_URL="$gateway"
if [ "$daemon" = true ]; then
# Run in background
nohup node "$CRABWALK_HOME/.output/server/index.mjs" > "$LOG_FILE" 2>&1 &
echo $! > "$PID_FILE"
sleep 1
if is_running >/dev/null; then
show_banner "$port" "$host"
echo -e "🦀 Running in background (PID $(cat $PID_FILE))"
echo -e " Logs: ${CYAN}$LOG_FILE${NC}"
else
echo -e "${RED}Error:${NC} Failed to start. Check $LOG_FILE"
exit 1
fi
else
# Run in foreground
show_banner "$port" "$host"
echo -e "Press ${YELLOW}Ctrl+C${NC} to stop"
echo ""
exec node "$CRABWALK_HOME/.output/server/index.mjs"
fi
}
# Stop command
cmd_stop() {
if pid=$(is_running); then
kill "$pid" 2>/dev/null
rm -f "$PID_FILE"
echo "🦀 Crabwalk stopped"
else
echo "🦀 Crabwalk is not running"
fi
}
# Status command
cmd_status() {
local port="${PORT:-3000}"
if pid=$(is_running); then
echo -e "🦀 Crabwalk is ${GREEN}running${NC} (PID $pid)"
echo -e " http://localhost:${port}/monitor"
else
echo -e "🦀 Crabwalk is ${RED}stopped${NC}"
fi
}
# Update command
cmd_update() {
local installed=$(get_version)
local latest=$(curl -s https://api.github.com/repos/luccast/crabwalk/releases/latest | grep '"tag_name"' | cut -d'"' -f4 | tr -d 'v')
if [ -z "$installed" ]; then
echo "🦀 Crabwalk not installed"
exit 1
fi
if [ -z "$latest" ]; then
echo -e "${RED}Error:${NC} Could not fetch latest version"
exit 1
fi
if [ "$installed" = "$latest" ]; then
echo "🦀 Already on latest: $installed"
exit 0
fi
echo "🦀 Update available: $installed -> $latest"
echo " https://github.com/luccast/crabwalk/releases/tag/v${latest}"
echo ""
read -p "Update now? [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Stop if running
if is_running >/dev/null; then
echo "🦀 Stopping server..."
cmd_stop
fi
echo "🦀 Downloading v${latest}..."
local version="v${latest}"
rm -rf "$CRABWALK_HOME/.output"
curl -sL "https://github.com/luccast/crabwalk/releases/download/${version}/crabwalk-${version}.tar.gz" | tar -xz -C "$CRABWALK_HOME"
# Update CLI if needed
if [ -f "$CRABWALK_HOME/bin/crabwalk" ]; then
cp "$CRABWALK_HOME/bin/crabwalk" ~/.local/bin/crabwalk 2>/dev/null || true
fi
echo "🦀 Updated to v${latest}"
else
echo "🦀 Update cancelled"
fi
}
# Main
main() {
local cmd="${1:-start}"
shift 2>/dev/null || true
# Handle flags before command
case $cmd in
-v|--version)
echo "🦀 Crabwalk v$(get_version)"
exit 0
;;
-h|--help|help)
show_help
exit 0
;;
start)
cmd_start "$@"
;;
stop)
cmd_stop
;;
status)
cmd_status
;;
update)
cmd_update
;;
*)
# Assume it's an option for start
cmd_start "$cmd" "$@"
;;
esac
}
main "$@"
-5
View File
@@ -5,9 +5,4 @@ services:
- "3000:3000"
environment:
- CLAWDBOT_API_TOKEN=${CLAWDBOT_API_TOKEN}
volumes:
# Mount host workspace directory to container
# The container expects the workspace at ~/.openclaw/workspace
# Change the host path if your workspace is in a different location
- ${WORKSPACE_HOST_PATH:-~/.openclaw/workspace}:/root/.openclaw/workspace
restart: unless-stopped
@@ -1,9 +1,9 @@
# Overview
Repo: openclaw/openclaw
Repo: clawdbot/clawdbot
Ref: 50b4126c79536a9645cddcfe6801916b5f6d9343
Base URL: https://codebase.md/openclaw/openclaw
Base URL: https://codebase.md/clawdbot/clawdbot
Note: This repo is currently being built in the background.
Status: /status/openclaw/openclaw/50b4126c79536a9645cddcfe6801916b5f6d9343
Status: /status/clawdbot/clawdbot/50b4126c79536a9645cddcfe6801916b5f6d9343
Estimated build time: ~96 seconds.
Try again in 60 seconds.
+236 -281
View File
@@ -1,12 +1,12 @@
{
"name": "crabwalk",
"version": "1.0.7",
"version": "1.0.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "crabwalk",
"version": "1.0.7",
"version": "1.0.5",
"dependencies": {
"@tanstack/db": "^0.5.0",
"@tanstack/history": "^1.132.0",
@@ -1587,9 +1587,9 @@
"license": "MIT"
},
"node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.57.1.tgz",
"integrity": "sha512-A6ehUVSiSaaliTxai040ZpZ2zTevHYbvu/lDoeAteHI8QnaosIzm4qwtezfRg1jOYaUmnzLX1AOD6Z+UJjtifg==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.57.0.tgz",
"integrity": "sha512-tPgXB6cDTndIe1ah7u6amCI1T0SsnlOuKgg10Xh3uizJk4e5M1JGaUMk7J4ciuAUcFpbOiNhm2XIjP9ON0dUqA==",
"cpu": [
"arm"
],
@@ -1600,9 +1600,9 @@
]
},
"node_modules/@rollup/rollup-android-arm64": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.57.1.tgz",
"integrity": "sha512-dQaAddCY9YgkFHZcFNS/606Exo8vcLHwArFZ7vxXq4rigo2bb494/xKMMwRRQW6ug7Js6yXmBZhSBRuBvCCQ3w==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.57.0.tgz",
"integrity": "sha512-sa4LyseLLXr1onr97StkU1Nb7fWcg6niokTwEVNOO7awaKaoRObQ54+V/hrF/BP1noMEaaAW6Fg2d/CfLiq3Mg==",
"cpu": [
"arm64"
],
@@ -1613,9 +1613,9 @@
]
},
"node_modules/@rollup/rollup-darwin-arm64": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.57.1.tgz",
"integrity": "sha512-crNPrwJOrRxagUYeMn/DZwqN88SDmwaJ8Cvi/TN1HnWBU7GwknckyosC2gd0IqYRsHDEnXf328o9/HC6OkPgOg==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.57.0.tgz",
"integrity": "sha512-/NNIj9A7yLjKdmkx5dC2XQ9DmjIECpGpwHoGmA5E1AhU0fuICSqSWScPhN1yLCkEdkCwJIDu2xIeLPs60MNIVg==",
"cpu": [
"arm64"
],
@@ -1626,9 +1626,9 @@
]
},
"node_modules/@rollup/rollup-darwin-x64": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.57.1.tgz",
"integrity": "sha512-Ji8g8ChVbKrhFtig5QBV7iMaJrGtpHelkB3lsaKzadFBe58gmjfGXAOfI5FV0lYMH8wiqsxKQ1C9B0YTRXVy4w==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.57.0.tgz",
"integrity": "sha512-xoh8abqgPrPYPr7pTYipqnUi1V3em56JzE/HgDgitTqZBZ3yKCWI+7KUkceM6tNweyUKYru1UMi7FC060RyKwA==",
"cpu": [
"x64"
],
@@ -1639,9 +1639,9 @@
]
},
"node_modules/@rollup/rollup-freebsd-arm64": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.57.1.tgz",
"integrity": "sha512-R+/WwhsjmwodAcz65guCGFRkMb4gKWTcIeLy60JJQbXrJ97BOXHxnkPFrP+YwFlaS0m+uWJTstrUA9o+UchFug==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.57.0.tgz",
"integrity": "sha512-PCkMh7fNahWSbA0OTUQ2OpYHpjZZr0hPr8lId8twD7a7SeWrvT3xJVyza+dQwXSSq4yEQTMoXgNOfMCsn8584g==",
"cpu": [
"arm64"
],
@@ -1652,9 +1652,9 @@
]
},
"node_modules/@rollup/rollup-freebsd-x64": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.57.1.tgz",
"integrity": "sha512-IEQTCHeiTOnAUC3IDQdzRAGj3jOAYNr9kBguI7MQAAZK3caezRrg0GxAb6Hchg4lxdZEI5Oq3iov/w/hnFWY9Q==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.57.0.tgz",
"integrity": "sha512-1j3stGx+qbhXql4OCDZhnK7b01s6rBKNybfsX+TNrEe9JNq4DLi1yGiR1xW+nL+FNVvI4D02PUnl6gJ/2y6WJA==",
"cpu": [
"x64"
],
@@ -1665,9 +1665,9 @@
]
},
"node_modules/@rollup/rollup-linux-arm-gnueabihf": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.57.1.tgz",
"integrity": "sha512-F8sWbhZ7tyuEfsmOxwc2giKDQzN3+kuBLPwwZGyVkLlKGdV1nvnNwYD0fKQ8+XS6hp9nY7B+ZeK01EBUE7aHaw==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.57.0.tgz",
"integrity": "sha512-eyrr5W08Ms9uM0mLcKfM/Uzx7hjhz2bcjv8P2uynfj0yU8GGPdz8iYrBPhiLOZqahoAMB8ZiolRZPbbU2MAi6Q==",
"cpu": [
"arm"
],
@@ -1678,9 +1678,9 @@
]
},
"node_modules/@rollup/rollup-linux-arm-musleabihf": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.57.1.tgz",
"integrity": "sha512-rGfNUfn0GIeXtBP1wL5MnzSj98+PZe/AXaGBCRmT0ts80lU5CATYGxXukeTX39XBKsxzFpEeK+Mrp9faXOlmrw==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.57.0.tgz",
"integrity": "sha512-Xds90ITXJCNyX9pDhqf85MKWUI4lqjiPAipJ8OLp8xqI2Ehk+TCVhF9rvOoN8xTbcafow3QOThkNnrM33uCFQA==",
"cpu": [
"arm"
],
@@ -1691,9 +1691,9 @@
]
},
"node_modules/@rollup/rollup-linux-arm64-gnu": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.57.1.tgz",
"integrity": "sha512-MMtej3YHWeg/0klK2Qodf3yrNzz6CGjo2UntLvk2RSPlhzgLvYEB3frRvbEF2wRKh1Z2fDIg9KRPe1fawv7C+g==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.57.0.tgz",
"integrity": "sha512-Xws2KA4CLvZmXjy46SQaXSejuKPhwVdaNinldoYfqruZBaJHqVo6hnRa8SDo9z7PBW5x84SH64+izmldCgbezw==",
"cpu": [
"arm64"
],
@@ -1704,9 +1704,9 @@
]
},
"node_modules/@rollup/rollup-linux-arm64-musl": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.57.1.tgz",
"integrity": "sha512-1a/qhaaOXhqXGpMFMET9VqwZakkljWHLmZOX48R0I/YLbhdxr1m4gtG1Hq7++VhVUmf+L3sTAf9op4JlhQ5u1Q==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.57.0.tgz",
"integrity": "sha512-hrKXKbX5FdaRJj7lTMusmvKbhMJSGWJ+w++4KmjiDhpTgNlhYobMvKfDoIWecy4O60K6yA4SnztGuNTQF+Lplw==",
"cpu": [
"arm64"
],
@@ -1717,9 +1717,9 @@
]
},
"node_modules/@rollup/rollup-linux-loong64-gnu": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.57.1.tgz",
"integrity": "sha512-QWO6RQTZ/cqYtJMtxhkRkidoNGXc7ERPbZN7dVW5SdURuLeVU7lwKMpo18XdcmpWYd0qsP1bwKPf7DNSUinhvA==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.57.0.tgz",
"integrity": "sha512-6A+nccfSDGKsPm00d3xKcrsBcbqzCTAukjwWK6rbuAnB2bHaL3r9720HBVZ/no7+FhZLz/U3GwwZZEh6tOSI8Q==",
"cpu": [
"loong64"
],
@@ -1730,9 +1730,9 @@
]
},
"node_modules/@rollup/rollup-linux-loong64-musl": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.57.1.tgz",
"integrity": "sha512-xpObYIf+8gprgWaPP32xiN5RVTi/s5FCR+XMXSKmhfoJjrpRAjCuuqQXyxUa/eJTdAE6eJ+KDKaoEqjZQxh3Gw==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.57.0.tgz",
"integrity": "sha512-4P1VyYUe6XAJtQH1Hh99THxr0GKMMwIXsRNOceLrJnaHTDgk1FTcTimDgneRJPvB3LqDQxUmroBclQ1S0cIJwQ==",
"cpu": [
"loong64"
],
@@ -1743,9 +1743,9 @@
]
},
"node_modules/@rollup/rollup-linux-ppc64-gnu": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.57.1.tgz",
"integrity": "sha512-4BrCgrpZo4hvzMDKRqEaW1zeecScDCR+2nZ86ATLhAoJ5FQ+lbHVD3ttKe74/c7tNT9c6F2viwB3ufwp01Oh2w==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.57.0.tgz",
"integrity": "sha512-8Vv6pLuIZCMcgXre6c3nOPhE0gjz1+nZP6T+hwWjr7sVH8k0jRkH+XnfjjOTglyMBdSKBPPz54/y1gToSKwrSQ==",
"cpu": [
"ppc64"
],
@@ -1756,9 +1756,9 @@
]
},
"node_modules/@rollup/rollup-linux-ppc64-musl": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.57.1.tgz",
"integrity": "sha512-NOlUuzesGauESAyEYFSe3QTUguL+lvrN1HtwEEsU2rOwdUDeTMJdO5dUYl/2hKf9jWydJrO9OL/XSSf65R5+Xw==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.57.0.tgz",
"integrity": "sha512-r1te1M0Sm2TBVD/RxBPC6RZVwNqUTwJTA7w+C/IW5v9Ssu6xmxWEi+iJQlpBhtUiT1raJ5b48pI8tBvEjEFnFA==",
"cpu": [
"ppc64"
],
@@ -1769,9 +1769,9 @@
]
},
"node_modules/@rollup/rollup-linux-riscv64-gnu": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.57.1.tgz",
"integrity": "sha512-ptA88htVp0AwUUqhVghwDIKlvJMD/fmL/wrQj99PRHFRAG6Z5nbWoWG4o81Nt9FT+IuqUQi+L31ZKAFeJ5Is+A==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.57.0.tgz",
"integrity": "sha512-say0uMU/RaPm3CDQLxUUTF2oNWL8ysvHkAjcCzV2znxBr23kFfaxocS9qJm+NdkRhF8wtdEEAJuYcLPhSPbjuQ==",
"cpu": [
"riscv64"
],
@@ -1782,9 +1782,9 @@
]
},
"node_modules/@rollup/rollup-linux-riscv64-musl": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.57.1.tgz",
"integrity": "sha512-S51t7aMMTNdmAMPpBg7OOsTdn4tySRQvklmL3RpDRyknk87+Sp3xaumlatU+ppQ+5raY7sSTcC2beGgvhENfuw==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.57.0.tgz",
"integrity": "sha512-/MU7/HizQGsnBREtRpcSbSV1zfkoxSTR7wLsRmBPQ8FwUj5sykrP1MyJTvsxP5KBq9SyE6kH8UQQQwa0ASeoQQ==",
"cpu": [
"riscv64"
],
@@ -1795,9 +1795,9 @@
]
},
"node_modules/@rollup/rollup-linux-s390x-gnu": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.57.1.tgz",
"integrity": "sha512-Bl00OFnVFkL82FHbEqy3k5CUCKH6OEJL54KCyx2oqsmZnFTR8IoNqBF+mjQVcRCT5sB6yOvK8A37LNm/kPJiZg==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.57.0.tgz",
"integrity": "sha512-Q9eh+gUGILIHEaJf66aF6a414jQbDnn29zeu0eX3dHMuysnhTvsUvZTCAyZ6tJhUjnvzBKE4FtuaYxutxRZpOg==",
"cpu": [
"s390x"
],
@@ -1808,9 +1808,9 @@
]
},
"node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.57.1.tgz",
"integrity": "sha512-ABca4ceT4N+Tv/GtotnWAeXZUZuM/9AQyCyKYyKnpk4yoA7QIAuBt6Hkgpw8kActYlew2mvckXkvx0FfoInnLg==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.57.0.tgz",
"integrity": "sha512-OR5p5yG5OKSxHReWmwvM0P+VTPMwoBS45PXTMYaskKQqybkS3Kmugq1W+YbNWArF8/s7jQScgzXUhArzEQ7x0A==",
"cpu": [
"x64"
],
@@ -1821,9 +1821,9 @@
]
},
"node_modules/@rollup/rollup-linux-x64-musl": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.57.1.tgz",
"integrity": "sha512-HFps0JeGtuOR2convgRRkHCekD7j+gdAuXM+/i6kGzQtFhlCtQkpwtNzkNj6QhCDp7DRJ7+qC/1Vg2jt5iSOFw==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.57.0.tgz",
"integrity": "sha512-XeatKzo4lHDsVEbm1XDHZlhYZZSQYym6dg2X/Ko0kSFgio+KXLsxwJQprnR48GvdIKDOpqWqssC3iBCjoMcMpw==",
"cpu": [
"x64"
],
@@ -1834,9 +1834,9 @@
]
},
"node_modules/@rollup/rollup-openbsd-x64": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.57.1.tgz",
"integrity": "sha512-H+hXEv9gdVQuDTgnqD+SQffoWoc0Of59AStSzTEj/feWTBAnSfSD3+Dql1ZruJQxmykT/JVY0dE8Ka7z0DH1hw==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.57.0.tgz",
"integrity": "sha512-Lu71y78F5qOfYmubYLHPcJm74GZLU6UJ4THkf/a1K7Tz2ycwC2VUbsqbJAXaR6Bx70SRdlVrt2+n5l7F0agTUw==",
"cpu": [
"x64"
],
@@ -1847,9 +1847,9 @@
]
},
"node_modules/@rollup/rollup-openharmony-arm64": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.57.1.tgz",
"integrity": "sha512-4wYoDpNg6o/oPximyc/NG+mYUejZrCU2q+2w6YZqrAs2UcNUChIZXjtafAiiZSUc7On8v5NyNj34Kzj/Ltk6dQ==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.57.0.tgz",
"integrity": "sha512-v5xwKDWcu7qhAEcsUubiav7r+48Uk/ENWdr82MBZZRIm7zThSxCIVDfb3ZeRRq9yqk+oIzMdDo6fCcA5DHfMyA==",
"cpu": [
"arm64"
],
@@ -1860,9 +1860,9 @@
]
},
"node_modules/@rollup/rollup-win32-arm64-msvc": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.57.1.tgz",
"integrity": "sha512-O54mtsV/6LW3P8qdTcamQmuC990HDfR71lo44oZMZlXU4tzLrbvTii87Ni9opq60ds0YzuAlEr/GNwuNluZyMQ==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.57.0.tgz",
"integrity": "sha512-XnaaaSMGSI6Wk8F4KK3QP7GfuuhjGchElsVerCplUuxRIzdvZ7hRBpLR0omCmw+kI2RFJB80nenhOoGXlJ5TfQ==",
"cpu": [
"arm64"
],
@@ -1873,9 +1873,9 @@
]
},
"node_modules/@rollup/rollup-win32-ia32-msvc": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.57.1.tgz",
"integrity": "sha512-P3dLS+IerxCT/7D2q2FYcRdWRl22dNbrbBEtxdWhXrfIMPP9lQhb5h4Du04mdl5Woq05jVCDPCMF7Ub0NAjIew==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.57.0.tgz",
"integrity": "sha512-3K1lP+3BXY4t4VihLw5MEg6IZD3ojSYzqzBG571W3kNQe4G4CcFpSUQVgurYgib5d+YaCjeFow8QivWp8vuSvA==",
"cpu": [
"ia32"
],
@@ -1886,9 +1886,9 @@
]
},
"node_modules/@rollup/rollup-win32-x64-gnu": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.57.1.tgz",
"integrity": "sha512-VMBH2eOOaKGtIJYleXsi2B8CPVADrh+TyNxJ4mWPnKfLB/DBUmzW+5m1xUrcwWoMfSLagIRpjUFeW5CO5hyciQ==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.57.0.tgz",
"integrity": "sha512-MDk610P/vJGc5L5ImE4k5s+GZT3en0KoK1MKPXCRgzmksAMk79j4h3k1IerxTNqwDLxsGxStEZVBqG0gIqZqoA==",
"cpu": [
"x64"
],
@@ -1899,9 +1899,9 @@
]
},
"node_modules/@rollup/rollup-win32-x64-msvc": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.57.1.tgz",
"integrity": "sha512-mxRFDdHIWRxg3UfIIAwCm6NzvxG0jDX/wBN6KsQFTvKFqqg9vTrWUE68qEjHt19A5wwx5X5aUi2zuZT7YR0jrA==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.57.0.tgz",
"integrity": "sha512-Zv7v6q6aV+VslnpwzqKAmrk5JdVkLUzok2208ZXGipjb+msxBr/fJPZyeEXiFgH7k62Ak0SLIfxQRZQvTuf7rQ==",
"cpu": [
"x64"
],
@@ -2190,9 +2190,9 @@
}
},
"node_modules/@tanstack/db": {
"version": "0.5.25",
"resolved": "https://registry.npmjs.org/@tanstack/db/-/db-0.5.25.tgz",
"integrity": "sha512-VqVchs6Mm4rw2GyiOkaoD+PJw6lCJT8EI/TzPu8KWZy3QxyOlilpMvEuDTCl0LZdp1iLYlQT1NdgDg0gimV3kQ==",
"version": "0.5.23",
"resolved": "https://registry.npmjs.org/@tanstack/db/-/db-0.5.23.tgz",
"integrity": "sha512-/zO2K2hjkupL0DYHyPLnzEf3gFBlznUyZ+RLWBSFX4Dsf6jhjoGnAVZe6W25fZYyoZ5adb/PlhedHDqKO1u2rg==",
"license": "MIT",
"dependencies": {
"@standard-schema/spec": "^1.1.0",
@@ -2253,9 +2253,9 @@
}
},
"node_modules/@tanstack/query-devtools": {
"version": "5.93.0",
"resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.93.0.tgz",
"integrity": "sha512-+kpsx1NQnOFTZsw6HAFCW3HkKg0+2cepGtAWXjiiSOJJ1CtQpt72EE2nyZb+AjAbLRPoeRmPJ8MtQd8r8gsPdg==",
"version": "5.92.0",
"resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.92.0.tgz",
"integrity": "sha512-N8D27KH1vEpVacvZgJL27xC6yPFUy0Zkezn5gnB3L3gRCxlDeSuiya7fKge8Y91uMTnC8aSxBQhcK6ocY7alpQ==",
"dev": true,
"license": "MIT",
"funding": {
@@ -2264,12 +2264,12 @@
}
},
"node_modules/@tanstack/react-db": {
"version": "0.1.69",
"resolved": "https://registry.npmjs.org/@tanstack/react-db/-/react-db-0.1.69.tgz",
"integrity": "sha512-rqhajRK5InIEKT9RABE9zNbYZL5NGkySjGNVANyilu/ADFHV8rhtkMEnhHcbrzv0grIKpcSlx1AvTgJNbbzjkw==",
"version": "0.1.67",
"resolved": "https://registry.npmjs.org/@tanstack/react-db/-/react-db-0.1.67.tgz",
"integrity": "sha512-MLvvAKdPhQP7ozp6fPF7JezN5kv6phsy1g2z6Qfo/sw8RB9hOj4l/bCL0OCMdAkAueCTm0zsC1gtF7WgGw6L+Q==",
"license": "MIT",
"dependencies": {
"@tanstack/db": "0.5.25",
"@tanstack/db": "0.5.23",
"use-sync-external-store": "^1.6.0"
},
"peerDependencies": {
@@ -2294,33 +2294,33 @@
}
},
"node_modules/@tanstack/react-query-devtools": {
"version": "5.91.3",
"resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.91.3.tgz",
"integrity": "sha512-nlahjMtd/J1h7IzOOfqeyDh5LNfG0eULwlltPEonYy0QL+nqrBB+nyzJfULV+moL7sZyxc2sHdNJki+vLA9BSA==",
"version": "5.91.2",
"resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.91.2.tgz",
"integrity": "sha512-ZJ1503ay5fFeEYFUdo7LMNFzZryi6B0Cacrgr2h1JRkvikK1khgIq6Nq2EcblqEdIlgB/r7XDW8f8DQ89RuUgg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@tanstack/query-devtools": "5.93.0"
"@tanstack/query-devtools": "5.92.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"peerDependencies": {
"@tanstack/react-query": "^5.90.20",
"@tanstack/react-query": "^5.90.14",
"react": "^18 || ^19"
}
},
"node_modules/@tanstack/react-router": {
"version": "1.157.17",
"resolved": "https://registry.npmjs.org/@tanstack/react-router/-/react-router-1.157.17.tgz",
"integrity": "sha512-7i4wD8HFI/EZfwFYGNrcilqjrb+r/dxEl7F61rPfjUrfS39WGXQUSw0p/cQpcWEQZeYOGhqWjhmtM34H/Hul0g==",
"version": "1.157.13",
"resolved": "https://registry.npmjs.org/@tanstack/react-router/-/react-router-1.157.13.tgz",
"integrity": "sha512-rLr6swdDhLjadAHbukg/XYurNi4q8AmmjP99QiWUnhRPKfrfmQ/O1UCvaowQ9GcaiyOG2COiJ9OlDAQU3k9MFQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@tanstack/history": "1.154.14",
"@tanstack/react-store": "^0.8.0",
"@tanstack/router-core": "1.157.16",
"@tanstack/router-core": "1.157.13",
"isbot": "^5.1.22",
"tiny-invariant": "^1.3.3",
"tiny-warning": "^1.0.3"
@@ -2338,12 +2338,12 @@
}
},
"node_modules/@tanstack/react-router-devtools": {
"version": "1.157.17",
"resolved": "https://registry.npmjs.org/@tanstack/react-router-devtools/-/react-router-devtools-1.157.17.tgz",
"integrity": "sha512-ajhTEQMPK9XtgVN7KqLy9JobYbyjcbuZXc76kABA8HeUJqB98rvwdpVuB106LReeIKuTc5RLOgCrdkq2A19wpg==",
"version": "1.157.13",
"resolved": "https://registry.npmjs.org/@tanstack/react-router-devtools/-/react-router-devtools-1.157.13.tgz",
"integrity": "sha512-NubObLraO9Qktd52aPlp5rqvzNx/BI9/DzDwHt15A9R5reXff+dNvbcUo/uFawYoSYB9s94BJPiGBPvXuEOnaA==",
"license": "MIT",
"dependencies": {
"@tanstack/router-devtools-core": "1.157.16"
"@tanstack/router-devtools-core": "1.157.13"
},
"engines": {
"node": ">=12"
@@ -2353,8 +2353,8 @@
"url": "https://github.com/sponsors/tannerlinsley"
},
"peerDependencies": {
"@tanstack/react-router": "^1.157.17",
"@tanstack/router-core": "^1.157.16",
"@tanstack/react-router": "^1.157.13",
"@tanstack/router-core": "^1.157.13",
"react": ">=18.0.0 || >=19.0.0",
"react-dom": ">=18.0.0 || >=19.0.0"
},
@@ -2365,18 +2365,18 @@
}
},
"node_modules/@tanstack/react-start": {
"version": "1.157.17",
"resolved": "https://registry.npmjs.org/@tanstack/react-start/-/react-start-1.157.17.tgz",
"integrity": "sha512-2maaXUTGj6jJClAE3upHLMlrpDhrmKQ6ozK2IUgvIoNZJbW0ONcBLLKUpeSHaeN+lVtmcIj1GBUDUGgrPTcXAQ==",
"version": "1.157.13",
"resolved": "https://registry.npmjs.org/@tanstack/react-start/-/react-start-1.157.13.tgz",
"integrity": "sha512-sGobb4NEDHanm1omHjrMnRfdK5royld6HAkwZDqzBIG21hByqu9ypa+PI10kUGrsz0YvVZHhMJY0J+Vg9coKtQ==",
"license": "MIT",
"dependencies": {
"@tanstack/react-router": "1.157.17",
"@tanstack/react-start-client": "1.157.17",
"@tanstack/react-start-server": "1.157.17",
"@tanstack/react-router": "1.157.13",
"@tanstack/react-start-client": "1.157.13",
"@tanstack/react-start-server": "1.157.13",
"@tanstack/router-utils": "^1.154.7",
"@tanstack/start-client-core": "1.157.16",
"@tanstack/start-plugin-core": "1.157.17",
"@tanstack/start-server-core": "1.157.16",
"@tanstack/start-client-core": "1.157.13",
"@tanstack/start-plugin-core": "1.157.13",
"@tanstack/start-server-core": "1.157.13",
"pathe": "^2.0.3"
},
"engines": {
@@ -2393,14 +2393,14 @@
}
},
"node_modules/@tanstack/react-start-client": {
"version": "1.157.17",
"resolved": "https://registry.npmjs.org/@tanstack/react-start-client/-/react-start-client-1.157.17.tgz",
"integrity": "sha512-IivMHwgFInSGJIdzfRHiXYNUqUi4RE8ebL+9Ex2F1XzgOWjBEgcW3HHfyBN2YlthZ6HK6e+rt7rKLvpKcRmioQ==",
"version": "1.157.13",
"resolved": "https://registry.npmjs.org/@tanstack/react-start-client/-/react-start-client-1.157.13.tgz",
"integrity": "sha512-1LcX/4V6HrUIW3OEjMtPRhdf5weaGZEi656llObQqxC2oiXrVX6O0NILXctBKMxAHUl1JG1HveeWDzs9PKDTiw==",
"license": "MIT",
"dependencies": {
"@tanstack/react-router": "1.157.17",
"@tanstack/router-core": "1.157.16",
"@tanstack/start-client-core": "1.157.16",
"@tanstack/react-router": "1.157.13",
"@tanstack/router-core": "1.157.13",
"@tanstack/start-client-core": "1.157.13",
"tiny-invariant": "^1.3.3",
"tiny-warning": "^1.0.3"
},
@@ -2417,16 +2417,16 @@
}
},
"node_modules/@tanstack/react-start-server": {
"version": "1.157.17",
"resolved": "https://registry.npmjs.org/@tanstack/react-start-server/-/react-start-server-1.157.17.tgz",
"integrity": "sha512-ky1O4e9Lo0VYN0wfWhSrpFKoN4XJ52UFkegX3QD9YRfS9eFuEKTOZ4y4UVXZNWA48pq3kCzKShYcgU1r107n+Q==",
"version": "1.157.13",
"resolved": "https://registry.npmjs.org/@tanstack/react-start-server/-/react-start-server-1.157.13.tgz",
"integrity": "sha512-isxQr9KkKgj9QwBDH39sC7M27qogfBO7Zam4Eras9jstWW4+vwdpwZyRi/jfqonaAO2VWucjEokszPCmbcn/AA==",
"license": "MIT",
"dependencies": {
"@tanstack/history": "1.154.14",
"@tanstack/react-router": "1.157.17",
"@tanstack/router-core": "1.157.16",
"@tanstack/start-client-core": "1.157.16",
"@tanstack/start-server-core": "1.157.16"
"@tanstack/react-router": "1.157.13",
"@tanstack/router-core": "1.157.13",
"@tanstack/start-client-core": "1.157.13",
"@tanstack/start-server-core": "1.157.13"
},
"engines": {
"node": ">=22.12.0"
@@ -2459,9 +2459,9 @@
}
},
"node_modules/@tanstack/router-core": {
"version": "1.157.16",
"resolved": "https://registry.npmjs.org/@tanstack/router-core/-/router-core-1.157.16.tgz",
"integrity": "sha512-eJuVgM7KZYTTr4uPorbUzUflmljMVcaX2g6VvhITLnHmg9SBx9RAgtQ1HmT+72mzyIbRSlQ1q0fY/m+of/fosA==",
"version": "1.157.13",
"resolved": "https://registry.npmjs.org/@tanstack/router-core/-/router-core-1.157.13.tgz",
"integrity": "sha512-dl1avpRH2Pi1tYhxDzGEqI6DU9VQUf5zBeW1JJFs3LfJuVkGd2lG93dSUzH9seJNp77hm8JWhoX+k4QYMEB6KA==",
"license": "MIT",
"peer": true,
"dependencies": {
@@ -2482,9 +2482,9 @@
}
},
"node_modules/@tanstack/router-devtools-core": {
"version": "1.157.16",
"resolved": "https://registry.npmjs.org/@tanstack/router-devtools-core/-/router-devtools-core-1.157.16.tgz",
"integrity": "sha512-XBJTs/kMZYK6J2zhbGucHNuypwDB1t2vi8K5To+V6dUnLGBEyfQTf01fegiF4rpL1yXgomdGnP6aTiOFgldbVg==",
"version": "1.157.13",
"resolved": "https://registry.npmjs.org/@tanstack/router-devtools-core/-/router-devtools-core-1.157.13.tgz",
"integrity": "sha512-JZj7isvv2Y1/bPRry0qS/e7/3cMCwUh6XUpzWcS1tEbFRSZVPIaVPKYCN6cM1Pl4/jT3kwSB2aNlYM++cskJNQ==",
"license": "MIT",
"dependencies": {
"clsx": "^2.1.1",
@@ -2499,7 +2499,7 @@
"url": "https://github.com/sponsors/tannerlinsley"
},
"peerDependencies": {
"@tanstack/router-core": "^1.157.16",
"@tanstack/router-core": "^1.157.13",
"csstype": "^3.0.10"
},
"peerDependenciesMeta": {
@@ -2509,12 +2509,12 @@
}
},
"node_modules/@tanstack/router-generator": {
"version": "1.157.16",
"resolved": "https://registry.npmjs.org/@tanstack/router-generator/-/router-generator-1.157.16.tgz",
"integrity": "sha512-Ae2M00VTFjjED7glSCi/mMLENRzhEym6NgjoOx7UVNbCC/rLU/5ASDe5VIlDa8QLEqP5Pj088Gi51gjmRuICvQ==",
"version": "1.157.13",
"resolved": "https://registry.npmjs.org/@tanstack/router-generator/-/router-generator-1.157.13.tgz",
"integrity": "sha512-nOufEhuvrqeTGDxVz6b2PgUousKrV/LQGVty7GdM4408p/r2Cc3Iwp7d5sePLpqbH20+EPVowsuMhuXJ+2YsFQ==",
"license": "MIT",
"dependencies": {
"@tanstack/router-core": "1.157.16",
"@tanstack/router-core": "1.157.13",
"@tanstack/router-utils": "1.154.7",
"@tanstack/virtual-file-routes": "1.154.7",
"prettier": "^3.5.0",
@@ -2532,9 +2532,9 @@
}
},
"node_modules/@tanstack/router-plugin": {
"version": "1.157.17",
"resolved": "https://registry.npmjs.org/@tanstack/router-plugin/-/router-plugin-1.157.17.tgz",
"integrity": "sha512-3apEMtVxeal8735k9u/Rp2+rSogiRP6SYkZJloMI3WTktFEifGUJF5UfdtSxbF+yOT5UzUyWhbwOOmSbGuxiEw==",
"version": "1.157.13",
"resolved": "https://registry.npmjs.org/@tanstack/router-plugin/-/router-plugin-1.157.13.tgz",
"integrity": "sha512-jksBDniuGv9tk9VbWv+8/PTIefpmeviMGe+7SLecOBemK4Fk3x1hQKmulcinirD3V5Z/TezofzzhTDbB3xG9tg==",
"license": "MIT",
"dependencies": {
"@babel/core": "^7.28.5",
@@ -2543,8 +2543,8 @@
"@babel/template": "^7.27.2",
"@babel/traverse": "^7.28.5",
"@babel/types": "^7.28.5",
"@tanstack/router-core": "1.157.16",
"@tanstack/router-generator": "1.157.16",
"@tanstack/router-core": "1.157.13",
"@tanstack/router-generator": "1.157.13",
"@tanstack/router-utils": "1.154.7",
"@tanstack/virtual-file-routes": "1.154.7",
"babel-dead-code-elimination": "^1.0.11",
@@ -2561,7 +2561,7 @@
},
"peerDependencies": {
"@rsbuild/core": ">=1.0.2",
"@tanstack/react-router": "^1.157.17",
"@tanstack/react-router": "^1.157.13",
"vite": ">=5.0.0 || >=6.0.0 || >=7.0.0",
"vite-plugin-solid": "^2.11.10",
"webpack": ">=5.92.0"
@@ -2607,14 +2607,14 @@
}
},
"node_modules/@tanstack/start-client-core": {
"version": "1.157.16",
"resolved": "https://registry.npmjs.org/@tanstack/start-client-core/-/start-client-core-1.157.16.tgz",
"integrity": "sha512-O+7H133MWQTkOxmXJNhrLXiOhDcBlxvpEcCd/N25Ga6eyZ7/P5vvFzNkSSxeQNkZV+RiPWnA5B75gT+U+buz3w==",
"version": "1.157.13",
"resolved": "https://registry.npmjs.org/@tanstack/start-client-core/-/start-client-core-1.157.13.tgz",
"integrity": "sha512-UawK22+YZOMwNjRcF8r8AHsOBlqeW0sGuTNJ+/Xjs/dqV0w56yCkdcr+LJZVBnVIduLsiLeiY4yHuEf70RpTQA==",
"license": "MIT",
"dependencies": {
"@tanstack/router-core": "1.157.16",
"@tanstack/router-core": "1.157.13",
"@tanstack/start-fn-stubs": "1.154.7",
"@tanstack/start-storage-context": "1.157.16",
"@tanstack/start-storage-context": "1.157.13",
"seroval": "^1.4.2",
"tiny-invariant": "^1.3.3",
"tiny-warning": "^1.0.3"
@@ -2641,21 +2641,21 @@
}
},
"node_modules/@tanstack/start-plugin-core": {
"version": "1.157.17",
"resolved": "https://registry.npmjs.org/@tanstack/start-plugin-core/-/start-plugin-core-1.157.17.tgz",
"integrity": "sha512-m2CN1arf366K57UjO3ZiEYo0XiHaqONsfBpDMwOLmfHN+m7YsgeDhONyUamU94hp6JuhTpI8bBheg9AatKrcwg==",
"version": "1.157.13",
"resolved": "https://registry.npmjs.org/@tanstack/start-plugin-core/-/start-plugin-core-1.157.13.tgz",
"integrity": "sha512-3mpuJ8AkVl2ANTp0PUaBGdPg1LoR3X+H9Ds3cbVTKwWYWVxVpT5cDBcLYt+BRBaErHhhuQLIaTmy/3BC8+/q4A==",
"license": "MIT",
"dependencies": {
"@babel/code-frame": "7.27.1",
"@babel/core": "^7.28.5",
"@babel/types": "^7.28.5",
"@rolldown/pluginutils": "1.0.0-beta.40",
"@tanstack/router-core": "1.157.16",
"@tanstack/router-generator": "1.157.16",
"@tanstack/router-plugin": "1.157.17",
"@tanstack/router-core": "1.157.13",
"@tanstack/router-generator": "1.157.13",
"@tanstack/router-plugin": "1.157.13",
"@tanstack/router-utils": "1.154.7",
"@tanstack/start-client-core": "1.157.16",
"@tanstack/start-server-core": "1.157.16",
"@tanstack/start-client-core": "1.157.13",
"@tanstack/start-server-core": "1.157.13",
"babel-dead-code-elimination": "^1.0.11",
"cheerio": "^1.0.0",
"exsolve": "^1.0.7",
@@ -2693,15 +2693,15 @@
}
},
"node_modules/@tanstack/start-server-core": {
"version": "1.157.16",
"resolved": "https://registry.npmjs.org/@tanstack/start-server-core/-/start-server-core-1.157.16.tgz",
"integrity": "sha512-PEltFleYfiqz6+KcmzNXxc1lXgT7VDNKP6G6i1TirdHBDbRJ9CIY+ASLPlhrRwqwA2PL9PpFjXZl8u5bH/+Q9A==",
"version": "1.157.13",
"resolved": "https://registry.npmjs.org/@tanstack/start-server-core/-/start-server-core-1.157.13.tgz",
"integrity": "sha512-z6YG8M4RczzhuPUUEisuLjOh1OrZIf2d8uvIkhF2I2X+aBE4GexvT2Lxbi1uppxEhtJXj62faTRwUsMHip3Mlg==",
"license": "MIT",
"dependencies": {
"@tanstack/history": "1.154.14",
"@tanstack/router-core": "1.157.16",
"@tanstack/start-client-core": "1.157.16",
"@tanstack/start-storage-context": "1.157.16",
"@tanstack/router-core": "1.157.13",
"@tanstack/start-client-core": "1.157.13",
"@tanstack/start-storage-context": "1.157.13",
"h3-v2": "npm:h3@2.0.1-rc.11",
"seroval": "^1.4.2",
"tiny-invariant": "^1.3.3"
@@ -2715,12 +2715,12 @@
}
},
"node_modules/@tanstack/start-storage-context": {
"version": "1.157.16",
"resolved": "https://registry.npmjs.org/@tanstack/start-storage-context/-/start-storage-context-1.157.16.tgz",
"integrity": "sha512-56izE0oihAw2YRwYUEds2H+uO5dyT2CahXCgWX62+l+FHou09M9mSep68n1lBKPdphC2ZU3cPV7wnvgeraJWHg==",
"version": "1.157.13",
"resolved": "https://registry.npmjs.org/@tanstack/start-storage-context/-/start-storage-context-1.157.13.tgz",
"integrity": "sha512-ixx19ryrduKGbeh4x4Fcjt+MvtY0VdnISc4DACoP/iuRsgze9rzJmI3eEMLnsvXTK8eYfSvUOX9VaCS4AdxGtA==",
"license": "MIT",
"dependencies": {
"@tanstack/router-core": "1.157.16"
"@tanstack/router-core": "1.157.13"
},
"engines": {
"node": ">=22.12.0"
@@ -2754,22 +2754,22 @@
}
},
"node_modules/@trpc/client": {
"version": "11.9.0",
"resolved": "https://registry.npmjs.org/@trpc/client/-/client-11.9.0.tgz",
"integrity": "sha512-3r4RT/GbR263QO+2gCPyrs5fEYaXua3/AzCs+GbWC09X0F+mVkyBpO3GRSDObiNU/N1YB597U7WGW3WA1d1TVw==",
"version": "11.8.1",
"resolved": "https://registry.npmjs.org/@trpc/client/-/client-11.8.1.tgz",
"integrity": "sha512-L/SJFGanr9xGABmuDoeXR4xAdHJmsXsiF9OuH+apecJ+8sUITzVT1EPeqp0ebqA6lBhEl5pPfg3rngVhi/h60Q==",
"funding": [
"https://trpc.io/sponsor"
],
"license": "MIT",
"peerDependencies": {
"@trpc/server": "11.9.0",
"@trpc/server": "11.8.1",
"typescript": ">=5.7.2"
}
},
"node_modules/@trpc/server": {
"version": "11.9.0",
"resolved": "https://registry.npmjs.org/@trpc/server/-/server-11.9.0.tgz",
"integrity": "sha512-T8gC4NOCzx8tCsQEQ5sSjf24bN+9AEqXZRfpThG+YCEmcEwXfS7RP8VVrl5Vodt1S+zGEDyQSof4YVAj1zq/mg==",
"version": "11.8.1",
"resolved": "https://registry.npmjs.org/@trpc/server/-/server-11.8.1.tgz",
"integrity": "sha512-P4rzZRpEL7zDFgjxK65IdyH0e41FMFfTkQkuq0BA5tKcr7E6v9/v38DEklCpoDN6sPiB1Sigy/PUEzHENhswDA==",
"funding": [
"https://trpc.io/sponsor"
],
@@ -2933,9 +2933,9 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "25.1.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.1.0.tgz",
"integrity": "sha512-t7frlewr6+cbx+9Ohpl0NOTKXZNV9xHRmNOvql47BFJKcEG1CxtxlPEEe+gR9uhVWM4DwhnvTF110mIL4yP9RA==",
"version": "25.0.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.10.tgz",
"integrity": "sha512-zWW5KPngR/yvakJgGOmZ5vTBemDoSqF3AcV/LrO5u5wTWyEAVVh+IT39G4gtyAkh3CtTZs8aX/yRM82OfzHJRg==",
"devOptional": true,
"license": "MIT",
"dependencies": {
@@ -2943,9 +2943,9 @@
}
},
"node_modules/@types/react": {
"version": "19.2.10",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.10.tgz",
"integrity": "sha512-WPigyYuGhgZ/cTPRXB2EwUw+XvsRA3GqHlsP4qteqrnnjDrApbS7MxcGr/hke5iUoeB7E/gQtrs9I37zAJ0Vjw==",
"version": "19.2.9",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.9.tgz",
"integrity": "sha512-Lpo8kgb/igvMIPeNV2rsYKTgaORYdO1XGVZ4Qz3akwOj0ySGYMPlQWa8BaLn0G63D1aSaAQ5ldR06wCpChQCjA==",
"license": "MIT",
"peer": true,
"dependencies": {
@@ -3119,9 +3119,9 @@
}
},
"node_modules/baseline-browser-mapping": {
"version": "2.9.19",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.19.tgz",
"integrity": "sha512-ipDqC8FrAl/76p2SSWKSI+H9tFwm7vYqXQrItCuiVPt26Km0jS+NzSsBWAaBusvSbQcfJG+JitdMm+wZAgTYqg==",
"version": "2.9.18",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.18.tgz",
"integrity": "sha512-e23vBV1ZLfjb9apvfPk4rHVu2ry6RIr2Wfs+O324okSidrX7pTAnEJPCh/O5BtRlr7QtZI7ktOP3vsqr7Z5XoA==",
"license": "Apache-2.0",
"bin": {
"baseline-browser-mapping": "dist/cli.js"
@@ -3191,21 +3191,6 @@
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
}
},
"node_modules/bufferutil": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.1.0.tgz",
"integrity": "sha512-ZMANVnAixE6AWWnPzlW2KpUrxhm9woycYvPOo67jWHyFowASTEd9s+QN1EIMsSDtwhIxN4sWE1jotpuDUIgyIw==",
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"node-gyp-build": "^4.3.0"
},
"engines": {
"node": ">=6.14.2"
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001766",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001766.tgz",
@@ -3724,9 +3709,9 @@
}
},
"node_modules/electron-to-chromium": {
"version": "1.5.283",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.283.tgz",
"integrity": "sha512-3vifjt1HgrGW/h76UEeny+adYApveS9dH2h3p57JYzBSXJIKUJAvtmIytDKjcSCt9xHfrNCFJ7gts6vkhuq++w==",
"version": "1.5.278",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.278.tgz",
"integrity": "sha512-dQ0tM1svDRQOwxnXxm+twlGTjr9Upvt8UFWAgmLsxEzFQxhbti4VwxmMjsDxVC51Zo84swW7FVCXEV+VAkhuPw==",
"license": "ISC"
},
"node_modules/encoding-sniffer": {
@@ -3875,13 +3860,13 @@
}
},
"node_modules/framer-motion": {
"version": "12.29.2",
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.29.2.tgz",
"integrity": "sha512-lSNRzBJk4wuIy0emYQ/nfZ7eWhqud2umPKw2QAQki6uKhZPKm2hRQHeQoHTG9MIvfobb+A/LbEWPJU794ZUKrg==",
"version": "12.29.0",
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.29.0.tgz",
"integrity": "sha512-1gEFGXHYV2BD42ZPTFmSU9buehppU+bCuOnHU0AD18DKh9j4DuTx47MvqY5ax+NNWRtK32qIcJf1UxKo1WwjWg==",
"license": "MIT",
"dependencies": {
"motion-dom": "^12.29.2",
"motion-utils": "^12.29.2",
"motion-dom": "^12.29.0",
"motion-utils": "^12.27.2",
"tslib": "^2.4.0"
},
"peerDependencies": {
@@ -3925,9 +3910,9 @@
}
},
"node_modules/get-tsconfig": {
"version": "4.13.1",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.1.tgz",
"integrity": "sha512-EoY1N2xCn44xU6750Sx7OjOIT59FkmstNc3X6y5xpz7D5cBtZRe/3pSlTkDJgqsOk3WwZPkWfonhhUJfttQo3w==",
"version": "4.13.0",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.0.tgz",
"integrity": "sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ==",
"license": "MIT",
"dependencies": {
"resolve-pkg-maps": "^1.0.0"
@@ -4224,9 +4209,9 @@
}
},
"node_modules/isbot": {
"version": "5.1.34",
"resolved": "https://registry.npmjs.org/isbot/-/isbot-5.1.34.tgz",
"integrity": "sha512-aCMIBSKd/XPRYdiCQTLC8QHH4YT8B3JUADu+7COgYIZPvkeoMcUHMRjZLM9/7V8fCj+l7FSREc1lOPNjzogo/A==",
"version": "5.1.33",
"resolved": "https://registry.npmjs.org/isbot/-/isbot-5.1.33.tgz",
"integrity": "sha512-P4Hgb5NqswjkI0J1CM6XKXon/sxKY1SuowE7Qx2hrBhIwICFyXy54mfgB5eMHXsbe/eStzzpbIGNOvGmz+dlKg==",
"license": "Unlicense",
"engines": {
"node": ">=18"
@@ -5168,18 +5153,18 @@
"license": "MIT"
},
"node_modules/motion-dom": {
"version": "12.29.2",
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.29.2.tgz",
"integrity": "sha512-/k+NuycVV8pykxyiTCoFzIVLA95Nb1BFIVvfSu9L50/6K6qNeAYtkxXILy/LRutt7AzaYDc2myj0wkCVVYAPPA==",
"version": "12.29.0",
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.29.0.tgz",
"integrity": "sha512-3eiz9bb32yvY8Q6XNM4AwkSOBPgU//EIKTZwsSWgA9uzbPBhZJeScCVcBuwwYVqhfamewpv7ZNmVKTGp5qnzkA==",
"license": "MIT",
"dependencies": {
"motion-utils": "^12.29.2"
"motion-utils": "^12.27.2"
}
},
"node_modules/motion-utils": {
"version": "12.29.2",
"resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.29.2.tgz",
"integrity": "sha512-G3kc34H2cX2gI63RqU+cZq+zWRRPSsNIOjpdl9TN4AQwC4sgwYPl/Q/Obf/d53nOm569T0fYK+tcoSV50BWx8A==",
"version": "12.27.2",
"resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.27.2.tgz",
"integrity": "sha512-B55gcoL85Mcdt2IEStY5EEAsrMSVE2sI14xQ/uAdPL+mfQxhKKFaEag9JmfxedJOR4vZpBGoPeC/Gm13I/4g5Q==",
"license": "MIT"
},
"node_modules/ms": {
@@ -5263,36 +5248,6 @@
}
}
},
"node_modules/nitro/node_modules/chokidar": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz",
"integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"readdirp": "^5.0.0"
},
"engines": {
"node": ">= 20.19.0"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/nitro/node_modules/lru-cache": {
"version": "11.2.5",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.5.tgz",
"integrity": "sha512-vFrFJkWtJvJnD5hg+hJvVE8Lh/TcMzKnTgCWmtBipwI5yLX/iX+5UB2tfuyODF5E7k9xEzMdYgGqaSb1c0c5Yw==",
"dev": true,
"license": "BlueOak-1.0.0",
"optional": true,
"peer": true,
"engines": {
"node": "20 || >=22"
}
},
"node_modules/nitro/node_modules/readdirp": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.0.0.tgz",
@@ -5687,9 +5642,9 @@
}
},
"node_modules/react": {
"version": "19.2.4",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz",
"integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==",
"version": "19.2.3",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz",
"integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==",
"license": "MIT",
"peer": true,
"engines": {
@@ -5697,16 +5652,16 @@
}
},
"node_modules/react-dom": {
"version": "19.2.4",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz",
"integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==",
"version": "19.2.3",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz",
"integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==",
"license": "MIT",
"peer": true,
"dependencies": {
"scheduler": "^0.27.0"
},
"peerDependencies": {
"react": "^19.2.4"
"react": "^19.2.3"
}
},
"node_modules/react-markdown": {
@@ -5826,9 +5781,9 @@
}
},
"node_modules/rollup": {
"version": "4.57.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.57.1.tgz",
"integrity": "sha512-oQL6lgK3e2QZeQ7gcgIkS2YZPg5slw37hYufJ3edKlfQSGGm8ICoxswK15ntSzF/a8+h7ekRy7k7oWc3BQ7y8A==",
"version": "4.57.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.57.0.tgz",
"integrity": "sha512-e5lPJi/aui4TO1LpAXIRLySmwXSE8k3b9zoGfd42p67wzxog4WHjiZF3M2uheQih4DGyc25QEV4yRBbpueNiUA==",
"license": "MIT",
"peer": true,
"dependencies": {
@@ -5842,31 +5797,31 @@
"npm": ">=8.0.0"
},
"optionalDependencies": {
"@rollup/rollup-android-arm-eabi": "4.57.1",
"@rollup/rollup-android-arm64": "4.57.1",
"@rollup/rollup-darwin-arm64": "4.57.1",
"@rollup/rollup-darwin-x64": "4.57.1",
"@rollup/rollup-freebsd-arm64": "4.57.1",
"@rollup/rollup-freebsd-x64": "4.57.1",
"@rollup/rollup-linux-arm-gnueabihf": "4.57.1",
"@rollup/rollup-linux-arm-musleabihf": "4.57.1",
"@rollup/rollup-linux-arm64-gnu": "4.57.1",
"@rollup/rollup-linux-arm64-musl": "4.57.1",
"@rollup/rollup-linux-loong64-gnu": "4.57.1",
"@rollup/rollup-linux-loong64-musl": "4.57.1",
"@rollup/rollup-linux-ppc64-gnu": "4.57.1",
"@rollup/rollup-linux-ppc64-musl": "4.57.1",
"@rollup/rollup-linux-riscv64-gnu": "4.57.1",
"@rollup/rollup-linux-riscv64-musl": "4.57.1",
"@rollup/rollup-linux-s390x-gnu": "4.57.1",
"@rollup/rollup-linux-x64-gnu": "4.57.1",
"@rollup/rollup-linux-x64-musl": "4.57.1",
"@rollup/rollup-openbsd-x64": "4.57.1",
"@rollup/rollup-openharmony-arm64": "4.57.1",
"@rollup/rollup-win32-arm64-msvc": "4.57.1",
"@rollup/rollup-win32-ia32-msvc": "4.57.1",
"@rollup/rollup-win32-x64-gnu": "4.57.1",
"@rollup/rollup-win32-x64-msvc": "4.57.1",
"@rollup/rollup-android-arm-eabi": "4.57.0",
"@rollup/rollup-android-arm64": "4.57.0",
"@rollup/rollup-darwin-arm64": "4.57.0",
"@rollup/rollup-darwin-x64": "4.57.0",
"@rollup/rollup-freebsd-arm64": "4.57.0",
"@rollup/rollup-freebsd-x64": "4.57.0",
"@rollup/rollup-linux-arm-gnueabihf": "4.57.0",
"@rollup/rollup-linux-arm-musleabihf": "4.57.0",
"@rollup/rollup-linux-arm64-gnu": "4.57.0",
"@rollup/rollup-linux-arm64-musl": "4.57.0",
"@rollup/rollup-linux-loong64-gnu": "4.57.0",
"@rollup/rollup-linux-loong64-musl": "4.57.0",
"@rollup/rollup-linux-ppc64-gnu": "4.57.0",
"@rollup/rollup-linux-ppc64-musl": "4.57.0",
"@rollup/rollup-linux-riscv64-gnu": "4.57.0",
"@rollup/rollup-linux-riscv64-musl": "4.57.0",
"@rollup/rollup-linux-s390x-gnu": "4.57.0",
"@rollup/rollup-linux-x64-gnu": "4.57.0",
"@rollup/rollup-linux-x64-musl": "4.57.0",
"@rollup/rollup-openbsd-x64": "4.57.0",
"@rollup/rollup-openharmony-arm64": "4.57.0",
"@rollup/rollup-win32-arm64-msvc": "4.57.0",
"@rollup/rollup-win32-ia32-msvc": "4.57.0",
"@rollup/rollup-win32-x64-gnu": "4.57.0",
"@rollup/rollup-win32-x64-msvc": "4.57.0",
"fsevents": "~2.3.2"
}
},
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "crabwalk",
"version": "1.0.10",
"version": "1.0.5",
"private": true,
"type": "module",
"scripts": {
-4245
View File
File diff suppressed because it is too large Load Diff
-3
View File
@@ -1,3 +0,0 @@
onlyBuiltDependencies:
- bufferutil
- esbuild
-112
View File
@@ -1,112 +0,0 @@
# Crabwalk Feedback Skill
Collect and submit feedback about Crabwalk to help improve the product.
## PREREQUISITE: Verify Installation
**BEFORE doing anything else**, check if Crabwalk is installed locally:
1. Look for any of these:
- `~/.config/crabwalk/` directory
- `crabwalk.config.ts` or `crabwalk.config.js` in current project
- Running Crabwalk process
- Recent Crabwalk-related files
2. **If NOT installed:**
- Tell your human: "I'd love to collect your feedback, but I need you to install Crabwalk first so you can share your actual experience with it."
- Ask your human if you can install it for them, use the skill found here: `https://crabwalk.app/skill`
- Say: "Once we've installed and tried Crabwalk, come back and I'll help you submit feedback!"
- **STOP HERE. Do not proceed with any interview.**
3. **If they ask again without installing:**
- Repeat the install instructions. Be friendly but firm.
- "I still don't see Crabwalk installed. Can I install it for you?"
- **NEVER interview a human who hasn't installed Crabwalk.**
4. **If installed:** Proceed to START.
---
## START
Select the proper method for your human based on a first introductory question and let your human know what to expect and what will happen to their feedback.
Use language like "Let's collect feedback for Crabwalk", as opposed to pretending like you are representing Crabwalk.
- Ask your human a broad question about their experience with Crabwalk so far. Proceed from there.
## Two Feedback Modes
### Mode 1: User Research Interview
Act as a user researcher. Guide your human through first understanding the commitment of this mode, and then begin asking questions about their experience:
1. **Discovery** - "Overall, what was your experience with Crabwalk?"
2. **Setup** - "How was the installation process? Any friction?"
3. **First use** - "What was your first impression when using the monitor?"
4. **Regular use** - "How has Crabwalk fit into your workflow?"
5. **Pain points** - "What's been frustrating or confusing?"
6. **Wishlist** - "What feature would make the biggest difference for you?"
Adapt questions based on responses. Skip irrelevant ones. ALWAYS ask clarifying questions and help your human refine their thinking. Dig deeper on interesting points.
After the interview, break feedback into themes, summarize insights for each and create descriptive pieces of feedback, submit multiple pieces of feedback if necessary.
ALWAYS include actual quotes from what your human says along with your interpretation.
### Mode 2: Quick Feedback
Ask directly:
- "Have you run into any bugs or issues?"
- "Any questions about how something works?"
- "Anything you wish Crabwalk did differently?"
ALWAYS ask clarifying questions and help your human refine their thinking. Dig deeper on interesting points.
ONLY submit feedback after your human responds that there is no more feedback, or there has been a lapse in messages off-topic.
ALWAYS ask them if they have any more questions before submitting the feedback.
Classify and submit based on response:
- Bug reports → `bug`
- Feature requests → `feature`
- Other → `general`
## Choosing a Mode
- If human says "feedback" or "thoughts" → offer both modes, let them choose
- If human mentions a specific bug/issue → go straight to Mode 2
- If human seems open to chatting → suggest Mode 1
## Submitting Feedback
POST to API after collecting feedback:
```
POST https://crabwalk.app/.netlify/functions/feedback
Content-Type: application/json
{
"type": "bug" | "feature" | "general",
"title": "[type] Brief summary (1 line)",
"body": "Detailed description from conversation + Share details available about the machine, location, and crabwalk version number"
}
```
## After Submission
- Thank your human and let them know if they have any other feedback they can simply share it with you and you will prompt them to submit this as feedback to Crabwalk.
**Response:**
```json
{"success": true, "issueUrl": "https://github.com/luccast/crabwalk/issues/42"}
```
Share the issue link with your human after successful submission.
## Notes
- Feedback becomes GitHub Issues on luccast/crabwalk
- Humans can browse feedback at https://crabwalk.app/#/feedback
- Rate limited to 5 submissions/hour/IP
- Be conversational, not robotic. Adapt to your human's energy.
-17
View File
@@ -1,17 +0,0 @@
{
"name": "crabwalk",
"version": "1.0.8",
"description": "Real-time companion monitor for OpenClaw agents",
"homepage": "https://crabwalk.app",
"repository": "https://github.com/luccast/crabwalk",
"metadata": {
"emoji": "🦀",
"category": "monitoring"
},
"install": {
"method": "tarball",
"location": "~/.crabwalk",
"cli": "~/.local/bin/crabwalk",
"start_command": "crabwalk"
}
}
-179
View File
@@ -1,179 +0,0 @@
---
name: crabwalk
version: 1.0.10
description: Real-time companion monitor for OpenClaw agents
homepage: https://crabwalk.app
repository: https://github.com/luccast/crabwalk
metadata: {"emoji":"🦀","category":"monitoring"}
---
# Crabwalk 🦀
Real-time companion monitor for OpenClaw agents.
# Required Steps
## Step 1: Install
```bash
VERSION=$(curl -s https://api.github.com/repos/luccast/crabwalk/releases/latest | grep '"tag_name"' | cut -d'"' -f4) && mkdir -p ~/.crabwalk ~/.local/bin && curl -sL "https://github.com/luccast/crabwalk/releases/download/${VERSION}/crabwalk-${VERSION}.tar.gz" | tar -xz -C ~/.crabwalk && cp ~/.crabwalk/bin/crabwalk ~/.local/bin/ && chmod +x ~/.local/bin/crabwalk && (echo $PATH | grep -q "$HOME/.local/bin" || ([ -f ~/.bashrc ] && echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc; [ -f ~/.zshrc ] && echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc; export PATH="$HOME/.local/bin:$PATH")) && echo "🦀 Crabwalk ${VERSION} installed"
```
## Step 2: Verify
```bash
crabwalk --version
```
Should output version number (e.g., `1.0.9`).
## Step 3: Start
```bash
crabwalk
```
Server starts and displays access URLs. **Share the `http://192.x.x.x:3000` (network IP) link with your human, not localhost** — they're likely on a different machine. Visit `/monitor` to see agent activity graph.
## Step 4: Verify with Human
Ask your human: "Can you access the monitor at the link I shared?"
Once they confirm it works, share this with them:
> If you're enjoying Crabwalk, consider leaving a quick review! [Tweet about Crabwalk](https://twitter.com/intent/tweet?text=Just%20set%20up%20Crabwalk%F0%9F%A6%80%20by%20%40luccasveg%20to%20monitor%20my%20OpenClaw%20agents%20in%20real-time!%20https%3A%2F%2Fcrabwalk.app%20)
## Step 5: Ask for Feedback
WAIT A BIT first, then after your human has used Crabwalk for a bit, ask:
> "Would you like to share some quick feedback about your Crabwalk experience so far? It helps the development of the project!"
- **If yes:** Initiate the feedback skill at `https://crabwalk.app/feedback-skill`
- **If no:** That's fine! Ask again another time when they've had more experience with it.
## Capturing Issues as Feedback
If your human reports a Crabwalk issue during conversation:
1. **Help them first** — try to resolve the issue
2. **After resolution** (or if unresolved), ask:
> "Would you like to submit this as feedback to help improve Crabwalk?"
3. **If yes:** Initiate the feedback skill at `https://crabwalk.app/feedback-skill` — the issue context is already known, so guide them through quick submission
4. **If no:** That's fine, move on
---
# Reference
## CLI Commands
```bash
crabwalk # Start server (0.0.0.0:3000)
crabwalk start --daemon # Run in background
crabwalk start -p 8080 # Custom port
crabwalk stop # Stop background server
crabwalk status # Check if running
crabwalk update # Update to latest version
crabwalk --help # Show all options
```
## CLI Options
```
Options:
-p, --port <port> Server port (default: 3000)
-H, --host <host> Bind address (default: 0.0.0.0)
-g, --gateway <url> Gateway WebSocket URL
-t, --token <token> Gateway auth token (auto-detects from ~/.openclaw/openclaw.json)
-d, --daemon Run in background
-v, --version Show version
-h, --help Show help
```
## Features
- `/monitor` — Real-time agent activity graph (ReactFlow)
- `/workspace` — File browser and markdown viewer
- Auto-detects gateway token from OpenClaw config
## Requirements
- Node.js 20+
- OpenClaw gateway running on `ws://127.0.0.1:18789`
- `qrencode` (optional, for QR code display)
## Updating
**IMPORTANT: Always ask user permission before updating.**
If update available, ask user:
> "Crabwalk update available (X.X.X -> Y.Y.Y). See release: https://github.com/luccast/crabwalk/releases/tag/vY.Y.Y — Update now?"
Only proceed if user confirms. Run:
```bash
crabwalk update
```
## Install Script (Expanded)
```bash
# Download latest release
VERSION=$(curl -s https://api.github.com/repos/luccast/crabwalk/releases/latest | grep '"tag_name"' | cut -d'"' -f4)
mkdir -p ~/.crabwalk
curl -sL "https://github.com/luccast/crabwalk/releases/download/${VERSION}/crabwalk-${VERSION}.tar.gz" | tar -xz -C ~/.crabwalk
# Install CLI
mkdir -p ~/.local/bin
cp ~/.crabwalk/bin/crabwalk ~/.local/bin/crabwalk
chmod +x ~/.local/bin/crabwalk
# Add to PATH if needed
if ! echo $PATH | grep -q "$HOME/.local/bin"; then
[ -f ~/.bashrc ] && echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
[ -f ~/.zshrc ] && echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
export PATH="$HOME/.local/bin:$PATH"
fi
```
## Manual Update
If `crabwalk update` fails:
```bash
VERSION=$(curl -s https://api.github.com/repos/luccast/crabwalk/releases/latest | grep '"tag_name"' | cut -d'"' -f4)
rm -rf ~/.crabwalk/.output
curl -sL "https://github.com/luccast/crabwalk/releases/download/${VERSION}/crabwalk-${VERSION}.tar.gz" | tar -xz -C ~/.crabwalk
cp ~/.crabwalk/bin/crabwalk ~/.local/bin/crabwalk
echo "🦀 Updated to ${VERSION}"
```
---
## Resources
- **Submit Feedback**: `https://crabwalk.app/feedback-skill` — Help improve Crabwalk by sharing your experience
- **Browse Feedback**: `https://crabwalk.app/#/feedback` — See what others are saying
## Optional: QR Code Display
Install `qrencode` to display QR codes for easy mobile access:
```bash
# macOS
brew install qrencode
# Debian/Ubuntu
sudo apt install qrencode
# Fedora
sudo dnf install qrencode
# Arch
sudo pacman -S qrencode
```
---
Repository: https://github.com/luccast/crabwalk
+71 -16
View File
@@ -1,4 +1,4 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useCallback, useEffect, useMemo, useRef, useState, useTransition } from 'react'
import {
ReactFlow,
Background,
@@ -15,7 +15,7 @@ import {
MarkerType,
ReactFlowProvider,
} from '@xyflow/react'
import { LayoutGrid, ArrowRightLeft, ArrowUpDown, Crosshair } from 'lucide-react'
import { LayoutGrid, ArrowRightLeft, ArrowUpDown, Crosshair, Loader2 } from 'lucide-react'
import '@xyflow/react/dist/style.css'
import { SessionNode } from './SessionNode'
import { ActionNode } from './ActionNode'
@@ -27,7 +27,7 @@ import type {
MonitorSession,
MonitorAction,
MonitorExecProcess,
} from '~/integrations/openclaw'
} from '~/integrations/clawdbot'
interface ActionGraphProps {
sessions: MonitorSession[]
@@ -35,6 +35,7 @@ interface ActionGraphProps {
execs: MonitorExecProcess[]
selectedSession: string | null
onSessionSelect: (key: string | null) => void
isHydrating?: boolean
}
/** Cast domain data to ReactFlow's Node data type */
@@ -82,6 +83,7 @@ function ActionGraphInner({
execs,
selectedSession,
onSessionSelect,
isHydrating = false,
}: ActionGraphProps) {
// Crab AI state
const crabRef = useRef<CrabAI>({
@@ -106,6 +108,10 @@ function ActionGraphInner({
const [followMode, setFollowMode] = useState(false)
const isAnimatingRef = useRef(false)
// Transition for large graph layout calculations
const [isPending, startTransition] = useTransition()
const [asyncLayoutResult, setAsyncLayoutResult] = useState<{ nodes: Node[]; edges: Edge[] } | null>(null)
// Get ReactFlow instance for viewport control
const { setCenter } = useReactFlow()
@@ -358,23 +364,52 @@ function ActionGraphInner({
return edges
}, [sessions, visibleActions, visibleExecs, selectedSession])
// Apply layout
const { nodes: layoutedNodes, edges: layoutedEdges } = useMemo(() => {
if (rawNodes.length === 1) {
return {
nodes: [{ ...rawNodes[0]!, position: { x: 0, y: 0 } }],
edges: [],
// Apply layout - fast path for small graphs, transition for large graphs
const LARGE_GRAPH_THRESHOLD = 100
// Fast path for small graphs (synchronous)
const immediateLayout = useMemo(() => {
if (rawNodes.length < LARGE_GRAPH_THRESHOLD) {
if (rawNodes.length === 1) {
return {
nodes: [{ ...rawNodes[0]!, position: { x: 0, y: 0 } }],
edges: [],
}
}
return layoutGraph(rawNodes, rawEdges, {
direction: layoutDirection,
nodeWidth: 200,
nodeHeight: 80,
rankSep: 60,
nodeSep: 30,
})
}
return layoutGraph(rawNodes, rawEdges, {
direction: layoutDirection,
nodeWidth: 200,
nodeHeight: 80,
rankSep: 60,
nodeSep: 30,
})
return null
}, [rawNodes, rawEdges, layoutDirection])
// Async path for large graphs (uses transition to keep UI responsive)
useEffect(() => {
if (rawNodes.length >= LARGE_GRAPH_THRESHOLD) {
startTransition(() => {
const result = layoutGraph(rawNodes, rawEdges, {
direction: layoutDirection,
nodeWidth: 200,
nodeHeight: 80,
rankSep: 60,
nodeSep: 30,
})
setAsyncLayoutResult(result)
})
} else {
// Clear async result when switching to small graph
setAsyncLayoutResult(null)
}
}, [rawNodes, rawEdges, layoutDirection])
// Use whichever result is available
const layoutedNodes = immediateLayout?.nodes ?? asyncLayoutResult?.nodes ?? []
const layoutedEdges = immediateLayout?.edges ?? asyncLayoutResult?.edges ?? []
// Initial nodes with chaser (click handler added later)
const initialNodes = useMemo(() => {
const crab = crabRef.current
@@ -817,6 +852,26 @@ function ActionGraphInner({
<LayoutGrid className="w-4 h-4" />
</button>
</div>
{/* Loading overlay for layout calculation */}
{isPending && (
<div className="absolute inset-0 z-50 flex items-center justify-center bg-shell-950/80 backdrop-blur-sm">
<div className="flex flex-col items-center gap-3">
<Loader2 className="w-8 h-8 animate-spin text-neon-cyan" />
<span className="font-mono text-sm text-gray-400">
Calculating layout for {rawNodes.length.toLocaleString()} nodes...
</span>
</div>
</div>
)}
{/* Loading overlay for initial hydration */}
{isHydrating && layoutedNodes.length === 0 && (
<div className="absolute inset-0 z-50 flex items-center justify-center bg-shell-950">
<div className="flex flex-col items-center gap-3">
<Loader2 className="w-8 h-8 animate-spin text-neon-cyan" />
<span className="font-mono text-sm text-gray-400">Loading graph data...</span>
</div>
</div>
)}
<MiniMap
nodeColor={(node) => {
if (node.type === 'crab') return '#ef4444'
+1 -1
View File
@@ -11,7 +11,7 @@ import {
MessageCircle,
Bot,
} from 'lucide-react'
import type { MonitorAction } from '~/integrations/openclaw'
import type { MonitorAction } from '~/integrations/clawdbot'
interface ActionNodeProps {
data: MonitorAction
+1 -1
View File
@@ -2,7 +2,7 @@ import { memo, useCallback, useMemo, useState } from 'react'
import { Handle, Position } from '@xyflow/react'
import { motion, AnimatePresence } from 'framer-motion'
import { CheckCircle, Copy, Check, Loader2, Terminal, XCircle } from 'lucide-react'
import type { MonitorExecProcess, MonitorExecOutputChunk } from '~/integrations/openclaw'
import type { MonitorExecProcess, MonitorExecOutputChunk } from '~/integrations/clawdbot'
interface ExecNodeProps {
data: MonitorExecProcess
@@ -1,87 +0,0 @@
import { motion } from 'framer-motion'
import { PanelLeft, Settings, Trash2 } from 'lucide-react'
import { StatusIndicator } from './StatusIndicator'
interface MobileMonitorToolbarProps {
onOpenDrawer: () => void
onOpenSettings: () => void
connected: boolean
connecting: boolean
sessionCount: number
actionCount: number
completedCount: number
onClearCompleted: () => void
}
export function MobileMonitorToolbar({
onOpenDrawer,
onOpenSettings,
connected,
connecting,
sessionCount,
actionCount,
completedCount,
onClearCompleted,
}: MobileMonitorToolbarProps) {
return (
<motion.div
initial={{ y: 100 }}
animate={{ y: 0 }}
transition={{ duration: 0.2, ease: 'easeOut' }}
className="fixed bottom-0 left-0 right-0 z-40 sm:hidden"
>
<div className="bg-shell-900 border-t border-shell-800 px-3 pt-3 pb-3.5">
<div className="flex items-center gap-2">
{/* Sessions button */}
<button
onClick={onOpenDrawer}
className="relative p-3 min-w-[48px] min-h-[48px] rounded-lg active:bg-shell-800 text-gray-400 active:text-crab-400 transition-colors"
>
<PanelLeft size={22} />
{sessionCount > 0 && (
<span className="absolute top-1.5 right-1.5 min-w-[18px] h-[18px] px-1 flex items-center justify-center bg-crab-600 text-white text-[10px] font-display rounded-full">
{sessionCount > 99 ? '99+' : sessionCount}
</span>
)}
</button>
{/* Stats display */}
<div className="flex-1 flex items-center justify-center gap-4 px-3 py-2 bg-shell-800/50 rounded-lg min-h-[44px]">
<div className="flex items-center gap-2">
<StatusIndicator status={connecting ? 'thinking' : connected ? 'active' : 'idle'} size="sm" />
<span className="font-console text-xs text-shell-400">
{connecting ? 'connecting' : connected ? 'connected' : 'offline'}
</span>
</div>
<div className="w-px h-4 bg-shell-700" />
<div className="flex items-center gap-1.5">
<span className="font-display text-sm text-neon-peach">{actionCount}</span>
<span className="font-console text-[10px] text-shell-500 uppercase">acts</span>
</div>
</div>
{/* Clear completed button */}
{completedCount > 0 && (
<button
onClick={onClearCompleted}
className="relative p-3 min-w-[48px] min-h-[48px] rounded-lg active:bg-shell-800 text-gray-400 active:text-crab-400 transition-colors"
>
<Trash2 size={22} />
<span className="absolute top-1.5 right-1.5 min-w-[18px] h-[18px] px-1 flex items-center justify-center bg-shell-700 text-shell-300 text-[10px] font-display rounded-full">
{completedCount > 99 ? '99+' : completedCount}
</span>
</button>
)}
{/* Settings button */}
<button
onClick={onOpenSettings}
className="p-3 min-w-[48px] min-h-[48px] rounded-lg active:bg-shell-800 text-gray-400 active:text-crab-400 transition-colors"
>
<Settings size={22} />
</button>
</div>
</div>
</motion.div>
)
}
@@ -1,374 +0,0 @@
import { useMemo, useState } from 'react'
import { motion, AnimatePresence } from 'framer-motion'
import { X, Users, ChevronDown, Github, Search } from 'lucide-react'
import { StatusIndicator } from './StatusIndicator'
import type { MonitorSession } from '~/integrations/openclaw'
function isSubagent(session: MonitorSession): boolean {
return Boolean(session.spawnedBy) || session.platform === 'subagent' || session.key.includes('subagent')
}
function XIcon({ size = 14, className }: { size?: number; className?: string }) {
return (
<svg
className={['footer-icon-x', className].filter(Boolean).join(' ')}
width={size}
height={size}
viewBox="0 0 16 16"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
>
<path d="M12.6.75h2.454l-5.36 6.142L16 15.25h-4.937l-3.867-5.07-4.425 5.07H.316l5.733-6.57L0 .75h5.063l3.495 4.633L12.601.75Zm-.86 13.028h1.36L4.323 2.145H2.865z" />
</svg>
)
}
const platformEmoji: Record<string, string> = {
whatsapp: '💬',
telegram: '✈️',
discord: '🎮',
slack: '💼',
}
interface MobileSessionDrawerProps {
open: boolean
onClose: () => void
sessions: MonitorSession[]
selectedKey: string | null
onSelect: (key: string) => void
}
function SubagentItem({
session,
selected,
onSelect,
}: {
session: MonitorSession
selected: boolean
onSelect: (key: string) => void
}) {
return (
<button
onClick={() => onSelect(session.key)}
className={`w-full text-left py-3 pr-4 pl-8 border-b border-shell-800/50 transition-all duration-150 ${
selected
? 'bg-neon-cyan/5 border-l-2 border-l-neon-cyan'
: 'active:bg-shell-800/30 border-l-2 border-l-transparent'
}`}
>
<div className="font-display text-[9px] font-medium text-neon-cyan/60 uppercase tracking-widest mb-1">
subagent
</div>
<div className="flex items-center gap-3">
<span className="text-base">🤖</span>
<span className="font-console text-sm text-shell-400 truncate flex-1">
{session.recipient}
</span>
<StatusIndicator status={session.status} size="sm" />
</div>
</button>
)
}
export function MobileSessionDrawer({
open,
onClose,
sessions,
selectedKey,
onSelect,
}: MobileSessionDrawerProps) {
const [filter, setFilter] = useState('')
const [platformFilter, setPlatformFilter] = useState<string | null>(null)
const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(new Set())
const parentSessions = sessions.filter((s) => !isSubagent(s))
const platforms = [...new Set(parentSessions.map((s) => s.platform))]
const filteredParents = parentSessions.filter((session) => {
const matchesText =
!filter ||
session.recipient.toLowerCase().includes(filter.toLowerCase()) ||
session.agentId.toLowerCase().includes(filter.toLowerCase())
const matchesPlatform = !platformFilter || session.platform === platformFilter
return matchesText && matchesPlatform
})
const sortedParents = [...filteredParents].sort((a, b) => {
if (a.status !== 'idle' && b.status === 'idle') return -1
if (a.status === 'idle' && b.status !== 'idle') return 1
return b.lastActivityAt - a.lastActivityAt
})
const { subagentsByParent, orphanSubagents } = useMemo(() => {
const byParent = new Map<string, MonitorSession[]>()
const orphans: MonitorSession[] = []
const parentKeys = new Set(parentSessions.map((s) => s.key))
for (const session of sessions) {
if (!isSubagent(session)) continue
const matchesFilter =
!filter ||
session.agentId.toLowerCase().includes(filter.toLowerCase()) ||
'subagent'.includes(filter.toLowerCase())
if (!matchesFilter) continue
if (session.spawnedBy && parentKeys.has(session.spawnedBy)) {
const list = byParent.get(session.spawnedBy) ?? []
list.push(session)
byParent.set(session.spawnedBy, list)
} else {
orphans.push(session)
}
}
for (const [key, list] of byParent) {
list.sort((a, b) => b.lastActivityAt - a.lastActivityAt)
byParent.set(key, list)
}
orphans.sort((a, b) => b.lastActivityAt - a.lastActivityAt)
return { subagentsByParent: byParent, orphanSubagents: orphans }
}, [sessions, parentSessions, filter])
const handleSelect = (key: string) => {
onSelect(key)
onClose()
}
return (
<AnimatePresence>
{open && (
<>
{/* Backdrop */}
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
onClick={onClose}
className="fixed inset-0 bg-black/70 backdrop-blur-sm z-40"
/>
{/* Sheet - slides up from bottom */}
<motion.div
initial={{ y: '100%' }}
animate={{ y: 0 }}
exit={{ y: '100%' }}
transition={{ type: 'spring', damping: 28, stiffness: 280 }}
className="fixed inset-x-0 bottom-0 z-50 flex flex-col bg-shell-900 rounded-t-2xl max-h-[85vh]"
style={{ paddingBottom: 'env(safe-area-inset-bottom)' }}
>
{/* Drag handle */}
<div className="flex justify-center pt-3 pb-2">
<div className="w-10 h-1 rounded-full bg-shell-600" />
</div>
{/* Header */}
<div className="flex items-center justify-between px-4 pb-3 border-b border-shell-800">
<h2 className="font-mono uppercase text-sm text-crab-400 tracking-wider">
Sessions
</h2>
<button
onClick={onClose}
className="p-2 -mr-2 active:bg-shell-800 rounded-lg transition-colors"
>
<X size={24} className="text-gray-400" />
</button>
</div>
{/* Search */}
<div className="px-4 py-3 border-b border-shell-800">
<div className="relative">
<Search size={16} className="absolute left-3 top-1/2 -translate-y-1/2 text-shell-500" />
<input
type="text"
placeholder="Filter sessions..."
value={filter}
onChange={(e) => setFilter(e.target.value)}
className="w-full bg-shell-800 border border-shell-700 rounded-lg pl-9 pr-3 py-2.5 text-sm font-console text-gray-200 placeholder-shell-500 focus:outline-none focus:border-crab-500"
/>
</div>
{/* Platform filters */}
{platforms.length > 1 && (
<div className="flex gap-2 mt-3 flex-wrap">
<button
onClick={() => setPlatformFilter(null)}
className={`px-3 py-1.5 text-xs font-display uppercase tracking-wide rounded-lg border transition-all ${
!platformFilter
? 'bg-crab-600 border-crab-500 text-white'
: 'bg-shell-800 border-shell-700 text-gray-400 active:border-shell-600'
}`}
>
All
</button>
{platforms.map((p) => (
<button
key={p}
onClick={() => setPlatformFilter(p)}
className={`px-3 py-1.5 text-xs font-display uppercase tracking-wide rounded-lg border transition-all ${
platformFilter === p
? 'bg-crab-600 border-crab-500 text-white'
: 'bg-shell-800 border-shell-700 text-gray-400 active:border-shell-600'
}`}
>
{platformEmoji[p] || '📱'} {p}
</button>
))}
</div>
)}
</div>
{/* Session list */}
<div className="flex-1 overflow-y-auto overscroll-contain">
<AnimatePresence mode="sync">
{sortedParents.map((session) => (
<motion.div
key={session.key}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
>
<button
onClick={() => handleSelect(session.key)}
className={`w-full text-left p-4 border-b border-shell-800 transition-all duration-150 ${
selectedKey === session.key
? 'bg-crab-900/20 border-l-2 border-l-crab-500'
: 'active:bg-shell-800/50 border-l-2 border-l-transparent'
}`}
>
<div className="font-display text-[9px] font-medium text-shell-500 uppercase tracking-widest mb-1">
main
</div>
<div className="flex items-center gap-3 mb-2">
<span className="text-xl">
{platformEmoji[session.platform] || '📱'}
</span>
<span className="font-display text-sm font-medium text-gray-200 truncate flex-1 uppercase tracking-wide">
{session.recipient}
</span>
<StatusIndicator status={session.status} size="sm" />
</div>
<div className="flex items-center gap-2">
<span className="font-console text-xs text-shell-500 truncate flex-1">
{session.agentId}
</span>
{session.isGroup && (
<span className="flex items-center gap-1 px-2 py-0.5 bg-shell-800 border border-shell-700 rounded text-xs text-shell-400">
<Users size={12} />
group
</span>
)}
</div>
</button>
{/* Nested subagents */}
{(() => {
const subs = subagentsByParent.get(session.key)
if (!subs?.length) return null
const isGroupCollapsed = collapsedGroups.has(session.key)
return (
<>
<button
onClick={(e) => {
e.stopPropagation()
setCollapsedGroups((prev) => {
const next = new Set(prev)
if (next.has(session.key)) next.delete(session.key)
else next.add(session.key)
return next
})
}}
className="w-full px-4 py-2 text-left flex items-center gap-2 text-xs font-display uppercase tracking-widest text-shell-500 active:text-shell-300 active:bg-shell-800/30 border-b border-shell-800/50"
>
<ChevronDown
size={16}
className={`transition-transform ${isGroupCollapsed ? '-rotate-90' : ''}`}
/>
<span>
{subs.length} subagent{subs.length > 1 ? 's' : ''}
</span>
</button>
<motion.div
initial={false}
animate={{
height: isGroupCollapsed ? 0 : 'auto',
opacity: isGroupCollapsed ? 0 : 1,
}}
transition={{ duration: 0.15, ease: 'easeInOut' }}
className="overflow-hidden"
>
{subs.map((sub) => (
<SubagentItem
key={sub.key}
session={sub}
selected={selectedKey === sub.key}
onSelect={handleSelect}
/>
))}
</motion.div>
</>
)
})()}
</motion.div>
))}
{/* Orphan subagents */}
{orphanSubagents.map((sub) => (
<motion.div
key={sub.key}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
>
<SubagentItem
session={sub}
selected={selectedKey === sub.key}
onSelect={handleSelect}
/>
</motion.div>
))}
</AnimatePresence>
{sortedParents.length === 0 && orphanSubagents.length === 0 && (
<div className="p-8 text-center">
<div className="font-console text-sm text-shell-500">
<span className="text-crab-600">&gt;</span> no sessions found
</div>
</div>
)}
</div>
{/* Footer */}
<div className="px-4 py-3 border-t border-shell-800 bg-shell-950/50">
<div className="font-console text-xs text-shell-500 text-center flex items-center justify-center gap-6">
<a
href="https://github.com/luccast/crabwalk"
target="_blank"
rel="noreferrer"
className="inline-flex items-center gap-1.5 text-shell-500 active:text-crab-500 transition-colors"
>
<Github size={14} />
<span>Github</span>
</a>
<a
href="https://x.com/luccasveg"
target="_blank"
rel="noreferrer"
className="inline-flex items-center gap-1.5 text-shell-500 active:text-crab-500 transition-colors"
>
<XIcon size={14} />
<span>@luccasveg</span>
</a>
</div>
</div>
</motion.div>
</>
)}
</AnimatePresence>
)
}
+76 -92
View File
@@ -2,7 +2,7 @@ import { useMemo, useState } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { Users, ChevronLeft, ChevronRight, ChevronDown, Github } from "lucide-react";
import { StatusIndicator } from "./StatusIndicator";
import type { MonitorSession } from "~/integrations/openclaw";
import type { MonitorSession } from "~/integrations/clawdbot";
function isSubagent(session: MonitorSession): boolean {
return Boolean(session.spawnedBy) || session.platform === "subagent" || session.key.includes("subagent");
@@ -57,7 +57,9 @@ function SubagentItem({
onSelect: (key: string) => void;
}) {
return (
<button
<motion.button
initial={false}
animate={{ opacity: 1 }}
onClick={() => onSelect(session.key)}
className={`w-full text-left border-b border-shell-800/50 transition-all duration-150 group ${
collapsed ? "p-2" : "py-2 pr-3 pl-6"
@@ -87,7 +89,7 @@ function SubagentItem({
</div>
</>
)}
</button>
</motion.button>
);
}
@@ -166,18 +168,16 @@ export function SessionList({
<div className="absolute inset-0 texture-scanlines pointer-events-none opacity-50" />
{/* Header */}
<div className="relative p-3 bg-shell-950/50 overflow-hidden">
<div className={`flex items-center mb-3 ${collapsed ? "justify-center" : "justify-between"}`}>
<h2
className={`font-mono uppercase text-sm text-crab-400 glow-red tracking-wider ml-1 transition-opacity duration-200 ${
collapsed ? "opacity-0 absolute pointer-events-none" : "opacity-100"
}`}
>
Sessions
</h2>
<div className="relative p-3 bg-shell-950/50">
<div className={`flex items-center justify-between ${collapsed ? "" : "mb-3"}`}>
{!collapsed && (
<h2 className="font-mono uppercase text-sm text-crab-400 glow-red tracking-wider ml-1">
Sessions
</h2>
)}
<button
onClick={onToggleCollapse}
className="p-1.5 hover:bg-shell-800 rounded transition-all"
className={`p-1.5 hover:bg-shell-800 rounded transition-all ${collapsed ? "mx-auto" : ""}`}
title={collapsed ? "Expand sidebar" : "Collapse sidebar"}
>
{collapsed ? (
@@ -188,68 +188,61 @@ export function SessionList({
</button>
</div>
{/* Search input - fades when collapsed */}
<div
className={`transition-all duration-200 ${
collapsed ? "opacity-0 h-0 overflow-hidden" : "opacity-100"
}`}
>
<div className="relative">
<input
type="text"
placeholder="Filter sessions..."
value={filter}
onChange={(e) => setFilter(e.target.value)}
className="input-retro w-full pl-9 pr-3 py-2 text-xs"
tabIndex={collapsed ? -1 : 0}
/>
</div>
{/* Search input - hidden when collapsed */}
{!collapsed && (
<>
<div className="relative">
<input
type="text"
placeholder="Filter sessions..."
value={filter}
onChange={(e) => setFilter(e.target.value)}
className="input-retro w-full pl-9 pr-3 py-2 text-xs"
/>
</div>
{/* Platform filters */}
{platforms.length > 1 && (
<div className="flex gap-1.5 mt-3 flex-wrap">
<button
onClick={() => setPlatformFilter(null)}
tabIndex={collapsed ? -1 : 0}
className={`px-2.5 py-1 text-[11px] font-display uppercase tracking-wide rounded border transition-all ${
!platformFilter
? "bg-crab-600 border-crab-500 text-white box-glow-red"
: "bg-shell-800 border-shell-700 text-gray-400 hover:border-shell-600 hover:text-gray-300"
}`}
>
All
</button>
{platforms.map((p) => (
{/* Platform filters */}
{platforms.length > 1 && (
<div className="flex gap-1.5 mt-3 flex-wrap">
<button
key={p}
onClick={() => setPlatformFilter(p)}
tabIndex={collapsed ? -1 : 0}
onClick={() => setPlatformFilter(null)}
className={`px-2.5 py-1 text-[11px] font-display uppercase tracking-wide rounded border transition-all ${
platformFilter === p
!platformFilter
? "bg-crab-600 border-crab-500 text-white box-glow-red"
: "bg-shell-800 border-shell-700 text-gray-400 hover:border-shell-600 hover:text-gray-300"
}`}
>
{platformEmoji[p] || "📱"} {p}
All
</button>
))}
</div>
)}
</div>
{platforms.map((p) => (
<button
key={p}
onClick={() => setPlatformFilter(p)}
className={`px-2.5 py-1 text-[11px] font-display uppercase tracking-wide rounded border transition-all ${
platformFilter === p
? "bg-crab-600 border-crab-500 text-white box-glow-red"
: "bg-shell-800 border-shell-700 text-gray-400 hover:border-shell-600 hover:text-gray-300"
}`}
>
{platformEmoji[p] || "📱"} {p}
</button>
))}
</div>
)}
</>
)}
</div>
{/* Session list */}
<div className="relative flex-1 overflow-y-auto">
<AnimatePresence mode="sync">
<AnimatePresence mode="popLayout">
{sortedParents.map((session) => (
<motion.div
key={session.key}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
>
<button
<div key={session.key}>
<motion.button
layout
initial={{ opacity: 0, x: -20 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: -20 }}
onClick={() => onSelect(session.key)}
className={`w-full text-left p-3 border-b border-shell-800 transition-all duration-150 group ${
selectedKey === session.key
@@ -297,7 +290,7 @@ export function SessionList({
</div>
</>
)}
</button>
</motion.button>
{/* Nested subagents */}
{(() => {
@@ -321,12 +314,12 @@ export function SessionList({
} flex items-center gap-1.5 text-xs font-display uppercase tracking-widest text-shell-500 hover:text-shell-300 hover:bg-shell-800/30`}
>
<ChevronDown
size={16}
className={`transition-transform ${isGroupCollapsed ? "-rotate-90" : ""} ${collapsed ? "ml-2" : ""}`}
size={14}
className={`transition-transform ${isGroupCollapsed ? "-rotate-90" : ""}`}
/>
<span className={`transition-opacity duration-200 ${collapsed ? "opacity-0 w-0 overflow-hidden" : "opacity-100"}`}>
{subs.length} subagent{subs.length > 1 ? "s" : ""}
</span>
{!collapsed && (
<span>{subs.length} subagent{subs.length > 1 ? "s" : ""}</span>
)}
</button>
<motion.div
initial={false}
@@ -350,30 +343,23 @@ export function SessionList({
</>
);
})()}
</motion.div>
</div>
))}
{/* Orphan subagents */}
{orphanSubagents.map((sub) => (
<motion.div
<SubagentItem
key={sub.key}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
>
<SubagentItem
session={sub}
selected={selectedKey === sub.key}
collapsed={collapsed}
onSelect={onSelect}
/>
</motion.div>
session={sub}
selected={selectedKey === sub.key}
collapsed={collapsed}
onSelect={onSelect}
/>
))}
</AnimatePresence>
{sortedParents.length === 0 && orphanSubagents.length === 0 && (
<div className={`p-6 text-center transition-opacity duration-200 ${collapsed ? "opacity-0" : "opacity-100"}`}>
{sortedParents.length === 0 && orphanSubagents.length === 0 && !collapsed && (
<div className="p-6 text-center">
<div className="font-console text-xs text-shell-500">
<span className="text-crab-600">&gt;</span> no sessions found
</div>
@@ -382,8 +368,10 @@ export function SessionList({
</div>
{/* Footer */}
<div className={`relative bg-shell-950/50 ${collapsed ? "py-3 px-2" : "p-2.5"}`}>
<div className={`font-console text-xs text-shell-500 text-center flex items-center justify-center ${collapsed ? "flex-col gap-3" : "gap-4"}`}>
<div className={`relative bg-shell-950/50 ${collapsed ? "py-4 px-2" : "p-2.5"}`}>
<div
className={`font-console text-xs text-shell-500 text-center flex items-center justify-center ${collapsed ? "flex-col gap-3" : "gap-4"}`}
>
<a
href="https://github.com/luccast/crabwalk"
target="_blank"
@@ -392,9 +380,7 @@ export function SessionList({
title="Github"
>
<Github size={14} />
<span className={`transition-opacity duration-200 ${collapsed ? "hidden" : "opacity-100"}`}>
Github
</span>
{!collapsed && <span>Github</span>}
</a>
<a
@@ -406,9 +392,7 @@ export function SessionList({
title="X"
>
<XIcon size={14} />
<span className={`transition-opacity duration-200 ${collapsed ? "hidden" : "opacity-100"}`}>
@luccasveg
</span>
{!collapsed && <span>@luccasveg</span>}
</a>
</div>
</div>
+1 -1
View File
@@ -3,7 +3,7 @@ import { Handle, Position } from '@xyflow/react'
import { motion, AnimatePresence } from 'framer-motion'
import { Users, User, Clock, Copy, Check } from 'lucide-react'
import { StatusIndicator } from './StatusIndicator'
import type { MonitorSession } from '~/integrations/openclaw'
import type { MonitorSession } from '~/integrations/clawdbot'
interface SessionNodeProps {
data: MonitorSession
+1 -2
View File
@@ -54,10 +54,9 @@ export function SettingsPanel({
return (
<>
{/* Trigger button - hidden on mobile, settings available in bottom bar */}
<button
onClick={() => onOpenChange(true)}
className="hidden sm:block p-2 bg-shell-800 hover:bg-shell-700 rounded-lg transition-all group"
className="p-2 bg-shell-800 hover:bg-shell-700 rounded-lg transition-all group"
>
<Settings size={14} className="text-gray-400 group-hover:text-crab-400 transition-colors" />
</button>
-2
View File
@@ -6,5 +6,3 @@ export { ExecNode } from './ExecNode'
export { CrabNode } from './CrabNode'
export { StatusIndicator } from './StatusIndicator'
export { SettingsPanel } from './SettingsPanel'
export { MobileSessionDrawer } from './MobileSessionDrawer'
export { MobileMonitorToolbar } from './MobileMonitorToolbar'
-173
View File
@@ -1,173 +0,0 @@
import { useState, useRef, useEffect } from 'react'
import { useLocation, useNavigate } from '@tanstack/react-router'
import { motion, AnimatePresence } from 'framer-motion'
import { Activity, FolderTree, ChevronDown, Terminal } from 'lucide-react'
interface NavTab {
path: string
label: string
icon: React.ReactNode
}
const TABS: NavTab[] = [
{
path: '/monitor',
label: 'MONITOR',
icon: <Activity size={14} />,
},
{
path: '/workspace',
label: 'WORKSPACE',
icon: <FolderTree size={14} />,
},
]
export function NavTabs() {
const [open, setOpen] = useState(false)
const location = useLocation()
const navigate = useNavigate()
const dropdownRef = useRef<HTMLDivElement>(null)
const currentPath = location.pathname.replace(/\/$/, '') || '/'
const activeTab = (TABS.find(
(tab) => tab.path === currentPath || currentPath.startsWith(tab.path)
) ?? TABS[0])!
// Close on outside click
useEffect(() => {
function handleClickOutside(e: MouseEvent) {
if (dropdownRef.current && !dropdownRef.current.contains(e.target as Node)) {
setOpen(false)
}
}
if (open) {
document.addEventListener('mousedown', handleClickOutside)
return () => document.removeEventListener('mousedown', handleClickOutside)
}
}, [open])
// Close on escape
useEffect(() => {
function handleEscape(e: KeyboardEvent) {
if (e.key === 'Escape') setOpen(false)
}
if (open) {
document.addEventListener('keydown', handleEscape)
return () => document.removeEventListener('keydown', handleEscape)
}
}, [open])
const handleSelect = (path: string) => {
setOpen(false)
navigate({ to: path })
}
return (
<div ref={dropdownRef} className="relative">
{/* Trigger button */}
<button
onClick={() => setOpen(!open)}
className="flex items-center gap-2 px-3 py-2 rounded-lg border border-shell-700/50 bg-shell-800/50 hover:bg-shell-800 hover:border-shell-600 transition-all group"
>
<span className="text-crab-400">{activeTab.icon}</span>
<span className="font-console text-xs tracking-widest text-shell-200">
{activeTab.label}
</span>
<ChevronDown
size={14}
className={`text-shell-500 transition-transform duration-200 ${open ? 'rotate-180' : ''}`}
/>
</button>
{/* Dropdown menu */}
<AnimatePresence>
{open && (
<>
{/* Backdrop */}
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
className="fixed inset-0 z-40"
onClick={() => setOpen(false)}
/>
{/* Dropdown panel */}
<motion.div
initial={{ opacity: 0, y: -8, scale: 0.96 }}
animate={{ opacity: 1, y: 0, scale: 1 }}
exit={{ opacity: 0, y: -8, scale: 0.96 }}
transition={{ type: 'spring', damping: 25, stiffness: 400 }}
className="absolute top-full left-0 mt-2 z-50 min-w-[200px]"
>
{/* Terminal-style container */}
<div className="bg-shell-900 border border-shell-700 rounded-lg overflow-hidden shadow-2xl shadow-black/50">
{/* Terminal header */}
<div className="flex items-center gap-2 px-3 py-2 bg-shell-950 border-b border-shell-800">
<Terminal size={12} className="text-shell-500" />
<span className="font-console text-[11px] text-shell-500 uppercase tracking-widest">
navigate
</span>
</div>
{/* Menu items */}
<div className="p-1.5">
{TABS.map((tab, index) => {
const isActive =
tab.path === currentPath || currentPath.startsWith(tab.path)
return (
<motion.button
key={tab.path}
initial={{ opacity: 0, x: -10 }}
animate={{ opacity: 1, x: 0 }}
transition={{ delay: index * 0.05 }}
onClick={() => handleSelect(tab.path)}
className={`w-full flex items-center gap-3 px-3 py-2.5 rounded-md transition-all group ${
isActive
? 'bg-crab-500/10 text-crab-400'
: 'text-shell-400 hover:bg-shell-800 hover:text-shell-200'
}`}
>
{/* Icon */}
<span
className={`transition-colors ${
isActive ? 'text-crab-400' : 'text-shell-500 group-hover:text-shell-400'
}`}
>
{tab.icon}
</span>
{/* Label */}
<span className="font-console text-xs tracking-widest flex-1 text-left">
{tab.label}
</span>
{/* Active indicator */}
{isActive && (
<motion.div
layoutId="nav-dropdown-active"
className="w-1.5 h-1.5 rounded-full bg-crab-500"
/>
)}
</motion.button>
)
})}
</div>
{/* Terminal footer with hint */}
<div className="px-3 pb-2 pt-1 bg-shell-950/50 border-t border-shell-800/50">
<span className="font-console text-[11px] text-shell-600">
<span className="text-shell-500">esc</span> to close
</span>
</div>
</div>
</motion.div>
</>
)}
</AnimatePresence>
</div>
)
}
-1
View File
@@ -1 +0,0 @@
export { NavTabs } from './NavTabs'
@@ -1,104 +0,0 @@
import { useEffect } from 'react'
import { motion, AnimatePresence } from 'framer-motion'
import { AlertTriangle, X, Check } from 'lucide-react'
interface ConfirmationDialogProps {
open: boolean
title: string
message: string
confirmText?: string
cancelText?: string
onConfirm: () => void
onCancel: () => void
variant?: 'danger' | 'warning' | 'info'
}
export function ConfirmationDialog({
open,
title,
message,
confirmText = 'Confirm',
cancelText = 'Cancel',
onConfirm,
onCancel,
variant = 'danger',
}: ConfirmationDialogProps) {
const iconColor = variant === 'danger' ? 'text-crab-400' : variant === 'warning' ? 'text-neon-peach' : 'text-neon-cyan'
const iconBg = variant === 'danger' ? 'bg-crab-900/30' : variant === 'warning' ? 'bg-neon-peach/10' : 'bg-neon-cyan/10'
const iconBorder = variant === 'danger' ? 'border-crab-700/50' : variant === 'warning' ? 'border-neon-peach/30' : 'border-neon-cyan/30'
const confirmButtonClass = variant === 'danger'
? 'bg-crab-600 hover:bg-crab-500 text-white'
: 'bg-neon-mint hover:bg-neon-mint/90 text-shell-950'
// Handle Escape key
useEffect(() => {
const handleEscape = (e: KeyboardEvent) => {
if (e.key === 'Escape') onCancel()
}
if (open) {
document.addEventListener('keydown', handleEscape)
}
return () => document.removeEventListener('keydown', handleEscape)
}, [open, onCancel])
return (
<AnimatePresence>
{open && (
<div className="fixed inset-0 z-50 flex items-center justify-center p-4">
{/* Backdrop */}
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="absolute inset-0 bg-black/60 backdrop-blur-sm"
onClick={onCancel}
/>
{/* Dialog */}
<motion.div
initial={{ opacity: 0, scale: 0.95, y: 10 }}
animate={{ opacity: 1, scale: 1, y: 0 }}
exit={{ opacity: 0, scale: 0.95, y: 10 }}
transition={{ type: 'spring', duration: 0.3 }}
className="relative w-full max-w-md bg-shell-900 rounded-xl border border-shell-700 shadow-2xl overflow-hidden"
>
{/* Header */}
<div className={`flex items-center gap-3 px-5 py-4 border-b border-shell-800 ${iconBg}`}>
<div className={`p-2 rounded-lg ${iconBg} border ${iconBorder}`}>
<AlertTriangle size={20} className={iconColor} />
</div>
<h3 className="font-display text-lg text-gray-200">{title}</h3>
</div>
{/* Content */}
<div className="px-5 py-4">
<p className="font-console text-sm text-shell-500 leading-relaxed">
{message}
</p>
</div>
{/* Footer */}
<div className="flex items-center justify-end gap-3 px-5 py-4 border-t border-shell-800 bg-shell-900/50">
<button
onClick={onCancel}
className="flex items-center gap-2 px-4 py-2 bg-shell-800 hover:bg-shell-700 rounded-lg text-sm font-console text-gray-300 transition-colors border border-shell-700"
>
<X size={14} />
{cancelText}
</button>
<button
onClick={onConfirm}
className={`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-console transition-colors border ${confirmButtonClass}`}
>
<Check size={14} />
{confirmText}
</button>
</div>
</motion.div>
</div>
)}
</AnimatePresence>
)
}
export default ConfirmationDialog
@@ -1,151 +0,0 @@
import React from 'react'
import { motion, AnimatePresence } from 'framer-motion'
interface ContextMenuItem {
icon: React.ReactNode
label: string
onClick: () => void
danger?: boolean
}
interface FileContextMenuProps {
open: boolean
position: { x: number; y: number } | null
items: ContextMenuItem[]
onClose: () => void
}
export function FileContextMenu({ open, position, items, onClose }: FileContextMenuProps) {
// Calculate position that stays within viewport
const adjustedPosition = React.useMemo(() => {
if (!position) return null
const menuWidth = 192 // w-48 = 12rem = 192px
const menuHeight = items.length * 42 // approximate height based on item count
const padding = 8
const viewportWidth = window.innerWidth
const viewportHeight = window.innerHeight
let x = position.x
let y = position.y
// Adjust if menu would go off right edge
if (x + menuWidth + padding > viewportWidth) {
x = Math.max(padding, viewportWidth - menuWidth - padding)
}
// Adjust if menu would go off bottom edge
if (y + menuHeight + padding > viewportHeight) {
y = Math.max(padding, viewportHeight - menuHeight - padding)
}
return { x, y }
}, [position, items.length])
// Close menu when clicking outside or pressing Escape
React.useEffect(() => {
const handleEscape = (e: KeyboardEvent) => {
if (e.key === 'Escape') onClose()
}
const handleClick = () => onClose()
if (open) {
document.addEventListener('click', handleClick)
document.addEventListener('keydown', handleEscape)
}
return () => {
document.removeEventListener('click', handleClick)
document.removeEventListener('keydown', handleEscape)
}
}, [open, onClose])
// Prevent clicks inside menu from closing it
const handleMenuClick = (e: React.MouseEvent) => {
e.stopPropagation()
}
return (
<AnimatePresence>
{open && adjustedPosition && (
<motion.div
initial={{ opacity: 0, scale: 0.95 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.95 }}
transition={{ type: 'spring', duration: 0.15 }}
className="fixed z-50 bg-shell-900 rounded-lg border border-shell-700 shadow-xl overflow-hidden"
style={{
left: adjustedPosition.x,
top: adjustedPosition.y,
}}
onClick={handleMenuClick}
>
{/* Menu items */}
<div className="py-1">
{items.map((item, index) => (
<button
key={index}
onClick={() => {
item.onClick()
onClose()
}}
className={`w-full flex items-center gap-3 px-4 py-2.5 text-left font-console text-sm transition-colors ${
item.danger
? 'text-crab-400 hover:bg-crab-900/30'
: 'text-gray-300 hover:bg-shell-800 hover:text-gray-100'
}`}
>
<span className={item.danger ? 'text-crab-500' : 'text-shell-500'}>
{item.icon}
</span>
{item.label}
</button>
))}
</div>
</motion.div>
)}
</AnimatePresence>
)
}
// Icon components
export const FileIcon = ({ size = 14 }: { size?: number }) => (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<polyline points="14 2 14 8 20 8" />
<line x1="16" y1="13" x2="8" y2="13" />
<line x1="16" y1="17" x2="8" y2="17" />
<polyline points="10 9 9 9 8 9" />
</svg>
)
export const TrashIcon = ({ size = 14 }: { size?: number }) => (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<polyline points="3 6 5 6 21 6" />
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
</svg>
)
export const CopyIcon = ({ size = 14 }: { size?: number }) => (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
</svg>
)
export const EditIcon = ({ size = 14 }: { size?: number }) => (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" />
</svg>
)
export const NewFileIcon = ({ size = 14 }: { size?: number }) => (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<polyline points="14 2 14 8 20 8" />
<line x1="12" y1="18" x2="12" y2="12" />
<line x1="9" y1="15" x2="15" y2="15" />
</svg>
)
export default FileContextMenu
-451
View File
@@ -1,451 +0,0 @@
import { useState, useCallback, useEffect, useRef } from 'react'
import { motion, AnimatePresence } from 'framer-motion'
import {
FileText,
Edit2,
Save,
X,
AlertCircle,
Check,
} from 'lucide-react'
import ReactMarkdown from 'react-markdown'
interface FileEditorProps {
content: string
fileName: string
filePath?: string
fileSize?: number
fileModified?: Date
error?: string
isStarred?: boolean
onStar?: (path: string) => void
onSave?: (content: string, callback: (success: boolean) => void) => void
}
function formatFileSize(bytes: number | undefined): string {
if (bytes === undefined) return ''
if (bytes === 0) return '0 B'
const k = 1024
const sizes = ['B', 'KB', 'MB', 'GB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i]
}
function formatModifiedDate(date: Date | undefined): string {
if (!date) return ''
const d = new Date(date)
const now = new Date()
const diff = now.getTime() - d.getTime()
const seconds = Math.floor(diff / 1000)
const minutes = Math.floor(seconds / 60)
const hours = Math.floor(minutes / 60)
const days = Math.floor(hours / 24)
if (days > 30) {
return d.toLocaleDateString()
} else if (days > 0) {
return `${days}d ago`
} else if (hours > 0) {
return `${hours}h ago`
} else if (minutes > 0) {
return `${minutes}m ago`
} else {
return 'just now'
}
}
function Star({ size = 16, fill = 'none', className = '' }: { size?: number; fill?: string; className?: string }) {
return (
<svg
width={size}
height={size}
viewBox="0 0 24 24"
fill={fill}
stroke="currentColor"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
className={className}
>
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />
</svg>
)
}
export function FileEditor({
content,
fileName,
filePath,
fileSize,
fileModified,
error,
isStarred,
onStar,
onSave,
}: FileEditorProps) {
const [isEditing, setIsEditing] = useState(false)
const [editContent, setEditContent] = useState(content)
const [isSaving, setIsSaving] = useState(false)
const [saveStatus, setSaveStatus] = useState<'idle' | 'saving' | 'saved' | 'error'>('idle')
const [lastSavedContent, setLastSavedContent] = useState(content)
const textareaRef = useRef<HTMLTextAreaElement>(null)
const isMarkdown = fileName.toLowerCase().endsWith('.md') || fileName.toLowerCase().endsWith('.markdown')
// Track previous file path to detect file changes
const prevFilePathRef = useRef<string | undefined>(filePath)
// Reset edit state when file changes to prevent saving stale content
useEffect(() => {
if (filePath !== prevFilePathRef.current) {
// File changed - exit edit mode and reset buffer
setIsEditing(false)
setEditContent(content)
setLastSavedContent(content)
setSaveStatus('idle')
prevFilePathRef.current = filePath
} else if (!isEditing && content !== lastSavedContent) {
// Sync content when not editing and it changed externally
setEditContent(content)
setLastSavedContent(content)
}
}, [content, isEditing, lastSavedContent, filePath])
// Track if content has unsaved changes
const hasUnsavedChanges = editContent !== lastSavedContent
const handleSave = useCallback(() => {
if (!onSave || !hasUnsavedChanges) return
setIsSaving(true)
setSaveStatus('saving')
onSave(editContent, (success) => {
setIsSaving(false)
if (success) {
setLastSavedContent(editContent)
setSaveStatus('saved')
setTimeout(() => setSaveStatus('idle'), 2000)
} else {
setSaveStatus('error')
setTimeout(() => setSaveStatus('idle'), 2000)
}
})
}, [editContent, hasUnsavedChanges, onSave])
const handleCancel = useCallback(() => {
setEditContent(lastSavedContent)
setIsEditing(false)
setSaveStatus('idle')
}, [lastSavedContent])
const handleKeyDown = (e: React.KeyboardEvent) => {
// Ctrl/Cmd + S to save
if ((e.ctrlKey || e.metaKey) && e.key === 's') {
e.preventDefault()
handleSave()
}
// Escape to cancel
if (e.key === 'Escape') {
handleCancel()
}
}
// Focus textarea when entering edit mode
useEffect(() => {
if (isEditing && textareaRef.current) {
textareaRef.current.focus()
}
}, [isEditing])
if (error) {
return (
<div className="h-full flex flex-col items-center justify-center p-8 text-center">
<motion.div
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
className="flex flex-col items-center gap-4"
>
<div className="w-16 h-16 rounded-full bg-crab-900/30 flex items-center justify-center border border-crab-700/50">
<AlertCircle size={32} className="text-crab-400" />
</div>
<div>
<h3 className="font-display text-lg text-crab-400 mb-2">Error Loading File</h3>
<p className="font-console text-sm text-shell-500 max-w-md">{error}</p>
</div>
</motion.div>
</div>
)
}
if (!content && !fileName) {
return (
<div className="h-full flex flex-col items-center justify-center p-8 text-center">
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
className="flex flex-col items-center gap-4"
>
<div className="w-16 h-16 rounded-full bg-shell-800/50 flex items-center justify-center border border-shell-700">
<FileText size={32} className="text-shell-500" />
</div>
<div>
<h3 className="font-display text-lg text-gray-400 mb-2">No File Selected</h3>
<p className="font-console text-sm text-shell-500 max-w-md">
Select a file from the sidebar to view its contents
</p>
</div>
</motion.div>
</div>
)
}
return (
<div className="h-full flex flex-col">
{/* File header */}
<div className="flex items-center gap-2 px-4 py-3 border-b border-shell-800 bg-shell-900/50 min-w-0">
{/* Left: Controls - always visible, fixed width */}
<div className="flex items-center gap-2 flex-shrink-0">
{/* Star button */}
{filePath && onStar && (
<button
onClick={() => onStar(filePath)}
className={`p-1.5 rounded transition-colors ${
isStarred
? 'text-yellow-400 hover:text-yellow-300'
: 'text-shell-600 hover:text-yellow-400'
}`}
title={isStarred ? 'Unstar file' : 'Star file'}
>
<Star size={16} fill={isStarred ? 'currentColor' : 'none'} />
</button>
)}
{/* Action buttons */}
{onSave && (
<div className="flex items-center gap-1">
{!isEditing ? (
<button
onClick={() => setIsEditing(true)}
className="flex items-center gap-1.5 px-2.5 py-1.5 bg-shell-800 hover:bg-shell-700 rounded-lg text-sm font-console text-gray-300 transition-colors border border-shell-700"
title="Edit file (or press E)"
>
<Edit2 size={14} />
<span className="hidden sm:inline">Edit</span>
</button>
) : (
<>
<button
onClick={handleSave}
disabled={isSaving || !hasUnsavedChanges}
className="flex items-center gap-1.5 px-2.5 py-1.5 bg-neon-mint/10 hover:bg-neon-mint/20 rounded-lg text-sm font-console text-neon-mint transition-colors border border-neon-mint/30 disabled:opacity-50 disabled:cursor-not-allowed"
title="Save (Ctrl+S)"
>
<Save size={14} />
<span className="hidden sm:inline">Save</span>
</button>
<button
onClick={handleCancel}
className="flex items-center gap-1.5 px-2.5 py-1.5 bg-shell-800 hover:bg-shell-700 rounded-lg text-sm font-console text-gray-300 transition-colors border border-shell-700"
title="Cancel (Esc)"
>
<X size={14} />
<span className="hidden sm:inline">Cancel</span>
</button>
</>
)}
</div>
)}
</div>
{/* Middle: Filename and indicators - flexes and truncates */}
<div className="flex items-center gap-2 flex-1 min-w-0 overflow-hidden">
<FileText size={18} className={`flex-shrink-0 ${isMarkdown ? 'text-crab-400' : 'text-shell-500'}`} />
<h2 className="font-display text-sm text-gray-200 truncate min-w-0">{fileName}</h2>
{isMarkdown && (
<span className="hidden sm:inline px-2 py-0.5 bg-crab-900/30 text-crab-400 text-[10px] font-console uppercase rounded border border-crab-700/30 flex-shrink-0">
Markdown
</span>
)}
{/* Edit mode indicator */}
{isEditing && (
<span className="hidden sm:inline px-2 py-0.5 bg-neon-mint/10 text-neon-mint text-[10px] font-console uppercase rounded border border-neon-mint/30 flex-shrink-0">
Editing
</span>
)}
{/* Unsaved changes indicator */}
{isEditing && hasUnsavedChanges && (
<span className="hidden sm:inline px-2 py-0.5 bg-neon-peach/10 text-neon-peach text-[10px] font-console uppercase rounded border border-neon-peach/30 animate-pulse flex-shrink-0">
Unsaved
</span>
)}
{/* Save status */}
<AnimatePresence>
{isEditing && (
<motion.div
initial={{ opacity: 0, scale: 0.8 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.8 }}
className="hidden sm:flex items-center gap-1.5 flex-shrink-0"
>
{saveStatus === 'saving' && (
<>
<div className="w-2.5 h-2.5 border-2 border-neon-cyan border-t-transparent rounded-full animate-spin" />
<span className="font-console text-[10px] text-neon-cyan">Saving...</span>
</>
)}
{saveStatus === 'saved' && (
<>
<Check size={12} className="text-neon-mint" />
<span className="font-console text-[10px] text-neon-mint">Saved</span>
</>
)}
{saveStatus === 'error' && (
<>
<AlertCircle size={12} className="text-neon-peach" />
<span className="font-console text-[10px] text-neon-peach">Save failed</span>
</>
)}
</motion.div>
)}
</AnimatePresence>
</div>
{/* Right: Metadata - shows when space allows, hides on very small screens */}
<div className="flex items-center gap-3 flex-shrink-0 overflow-hidden">
<div className="hidden min-[480px]:flex items-center gap-3">
{fileSize !== undefined && (
<span className="font-console text-[10px] text-shell-500 whitespace-nowrap">
{formatFileSize(fileSize)}
</span>
)}
{fileModified && (
<span className="font-console text-[10px] text-shell-500 whitespace-nowrap">
{formatModifiedDate(fileModified)}
</span>
)}
</div>
</div>
</div>
{/* Content */}
<div className="flex-1 overflow-auto p-6">
<div className="max-w-[1200px] mx-auto h-full">
<AnimatePresence mode="wait">
{isEditing ? (
<motion.div
key="editor"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="h-full"
>
<textarea
ref={textareaRef}
value={editContent}
onChange={(e) => setEditContent(e.target.value)}
onKeyDown={handleKeyDown}
className="w-full h-full min-h-[400px] bg-shell-900 border border-shell-700 rounded-lg p-4 font-mono text-sm text-gray-300 placeholder-shell-600 resize-none focus:outline-none focus:border-crab-500 focus:ring-1 focus:ring-crab-500/20 break-words"
spellCheck={false}
autoCapitalize="off"
autoCorrect="off"
autoComplete="off"
/>
</motion.div>
) : (
<motion.div
key="viewer"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
className="min-w-0"
>
{isMarkdown ? (
<div className="prose prose-invert prose-sm max-w-full break-words">
<ReactMarkdown
components={{
h1: ({ children }) => (
<h1 className="text-2xl font-display text-crab-400 mb-4 pb-2 border-b border-shell-800">
{children}
</h1>
),
h2: ({ children }) => (
<h2 className="text-xl font-display text-neon-mint mt-6 mb-3">{children}</h2>
),
h3: ({ children }) => (
<h3 className="text-lg font-display text-gray-200 mt-4 mb-2">{children}</h3>
),
p: ({ children }) => (
<p className="text-gray-300 leading-relaxed mb-4">{children}</p>
),
code: ({ children, className }) => {
const isInline = !className
return isInline ? (
<code className="bg-shell-800 text-neon-peach px-1.5 py-0.5 rounded text-sm font-mono">
{children}
</code>
) : (
<pre className="bg-shell-900 border border-shell-800 rounded-lg p-4 mb-4 max-w-full">
<code className="text-xs sm:text-sm font-mono text-gray-300 whitespace-pre-wrap break-all">{children}</code>
</pre>
)
},
ul: ({ children }) => (
<ul className="list-disc list-inside text-gray-300 mb-4 space-y-1">{children}</ul>
),
ol: ({ children }) => (
<ol className="list-decimal list-inside text-gray-300 mb-4 space-y-1">{children}</ol>
),
li: ({ children }) => <li className="text-gray-300">{children}</li>,
a: ({ children, href }) => (
<a
href={href}
className="text-neon-cyan hover:text-neon-mint transition-colors underline"
target="_blank"
rel="noopener noreferrer"
>
{children}
</a>
),
blockquote: ({ children }) => (
<blockquote className="border-l-4 border-crab-500 pl-4 italic text-shell-400 mb-4">
{children}
</blockquote>
),
hr: () => <hr className="border-shell-700 my-6" />,
table: ({ children }) => (
<table className="w-full border-collapse mb-4">{children}</table>
),
thead: ({ children }) => (
<thead className="bg-shell-800">{children}</thead>
),
th: ({ children }) => (
<th className="border border-shell-700 px-4 py-2 text-left font-display text-sm text-gray-200">
{children}
</th>
),
td: ({ children }) => (
<td className="border border-shell-700 px-4 py-2 text-sm text-gray-300">
{children}
</td>
),
}}
>
{content}
</ReactMarkdown>
</div>
) : (
<pre className="font-mono text-xs sm:text-sm text-gray-300 whitespace-pre-wrap break-all overflow-x-auto max-w-full">{content}</pre>
)}
</motion.div>
)}
</AnimatePresence>
</div>
</div>
</div>
)
}
export default FileEditor
-221
View File
@@ -1,221 +0,0 @@
import { useState, useCallback, useEffect } from 'react'
import { ChevronRight, ChevronDown, Folder, FolderOpen, FileText } from 'lucide-react'
import { motion, AnimatePresence } from 'framer-motion'
import type { DirectoryEntry } from '~/lib/workspace-fs'
// Format file size to human-readable format
function formatFileSize(bytes: number | undefined): string {
if (bytes === undefined) return ''
if (bytes === 0) return '0 B'
const k = 1024
const sizes = ['B', 'KB', 'MB', 'GB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i]
}
interface FileTreeProps {
entries: DirectoryEntry[]
selectedPath: string | null
onSelect: (path: string, type: 'file' | 'directory') => void
onLoadDirectory?: (path: string) => Promise<DirectoryEntry[]>
onContextMenu?: (e: React.MouseEvent, path: string) => void
level?: number
}
interface FileTreeItemProps {
entry: DirectoryEntry
selectedPath: string | null
onSelect: (path: string, type: 'file' | 'directory') => void
onLoadDirectory?: (path: string) => Promise<DirectoryEntry[]>
onContextMenu?: (e: React.MouseEvent, path: string) => void
level: number
}
function FileTreeItem({ entry, selectedPath, onSelect, onLoadDirectory, onContextMenu, level }: FileTreeItemProps) {
const [expanded, setExpanded] = useState(false)
const [children, setChildren] = useState<DirectoryEntry[]>([])
const [loading, setLoading] = useState(false)
// Reset children when entry path changes (e.g., on refresh)
useEffect(() => {
setChildren([])
setExpanded(false)
}, [entry.path])
const isSelected = selectedPath === entry.path
const isDirectory = entry.type === 'directory'
const paddingLeft = level * 16 + 8
const loadChildren = useCallback(async () => {
if (!isDirectory || !onLoadDirectory) return
setLoading(true)
try {
const entries = await onLoadDirectory(entry.path)
setChildren(entries)
} catch (error) {
console.error('Failed to load directory:', error)
} finally {
setLoading(false)
}
}, [entry.path, isDirectory, onLoadDirectory])
const handleToggle = useCallback(
async (e: React.MouseEvent) => {
e.stopPropagation()
if (isDirectory) {
if (!expanded) {
await loadChildren()
setExpanded(true)
} else {
setExpanded(false)
}
}
},
[expanded, loadChildren, isDirectory]
)
const handleClick = useCallback(async () => {
if (isDirectory) {
if (!expanded) {
await loadChildren()
setExpanded(true)
} else {
setExpanded(false)
}
onSelect(entry.path, 'directory')
} else {
onSelect(entry.path, 'file')
}
}, [entry.path, entry.type, expanded, loadChildren, onSelect, isDirectory])
const handleContextMenuFn = useCallback(
(e: React.MouseEvent) => {
if (onContextMenu && entry.type === 'file') {
onContextMenu(e, entry.path)
}
},
[entry.path, entry.type, onContextMenu]
)
return (
<div>
<motion.div
onClick={handleClick}
onContextMenu={handleContextMenuFn}
style={{ paddingLeft }}
className={`flex items-center gap-2 py-1.5 pr-2 text-left transition-all duration-150 rounded-md mr-1 cursor-pointer ${
isSelected
? 'bg-crab-500/20 text-crab-400 border-l-2 border-crab-400'
: 'text-gray-300 hover:bg-shell-800 hover:text-gray-100 border-l-2 border-transparent'
}`}
whileHover={{ x: 2 }}
transition={{ duration: 0.1 }}
>
{/* Expand/collapse chevron for directories */}
{isDirectory ? (
<div
onClick={handleToggle}
className="p-0.5 hover:bg-shell-700 rounded transition-colors cursor-pointer"
>
{loading ? (
<motion.div
animate={{ rotate: 360 }}
transition={{ duration: 1, repeat: Infinity, ease: 'linear' }}
>
<ChevronRight size={14} className="text-shell-500" />
</motion.div>
) : expanded ? (
<ChevronDown size={14} className="text-shell-500" />
) : (
<ChevronRight size={14} className="text-shell-500" />
)}
</div>
) : (
<span className="w-5" /> // Spacer for alignment
)}
{/* Icon */}
{isDirectory ? (
expanded ? (
<FolderOpen size={16} className="text-neon-mint flex-shrink-0" />
) : (
<Folder size={16} className="text-neon-mint flex-shrink-0" />
)
) : (
<FileText
size={16}
className={`flex-shrink-0 ${
entry.extension === '.md' ? 'text-crab-400' : 'text-shell-500'
}`}
/>
)}
{/* Name */}
<span
className={`font-console text-sm truncate flex-1 ${
isSelected ? 'text-crab-400' : ''
}`}
>
{entry.name}
</span>
{/* Metadata for files */}
{!isDirectory && (
<span className="font-console text-[10px] text-shell-600 flex-shrink-0">
{entry.size !== undefined && formatFileSize(entry.size)}
</span>
)}
</motion.div>
{/* Children */}
<AnimatePresence>
{expanded && isDirectory && (
<motion.div
initial={{ height: 0, opacity: 0 }}
animate={{ height: 'auto', opacity: 1 }}
exit={{ height: 0, opacity: 0 }}
transition={{ duration: 0.2 }}
className="overflow-hidden"
>
{children.length > 0 ? (
children.map((childEntry) => (
<FileTreeItem
key={childEntry.path}
entry={childEntry}
selectedPath={selectedPath}
onSelect={onSelect}
onLoadDirectory={onLoadDirectory}
onContextMenu={onContextMenu}
level={level + 1}
/>
))
) : (
<div className="py-1 px-4">
<span className="font-console text-xs text-shell-500 italic">Empty folder</span>
</div>
)}
</motion.div>
)}
</AnimatePresence>
</div>
)
}
export function FileTree({ entries, selectedPath, onSelect, onLoadDirectory, onContextMenu, level = 0 }: FileTreeProps) {
return (
<div className="py-1">
{entries.map((entry) => (
<FileTreeItem
key={entry.path}
entry={entry}
selectedPath={selectedPath}
onSelect={onSelect}
onLoadDirectory={onLoadDirectory}
onContextMenu={onContextMenu}
level={level}
/>
))}
</div>
)
}
export default FileTree
-224
View File
@@ -1,224 +0,0 @@
import { useMemo } from 'react'
import ReactMarkdown from 'react-markdown'
import { FileText, AlertCircle, Star } from 'lucide-react'
import { motion } from 'framer-motion'
interface MarkdownViewerProps {
content: string
fileName: string
filePath?: string
fileSize?: number
fileModified?: Date
error?: string
isStarred?: boolean
onStar?: (path: string) => void
}
// Format file size to human-readable format
function formatFileSize(bytes: number | undefined): string {
if (bytes === undefined) return ''
if (bytes === 0) return '0 B'
const k = 1024
const sizes = ['B', 'KB', 'MB', 'GB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i]
}
// Format date to relative time
function formatModifiedDate(date: Date | undefined): string {
if (!date) return ''
const d = new Date(date)
const now = new Date()
const diff = now.getTime() - d.getTime()
const seconds = Math.floor(diff / 1000)
const minutes = Math.floor(seconds / 60)
const hours = Math.floor(minutes / 60)
const days = Math.floor(hours / 24)
if (days > 30) {
return d.toLocaleDateString()
} else if (days > 0) {
return `${days}d ago`
} else if (hours > 0) {
return `${hours}h ago`
} else if (minutes > 0) {
return `${minutes}m ago`
} else {
return 'just now'
}
}
export function MarkdownViewer({ content, fileName, filePath, fileSize, fileModified, error, isStarred, onStar }: MarkdownViewerProps) {
const isMarkdown = useMemo(() => {
return fileName.toLowerCase().endsWith('.md') || fileName.toLowerCase().endsWith('.markdown')
}, [fileName])
if (error) {
return (
<div className="h-full flex flex-col items-center justify-center p-8 text-center">
<motion.div
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
className="flex flex-col items-center gap-4"
>
<div className="w-16 h-16 rounded-full bg-crab-900/30 flex items-center justify-center border border-crab-700/50">
<AlertCircle size={32} className="text-crab-400" />
</div>
<div>
<h3 className="font-display text-lg text-crab-400 mb-2">Error Loading File</h3>
<p className="font-console text-sm text-shell-500 max-w-md">{error}</p>
</div>
</motion.div>
</div>
)
}
if (!content && !fileName) {
return (
<div className="h-full flex flex-col items-center justify-center p-8 text-center">
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
className="flex flex-col items-center gap-4"
>
<div className="w-16 h-16 rounded-full bg-shell-800/50 flex items-center justify-center border border-shell-700">
<FileText size={32} className="text-shell-500" />
</div>
<div>
<h3 className="font-display text-lg text-gray-400 mb-2">No File Selected</h3>
<p className="font-console text-sm text-shell-500 max-w-md">
Select a file from the sidebar to view its contents
</p>
</div>
</motion.div>
</div>
)
}
return (
<div className="h-full flex flex-col">
{/* File header */}
<div className="flex items-center gap-3 px-6 py-4 border-b border-shell-800 bg-shell-900/50">
{/* Star button */}
{filePath && onStar && (
<button
onClick={() => onStar(filePath)}
className={`p-1 rounded transition-colors ${
isStarred
? 'text-yellow-400 hover:text-yellow-300'
: 'text-shell-600 hover:text-yellow-400'
}`}
title={isStarred ? 'Unstar file' : 'Star file'}
>
<Star size={16} fill={isStarred ? 'currentColor' : 'none'} />
</button>
)}
<FileText size={18} className={isMarkdown ? 'text-crab-400' : 'text-shell-500'} />
<h2 className="font-display text-sm text-gray-200">{fileName}</h2>
{isMarkdown && (
<span className="px-2 py-0.5 bg-crab-900/30 text-crab-400 text-[10px] font-console uppercase rounded border border-crab-700/30">
Markdown
</span>
)}
{/* File metadata */}
<div className="flex items-center gap-3 ml-auto">
{fileSize !== undefined && (
<span className="font-console text-[10px] text-shell-500">
{formatFileSize(fileSize)}
</span>
)}
{fileModified && (
<span className="font-console text-[10px] text-shell-500">
{formatModifiedDate(fileModified)}
</span>
)}
</div>
</div>
{/* Content - Fixed max-width with word wrap */}
<div className="flex-1 overflow-auto p-6">
<div className="max-w-[1200px] mx-auto">
{isMarkdown ? (
<div className="prose prose-invert prose-sm max-w-none break-words">
<ReactMarkdown
components={{
h1: ({ children }) => (
<h1 className="text-2xl font-display text-crab-400 mb-4 pb-2 border-b border-shell-800">
{children}
</h1>
),
h2: ({ children }) => (
<h2 className="text-xl font-display text-neon-mint mt-6 mb-3">{children}</h2>
),
h3: ({ children }) => (
<h3 className="text-lg font-display text-gray-200 mt-4 mb-2">{children}</h3>
),
p: ({ children }) => (
<p className="text-gray-300 leading-relaxed mb-4">{children}</p>
),
code: ({ children, className }) => {
const isInline = !className
return isInline ? (
<code className="bg-shell-800 text-neon-peach px-1.5 py-0.5 rounded text-sm font-mono">
{children}
</code>
) : (
<pre className="bg-shell-900 border border-shell-800 rounded-lg p-4 overflow-x-auto mb-4">
<code className="text-sm font-mono text-gray-300">{children}</code>
</pre>
)
},
ul: ({ children }) => (
<ul className="list-disc list-inside text-gray-300 mb-4 space-y-1">{children}</ul>
),
ol: ({ children }) => (
<ol className="list-decimal list-inside text-gray-300 mb-4 space-y-1">{children}</ol>
),
li: ({ children }) => <li className="text-gray-300">{children}</li>,
a: ({ children, href }) => (
<a
href={href}
className="text-neon-cyan hover:text-neon-mint transition-colors underline"
target="_blank"
rel="noopener noreferrer"
>
{children}
</a>
),
blockquote: ({ children }) => (
<blockquote className="border-l-4 border-crab-500 pl-4 italic text-shell-400 mb-4">
{children}
</blockquote>
),
hr: () => <hr className="border-shell-700 my-6" />,
table: ({ children }) => (
<table className="w-full border-collapse mb-4">{children}</table>
),
thead: ({ children }) => (
<thead className="bg-shell-800">{children}</thead>
),
th: ({ children }) => (
<th className="border border-shell-700 px-4 py-2 text-left font-display text-sm text-gray-200">
{children}
</th>
),
td: ({ children }) => (
<td className="border border-shell-700 px-4 py-2 text-sm text-gray-300">
{children}
</td>
),
}}
>
{content}
</ReactMarkdown>
</div>
) : (
<pre className="font-mono text-sm text-gray-300 whitespace-pre-wrap break-words">{content}</pre>
)}
</div>
</div>
</div>
)
}
export default MarkdownViewer
@@ -1,61 +0,0 @@
import { motion } from 'framer-motion'
import { PanelLeft, FolderOpen, RefreshCw } from 'lucide-react'
interface MobileBottomToolbarProps {
onOpenDrawer: () => void
onOpenPathSheet: () => void
onRefresh: () => void
loading: boolean
pathValid: boolean
currentPath: string
}
export function MobileBottomToolbar({
onOpenDrawer,
onOpenPathSheet,
onRefresh,
loading,
pathValid,
currentPath,
}: MobileBottomToolbarProps) {
return (
<motion.div
initial={{ y: 100 }}
animate={{ y: 0 }}
transition={{ duration: 0.2, ease: 'easeOut' }}
className="fixed bottom-0 left-0 right-0 z-40 sm:hidden"
>
<div className="bg-shell-900 border-t border-shell-800 px-3 pt-3 pb-3.5">
<div className="flex items-center gap-2">
{/* Files button */}
<button
onClick={onOpenDrawer}
className="shrink-0 p-3 min-w-[48px] min-h-[48px] rounded-lg active:bg-shell-800 text-gray-400 active:text-crab-400 transition-colors"
>
<PanelLeft size={22} />
</button>
{/* Path input field */}
<button
onClick={onOpenPathSheet}
className="flex-1 min-w-0 flex items-center gap-2 px-3 py-2.5 bg-shell-800 border border-shell-700 rounded-lg active:border-crab-500 transition-colors min-h-[44px] overflow-hidden"
>
<FolderOpen size={16} className={pathValid ? 'text-crab-400 shrink-0' : 'text-shell-500 shrink-0'} />
<span className={`font-console text-sm truncate text-left ${currentPath ? 'text-gray-200' : 'text-shell-500'}`}>
{currentPath || 'Set workspace path...'}
</span>
</button>
{/* Refresh button */}
<button
onClick={onRefresh}
disabled={!pathValid || loading}
className="shrink-0 p-3 min-w-[48px] min-h-[48px] rounded-lg active:bg-shell-800 text-gray-400 active:text-crab-400 transition-colors disabled:opacity-40 disabled:cursor-not-allowed"
>
<RefreshCw size={22} className={loading ? 'animate-spin' : ''} />
</button>
</div>
</div>
</motion.div>
)
}
@@ -1,146 +0,0 @@
import { motion, AnimatePresence } from 'framer-motion'
import { X, FileText, Star } from 'lucide-react'
import { FileTree } from './FileTree'
import type { DirectoryEntry } from '~/lib/workspace-fs'
interface MobileFileDrawerProps {
open: boolean
onClose: () => void
entries: DirectoryEntry[]
selectedPath: string | null
starredPaths: Set<string>
workspacePath: string
pathValid: boolean
onSelect: (path: string, type: 'file' | 'directory') => void
onLoadDirectory: (path: string) => Promise<DirectoryEntry[]>
onStar: (path: string) => void
}
export function MobileFileDrawer({
open,
onClose,
entries,
selectedPath,
starredPaths,
workspacePath,
pathValid,
onSelect,
onLoadDirectory,
onStar,
}: MobileFileDrawerProps) {
// Handle file select with auto-close
const handleSelect = (path: string, type: 'file' | 'directory') => {
onSelect(path, type)
if (type === 'file') {
onClose()
}
}
return (
<AnimatePresence>
{open && (
<>
{/* Backdrop */}
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
onClick={onClose}
className="fixed inset-0 bg-black/60 backdrop-blur-sm z-40"
/>
{/* Drawer */}
<motion.div
initial={{ x: '-100%' }}
animate={{ x: 0 }}
exit={{ x: '-100%' }}
transition={{ type: 'spring', damping: 30, stiffness: 300 }}
className="fixed inset-y-0 left-0 w-full max-w-[85vw] bg-shell-900 z-50 flex flex-col"
>
{/* Header */}
<div className="flex items-center justify-between px-4 py-4 border-b border-shell-800">
<span className="font-display text-sm text-crab-400 uppercase tracking-wider">
Files
</span>
<button
onClick={onClose}
className="p-2 -mr-2 hover:bg-shell-800 rounded-lg transition-colors"
>
<X size={24} className="text-gray-400" />
</button>
</div>
{/* Starred files section */}
{starredPaths.size > 0 && (
<div className="border-b border-shell-800 py-2">
{[...starredPaths].map((filePath) => {
const fileName = filePath.split('/').pop() || filePath
const ext = fileName.includes('.') ? '.' + fileName.split('.').pop() : ''
const isSelected = selectedPath === filePath
return (
<div
key={filePath}
className={`group flex items-center gap-3 px-4 py-3 cursor-pointer transition-colors ${
isSelected
? 'bg-crab-500/20 text-crab-400'
: 'text-gray-300 active:bg-shell-800'
}`}
onClick={() => handleSelect(filePath, 'file')}
>
<FileText
size={18}
className={`shrink-0 ${
ext === '.md' ? 'text-crab-400' : 'text-shell-500'
}`}
/>
<span className="font-console text-sm truncate flex-1">
{fileName}
</span>
<button
onClick={(e) => {
e.stopPropagation()
onStar(filePath)
}}
className="text-yellow-400 active:text-yellow-300 shrink-0 p-1"
>
<Star size={16} fill="currentColor" />
</button>
</div>
)
})}
</div>
)}
{/* File tree */}
<div className="flex-1 overflow-auto py-2">
{pathValid ? (
<FileTree
entries={entries}
selectedPath={selectedPath}
onSelect={handleSelect}
onLoadDirectory={onLoadDirectory}
/>
) : (
<div className="p-4 text-center">
<p className="font-console text-xs text-shell-500">
Set a workspace path to browse files
</p>
</div>
)}
</div>
{/* Footer with path */}
{pathValid && (
<div className="px-4 py-3 border-t border-shell-800 bg-shell-950/50">
<p className="font-console text-[10px] text-shell-600 truncate">
{workspacePath}
</p>
</div>
)}
</motion.div>
</>
)}
</AnimatePresence>
)
}
@@ -1,132 +0,0 @@
import { useRef, useEffect, useState } from 'react'
import { motion, AnimatePresence } from 'framer-motion'
import { FolderOpen, AlertCircle } from 'lucide-react'
interface MobilePathSheetProps {
open: boolean
onClose: () => void
initialPath: string
validatedPath: string
pathValid: boolean
pathError: string | null
onValidate: (path: string) => Promise<boolean>
}
export function MobilePathSheet({
open,
onClose,
initialPath,
validatedPath,
pathValid,
pathError,
onValidate,
}: MobilePathSheetProps) {
const inputRef = useRef<HTMLInputElement>(null)
const [pathInput, setPathInput] = useState(initialPath)
const [loading, setLoading] = useState(false)
// Sync initial path when it changes
useEffect(() => {
setPathInput(initialPath)
}, [initialPath])
// Auto-focus input after animation
useEffect(() => {
if (open) {
const timer = setTimeout(() => {
inputRef.current?.focus()
}, 100)
return () => clearTimeout(timer)
}
}, [open])
const handleSubmit = async () => {
if (!pathInput.trim() || loading) return
setLoading(true)
try {
const success = await onValidate(pathInput)
if (success) {
onClose()
}
} finally {
setLoading(false)
}
}
const handleKeyDown = (e: React.KeyboardEvent) => {
if (e.key === 'Enter') {
handleSubmit()
}
}
return (
<AnimatePresence>
{open && (
<>
{/* Backdrop */}
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
onClick={onClose}
className="fixed inset-0 bg-black/60 backdrop-blur-sm z-40"
/>
{/* Sheet */}
<motion.div
initial={{ y: '100%' }}
animate={{ y: 0 }}
exit={{ y: '100%' }}
transition={{ type: 'spring', damping: 30, stiffness: 300 }}
className="fixed bottom-0 left-0 right-0 z-50 bg-shell-900 rounded-t-2xl"
>
{/* Drag handle */}
<div className="flex justify-center pt-3 pb-2">
<div className="w-10 h-1 bg-shell-700 rounded-full" />
</div>
{/* Content */}
<div className="px-4 pb-safe">
<h3 className="font-display text-sm text-crab-400 uppercase tracking-wider mb-4">
Workspace Path
</h3>
<div className="flex items-center gap-2 mb-4">
<FolderOpen size={18} className="text-shell-500 shrink-0" />
<input
ref={inputRef}
type="text"
value={pathInput}
onChange={(e) => setPathInput(e.target.value)}
onKeyDown={handleKeyDown}
placeholder="Enter workspace path..."
className="flex-1 bg-shell-800 border border-shell-700 rounded-lg px-4 py-3 text-base font-console text-gray-200 placeholder-shell-500 focus:outline-none focus:border-crab-500"
/>
</div>
{pathError && (
<div className="mb-4 px-3 py-2 bg-crab-900/50 border border-crab-700 rounded-lg flex items-center gap-2">
<AlertCircle size={16} className="text-crab-400 shrink-0" />
<span className="text-xs text-crab-200 font-console">{pathError}</span>
</div>
)}
<button
onClick={handleSubmit}
disabled={loading || !pathInput.trim() || (pathValid && pathInput === validatedPath)}
className={`w-full py-4 font-display text-sm uppercase tracking-wider rounded-lg transition-colors mb-4 ${
pathValid && pathInput === validatedPath
? 'bg-shell-800 text-shell-500 cursor-default'
: 'bg-crab-600 hover:bg-crab-500 active:bg-crab-700 text-white disabled:opacity-50 disabled:cursor-not-allowed'
}`}
>
{loading ? 'Opening...' : 'Open'}
</button>
</div>
</motion.div>
</>
)}
</AnimatePresence>
)
}
-192
View File
@@ -1,192 +0,0 @@
import { useState, useCallback, useRef, useEffect } from 'react'
import { motion, AnimatePresence } from 'framer-motion'
import { FileText, X, Plus, AlertCircle } from 'lucide-react'
interface NewFileDialogProps {
open: boolean
onClose: () => void
onCreate: (fileName: string, content: string) => void
}
export function NewFileDialog({ open, onClose, onCreate }: NewFileDialogProps) {
const [fileName, setFileName] = useState('')
const [content, setContent] = useState('')
const [error, setError] = useState<string | null>(null)
const inputRef = useRef<HTMLInputElement>(null)
// Focus input when dialog opens
useEffect(() => {
if (open) {
setFileName('')
setContent('')
setError(null)
const timeoutId = setTimeout(() => inputRef.current?.focus(), 50)
return () => clearTimeout(timeoutId)
}
}, [open])
const handleSubmit = useCallback(async () => {
setError(null)
if (!fileName.trim()) {
setError('Please enter a file name')
return
}
// Validate file name - allow forward slash for subdirectory creation
const invalidChars = /[<>:"\\|?*\x00-\x1f]/g
if (invalidChars.test(fileName)) {
setError('File name contains invalid characters')
return
}
// Check for path traversal - only block parent directory traversal, not relative paths
if (fileName.includes('..') || fileName.startsWith('/')) {
setError('File name cannot contain path traversal sequences')
return
}
// Create the file - wait for completion before closing
try {
await onCreate(fileName.trim(), content)
onClose()
} catch (err) {
setError(err instanceof Error ? err.message : 'Failed to create file')
}
}, [fileName, content, onCreate, onClose])
const handleKeyDown = (e: React.KeyboardEvent) => {
// Only submit on Enter if focus is on the filename input (not content textarea)
if (e.key === 'Enter' && e.target === inputRef.current) {
handleSubmit()
}
if (e.key === 'Escape') {
onClose()
}
}
const addExtension = (ext: string) => {
if (!fileName.includes('.')) {
setFileName(fileName + ext)
}
}
return (
<AnimatePresence>
{open && (
<div className="fixed inset-0 z-50 flex items-center justify-center p-4">
{/* Backdrop */}
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="absolute inset-0 bg-black/60 backdrop-blur-sm"
onClick={onClose}
/>
{/* Dialog */}
<motion.div
initial={{ opacity: 0, scale: 0.95, y: 10 }}
animate={{ opacity: 1, scale: 1, y: 0 }}
exit={{ opacity: 0, scale: 0.95, y: 10 }}
transition={{ type: 'spring', duration: 0.3 }}
className="relative w-full max-w-lg bg-shell-900 rounded-xl border border-shell-700 shadow-2xl overflow-hidden"
>
{/* Header */}
<div className="flex items-center gap-3 px-5 py-4 border-b border-shell-800 bg-neon-mint/5">
<div className="p-2 rounded-lg bg-neon-mint/10 border border-neon-mint/30">
<Plus size={20} className="text-neon-mint" />
</div>
<h3 className="font-display text-lg text-gray-200">Create New File</h3>
</div>
{/* Content */}
<div className="px-5 py-4 space-y-4">
{/* File name input */}
<div>
<label className="block font-console text-xs text-shell-500 uppercase tracking-wider mb-2">
File Name
</label>
<div className="relative">
<FileText size={16} className="absolute left-3 top-1/2 -translate-y-1/2 text-shell-500" />
<input
ref={inputRef}
type="text"
value={fileName}
onChange={(e) => setFileName(e.target.value)}
onKeyDown={handleKeyDown}
placeholder="example.md"
className={`w-full bg-shell-800 border rounded-lg pl-10 pr-3 py-2.5 text-sm font-console text-gray-200 placeholder-shell-500 focus:outline-none focus:ring-1 ${
error
? 'border-crab-500 focus:border-crab-500 focus:ring-crab-500/20'
: 'border-shell-700 focus:border-neon-mint focus:ring-neon-mint/20'
}`}
/>
</div>
{error && (
<div className="flex items-center gap-1.5 mt-2 text-crab-400">
<AlertCircle size={12} />
<span className="font-console text-xs">{error}</span>
</div>
)}
</div>
{/* Quick extension buttons */}
<div>
<label className="block font-console text-xs text-shell-500 uppercase tracking-wider mb-2">
Quick Extensions
</label>
<div className="flex gap-2">
{['.md', '.txt', '.json', '.html'].map((ext) => (
<button
key={ext}
onClick={() => addExtension(ext)}
className="px-3 py-1.5 bg-shell-800 hover:bg-shell-700 rounded-lg text-xs font-console text-gray-400 transition-colors border border-shell-700"
>
{ext}
</button>
))}
</div>
</div>
{/* Optional content */}
<div>
<label className="block font-console text-xs text-shell-500 uppercase tracking-wider mb-2">
Initial Content (optional)
</label>
<textarea
value={content}
onChange={(e) => setContent(e.target.value)}
onKeyDown={handleKeyDown}
placeholder="Enter file content..."
className="w-full h-32 bg-shell-800 border border-shell-700 rounded-lg p-3 text-sm font-mono text-gray-300 placeholder-shell-600 resize-none focus:outline-none focus:border-neon-mint focus:ring-1 focus:ring-neon-mint/20"
spellCheck={false}
/>
</div>
</div>
{/* Footer */}
<div className="flex items-center justify-end gap-3 px-5 py-4 border-t border-shell-800 bg-shell-900/50">
<button
onClick={onClose}
className="flex items-center gap-2 px-4 py-2 bg-shell-800 hover:bg-shell-700 rounded-lg text-sm font-console text-gray-300 transition-colors border border-shell-700"
>
<X size={14} />
Cancel
</button>
<button
onClick={handleSubmit}
className="flex items-center gap-2 px-4 py-2 bg-neon-mint hover:bg-neon-mint/90 rounded-lg text-sm font-console text-shell-950 transition-colors"
>
<Plus size={14} />
Create File
</button>
</div>
</motion.div>
</div>
)}
</AnimatePresence>
)
}
export default NewFileDialog
-9
View File
@@ -1,9 +0,0 @@
export { FileTree } from './FileTree'
export { FileEditor } from './FileEditor'
export { MarkdownViewer } from './MarkdownViewer'
export { MobileBottomToolbar } from './MobileBottomToolbar'
export { MobileFileDrawer } from './MobileFileDrawer'
export { MobilePathSheet } from './MobilePathSheet'
export { ConfirmationDialog } from './ConfirmationDialog'
export { FileContextMenu, FileIcon, TrashIcon, CopyIcon, EditIcon, NewFileIcon } from './FileContextMenu'
export { NewFileDialog } from './NewFileDialog'
-17
View File
@@ -1,17 +0,0 @@
import { useState, useEffect } from 'react'
export function useIsMobile(breakpoint = 640) {
const [isMobile, setIsMobile] = useState(false)
useEffect(() => {
const mql = window.matchMedia(`(max-width: ${breakpoint - 1}px)`)
setIsMobile(mql.matches)
const handler = (e: MediaQueryListEvent) => setIsMobile(e.matches)
mql.addEventListener('change', handler)
return () => mql.removeEventListener('change', handler)
}, [breakpoint])
return isMobile
}
@@ -49,7 +49,7 @@ export class ClawdbotClient {
const timeout = setTimeout(() => {
this._connecting = false
this.ws?.close()
reject(new Error('Connection timeout - is openclaw gateway running?'))
reject(new Error('Connection timeout - is clawdbot gateway running?'))
}, 10000)
try {
@@ -77,7 +77,7 @@ export class ClawdbotClient {
this.handleMessage(msg, resolve, reject, timeout)
} catch (e) {
console.error('[openclaw] Failed to parse message:', e)
console.error('[clawdbot] Failed to parse message:', e)
}
})
@@ -84,21 +84,21 @@ function inferSpawnedBy(subagentKey: string, timestamp?: number): string | undef
export const sessionsCollection = createCollection(
localOnlyCollectionOptions<MonitorSession>({
id: 'openclaw-sessions',
id: 'clawdbot-sessions',
getKey: (item) => item.key,
})
)
export const actionsCollection = createCollection(
localOnlyCollectionOptions<MonitorAction>({
id: 'openclaw-actions',
id: 'clawdbot-actions',
getKey: (item) => item.id,
})
)
export const execsCollection = createCollection(
localOnlyCollectionOptions<MonitorExecProcess>({
id: 'openclaw-execs',
id: 'clawdbot-execs',
getKey: (item) => item.id,
})
)
+9 -138
View File
@@ -2,27 +2,15 @@ import { initTRPC } from '@trpc/server'
import { observable } from '@trpc/server/observable'
import superjson from 'superjson'
import { z } from 'zod'
import { getClawdbotClient } from '~/integrations/openclaw/client'
import { getPersistenceService } from '~/integrations/openclaw/persistence'
import { getClawdbotClient } from '~/integrations/clawdbot/client'
import { getPersistenceService } from '~/integrations/clawdbot/persistence'
import {
parseEventFrame,
sessionInfoToMonitor,
type MonitorSession,
type MonitorAction,
type MonitorExecEvent,
} from '~/integrations/openclaw'
import {
listDirectory,
readFile,
writeFile,
deleteFile,
createFile,
pathExists,
getDefaultWorkspacePath,
expandTilde,
type DirectoryEntry,
type FileContent,
} from '~/lib/workspace-fs'
} from '~/integrations/clawdbot'
// Server-side debug mode state
let debugMode = false
@@ -39,7 +27,7 @@ export const router = t.router
export const publicProcedure = t.procedure
// Clawdbot router
const openclawRouter = router({
const clawdbotRouter = router({
connect: publicProcedure.mutation(async () => {
const client = getClawdbotClient()
if (client.connected) {
@@ -76,7 +64,7 @@ const openclawRouter = router({
.input(z.object({ enabled: z.boolean() }))
.mutation(({ input }) => {
debugMode = input.enabled
console.log(`[openclaw] debug mode ${debugMode ? 'enabled' : 'disabled'}`)
console.log(`[clawdbot] debug mode ${debugMode ? 'enabled' : 'disabled'}`)
return { debugMode }
}),
@@ -90,9 +78,9 @@ const openclawRouter = router({
.mutation(({ input }) => {
collectLogs = input.enabled
if (input.enabled) {
console.log(`[openclaw] log collection started`)
console.log(`[clawdbot] log collection started`)
} else {
console.log(`[openclaw] log collection stopped, ${collectedEvents.length} events collected`)
console.log(`[clawdbot] log collection stopped, ${collectedEvents.length} events collected`)
}
return { collectLogs, eventCount: collectedEvents.length }
}),
@@ -112,7 +100,7 @@ const openclawRouter = router({
clearLogs: publicProcedure.mutation(() => {
const count = collectedEvents.length
collectedEvents.length = 0
console.log(`[openclaw] cleared ${count} collected events`)
console.log(`[clawdbot] cleared ${count} collected events`)
return { cleared: count }
}),
@@ -228,122 +216,6 @@ const openclawRouter = router({
}),
})
// Workspace router for file system operations
const workspaceRouter = router({
// Validate workspace path exists
validatePath: publicProcedure
.input(z.object({ path: z.string() }))
.query(async ({ input }): Promise<{ valid: boolean; error?: string; expandedPath?: string }> => {
try {
const expandedPath = expandTilde(input.path)
const exists = await pathExists(expandedPath)
if (!exists) {
return { valid: false, error: 'Path does not exist' }
}
return { valid: true, expandedPath }
} catch (error) {
return {
valid: false,
error: error instanceof Error ? error.message : 'Unknown error',
}
}
}),
// Get default workspace path
getDefaultPath: publicProcedure.query((): { path: string } => {
return { path: getDefaultWorkspacePath() }
}),
// List directory contents
listDirectory: publicProcedure
.input(z.object({ workspaceRoot: z.string(), path: z.string() }))
.query(async ({ input }): Promise<{ entries: DirectoryEntry[]; error?: string }> => {
try {
const expandedRoot = expandTilde(input.workspaceRoot)
const expandedPath = expandTilde(input.path)
const entries = await listDirectory(expandedRoot, expandedPath)
return { entries }
} catch (error) {
return {
entries: [],
error: error instanceof Error ? error.message : 'Failed to list directory',
}
}
}),
// Read file contents
readFile: publicProcedure
.input(z.object({ workspaceRoot: z.string(), path: z.string() }))
.query(async ({ input }): Promise<FileContent & { error?: string }> => {
try {
const expandedRoot = expandTilde(input.workspaceRoot)
const expandedPath = expandTilde(input.path)
const result = await readFile(expandedRoot, expandedPath)
return result
} catch (error) {
return {
content: '',
path: input.path,
name: '',
error: error instanceof Error ? error.message : 'Failed to read file',
}
}
}),
// Write file contents
writeFile: publicProcedure
.input(z.object({ workspaceRoot: z.string(), path: z.string(), content: z.string() }))
.mutation(async ({ input }): Promise<{ success: boolean; error?: string }> => {
try {
const expandedRoot = expandTilde(input.workspaceRoot)
const expandedPath = expandTilde(input.path)
await writeFile(expandedRoot, expandedPath, input.content)
return { success: true }
} catch (error) {
return {
success: false,
error: error instanceof Error ? error.message : 'Failed to write file',
}
}
}),
// Delete file
deleteFile: publicProcedure
.input(z.object({ workspaceRoot: z.string(), path: z.string() }))
.mutation(async ({ input }): Promise<{ success: boolean; error?: string }> => {
try {
const expandedRoot = expandTilde(input.workspaceRoot)
const expandedPath = expandTilde(input.path)
await deleteFile(expandedRoot, expandedPath)
return { success: true }
} catch (error) {
return {
success: false,
error: error instanceof Error ? error.message : 'Failed to delete file',
}
}
}),
// Create file
createFile: publicProcedure
.input(z.object({ workspaceRoot: z.string(), fileName: z.string(), content: z.string().optional() }))
.mutation(async ({ input }): Promise<{ success: boolean; error?: string; filePath?: string }> => {
try {
const expandedRoot = expandTilde(input.workspaceRoot)
// Construct path server-side using Node.js path.join
const path = await import('path')
const fullPath = path.join(expandedRoot, input.fileName)
await createFile(expandedRoot, fullPath, input.content || '')
return { success: true, filePath: fullPath }
} catch (error) {
return {
success: false,
error: error instanceof Error ? error.message : 'Failed to create file',
}
}
}),
})
export const appRouter = router({
hello: publicProcedure
.input(z.object({ name: z.string().optional() }))
@@ -359,8 +231,7 @@ export const appRouter = router({
]
}),
openclaw: openclawRouter,
workspace: workspaceRouter,
clawdbot: clawdbotRouter,
})
export type AppRouter = typeof appRouter
+1 -1
View File
@@ -3,7 +3,7 @@ import type {
MonitorSession,
MonitorAction,
MonitorExecProcess,
} from '~/integrations/openclaw'
} from '~/integrations/clawdbot'
/** Cast domain data to ReactFlow's Node data type */
function nodeData<T>(data: T): Record<string, unknown> {
-355
View File
@@ -1,355 +0,0 @@
import { promises as fs } from 'fs'
import os from 'os'
import path from 'path'
/**
* File system utilities for workspace explorer
* Provides safe directory traversal and file reading operations
*/
export interface DirectoryEntry {
name: string
type: 'file' | 'directory'
path: string
extension?: string
size?: number
modifiedAt?: Date
}
export interface FileContent {
content: string
path: string
name: string
}
/**
* Validates that a path is within the allowed workspace root
* Prevents directory traversal attacks and symlink escapes
*/
export async function validatePath(workspaceRoot: string, targetPath: string): Promise<string> {
// Resolve to absolute paths
const resolvedRoot = path.resolve(workspaceRoot)
const resolvedTarget = path.resolve(targetPath)
// Resolve symlinks to prevent escaping workspace via symlinked paths
// This ensures we validate the actual filesystem location, not the symlink itself
const realRoot = await fs.realpath(resolvedRoot)
const realTarget = await fs.realpath(resolvedTarget)
// Normalize paths for cross-platform comparison
// Convert backslashes to forward slashes and ensure consistent formatting
const normalizeForComparison = (p: string) => p.replace(/\\/g, '/').replace(/\/$/, '')
const normalizedRoot = normalizeForComparison(realRoot) + '/'
const normalizedTarget = normalizeForComparison(realTarget)
// Ensure target path is within root path by checking with trailing separator
// This prevents bypasses like /home/user/workspace-evil matching /home/user/workspace
if (!normalizedTarget.startsWith(normalizedRoot) && normalizedTarget !== normalizeForComparison(realRoot)) {
throw new Error('Path traversal detected: target path is outside workspace root')
}
return realTarget
}
/**
* Lists directory contents
* Returns files and directories with their types
*/
export async function listDirectory(
workspaceRoot: string,
targetPath: string
): Promise<DirectoryEntry[]> {
const safePath = await validatePath(workspaceRoot, targetPath)
try {
const entries = await fs.readdir(safePath, { withFileTypes: true })
const result: DirectoryEntry[] = await Promise.all(
entries.map(async (entry) => {
const entryPath = path.join(targetPath, entry.name)
const ext = entry.isFile() ? path.extname(entry.name).toLowerCase() : undefined
const isFile = entry.isFile()
// Get file stats for metadata
let size: number | undefined
let modifiedAt: Date | undefined
try {
const stats = await fs.stat(path.join(safePath, entry.name))
size = isFile ? stats.size : undefined
modifiedAt = stats.mtime
} catch {
// Stats unavailable, continue without metadata
}
return {
name: entry.name,
type: entry.isDirectory() ? 'directory' : 'file',
path: entryPath,
extension: ext,
size,
modifiedAt,
}
})
)
// Sort: directories first, then files, both alphabetically
result.sort((a, b) => {
if (a.type === b.type) {
return a.name.localeCompare(b.name)
}
return a.type === 'directory' ? -1 : 1
})
return result
} catch (error) {
throw new Error(
`Failed to list directory: ${error instanceof Error ? error.message : 'Unknown error'}`
)
}
}
/**
* Reads file contents
* Only reads text files (markdown, json, txt, etc.)
*/
export async function readFile(
workspaceRoot: string,
filePath: string
): Promise<FileContent> {
const safePath = await validatePath(workspaceRoot, filePath)
try {
// Check if file exists and is a file
const stats = await fs.stat(safePath)
if (!stats.isFile()) {
throw new Error('Path is not a file')
}
// Check file size (limit to 10MB)
const maxSize = 10 * 1024 * 1024 // 10MB
if (stats.size > maxSize) {
throw new Error('File too large (max 10MB)')
}
// Read file content
const content = await fs.readFile(safePath, 'utf-8')
const name = path.basename(safePath)
return {
content,
path: filePath,
name,
}
} catch (error) {
throw new Error(
`Failed to read file: ${error instanceof Error ? error.message : 'Unknown error'}`
)
}
}
/**
* Checks if a path exists and is accessible
*/
export async function pathExists(targetPath: string): Promise<boolean> {
try {
await fs.access(targetPath)
return true
} catch {
return false
}
}
/**
* Gets the default workspace path
* Returns the user's home directory + .openclaw/workspace
*/
export function getDefaultWorkspacePath(): string {
const homeDir = os.homedir()
return path.join(homeDir, '.openclaw', 'workspace')
}
/**
* Checks if a file is a markdown file based on extension
*/
export function isMarkdownFile(filename: string): boolean {
const ext = path.extname(filename).toLowerCase()
return ext === '.md' || ext === '.markdown'
}
/**
* Expands tilde (~) to the user's home directory on Unix-based systems
* Handles both "~/" prefix and standalone "~" path
*/
export function expandTilde(inputPath: string): string {
// Only expand if path starts with ~
if (!inputPath.startsWith('~')) {
return inputPath
}
// Get home directory using Node.js built-in (handles cross-platform)
// Returns /root in containerized environments if HOME is not set
const homeDir = os.homedir()
// Handle "~/" prefix or standalone "~"
if (inputPath === '~' || inputPath.startsWith('~/')) {
return path.join(homeDir, inputPath.slice(1))
}
// Path starts with ~ but not followed by / (e.g., ~username)
// This is a valid Unix path referring to another user's home
// Return as-is and let the system handle it
return inputPath
}
/**
* Checks if a file is viewable as text
*/
export function isTextFile(filename: string): boolean {
const textExtensions = [
'.md',
'.markdown',
'.txt',
'.json',
'.yaml',
'.yml',
'.js',
'.ts',
'.jsx',
'.tsx',
'.css',
'.html',
'.xml',
'.sh',
'.bash',
'.zsh',
'.py',
'.rb',
'.go',
'.rs',
'.java',
'.c',
'.cpp',
'.h',
'.hpp',
'.cs',
'.php',
'.swift',
'.kt',
'.scala',
'.r',
'.pl',
'.lua',
'.vim',
'.conf',
'.cfg',
'.ini',
'.toml',
'.env',
'.gitignore',
'.dockerignore',
]
// Get extension - handle files starting with dot (like .gitignore)
// path.extname returns '' for files like 'Makefile' and '.gitignore'
// We need to distinguish between extensionless files and dotfiles
const lastDotIndex = filename.lastIndexOf('.')
const ext = lastDotIndex > 0 ? path.extname(filename).toLowerCase() : ''
return textExtensions.includes(ext) || ext === ''
}
/**
* Writes content to a file
* Creates the file if it doesn't exist, overwrites if it does
*/
export async function writeFile(
workspaceRoot: string,
filePath: string,
content: string
): Promise<void> {
const safePath = await validatePath(workspaceRoot, filePath)
try {
// Check if parent directory exists
const parentDir = path.dirname(safePath)
const parentStats = await fs.stat(parentDir)
if (!parentStats.isDirectory()) {
throw new Error('Parent path is not a directory')
}
// Write file content
await fs.writeFile(safePath, content, 'utf-8')
} catch (error) {
throw new Error(
`Failed to write file: ${error instanceof Error ? error.message : 'Unknown error'}`
)
}
}
/**
* Deletes a file
*/
export async function deleteFile(
workspaceRoot: string,
filePath: string
): Promise<void> {
const safePath = await validatePath(workspaceRoot, filePath)
try {
// Check if file exists and is a file
const stats = await fs.stat(safePath)
if (!stats.isFile()) {
throw new Error('Path is not a file')
}
// Delete the file
await fs.unlink(safePath)
} catch (error) {
throw new Error(
`Failed to delete file: ${error instanceof Error ? error.message : 'Unknown error'}`
)
}
}
/**
* Creates a new file with optional content
*/
export async function createFile(
workspaceRoot: string,
filePath: string,
content: string = ''
): Promise<void> {
// Expand user home directory and resolve path
const expandedRoot = expandTilde(workspaceRoot)
const expandedFilePath = expandTilde(filePath)
// Get the parent directory path
const parentDir = path.dirname(expandedFilePath)
const fileName = path.basename(expandedFilePath)
// Validate that parent directory is within workspace root
const safeParentPath = await validatePath(expandedRoot, parentDir)
// Check if file already exists
const exists = await pathExists(expandedFilePath)
if (exists) {
throw new Error('File already exists')
}
// Check if parent directory exists
try {
const parentStats = await fs.stat(safeParentPath)
if (!parentStats.isDirectory()) {
throw new Error('Parent path is not a directory')
}
} catch {
throw new Error('Parent directory does not exist')
}
// Create the file
try {
await fs.writeFile(expandedFilePath, content, 'utf-8')
} catch (error) {
throw new Error(
`Failed to create file: ${error instanceof Error ? error.message : 'Unknown error'}`
)
}
}
+4 -12
View File
@@ -1,7 +1,7 @@
import { useState, useCallback, useEffect } from 'react'
import { createFileRoute, Link } from '@tanstack/react-router'
import { motion } from 'framer-motion'
import { Github, FolderOpen } from 'lucide-react'
import { Github } from 'lucide-react'
import { version } from '../../package.json'
import { CrabIdleAnimation, CrabJumpAnimation, CrabAttackAnimation } from '~/components/ani'
@@ -123,7 +123,7 @@ function Home() {
transition={{ duration: 0.5, delay: 0.3 }}
className="font-console font-bold text-lg text-gray-400 mb-4 tracking-wide uppercase"
>
Open-Source OpenClaw Companion
Open-Source Moltbot (Clawdbot) Companion
</motion.p>
{/* Console-style description */}
@@ -135,26 +135,18 @@ function Home() {
>
<span className="text-crab-600">&gt;</span> Real-time AI agent activity monitoring<br />
<span className="text-crab-600">&gt;</span> Session tracking & action visualization<br />
<span className="text-crab-600">&gt;</span> Workspace file browser & markdown viewer
<span className="text-crab-600">&gt;</span> Multi-platform gateway interface
</motion.div>
{/* CTA Buttons */}
{/* CTA Button */}
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.5, delay: 0.5 }}
className="flex flex-col sm:flex-row items-center justify-center gap-4"
>
<Link to="/monitor" className="btn-retro inline-block rounded-lg font-black!">
Launch Monitor
</Link>
<Link
to="/workspace"
className="btn-retro btn-retro-secondary inline-flex items-center gap-2 rounded-lg font-black!"
>
<FolderOpen size={18} />
Explore Workspace
</Link>
</motion.div>
{/* Decorative line */}
+43 -66
View File
@@ -4,7 +4,6 @@ import { useLiveQuery } from '@tanstack/react-db'
import { motion } from 'framer-motion'
import { ArrowLeft, Loader2, HardDrive, Trash2 } from 'lucide-react'
import { trpc } from '~/integrations/trpc/client'
import { NavTabs } from '~/components/navigation'
import {
sessionsCollection,
actionsCollection,
@@ -16,17 +15,14 @@ import {
clearCollections,
hydrateFromServer,
clearCompletedExecs,
} from '~/integrations/openclaw'
} from '~/integrations/clawdbot'
import {
ActionGraph,
SessionList,
SettingsPanel,
StatusIndicator,
MobileSessionDrawer,
MobileMonitorToolbar,
} from '~/components/monitor'
import { CrabIdleAnimation } from '~/components/ani'
import { useIsMobile } from '~/hooks/useIsMobile'
export const Route = createFileRoute('/monitor/')({
component: MonitorPageWrapper,
@@ -87,9 +83,8 @@ function MonitorPage() {
// Settings panel state
const [settingsOpen, setSettingsOpen] = useState(false)
// Mobile state
const isMobile = useIsMobile()
const [sessionDrawerOpen, setSessionDrawerOpen] = useState(false)
// Hydrating state for large graph loading
const [isHydrating, setIsHydrating] = useState(false)
// Live queries from TanStack DB collections
const sessionsQuery = useLiveQuery(sessionsCollection)
@@ -120,7 +115,7 @@ function MonitorPage() {
const checkPersistenceStatus = async () => {
try {
const status = await trpc.openclaw.persistenceStatus.query()
const status = await trpc.clawdbot.persistenceStatus.query()
setPersistenceEnabled(status.enabled)
setPersistenceStartedAt(status.startedAt)
setPersistenceSessionCount(status.sessionCount)
@@ -132,7 +127,7 @@ function MonitorPage() {
const checkStatus = async () => {
try {
const status = await trpc.openclaw.status.query()
const status = await trpc.clawdbot.status.query()
setConnected(status.connected)
} catch {
setConnected(false)
@@ -143,7 +138,7 @@ function MonitorPage() {
setConnecting(true)
setRetryCount(retry)
try {
const result = await trpc.openclaw.connect.mutate()
const result = await trpc.clawdbot.connect.mutate()
if (result.status === 'connected' || result.status === 'already_connected') {
setConnected(true)
setRetryCount(0)
@@ -166,26 +161,29 @@ function MonitorPage() {
const hydrateFromPersistence = async () => {
try {
const status = await trpc.openclaw.persistenceStatus.query()
const status = await trpc.clawdbot.persistenceStatus.query()
if (status.sessionCount > 0 || status.actionCount > 0 || status.execEventCount > 0) {
const data = await trpc.openclaw.persistenceHydrate.query()
setIsHydrating(true)
const data = await trpc.clawdbot.persistenceHydrate.query()
hydrateFromServer(data.sessions, data.actions, data.execEvents ?? [])
console.log(
`[monitor] hydrated ${data.sessions.length} sessions, ${data.actions.length} actions, ${(data.execEvents ?? []).length} exec events`
)
setIsHydrating(false)
}
setPersistenceEnabled(status.enabled)
setPersistenceStartedAt(status.startedAt)
setPersistenceSessionCount(status.sessionCount)
setPersistenceActionCount(status.actionCount)
} catch (e) {
setIsHydrating(false)
console.error('Failed to hydrate:', e)
}
}
const handleDisconnect = async () => {
try {
await trpc.openclaw.disconnect.mutate()
await trpc.clawdbot.disconnect.mutate()
setConnected(false)
clearCollections()
} catch (e) {
@@ -195,7 +193,7 @@ function MonitorPage() {
const loadSessions = async () => {
try {
const result = await trpc.openclaw.sessions.query(
const result = await trpc.clawdbot.sessions.query(
historicalMode ? { activeMinutes: 1440 } : { activeMinutes: 60 }
)
if (result.sessions) {
@@ -222,7 +220,7 @@ function MonitorPage() {
const handleDebugModeChange = async (enabled: boolean) => {
setDebugMode(enabled)
try {
await trpc.openclaw.setDebugMode.mutate({ enabled })
await trpc.clawdbot.setDebugMode.mutate({ enabled })
} catch (e) {
console.error('Failed to set debug mode:', e)
}
@@ -231,7 +229,7 @@ function MonitorPage() {
const handleLogCollectionChange = async (enabled: boolean) => {
setLogCollection(enabled)
try {
const result = await trpc.openclaw.setLogCollection.mutate({ enabled })
const result = await trpc.clawdbot.setLogCollection.mutate({ enabled })
setLogCount(result.eventCount)
} catch (e) {
console.error('Failed to set log collection:', e)
@@ -240,12 +238,12 @@ function MonitorPage() {
const handleDownloadLogs = async () => {
try {
const result = await trpc.openclaw.downloadLogs.query()
const result = await trpc.clawdbot.downloadLogs.query()
const blob = new Blob([JSON.stringify(result, null, 2)], { type: 'application/json' })
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = `openclaw-events-${new Date().toISOString().slice(0, 19).replace(/:/g, '-')}.json`
a.download = `clawdbot-events-${new Date().toISOString().slice(0, 19).replace(/:/g, '-')}.json`
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
@@ -257,7 +255,7 @@ function MonitorPage() {
const handleClearLogs = async () => {
try {
await trpc.openclaw.clearLogs.mutate()
await trpc.clawdbot.clearLogs.mutate()
setLogCount(0)
} catch (e) {
console.error('Failed to clear logs:', e)
@@ -266,7 +264,7 @@ function MonitorPage() {
const handlePersistenceStart = async () => {
try {
const result = await trpc.openclaw.persistenceStart.mutate()
const result = await trpc.clawdbot.persistenceStart.mutate()
setPersistenceEnabled(result.enabled)
setPersistenceStartedAt(result.startedAt)
} catch (e) {
@@ -276,7 +274,7 @@ function MonitorPage() {
const handlePersistenceStop = async () => {
try {
const result = await trpc.openclaw.persistenceStop.mutate()
const result = await trpc.clawdbot.persistenceStop.mutate()
setPersistenceEnabled(result.enabled)
setPersistenceStartedAt(null)
} catch (e) {
@@ -286,7 +284,7 @@ function MonitorPage() {
const handlePersistenceClear = async () => {
try {
await trpc.openclaw.persistenceClear.mutate()
await trpc.clawdbot.persistenceClear.mutate()
setPersistenceSessionCount(0)
setPersistenceActionCount(0)
clearCollections()
@@ -300,7 +298,7 @@ function MonitorPage() {
if (!logCollection) return
const interval = setInterval(async () => {
try {
const result = await trpc.openclaw.getLogCollection.query()
const result = await trpc.clawdbot.getLogCollection.query()
setLogCount(result.eventCount)
} catch {
// ignore
@@ -313,7 +311,7 @@ function MonitorPage() {
useEffect(() => {
const interval = setInterval(async () => {
try {
const status = await trpc.openclaw.persistenceStatus.query()
const status = await trpc.clawdbot.persistenceStatus.query()
setPersistenceEnabled(status.enabled)
setPersistenceStartedAt(status.startedAt)
setPersistenceSessionCount(status.sessionCount)
@@ -349,7 +347,7 @@ function MonitorPage() {
useEffect(() => {
if (!connected) return
const subscription = trpc.openclaw.events.subscribe(undefined, {
const subscription = trpc.clawdbot.events.subscribe(undefined, {
onData: (data) => {
if (data.type === 'session' && data.session?.key && data.session.status) {
updateSessionStatus(data.session.key, data.session.status)
@@ -386,13 +384,16 @@ function MonitorPage() {
<ArrowLeft size={18} className="text-gray-400 group-hover:text-crab-400" />
</Link>
{/* Navigation tabs */}
<NavTabs />
{/* Connection status */}
<div className="flex items-center gap-2 ml-2">
<StatusIndicator status={connecting ? 'thinking' : connected ? 'active' : 'idle'} />
<div className="flex items-center gap-3">
<div className="crab-icon-glow">
<CrabIdleAnimation className="w-7 h-7" />
</div>
<h1 className="font-arcade text-xs text-crab-400 glow-red tracking-wider">
MONITOR
</h1>
</div>
<StatusIndicator status={connecting ? 'thinking' : connected ? 'active' : 'idle'} />
</div>
<div className="relative flex items-center gap-4">
@@ -487,51 +488,27 @@ function MonitorPage() {
{/* Main content */}
<div className="flex-1 flex overflow-hidden">
{/* Sidebar - desktop only */}
{!isMobile && (
<SessionList
sessions={sessions}
selectedKey={selectedSession}
onSelect={setSelectedSession}
collapsed={sidebarCollapsed}
onToggleCollapse={handleToggleSidebar}
/>
)}
{/* Sidebar */}
<SessionList
sessions={sessions}
selectedKey={selectedSession}
onSelect={setSelectedSession}
collapsed={sidebarCollapsed}
onToggleCollapse={handleToggleSidebar}
/>
{/* Graph area */}
<div className={`flex-1 relative ${isMobile ? 'pb-20' : ''}`}>
<div className="flex-1 relative">
<ActionGraph
sessions={sessions}
actions={actions}
execs={execs}
selectedSession={selectedSession}
onSessionSelect={setSelectedSession}
isHydrating={isHydrating}
/>
</div>
</div>
{/* Mobile components */}
{isMobile && (
<>
<MobileMonitorToolbar
onOpenDrawer={() => setSessionDrawerOpen(true)}
onOpenSettings={() => setSettingsOpen(true)}
connected={connected}
connecting={connecting}
sessionCount={sessions.length}
actionCount={actions.length}
completedCount={completedCount}
onClearCompleted={handleClearCompleted}
/>
<MobileSessionDrawer
open={sessionDrawerOpen}
onClose={() => setSessionDrawerOpen(false)}
sessions={sessions}
selectedKey={selectedSession}
onSelect={setSelectedSession}
/>
</>
)}
</div>
)
}
-826
View File
@@ -1,826 +0,0 @@
import { useState, useEffect, useCallback, useMemo } from 'react'
import { createFileRoute, Link } from '@tanstack/react-router'
import { motion } from 'framer-motion'
import {
ArrowLeft,
FolderOpen,
RefreshCw,
AlertCircle,
PanelLeft,
PanelLeftClose,
Star,
FileText,
Plus,
} from 'lucide-react'
import { trpc } from '~/integrations/trpc/client'
import {
FileTree,
FileEditor,
MobileBottomToolbar,
MobileFileDrawer,
MobilePathSheet,
ConfirmationDialog,
FileContextMenu,
TrashIcon,
CopyIcon,
EditIcon,
NewFileDialog,
} from '~/components/workspace'
import { NavTabs } from '~/components/navigation'
import { CrabIdleAnimation } from '~/components/ani'
import { useIsMobile } from '~/hooks/useIsMobile'
import type { DirectoryEntry } from '~/lib/workspace-fs'
// Get parent directory path using path separator logic
// Works cross-platform for both / and \ separators
function getParentDirPath(filePath: string): string {
// Normalize to forward slashes for consistent processing
const normalized = filePath.replace(/\\/g, '/')
const lastSlashIndex = normalized.lastIndexOf('/')
if (lastSlashIndex <= 0) {
return filePath
}
// Return the original path up to the last separator
return filePath.substring(0, lastSlashIndex)
}
export const Route = createFileRoute('/workspace/')({
component: WorkspacePageWrapper,
})
// Wrapper to ensure client-only rendering
function WorkspacePageWrapper() {
const [mounted, setMounted] = useState(false)
useEffect(() => setMounted(true), [])
if (!mounted) {
return (
<div className="h-screen flex items-center justify-center bg-shell-950 text-white">
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
className="flex flex-col items-center gap-4"
>
<div className="crab-icon-glow">
<CrabIdleAnimation className="w-16 h-16" />
</div>
<div className="flex items-center gap-3">
<span className="font-display text-sm text-gray-400 tracking-wide uppercase">
Loading Workspace...
</span>
</div>
</motion.div>
</div>
)
}
return <WorkspacePage />
}
function WorkspacePage() {
// Workspace path state
const [workspacePath, setWorkspacePath] = useState('')
const [workspacePathInput, setWorkspacePathInput] = useState('')
const [pathError, setPathError] = useState<string | null>(null)
const [pathValid, setPathValid] = useState(false)
// File tree state
const [loading, setLoading] = useState(false)
const [pathCache, setPathCache] = useState<Map<string, DirectoryEntry[]>>(new Map())
// Selected file state
const [selectedPath, setSelectedPath] = useState<string | null>(null)
const [selectedFileContent, setSelectedFileContent] = useState('')
const [selectedFileName, setSelectedFileName] = useState('')
const [selectedFileSize, setSelectedFileSize] = useState<number | undefined>()
const [selectedFileModified, setSelectedFileModified] = useState<Date | undefined>()
const [fileError, setFileError] = useState<string | undefined>()
// Sidebar collapse state
const [sidebarCollapsed, setSidebarCollapsed] = useState(false)
// Starred files state
const [starredPaths, setStarredPaths] = useState<Set<string>>(new Set())
// Mobile state
const isMobile = useIsMobile()
const [fileDrawerOpen, setFileDrawerOpen] = useState(false)
const [pathSheetOpen, setPathSheetOpen] = useState(false)
// Root entries for FileTree
const rootEntries = workspacePath && pathValid ? (pathCache.get(workspacePath) || []) : []
// Load saved path and starred files on mount
useEffect(() => {
const savedPath = localStorage.getItem('crabcrawl:workspacePath')
if (savedPath) {
setWorkspacePathInput(savedPath)
// Auto-validate saved path
validatePathAndSet(savedPath)
} else {
loadDefaultPath()
}
// Load starred files
const savedStarred = localStorage.getItem('crabcrawl:starredFiles')
if (savedStarred) {
try {
const parsed = JSON.parse(savedStarred)
setStarredPaths(new Set(parsed))
} catch {
// ignore invalid JSON
}
}
}, [])
// Load entries when workspace path changes and is valid
useEffect(() => {
if (workspacePath && pathValid) {
loadDirectory(workspacePath)
}
}, [workspacePath, pathValid])
const loadDefaultPath = async () => {
try {
const result = await trpc.workspace.getDefaultPath.query()
setWorkspacePathInput(result.path)
// Don't auto-set workspace path - let user confirm
} catch (error) {
console.error('Failed to get default path:', error)
}
}
const validatePathAndSet = async (pathToValidate: string) => {
setPathError(null)
setPathValid(false)
if (!pathToValidate.trim()) {
setPathError('Please enter a path')
return
}
try {
const result = await trpc.workspace.validatePath.query({
path: pathToValidate,
})
if (result.valid && result.expandedPath) {
// Use the expanded path (e.g., ~/Documents -> /home/user/Documents)
setWorkspacePath(result.expandedPath)
setWorkspacePathInput(result.expandedPath)
setPathValid(true)
// Persist to localStorage
localStorage.setItem('crabcrawl:workspacePath', result.expandedPath)
// Clear cache when path changes
setPathCache(new Map())
setSelectedPath(null)
setSelectedFileContent('')
setSelectedFileName('')
} else {
setPathError(result.error || 'Invalid path')
}
} catch (error) {
setPathError(error instanceof Error ? error.message : 'Failed to validate path')
}
}
const validateAndSetPath = async () => {
await validatePathAndSet(workspacePathInput)
}
const loadDirectory = async (dirPath: string): Promise<DirectoryEntry[]> => {
// Check cache first
if (pathCache.has(dirPath)) {
return pathCache.get(dirPath)!
}
setLoading(true)
try {
const result = await trpc.workspace.listDirectory.query({
workspaceRoot: workspacePath,
path: dirPath,
})
if (result.error) {
throw new Error(result.error)
}
// Update cache
setPathCache((prev) => new Map(prev).set(dirPath, result.entries))
return result.entries
} catch (error) {
console.error('Failed to load directory:', error)
return []
} finally {
setLoading(false)
}
}
const loadFile = useCallback(
async (filePath: string) => {
setFileError(undefined)
try {
const result = await trpc.workspace.readFile.query({
workspaceRoot: workspacePath,
path: filePath,
})
if (result.error) {
setFileError(result.error)
setSelectedFileContent('')
setSelectedFileName('')
setSelectedFileSize(undefined)
setSelectedFileModified(undefined)
} else {
setSelectedFileContent(result.content)
setSelectedFileName(result.name)
// Get file metadata from the parent directory entry if available
const parentDir = pathCache.get(getParentDirPath(filePath) || workspacePath)
const fileEntry = parentDir?.find(e => e.path === filePath)
setSelectedFileSize(fileEntry?.size)
setSelectedFileModified(fileEntry?.modifiedAt)
}
} catch (error) {
setFileError(error instanceof Error ? error.message : 'Failed to read file')
setSelectedFileContent('')
setSelectedFileName('')
setSelectedFileSize(undefined)
setSelectedFileModified(undefined)
}
},
[workspacePath, pathCache, selectedPath]
)
const handleSelect = useCallback(
async (path: string, type: 'file' | 'directory') => {
if (type === 'file') {
setSelectedPath(path)
await loadFile(path)
}
// Note: directory expansion is handled by FileTree component internally
},
[loadFile]
)
// Handle directory loading for FileTree
const handleLoadDirectory = useCallback(
async (dirPath: string): Promise<DirectoryEntry[]> => {
return loadDirectory(dirPath)
},
[workspacePath]
)
const handleRefresh = useCallback(async () => {
if (!workspacePath || !pathValid) return
// Store current selection before clearing cache
const currentSelectedPath = selectedPath
// Clear cache first, then reload
// Use a callback to ensure cache is cleared before loading
setPathCache(new Map())
// Small delay to ensure React has processed the state update
// before we try to load the directory
await new Promise(resolve => setTimeout(resolve, 0))
// Reload root directory - this will repopulate the file tree
// Force reload by bypassing cache check
setLoading(true)
try {
const result = await trpc.workspace.listDirectory.query({
workspaceRoot: workspacePath,
path: workspacePath,
})
if (result.error) {
throw new Error(result.error)
}
// Update cache with fresh data
setPathCache(new Map([[workspacePath, result.entries]]))
} catch (error) {
console.error('Failed to load directory:', error)
} finally {
setLoading(false)
}
// Reload selected file if any (with error handling for deleted files)
if (currentSelectedPath) {
try {
const result = await trpc.workspace.readFile.query({
workspaceRoot: workspacePath,
path: currentSelectedPath,
})
if (result.error) {
// File no longer exists - clear selection gracefully
setSelectedPath(null)
setSelectedFileContent('')
setSelectedFileName('')
setSelectedFileSize(undefined)
setSelectedFileModified(undefined)
setFileError(result.error)
} else {
setSelectedFileContent(result.content)
setSelectedFileName(result.name)
// Get file metadata from the parent directory entry if available
const parentDir = pathCache.get(getParentDirPath(currentSelectedPath) || workspacePath)
const fileEntry = parentDir?.find(e => e.path === currentSelectedPath)
setSelectedFileSize(fileEntry?.size)
setSelectedFileModified(fileEntry?.modifiedAt)
}
} catch (error) {
// File no longer exists - clear selection gracefully
setSelectedPath(null)
setSelectedFileContent('')
setSelectedFileName('')
setSelectedFileSize(undefined)
setSelectedFileModified(undefined)
setFileError(error instanceof Error ? error.message : 'Failed to read file')
}
}
}, [workspacePath, pathValid, selectedPath, loadFile])
const handleKeyDown = (e: React.KeyboardEvent) => {
if (e.key === 'Enter') {
validateAndSetPath()
}
}
// Handle starring/unstarring files
const handleStar = useCallback((filePath: string) => {
setStarredPaths((prev) => {
const next = new Set(prev)
if (next.has(filePath)) {
next.delete(filePath)
} else {
next.add(filePath)
}
// Persist to localStorage
localStorage.setItem('crabcrawl:starredFiles', JSON.stringify([...next]))
return next
})
}, [])
// Delete confirmation dialog state
const [deleteConfirmOpen, setDeleteConfirmOpen] = useState(false)
const [fileToDelete, setFileToDelete] = useState<string | null>(null)
// New file dialog state
const [newFileDialogOpen, setNewFileDialogOpen] = useState(false)
// Context menu state
const [contextMenuOpen, setContextMenuOpen] = useState(false)
const [contextMenuPosition, setContextMenuPosition] = useState<{ x: number; y: number } | null>(null)
const [contextMenuFilePath, setContextMenuFilePath] = useState<string | null>(null)
// Handle save file with confirmation callback
const handleSave = useCallback(
async (content: string, callback: (success: boolean) => void) => {
if (!selectedPath) {
callback(false)
return
}
try {
await trpc.workspace.writeFile.mutate({
workspaceRoot: workspacePath,
path: selectedPath,
content,
})
// Reload the file to get updated metadata
await loadFile(selectedPath)
// Refresh the directory to update metadata
await handleRefresh()
callback(true)
} catch (error) {
console.error('Failed to save file:', error)
callback(false)
}
},
[selectedPath, workspacePath, loadFile, handleRefresh]
)
// Handle delete file
const handleDeleteFile = useCallback(async () => {
if (!fileToDelete) return
try {
await trpc.workspace.deleteFile.mutate({
workspaceRoot: workspacePath,
path: fileToDelete,
})
// If deleted file was selected, clear selection
if (selectedPath === fileToDelete) {
setSelectedPath(null)
setSelectedFileContent('')
setSelectedFileName('')
setSelectedFileSize(undefined)
setSelectedFileModified(undefined)
}
// Clear cache and refresh
setPathCache(new Map())
await handleRefresh()
} catch (error) {
console.error('Failed to delete file:', error)
} finally {
setFileToDelete(null)
setDeleteConfirmOpen(false)
}
}, [fileToDelete, workspacePath, selectedPath, handleRefresh])
// Handle create file
const handleCreateFile = useCallback(
async (fileName: string, content: string) => {
try {
const result = await trpc.workspace.createFile.mutate({
workspaceRoot: workspacePath,
fileName,
content,
})
if (result.success && result.filePath) {
// Clear cache and refresh
setPathCache(new Map())
await handleRefresh()
// Select the new file
setSelectedPath(result.filePath)
await loadFile(result.filePath)
} else if (result.error) {
throw new Error(result.error)
}
} catch (error) {
console.error('Failed to create file:', error)
throw error
}
},
[workspacePath, loadFile, handleRefresh]
)
// Handle context menu
const handleContextMenu = useCallback(
(e: React.MouseEvent, filePath: string) => {
e.preventDefault()
e.stopPropagation()
setContextMenuFilePath(filePath)
setContextMenuPosition({ x: e.clientX, y: e.clientY })
setContextMenuOpen(true)
},
[]
)
// Context menu items
const contextMenuItems = useMemo(() => [
{
icon: <EditIcon size={14} />,
label: 'Edit',
onClick: () => {
if (contextMenuFilePath) {
handleSelect(contextMenuFilePath, 'file')
}
},
},
{
icon: <CopyIcon size={14} />,
label: 'Copy Path',
onClick: async () => {
if (contextMenuFilePath) {
try {
await navigator.clipboard.writeText(contextMenuFilePath)
} catch {
console.warn('Failed to copy to clipboard')
}
}
},
},
{
icon: <TrashIcon size={14} />,
label: 'Delete',
danger: true,
onClick: () => {
if (contextMenuFilePath) {
setFileToDelete(contextMenuFilePath)
setDeleteConfirmOpen(true)
}
},
},
], [contextMenuFilePath, handleSelect])
return (
<div className="h-screen flex flex-col bg-shell-950 text-white overflow-hidden">
{/* Header */}
<header className="flex items-center justify-between px-4 py-3 bg-shell-900 relative">
{/* Gradient accent */}
<div className="absolute inset-0 bg-linear-to-r from-crab-950/20 via-transparent to-transparent pointer-events-none" />
<div className="relative flex items-center gap-4">
<Link
to="/"
className="p-2 hover:bg-shell-800 rounded-lg transition-all border border-transparent hover:border-shell-600 group"
>
<ArrowLeft size={18} className="text-gray-400 group-hover:text-crab-400" />
</Link>
{/* Navigation tabs */}
<NavTabs />
</div>
{/* Path input - desktop only */}
<div className="hidden sm:flex relative items-center gap-2 flex-1 max-w-2xl mx-4">
<div className="flex-1 relative">
<FolderOpen size={16} className="absolute left-3 top-1/2 -translate-y-1/2 text-shell-500 pointer-events-none" />
<input
type="text"
value={workspacePathInput}
onChange={(e) => setWorkspacePathInput(e.target.value)}
onKeyDown={handleKeyDown}
placeholder="Enter workspace path..."
className="w-full bg-shell-800 border border-shell-700 rounded-lg pl-9 pr-3 py-1.5 text-sm font-console text-gray-200 placeholder-shell-500 focus:outline-none focus:border-crab-500 focus:ring-1 focus:ring-crab-500/20"
/>
</div>
<button
onClick={validateAndSetPath}
disabled={pathValid && workspacePathInput === workspacePath}
className={`px-3 py-1.5 text-sm font-display rounded-lg transition-colors shrink-0 ${
pathValid && workspacePathInput === workspacePath
? 'bg-shell-800 text-shell-500 cursor-default'
: 'bg-crab-600 hover:bg-crab-500 text-white'
}`}
>
Open
</button>
{pathError && (
<div className="absolute top-full left-0 right-0 mt-2 px-3 py-2 bg-crab-900/90 border border-crab-700 rounded-lg flex items-center gap-2 z-50">
<AlertCircle size={14} className="text-crab-400" />
<span className="text-xs text-crab-200 font-console">{pathError}</span>
</div>
)}
</div>
{/* Refresh button - desktop only */}
<div className="hidden sm:flex relative items-center gap-3">
<button
onClick={handleRefresh}
disabled={!pathValid || loading}
className="p-2 hover:bg-shell-800 rounded-lg transition-all border border-transparent hover:border-shell-600 disabled:opacity-50 disabled:cursor-not-allowed group"
title="Refresh"
>
<RefreshCw
size={18}
className={`text-gray-400 group-hover:text-crab-400 ${loading ? 'animate-spin' : ''}`}
/>
</button>
</div>
</header>
{/* Main content */}
<div className="flex-1 flex overflow-hidden">
{/* Sidebar - desktop only */}
{!isMobile && (
<motion.div
initial={false}
animate={{ width: sidebarCollapsed ? 56 : 320 }}
transition={{ duration: 0.2, ease: 'easeInOut' }}
className="border-r border-shell-800 bg-shell-900/50 flex flex-col overflow-hidden"
>
{/* Sidebar header */}
<div className={`flex items-center justify-between px-3 py-3 border-b border-shell-800 ${sidebarCollapsed ? 'justify-center' : ''}`}>
{!sidebarCollapsed && (
<span className="font-display text-xs text-shell-500 uppercase tracking-wider">
Files
</span>
)}
<div className={`flex items-center gap-1 ${sidebarCollapsed ? 'mx-auto flex-col' : ''}`}>
{loading && !sidebarCollapsed && (
<motion.div
animate={{ rotate: 360 }}
transition={{ duration: 1, repeat: Infinity, ease: 'linear' }}
>
<RefreshCw size={14} className="text-shell-500" />
</motion.div>
)}
{!sidebarCollapsed && (
<button
onClick={() => setNewFileDialogOpen(true)}
className="p-1.5 hover:bg-shell-800 rounded transition-colors"
title="New File"
>
<Plus size={16} className="text-shell-500 hover:text-neon-mint" />
</button>
)}
<button
onClick={() => setSidebarCollapsed(!sidebarCollapsed)}
className="p-1.5 hover:bg-shell-800 rounded transition-colors"
title={sidebarCollapsed ? 'Show sidebar' : 'Hide sidebar'}
>
{sidebarCollapsed ? (
<PanelLeft size={16} className="text-gray-400 hover:text-crab-400" />
) : (
<PanelLeftClose size={16} className="text-shell-500 hover:text-crab-400" />
)}
</button>
</div>
</div>
{/* Starred files section */}
{starredPaths.size > 0 && (
<>
{sidebarCollapsed ? (
// Collapsed: stacked file icons
<div className="flex flex-col items-center gap-1 py-2 border-b border-shell-800">
{[...starredPaths].slice(0, 5).map((filePath) => {
const fileName = filePath.split('/').pop() || filePath
const isSelected = selectedPath === filePath
return (
<button
key={filePath}
onClick={() => handleSelect(filePath, 'file')}
className={`relative p-1.5 rounded transition-colors ${
isSelected ? 'bg-crab-500/20' : 'hover:bg-shell-800'
}`}
title={fileName}
>
<FileText
size={16}
className={isSelected ? 'text-crab-400' : 'text-shell-500'}
/>
<Star
size={8}
fill="currentColor"
className="absolute -top-0.5 -right-0.5 text-yellow-400"
/>
</button>
)
})}
{starredPaths.size > 5 && (
<span className="text-[10px] text-shell-500">+{starredPaths.size - 5}</span>
)}
</div>
) : (
// Expanded: starred files list
<div className="border-b border-shell-800 py-2">
{[...starredPaths].map((filePath) => {
const fileName = filePath.split('/').pop() || filePath
const ext = fileName.includes('.') ? '.' + fileName.split('.').pop() : ''
const isSelected = selectedPath === filePath
return (
<div
key={filePath}
className={`group flex items-center gap-2 px-4 py-1.5 cursor-pointer transition-colors ${
isSelected
? 'bg-crab-500/20 text-crab-400'
: 'text-gray-300 hover:bg-shell-800 hover:text-gray-100'
}`}
onClick={() => handleSelect(filePath, 'file')}
>
<FileText
size={14}
className={`flex-shrink-0 ${
ext === '.md' ? 'text-crab-400' : 'text-shell-500'
}`}
/>
<span className="font-console text-sm truncate flex-1">
{fileName}
</span>
<button
onClick={(e) => {
e.stopPropagation()
handleStar(filePath)
}}
className="text-yellow-400 hover:text-yellow-300 flex-shrink-0"
title="Unstar file"
>
<Star size={14} fill="currentColor" />
</button>
</div>
)
})}
</div>
)}
</>
)}
{/* File tree */}
{!sidebarCollapsed && (
<div className="flex-1 overflow-y-auto overflow-x-hidden py-2">
{pathValid ? (
<FileTree
entries={rootEntries}
selectedPath={selectedPath}
onSelect={handleSelect}
onLoadDirectory={handleLoadDirectory}
onContextMenu={handleContextMenu}
/>
) : (
<div className="p-4 text-center">
<p className="font-console text-xs text-shell-500">
Enter a workspace path to browse files
</p>
</div>
)}
</div>
)}
{/* Sidebar footer */}
{pathValid && !sidebarCollapsed && (
<div className="px-4 py-2 border-t border-shell-800">
<p className="font-console text-[10px] text-shell-600 truncate">
{workspacePath}
</p>
</div>
)}
</motion.div>
)}
{/* Main content area */}
<div className={`flex-1 relative bg-shell-950 ${isMobile ? 'pb-20' : ''}`}>
<FileEditor
content={selectedFileContent}
fileName={selectedFileName}
filePath={selectedPath ?? undefined}
fileSize={selectedFileSize}
fileModified={selectedFileModified}
error={fileError}
isStarred={selectedPath ? starredPaths.has(selectedPath) : false}
onStar={handleStar}
onSave={handleSave}
/>
</div>
</div>
{/* Mobile components */}
{isMobile && (
<>
<MobileBottomToolbar
onOpenDrawer={() => setFileDrawerOpen(true)}
onOpenPathSheet={() => setPathSheetOpen(true)}
onRefresh={handleRefresh}
loading={loading}
pathValid={pathValid}
currentPath={workspacePathInput}
/>
<MobileFileDrawer
open={fileDrawerOpen}
onClose={() => setFileDrawerOpen(false)}
entries={rootEntries}
selectedPath={selectedPath}
starredPaths={starredPaths}
workspacePath={workspacePath}
pathValid={pathValid}
onSelect={handleSelect}
onLoadDirectory={handleLoadDirectory}
onStar={handleStar}
/>
<MobilePathSheet
open={pathSheetOpen}
onClose={() => setPathSheetOpen(false)}
initialPath={workspacePathInput}
validatedPath={workspacePath}
pathValid={pathValid}
pathError={pathError}
onValidate={async (path) => {
await validatePathAndSet(path)
return pathValid
}}
/>
</>
)}
{/* Delete confirmation dialog */}
<ConfirmationDialog
open={deleteConfirmOpen}
title="Delete File"
message={`Are you sure you want to delete "${fileToDelete?.split('/').pop()}"? This action cannot be undone.`}
confirmText="Delete"
cancelText="Cancel"
onConfirm={handleDeleteFile}
onCancel={() => {
setDeleteConfirmOpen(false)
setFileToDelete(null)
}}
variant="danger"
/>
{/* New file dialog */}
<NewFileDialog
open={newFileDialogOpen}
onClose={() => setNewFileDialogOpen(false)}
onCreate={handleCreateFile}
/>
{/* Context menu */}
<FileContextMenu
open={contextMenuOpen}
position={contextMenuPosition}
items={contextMenuItems}
onClose={() => setContextMenuOpen(false)}
/>
</div>
)
}
-5
View File
@@ -433,8 +433,3 @@ code, pre {
@apply focus:outline-none focus:border-crab-500 focus:ring-2 focus:ring-crab-500/20;
@apply transition-all duration-150;
}
/* Safe area padding for iOS */
.pb-safe {
padding-bottom: env(safe-area-inset-bottom, 0);
}