{
  "permissions": {
    "allow": [
      "Bash(wc -l /root/.openclaw/cron/runs/*.jsonl)",
      "Bash(cat /root/.openclaw/cron/runs/daa3e140-bb72-4d83-bb8f-753b25077d64.jsonl | python3 -m json.tool 2>/dev/null | head -100 || cat /root/.openclaw/cron/runs/daa3e140-bb72-4d83-bb8f-753b25077d64.jsonl)",
      "Bash(ls -la /root/.openclaw/agents/main/sessions/*.jsonl | sort -k6,7)",
      "Bash(grep \"feishu\" /root/.openclaw/agents/main/sessions/adfae334-d01b-42bb-9653-c76200266e42.jsonl | head -5 | python3 -c \"import sys,json; [print\\(json.dumps\\(json.loads\\(l\\), indent=2, ensure_ascii=False\\)[:2000]\\) for l in sys.stdin]\")",
      "Bash(python3 /dev/stdin << 'PYEOF'\nimport json\n\nsession_file = '/root/.openclaw/agents/main/sessions/1b6e1dd4-0e38-42a4-aef0-a2cd4d242ad8.jsonl'\nfeishu_sends = []\n\nwith open\\(session_file\\) as f:\n    for line in f:\n        entry = json.loads\\(line\\)\n        msg = entry.get\\('message', {}\\)\n        \n        if msg.get\\('role'\\) == 'assistant':\n            content = msg.get\\('content', []\\)\n            if isinstance\\(content, list\\):\n                for item in content:\n                    if isinstance\\(item, dict\\) and item.get\\('type'\\) == 'toolCall':\n                        name = item.get\\('name', ''\\)\n                        args = item.get\\('arguments', {}\\)\n                        if name == 'message' and args.get\\('channel'\\) == 'feishu':\n                            feishu_sends.append\\(\\(entry.get\\('timestamp'\\), args.get\\('action'\\), args.get\\('message', ''\\)[:150]\\)\\)\n\nprint\\(\"=== Feishu SENDS in 1b6e1dd4 session ===\"\\)\nfor ts, action, msg in feishu_sends:\n    print\\(f\"[{ts}] {action}: {msg}\"\\)\n\nprint\\(f\"\\\\nTotal sends: {len\\(feishu_sends\\)}\"\\)\nPYEOF)",
      "Bash(wc -l /root/.nvm/versions/node/v22.22.0/lib/node_modules/openclaw/extensions/feishu/src/*.ts | sort -rn | head -20)",
      "Bash(python3 -c \"\nimport json\nbackups = [\n    '/root/.openclaw/openclaw.json.bak',\n    '/root/.openclaw/openclaw.json.bak.20260227',\n    '/root/.openclaw/openclaw.json.ok1',\n    '/root/.openclaw/openclaw.json.ok2',\n]\nfor fname in backups:\n    try:\n        with open\\(fname\\) as f:\n            d = json.load\\(f\\)\n        feishu = d.get\\('channels', {}\\).get\\('feishu', {}\\)\n        print\\(f'{fname}: feishu.enabled={feishu.get\\(\\\\\"enabled\\\\\", \\\\\"NOT SET\\\\\"\\)}, feishu.streaming={feishu.get\\(\\\\\"streaming\\\\\", \\\\\"NOT SET\\\\\"\\)}'\\)\n    except Exception as e:\n        print\\(f'{fname}: ERROR {e}'\\)\n\")",
      "Bash(python3 /dev/stdin << 'PYEOF'\nimport json\n\nfname = '/root/.openclaw/agents/main/sessions/4fccb9f1-37cf-48e4-8348-75afbaac1af4.jsonl'\ntool_counts = {}\nfeishu_sends = []\n\nwith open\\(fname\\) as f:\n    for line in f:\n        entry = json.loads\\(line\\)\n        msg = entry.get\\('message', {}\\)\n        if msg.get\\('role'\\) == 'toolResult':\n            tool = msg.get\\('toolName', '?'\\)\n            tool_counts[tool] = tool_counts.get\\(tool, 0\\) + 1\n            if tool == 'message':\n                details = msg.get\\('details', {}\\)\n                feishu_sends.append\\({\n                    'ts': entry.get\\('timestamp'\\),\n                    'channel': details.get\\('channel'\\),\n                    'result': details.get\\('result', {}\\),\n                    'isError': msg.get\\('isError'\\)\n                }\\)\n\nprint\\(\"Tool counts:\"\\)\nfor k, v in sorted\\(tool_counts.items\\(\\), key=lambda x: -x[1]\\):\n    print\\(f\"  {k}: {v}\"\\)\n    \nprint\\(f\"\\\\nFeishu message sends \\({len\\(feishu_sends\\)}\\):\"\\)\nfor s in feishu_sends:\n    print\\(f\"  [{s['ts']}] channel={s['channel']} error={s['isError']} result={s['result']}\"\\)\nPYEOF)",
      "Bash(python3 /dev/stdin << 'PYEOF'\nimport json\n\n# Check all sub-agent sessions for feishu sends\nimport os\n\nsessions_dir = '/root/.openclaw/agents/sub-agent/sessions'\ntotal_feishu = []\n\nfor fname in os.listdir\\(sessions_dir\\):\n    path = os.path.join\\(sessions_dir, fname\\)\n    feishu_sends = []\n    try:\n        with open\\(path\\) as f:\n            for line in f:\n                entry = json.loads\\(line\\)\n                msg = entry.get\\('message', {}\\)\n                if msg.get\\('role'\\) == 'toolResult' and msg.get\\('toolName'\\) == 'message':\n                    details = msg.get\\('details', {}\\)\n                    if details.get\\('channel'\\) == 'feishu':\n                        feishu_sends.append\\(entry.get\\('timestamp'\\)\\)\n    except:\n        pass\n    if feishu_sends:\n        total_feishu.append\\(\\(fname, feishu_sends\\)\\)\n\nprint\\(f\"Sub-agent sessions with feishu sends: {len\\(total_feishu\\)}\"\\)\nfor fname, sends in total_feishu:\n    print\\(f\"  {fname}: {len\\(sends\\)} sends\"\\)\n    for ts in sends:\n        print\\(f\"    {ts}\"\\)\nPYEOF)",
      "Bash(grep -rn \"streaming.*boolean\\\\|streaming.*false\\\\|renderMode\" /root/.nvm/versions/node/v22.22.0/lib/node_modules/openclaw/extensions/feishu/src/*.ts 2>/dev/null)",
      "Bash(find /root/.openclaw/agents -name \"*.json\" -o -name \"*.yaml\" -o -name \"*.yml\" 2>/dev/null | head -20)",
      "Bash(tail -50 /root/.openclaw/cron/runs/daa3e140-bb72-4d83-bb8f-753b25077d64.jsonl | python3 -c \"import sys,json; [print\\(json.dumps\\(json.loads\\(l\\), ensure_ascii=False, indent=2\\)\\) for l in sys.stdin if l.strip\\(\\)]\" 2>/dev/null | tail -100)",
      "Bash(cat /root/.openclaw/cron/runs/daa3e140-bb72-4d83-bb8f-753b25077d64.jsonl | python3 -c \"\nimport sys, json\nlines = [l.strip\\(\\) for l in sys.stdin if l.strip\\(\\)]\n# get last run\nlast = json.loads\\(lines[-1]\\)\nprint\\(json.dumps\\(last, ensure_ascii=False, indent=2\\)\\)\n\")",
      "Bash(ls /root/.openclaw/delivery-queue/failed/ 2>/dev/null && cat /root/.openclaw/delivery-queue/failed/*.json 2>/dev/null || echo \"empty/no access\")",
      "Bash(cat /root/.openclaw/agents/main/sessions/ff7a488c-aa6e-4528-9ff7-620c46d11bce.jsonl | python3 -c \"\nimport sys, json\nfor line in sys.stdin:\n    line = line.strip\\(\\)\n    if not line: continue\n    d = json.loads\\(line\\)\n    t = d.get\\('type',''\\)\n    ts = d.get\\('timestamp',''\\)\n    msg = d.get\\('message', {}\\)\n    role = msg.get\\('role',''\\)\n    \n    if role == 'tool' or t == 'toolCall':\n        tname = msg.get\\('toolName'\\) or d.get\\('toolName',''\\)\n        targs = msg.get\\('input'\\) or msg.get\\('args'\\) or {}\n        print\\(f'[{ts}] TOOL CALL: {tname} args={json.dumps\\(targs, ensure_ascii=False\\)[:200]}'\\)\n    elif role == 'toolResult':\n        tname = msg.get\\('toolName',''\\)\n        content = msg.get\\('content', []\\)\n        text = content[0].get\\('text',''\\) if content else ''\n        print\\(f'[{ts}] TOOL RESULT: {tname} -> {text[:200]}'\\)\n\" 2>/dev/null)",
      "Bash(cat /root/.openclaw/agents/main/sessions/ff7a488c-aa6e-4528-9ff7-620c46d11bce.jsonl | python3 -c \"\nimport sys, json\nfor line in sys.stdin:\n    line = line.strip\\(\\)\n    if not line: continue\n    d = json.loads\\(line\\)\n    msg = d.get\\('message', {}\\)\n    role = msg.get\\('role',''\\)\n    ts = d.get\\('timestamp',''\\)\n    if role == 'assistant':\n        content = msg.get\\('content', []\\)\n        for c in content:\n            if c.get\\('type'\\) == 'text':\n                print\\(f'[{ts}] ASSISTANT: {c[\\\\\"text\\\\\"][:400]}'\\)\n                break\n\")",
      "Bash(cat /root/.openclaw/agents/main/sessions/ff7a488c-aa6e-4528-9ff7-620c46d11bce.jsonl | python3 -c \"\nimport sys, json\nfor line in sys.stdin:\n    line = line.strip\\(\\)\n    if not line: continue\n    d = json.loads\\(line\\)\n    msg = d.get\\('message', {}\\)\n    role = msg.get\\('role',''\\)\n    if role == 'user':\n        content = msg.get\\('content', []\\)\n        if isinstance\\(content, list\\):\n            for c in content:\n                text = c.get\\('text',''\\)\n                if 'slack' in text.lower\\(\\) or 'D0AH' in text or 'U0' in text or 'W0' in text:\n                    print\\(text[:500]\\)\n                    break\n\" 2>/dev/null | head -30)",
      "Bash(python3 -c \"\nimport json, time\n\nfor attempt in range\\(5\\):\n    try:\n        with open\\('/root/.openclaw/cron/jobs.json', 'r'\\) as f:\n            data = json.load\\(f\\)\n        \n        for job in data['jobs']:\n            if job['delivery']['channel'] == 'feishu':\n                job['delivery']['channel'] = 'slack'\n                job['delivery']['to'] = 'D0AH8JWUMBR'\n            # 顺便更新 prompt 里的飞书引用\n            msg = job['payload'].get\\('message', ''\\)\n            job['payload']['message'] = msg.replace\\('Powell 的飞书', 'Powell 的 Slack'\\).replace\\('通过飞书', '通过 Slack'\\)\n        \n        out = json.dumps\\(data, ensure_ascii=False, indent=2\\)\n        with open\\('/root/.openclaw/cron/jobs.json', 'w'\\) as f:\n            f.write\\(out\\)\n        print\\('Done'\\)\n        break\n    except Exception as e:\n        print\\(f'Attempt {attempt+1} failed: {e}'\\)\n        time.sleep\\(0.5\\)\n\")",
      "Bash(find /root/.nvm/versions/node/v22.22.0/lib/node_modules/openclaw/extensions -name \"*slack*\" -o -name \"*gateway*\" -o -name \"*handler*\" 2>/dev/null | head -20)",
      "Bash(grep -r \"monitorSlackProvider\" /root/.nvm/versions/node/v22.22.0/lib/node_modules/openclaw --include=\"*.ts\" --include=\"*.mts\" 2>/dev/null | head -5)",
      "Bash(grep -r \"agents\\\\.turn\\\\|ctx\\\\.agents\\\\|runtime\\\\.agents\" /root/.nvm/versions/node/v22.22.0/lib/node_modules/openclaw/dist/plugin-sdk --include=\"*.d.ts\" 2>/dev/null | head -20)",
      "Bash(grep -r \"ackReaction\\\\|ack_reaction\" /root/.nvm/versions/node/v22.22.0/lib/node_modules/openclaw/dist/plugin-sdk/config --include=\"*.d.ts\" 2>/dev/null | head -20)",
      "Bash(python3 -c \"\nimport json\nwith open\\('/root/.openclaw/openclaw.json'\\) as f:\n    cfg = json.load\\(f\\)\nprint\\(json.dumps\\(cfg.get\\('messages', {}\\), indent=2, ensure_ascii=False\\)\\)\nprint\\('---'\\)\nprint\\(json.dumps\\(cfg.get\\('channels', {}\\).get\\('slack', {}\\), indent=2, ensure_ascii=False\\)\\)\n\")",
      "Bash(python3 -c \"\nimport json\nwith open\\('/root/.openclaw/openclaw.json'\\) as f:\n    cfg = json.load\\(f\\)\nprint\\(json.dumps\\(cfg.get\\('agents', {}\\), indent=2, ensure_ascii=False\\)\\)\n\")",
      "Bash(python3 -c \"\nimport json\n\nwith open\\('/root/.openclaw/openclaw.json', 'r'\\) as f:\n    cfg = json.load\\(f\\)\n\ncfg['agents']['defaults']['typingMode'] = 'instant'\n\nwith open\\('/root/.openclaw/openclaw.json', 'w'\\) as f:\n    json.dump\\(cfg, f, ensure_ascii=False, indent=2\\)\n\nprint\\('done'\\)\n\")",
      "Bash(ls -lt /root/.openclaw/agents/main/sessions/*.jsonl | head -5)",
      "Bash(python3 -c \"\nimport json\nwith open\\('/root/.openclaw/openclaw.json'\\) as f:\n    cfg = json.load\\(f\\)\nslack = cfg.get\\('channels', {}\\).get\\('slack', {}\\)\nprint\\('botToken:', slack.get\\('botToken', ''\\)[:30] + '...'\\)\nprint\\('ackReaction:', slack.get\\('ackReaction'\\)\\)\nprint\\('messages.ackReaction:', cfg.get\\('messages', {}\\).get\\('ackReaction'\\)\\)\nprint\\('messages.ackReactionScope:', cfg.get\\('messages', {}\\).get\\('ackReactionScope'\\)\\)\n\")",
      "Bash(openclaw start 2>&1)",
      "Bash(openclaw --help 2>&1)",
      "Bash(openclaw gateway --force 2>&1)",
      "Bash(openclaw health 2>&1)",
      "Bash(openclaw status 2>&1)",
      "Bash(systemctl status openclaw-gateway 2>&1)",
      "Bash(journalctl -u openclaw-gateway -n 50 2>&1)",
      "Bash(openclaw daemon --help 2>&1)",
      "Bash(openclaw daemon status 2>&1)",
      "Bash(openclaw doctor --repair 2>&1)",
      "Bash(node --version)",
      "Read(//usr/bin/**)",
      "Bash(journalctl --user -u openclaw-gateway.service -n 100 --no-pager 2>&1 || echo \"No journal logs found\")",
      "Bash(openclaw doctor:*)",
      "Bash(openclaw gateway:*)",
      "Bash(openclaw status:*)",
      "Bash(openclaw logs:*)"
    ]
  }
}
