Phase 2 P1 Tasks Completed: API Layer (gateway-client.ts, gatewayStore.ts): - Add Channels CRUD: getChannel, createChannel, updateChannel, deleteChannel - Add Triggers CRUD: getTrigger, createTrigger, updateTrigger, deleteTrigger - Add Skills CRUD: getSkill, createSkill, updateSkill, deleteSkill - Add Scheduled Tasks API: createScheduledTask, deleteScheduledTask, toggleScheduledTask - Add loadModels action for dynamic model list UI Components: - ModelsAPI.tsx: Dynamic model loading from API with loading/error states - SchedulerPanel.tsx: Full CreateJobModal with cron/interval/once scheduling - SecurityStatus.tsx: Loading states, error handling, retry functionality - WorkflowEditor.tsx: New workflow creation/editing modal (new file) - WorkflowHistory.tsx: Workflow execution history viewer (new file) - WorkflowList.tsx: Integrated editor and history access Configuration: - Add 4 Hands TOML configs: clip, collector, predictor, twitter Documentation (SYSTEM_ANALYSIS.md): - Update API coverage: 65% → 89% (53/62 endpoints) - Update UI completion: 85% → 92% - Mark Phase 2 P1 tasks as completed - Update technical debt cleanup status Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
157 lines
3.2 KiB
TOML
157 lines
3.2 KiB
TOML
# Twitter Hand - Twitter/X 自动化能力包
|
||
#
|
||
# OpenFang 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
|