570ecbd1b0
Prioritize scheduled-task intent over page.generate for automation phrases, add run-wechat-gate-evidence.mjs for WX-01..13, and document 103 maintenance-window steps for Goose v1.49. Co-authored-by: Cursor <cursoragent@cursor.com>
109 lines
3.0 KiB
Bash
Executable File
109 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Install Goose v1.49 (goose serve) as a local LaunchAgent on loopback :18049.
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
PORT="${GOOSE_V149_PORT:-18049}"
|
|
LABEL="${GOOSE_V149_LAUNCHD_LABEL:-com.tkmind.local-goose-v149}"
|
|
LAUNCHD_DIR="${HOME}/Library/LaunchAgents"
|
|
PLIST="${LAUNCHD_DIR}/${LABEL}.plist"
|
|
RUN_SCRIPT="${ROOT}/scripts/run-goosed-v149-local.sh"
|
|
LOG_ROOT="${GOOSE_V149_RUNTIME_ROOT:-/tmp/goose-v149-runtime}"
|
|
GUI="gui/$(id -u)"
|
|
|
|
usage() {
|
|
cat <<EOF
|
|
Usage:
|
|
bash scripts/install-local-goose-v149.sh
|
|
bash scripts/install-local-goose-v149.sh --uninstall
|
|
|
|
Installs Goose v1.49 on https://127.0.0.1:${PORT} (loopback only).
|
|
Requires: bash scripts/build-goosed-v149-local.sh (once)
|
|
|
|
After install, set Portal .env:
|
|
TKMIND_API_TARGET=https://127.0.0.1:${PORT}
|
|
EOF
|
|
}
|
|
|
|
uninstall() {
|
|
launchctl bootout "${GUI}/${LABEL}" 2>/dev/null || true
|
|
rm -f "${PLIST}"
|
|
if lsof -nP -iTCP:"${PORT}" -sTCP:LISTEN >/dev/null 2>&1; then
|
|
lsof -ti "TCP:${PORT}" -sTCP:LISTEN | xargs kill -TERM 2>/dev/null || true
|
|
fi
|
|
echo "[install-local-goose-v149] uninstalled ${LABEL}"
|
|
}
|
|
|
|
if [[ "${1:-}" == "--uninstall" ]]; then
|
|
uninstall
|
|
exit 0
|
|
fi
|
|
|
|
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
|
usage
|
|
exit 0
|
|
fi
|
|
|
|
if [[ ! -x "${RUN_SCRIPT}" ]]; then
|
|
echo "run script missing: ${RUN_SCRIPT}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
for blocked in 18006 18007 18008 18009 18010 18011 18012 18013 18014 8081; do
|
|
if [[ "${PORT}" == "${blocked}" ]]; then
|
|
echo "refusing stable/production port ${PORT}" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
mkdir -p "${LAUNCHD_DIR}" "${LOG_ROOT}"
|
|
|
|
cat > "${PLIST}" <<EOF
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
|
|
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>Label</key>
|
|
<string>${LABEL}</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>/bin/bash</string>
|
|
<string>${RUN_SCRIPT}</string>
|
|
</array>
|
|
<key>WorkingDirectory</key>
|
|
<string>${ROOT}</string>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>KeepAlive</key>
|
|
<true/>
|
|
<key>StandardOutPath</key>
|
|
<string>${LOG_ROOT}/goose-v149.launchd.log</string>
|
|
<key>StandardErrorPath</key>
|
|
<string>${LOG_ROOT}/goose-v149.launchd.err.log</string>
|
|
<key>EnvironmentVariables</key>
|
|
<dict>
|
|
<key>PATH</key>
|
|
<string>/opt/homebrew/bin:/opt/homebrew/opt/node@24/bin:/usr/local/bin:/usr/bin:/bin</string>
|
|
<key>GOOSE_V149_ALLOW_REAL_LLM</key>
|
|
<string>1</string>
|
|
<key>GOOSE_V149_PORT</key>
|
|
<string>${PORT}</string>
|
|
<key>GOOSE_SERVER__SECRET_KEY</key>
|
|
<string>local-dev-secret</string>
|
|
<key>GOOSE_V149_RUNTIME_ROOT</key>
|
|
<string>${LOG_ROOT}</string>
|
|
</dict>
|
|
</dict>
|
|
</plist>
|
|
EOF
|
|
|
|
plutil -lint "${PLIST}" >/dev/null
|
|
launchctl bootout "${GUI}/${LABEL}" 2>/dev/null || true
|
|
launchctl bootstrap "${GUI}" "${PLIST}"
|
|
launchctl enable "${GUI}/${LABEL}"
|
|
launchctl kickstart -k "${GUI}/${LABEL}"
|
|
|
|
echo "[install-local-goose-v149] installed ${LABEL} on https://127.0.0.1:${PORT}"
|
|
echo "Verify: curl -sk https://127.0.0.1:${PORT}/status -H 'X-Secret-Key: local-dev-secret'"
|