diff mrjunejune/inference_stack.sh @ 282:6bd4a3990696 default tip

Add cross-platform canvas orchestration and typed composer Enable native ARM dependencies, macOS Copilot orchestration, portable service supervision, CPU dictation, and a shared N-key speak-or-type composer. Co-authored-by: Copilot <[email protected]> Copilot-Session: f68442b1-fa8f-46a0-9689-81710613bbd4
author MrJuneJune <me@mrjunejune.com>
date Thu, 20 Aug 2026 20:45:25 -0700
parents 13d61401c57d
children
line wrap: on
line diff
--- a/mrjunejune/inference_stack.sh	Tue Aug 18 22:18:15 2026 -0700
+++ b/mrjunejune/inference_stack.sh	Thu Aug 20 20:45:25 2026 -0700
@@ -1,13 +1,20 @@
 #!/usr/bin/env bash
 set -euo pipefail
 
-server="$(realpath "$1")"
-sidecar_launcher="$(realpath "$2")"
-sidecar_zip="$(realpath "$3")"
-copilot_cli="$(realpath "$4")"
-litellm_zip="$(realpath "$5")"
-litellm_config="$(realpath "$6")"
-python="$(realpath "$7")"
+resolve_path() {
+  local path="$1"
+  local directory
+  directory="$(cd "$(dirname "$path")" && pwd -P)"
+  printf '%s/%s\n' "$directory" "$(basename "$path")"
+}
+
+server="$(resolve_path "$1")"
+sidecar_launcher="$(resolve_path "$2")"
+sidecar_zip="$(resolve_path "$3")"
+copilot_cli="$(resolve_path "$4")"
+litellm_zip="$(resolve_path "$5")"
+litellm_config="$(resolve_path "$6")"
+python="$(resolve_path "$7")"
 mock_sidecar="${8:-}"
 if (( $# >= 8 )); then
   shift 8
@@ -41,7 +48,7 @@
     [[ "$candidate" != /mrjunejune/.config ]] || continue
     [[ "$candidate" != /.config/mrjunejune/.config ]] || continue
     if [[ -f "$candidate" ]]; then
-      realpath "$candidate"
+      resolve_path "$candidate"
       return 0
     fi
   done
@@ -136,19 +143,19 @@
 cleanup() {
   for pid in "$server_pid" "$litellm_pid"; do
     if [[ -n "$pid" ]]; then
-      kill -- "-$pid" 2>/dev/null || true
+      kill "$pid" 2>/dev/null || true
     fi
   done
   for pid in "$server_pid" "$litellm_pid"; do
     [[ -n "$pid" ]] || continue
     for _ in $(seq 1 30); do
-      if ! kill -0 -- "-$pid" 2>/dev/null; then
+      if ! kill -0 "$pid" 2>/dev/null; then
         break
       fi
       sleep 0.1
     done
-    if kill -0 -- "-$pid" 2>/dev/null; then
-      kill -KILL -- "-$pid" 2>/dev/null || true
+    if kill -0 "$pid" 2>/dev/null; then
+      kill -KILL "$pid" 2>/dev/null || true
     fi
     wait "$pid" 2>/dev/null || true
   done
@@ -206,7 +213,7 @@
     exit 1
   fi
 
-  setsid "$python" "$litellm_zip" \
+  "$python" "$litellm_zip" \
     --config "$litellm_config" \
     --host "$litellm_host" \
     --port "$litellm_port" &
@@ -253,7 +260,7 @@
 fi
 
 export MRJUNEJUNE_CONFIG_PATH="$config_file"
-setsid "$server" &
+"$server" &
 server_pid=$!
 while true; do
   if ! kill -0 "$server_pid" 2>/dev/null; then