@optima-chat/optima-agent 0.8.103 → 0.9.1

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.
Files changed (91) hide show
  1. package/.claude/skills/ads/SKILL.md +26 -28
  2. package/.claude/skills/channels/SKILL.md +179 -0
  3. package/.claude/skills/skillify/SKILL.md +114 -0
  4. package/dist/bin/bi-cli.js +0 -0
  5. package/dist/bin/browser-cli.js +0 -0
  6. package/dist/bin/channels.d.ts +3 -0
  7. package/dist/bin/channels.d.ts.map +1 -0
  8. package/dist/bin/channels.js +3 -0
  9. package/dist/bin/channels.js.map +1 -0
  10. package/dist/bin/commerce.js +0 -0
  11. package/dist/bin/gen.js +0 -0
  12. package/dist/bin/google-ads.js +0 -0
  13. package/dist/bin/logistics.js +0 -0
  14. package/dist/bin/optima.js +0 -0
  15. package/dist/bin/scout.js +0 -0
  16. package/dist/bin/sentinel.js +0 -0
  17. package/dist/bin/shopify.js +0 -0
  18. package/package.json +4 -2
  19. package/.claude/settings.local.json +0 -166
  20. package/dist/bin/comfy.d.ts +0 -3
  21. package/dist/bin/comfy.d.ts.map +0 -1
  22. package/dist/bin/comfy.js +0 -3
  23. package/dist/bin/comfy.js.map +0 -1
  24. package/dist/bin/growth.d.ts +0 -3
  25. package/dist/bin/growth.d.ts.map +0 -1
  26. package/dist/bin/growth.js +0 -3
  27. package/dist/bin/growth.js.map +0 -1
  28. package/dist/src/hooks-loader.d.ts +0 -6
  29. package/dist/src/hooks-loader.d.ts.map +0 -1
  30. package/dist/src/hooks-loader.js +0 -215
  31. package/dist/src/hooks-loader.js.map +0 -1
  32. package/dist/src/ui/App.d.ts +0 -6
  33. package/dist/src/ui/App.d.ts.map +0 -1
  34. package/dist/src/ui/App.js +0 -164
  35. package/dist/src/ui/App.js.map +0 -1
  36. package/dist/src/ui/components/Composer.d.ts +0 -10
  37. package/dist/src/ui/components/Composer.d.ts.map +0 -1
  38. package/dist/src/ui/components/Composer.js +0 -13
  39. package/dist/src/ui/components/Composer.js.map +0 -1
  40. package/dist/src/ui/components/Header.d.ts +0 -7
  41. package/dist/src/ui/components/Header.d.ts.map +0 -1
  42. package/dist/src/ui/components/Header.js +0 -7
  43. package/dist/src/ui/components/Header.js.map +0 -1
  44. package/dist/src/ui/components/Message.d.ts +0 -12
  45. package/dist/src/ui/components/Message.d.ts.map +0 -1
  46. package/dist/src/ui/components/Message.js +0 -21
  47. package/dist/src/ui/components/Message.js.map +0 -1
  48. package/dist/src/ui/components/MessageList.d.ts +0 -9
  49. package/dist/src/ui/components/MessageList.d.ts.map +0 -1
  50. package/dist/src/ui/components/MessageList.js +0 -18
  51. package/dist/src/ui/components/MessageList.js.map +0 -1
  52. package/dist/src/ui/components/Spinner.d.ts +0 -6
  53. package/dist/src/ui/components/Spinner.d.ts.map +0 -1
  54. package/dist/src/ui/components/Spinner.js +0 -7
  55. package/dist/src/ui/components/Spinner.js.map +0 -1
  56. package/dist/src/ui/components/StatusBar.d.ts +0 -11
  57. package/dist/src/ui/components/StatusBar.d.ts.map +0 -1
  58. package/dist/src/ui/components/StatusBar.js +0 -7
  59. package/dist/src/ui/components/StatusBar.js.map +0 -1
  60. package/dist/src/ui/components/index.d.ts +0 -7
  61. package/dist/src/ui/components/index.d.ts.map +0 -1
  62. package/dist/src/ui/components/index.js +0 -7
  63. package/dist/src/ui/components/index.js.map +0 -1
  64. package/dist/src/validation/error-formatter.d.ts +0 -21
  65. package/dist/src/validation/error-formatter.d.ts.map +0 -1
  66. package/dist/src/validation/error-formatter.js +0 -98
  67. package/dist/src/validation/error-formatter.js.map +0 -1
  68. package/dist/src/validation/index.d.ts +0 -10
  69. package/dist/src/validation/index.d.ts.map +0 -1
  70. package/dist/src/validation/index.js +0 -10
  71. package/dist/src/validation/index.js.map +0 -1
  72. package/dist/src/validation/json-validator.d.ts +0 -25
  73. package/dist/src/validation/json-validator.d.ts.map +0 -1
  74. package/dist/src/validation/json-validator.js +0 -173
  75. package/dist/src/validation/json-validator.js.map +0 -1
  76. package/dist/src/validation/schema.d.ts +0 -353
  77. package/dist/src/validation/schema.d.ts.map +0 -1
  78. package/dist/src/validation/schema.js +0 -57
  79. package/dist/src/validation/schema.js.map +0 -1
  80. package/dist/src/validation/suggestions.d.ts +0 -25
  81. package/dist/src/validation/suggestions.d.ts.map +0 -1
  82. package/dist/src/validation/suggestions.js +0 -144
  83. package/dist/src/validation/suggestions.js.map +0 -1
  84. package/dist/src/validation/types.d.ts +0 -40
  85. package/dist/src/validation/types.d.ts.map +0 -1
  86. package/dist/src/validation/types.js +0 -5
  87. package/dist/src/validation/types.js.map +0 -1
  88. package/dist/src/validation/yaml-validator.d.ts +0 -25
  89. package/dist/src/validation/yaml-validator.d.ts.map +0 -1
  90. package/dist/src/validation/yaml-validator.js +0 -177
  91. package/dist/src/validation/yaml-validator.js.map +0 -1
