diff mrjunejune/test/production_inference_bundle_test.sh @ 260:1f9877b637e9

Add Copilot-powered cyberpunk JRPG chat Integrate the production JRPG chat with Seobeo streaming, Deita persistence, and a Bazel-managed Copilot SDK and LiteLLM inference stack. Co-authored-by: Copilot <[email protected]>
author MrJuneJune <mrjunejune@users.noreply.github.com>
date Wed, 05 Aug 2026 09:19:41 -0700
parents
children b401627fc49e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mrjunejune/test/production_inference_bundle_test.sh	Wed Aug 05 09:19:41 2026 -0700
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+bundle="$(realpath "$1")"
+
+required_patterns=(
+  '/jrpg/index.html$'
+  '/jrpg/jrpg.css$'
+  '/jrpg/jrpg.js$'
+  '/pixel-mplus-12-regular.ttf$'
+  '/copilot_sidecar.zip$'
+  '/litellm_proxy.zip$'
+  '/litellm_config.yaml$'
+  '/inference_stack.sh$'
+  '/inference_sidecar_launcher.sh$'
+  '/production_entrypoint.sh$'
+  '/copilot$'
+  '/python3$'
+)
+
+files="$(find -L "$bundle" -type f)"
+for pattern in "${required_patterns[@]}"; do
+  if ! grep -Eq "$pattern" <<<"$files"; then
+    echo "Production bundle is missing inference runtime: $pattern" >&2
+    exit 1
+  fi
+done
+
+config="$(find -L "$bundle" -type f -name litellm_config.yaml -print -quit)"
+grep -q 'os.environ/LITELLM_MASTER_KEY' "$config"
+if grep -Eq 'sk-[A-Za-z0-9_-]{16,}|gh[opurs]_[A-Za-z0-9]{16,}' "$config"; then
+  echo "Production LiteLLM config contains a credential" >&2
+  exit 1
+fi
+
+entrypoint="$(find -L "$bundle" -type f -name production_entrypoint.sh -print -quit)"
+bash -n "$entrypoint"
+grep -q 'mrjunejune_server_binary' "$entrypoint"
+
+sidecar="$(find -L "$bundle" -type f -path '*/mrjunejune/inference/copilot_sidecar.zip' -print -quit)"
+litellm="$(find -L "$bundle" -type f -path '*/mrjunejune/inference/litellm_proxy.zip' -print -quit)"
+copilot_cli="$(find -L "$bundle" -type f -path '*/+http_archive+copilot_cli_linux_x86_64/copilot' -print -quit)"
+python="$(find -L "$bundle" -type f -path '*/rules_python++python+python_3_11_*/bin/python3' -print -quit)"
+state="$(mktemp -d)"
+trap 'rm -rf "$state"' EXIT
+
+output="$(
+  printf '%s\n' '{"command":"shutdown","request_id":"bundle-test","conversation_id":null}' |
+    COPILOT_SIDECAR_HOME="$state/copilot" \
+    LITELLM_BASE_URL='http://127.0.0.1:1/v1' \
+    LITELLM_MODEL='jrpg-copilot' \
+    LITELLM_WIRE_API='completions' \
+    "$python" "$sidecar" "$copilot_cli"
+)"
+grep -q '"type":"ready"' <<<"$output"
+"$python" "$litellm" --help >/dev/null