@geoly-ai/social-hub-cli 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geoly-ai/social-hub-cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "description": "social-hub CLI for Social Ops Hub",
6
6
  "repository": {
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "commander": "^12.1.0",
25
- "@geoly-ai/social-hub-authz": "0.0.4",
26
- "@geoly-ai/social-hub-sdk": "0.0.22"
25
+ "@geoly-ai/social-hub-sdk": "0.0.23",
26
+ "@geoly-ai/social-hub-authz": "0.0.4"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^22.10.2",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 1,
3
3
  "package": "social-ops-hub",
4
- "cliVersion": "0.2.1",
4
+ "cliVersion": "0.2.3",
5
5
  "repository": "social-ops-hub",
6
6
  "publish": {
7
7
  "registry": "https://skill.sh",
@@ -78,13 +78,15 @@ social-hub accounts delete -t <team-id> --account <uuid> # 危险
78
78
  | `credentialsRef` | ✅ | ✅ | vault 引用(可 null) |
79
79
  | `status` | ✅ | ✅ | `warming\|active\|postable\|restricted\|banned` |
80
80
  | `karma` | ✅ | ✅ | int ≥0(可 null) |
81
- | `accountAgeDays` | ✅ | ✅ | int ≥0(可 null|
81
+ | `accountAgeDays` | ✅ | ✅ | int ≥0(可 null);**legacy 回退**,仅 `registeredAt` 未设时参与 age/postable |
82
+ | `registeredAt` | ✅ | ✅ | 平台注册日历日 `YYYY-MM-DD`(可 null,不得晚于今天);账号 age 的**主源** |
83
+ | `ageDays` | — | — | **只读派生**(响应字段):`registeredAt` 有则按天动态算,否则回退 `accountAgeDays` |
82
84
  | `workflowStage` | ✅ | ✅ | `prospect\|qualified\|warming\|onboarded\|active\|at_risk\|restricted\|paused\|archived` |
83
85
  | `metricsSource` | ✅ | ✅ | string(可 null) |
84
86
  | `metricsUpdatedAt` | ✅ | ✅ | ISO8601(可 null) |
85
87
  | `primaryProducts` | ✅ | ✅ | string[](账号主推产品,≤50 项;可 null) |
86
88
 
87
- > `postable` 状态要求 `karma > 20`,否则 400。
89
+ > `postable` 状态要求 `karma > 20` 且账号 age > 21 天,否则 400。account age 由 `registeredAt` 派生(设了就以它为准);未设时回退 legacy `accountAgeDays`。`ageDays` 只读、不可写。
88
90
 
89
91
  ## 账号数据全量同步 checklist
90
92
 
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: social-hub-content-review
3
+ description: >-
4
+ 评论内容复审(发布前三层 gate 的层③):social-hub content review。
5
+ Agent 在 Reddit 评论/回复发布前,把草稿+帖子场景送 Hub 由独立 LLM 按 rubric
6
+ 六维评审(情境锚定/突发性/AI 腔/人设声音/合规红线/自我重复)并可选优化重写。
7
+ 不用于:相关性判定(该不该评这帖)、发帖正文审查、账号级风控闸门。
8
+ metadata:
9
+ cliVersion: ">=0.2.3"
10
+ ---
11
+
12
+ # social-hub-content-review
13
+
14
+ > **前置条件:** 先阅读 [`../social-hub-shared/SKILL.md`](../social-hub-shared/SKILL.md),
15
+ > 确认已 `auth login` 并 `context use <team-id>`。
16
+
17
+ ## 定位(三层 gate 的层③)
18
+
19
+ | 层 | 位置 | 作用 |
20
+ | --- | --------------------------- | ------------------------------------ |
21
+ | ① | agent 本地 check_ai_tone.py | 廉价预筛,硬拦明确 AI 味 |
22
+ | ② | agent 自审 | Hub 不可达时的兜底 |
23
+ | ③ | **本服务** | 独立模型对抗式复审+优化,**权威判定** |
24
+
25
+ 执行顺序:① 预筛 → ③ Hub 复审 → `revise` 用 `optimized` 或改后 `attempt+1`
26
+ 再审(服务端强制上限 2)→ `block` 弃发。\*\*Hub 不可达/degraded → 降级层②自审
27
+
28
+ - 层①硬拦,回执标 `[hub-offline-fallback]`,不阻断发布链。\*\*
29
+
30
+ ## 命令
31
+
32
+ ```bash
33
+ social-hub content review -t <team-id> -j '{
34
+ "accountId": "<uuid|handle>",
35
+ "draft": "<评论草稿>",
36
+ "commentType": "top_level",
37
+ "stage": "互动期",
38
+ "thread": {
39
+ "subreddit": "buildapc",
40
+ "postTitle": "...",
41
+ "postBody": "<OP 正文摘要>",
42
+ "parentComment": "<楼中楼时必带>",
43
+ "topComments": ["<高赞评论 1-3 条>"],
44
+ "subredditToneHint": "blunt/technical"
45
+ },
46
+ "rewrite": true,
47
+ "attempt": 1
48
+ }'
49
+ ```
50
+
51
+ 人设(styleGuide/toneTags/brandFit/avoidTopics)由 Hub 按 accountId 服务端
52
+ enrich,**不要**在请求里传人设内容;`personaId` 传了只做一致性校验。
53
+
54
+ ## 读结果(先看 executionStatus)
55
+
56
+ - `executionStatus: "completed"` → `verdict` 是权威判定:
57
+ - `pass` 直接发;`revise` 用 `optimized`(或按 dimensions.issues 改)后再审一次;
58
+ - `block` 弃发(合规红线/无情境锚定;**block 不会给可发布稿**)。
59
+ - `executionStatus: "degraded"`(LLM 超时/失败) → verdict 不可信,降级层②自审,
60
+ 回执标 `[hub-offline-fallback]`;`degradedReason` 说明原因。
61
+ - `score` 为服务端按版本化权重计算的权威综合分;`modelScore` 仅审计对照。
62
+ - 情境锚定与合规是一票否决维度;静默期账号阈值自动收紧 +10。
63
+
64
+ ## 硬性边界
65
+
66
+ - 确定性预检:草稿含链接/邮箱/站外联系引导(telegram 等)→ 直接 `block`,不烧模型。
67
+ - 全程只调用可信 LLM(部署 env 配置),**绝不**外发第三方 AI 检测器。
68
+ - 限流:每团队每分钟 30 次(可配),429 时降级层②。
69
+ - 复审记录(不含草稿原文,只留 hash+摘要)写 `content_review_records`,
70
+ 供金丝雀趋势;events 有 `system.content_review` 事件。
71
+
72
+ ## 部署配置(Hub 侧,非 agent)
73
+
74
+ `REVIEW_LLM_PROVIDER=anthropic|openai|custom` + `REVIEW_LLM_MODEL` +
75
+ `REVIEW_LLM_API_KEY`;三种 provider 都支持 `REVIEW_LLM_BASE_URL` 覆盖端点
76
+ (不配置走厂商官方默认;代理/网关场景配置它)。非官方 host 须同时加进
77
+ `REVIEW_LLM_CUSTOM_HOST_ALLOWLIST`(逗号分隔 host 列表,防误接第三方 AI
78
+ 检测器的红线双重确认),且 https-only(localhost 例外);custom provider
79
+ 必配 BASE_URL。未配置 provider 时端点 503,agent 走离线降级。
80
+ 复审模型应不同于撰写 agent 的模型(独立性破自我盲区)。
81
+
82
+ 阈值策略(v1 限制):仅支持全局 system_settings key
83
+ `content_review.default_policy`(JSON 部分覆盖默认权重/阈值)+ stage=静默期
84
+ 自动收紧;team/campaign/subreddit 风险层级配置属 v2,尚未支持。
@@ -47,7 +47,9 @@ social-hub graph project --all [--dry-run] # 全部可见团队
47
47
  ```bash
48
48
  social-hub compliance sanctions-list -t <team-id> [--account <uuid>] [--sub <name>]
49
49
  social-hub compliance sanctions-create -t <team-id> -j '{"socialAccountId":"<uuid>","subreddit":"example","status":"blocked","reason":"..."}'
50
- social-hub compliance sanctions-update -t <team-id> --id <sanction-uuid> -j '{"status":"resolved"}'
50
+ # 解除制裁只认 status:"lifted"(枚举 warned/banned/restricted/blocked/cooldown/shadowbanned_suspected/lifted);
51
+ # HTTP API 对 resolved/cleared 等旧值直接 400(仅内部导入路径会归一),必须写 lifted
52
+ social-hub compliance sanctions-update -t <team-id> --id <sanction-uuid> -j '{"status":"lifted"}'
51
53
  social-hub compliance sanctions-delete -t <team-id> --id <sanction-uuid>
52
54
 
53
55
  social-hub compliance risk-list -t <team-id> -n 100
@@ -59,6 +59,8 @@ social-hub ops skip -t <team-id> --job <jobId> --agent "$AGENT" --reason manual_
59
59
  ## 并发
60
60
 
61
61
  同一账号同时只能有一个有效 lease;重复 claim 会被拒绝。`complete` 会原子更新 job 与关联 calendar(若 payload 含 calendarEntryId)。
62
+ `complete`/`fail`/`skip` 均幂等:同终态重试返回成功(`alreadyCompleted`/`alreadyTerminal`),跨终态冲突返回 409。
63
+ cron 周期任务无论 complete/fail/skip 都会自动生成下一期(按原 runAt 推算),循环链不断。skip 的终态是 `skipped`(可用 `--status skipped` 筛出)。
62
64
 
63
65
  遗留路径 `jobs agent-status` 仅在未接 ops 链路时使用(见 `social-hub-calendar-jobs`)。
64
66
 
@@ -111,7 +111,7 @@ social-hub reddit batch-upsert -t <team-id> -j '{
111
111
  ### Item 字段说明
112
112
 
113
113
  - **必填(推荐)**:`subreddit`;有真实 Reddit 链接时带 `permalink`
114
- - **可选**:`title`、`score`、`commentsCount`、`viewCount`、`upvoteRatio`、`postedAt`、`source`、`publishDoc`、`rawPayload`
114
+ - **可选**:`title`、`score`、`commentsCount`、`viewCount`、`seqNo`(数字序列号,列表可按其排序 `sortBy=seq_no`)、`upvoteRatio`、`postedAt`、`source`、`publishDoc`、`rawPayload`
115
115
  - **`opsStatus`**:只写 canonical 值(`normal|risk|deleted|abnormal|unknown`),导入/更新时勿写中文标签。
116
116
  - **`socialAccountId`**:OpenClaw profile 扫描时建议带上(来自 `context account` 的 `account.id`),用于把快照归因到运营账号。
117
117
  - **`viewCount`**:浏览/曝光。平台页面不可见时传 `null`,不要臆造。
@@ -38,6 +38,9 @@ brand(系统级)→ content_draft → publishing_plan → calendar_entry →
38
38
  ```bash
39
39
  social-hub brands system-list
40
40
  social-hub brands system-create -j '{"name":"My Brand","slug":"my-brand"}'
41
+ # 内部自建品牌(养号/测试/自建社区,非合作)标 isInternal:true——Reddit 指标快照剔除其帖子
42
+ social-hub brands system-create -j '{"name":"Internal X","slug":"internal-x","isInternal":true}'
43
+ social-hub brands system-update --brand <uuid> -j '{"isInternal":true}'
41
44
  social-hub brand-members system-list
42
45
  social-hub brand-members system-create -j '{"brandId":"<uuid>","userId":"<uuid>","role":"manager"}'
43
46
  social-hub accounts brand-bindings list -t <team-id> --account <uuid>
@@ -51,9 +54,18 @@ social-hub drafts list -t <team-id> --brand <brand-uuid> -n 20
51
54
  social-hub drafts create -t <team-id> -j '{"brandId":"<uuid>","title":"Launch","body":"..."}'
52
55
  social-hub drafts get -t <team-id> --draft <uuid>
53
56
  social-hub drafts update -t <team-id> --draft <uuid> -j '{"body":"..."}'
57
+ # 乐观并发:带 expectedVersion(get 返回的 version)防覆盖他人改动,版本不匹配返回 409
58
+ social-hub drafts update -t <team-id> --draft <uuid> -j '{"body":"...","expectedVersion":3}'
54
59
  social-hub drafts delete -t <team-id> --draft <uuid> # 先确认 id,再执行
60
+ # 一稿一投:日历条目 succeeded 时系统自动把关联草稿置为 published(终态);
61
+ # published/已在活跃排期中/同计划重复引用的草稿都不能再排入新计划(400)。
62
+ # 误标可手动改回状态(escape hatch):drafts update -j '{"status":"draft"}'
63
+
55
64
 
56
65
  social-hub plans list -t <team-id> --brand <brand-uuid>
66
+ # plan status 为派生值(由 entries 聚合:显式取消 > running > 有待执行=scheduled > failed > succeeded),
67
+ # 响应含 entryCounts 各状态计数;--status 按派生值过滤
68
+ social-hub plans list -t <team-id> --status running
57
69
  social-hub plans create -t <team-id> -j '{"brandId":"<uuid>","name":"Week 1","entries":[...]}'
58
70
  social-hub plans cancel -t <team-id> --plan <uuid> # 破坏性:先 list 确认 plan id
59
71
  ```