comparison 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
comparison
equal deleted inserted replaced
259:667156fcd3e3 260:1f9877b637e9
1 #!/usr/bin/env bash
2 set -euo pipefail
3
4 bundle="$(realpath "$1")"
5
6 required_patterns=(
7 '/jrpg/index.html$'
8 '/jrpg/jrpg.css$'
9 '/jrpg/jrpg.js$'
10 '/pixel-mplus-12-regular.ttf$'
11 '/copilot_sidecar.zip$'
12 '/litellm_proxy.zip$'
13 '/litellm_config.yaml$'
14 '/inference_stack.sh$'
15 '/inference_sidecar_launcher.sh$'
16 '/production_entrypoint.sh$'
17 '/copilot$'
18 '/python3$'
19 )
20
21 files="$(find -L "$bundle" -type f)"
22 for pattern in "${required_patterns[@]}"; do
23 if ! grep -Eq "$pattern" <<<"$files"; then
24 echo "Production bundle is missing inference runtime: $pattern" >&2
25 exit 1
26 fi
27 done
28
29 config="$(find -L "$bundle" -type f -name litellm_config.yaml -print -quit)"
30 grep -q 'os.environ/LITELLM_MASTER_KEY' "$config"
31 if grep -Eq 'sk-[A-Za-z0-9_-]{16,}|gh[opurs]_[A-Za-z0-9]{16,}' "$config"; then
32 echo "Production LiteLLM config contains a credential" >&2
33 exit 1
34 fi
35
36 entrypoint="$(find -L "$bundle" -type f -name production_entrypoint.sh -print -quit)"
37 bash -n "$entrypoint"
38 grep -q 'mrjunejune_server_binary' "$entrypoint"
39
40 sidecar="$(find -L "$bundle" -type f -path '*/mrjunejune/inference/copilot_sidecar.zip' -print -quit)"
41 litellm="$(find -L "$bundle" -type f -path '*/mrjunejune/inference/litellm_proxy.zip' -print -quit)"
42 copilot_cli="$(find -L "$bundle" -type f -path '*/+http_archive+copilot_cli_linux_x86_64/copilot' -print -quit)"
43 python="$(find -L "$bundle" -type f -path '*/rules_python++python+python_3_11_*/bin/python3' -print -quit)"
44 state="$(mktemp -d)"
45 trap 'rm -rf "$state"' EXIT
46
47 output="$(
48 printf '%s\n' '{"command":"shutdown","request_id":"bundle-test","conversation_id":null}' |
49 COPILOT_SIDECAR_HOME="$state/copilot" \
50 LITELLM_BASE_URL='http://127.0.0.1:1/v1' \
51 LITELLM_MODEL='jrpg-copilot' \
52 LITELLM_WIRE_API='completions' \
53 "$python" "$sidecar" "$copilot_cli"
54 )"
55 grep -q '"type":"ready"' <<<"$output"
56 "$python" "$litellm" --help >/dev/null