siluzan-tso-cli 1.1.23-beta.2 → 1.1.24-beta.2

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 CHANGED
@@ -51,7 +51,7 @@ siluzan-tso init -d /path/to/skills # 写入自定义目录
51
51
  siluzan-tso init --force # 强制覆盖已存在文件
52
52
  ```
53
53
 
54
- > **注意**:当前为测试版(1.1.23-beta.2),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
54
+ > **注意**:当前为测试版(1.1.24-beta.2),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
55
55
 
56
56
  | 助手 | 建议 `--ai` |
57
57
  | ----------------------- | ------------------------------------ |
@@ -7,12 +7,14 @@
7
7
  1. Read `SKILL.md`(路由 + 任务→文档表)
8
8
  2. **每个新任务** Read `references/core/agent-conventions.md`
9
9
  3. 按任务表 Read 对应域文档后再执行 `siluzan-tso …`
10
+ 4. **P5 / P6 / P7** 或长 CLI 输出:可选 Read `references/core/subagent-orchestration.md`(主 Agent 自行决定是否委派 subagent)
10
11
 
11
12
  ## 文档域(gstack-style domains)
12
13
 
13
14
  | 域 | 路径 | 何时 Read |
14
15
  | --- | --- | --- |
15
- | **Core** | `references/core/` | 纪律、安装、tips、playbooks、workflows |
16
+ | **Core** | `references/core/` | 纪律、安装、tips、playbooks、workflows、subagent-orchestration |
17
+ | **Handoff** | `snippets/` | P5/P6/P7 Task 派发模板(与 SKILL 同级) |
16
18
  | **Accounts** | `references/accounts/` | 列表、余额、开户、财务、审计 |
17
19
  | **Google Ads** | `references/google-ads/` | CRUD、PMax、搜索系列流水线;`rules/` 为优化 SOP |
18
20
  | **Analytics** | `references/analytics/` | 拉数、批处理、拓词、RAG、TSO 报告 |
@@ -16,6 +16,8 @@ allowed-tools: Bash(siluzan-tso:*) Read Write
16
16
  <!-- 注入到 SKILL.md.tmpl 的 {{AGENT_PREAMBLE}};构建时由 gen-skill-docs.mjs 合并 -->
17
17
 
18
18
  > **Agent 纪律(每个新任务必读)**:Read `references/core/agent-conventions.md`,再按 `SKILL.md` 任务表 Read 域文档。禁止跨话题复用参数记忆;数据类任务一律 `--json-out` + 脚本读盘(见 `references/core/tips.md`)。
19
+ >
20
+ > **Subagent(可选)**:若宿主支持 Task / 子会话,复杂报告(P5/P6/P7)或长 CLI 输出前 Read `references/core/subagent-orchestration.md`,**自行决定**是否委派;写操作确认与对用户的最终交付留在主 Agent。
19
21
 
20
22
  ---
21
23
 
@@ -55,11 +57,24 @@ Windows:部分 Agent 通过 PowerShell 代执行时可能失败,改在 [Git
55
57
  | `references/google-ads/` | `google-ads.md` | CRUD、PMax、campaign-plan;`rules/` 优化 SOP |
56
58
  | `references/analytics/` | `account-analytics.md` | google-analysis、批处理、拓词、RAG |
57
59
  | `references/operations/` | `forewarning.md` | 预警、线索、optimize、宿主编排 |
60
+ | `references/core/` | `subagent-orchestration.md` | **可选** subagent 自主委派(P5/P6/P7、长日志) |
58
61
 
59
62
  完整文件列表:`references/README.md` · Agent 目录:`AGENTS.md`
60
63
 
61
64
  ---
62
65
 
66
+ ## Subagent 自主委派(可选)
67
+
68
+ 宿主具备 **Task / subagent**(或内置 Bash/Explore)时:
69
+
70
+ 1. **复杂报告或批处理**(P5 / P6 OKKI / P7 询盘)、预计 CLI 输出很长 → 先 Read `references/core/subagent-orchestration.md`,按**决策矩阵**选择主会话或子会话。
71
+ 2. Handoff 模板在 skill 根目录 `snippets/handoff-p{5,6,7}-*.md`;子会话只回传 manifest/exitCode 摘要,**禁止**把 MB 级 JSON 贴回主对话。
72
+ 3. **无 subagent 能力** → 跳过本节,按 `core/playbooks.md` 在主会话执行。
73
+
74
+ 写操作、`--commit`、401/batch `resume` 策略由**主 Agent**负责,不默认下放子会话。
75
+
76
+ ---
77
+
63
78
  ## 任务 → 必读 references
64
79
 
65
80
  | 用户意图(关键词) | 必读(Read 后再 `-h` / 执行) |
@@ -75,9 +90,10 @@ Windows:部分 Agent 通过 PowerShell 代执行时可能失败,改在 [Git
75
90
  | 预警 | `operations/forewarning.md` |
76
91
  | 发票 / 转账 / 充值 | `accounts/finance.md` |
77
92
  | 开户 | `accounts/open-account-by-media.md`(Google 加 `accounts/open-account-google-ui.md`) |
78
- | OKKI 周报 | `report-templates/okki-weekly-google-client.md` + `core/playbooks.md` P6 |
79
- | Google 询盘分析 | `report-templates/google-inquiry-analysis.md` + `core/playbooks.md` P7 |
93
+ | OKKI 周报 | `report-templates/okki-weekly-google-client.md` + `core/playbooks.md` P6;可选 `core/subagent-orchestration.md` |
94
+ | Google 询盘分析 | `report-templates/google-inquiry-analysis.md` + `core/playbooks.md` P7;可选 `core/subagent-orchestration.md` |
80
95
  | 标准画像/扫描/周期报告 | `core/playbooks.md` 对应 P1–P5 |
96
+ | P5 多账户多维度 batch | `analytics/google-analysis-batch.md` + `core/playbooks.md` P5;可选 `core/subagent-orchestration.md` |
81
97
 
82
98
  > 表未覆盖时:查 `references/README.md` → Read 对应 reference → 再执行 CLI。
83
99
 
@@ -96,7 +112,7 @@ P1–P7 见 `references/core/playbooks.md`。
96
112
  | 结构化字段拉取(`--json-out`) | 何时触发检查(cron、对话) |
97
113
  | 写命令语义与读命令复核文档 | IF 条件计算与决策 |
98
114
  | 金额、ID、字段口径一致 | 触达(钉钉/飞书)与工单 |
99
- | references 与命令对齐 | 批处理循环、限速、重试 |
115
+ | references 与命令对齐 | 批处理循环、限速、重试;**可选** subagent 并行(见 `subagent-orchestration.md`) |
100
116
 
101
117
  详见 `operations/hosted-automation-self-control.md`、`operations/hosted-automation-monitoring-json.md`、`operations/hosted-automation-optimize-index.md`。
102
118
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "slug": "siluzan-tso",
3
- "version": "1.1.23-beta.2",
4
- "publishedAt": 1780022870426
3
+ "version": "1.1.24-beta.2",
4
+ "publishedAt": 1780295970911
5
5
  }
@@ -12,6 +12,7 @@
12
12
  | `core/playbooks.md` | P1–P7 高频任务标准动作 |
13
13
  | `core/workflows.md` | 多命令串联业务流程 |
14
14
  | `core/skill-authoring.md` | Skill 文档维护最佳实践(维护者) |
15
+ | `core/subagent-orchestration.md` | **可选**:主 Agent 自主决定是否委派 subagent(P5/P6/P7) |
15
16
 
16
17
  ## 账户与财务
17
18
 
@@ -71,3 +72,13 @@
71
72
  ## 报告模板(`../report-templates/`)
72
73
 
73
74
  见 `report-templates/README.md`。
75
+
76
+ ## Handoff 模板(`../snippets/`,随 skill 安装)
77
+
78
+ | 文件 | 用途 |
79
+ | ---- | ---- |
80
+ | `handoff-p5-batch.md` | P5 batch 与按账户聚合 Task prompt |
81
+ | `handoff-p6-okki.md` | P6 OKKI 拉数 / 写 xlsx |
82
+ | `handoff-p7-inquiry.md` | P7 询盘拉数与 xlsx |
83
+
84
+ `agent-preamble.md` 仅用于构建时注入 `SKILL.md`,不复制到 `dist/skill/snippets/`。
@@ -200,6 +200,18 @@ const tsType = outline
200
200
 
201
201
  ---
202
202
 
203
+ ## 产物消费与 subagent(可选)
204
+
205
+ batch 完成后,主 Agent 按 `references/core/tips.md`:**先 outline 后 JSON**,脚本读盘聚合。
206
+
207
+ 若宿主支持 subagent(见 `references/core/subagent-orchestration.md` § P5):
208
+
209
+ - **batch `run` / `resume`**:主会话或**单次** Bash 执行,**禁止** per-account 子会话重复调 API。
210
+ - **按账户写报告片段**:可对每个 `results/<accountId>/` 并行 Task,handoff 见 `snippets/handoff-p5-batch.md` §阶段 B。
211
+ - 子会话**禁止**重新 `run` batch;401 由主 Agent 统一 `login` 后 `resume`。
212
+
213
+ ---
214
+
203
215
  ## 常见问题
204
216
 
205
217
  **Q:拉全量是不是先 `list-accounts` 再把 ID 拼进 `-a`?**
@@ -46,6 +46,14 @@
46
46
  | **客户/产品背景** | 拓词、方案、报告背景段:先 `rag list` + `rag query`,再衔接 `keyword` / `ad` / `google-analysis` |
47
47
  | **仅调接口** | 优化记录、线索表单、预警、财务命令:无需输出转换 |
48
48
 
49
+ ### Subagent(可选)
50
+
51
+ 宿主支持 Task / 子会话时:
52
+
53
+ 1. **P5 / P6 / P7** 或预计 CLI 日志很长 → Read `references/core/subagent-orchestration.md`,按决策矩阵选择主会话或委派。
54
+ 2. 子会话**不替代**本节「文档加载纪律」:主 Agent 仍须 Read 当次必读 references;handoff 只传路径与命令块,不传对话记忆。
55
+ 3. 写入/修改/删除、`--commit`、对用户确认与最终交付 → **主 Agent**。
56
+
49
57
  ---
50
58
 
51
59
  ## 硬规范
@@ -8,9 +8,9 @@
8
8
  | P2 | 多账户余额扫描 | `accounts/accounts.md`(`balance-scan`)、`accounts/currency.md` |
9
9
  | P3 | 多账户投放画像汇总 | `accounts/accounts.md` § accounts-digest、`accounts/currency.md`、`core/tips.md` |
10
10
  | P4 | Google 账户周期报告 | `report-templates/google-period-report.md`、`analytics/account-analytics.md`、`core/tips.md` |
11
- | P5 | 多账户多维度报告 | `analytics/google-analysis-batch.md`、`analytics/account-analytics.md`、`core/tips.md` |
12
- | P6 | OKKI 周报 | `report-templates/okki-weekly-google-client.md`(全文)、`analytics/account-analytics.md`、`core/tips.md` |
13
- | P7 | Google 询盘分析 | `report-templates/google-inquiry-analysis.md`(全文)、`analytics/account-analytics.md`、`core/tips.md`、`analytics/geo-continents.json` |
11
+ | P5 | 多账户多维度报告 | `analytics/google-analysis-batch.md`、`analytics/account-analytics.md`、`core/tips.md`;可选 `core/subagent-orchestration.md` |
12
+ | P6 | OKKI 周报 | `report-templates/okki-weekly-google-client.md`(全文)、`analytics/account-analytics.md`、`core/tips.md`;可选 `core/subagent-orchestration.md` |
13
+ | P7 | Google 询盘分析 | `report-templates/google-inquiry-analysis.md`(全文)、`analytics/account-analytics.md`、`core/tips.md`、`analytics/geo-continents.json`;可选 `core/subagent-orchestration.md` |
14
14
 
15
15
  ---
16
16
 
@@ -72,6 +72,8 @@ siluzan-tso accounts-digest -m Google -a id1,id2,... --start <S> --end <D> --jso
72
72
 
73
73
  **入口选择**:全量 → 省略 `-a`;2~10 子集 → `google-analysis -a id1,id2,...`;≥10 子集或需 resume → `google-analysis-batch run -a id1,id2,...`
74
74
 
75
+ 0. **执行模式**(可选):Read `core/subagent-orchestration.md` § P5。batch 本身用主会话或**单次** Bash;**禁止** per-account 子会话调 API;batch 完成后可按账户并行 Task 聚合(`snippets/handoff-p5-batch.md`)。
76
+
75
77
  1. 反问时间范围 + 维度(默认 `campaigns,geographic,keywords`)。
76
78
  2. **执行**:
77
79
 
@@ -102,6 +104,8 @@ siluzan-tso accounts-digest -m Google -a id1,id2,... --start <S> --end <D> --jso
102
104
 
103
105
  > **触发**:用户话术含 `使用okki周报模板` / `OKKI 周报` / `okki 周报` 等,且指向 Google 账户 + 日期区间。
104
106
 
107
+ 0. **执行模式**(可选):Read `core/subagent-orchestration.md` § P6。拉数 / 写 xlsx 可分阶段委派(`snippets/handoff-p6-okki.md`);无 subagent 则主会话执行下列步骤。
108
+
105
109
  1. **不要**按 `google-period-report.md` 展开默认 8 维;改读 `report-templates/okki-weekly-google-client.md` 全文。
106
110
  2. 确认 `mediaCustomerId` 与 `--start` / `--end`(未给齐按 `core/agent-conventions.md` 时间范围规则反问)。
107
111
  3. 同一 `--json-out` 目录执行模板中的命令组合:`list-accounts`(可选)、`stats`、`balance`、`google-analysis --sections overview,campaigns,keywords,search-terms,campaign-device,campaign-geo-matched`。
@@ -115,6 +119,8 @@ siluzan-tso accounts-digest -m Google -a id1,id2,... --start <S> --end <D> --jso
115
119
  > **触发**:用户话术含 `Goog账户询盘分析` / `Google 账户询盘分析` / `分析XXX Google账号的询盘效果`,或同时包含「询盘 + 账户 + Google」三要素。
116
120
  > **不要**按 `google-period-report.md` 默认 8 维流程。
117
121
 
122
+ 0. **执行模式**(可选):Read `core/subagent-orchestration.md` § P7。`m1`/`m2`/`m3` 可并行 Task(`snippets/handoff-p7-inquiry.md`);写 8 Sheet xlsx 建议主 Agent 或单 Task 收尾。
123
+
118
124
  1. **时间窗口强约束**:**严格 3 个月** = 分析月份 + 向前 2 个完整自然月。**禁止**扩展到 7 个月。
119
125
  2. **询盘资料入场**:
120
126
  - **流程 A**(用户已附文件):解析 → 落盘 `./snap-inquiry/inquiries.json`(字段见模板「询盘字段清单」)。
@@ -14,8 +14,9 @@ siluzan-tso/ # 安装后目录名
14
14
  ├── SKILL.md.tmpl → SKILL.md # 构建生成
15
15
  ├── snippets/ # 共享注入块
16
16
  ├── docs/skill-guide.md # 人类导读
17
+ ├── snippets/ # agent-preamble、handoff-p5/p6/p7(构建时注入 SKILL 或随包复制)
17
18
  ├── references/
18
- │ ├── core/ # 纪律、安装、playbooks
19
+ │ ├── core/ # 纪律、安装、playbooks、subagent-orchestration
19
20
  │ ├── accounts/ # 账户、开户、财务
20
21
  │ ├── google-ads/ # CLI + rules/
21
22
  │ ├── analytics/ # 拉数、批处理、拓词
@@ -104,6 +105,8 @@ Agent 已具备通用能力。文档只写 **CLI 特有** 内容:字段口径
104
105
  | `SKILL.md` | 安装、能力边界、文档路由表、任务→文档速查、Playbook 索引 |
105
106
  | `references/core/agent-conventions.md` | Agent 纪律:加载时机、硬规范、数据转换、时间/币种/批量 |
106
107
  | `references/core/playbooks.md` | P1–P7 标准动作(可复制命令块) |
108
+ | `references/core/subagent-orchestration.md` | 主 Agent 自主委派决策矩阵(无 `agents/` 目录) |
109
+ | `snippets/handoff-p*.md` | Task handoff 模板(随 skill 安装根复制) |
107
110
  | `references/core/tips.md` | `--json-out` 协议、outline 处理顺序 |
108
111
  | `references/*.md` | 单功能域:命令、参数、输出示例 |
109
112
  | `references/google-ads/rules/` | Google 优化/合规 SOP(非 CLI 参数) |
@@ -181,6 +184,7 @@ description: >-
181
184
  | google-ads-rules 深链三层 | SKILL → `google-ads/rules/README.md` → 具体规则 |
182
185
  | HTML 模板假数据当示例 | 纲要 `.md` 定义维度,数据来自 CLI |
183
186
  | 凭记忆跨任务复用参数 | 每任务重读 `core/agent-conventions.md` § 加载纪律 |
187
+ | 固定 `agents/` 与 skill 双源维护 | 用 `subagent-orchestration.md` + handoff snippets,主 Agent 自主决策 |
184
188
 
185
189
  ---
186
190
 
@@ -0,0 +1,148 @@
1
+ # Subagent 自主委派(宿主客户端)
2
+
3
+ > 本文件定义:在已激活 **siluzan-tso** Skill 的前提下,**主 Agent 如何根据当前任务自行决定**是否在子会话中执行部分步骤,以及如何 handoff。
4
+ > 不预置固定 `agents/` 目录;不修改 CLI。若宿主**无** Task / subagent 能力,**整节不适用**,按 `playbooks.md` 在主会话执行即可。
5
+
6
+ 协议背景:[Agent Skills — Subagent delegation](https://agentskills.io/client-implementation/adding-skills-support)(可选:子会话执行 + 摘要回传)。Cursor 对照:[Skills vs Subagents](https://cursor.com/docs/subagents)。
7
+
8
+ ---
9
+
10
+ ## 主 Agent 与主会话的职责(不可下放)
11
+
12
+ | 保留在主 Agent | 禁止默认交给子会话 |
13
+ | -------------- | ------------------ |
14
+ | 时间范围反问(见 `agent-conventions.md`) | 写入/修改/删除及 `--commit` 确认 |
15
+ | 向用户说明计划并获确认 | 401 后统一停批、引导 `login` 再 `resume` |
16
+ | 合并子会话摘要并交付用户 | 编造 `mediaCustomerId`、金额、业务数据 |
17
+ | 选择 Playbook(P1–P7)与必读 references | 用子会话替代「每任务 Read references」 |
18
+
19
+ 子会话**不继承**父对话历史;handoff 必须**自包含**(见下文)。
20
+
21
+ ---
22
+
23
+ ## 每任务决策流程(建议顺序)
24
+
25
+ 1. Read 当次任务必读 references(`SKILL.md` 任务表 + `agent-conventions.md`)。
26
+ 2. **若**任务属于 P5 / P6 / P7,或预计 CLI 日志冗长 / 需并行拉数 / 需读大段只读 SOP → **Read 本节决策矩阵**。
27
+ 3. 选定执行模式:**主会话** | **单次 Bash 子会话** | **单次 Task handoff** | **并行多个 Task**。
28
+ 4. 执行;子会话仅回传 `returnSchema`(见下),主 Agent 再脚本聚合或写报告。
29
+
30
+ **默认路径**:不确定时 → **主会话直接执行**(与「简单任务不滥用 subagent」一致)。
31
+
32
+ ---
33
+
34
+ ## 决策矩阵
35
+
36
+ | 信号 | 倾向 | 推荐子会话类型 | 勿委派 |
37
+ | ---- | ---- | -------------- | ------ |
38
+ | 单次 `list-accounts -k`、P1 三步拉数、`-h` 查参 | **主会话** | — | 为查一个账户开子会话 |
39
+ | `balance-scan` / `accounts-digest` 单命令 | **主会话** | — | 外层 for-loop 逐账户 |
40
+ | 预计 CLI **>2 分钟** 或 stderr/stdout 很长 | **委派** | 内置 **Bash** 或 Task + `snippets/handoff-*.md` 拉数段 | 在主会话逐行读日志 |
41
+ | **P6 OKKI**:拉数 → 写 xlsx(两阶段) | **委派** | 阶段 1:Bash/Task 拉数;阶段 2:Task 只读 snap 写脚本 | 子会话做写操作确认 |
42
+ | **P7 询盘**:`m1`/`m2`/`m3` 三月拉数 | **并行委派** | 3× Task(`handoff-p7-inquiry.md` 子目录变体) | 3× 主会话顺序跑 |
43
+ | **P5** `google-analysis-batch run` 全量 | **主会话或单次 Bash** | **一次** batch;CLI 内置并发 | per-account 子会话调 API |
44
+ | **P5** batch **完成后** 按账户聚合 | **可选并行** | N× Task,只读 `results/<accountId>/` | 子会话 `run` 新 batch |
45
+ | 读 `google-ads/rules/*` 全文做方案 | **委派** | **Explore** + `readonly` | 主会话 Read 全文进上下文 |
46
+ | 用户仅闲聊 / 解释字段口径 | **主会话** | — | — |
47
+
48
+ ---
49
+
50
+ ## Handoff 规范
51
+
52
+ ### 必填字段(写入 Task prompt 或 Bash 说明)
53
+
54
+ | 字段 | 说明 |
55
+ | ---- | ---- |
56
+ | `playbookId` | `P5` / `P6` / `P7` 等 |
57
+ | `snapDir` | `--json-out` 根目录(绝对或相对 cwd) |
58
+ | `mediaCustomerId` | 来自当次 `list-accounts`,禁止猜 |
59
+ | `dateRange` | `start` / `end`(YYYY-MM-DD);P7 另附 `m1`/`m2`/`m3` |
60
+ | `commands[]` | 可复制 bash 块(来自 playbook 或 report-template) |
61
+ | `forbidden[]` | 至少包含:禁止 Read 全量 MB JSON 进回复;禁止编造 ID/金额;禁止 batch 重新 `run`(仅 `resume`) |
62
+ | `returnSchema` | 子会话**只**回传下列内容 |
63
+
64
+ ### returnSchema(子会话结束时的回复格式)
65
+
66
+ ```text
67
+ exitCode: <number>
68
+ manifestFile: <path or "">
69
+ writtenFiles: [<path>, ...]
70
+ outlineFiles: [<path>, ...]
71
+ stderrTail: <last ~20 lines or "">
72
+ summary: <1-3 句中文,无业务数字除非来自 manifest>
73
+ ```
74
+
75
+ 主 Agent **不得**要求子会话生成 xlsx 话术或向用户确认写操作。
76
+
77
+ ### Handoff 模板文件(复制进 Task prompt)
78
+
79
+ | Playbook | 文件 |
80
+ | -------- | ---- |
81
+ | P6 OKKI | `{skillRoot}/snippets/handoff-p6-okki.md` |
82
+ | P5 batch 后 | `{skillRoot}/snippets/handoff-p5-batch.md` |
83
+ | P7 询盘 | `{skillRoot}/snippets/handoff-p7-inquiry.md` |
84
+
85
+ > **路径说明**:`snippets/` 与 `SKILL.md`、`references/` 同级(skill 安装根目录)。主 Agent 派发 Task 前先 Read 对应 handoff 文件,替换占位符后写入子会话 prompt。
86
+
87
+ ---
88
+
89
+ ## 内置 subagent vs 自定义 Task prompt
90
+
91
+ | 宿主能力 | 何时优先 |
92
+ | -------- | -------- |
93
+ | **Bash**(Cursor 内置) | 纯 `siluzan-tso` 命令序列、长输出隔离 |
94
+ | **Explore** + `readonly` | 只读搜 reference / `rules/`,不改 snap |
95
+ | **Task + 自写 prompt** | 需嵌入上表 `forbidden` 且 Bash 不够用 |
96
+
97
+ 不要求固定子 Agent 名称;在 prompt 中写清角色即可(例:「TSO 拉数子任务,仅执行下列命令」)。
98
+
99
+ ---
100
+
101
+ ## Playbook 编排(P5 / P6 / P7)
102
+
103
+ ### P6 · OKKI 周报
104
+
105
+ **必读**:`report-templates/okki-weekly-google-client.md`、`core/playbooks.md` P6。
106
+
107
+ 1. 主 Agent:确认账户与日期区间。
108
+ 2. **决策**:拉数阶段若日志长 → Bash/Task + `handoff-p6-okki.md` §拉数;否则主会话执行模板 §拉数命令。
109
+ 3. **决策**:写 xlsx 阶段 → Task handoff(只读 `snapDir`,先 outline 后 JSON,见 `core/tips.md`);或主会话若上下文充足。
110
+ 4. 主 Agent:合并交付话术 + 文件路径;金额与 ID 与 manifest 一致。
111
+
112
+ ### P5 · 多账户多维度
113
+
114
+ **必读**:`analytics/google-analysis-batch.md`、`core/playbooks.md` P5。
115
+
116
+ 1. 主 Agent:确认区间与 `--sections`。
117
+ 2. **batch 本身**:主会话或**单次** Bash 执行 `google-analysis-batch run`(全量省略 `-a`)或 `resume` — **禁止** per-account 子会话调 API。
118
+ 3. 处理 stdout `kind=siluzan-tso-batch-summary` 与退出码;401 → 登录后 `resume`。
119
+ 4. **可选**:账户数多且需分账户聚合 → 并行 Task,handoff 见 `handoff-p5-batch.md` §聚合,只读 `results/<accountId>/`。
120
+ 5. 主 Agent:汇总报告;跨账户禁止心算。
121
+
122
+ ### P7 · Google 询盘分析
123
+
124
+ **必读**:`report-templates/google-inquiry-analysis.md`、`core/playbooks.md` P7。
125
+
126
+ 1. 主 Agent:询盘资料落盘或流程 B 反问。
127
+ 2. **决策**:主 snap 拉数 + **并行** 3× Task 跑 `m1`/`m2`/`m3`(`handoff-p7-inquiry.md`),或主会话顺序执行若客户端不支持并行。
128
+ 3. **单实例**写 8 Sheet xlsx:主会话或一次 Task(读 `geo-continents.json` 运行时加载)。
129
+ 4. 主 Agent:交付;禁止扩展为 7 个月窗口。
130
+
131
+ ---
132
+
133
+ ## 客户端兼容说明
134
+
135
+ | 客户端 | 行为 |
136
+ | ------ | ---- |
137
+ | **Cursor** | 主 Agent 通过 Task 或内置 Bash/Explore 委派;不依赖 skill 包内 `agents/` |
138
+ | **无 subagent** | 忽略本节,全部在主会话完成,仍遵守 `--json-out` 与 outline 纪律 |
139
+ | **Claude Code 等** | 若有子 Agent API,同样遵循 handoff + returnSchema |
140
+
141
+ ---
142
+
143
+ ## 反模式
144
+
145
+ - 为每个 Playbook 建固定 `.cursor/agents/` 文件且与 skill 双源维护。
146
+ - 子会话内 `Read` 多份 MB 级 `keywords-*.json` 并把内容贴回父会话。
147
+ - 用多个子会话替代 `google-analysis-batch` 内置并发。
148
+ - 子会话代替主 Agent 向用户确认 `--commit` 写操作。
@@ -54,6 +54,16 @@
54
54
 
55
55
  ---
56
56
 
57
+ ## Subagent 编排(可选)
58
+
59
+ 主 Agent 先 Read `references/core/subagent-orchestration.md` § P7:
60
+
61
+ - **主 snap + 按月拉数**:可并行 3× Task(`snippets/handoff-p7-inquiry.md` 变体 m1/m2/m3),或主会话顺序执行。
62
+ - **8 Sheet xlsx**:主 Agent 或单 Task 收尾;子会话禁止扩展 7 个月窗口、禁止编造询盘数据。
63
+ - handoff 与 `returnSchema` 见 orchestration 文档。
64
+
65
+ ---
66
+
57
67
  ## 拉数(同一目录落盘)
58
68
 
59
69
  `./snap-inquiry` 为示例目录。设 `S` = 起始月 1 号、`E` = 分析月最后一天。
@@ -55,6 +55,19 @@ siluzan-tso google-analysis -a <mediaCustomerId> --start <S> --end <E> --json-ou
55
55
 
56
56
  ---
57
57
 
58
+ ## Subagent 编排(可选)
59
+
60
+ 宿主支持 Task / 子会话时,主 Agent 先 Read `references/core/subagent-orchestration.md` § P6,再决定是否委派:
61
+
62
+ | 阶段 | 建议 | handoff |
63
+ | ---- | ---- | ------- |
64
+ | 拉数(本节命令) | 主会话或 Bash/Task | `snippets/handoff-p6-okki.md` §阶段 A |
65
+ | 写 xlsx + 话术 | 主 Agent 或单 Task | 同文件 §阶段 B |
66
+
67
+ 子会话只回传 manifest/exitCode/产出路径;**禁止**把 JSON 全文贴回主对话。写操作确认仍由主 Agent 负责。
68
+
69
+ ---
70
+
58
71
  ## xlsx 版式规范
59
72
 
60
73
  工作簿 → Sheet 名(须完全一致)→ 版式。**不**单独建「广告系列」Sheet(系列表在 `账户报告` 内)。状态枚举若为英文须转中文。
@@ -9,7 +9,7 @@ $ErrorActionPreference = 'Stop'
9
9
  # -- Package info (injected at build time) ------------------------------------
10
10
  $PKG_NAME = 'siluzan-tso-cli'
11
11
  # PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
12
- $PKG_VERSION = '1.1.23-beta.2'
12
+ $PKG_VERSION = '1.1.24-beta.2'
13
13
  $CLI_BIN = 'siluzan-tso'
14
14
  $SKILL_LABEL = 'Siluzan TSO'
15
15
  $INSTALL_CMD = 'npm install -g siluzan-tso-cli@beta'
@@ -9,7 +9,7 @@ set -euo pipefail
9
9
  # -- Package info (injected at build time) ------------------------------------
10
10
  readonly PKG_NAME="siluzan-tso-cli"
11
11
  # PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
12
- readonly PKG_VERSION="1.1.23-beta.2"
12
+ readonly PKG_VERSION="1.1.24-beta.2"
13
13
  readonly CLI_BIN="siluzan-tso"
14
14
  readonly SKILL_LABEL="Siluzan TSO"
15
15
  readonly INSTALL_CMD="npm install -g siluzan-tso-cli@beta"
@@ -0,0 +1,45 @@
1
+ # Handoff · P5 多账户 batch(供 Task / Bash 子会话)
2
+
3
+ ## 阶段 A · batch 执行(通常由主会话或单次 Bash 完成,非 per-account)
4
+
5
+ 主 Agent **应**在主会话或**一次** Bash 子会话执行,不要用多个子会话替代 CLI 并发:
6
+
7
+ ```bash
8
+ # 全量:省略 -a
9
+ siluzan-tso google-analysis-batch run \
10
+ --start <S> --end <D> \
11
+ --sections campaigns,geographic,keywords \
12
+ --account-concurrency 4 --section-concurrency 6 \
13
+ --min-spend 1 --keyword-limit 1000 \
14
+ --json-out ./snap-p5
15
+
16
+ # 中断后续跑(禁止重新 run)
17
+ siluzan-tso google-analysis-batch resume --json-out ./snap-p5 --run-id <runId>
18
+ ```
19
+
20
+ **forbidden**: 先 `list-accounts` 再拼全量 ID 到 `-a`;禁止子会话对每个账户单独 `google-analysis`。
21
+
22
+ **returnSchema**: stdout 单行 JSON 摘要、`runId`、exitCode;勿贴 `results/` 下全文 JSON。
23
+
24
+ ---
25
+
26
+ ## 阶段 B · 按账户聚合(可选,可并行多个 Task)
27
+
28
+ **前提**: batch 已成功或部分成功(exitCode 0 或 2),路径已知:
29
+
30
+ `snapDir`: `./snap-p5`
31
+ `runId`: `<runId>`
32
+ `accountId`: `<单个 mediaCustomerId>`
33
+
34
+ **forbidden**:
35
+
36
+ - 禁止 `google-analysis-batch run` 重新跑
37
+ - 禁止 Read 整文件 JSON 进回复;脚本读盘
38
+
39
+ **任务**:
40
+
41
+ 1. 只处理 `{snapDir}/{runId}/results/{accountId}/` 下文件。
42
+ 2. 先读各 `*.outline.txt`,再脚本读 `*.json` 聚合。
43
+ 3. 产出该账户报告片段或中间 CSV/JSON(路径回传)。
44
+
45
+ **returnSchema**: 产出路径 + 该账户汇总摘要(数字须可追溯至 JSON 路径)。
@@ -0,0 +1,51 @@
1
+ # Handoff · P6 OKKI 周报(供 Task / Bash 子会话)
2
+
3
+ > 主 Agent 派发前已确认 `mediaCustomerId`、`--start`、`--end`。将下列占位符替换为实值。
4
+
5
+ ## 角色
6
+
7
+ 你是 siluzan-tso **拉数**子任务(或 **写 xlsx** 子任务,见阶段)。只执行指定命令或脚本,不向用户对话。
8
+
9
+ ## 阶段 A · 拉数(委派本阶段时使用)
10
+
11
+ **snapDir**: `./snap-okki`(或主 Agent 指定路径)
12
+
13
+ **forbidden**:
14
+
15
+ - 禁止在回复中粘贴完整 JSON 内容
16
+ - 禁止编造 mediaCustomerId
17
+ - 禁止写 xlsx、禁止写操作类 CLI
18
+
19
+ **commands**(在同一 snapDir 依次执行):
20
+
21
+ ```bash
22
+ mkdir -p ./snap-okki
23
+
24
+ siluzan-tso list-accounts -m Google -k <mediaCustomerId> --json-out ./snap-okki
25
+
26
+ siluzan-tso stats -m Google -a <mediaCustomerId> --start <S> --end <E> --json-out ./snap-okki
27
+
28
+ siluzan-tso balance -m Google -a <mediaCustomerId> --json-out ./snap-okki
29
+
30
+ siluzan-tso google-analysis -a <mediaCustomerId> --start <S> --end <E> --json-out ./snap-okki \
31
+ --sections overview,campaigns,keywords,search-terms,campaign-device,campaign-geo-matched
32
+ ```
33
+
34
+ **returnSchema**: 仅回传 exitCode、manifestFile、writtenFiles、outlineFiles、stderrTail、summary(无编造数字)。
35
+
36
+ ## 阶段 B · 写 xlsx(委派本阶段时使用)
37
+
38
+ **snapDir**: 同上(拉数已完成)
39
+
40
+ **forbidden**:
41
+
42
+ - 禁止在脚本中写死业务数字;数值只来自落盘 JSON
43
+ - 禁止跳过 outline;先读 `*.outline.txt` 再读 JSON
44
+
45
+ **任务**:
46
+
47
+ 1. Read `report-templates/okki-weekly-google-client.md` 中 xlsx 版式(若子会话可 Read skill 内路径)。
48
+ 2. 编写并执行 Node/Python 脚本,产出 `.xlsx` + 客户话术。
49
+ 3. 设备/国家 Sheet 必须用 `campaign-device` / `campaign-geo-matched` 落盘文件。
50
+
51
+ **returnSchema**: 产出文件路径列表 + 脚本 exitCode;勿贴 xlsx 二进制内容。
@@ -0,0 +1,43 @@
1
+ # Handoff · P7 Google 询盘分析(供 Task / Bash 子会话)
2
+
3
+ > 主 Agent 已确认 3 个月窗口与 `mediaCustomerId`。询盘数据已在 `./snap-inquiry/inquiries.json`(流程 A/B 完成后)。
4
+
5
+ ## 变体 · 主 snap 拉数(单次)
6
+
7
+ **snapDir**: `./snap-inquiry`
8
+
9
+ ```bash
10
+ siluzan-tso list-accounts -m Google -k <mediaCustomerId> --json-out ./snap-inquiry
11
+ siluzan-tso google-analysis -a <mediaCustomerId> \
12
+ --start <S> --end <D> \
13
+ --sections campaigns,keywords,search-terms,campaign-geo \
14
+ --json-out ./snap-inquiry
15
+ ```
16
+
17
+ **forbidden**: 禁止编造询盘行;禁止 7 个月窗口。
18
+
19
+ **returnSchema**: exitCode、writtenFiles、outlineFiles、stderrTail、summary。
20
+
21
+ ---
22
+
23
+ ## 变体 · 月度 m1 / m2 / m3(可并行 3 个子会话)
24
+
25
+ | 子任务 | snapDir | 命令 |
26
+ | ------ | ------- | ---- |
27
+ | m1 | `./snap-inquiry/m1` | `google-analysis -a <id> --start <M1S> --end <M1E> --sections campaigns,geographic --json-out ./snap-inquiry/m1` |
28
+ | m2 | `./snap-inquiry/m2` | 同上,M2 日期 |
29
+ | m3 | `./snap-inquiry/m3` | 同上,M3 日期 |
30
+
31
+ **forbidden**: 禁止用 `daily-metrics` 填 Sheet 4 上区;禁止主会话 Read 全量 JSON。
32
+
33
+ **returnSchema**: 各目录 manifest + exitCode。
34
+
35
+ ---
36
+
37
+ ## 变体 · 写 8 Sheet xlsx(单次,主 Agent 或一个 Task)
38
+
39
+ **snapDir**: `./snap-inquiry`(含 m1/m2/m3 子目录)
40
+
41
+ **任务**: 读 `report-templates/google-inquiry-analysis.md` 版式;脚本读 JSON + `references/analytics/geo-continents.json`;产出 xlsx。
42
+
43
+ **returnSchema**: xlsx 路径 + exitCode;勿贴表内全部单元格。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-tso-cli",
3
- "version": "1.1.23-beta.2",
3
+ "version": "1.1.24-beta.2",
4
4
  "description": "Siluzan 广告账户管理 CLI — 查询账户、余额、消耗数据,管理绑定关系与充值。",
5
5
  "keywords": [
6
6
  "ad-account",