Mercurial
comparison infinite_canvas/run_orchestration_dev.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 | 49e9e591c9bb |
| children |
comparison
equal
deleted
inserted
replaced
| 281:c57149ad216e | 282:6bd4a3990696 |
|---|---|
| 1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
| 2 set -euo pipefail | 2 set -euo pipefail |
| 3 | 3 |
| 4 RUNFILES_ROOT="${RUNFILES_DIR:-$0.runfiles}" | 4 RUNFILES_ROOT="${RUNFILES_DIR:-$0.runfiles}" |
| 5 export RUNFILES_DIR="$RUNFILES_ROOT" | 5 export RUNFILES_DIR="$RUNFILES_ROOT" |
| 6 | |
| 7 resolve_path() { | |
| 8 local path="$1" | |
| 9 local directory | |
| 10 directory="$(cd "$(dirname "$path")" && pwd -P)" | |
| 11 printf '%s/%s\n' "$directory" "$(basename "$path")" | |
| 12 } | |
| 6 | 13 |
| 7 find_runfile() { | 14 find_runfile() { |
| 8 local pattern="$1" | 15 local pattern="$1" |
| 9 local path | 16 local path |
| 10 path="$(find -L "$RUNFILES_ROOT" -path "$pattern" -print -quit)" | 17 path="$(find -L "$RUNFILES_ROOT" -path "$pattern" -print -quit)" |
| 11 if [[ -z "$path" ]]; then | 18 if [[ -z "$path" ]]; then |
| 12 echo "Could not locate orchestration runtime file: $pattern" >&2 | 19 echo "Could not locate orchestration runtime file: $pattern" >&2 |
| 13 exit 1 | 20 exit 1 |
| 14 fi | 21 fi |
| 15 realpath "$path" | 22 resolve_path "$path" |
| 23 } | |
| 24 | |
| 25 find_runfile_any() { | |
| 26 local pattern | |
| 27 local path | |
| 28 for pattern in "$@"; do | |
| 29 path="$(find -L "$RUNFILES_ROOT" -path "$pattern" -print -quit)" | |
| 30 if [[ -n "$path" ]]; then | |
| 31 resolve_path "$path" | |
| 32 return 0 | |
| 33 fi | |
| 34 done | |
| 35 echo "Could not locate orchestration runtime file" >&2 | |
| 36 exit 1 | |
| 16 } | 37 } |
| 17 | 38 |
| 18 find_config() { | 39 find_config() { |
| 19 local candidate | 40 local candidate |
| 20 for candidate in \ | 41 for candidate in \ |
| 22 "$PWD/mrjunejune/.config" \ | 43 "$PWD/mrjunejune/.config" \ |
| 23 "${HOME:-}/.config/mrjunejune/.config"; do | 44 "${HOME:-}/.config/mrjunejune/.config"; do |
| 24 [[ "$candidate" != /mrjunejune/.config ]] || continue | 45 [[ "$candidate" != /mrjunejune/.config ]] || continue |
| 25 [[ "$candidate" != /.config/mrjunejune/.config ]] || continue | 46 [[ "$candidate" != /.config/mrjunejune/.config ]] || continue |
| 26 if [[ -f "$candidate" ]]; then | 47 if [[ -f "$candidate" ]]; then |
| 27 realpath "$candidate" | 48 resolve_path "$candidate" |
| 28 return 0 | 49 return 0 |
| 29 fi | 50 fi |
| 30 done | 51 done |
| 31 return 1 | 52 return 1 |
| 32 } | 53 } |
| 57 done < "$config_path" | 78 done < "$config_path" |
| 58 } | 79 } |
| 59 | 80 |
| 60 dictation="$(find_runfile '*/dictation/server')" | 81 dictation="$(find_runfile '*/dictation/server')" |
| 61 dictation_bin="$(find_runfile '*/dictation/dictation_bin')" | 82 dictation_bin="$(find_runfile '*/dictation/dictation_bin')" |
| 62 canvas="$(find_runfile '*/infinite_canvas/dev_linux')" | 83 canvas="$(find_runfile_any \ |
| 84 '*/infinite_canvas/dev_linux' \ | |
| 85 '*/infinite_canvas/dev_bin')" | |
| 63 sidecar_launcher="$(find_runfile '*/mrjunejune/inference_sidecar_launcher.sh')" | 86 sidecar_launcher="$(find_runfile '*/mrjunejune/inference_sidecar_launcher.sh')" |
| 64 sidecar_zip="$(find_runfile '*/mrjunejune/inference/copilot_sidecar.zip')" | 87 sidecar_zip="$(find_runfile '*/mrjunejune/inference/copilot_sidecar.zip')" |
| 65 litellm_zip="$(find_runfile '*/mrjunejune/inference/litellm_proxy.zip')" | 88 litellm_zip="$(find_runfile '*/mrjunejune/inference/litellm_proxy.zip')" |
| 66 litellm_config="$(find_runfile '*/mrjunejune/inference/litellm_config.yaml')" | 89 litellm_config="$(find_runfile '*/mrjunejune/inference/litellm_config.yaml')" |
| 67 copilot_cli="$(find_runfile '*copilot_cli_linux_x86_64/copilot')" | 90 copilot_cli="$(find_runfile '*copilot_cli_*/copilot')" |
| 68 python="$(find_runfile '*python_3_11_x86_64-unknown-linux-gnu/bin/python3')" | 91 python="$(find_runfile '*python_3_11*/bin/python3')" |
| 69 | 92 |
| 70 config_file="$(find_config || true)" | 93 config_file="$(find_config || true)" |
| 71 if [[ -z "$config_file" ]]; then | 94 if [[ -z "$config_file" ]]; then |
| 72 echo "Missing mrjunejune/.config." >&2 | 95 echo "Missing mrjunejune/.config." >&2 |
| 73 echo "Copy mrjunejune/.config.development to mrjunejune/.config." >&2 | 96 echo "Copy mrjunejune/.config.development to mrjunejune/.config." >&2 |
| 98 | 121 |
| 99 cleanup() { | 122 cleanup() { |
| 100 local status=$? | 123 local status=$? |
| 101 trap - EXIT INT TERM | 124 trap - EXIT INT TERM |
| 102 for pid in "${service_pids[@]}"; do | 125 for pid in "${service_pids[@]}"; do |
| 103 kill -- "-$pid" 2>/dev/null || kill "$pid" 2>/dev/null || true | 126 kill "$pid" 2>/dev/null || true |
| 104 done | 127 done |
| 105 for pid in "${service_pids[@]}"; do | 128 for pid in "${service_pids[@]}"; do |
| 106 wait "$pid" 2>/dev/null || true | 129 wait "$pid" 2>/dev/null || true |
| 107 done | 130 done |
| 108 exit "$status" | 131 exit "$status" |
| 114 | 137 |
| 115 export GITHUB_COPILOT_TOKEN_DIR="$token_dir" | 138 export GITHUB_COPILOT_TOKEN_DIR="$token_dir" |
| 116 export XDG_CACHE_HOME="$cache_root" | 139 export XDG_CACHE_HOME="$cache_root" |
| 117 export DICTATION_MODEL_DIR="${DICTATION_MODEL_DIR:-$HOME/.cache/zenbu/faster-whisper-small}" | 140 export DICTATION_MODEL_DIR="${DICTATION_MODEL_DIR:-$HOME/.cache/zenbu/faster-whisper-small}" |
| 118 export LITELLM_MASTER_KEY | 141 export LITELLM_MASTER_KEY |
| 119 setsid "$python" "$litellm_zip" \ | 142 "$python" "$litellm_zip" \ |
| 120 --config "$litellm_config" \ | 143 --config "$litellm_config" \ |
| 121 --host "$litellm_host" \ | 144 --host "$litellm_host" \ |
| 122 --port "$litellm_port" & | 145 --port "$litellm_port" & |
| 123 service_pids+=("$!") | 146 service_pids+=("$!") |
| 124 | 147 |
| 125 setsid "$dictation" "$dictation_bin" server & | 148 "$dictation" "$dictation_bin" server & |
| 126 service_pids+=("$!") | 149 service_pids+=("$!") |
| 127 | 150 |
| 128 for _ in {1..150}; do | 151 for _ in {1..150}; do |
| 129 if curl --fail --silent \ | 152 if curl --fail --silent \ |
| 130 --connect-timeout 1 \ | 153 --connect-timeout 1 \ |