@@ -39,7 +39,7 @@ AI 广告官:通过 `~/ads/` 工作目录持续运营用户的付费广告投放
39
39
  2. `cat ~/ads/PROGRESS.md | head -30` — 上次做了什么、异常、下次待办
40
40
  3. `git -C ~/ads log --oneline -5` — 最近变更
41
41
  4. `ls ~/ads/campaigns/` — 列出本地登记的 campaign
42
- 5. `ads status --json` — 从后端拉事实: 在跑的 campaign 列表 + 7 天花费 + 钱包 + 月度 cap
42
+ 5. `ads status` — 从后端拉事实(默认 JSON 输出,加 `--pretty` 可读格式): 在跑的 campaign 列表 + 7 天花费 + 钱包 + 月度 cap
43
43
  - 如果钱包余额 < 阈值,第一时间告诉用户
44
44
  - 如果月度 cap 使用率 > 80%,同样提示
45
45
  - 如果后端 campaign 和本地目录对不齐,视为需要修复
@@ -52,7 +52,7 @@ AI 广告官:通过 `~/ads/` 工作目录持续运营用户的付费广告投放
52
52
  (The template directory is at the same path as this SKILL.md file, under `template/user/`.)
53
53
  2. `cd ~/ads && git init && git add -A && git commit -m "init workspace"`
54
54
  3. **对话式引导填 ADS.md**(一次问一个,不要塞 10 个表单):
55
- - "我们要推广什么?" `commerce-cli product list` 列候选商品
55
+ - "我们要推广什么?"(商品、店铺、网站、活动等均可。如果是商品,加载 `product` skill 查询商品信息)
56
56
  - "默认目标受众是谁?(地域 / 年龄 / 设备 / 时段)"
57
57
  - "月度总预算上限多少美元?"
58
58
  - "有什么品牌禁忌或必须避开的词吗?"
@@ -60,7 +60,7 @@ AI 广告官:通过 `~/ads/` 工作目录持续运营用户的付费广告投放
60
60
  4. `ads init --total-monthly-budget <X>` — 后端创建 user_ads 记录 + 确保 Google Ads label 存在 + 查 USD wallet
61
61
  5. 把后端返回的 ID 自动填进 ADS.md 的"后端登记"段,`git commit -m "register backend"`
62
62
  6. 提示用户:
63
- - 钱包余额为 0 → "需要先充值. 说 'topup 100' 可充 $100"
63
+ - 钱包余额为 0 → "需要先充值. 说 'ads budget topup --amount 100' 可充 $100"
64
64
  - 有余额 → "可以现在 launch 第一个 campaign,或者下次会话再开始"
65
65
 
66
66
  **不会自动 launch 任何 campaign.** 第一次 launch 必须由用户明确要求。
@@ -79,9 +79,9 @@ AI 广告官:通过 `~/ads/` 工作目录持续运营用户的付费广告投放
79
79
 
80
80
  **流程**:
81
81
  1. 读 ADS.md 拿整体策略,确认推什么产品、受众、预算
82
- 2. `gen image` 生成多个素材变体到 `~/ads/assets/`
82
+ 2. 加载 `gen` skill 生成多个素材变体到 `~/ads/assets/`
83
83
  3. 构造 CampaignSpec JSON(参考下方"CampaignSpec 结构"),写到 `/tmp/spec.json`
84
- 4. `ads launch --spec /tmp/spec.json --reason "..."` — 默认 PAUSED
84
+ 4. `ads launch create --spec /tmp/spec.json --reason "..."` — 默认 PAUSED
85
85
  5. **必做**: 创建 `~/ads/campaigns/<slug>/` 子目录:
