From d5a7e98fb3bba2a39ded9fd226b9d760ac98a7d3 Mon Sep 17 00:00:00 2001 From: "Alice (OpenClaw)" Date: Wed, 13 May 2026 11:26:43 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20add=20OpenClaw=20patch=20inventory=20an?= =?UTF-8?q?d=20patch-script=20skeletons=20/=20=E8=A3=9C=20OpenClaw=20patch?= =?UTF-8?q?=20inventory=20=E8=88=87=20apply/rollback=20=E9=AA=A8=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reports/openclaw-patch-inventory.md | 82 ++++++++++++++++++++++++++ scripts/apply-openclaw-poc-patch.sh | 11 ++++ scripts/rollback-openclaw-poc-patch.sh | 11 ++++ 3 files changed, 104 insertions(+) create mode 100644 reports/openclaw-patch-inventory.md create mode 100755 scripts/apply-openclaw-poc-patch.sh create mode 100755 scripts/rollback-openclaw-poc-patch.sh diff --git a/reports/openclaw-patch-inventory.md b/reports/openclaw-patch-inventory.md new file mode 100644 index 0000000..908e9a9 --- /dev/null +++ b/reports/openclaw-patch-inventory.md @@ -0,0 +1,82 @@ +# OpenClaw Patch Inventory (PoC) + +## Purpose + +This file records the exact runtime modifications currently used to make the Telegram + OpenClaw reply-end-controls PoC work inside `openclawtest`. + +It is not the final architecture. + +It exists so the current PoC does not depend on vague memory or hand-wavy descriptions. + +## Environment + +- User: `openclawtest` +- OpenClaw install root: + - `/home/openclawtest/.nvm/versions/node/v22.22.2/lib/node_modules/openclaw/dist` + +## Patched runtime files + +### 1. `send-sxDwUGaO.js` + +Purpose: + +- inject default Telegram inline buttons into assistant replies for PoC validation + +Observed patch point: + +- line containing: + - `buildInlineKeyboard(opts.buttons ?? [[{ text: "A. 繼續", callback_data: "rec:continue" }, { text: "B. 就這樣吧,不需要額外處理", callback_data: "rec:stop" }]])` + +What it changes: + +- if no explicit Telegram buttons are supplied, PoC default reply-end buttons are attached + +### 2. `bot-Ce301bOE.js` + +Purpose: + +- handle reply-end callback data +- persist callback choice +- visibly update buttons +- send callback acknowledgement +- read stop state on later inbound messages and suppress proactive continuation behavior + +Observed patch points: + +- raw callback debug file path: + - `reply-end-debug.log` +- persisted state file path: + - `reply-end-controls.json` +- callback click handling: + - `reply-end-controls: ${choice} clicked ...` +- resolved button states: + - `✅ A. 繼續` + - `⏹ B. 就這樣吧,不需要額外處理` +- callback acknowledgement replies: + - `reply-end-controls: continue received` + - `reply-end-controls: stop received` +- inbound stop-state behavior injection: + - if stored state for this chat is `stop`, append a strong system-style instruction before agent execution to suppress proactive continuation + +## Persisted files created by the PoC + +These are written under the OpenClaw state dir: + +- `~/.openclaw/reply-end-debug.log` +- `~/.openclaw/reply-end-controls.json` + +## What this inventory is for + +This inventory supports the next implementation phase: + +- building a reproducible patch set +- defining apply/rollback scripts +- replacing direct runtime edits with a cleaner integration path + +## What this inventory is not + +- not a production implementation guide +- not a stable plugin API +- not a guarantee that these exact line offsets will survive OpenClaw upgrades + +The purpose is simply to capture what currently makes the PoC work. diff --git a/scripts/apply-openclaw-poc-patch.sh b/scripts/apply-openclaw-poc-patch.sh new file mode 100755 index 0000000..293beb8 --- /dev/null +++ b/scripts/apply-openclaw-poc-patch.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euo pipefail + +echo "reply-end-controls PoC patch applicator" +echo +echo "This is a skeleton script." +echo "Its intended future role is to apply the currently documented OpenClaw runtime patch set to a target test environment." +echo +echo "Before implementing this script fully, consult:" +echo "- reports/openclaw-patch-inventory.md" +echo "- telegram-openclaw-poc-plan.md" diff --git a/scripts/rollback-openclaw-poc-patch.sh b/scripts/rollback-openclaw-poc-patch.sh new file mode 100755 index 0000000..cf958ba --- /dev/null +++ b/scripts/rollback-openclaw-poc-patch.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euo pipefail + +echo "reply-end-controls PoC patch rollback" +echo +echo "This is a skeleton script." +echo "Its intended future role is to revert the documented OpenClaw runtime patch set from a target test environment." +echo +echo "Before implementing this script fully, consult:" +echo "- reports/openclaw-patch-inventory.md" +echo "- telegram-openclaw-poc-plan.md"