Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
重构所有代码和文档中的项目名称,将OpenFang统一更新为ZCLAW。包括: - 配置文件中的项目名称 - 代码注释和文档引用 - 环境变量和路径 - 类型定义和接口名称 - 测试用例和模拟数据 同时优化部分代码结构,移除未使用的模块,并更新相关依赖项。
157 lines
3.2 KiB
TOML
157 lines
3.2 KiB
TOML
# Twitter Hand - Twitter/X 自动化能力包
|
||
#
|
||
# ZCLAW Hand 配置
|
||
# 这个 Hand 提供 Twitter/X 平台的自动化操作和互动能力
|
||
|
||
[hand]
|
||
name = "twitter"
|
||
version = "1.0.0"
|
||
description = "Twitter/X 自动化能力包 - 发推文、搜索、分析和互动"
|
||
author = "ZCLAW Team"
|
||
|
||
# Hand 类型
|
||
type = "communication"
|
||
|
||
# 是否需要人工审批才能执行
|
||
# 发推文等敏感操作需要审批
|
||
requires_approval = true
|
||
|
||
# 默认超时时间(秒)
|
||
timeout = 120
|
||
|
||
# 最大并发执行数
|
||
max_concurrent = 3
|
||
|
||
# 能力标签
|
||
tags = ["twitter", "social", "automation", "engagement", "marketing"]
|
||
|
||
[hand.config]
|
||
# API 配置
|
||
api_version = "v2"
|
||
rate_limit_mode = "strict" # strict, relaxed
|
||
|
||
# 发推配置
|
||
max_tweet_length = 280
|
||
auto_shorten_urls = true
|
||
url_shortener = "none" # none, bitly, custom
|
||
|
||
# 搜索配置
|
||
search_max_results = 100
|
||
search_include_metrics = true
|
||
|
||
# 互动配置
|
||
max_daily_likes = 50
|
||
max_daily_retweets = 25
|
||
max_daily_follows = 30
|
||
|
||
# 安全设置
|
||
allow_sensitive_content = false
|
||
filter_spam = true
|
||
|
||
[hand.triggers]
|
||
# 触发器配置
|
||
manual = true
|
||
schedule = true
|
||
webhook = true
|
||
|
||
# 事件触发器
|
||
[[hand.triggers.events]]
|
||
type = "schedule.cron"
|
||
pattern = "0 9,12,18 * * *" # 每天3次
|
||
priority = 5
|
||
|
||
[[hand.triggers.events]]
|
||
type = "chat.intent"
|
||
pattern = "推特|发推|tweet|twitter|x\\.com"
|
||
priority = 5
|
||
|
||
[hand.permissions]
|
||
# 权限要求
|
||
requires = [
|
||
"twitter.read",
|
||
"twitter.write",
|
||
"twitter.engage"
|
||
]
|
||
|
||
# RBAC 角色要求
|
||
roles = ["operator.read", "operator.write", "social.manage"]
|
||
|
||
# 速率限制(严格遵循 Twitter API 限制)
|
||
[hand.rate_limit]
|
||
max_requests = 100
|
||
window_seconds = 900 # 15 minutes
|
||
|
||
# 审计配置
|
||
[hand.audit]
|
||
log_inputs = true
|
||
log_outputs = true
|
||
retention_days = 90 # 社交媒体操作保留更长时间
|
||
|
||
# 参数定义
|
||
[[hand.parameters]]
|
||
name = "action"
|
||
label = "操作类型"
|
||
type = "select"
|
||
required = true
|
||
options = ["post", "search", "analyze", "engage"]
|
||
description = "要执行的 Twitter 操作"
|
||
|
||
[[hand.parameters]]
|
||
name = "content"
|
||
label = "内容"
|
||
type = "textarea"
|
||
required = false
|
||
description = "推文内容或搜索查询"
|
||
|
||
[[hand.parameters]]
|
||
name = "schedule"
|
||
label = "计划时间"
|
||
type = "text"
|
||
required = false
|
||
description = "ISO 日期时间或 'now'"
|
||
|
||
[[hand.parameters]]
|
||
name = "mediaUrls"
|
||
label = "媒体 URL"
|
||
type = "text"
|
||
required = false
|
||
description = "附加媒体的 URL(逗号分隔,最多4个)"
|
||
|
||
# 工作流步骤(根据操作类型)
|
||
[[hand.workflow]]
|
||
id = "validate"
|
||
name = "验证请求"
|
||
description = "检查操作权限和参数有效性"
|
||
|
||
[[hand.workflow]]
|
||
id = "prepare"
|
||
name = "准备内容"
|
||
description = "处理内容、缩短 URL、附加媒体"
|
||
|
||
[[hand.workflow]]
|
||
id = "execute"
|
||
name = "执行操作"
|
||
description = "调用 Twitter API 执行操作"
|
||
|
||
[[hand.workflow]]
|
||
id = "verify"
|
||
name = "验证结果"
|
||
description = "确认操作成功并记录结果"
|
||
|
||
# 操作特定的工作流
|
||
[[hand.workflow.post]]
|
||
steps = ["validate", "prepare", "execute", "verify"]
|
||
approval_required = true
|
||
|
||
[[hand.workflow.search]]
|
||
steps = ["validate", "execute", "verify"]
|
||
approval_required = false
|
||
|
||
[[hand.workflow.analyze]]
|
||
steps = ["validate", "execute", "verify"]
|
||
approval_required = false
|
||
|
||
[[hand.workflow.engage]]
|
||
steps = ["validate", "execute", "verify"]
|
||
approval_required = true
|