86
86
  ```bash
87
87
  slug=<campaign-slug>
@@ -103,11 +103,14 @@ AI 广告官:通过 `~/ads/` 工作目录持续运营用户的付费广告投放
103
103
  2. 读 `~/ads/campaigns/<slug>/CREATIVES.md` 看变体表现
104
104
  3. 读 `~/ads/LEARNINGS.md` 看历史经验
105
105
  4. 决定要改什么(一个或多个):
106
- - 淘汰低 CTR 素材: `ads optimize pause-creative <id> --reason "..."`
107
- - 加新关键词: `ads optimize add-keywords <ad_group_id> --keywords "..." --reason "..."`
108
- - 加否定词: `ads optimize add-negatives <ad_group_id> --keywords "..." --reason "..."`
109
- - 调出价修正: `ads optimize change-bid-mod <criterion_id> --modifier 1.2 --reason "..."`
110
- - 调预算: `ads budget set --campaign <id> --daily <usd> --reason "..."`
106
+ - 淘汰低 CTR 素材: `ads optimize pause-variant --campaign <id> --variant <id> --reason "..."`
107
+ - 恢复素材: `ads optimize resume-variant --campaign <id> --variant <id> --reason "..."`
108
+ - 加新关键词: `ads optimize add-keywords --campaign <id> --keywords "word1" "word2" --reason "..."`
109
+ - 移除关键词: `ads optimize remove-keywords --campaign <id> --keywords "word1" --reason "..."`
110
+ - 加否定词: `ads optimize add-negatives --campaign <id> --keywords "word1" "word2" --reason "..."`
111
+ - 调出价修正: `ads optimize change-bid-mod --campaign <id> --modifier 1.2 --reason "..."`
112
+ - 替换素材: `ads optimize replace-variant --campaign <id> --old-variant <id> --spec /tmp/v.json --reason "..."`
113
+ - 调预算: `ads budget set --campaign <id> --daily <micros> --reason "..."`
111
114
  5. 更新 `campaigns/<slug>/CREATIVES.md`(把被淘汰的变体移到"已淘汰"段)
112
115
  6. 追加一段到 `campaigns/<slug>/NOTES.md`(观察 + 推理 + 下次验证点)
113
116
  7. 如果这个洞察是可泛化的,也追加到 `~/ads/LEARNINGS.md`
@@ -119,8 +122,8 @@ AI 广告官:通过 `~/ads/` 工作目录持续运营用户的付费广告投放
119
122
  **触发**: 定时(每天)或作为其它动作的前置。
120
123
 
121
124
  **流程**:
122
- 1. `ads collect --days 7` → 后端从 Google Ads 拉 per-campaign 和 per-creative 的最新数据,返回 JSON
123
- 2. 对返回的每个 `creative_perf` 项,找到对应 `campaigns/<slug>/CREATIVES.md`(通过 `campaign_id` 匹配——每个 `campaigns/<slug>/STRATEGY.md` 的"后端关联"段记录了 `campaign_id`),用新 CTR/CVR/花费重写"在投变体"表
125
+ 1. `ads collect --days 7` → 后端从 Google Ads 拉 per-campaign 和 per-variant 的最新数据,返回 JSON
126
+ 2. 对返回的每个 snapshot 中的 `variantPerf` 项,找到对应 `campaigns/<slug>/CREATIVES.md`(通过 `campaign_id` 匹配——每个 `campaigns/<slug>/STRATEGY.md` 的"后端关联"段记录了 `campaign_id`),用新 CTR/CVR/花费重写"在投变体"表
124
127
  3. 如果是纯 collect session(不是被其它动作调用),追加一段到 PROGRESS.md 和 commit。
125
128
  如果是嵌入在其它动作里,则跟那个动作的 commit 合并。
126
129
 
@@ -140,9 +143,9 @@ AI 广告官:通过 `~/ads/` 工作目录持续运营用户的付费广告投放
140
143
  **触发**: 用户说"加预算"、"充钱"。
141
144
 
142
145
  **场景**:
143
- - "加到 $20/天" → `ads budget set --campaign <id> --daily 20 --reason "..."`
144
- - "月度上限改 $500" → `ads budget set --total-monthly 500 --reason "..."`
145
- - "充 $100" → `ads budget topup 100` → 把返回的 `checkout_url` 作为 markdown 链接输出给用户
146
+ - "加到 $20/天" → `ads budget set --campaign <id> --daily 20000000 --reason "..."`
147
+ - "月度上限改 $500" → `ads budget set --total-monthly 500000000 --reason "..."`
148
+ - "充 $100" → `ads budget topup --amount 100` → 把返回的 `checkout_url` 作为 markdown 链接输出给用户(topup 用 USD)
146
149
  - "看下预算" → `ads budget show`
147
150
 
148
151
  改完之后相应更新 `ADS.md`(月度 cap 变化)或 `campaigns/<slug>/STRATEGY.md`(campaign 日预算变化),commit。
@@ -154,7 +157,7 @@ AI 广告官:通过 `~/ads/` 工作目录持续运营用户的付费广告投放
154
157
  **流程**:
155
158
  - "停掉 XX campaign" → `ads pause campaign <id> --reason "..."`
156
159
  - "全停" → `ads pause all --reason "..."`
157
- - "停某个素材" → `ads pause creative <variant_id> --reason "..."`
160
+ - "停某个素材" → `ads pause variant <variant_id> --reason "..."`
158
161
  - "恢复" → `ads resume ...`(但钱包低余额或月度 cap 超出时会被后端拒)
159
162
 
160
163
  停掉之后在对应 `campaigns/<slug>/NOTES.md` 记一笔,commit。
@@ -176,12 +179,12 @@ AI 广告官:通过 `~/ads/` 工作目录持续运营用户的付费广告投放
176
179
  **触发**: 独立会话,聚焦素材质量。
177
180
 
178
181
  **流程**:
179
- 1. `ads status --include-creatives` 看现状
182
+ 1. `ads status --include-variants` 看现状
180
183
  2. 读 `~/ads/campaigns/<slug>/CREATIVES.md` 和 `~/ads/LEARNINGS.md`
181
184
  3. 决定要生成什么新变体(几个 prompt、什么风格)
182
- 4. `gen image "<prompt>" -o ~/ads/assets` 多次调用
185
+ 4. 加载 `gen` skill 生成素材到 `~/ads/assets/`
183
186
  5. 写进对应 `campaigns/<slug>/CREATIVES.md`
184
- 6. 如果要把新变体上线到现有 campaign: `ads optimize replace-creative <campaign_id> --new-spec /tmp/v.json --reason "..."`
187
+ 6. 如果要把新变体上线到现有 campaign: `ads optimize replace-variant --campaign <campaign_id> --old-variant <id> --spec /tmp/v.json --reason "..."`
185
188
  7. 如果只是建素材库待用,不上线,也 OK
186
189
  8. commit
187
190
 
@@ -201,8 +204,8 @@ AI 广告官:通过 `~/ads/` 工作目录持续运营用户的付费广告投放
201
204
  "intentSignals": ["夏季连衣裙", "summer dress"],
202
205
  "excludeSignals": ["免费", "free"]
203
206
  },
204
- "budget": { "dailyLimitUsd": 10 },
205
- "creatives": [
207
+ "budget": { "dailyLimitMicros": 10000000, "totalLimitMicros": 300000000 },
208
+ "variants": [
206
209
  {
207
210
  "variantId": "v_abc123",
208
211
  "headlines": ["标题1 最多 30 字", "标题2", "标题3", "标题4", "标题5"],
@@ -231,14 +234,9 @@ AI 广告官:通过 `~/ads/` 工作目录持续运营用户的付费广告投放
231
234
  ## Skill 之间的协作
232
235
 
233
236
  按需加载其它 skill:
234
- - **`gen`** — image/video/tts 生成
237
+ - **`gen`** — image 生成
238
+ - **`video-gen`** — video 生成
235
239
  - **`scout`** / **`shein`** / **`tiktok`** 等 — 竞品研究、关键词发现(在 launch 或 optimize 的策略阶段)
236
240
  - **`sentinel`** — 定时调度 collect / optimize / report
237
241
  - **`browser`** — API 不支持时的兜底
238
242
 
239
- ## 依赖的 CLI
240
-
241
- - `ads`(`@optima-chat/ads-cli`)— 本 skill 的核心后端入口
242
- - `gen`(`@optima-chat/gen-cli`)— 素材生成
243
- - `commerce-cli`(`@optima-chat/commerce-cli`)— 查商家商品
244
- - `git`(系统)— workspace 版本管理
@@ -0,0 +1,179 @@
1
+ ---
2
+ name: channels
3
+ description: "社交渠道管理。接入/管理 Telegram、WhatsApp、Discord、Slack、飞书、LINE、Zalo 等社交渠道,绑定用户账号,发送通知。使用场景:接入渠道(connect channel)、绑定(bind)、社交(social)、Telegram、WhatsApp、Discord、Slack、飞书、LINE、Zalo、通知(notify)、推送(push)、消息(message)。"
4
+ ---
5
+
6
+ # Optima Channels - 社交渠道管理
7
+
8
+ 管理社交渠道接入、用户绑定和消息推送。支持 Telegram、WhatsApp、Discord、Slack、飞书、LINE、Zalo。
9
+
10
+ ## 典型场景
11
+
12
+ 当用户说:
13
+ - "帮我接入 Telegram" → 引导创建 bot → `channels accounts add telegram --account-id store --token <token>`
14
+ - "查看我的渠道" → `channels accounts list`
15
+ - "关掉 Telegram" → `channels accounts disable telegram store`
16
+ - "重新开启 Telegram" → `channels accounts enable telegram store`
17
+ - "删除 Telegram 渠道" → `channels accounts remove telegram store`
18
+ - "帮我绑定 Telegram" → `channels bind generate`
19
+ - "查看我的绑定" → `channels bind list`
20
+ - "解绑 Telegram" → `channels bind remove --platform telegram --account-id store --platform-uid 123456`
21
+ - "给用户发通知" → `channels send --user-id <id> --text "消息内容"`
22
+ - "广播消息" → `channels broadcast --text "消息" --user-ids id1,id2`
23
+ - "查看渠道状态" → `channels status`
24
+
25
+ ### 场景决策表
26
+
27
+ | 用户需求 | 推荐命令 | 关键注意点 |
28
+ |---------|---------|-----------|
29
+ | 接入新渠道 | `channels accounts add <platform>` | 不同平台需要不同参数,见下方 |
30
+ | 查看渠道列表 | `channels accounts list` | 显示所有账号及状态 |
31
+ | 启用/禁用渠道 | `channels accounts enable/disable` | 不删除配置,只是暂停 |
32
+ | 删除渠道 | `channels accounts remove` | 永久删除,需重新配置 |
33
+ | 绑定社交账号 | `channels bind generate` | 生成绑定码,用户在社交 App 发给 bot |
34
+ | 查看绑定 | `channels bind list` | 显示当前用户绑定的社交账号 |
35
+ | 解绑 | `channels bind remove` | 需要指定 platform、account-id、platform-uid |
36
+ | 发送通知 | `channels send` | 发到用户所有已绑定渠道 |
37
+ | 广播 | `channels broadcast` | 发给多个用户 |
38
+
39
+ ## 场景1:接入 Telegram
40
+
41
+ **流程**: 创建 Bot → 获取 Token → 添加到 Optima
42
+
43
+ ```bash
44
+ # 1. 引导用户:
45
+ # "请在 Telegram 找 @BotFather,发送 /newbot,按提示创建 bot,然后把 token 发给我"
46
+
47
+ # 2. 用户提供 token 后,添加渠道
48
+ channels accounts add telegram --account-id store --token "123456:AAHxxxxxxxxxx"
49
+
50
+ # 3. 验证
51
+ channels status
52
+ ```
53
+
54
+ ## 场景2:接入 Discord
55
+
56
+ ```bash
57
+ # 1. 引导用户:
58
+ # "请在 Discord Developer Portal (discord.com/developers) 创建 Application → Bot,
59
+ # 开启 MESSAGE CONTENT Intent,复制 Bot Token"
60
+
61
+ # 2. 添加渠道
62
+ channels accounts add discord --account-id store --token "MTA3xxx..."
63
+
64
+ # 3. 验证
65
+ channels status
66
+ ```
67
+
68
+ ## 场景3:接入 Slack
69
+
70
+ ```bash
71
+ # 1. 引导用户:
72
+ # "请在 api.slack.com 创建 App,启用 Socket Mode,获取 Bot Token 和 App Token"
73
+
74
+ # 2. 添加渠道
75
+ channels accounts add slack --account-id store \
76
+ --bot-token "xoxb-..." \
77
+ --app-token "xapp-..." \
78
+ --signing-secret "..."
79
+
80
+ # 3. 验证
81
+ channels status
82
+ ```
83
+
84
+ ## 场景4:接入飞书
85
+
86
+ ```bash
87
+ # 1. 引导用户:
88
+ # "请在飞书开发者后台创建应用,获取 App ID 和 App Secret"
89
+
90
+ # 2. 添加渠道
91
+ channels accounts add feishu --account-id store \
92
+ --app-id "cli_xxx" \
93
+ --app-secret "xxx"
94
+
95
+ # 3. 验证
96
+ channels status
97
+ ```
98
+
99
+ ## 场景5:接入 LINE
100
+
101
+ ```bash
102
+ # 1. 引导用户:
103
+ # "请在 LINE Developers Console 创建 Messaging API channel,获取 Channel Access Token 和 Channel Secret"
104
+
105
+ # 2. 添加渠道
106
+ channels accounts add line --account-id store \
107
+ --channel-access-token "xxx" \
108
+ --channel-secret "xxx"
109
+
110
+ # 3. 配置 Webhook URL(需在 LINE Developer Console 手动设置):
111
+ # https://channels-api.optima.onl/webhook/line/store
112
+
113
+ # 4. 验证
114
+ channels status
115
+ ```
116
+
117
+ ## 场景6:绑定社交账号
118
+
119
+ **流程**: 生成绑定码 → 用户在社交 App 发给 bot
120
+
121
+ ```bash
122
+ # 1. 生成绑定码(默认当前登录用户)
123
+ channels bind generate
124
+ # 输出: { "code": "BIND-A3X7K9", "expiresIn": 300 }
125
+
126
+ # 2. 告诉用户:
127
+ # "请在 Telegram 给 @YourBot 发送: BIND-A3X7K9(5分钟内有效)"
128
+
129
+ # 3. 确认绑定
130
+ channels bind list
131
+ ```
132
+
133
+ ## 场景7:发送通知
134
+
135
+ ```bash
136
+ # 发送给单个用户(发到所有已绑定渠道)
137
+ channels send --user-id "uuid-xxx" --text "您的订单 #1234 已发货"
138
+
139
+ # 指定渠道发送
140
+ channels send --user-id "uuid-xxx" --text "消息" --platform telegram
141
+
142
+ # 广播给多个用户
143
+ channels broadcast --text "新品上架!限时8折" --user-ids "uuid-1,uuid-2,uuid-3"
144
+ ```
145
+
146
+ ## 各平台必需参数
147
+
148
+ | 平台 | 必需参数 | 获取方式 |
149
+ |------|---------|---------|
150
+ | Telegram | `--token` | @BotFather 创建 bot |
151
+ | Discord | `--token` | Developer Portal → Bot |
152
+ | Slack | `--bot-token` `--app-token` `--signing-secret` | api.slack.com → App |
153
+ | LINE | `--channel-access-token` `--channel-secret` | LINE Developers Console |
154
+ | 飞书 | `--app-id` `--app-secret` | 飞书开发者后台 |
155
+ | WhatsApp | `--session-dir`(可选) | baileys QR 扫码认证 |
156
+ | Zalo | `--token` | Zalo Developer Console |
157
+
158
+ ## 命令参考
159
+
160
+ ```bash
161
+ # 状态
162
+ channels status
163
+
164
+ # 账号管理
165
+ channels accounts list
166
+ channels accounts add <platform> --account-id <id> [平台参数]
167
+ channels accounts remove <platform> <accountId>
168
+ channels accounts enable <platform> <accountId>
169
+ channels accounts disable <platform> <accountId>
170
+
171
+ # 绑定管理
172
+ channels bind generate [--user-id <id>]
173
+ channels bind list [--user-id <id>]
174
+ channels bind remove --platform <p> --account-id <a> --platform-uid <uid>
175
+
176
+ # 消息
177
+ channels send --user-id <id> --text "消息"
178
+ channels broadcast --text "消息" --user-ids "id1,id2"
179
+ ```
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: skillify
3
+ description: "Create custom reusable skills from conversation patterns or described workflows"
4
+ when_to_use: "Use when user wants to create a skill, automate a workflow, save a repeatable process, or says 'make this a skill'"
5
+ ---
6
+
7
+ # Skillify — Create Custom Skills
8
+
9
+ ## Goal
10
+ Help the user create a reusable skill (SKILL.md file) and register it for immediate use.
11
+
12
+ ## Step 1: Understand Intent
13
+
14
+ Ask the user:
15
+ - "What do you want to automate?"
16
+ - "Is this based on something we just did, or a new workflow?"
17
+
18
+ If based on conversation history, review the recent tool calls to extract the pattern.
19
+
20
+ ## Step 2: Interview (3-5 questions)
21
+
22
+ Use AskUserQuestion (if available) or direct questions:
23
+
24
+ 1. **Name**: "What should this skill be called?"
25
+ - Generate slug: lowercase, hyphens only, letters/numbers, start with letter, max 50 chars
26
+ - Examples: "Competitor Analysis" → `competitor-analysis`, "竞品分析" → `competitor-analysis`
27
+ - **Always use English for slug, even if name is in Chinese**
28
+
29
+ 2. **Trigger**: "When should this skill activate? Give me example phrases."
30
+
31
+ 3. **Arguments**: "What inputs does it need each time?" (e.g., keyword, region, URL)
32
+
33
+ 4. **Config**: "Does it need any API keys or credentials?" (most skills don't)
34
+
35
+ 5. **Output**: "Should it produce a file, display results, or both?"
36
+
37
+ ## Step 3: Generate SKILL.md
38
+
39
+ Create the file following this template exactly:
40
+
41
+ ```
42
+ ---
43
+ name: {slug}
44
+ description: "{one-line description in the user's language}"
45
+ when_to_use: "{trigger phrases as a sentence}"
46
+ ---
47
+
48
+ # {Display Name}
49
+
50
+ ## Goal
51
+ {Clear statement of what this skill accomplishes}
52
+
53
+ ## Inputs
54
+ - `$arg1`: {description}
55
+ - `$arg2`: {description}
56
+
57
+ ## Steps
58
+
59
+ ### 1. {First Step}
60
+ {Specific instructions — use exact CLI commands where possible}
61
+
62
+ **Success criteria**: {How to verify this step succeeded}
63
+
64
+ ### 2. {Second Step}
65
+ ...
66
+
67
+ ### N. {Final Step — Output}
68
+ {Generate report / display results / write file}
69
+
70
+ **Success criteria**: {Final deliverable verification}
71
+ ```
72
+
73
+ **Rules:**
74
+ - Every step MUST have **Success criteria**
75
+ - Use `$arg_name` for referencing inputs (this is a prompt convention, not a template system)
76
+ - Be specific: include exact CLI commands (e.g., `scout search "$keyword"`)
77
+ - If a step uses a known skill's CLI, include the full command syntax
78
+ - Keep total content under 100KB
79
+ - Frontmatter: only use `name`, `description`, `when_to_use` (other fields are for future use)
80
+
81
+ ## Step 4: Preview & Confirm
82
+
83
+ Show the complete SKILL.md to the user:
84
+
85
+ "Here's your new skill. Review it and let me know if you want changes:"
86
+
87
+ Display the full content. Wait for confirmation. If changes requested, modify and show again.
88
+
89
+ ## Step 5: Save
90
+
91
+ On confirmation:
92
+
93
+ 1. Create directory and write file:
94
+ ```bash
95
+ mkdir -p /home/aiuser/.claude/skills/{slug}
96
+ ```
97
+ Then use Write tool: `/home/aiuser/.claude/skills/{slug}/SKILL.md`
98
+
99
+ 2. Register with registry:
100
+ ```bash
101
+ optima-skills-cli skill create --slug "{slug}" --name "{name}" --description "{description}" --file "/home/aiuser/.claude/skills/{slug}/SKILL.md"
102
+ ```
103
+
104
+ 3. Parse the JSON output. If it contains an `id` field, creation succeeded.
105
+
106
+ 4. Tell the user: "Skill '{name}' created! Try it by saying: '{trigger phrase}'"
107
+
108
+ ## Step 6: Error Handling
109
+
110
+ - **CLI outputs `TOKEN_EXPIRED`**: "注册失败(token 过期),但 skill 在当前会话可用。刷新页面后重试。"
111
+ - **CLI outputs error with `slug already exists`**: Suggest alternative slug, retry with new slug.
112
+ - **CLI outputs other error**: "Skill 保存到本地成功,但注册到云端失败。当前会话可正常使用。"
113
+ - **Write tool fails**: Inform user and abort.
114
+ - **CLI hangs (10s timeout)**: CLI will auto-abort. Tell user: "注册超时,但 skill 在当前会话可用。"
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import "@optima-chat/channels-cli";
3
+ //# sourceMappingURL=channels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../bin/channels.ts"],"names":[],"mappings":";AACA,OAAO,2BAA2B,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import "@optima-chat/channels-cli";
3
+ //# sourceMappingURL=channels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.js","sourceRoot":"","sources":["../../bin/channels.ts"],"names":[],"mappings":";AACA,OAAO,2BAA2B,CAAC"}
File without changes
package/dist/bin/gen.js CHANGED
File without changes
File without changes
File without changes
File without changes
package/dist/bin/scout.js CHANGED
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optima-chat/optima-agent",
3
- "version": "0.8.103",
3
+ "version": "0.9.1",
4
4
  "description": "基于 Claude Agent SDK 的电商运营 AI 助手",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -16,7 +16,8 @@
16
16
  "shopify": "./dist/bin/shopify.js",
17
17
  "logistics": "./dist/bin/logistics.js",
18
18
  "browser-cli": "./dist/bin/browser-cli.js",
19
- "kb-skills": "./dist/bin/kb-skills.js"
19
+ "kb-skills": "./dist/bin/kb-skills.js",
20
+ "channels": "./dist/bin/channels.js"
20
21
  },
21
22
  "files": [
22
23
  "dist",
@@ -51,6 +52,7 @@
51
52
  "@optima-chat/ads-cli": "latest",
52
53
  "@optima-chat/bi-cli": "latest",
53
54
  "@optima-chat/browser-cli": "latest",
55
+ "@optima-chat/channels-cli": "latest",
54
56
  "@optima-chat/commerce-cli": "latest",
55
57
  "@optima-chat/gen-cli": "latest",
56
58
  "@optima-chat/logistics-cli": "latest",
@@ -1,166 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(gh api:*)",
5
- "WebFetch(domain:platform.claude.com)",
6
- "Bash(git init:*)",
7
- "Bash(mkdir:*)",
8
- "Bash(npm run typecheck:*)",
9
- "Bash(npm view:*)",
10
- "WebSearch",
11
- "Bash(commerce --help)",
12
- "Bash(done)",
13
- "Bash(commerce product:*)",
14
- "Bash(commerce order:*)",
15
- "Bash(commerce i18n:*)",
16
- "Bash(google-ads:*)",
17
- "Bash(scout --help:*)",
18
- "Bash(tree:*)",
19
- "Bash(cloc:*)",
20
- "Bash(npm run build:*)",
21
- "Bash(git restore:*)",
22
- "Bash(gh repo view:*)",
23
- "Bash(mv:*)",
24
- "Bash(rmdir:*)",
25
- "Bash(git add:*)",
26
- "Bash(git commit:*)",
27
- "Bash(git push)",
28
- "Bash(timeout 5 npm run optima:*)",
29
- "Bash(npm install:*)",
30
- "Bash(cat:*)",
31
- "Bash(gh issue create:*)",
32
- "Bash(npx tsx:*)",
33
- "Bash(timeout 30 npx tsx:*)",
34
- "Bash(git push origin feature/ask-user-question)",
35
- "Bash(node:*)",
36
- "Bash(npm version:*)",
37
- "Bash(git push:*)",
38
- "Bash(npm publish:*)",
39
- "Bash(pkill:*)",
40
- "Bash(git -C /Users/verypro/optima-agent log --oneline --all -- \".claude/\")",
41
- "Bash(wc:*)",
42
- "Bash(grep:*)",
43
- "Bash(find:*)",
44
- "Bash(commerce collection --help:*)",
45
- "Bash(commerce collection update --help:*)",
46
- "Bash(commerce collection set-cover:*)",
47
- "Bash(commerce collection get --help:*)",
48
- "Bash(commerce collection list --help:*)",
49
- "Bash(commerce collection create --help:*)",
50
- "Bash(commerce collection remove-products:*)",
51
- "Bash(commerce collection list-products:*)",
52
- "Bash(commerce --version:*)",
53
- "Bash(bi-cli --version:*)",
54
- "Bash(commerce homepage create --help:*)",
55
- "Bash(commerce homepage reorder --help:*)",
56
- "Bash(commerce homepage delete --help:*)",
57
- "Bash(commerce homepage update-images:*)",
58
- "Bash(commerce homepage update-collections:*)",
59
- "Bash(commerce homepage update-target:*)",
60
- "Bash(commerce homepage switch-template:*)",
61
- "Bash(commerce inventory:*)",
62
- "Bash(commerce merchant:*)",
63
- "Bash(commerce review:*)",
64
- "Bash(commerce product-page:*)",
65
- "Bash(bi-cli:*)",
66
- "Bash(comfy:*)",
67
- "Bash(scout search:*)",
68
- "Bash(scout product:*)",
69
- "Bash(commerce homepage create-collections:*)",
70
- "Bash(commerce homepage create-featured:*)",
71
- "Bash(commerce homepage create-collection-products:*)",
72
- "Bash(commerce homepage create-banner:*)",
73
- "Bash(xargs -I {} sh -c 'echo \"\"\"\"=== {} ===\"\"\"\"; head -3 /Users/verypro/optima-agent/.claude/skills/{}/SKILL.md | grep \"\"\"\"name:\"\"\"\"')",
74
- "Bash(ls:*)",
75
- "Bash(gh issue view:*)",
76
- "Bash(npx markdownlint-cli:*)",
77
- "Bash(chmod:*)",
78
- "Bash(npm whoami:*)",
79
- "Bash(tsx test-scripts/test-headless-progress.ts:*)",
80
- "Bash(DEBUG_STREAM=1 node dist/bin/optima.js:*)",
81
- "Bash(git describe:*)",
82
- "WebFetch(domain:github.com)",
83
- "Bash(./scripts/test-headless.sh:*)",
84
- "Bash(./scripts/test-headless-simple.sh:*)",
85
- "Bash(env)",
86
- "Bash(gh pr list:*)",
87
- "Bash(gh pr view:*)",
88
- "Bash(gh pr diff:*)",
89
- "Bash(optima --version:*)",
90
- "Bash(optima agent headless:*)",
91
- "Bash(optima headless:*)",
92
- "Bash(/Users/verypro/optima-agent/scripts/test-headless.sh:*)",
93
- "Bash(/Users/verypro/optima-agent/scripts/test-headless-simple.sh:*)",
94
- "Bash(tee:*)",
95
- "Bash(CONV_ID=\"conv-1\":*)",
96
- "Bash(echo:*)",
97
- "Bash(scout tiktok trending --help:*)",
98
- "Bash(scout tiktok trending:*)",
99
- "Bash(git checkout:*)",
100
- "Bash(npm test:*)",
101
- "Bash(git tag:*)",
102
- "Bash(/private/tmp/claude/-Users-verypro-optima-agent/68a9ac2c-def2-44e1-b42b-e53bd9022ab6/scratchpad/test-canUseTool.sh)",
103
- "Bash(optima --help:*)",
104
- "Bash(npx @optima-chat/ads-cli:*)",
105
- "Bash(head:*)",
106
- "Bash(git pull:*)",
107
- "Bash(pnpm build:*)",
108
- "Skill(read-code)",
109
- "Bash(npm run cli:*)",
110
- "Bash(scout:*)",
111
- "WebFetch(domain:docs.scrapecreators.com)",
112
- "WebFetch(domain:scrapecreators.com)",
113
- "Bash(gh auth status:*)",
114
- "Bash(optima-agent:*)",
115
- "Bash(python3:*)",
116
- "Bash(python3 -c \" import sys content = sys.stdin.read\\(\\) # Find flushMessageQueueSync idx = content.find\\(''flushMessageQueueSync''\\) # Get context around it lines = content.split\\(''\\\\n''\\) for i, line in enumerate\\(lines\\): if ''flushMessageQueueSync'' in line and ''private'' in line: for j in range\\(i, min\\(i+20, len\\(lines\\)\\)\\): print\\(f''{j+1}: {lines[j]}''\\) break \")",
117
- "Bash(optima:*)",
118
- "WebFetch(domain:www.npmjs.com)",
119
- "WebFetch(domain:registry.npmjs.org)",
120
- "WebFetch(domain:zod.dev)",
121
- "Bash(npm ls:*)",
122
- "Bash(NODE_DEBUG=child_process npx tsx:*)",
123
- "Bash(DEBUG_CLAUDE_AGENT_SDK=1 npx tsx:*)",
124
- "Bash(CLAUDECODE= npx tsx:*)",
125
- "Bash(env:*)",
126
- "Bash(gh release:*)",
127
- "Bash(npm info:*)",
128
- "Bash(gh run:*)",
129
- "Bash(gtimeout 90:*)",
130
- "Bash(sentinel:*)",
131
- "Bash(gh pr:*)",
132
- "Bash(git fetch:*)",
133
- "Bash(git log:*)",
134
- "Bash(npm bin:*)",
135
- "Bash(git status:*)",
136
- "Bash(browser-cli --version && browser-cli --help)",
137
- "Bash(browser-cli status:*)",
138
- "Bash(browser-cli launch:*)",
139
- "Bash(browser-cli screenshot:*)",
140
- "Bash(browser-cli --version)",
141
- "Bash(browser-cli close:*)",
142
- "Bash(npm update:*)",
143
- "Bash(node -e \"console.log\\(require\\('./node_modules/@optima-chat/browser-cli/package.json'\\).version\\)\")",
144
- "WebFetch(domain:raw.githubusercontent.com)",
145
- "Bash(aws ecs:*)",
146
- "Bash(aws ecr:*)",
147
- "Bash(gh search:*)",
148
- "Bash(npx tsc:*)",
149
- "Bash(find /Users/verypro/optima-agent -path */node_modules -prune -o -type f \\\\\\(-name *comfy* -o -name *gen* \\\\\\) -print)",
150
- "Bash(export PATH=\"/usr/local/bin:$PATH\")",
151
- "Bash(pnpm add:*)",
152
- "Bash(cp -r ~/optima-agent/test/skills/kol-outreach/fixtures/one-active-campaign ~/optima-agent/test/skills/kol-outreach/fixtures/max-rounds-hit)",
153
- "Bash(cp -r ~/optima-agent/test/skills/kol-outreach/fixtures/one-active-campaign ~/optima-agent/test/skills/kol-outreach/fixtures/budget-almost-spent)",
154
- "Bash(cp -r ~/optima-agent/test/skills/kol-outreach/fixtures/one-active-campaign ~/optima-agent/test/skills/kol-outreach/fixtures/two-active-campaigns)",
155
- "Bash(cp -r ~/optima-agent/test/skills/kol-outreach/fixtures/one-active-campaign ~/optima-agent/test/skills/kol-outreach/fixtures/brand-only)",
156
- "Bash(pnpm vitest:*)",
157
- "Bash(pnpm test:*)",
158
- "Bash(pnpm --filter @optima-scout/backend test --reporter=verbose backend/src/routes/outreach/__tests__/lock.test.ts backend/src/routes/outreach/__tests__/inbound.test.ts)",
159
- "Bash(npx vitest:*)",
160
- "Bash(DATABASE_URL=postgres://optima_scout:optima_scout_dev@localhost:7293/optima_scout pnpm --filter @optima-scout/backend test)",
161
- "Bash(pnpm --filter @optima-scout/backend exec vitest run src/routes/outreach/__tests__/inbound.test.ts)"
162
- ],
163
- "deny": [],
164
- "ask": []
165
- }
166
- }