@chenshu2026/qianchuan-auto 0.0.0-stage → 1.0.0
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/README.md +70 -2
- package/cordis.patch.yml +4 -0
- package/data/ruleset.json +51 -0
- package/icon.svg +14 -0
- package/index.js +1237 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +33 -3
package/README.md
CHANGED
|
@@ -1,3 +1,71 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 千川自动化投放(qianchuan-auto)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
一个 DeepSeek Harness(DSH)Host 插件,接入**巨量千川 Marketing API**,内置规则引擎,实现乘方/全域调控任务的自动化:加预算、调出价、异常暂停、每日建量、账本记账。
|
|
4
|
+
|
|
5
|
+
> 插件自包含:规则、状态、账本都在插件自己的 `data/` 目录,拷走即可用。
|
|
6
|
+
|
|
7
|
+
## 功能
|
|
8
|
+
|
|
9
|
+
- **API 工具**:授权、账户、计划、报表、素材、可控任务、乘方计划、一键调速等 17 个工具。
|
|
10
|
+
- **规则引擎**(`qianchuan_engine_run`):
|
|
11
|
+
- **R4**:任意任务 ROI < 素材平均×50% 且消耗≥500 → 暂停/重建(首次确认)
|
|
12
|
+
- **R5**:放量 成交÷预算≥9 → 预算+500;控成本 消耗>预算×80% 且 ROI≥10 → 预算+1000(自动)
|
|
13
|
+
- **R6**:控成本 Δ<25%×H1 → 出价×1.066;Δ>75%×H1 → 出价×0.934(自动,取整,250~350)
|
|
14
|
+
- **R7**:控成本 消耗时长>2h 且 ROI<素材平均×70% → 暂停/重建(首次确认)
|
|
15
|
+
- **R8**:连续 4 次巡检成交无新增 → 暂停/重建(首次确认)
|
|
16
|
+
- **每日建量**:06:10 提议建 直投-放 / 主-放 / 次-放(首次确认)
|
|
17
|
+
- **账本**:`data/ops_ledger.jsonl`,记录每次加预算/调价,卡单日≤4次。
|
|
18
|
+
|
|
19
|
+
## 给别人的安装步骤(5 步)
|
|
20
|
+
|
|
21
|
+
1. **拿到插件**:解压 `qianchuan-auto` 到他本地,例如 `C:\Users\他\qianchuan-auto`。
|
|
22
|
+
2. **安装**:DSH → Plugins → **Add plugin** → 输入该文件夹的**绝对路径**(或让他的 DSH agent 调 `plugin_manager install_bundle`,target=文件夹路径)→ 装完启用。
|
|
23
|
+
3. **改账户**:编辑 `data/ruleset.json`:
|
|
24
|
+
- `account.advertiserId` = 他的广告主 ID
|
|
25
|
+
- `account.planId` = 他的乘方计划 ID
|
|
26
|
+
- `params` 里按需调阈值/开关(可选)
|
|
27
|
+
4. **授权**:用他的 App ID/Secret 调用 `qianchuan_save_credentials` → `qianchuan_get_auth_url` → 浏览器授权 → 再 `qianchuan_save_credentials`(带 auth_code)。
|
|
28
|
+
5. **启用自动化**:
|
|
29
|
+
- `cordis.patch.yml` 的 `config.polling.enabled: true`(每 30 分钟自动跑),或
|
|
30
|
+
- 建 DSH 定时任务,每 30 分钟调 `qianchuan_engine_run`。
|
|
31
|
+
|
|
32
|
+
## 配置
|
|
33
|
+
|
|
34
|
+
`cordis.patch.yml` 的 `config`:
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
config:
|
|
38
|
+
advertiserId: '' # 默认广告主 ID,留空则用授权账户
|
|
39
|
+
planId: '' # 乘方计划 ID,留空则用 ruleset.account.planId
|
|
40
|
+
dataDir: '' # 数据目录,留空 = 插件自己的 data/
|
|
41
|
+
polling:
|
|
42
|
+
enabled: true # 开启后台引擎
|
|
43
|
+
intervalMinutes: 30
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 规则参数(`data/ruleset.json` 的 `params`)
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
"params": {
|
|
50
|
+
"R4": { "enabled": true, "roiFactor": 0.5, "minCost": 500 },
|
|
51
|
+
"R5": { "enabled": true, "boostRatio": 9, "boostAdd": 500, "controlSpendPct": 0.8, "controlMinRoi": 10, "controlAdd": 1000, "dailyLimit": 4 },
|
|
52
|
+
"R6": { "enabled": true, "lowPct": 0.25, "highPct": 0.75, "bidUp": 1.066, "bidDown": 0.934, "bidMin": 250, "bidMax": 350 },
|
|
53
|
+
"R7": { "enabled": true, "minAgeHours": 2, "roiFactor": 0.7 },
|
|
54
|
+
"R8": { "enabled": true, "consecutiveRuns": 4 },
|
|
55
|
+
"dailyCreate": { "enabled": true, "roiFactor": 0.8, "top": 9, "from": 10, "to": 18, "budgetPerHour": 100 }
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
新增/修改规则 = 改 `params` 或 `dailyCreate`,**不用改代码**。
|
|
60
|
+
|
|
61
|
+
## 注意
|
|
62
|
+
|
|
63
|
+
- **凭据不打包**:每位使用者用自己的 App ID/Secret 授权,插件目录不含任何密钥。
|
|
64
|
+
- **19 位 material_id 精度**:建任务时用精确整数(引擎/仓库里的 `create_task.py` 已处理),不要直接用 JS 数字。
|
|
65
|
+
- **R4/R7/R8 与每日建量是「首次触发需确认」**,不会自动删任务。
|
|
66
|
+
- **接口频控**:引擎有「指标全 0 则整轮跳过」的护栏,避免误触发。
|
|
67
|
+
|
|
68
|
+
## 分享前建议
|
|
69
|
+
|
|
70
|
+
- 清空 `data/rule_state.json`(把 `snapshots` 置空)和 `data/ops_ledger.jsonl`(清空)。
|
|
71
|
+
- 保留 `data/ruleset.json` 作为模板,把 `account.advertiserId/planId` 留成占位符,提醒对方修改。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"rulesetName": "千川乘方自动化投放规则集(自包含)",
|
|
3
|
+
"version": "2026-12-02",
|
|
4
|
+
"account": {
|
|
5
|
+
"advertiserId": "",
|
|
6
|
+
"planId": "",
|
|
7
|
+
"planName": "把你的乘方计划名填这里"
|
|
8
|
+
},
|
|
9
|
+
"params": {
|
|
10
|
+
"R4": { "enabled": true, "roiFactor": 0.5, "minCost": 500 },
|
|
11
|
+
"R5": { "enabled": true, "boostRatio": 9, "boostAdd": 500, "controlSpendPct": 0.8, "controlMinRoi": 10, "controlAdd": 1000, "dailyLimit": 4 },
|
|
12
|
+
"R6": { "enabled": true, "lowPct": 0.25, "highPct": 0.75, "bidUp": 1.066, "bidDown": 0.934, "bidMin": 250, "bidMax": 350 },
|
|
13
|
+
"R7": { "enabled": true, "minAgeHours": 2, "roiFactor": 0.7 },
|
|
14
|
+
"R8": { "enabled": true, "consecutiveRuns": 4 },
|
|
15
|
+
"dailyCreate": { "enabled": true, "roiFactor": 0.8, "top": 9, "from": 10, "to": 18, "budgetPerHour": 100 }
|
|
16
|
+
},
|
|
17
|
+
"dailyCreate": {
|
|
18
|
+
"openCheck": "DELIVERY_OK / DELIVERYING 才继续,否则跳过",
|
|
19
|
+
"duration": "创建时刻 → 次日 01:00 的小时数",
|
|
20
|
+
"tasks": [
|
|
21
|
+
{ "name": "直投-放", "material": "直播间画面素材", "mode": "放量" },
|
|
22
|
+
{ "name": "主-放", "material": "近3天 · 消耗降序 · ROI≥平均×80% · 前9条", "mode": "放量" },
|
|
23
|
+
{ "name": "次-放", "material": "近3天 · 消耗降序 · ROI≥平均×80% · 第10~18条", "mode": "放量" }
|
|
24
|
+
],
|
|
25
|
+
"budget": "时长 × 100",
|
|
26
|
+
"disabled": ["高ROI-放"]
|
|
27
|
+
},
|
|
28
|
+
"monitorRules": [
|
|
29
|
+
{ "id": "R4", "name": "ROI过低", "condition": "总ROI < 素材平均×50%,累计消耗≥500", "action": "删除重建(首次确认)" },
|
|
30
|
+
{ "id": "R5", "name": "加预算", "condition": "控成本:消耗>预算×80% 且 ROI≥10;放量:成交÷预算≥9", "action": "控成本 +1000;放量 +500;单日限4次" },
|
|
31
|
+
{ "id": "R6", "name": "控成本调价", "condition": "控成本:Δ<上一个小时消耗×25% → 出价×1.066;Δ>75% → 出价×0.934", "action": "取整;自动执行" },
|
|
32
|
+
{ "id": "R7", "name": "控成本超2小时低ROI", "condition": "控成本:消耗时长>2h 且 总ROI<素材平均×70%", "action": "删除重建(首次确认)" },
|
|
33
|
+
{ "id": "R8", "name": "连续4次无新增成交", "condition": "所有任务:连续4次巡检成交无新增", "action": "删除重建(首次确认)" }
|
|
34
|
+
],
|
|
35
|
+
"guards": {
|
|
36
|
+
"bidMin": 250,
|
|
37
|
+
"bidMax": 350,
|
|
38
|
+
"maxRebuildPerTaskPerDay": 6,
|
|
39
|
+
"maxBudgetAddPerTaskPerDay": 4,
|
|
40
|
+
"readonlyWindow": "00:00-05:59",
|
|
41
|
+
"ledgerPath": "data/ops_ledger.jsonl"
|
|
42
|
+
},
|
|
43
|
+
"execution": {
|
|
44
|
+
"R4": { "mode": "confirm_first" },
|
|
45
|
+
"R5": { "mode": "auto" },
|
|
46
|
+
"R6": { "mode": "auto" },
|
|
47
|
+
"R7": { "mode": "confirm_first" },
|
|
48
|
+
"R8": { "mode": "confirm_first" },
|
|
49
|
+
"dailyCreate": { "mode": "confirm_first" }
|
|
50
|
+
}
|
|
51
|
+
}
|
package/icon.svg
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128" role="img" aria-label="Qianchuan auto delivery">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
|
|
4
|
+
<stop offset="0" stop-color="#4f7cff"/>
|
|
5
|
+
<stop offset="1" stop-color="#7a5cff"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect x="4" y="4" width="120" height="120" rx="28" fill="url(#bg)"/>
|
|
9
|
+
<path d="M28 88 L52 62 L66 72 L92 42" fill="none" stroke="#ffffff" stroke-width="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
10
|
+
<path d="M76 42 L92 42 L92 58" fill="none" stroke="#ffffff" stroke-width="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
11
|
+
<circle cx="52" cy="62" r="6" fill="#ffffff"/>
|
|
12
|
+
<circle cx="66" cy="72" r="6" fill="#ffffff"/>
|
|
13
|
+
<circle cx="92" cy="42" r="6" fill="#ffffff"/>
|
|
14
|
+
</svg>
|