refactor: drive verify script from patch contract / 讓 verify script 讀 patch contract
This commit is contained in:
26
scripts/render-openclaw-verify-targets.mjs
Normal file
26
scripts/render-openclaw-verify-targets.mjs
Normal file
@@ -0,0 +1,26 @@
|
||||
import fs from "node:fs"
|
||||
import path from "node:path"
|
||||
|
||||
const contractPath = path.join(import.meta.dirname, "..", "generated", "openclaw-telegram-patch-contract.json")
|
||||
const contract = JSON.parse(fs.readFileSync(contractPath, "utf-8"))
|
||||
|
||||
const targets = {
|
||||
send: {
|
||||
defaultButtonsInjected: "buildInlineKeyboard(opts.buttons ??",
|
||||
continueCallback: contract.defaultButtons[0][0].callback_data,
|
||||
stopCallback: contract.defaultButtons[0][1].callback_data,
|
||||
continueLabel: contract.defaultButtons[0][0].text,
|
||||
stopLabel: contract.defaultButtons[0][1].text,
|
||||
},
|
||||
bot: {
|
||||
stateFilePath: "reply-end-controls.json",
|
||||
debugLogPath: "reply-end-debug.log",
|
||||
continueAck: contract.resolved.continue.acknowledgement,
|
||||
stopAck: contract.resolved.stop.acknowledgement,
|
||||
stopPolicy: contract.stopPolicyText,
|
||||
resolvedContinueLabel: contract.resolved.continue.buttons[0][0].text,
|
||||
resolvedStopLabel: contract.resolved.stop.buttons[0][1].text,
|
||||
},
|
||||
}
|
||||
|
||||
process.stdout.write(`${JSON.stringify(targets, null, 2)}\n`)
|
||||
@@ -9,6 +9,11 @@ fi
|
||||
STATE_DIR="$1"
|
||||
DIST_DIR="$2"
|
||||
MANIFEST_PATH="$(dirname "$0")/../reports/live-openclawtest-manifest.json"
|
||||
VERIFY_TARGETS_PATH="$(dirname "$0")/../generated/openclaw-verify-targets.json"
|
||||
|
||||
mkdir -p "$(dirname "${VERIFY_TARGETS_PATH}")"
|
||||
npx -p tsx@4.20.6 -p typescript@5.9.3 tsx "$(dirname "$0")/render-openclaw-patch-contract.mjs" > "$(dirname "$0")/../generated/openclaw-telegram-patch-contract.json"
|
||||
npx -p tsx@4.20.6 -p typescript@5.9.3 tsx "$(dirname "$0")/render-openclaw-verify-targets.mjs" > "${VERIFY_TARGETS_PATH}"
|
||||
|
||||
echo "== reply-end-controls PoC verify =="
|
||||
echo "state_dir=${STATE_DIR}"
|
||||
@@ -29,23 +34,15 @@ done
|
||||
|
||||
echo
|
||||
echo "== patch markers =="
|
||||
sudo python3 - <<'PY' "$DIST_DIR"
|
||||
sudo python3 - <<'PY' "$DIST_DIR" "$VERIFY_TARGETS_PATH"
|
||||
from pathlib import Path
|
||||
import json, sys
|
||||
|
||||
live_dist = Path(sys.argv[1])
|
||||
targets = json.loads(Path(sys.argv[2]).read_text(encoding='utf-8'))
|
||||
checks = {
|
||||
'send-sxDwUGaO.js': {
|
||||
'defaultButtonsInjected': 'buildInlineKeyboard(opts.buttons ??',
|
||||
'continueCallback': 'rec:continue',
|
||||
'stopCallback': 'rec:stop',
|
||||
},
|
||||
'bot-Ce301bOE.js': {
|
||||
'stateFilePath': 'reply-end-controls.json',
|
||||
'continueAck': 'reply-end-controls: continue received',
|
||||
'stopAck': 'reply-end-controls: stop received',
|
||||
'stopPolicy': 'Treat the previous thread as closed',
|
||||
},
|
||||
'send-sxDwUGaO.js': targets['send'],
|
||||
'bot-Ce301bOE.js': targets['bot'],
|
||||
}
|
||||
for name, markers in checks.items():
|
||||
path = live_dist / name
|
||||
|
||||
Reference in New Issue
Block a user