-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·124 lines (115 loc) · 3.83 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·124 lines (115 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/usr/bin/env bash
set -euo pipefail
OPENCLAW_HOME="${OPENCLAW_HOME:-$HOME/.openclaw}"
CONFIG_PATH="$OPENCLAW_HOME/openclaw.json"
SCRIPT_PATH="${0-}"
SCRIPT_DIR=""
case "$SCRIPT_PATH" in
""|bash|sh|-bash|-sh) ;;
*)
if [ -e "$SCRIPT_PATH" ]; then
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
fi
;;
esac
TMP_REPO=""
cleanup() {
if [ -n "$TMP_REPO" ] && [ -d "$TMP_REPO" ]; then
rm -rf "$TMP_REPO"
fi
}
trap cleanup EXIT
fetch_if_needed() {
if [ -f "$SCRIPT_DIR/plugin/index.ts" ]; then
return 0
fi
TMP_REPO="$(mktemp -d)"
curl -fsSL "https://codeload.github.com/bkochavy/openclaw-postfix-pack/tar.gz/main" | tar -xz -C "$TMP_REPO"
SCRIPT_DIR="$(find "$TMP_REPO" -mindepth 1 -maxdepth 1 -type d | head -1)"
}
command -v openclaw >/dev/null 2>&1 || {
echo "openclaw is required" >&2
exit 1
}
command -v python3 >/dev/null 2>&1 || {
echo "python3 is required" >&2
exit 1
}
mkdir -p "$OPENCLAW_HOME"
[ -f "$CONFIG_PATH" ] || printf '{}\n' > "$CONFIG_PATH"
fetch_if_needed
openclaw plugins install "$SCRIPT_DIR/plugin"
python3 - "$CONFIG_PATH" <<'PY'
import json, sys
from pathlib import Path
p = Path(sys.argv[1])
obj = json.loads(p.read_text())
obj.setdefault('messages', {})['responsePrefix'] = '[[ocstamp:{provider}:{model}:{identityname}]]'
plugins = obj.setdefault('plugins', {})
allow = plugins.setdefault('allow', [])
if 'message-stamp-suffix' not in allow:
allow.append('message-stamp-suffix')
entries = plugins.setdefault('entries', {})
entry = entries.setdefault('message-stamp-suffix', {'enabled': True})
entry['enabled'] = True
entry['config'] = {
'marker': 'ocstamp',
'separator': '\n',
'identityMode': 'initial',
'providerAliases': {
'anthropic': 'anK',
'claude-cli': 'anO',
'codex-cli': 'opK',
'lmstudio': 'lmL',
'opencode': 'ocK',
'openai-codex': 'opK',
'openrouter': 'orK',
'vercel-ai-gateway': 'veT',
'xai': 'xaK'
},
'modelAliases': {
'claude-haiku-4.5': 'h45',
'claude-haiku-4-5': 'h45',
'claude-opus-4.6': 'o46',
'claude-opus-4-6': 'o46',
'claude-sonnet-4.5': 's45',
'claude-sonnet-4-5': 's45',
'claude-sonnet-4.6': 's46',
'claude-sonnet-4-6': 's46',
'glm-5': 'g5',
'gpt-5.2': 'gpt52',
'gpt-5.3-codex': 'gpt53c',
'gpt-5.3-codex-spark': 'gpt53s',
'gpt-5.4': 'gpt54',
'grok-4-1-fast': 'g41f',
'haiku-4.6': 'h46',
'kimi-k2.5': 'k25',
'minimax-m2.5': 'm25',
'opus-4.6': 'o46',
'qwen3-8b-mlx': 'q38b',
'sonnet-4.6': 's46'
}
}
def strip_postfix(node):
if isinstance(node, dict):
for key in list(node.keys()):
value = node[key]
if key == 'responsePrefix' and isinstance(value, str) and value.startswith('postfix:'):
del node[key]
continue
strip_postfix(value)
elif isinstance(node, list):
for item in node:
strip_postfix(item)
strip_postfix(obj.get('channels', {}))
p.write_text(json.dumps(obj, indent=2) + '\n')
PY
launchctl bootout "gui/$(id -u)/ai.openclaw.gateway-selfheal" >/dev/null 2>&1 || true
launchctl disable "gui/$(id -u)/ai.openclaw.gateway-selfheal" >/dev/null 2>&1 || true
rm -f "$HOME/Library/LaunchAgents/ai.openclaw.gateway-selfheal.plist"
rm -f "$OPENCLAW_HOME/bin/patch.py" "$OPENCLAW_HOME/bin/ensure-openclaw-postfix-patch.py" "$OPENCLAW_HOME/bin/selfheal.sh" "$OPENCLAW_HOME/bin/wrapper.sh" "$OPENCLAW_HOME/bin/openclaw-gateway-wrapper.sh" "$OPENCLAW_HOME/bin/openclaw-gateway-selfheal.sh" "$OPENCLAW_HOME/bin/postfix-apply"
rm -f "$OPENCLAW_HOME/postfix-pack.json" "$OPENCLAW_HOME/postfix-pack.example.json"
if command -v openclaw >/dev/null 2>&1; then
openclaw gateway restart >/dev/null 2>&1 || true
fi
echo "openclaw-postfix-pack v2 installed"