|
1 | 1 | #!/usr/bin/env bash |
2 | 2 | # Reset everything VPS-side for a fresh test cycle: |
3 | 3 | # |
4 | | -# - stop the matcher (~/.ocap), sample-services (~/.ocap-services), |
5 | | -# and consumer (~/.ocap-consumer) daemons, plus the matcher's |
6 | | -# llm-bridge subprocess; sweep up any orphan daemon-entry / bridge |
7 | | -# processes; |
8 | | -# - purge consumer + sample-services state and clear daemon logs in |
9 | | -# all three homes (the matcher's state is purged by |
10 | | -# start-matcher.sh as a side effect of its default behavior); |
| 4 | +# - stop both daemons (matcher under ~/.ocap, consumer under |
| 5 | +# ~/.ocap-consumer) and sweep up any orphan daemon-entry processes; |
| 6 | +# - purge consumer state and clear daemon logs in both homes |
| 7 | +# (the matcher's state is purged by start-matcher.sh as a side |
| 8 | +# effect of its default behavior); |
11 | 9 | # - bring the matcher back up via start-matcher.sh, capturing the |
12 | 10 | # newly-issued OCAP URL on stdout; |
13 | | -# - bring the sample-services daemon back up via start-services.sh, |
14 | | -# pointed at that URL, so Echo and RandomNumber register; |
15 | 11 | # - bring the consumer daemon back up with --local-relay; |
16 | 12 | # - update the openclaw discovery plugin's matcherUrl config and |
17 | 13 | # restart the gateway so the new URL takes effect. |
|
25 | 21 | # Usage: |
26 | 22 | # reset-everything.sh [--no-build] |
27 | 23 | # |
28 | | -# --no-build Skip building/bundling the matcher vat and the sample |
29 | | -# services (passed through to start-matcher.sh and |
30 | | -# start-services.sh). |
| 24 | +# --no-build Skip building/bundling the matcher vat (passed through |
| 25 | +# to start-matcher.sh). |
31 | 26 |
|
32 | 27 | set -euo pipefail |
33 | 28 |
|
34 | 29 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
35 | 30 | REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)" |
36 | | -START_SERVICES_SCRIPT="$REPO_ROOT/packages/sample-services/scripts/start-services.sh" |
37 | 31 | OCAP_BIN="$REPO_ROOT/packages/kernel-cli/dist/app.mjs" |
38 | 32 | CONSUMER_HOME="${OCAP_CONSUMER_HOME:-${HOME}/.ocap-consumer}" |
39 | | -SERVICES_HOME="${OCAP_SERVICES_HOME:-${HOME}/.ocap-services}" |
40 | 33 | MATCHER_HOME="${HOME}/.ocap" |
41 | 34 | LLM_BRIDGE_PID_PATH="$MATCHER_HOME/matcher-llm-bridge.pid" |
42 | 35 | LLM_BRIDGE_LOG_PATH="$MATCHER_HOME/matcher-llm-bridge.log" |
43 | 36 | LLM_SOCKET_PATH="$MATCHER_HOME/matcher-llm.sock" |
44 | 37 |
|
45 | | -PASSTHROUGH_ARGS=() |
| 38 | +START_MATCHER_ARGS=() |
46 | 39 | while [[ $# -gt 0 ]]; do |
47 | 40 | case "$1" in |
48 | 41 | --no-build) |
49 | | - PASSTHROUGH_ARGS+=(--no-build); shift ;; |
| 42 | + START_MATCHER_ARGS+=(--no-build); shift ;; |
50 | 43 | --help|-h) |
51 | 44 | sed -n '2,/^$/p' "$0" >&2; exit 0 ;; |
52 | 45 | *) |
|
69 | 62 | info "Stopping consumer daemon (if running)..." |
70 | 63 | node "$OCAP_BIN" --home "$CONSUMER_HOME" daemon stop >/dev/null 2>&1 || true |
71 | 64 |
|
72 | | -info "Stopping sample-services daemon (if running)..." |
73 | | -node "$OCAP_BIN" --home "$SERVICES_HOME" daemon stop >/dev/null 2>&1 || true |
74 | | - |
75 | 65 | info "Stopping matcher daemon (if running)..." |
76 | 66 | node "$OCAP_BIN" --home "$MATCHER_HOME" daemon stop >/dev/null 2>&1 || true |
77 | 67 |
|
|
114 | 104 | info "Purging consumer daemon state..." |
115 | 105 | node "$OCAP_BIN" --home "$CONSUMER_HOME" daemon purge --force >/dev/null 2>&1 || true |
116 | 106 |
|
117 | | -info "Purging sample-services daemon state..." |
118 | | -node "$OCAP_BIN" --home "$SERVICES_HOME" daemon purge --force >/dev/null 2>&1 || true |
119 | | - |
120 | 107 | info "Clearing daemon and bridge logs..." |
121 | 108 | rm -f \ |
122 | 109 | "$MATCHER_HOME/daemon.log" \ |
123 | 110 | "$CONSUMER_HOME/daemon.log" \ |
124 | | - "$SERVICES_HOME/daemon.log" \ |
125 | 111 | "$LLM_BRIDGE_LOG_PATH" |
126 | 112 |
|
127 | 113 | # --------------------------------------------------------------------------- |
128 | 114 | # 6. Bring the matcher back up; capture the URL on stdout. |
129 | 115 | # --------------------------------------------------------------------------- |
130 | 116 |
|
131 | 117 | info "Starting matcher..." |
132 | | -MATCHER_URL="$("$SCRIPT_DIR/start-matcher.sh" "${PASSTHROUGH_ARGS[@]}")" |
| 118 | +MATCHER_URL="$("$SCRIPT_DIR/start-matcher.sh" "${START_MATCHER_ARGS[@]}")" |
133 | 119 | if [[ -z "$MATCHER_URL" ]]; then |
134 | 120 | echo "[reset] ERROR: start-matcher.sh produced no URL." >&2 |
135 | 121 | exit 1 |
136 | 122 | fi |
137 | 123 | info "Matcher URL: $MATCHER_URL" |
138 | 124 |
|
139 | 125 | # --------------------------------------------------------------------------- |
140 | | -# 7. Bring the sample-services daemon back up, pointed at the matcher. |
141 | | -# --------------------------------------------------------------------------- |
142 | | - |
143 | | -info "Starting sample-services daemon..." |
144 | | -"$START_SERVICES_SCRIPT" "$MATCHER_URL" "${PASSTHROUGH_ARGS[@]}" >&2 |
145 | | - |
146 | | -# --------------------------------------------------------------------------- |
147 | | -# 8. Bring the consumer daemon back up. |
| 126 | +# 7. Bring the consumer daemon back up. |
148 | 127 | # --------------------------------------------------------------------------- |
149 | 128 |
|
150 | 129 | info "Starting consumer daemon (--local-relay)..." |
|
0 commit comments