* fix(ui): make chat message action icons always visible - Removes opacity-0 and pointer-events-none classes from UserMessageBody action buttons container. - Ensures icons are visible by default instead of only on hover/focus. - Addresses user feedback about empty space at the bottom of chat bubbles. * fix(ui): make chat message action icons always visible - Removes opacity-0 and pointer-events-none classes from UserMessageBody action buttons container. - Ensures icons are visible by default instead of only on hover/focus. - Addresses user feedback about empty space at the bottom of chat bubbles. * fix(ui): prevent diff comment input from closing on click (#3) Replaced global `document.querySelector('[data-comment-ui]')` with a local `useRef` to detect clicks inside the comment input area. This fixes an issue where clicking the input in one diff viewer would close it if another diff viewer (found first by querySelector) existed in the DOM. - Added `commentContainerRef` in `PierreDiffViewer.tsx`. - Updated `handleClickOutside` to check against the ref. - Attached ref to comment UI containers in both 'fill' and 'inline' layouts. - Preserved `data-comment-ui` attribute for backward compatibility. * feat(ui): add visual connector lines to file explorer (#2) - Replaced manual padding-based indentation with nested list structure - Added vertical connector lines using border-l on nested ul - Added horizontal connector lines using pseudo-elements on list items - Added tail masking for the last item in a branch to create the 'L' shape - Removed manual padding calculation from file/folder buttons * Create openchamber.yml * Create OPENCODE_FOR_ACTIONS.md * feat: update OpenChamber for Actions workflow and docs (#6) - Rename `docs/OPENCODE_FOR_ACTIONS.md` to `docs/OPENCHAMBER_FOR_ACTIONS.md`. - Update `README.md` to include a section on OpenChamber for Actions. - Update `.github/workflows/openchamber.yml` to allow users to select which service to expose (OpenChamber, OpenCode, or Both). - Update documentation to reflect the new workflow options. * feat: Add shimmer effect for generating messages (#7) * Create test_unreleased.yml * Update test_unreleased.yml * Delete test_unreleased.yml * 🧪 Labs: Enhanced File Explorer with Context Menus & UI Improvements (#13) * feat: add file management capabilities (create, rename, delete) (#11) Added backend endpoints for delete and rename operations. Extended FilesAPI interface and implementation. Updated FilesView with toolbar buttons for Create File/Folder. Added context menu to file tree items for Rename, Delete, and Copy Path. Implemented dialogs for all file operations. * Refactor UI/UX: Modernize styles, components, and layout architecture (#10) Refactored `packages/ui` CSS into modular files (design-system, typography, mobile). Modernized `Header` with pill-style tabs and semantic Flexbox layout. Enhanced `Chat` UI with threading visuals, improved typography, and better spacing. Updated `Sidebar` to match the new design system aesthetic. Verified with full workspace build. * Add workflow * Change to manual dispatch only * Delete test.yml * Update openchamber.yml * Fix styling and workflow improvements (#17) * Refactor OpenChamber workflow and update docs (#18) - Refactor `.github/workflows/openchamber.yml` to use modular helper scripts. - Add helper scripts in `scripts/`: `monitor.sh`, `persistence-restore.sh`, `persistence-save.sh`, `opencode-config.sh`. - Update `docs/OPENCHAMBER_FOR_ACTIONS.md` to reflect new inputs and features. - Implement robust monitoring with self-healing and proper URL logging. - Improve persistence robustness for file copying. * Expose Opencode Core, Web, and Chamber via Cloudflare tunnels (#19) This commit updates the GitHub Actions workflow and monitoring script to: 1. Install `wetty` to expose the core Opencode TTY over the web (interpreted from user request for "WiTTY"). 2. Start `opencode web` (8080), `openchamber` (9090), and `wetty` (3000) concurrently. 3. Configure Cloudflare to create three separate tunnels for these ports. 4. Update `monitor.sh` to accept and display URLs for all three services. * Update opencode-config.sh * Tighten actions persistence and UI polish * Delete openchamber.yml * Delete persistence-save.sh * Delete persistence-restore.sh * Delete opencode-config.sh * Delete monitor.sh * Delete install.sh * Fix OpenChamber workflow and scripts for multi-service tunnels (#21) * Create auto-opencode.yml * Update opencode.yml * feat: add password protection for OpenChamber in Actions (#22) - Introduce `OPENCODE_SERVER_PASSWORD` secret support in `.github/workflows/opencode.yml`. - Automatically set `OPENCHAMBER_UI_PASSWORD` and `OPENCODE_UI_PASSWORD` if the secret is provided. - Configure `ttyd` to use basic auth (`-c user:password`) when password is set. - Update `scripts/monitor.sh` to respect password settings during service restarts. - Significantly update `docs/OPENCHAMBER_FOR_ACTIONS.md` with an overview, password configuration instructions, and improved layout (collapsible sections). * use one password env variable * Update OPENCHAMBER_FOR_ACTIONS.md * feat: improve GITHUB_STEP_SUMMARY, fix TTY home logic and add encryption support in scripts * feat: lazy load large diffs to prevent page freeze (#186) When diff content exceeds 1500 lines or 150KB, show a placeholder with "Load Diff" button instead of parsing immediately. This prevents the page from freezing when viewing large diffs. Co-authored-by: Jovines <jovines@qq.com> * feat: add Web Push API support and PWA integration (#189) * feat: add Web Push API support and PWA integration Add web Push API with subscribe/unsubscribe and visibility endpoints Introduce usePushVisibilityBeacon and useSessionDeepLink hooks Integrate PWA with service worker, registerSW, and VAPID key persistence * feat: add heartbeat visibility beacon for web runtime Add a 10s heartbeat to ping visibility while visible Subscribe to visibilitychange, focus, blur, pageshow, and pagehide events to report state Clear heartbeat interval on unmount to avoid leaks * feat(UI): Introduce new UI components for file attachments and related views (#191) Add file management API and UI components Implement directory listing, search and CRUD operations in desktop backend Expose new Files API on frontend to list, search, and modify files * feat: add workbox-window and improve event stream cleanup Add workbox-window dependency to bun.lock and web package.json Cancel and release the stream reader on disconnect to avoid leaks * feat: provider config management (#193) * feat: support scoped removal of provider config (auth, user, project, custom) * feat: implement UI session token management with cookies for window visibility control * feature: header layout changes (#195) * fix(ui): remove fixed sessions button and mac titlebar coupling Remove fixed sessions button from header on desktop Mac Eliminate Mac titlebar spacer and drag-to-dock logic in sidebar Update layout to rely on standard header/sidebar without mac-specific tweaks * feat: improve mobile header with session toggle and back button Add back button in mobile header to exit session switcher Show Sessions label when session switcher is open in mobile header Toggle between opening sessions and back navigation based on session state * restore: add back scripts/install.sh from main branch * docs: improve Tech Stack section with organized label badges * Fix actions auth and remove shimmer
234 lines
8.2 KiB
Bash
Executable File
234 lines
8.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# ==============================================================================
|
|
# OpenCode Persistence Save Script
|
|
# ==============================================================================
|
|
# This script prepares all session data for artifact upload.
|
|
# It saves:
|
|
# - Configuration files (~/.config/opencode/)
|
|
# - Session data, messages, chats (~/.local/share/opencode/storage/)
|
|
# - Project snapshots (~/.local/share/opencode/snapshot/)
|
|
# - Authentication tokens (~/.local/share/opencode/auth.json)
|
|
# - Logs (~/.local/share/opencode/log/)
|
|
#
|
|
# Excludes (to keep artifact size manageable):
|
|
# - node_modules/ directories
|
|
# - bin/ directory (will be reinstalled)
|
|
# - tool-output/ (temporary tool outputs)
|
|
#
|
|
# If OPENCODE_SERVER_PASSWORD is set, the artifact will be encrypted.
|
|
# ==============================================================================
|
|
|
|
set -euo pipefail
|
|
|
|
SAVE_DIR="${SAVE_DIR:-/tmp/opencode-save}"
|
|
CONFIG_DIR="$HOME/.config/opencode"
|
|
SHARE_DIR="$HOME/.local/share/opencode"
|
|
ENCRYPTION_PASSWORD="${OPENCODE_SERVER_PASSWORD:-}"
|
|
|
|
echo "=== OpenCode Session Save ==="
|
|
echo "Save directory: $SAVE_DIR"
|
|
echo "Config directory: $CONFIG_DIR"
|
|
echo "Share directory: $SHARE_DIR"
|
|
if [ -n "$ENCRYPTION_PASSWORD" ]; then
|
|
echo "Encryption: ENABLED"
|
|
else
|
|
echo "Encryption: DISABLED (set OPENCODE_SERVER_PASSWORD to enable)"
|
|
fi
|
|
echo ""
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Clean up and create save directory
|
|
# ------------------------------------------------------------------------------
|
|
rm -rf "$SAVE_DIR"
|
|
mkdir -p "$SAVE_DIR/config"
|
|
mkdir -p "$SAVE_DIR/share"
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Save configuration files
|
|
# ------------------------------------------------------------------------------
|
|
save_config() {
|
|
echo "=== Saving Configuration Files ==="
|
|
|
|
if [ -d "$CONFIG_DIR" ] && [ "$(ls -A "$CONFIG_DIR" 2>/dev/null)" ]; then
|
|
# Save all config files (excluding node_modules)
|
|
for item in "$CONFIG_DIR"/*; do
|
|
if [ -e "$item" ]; then
|
|
local basename=$(basename "$item")
|
|
|
|
# Skip node_modules and bun.lock (will be reinstalled)
|
|
if [ "$basename" = "node_modules" ] || [ "$basename" = "bun.lock" ]; then
|
|
echo "Skipping: $basename (will be reinstalled)"
|
|
continue
|
|
fi
|
|
|
|
# Copy file or directory
|
|
if [ -f "$item" ]; then
|
|
cp -v "$item" "$SAVE_DIR/config/" 2>/dev/null || true
|
|
fi
|
|
fi
|
|
done
|
|
|
|
local count=$(find "$SAVE_DIR/config" -type f 2>/dev/null | wc -l)
|
|
echo "Config files saved: $count"
|
|
else
|
|
echo "No config data to save"
|
|
fi
|
|
}
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Save share data (sessions, messages, snapshots, auth)
|
|
# ------------------------------------------------------------------------------
|
|
save_share() {
|
|
echo ""
|
|
echo "=== Saving Share Data ==="
|
|
|
|
if [ ! -d "$SHARE_DIR" ]; then
|
|
echo "No share directory found"
|
|
return
|
|
fi
|
|
|
|
# Save auth.json (authentication tokens - critical!)
|
|
if [ -f "$SHARE_DIR/auth.json" ]; then
|
|
cp -v "$SHARE_DIR/auth.json" "$SAVE_DIR/share/" 2>/dev/null || true
|
|
echo "Auth data saved"
|
|
fi
|
|
|
|
# Save storage directory (sessions, messages, parts, projects)
|
|
if [ -d "$SHARE_DIR/storage" ] && [ "$(ls -A "$SHARE_DIR/storage" 2>/dev/null)" ]; then
|
|
echo "Saving storage data (sessions, messages, chats)..."
|
|
mkdir -p "$SAVE_DIR/share/storage"
|
|
|
|
# Copy all storage subdirectories
|
|
for subdir in message migration part project session session_diff; do
|
|
if [ -d "$SHARE_DIR/storage/$subdir" ]; then
|
|
cp -r "$SHARE_DIR/storage/$subdir" "$SAVE_DIR/share/storage/" 2>/dev/null || true
|
|
fi
|
|
done
|
|
|
|
local storage_count=$(find "$SAVE_DIR/share/storage" -type f 2>/dev/null | wc -l)
|
|
echo "Storage files saved: $storage_count"
|
|
fi
|
|
|
|
# Save snapshot directory (project snapshots for undo/rollback)
|
|
if [ -d "$SHARE_DIR/snapshot" ] && [ "$(ls -A "$SHARE_DIR/snapshot" 2>/dev/null)" ]; then
|
|
echo "Saving snapshot data..."
|
|
mkdir -p "$SAVE_DIR/share/snapshot"
|
|
cp -r "$SHARE_DIR/snapshot/"* "$SAVE_DIR/share/snapshot/" 2>/dev/null || true
|
|
|
|
local snapshot_count=$(find "$SAVE_DIR/share/snapshot" -type f 2>/dev/null | wc -l)
|
|
echo "Snapshot files saved: $snapshot_count"
|
|
fi
|
|
|
|
# Save log directory (useful for debugging)
|
|
if [ -d "$SHARE_DIR/log" ] && [ "$(ls -A "$SHARE_DIR/log" 2>/dev/null)" ]; then
|
|
echo "Saving log data..."
|
|
mkdir -p "$SAVE_DIR/share/log"
|
|
cp -r "$SHARE_DIR/log/"* "$SAVE_DIR/share/log/" 2>/dev/null || true
|
|
echo "Log files saved"
|
|
fi
|
|
}
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Create manifest with metadata
|
|
# ------------------------------------------------------------------------------
|
|
create_manifest() {
|
|
echo ""
|
|
echo "=== Creating Manifest ==="
|
|
|
|
local manifest="$SAVE_DIR/manifest.json"
|
|
local timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
local config_count=$(find "$SAVE_DIR/config" -type f 2>/dev/null | wc -l)
|
|
local share_count=$(find "$SAVE_DIR/share" -type f 2>/dev/null | wc -l)
|
|
local total_size=$(du -sh "$SAVE_DIR" 2>/dev/null | cut -f1)
|
|
|
|
cat << EOF > "$manifest"
|
|
{
|
|
"version": "2.0",
|
|
"timestamp": "$timestamp",
|
|
"hostname": "$(hostname)",
|
|
"stats": {
|
|
"config_files": $config_count,
|
|
"share_files": $share_count,
|
|
"total_size": "$total_size"
|
|
},
|
|
"contents": {
|
|
"config": $([ -d "$SAVE_DIR/config" ] && ls "$SAVE_DIR/config" 2>/dev/null | jq -R -s -c 'split("\n") | map(select(length > 0))' || echo '[]'),
|
|
"share": $([ -d "$SAVE_DIR/share" ] && ls "$SAVE_DIR/share" 2>/dev/null | jq -R -s -c 'split("\n") | map(select(length > 0))' || echo '[]')
|
|
}
|
|
}
|
|
EOF
|
|
|
|
echo "Manifest created: $manifest"
|
|
cat "$manifest"
|
|
}
|
|
|
|
# ==============================================================================
|
|
# Main Save Process
|
|
# ==============================================================================
|
|
|
|
save_config
|
|
save_share
|
|
create_manifest
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Final Summary
|
|
# ------------------------------------------------------------------------------
|
|
echo ""
|
|
echo "=== Save Summary ==="
|
|
|
|
# Calculate totals
|
|
total_files=$(find "$SAVE_DIR" -type f 2>/dev/null | wc -l)
|
|
total_size=$(du -sh "$SAVE_DIR" 2>/dev/null | cut -f1)
|
|
|
|
echo "Save directory structure:"
|
|
if command -v tree &> /dev/null; then
|
|
tree -L 2 "$SAVE_DIR" 2>/dev/null || ls -laR "$SAVE_DIR" | head -50
|
|
else
|
|
ls -laR "$SAVE_DIR" | head -50
|
|
fi
|
|
|
|
echo ""
|
|
echo "Total files to upload: $total_files"
|
|
echo "Total size: $total_size"
|
|
echo ""
|
|
|
|
# Verify we have something to save
|
|
if [ "$total_files" -gt 1 ]; then
|
|
echo "Session data prepared successfully for artifact upload!"
|
|
else
|
|
echo "Warning: Minimal data to save. Creating placeholder..."
|
|
echo "{\"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\", \"status\": \"empty\"}" > "$SAVE_DIR/placeholder.json"
|
|
fi
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Optional Encryption (if OPENCODE_SERVER_PASSWORD is set)
|
|
# ------------------------------------------------------------------------------
|
|
if [ -n "$ENCRYPTION_PASSWORD" ]; then
|
|
echo ""
|
|
echo "=== Encrypting Session Data ==="
|
|
|
|
TEMP_ARCHIVE="/tmp/opencode-session-data.tar.gz"
|
|
ENCRYPTED_FILE="$SAVE_DIR.enc"
|
|
|
|
tar -czf "$TEMP_ARCHIVE" -C "$SAVE_DIR" .
|
|
|
|
openssl enc -aes-256-cbc -salt -pbkdf2 -iter 100000 \
|
|
-in "$TEMP_ARCHIVE" \
|
|
-out "$ENCRYPTED_FILE" \
|
|
-pass pass:"$ENCRYPTION_PASSWORD"
|
|
|
|
rm -f "$TEMP_ARCHIVE"
|
|
rm -rf "$SAVE_DIR"
|
|
mkdir -p "$SAVE_DIR"
|
|
mv "$ENCRYPTED_FILE" "$SAVE_DIR/session.enc"
|
|
|
|
echo '{"encrypted": true, "algorithm": "aes-256-cbc", "kdf": "pbkdf2", "iterations": 100000}' > "$SAVE_DIR/manifest.json"
|
|
|
|
echo "Encryption complete. Artifact is password-protected."
|
|
echo "Encrypted file: $SAVE_DIR/session.enc"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Save location: $SAVE_DIR"
|
|
echo "Ready for artifact upload!"
|