@kokorolx/ai-sandbox-wrapper 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/ai-run +35 -4
  2. package/package.json +1 -1
package/bin/ai-run CHANGED
@@ -701,6 +701,7 @@ get_installed_tools() {
701
701
  # Tool config persistence via bind mounts
702
702
  # Bind-mount host paths directly to ensure changes persist to the host.
703
703
  TOOL_CONFIG_MOUNTS=""
704
+ RG_COMPAT_MOUNT=""
704
705
 
705
706
  mount_tool_config() {
706
707
  local host_path="$1"
@@ -724,6 +725,32 @@ for tool in $(get_installed_tools); do
724
725
  done
725
726
  done
726
727
 
728
+ setup_opencode_rg_compat() {
729
+ [[ "$TOOL" != "opencode" ]] && return 0
730
+
731
+ local bundled_rg="$HOME/.local/share/opencode/bin/rg"
732
+ local rg_shim_path="$SANDBOX_DIR/shared/rg-linux-shim"
733
+
734
+ [[ -f "$bundled_rg" ]] || return 0
735
+ command -v file &>/dev/null || return 0
736
+
737
+ local rg_file_info
738
+ rg_file_info=$(file -b "$bundled_rg" 2>/dev/null || true)
739
+
740
+ if echo "$rg_file_info" | grep -qi "Mach-O"; then
741
+ mkdir -p "$(dirname "$rg_shim_path")"
742
+ cat > "$rg_shim_path" << 'EOF'
743
+ #!/usr/bin/env bash
744
+ exec /usr/bin/rg "$@"
745
+ EOF
746
+ chmod +x "$rg_shim_path"
747
+ RG_COMPAT_MOUNT="-v $rg_shim_path:/home/agent/.local/share/opencode/bin/rg:ro"
748
+ echo "⚠️ Detected incompatible OpenCode bundled rg (Mach-O). Using /usr/bin/rg in container."
749
+ fi
750
+ }
751
+
752
+ setup_opencode_rg_compat
753
+
727
754
  # Bundle OpenCode default skills (if opencode is installed)
728
755
  if get_installed_tools | grep -qw "opencode"; then
729
756
  AIRUN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -756,11 +783,12 @@ if [[ -d "$HOST_SKILLS_DIR" ]]; then
756
783
  SHARED_CACHE_MOUNTS="$SHARED_CACHE_MOUNTS -v $HOST_SKILLS_DIR:/home/agent/.config/opencode/skills:ro"
757
784
  fi
758
785
 
759
- # Nano-brain mount disabled to prevent SQLite conflicts between host and container
760
- # All tools should use the MCP interface to interact with nano-brain on the host
786
+ # Nano-brain read-only mount
787
+ # Exposes logs/index/sqlite files to container while preventing writes
788
+ NANO_BRAIN_MOUNT=""
761
789
  if [[ -d "$HOME/.nano-brain" ]]; then
762
- echo "ℹ️ Skipping .nano-brain mount to prevent SQLite database corruption"
763
- echo " Use MCP interface for nano-brain access instead of direct CLI"
790
+ NANO_BRAIN_MOUNT="-v $HOME/.nano-brain:/home/agent/.nano-brain:ro"
791
+ echo "ℹ️ Mounted .nano-brain as read-only at /home/agent/.nano-brain"
764
792
  fi
765
793
 
766
794
 
@@ -2230,6 +2258,7 @@ if [[ "${AI_RUN_DEBUG:-}" == "1" ]]; then
2230
2258
  echo "🔧 Debug: PORT_MAPPINGS='$PORT_MAPPINGS'"
2231
2259
  echo "🔧 Debug: WEB_DETECTED='$WEB_DETECTED'"
2232
2260
  echo "🔧 Debug: EXPOSE_PORTS_LIST='$EXPOSE_PORTS_LIST'"
2261
+ echo "🔧 Debug: RG_COMPAT_MOUNT='$RG_COMPAT_MOUNT'"
2233
2262
  fi
2234
2263
 
2235
2264
  is_nano_brain_command() {
@@ -2516,6 +2545,7 @@ docker run $CONTAINER_NAME --rm $TTY_FLAGS \
2516
2545
  $VOLUME_MOUNTS \
2517
2546
  $CONFIG_MOUNT \
2518
2547
  $TOOL_CONFIG_MOUNTS \
2548
+ $RG_COMPAT_MOUNT \
2519
2549
  $GIT_MOUNTS \
2520
2550
  $SSH_AGENT_ENV \
2521
2551
  $NETWORK_OPTIONS \
@@ -2525,6 +2555,7 @@ docker run $CONTAINER_NAME --rm $TTY_FLAGS \
2525
2555
  $OPENCODE_PASSWORD_ENV \
2526
2556
  -v "$HOME_DIR":/home/agent \
2527
2557
  $SHARED_CACHE_MOUNTS \
2558
+ $NANO_BRAIN_MOUNT \
2528
2559
  -w "$CURRENT_DIR" \
2529
2560
  --env-file "$ENV_FILE" \
2530
2561
  -e TERM="$TERM" \
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kokorolx/ai-sandbox-wrapper",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Docker-based security sandbox for AI coding agents. Isolate Claude, Gemini, Aider, and other AI tools from your host system.",
5
5
  "keywords": [
6
6
  "ai",