@thinkingai/ae-cli 1.0.24 → 1.0.27

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 (54) hide show
  1. package/README.md +17 -2
  2. package/README.zh.md +18 -2
  3. package/dist/{auth-4OPL4YWG.js → auth-TXFJHPXU.js} +3 -2
  4. package/dist/{auth-PBPAZQWP.js → auth-W2JZ3DKA.js} +7 -5
  5. package/dist/{chunk-OVHL4JAC.js → chunk-2NGWYMLB.js} +5 -3
  6. package/dist/chunk-6T7245YE.js +478 -0
  7. package/dist/{chunk-JJCRURTR.js → chunk-B4UL2VIJ.js} +1 -1
  8. package/dist/{chunk-DC66L5AM.js → chunk-BI5ZVD6T.js} +17 -90
  9. package/dist/chunk-MNHE6SSI.js +79 -0
  10. package/dist/chunk-MWWYGZ76.js +130 -0
  11. package/dist/{chunk-47MTN54I.js → chunk-SRRUNQIM.js} +29 -2
  12. package/dist/chunk-TG64AQV4.js +262 -0
  13. package/dist/{chunk-MZW6NOVS.js → chunk-VT6VC4PA.js} +9 -3
  14. package/dist/{client-TDH6MUWM.js → client-IU2E5IOL.js} +6 -3
  15. package/dist/{config-5ELRYAIH.js → config-WH3R3IRY.js} +3 -2
  16. package/dist/index.js +45 -17
  17. package/dist/model-CC7U5XOJ.js +131 -0
  18. package/dist/{raw-EM7AP3RT.js → raw-TUHZQ4UB.js} +5 -4
  19. package/dist/sync-EVEDS7YE.js +383 -0
  20. package/dist/te-agent-FLTDYV3L.js +522 -0
  21. package/dist/{te-analysis-3KFSNUCJ.js → te-analysis-CMXADIJM.js} +81 -11
  22. package/dist/{te-audience-GMYJFCSC.js → te-audience-LPZFFSXM.js} +4 -3
  23. package/dist/{te-common-YLERCMQI.js → te-common-BXQFKTB3.js} +4 -3
  24. package/dist/{te-community-PYDN5A6B.js → te-community-K5S3VOZY.js} +4 -3
  25. package/dist/{te-dataops-ETWS5O3X.js → te-dataops-567IMCQG.js} +4 -3
  26. package/dist/{te-engage-ROJVZHDA.js → te-engage-TBUTGW5F.js} +105 -49
  27. package/dist/{te-kb-VUNS2CC7.js → te-kb-XHVBWP5E.js} +225 -29
  28. package/dist/{te-meta-3EFWLM3A.js → te-meta-NQ4U3VJW.js} +4 -3
  29. package/dist/te-team-556APRIU.js +529 -0
  30. package/package.json +5 -1
  31. package/skills/ae-agent/SKILL.md +133 -0
  32. package/skills/ae-analysis/references/drilldown_user_events.md +1 -1
  33. package/skills/ae-analysis/references/drilldown_users.md +2 -2
  34. package/skills/ae-analysis/references/query_adhoc.md +3 -2
  35. package/skills/ae-analysis/references/query_entity_details.md +1 -1
  36. package/skills/ae-engage/SKILL.md +25 -2
  37. package/skills/ae-engage/references/build-task-save-guide.md +283 -0
  38. package/skills/ae-engage/references/save-task.md +304 -0
  39. package/skills/ae-kb/SKILL.md +283 -0
  40. package/skills/ae-team/SKILL.md +164 -0
  41. package/skills/ae-team/references/ai-generate.md +39 -0
  42. package/skills/ae-team/references/create.md +94 -0
  43. package/skills/ae-team/references/delete.md +39 -0
  44. package/skills/ae-team/references/list-projects.md +45 -0
  45. package/skills/ae-team/references/list-templates.md +38 -0
  46. package/skills/ae-team/references/list.md +39 -0
  47. package/skills/ae-team/references/run-artifacts.md +51 -0
  48. package/skills/ae-team/references/run-cancel.md +38 -0
  49. package/skills/ae-team/references/run-chat.md +57 -0
  50. package/skills/ae-team/references/run-reply.md +41 -0
  51. package/skills/ae-team/references/run-result.md +75 -0
  52. package/skills/ae-team/references/run-start.md +73 -0
  53. package/skills/ae-team/references/run-watch.md +82 -0
  54. package/skills/ae-team/references/update.md +47 -0
@@ -55,14 +55,14 @@ ae-cli analysis +drilldown_users --dry-run
55
55
  | `--include_total` | No | Whether to query users from the total row. Default: false |
56
56
  | `--relation_val` | No | Relation value used in relation analysis scenarios |
57
57
  | `--use_cache` | No | Whether to use cache. Default: true |
58
- | `--limit` | No | Optional limit. Default: 20, maximum: 50. |
58
+ | `--limit` | No | Optional limit. Default: 1000, maximum: 100000. |
59
59
  | `--offset` | No | Optional offset. Default: 0. |
60
60
  | `--timeout_minutes` | No | Query timeout in minutes. If the query exceeds this time, it will be cancelled automatically. |
61
61
 
62
62
  ## Decision Rules
63
63
  - Drilldown positioning parameters must come from upstream analysis results and must not be fabricated.
64
64
  - `qp` must not be rewritten or "simplified"; it should remain consistent with the source analysis.
65
- - For pagination, use `--limit` and `--offset` together. Default limit is 20.
65
+ - For pagination, use `--limit` and `--offset` together. Default limit is 1000, maximum 100000.
66
66
  - For the first run, it is recommended to pass only the required parameters (`--project_id`, `--model_type`, `--qp`) and add optional parameters after confirming the chain works.
67
67
  - Wrap JSON parameters in single quotes (for example `--qp '{}'`, `--drilldown_groups '{}'`) to avoid shell escaping issues.
68
68
  - When dates/time ranges are involved, validate with a short range first and then expand gradually.
@@ -95,7 +95,7 @@ ae-cli analysis +query_adhoc --project_id <project_id> --model_type <model_type>
95
95
  | `--is_sort_by_columns` | No | Whether to sort query results by columns. Default: false |
96
96
  | `--resolve_recent_day` | No | Whether to resolve relative time expressions such as "last 7 days". If omitted, service auto-resolves when `qp.eventView.recentDay` exists and `startTime`/`endTime` is incomplete; otherwise defaults to false. |
97
97
  | `--fields` | No | Optional fields to return. Must match column names in result. Invalid fields cause INVALID_FIELDS error. |
98
- | `--limit` | No | Optional limit. Default: 20, maximum: 50. |
98
+ | `--limit` | No | Optional limit. Default: 1000, maximum: 100000. |
99
99
  | `--offset` | No | Optional offset. Default: 0. |
100
100
  | `--timeout_minutes` | No | Query timeout in minutes. If the query exceeds this time, it will be cancelled automatically. |
101
101
 
@@ -103,7 +103,8 @@ ae-cli analysis +query_adhoc --project_id <project_id> --model_type <model_type>
103
103
  - On the first run, start with only the required parameters (`--project_id`,`--model_type`,`--qp`), and add optional parameters after confirming the path works.
104
104
  - Do not call this command with placeholder QP such as `{}`. For builder-supported models, wait for builder `status=generated`; for non-builder models, build QP from verified schema/metadata first.
105
105
  - For builder-supported models, do not run metadata/schema lookup to "help" the builder. The builder is the metadata resolver.
106
- - For pagination, use `--limit` and `--offset` together. Default limit is 20.
106
+ - For pagination, use `--limit` and `--offset` together. Default limit is 1000, maximum 100000.
107
+ - For `model_type=sql`, use exactly one row limit: either put `LIMIT` in the SQL, or use `--limit`. If both are present they must be equal — `query_adhoc` rejects mismatched values to avoid silently sampled or duplicated results. When the SQL already has a trailing `LIMIT`, you may omit `--limit` and the SQL governs.
107
108
  - Use `--fields` to select specific columns for lighter response payloads.
108
109
  - `event`, `retention`, `funnel`, and `prop_analysis` must not manually craft QP with schema-first flow; call the builder and use the returned `qp`.
109
110
  - For non-builder models, `qp` must satisfy both schema structure and project metadata constraints.
@@ -39,7 +39,7 @@ ae-cli analysis +query_entity_details --dry-run
39
39
  | `--properties` | No | Optional display properties JSON, for example `[{"columnName":"#user_id","tableType":"0"},{"columnName":"device_id","tableType":"0"}]`. If provided, property names should come from `analysis_meta +list_properties` in the same `project_id`. |
40
40
  | `--sort_by` | No | Optional sort field |
41
41
  | `--sort_order` | No | Optional sort order. Supported values: asc and desc |
42
- | `--limit` | No | Optional result limit. Default: 20, maximum: 50 |
42
+ | `--limit` | No | Optional result limit. Default: 1000, maximum: 100000 |
43
43
  | `--zone_offset` | No | Time zone offset. For example, UTC+8 is 8 |
44
44
  | `--use_cache` | No | Whether to use cache. Default: true |
45
45
 
@@ -79,6 +79,12 @@ ae-cli engage +config_channel_list --project_id 1
79
79
  # Query the task list
80
80
  ae-cli engage +task_list --project_id 1 --req '{"pageNum":1,"pageSize":20}'
81
81
 
82
+ # Build a save_task guide before composing the final req
83
+ ae-cli engage +build_task_save_guide --project_id 1 --req '{"context":{"triggerType":2,"channelId":"channel_123"}}'
84
+
85
+ # Save a task draft (create when req.taskId is omitted)
86
+ ae-cli engage +save_task --project_id 1 --req '{"baseInfo":{"taskName":"Demo Task"},"channelConfig":{"channelType":1,"channelId":"channel_123","groupContentList":[{"contentList":[{"pushLanguageCode":"default","content":"[]"}]}]},"targetConfig":{"targetClusterType":3},"triggerConfig":{"triggerType":2},"controlConfig":{"completionIndicatorDef":{"completionIndicators":[]}}}'
87
+
82
88
  # Query task details
83
89
  ae-cli engage +task_detail --project_id 1 --task_id task_123
84
90
 
@@ -182,6 +188,8 @@ For more detailed generation rules, consult these references first:
182
188
  ```bash
183
189
  ae-cli --dry-run engage +channel_list --project_id 1
184
190
  ae-cli --dry-run engage +task_list --project_id 1 --req '{"pageNum":1,"pageSize":20}'
191
+ ae-cli --dry-run engage +build_task_save_guide --project_id 1 --req '{}'
192
+ ae-cli --dry-run engage +save_task --project_id 1 --req '{"baseInfo":{"taskName":"Demo Task"},"channelConfig":{"channelType":1,"channelId":"channel_123","groupContentList":[{"contentList":[{"pushLanguageCode":"default","content":"[]"}]}]},"targetConfig":{"targetClusterType":3},"triggerConfig":{"triggerType":2},"controlConfig":{"completionIndicatorDef":{"completionIndicators":[]}}}'
185
193
  ae-cli --dry-run engage +flow_list --project_id 1
186
194
  ```
187
195
 
@@ -190,6 +198,8 @@ ae-cli --dry-run engage +flow_list --project_id 1
190
198
  More detailed single-command guidance is available in the business-oriented `references/` directory:
191
199
 
192
200
  - `references/channel-list.md`
201
+ - `references/build-task-save-guide.md`
202
+ - `references/save-task.md`
193
203
  - `references/task-list.md`
194
204
  - `references/config-item-list.md`
195
205
  - `references/flow-list.md`
@@ -204,7 +214,7 @@ This split documentation structure is easier to extend later, because commands w
204
214
 
205
215
  ### task
206
216
 
207
- `+task_data_overview`, `+task_data_detail`, `+task_metric_detail`, `+task_experiment_report`, `+task_detail`, `+task_list`, `+task_stats`, `+manage_task`
217
+ `+task_data_overview`, `+task_data_detail`, `+task_metric_detail`, `+task_experiment_report`, `+task_detail`, `+task_list`, `+task_stats`, `+build_task_save_guide`, `+save_task`, `+manage_task`
208
218
 
209
219
  ### config
210
220
 
@@ -225,4 +235,17 @@ The following commands are write operations. Confirm that the user intent is exp
225
235
  - Channels and config channels: `+add_channel`, `+delete_channel`, `+update_channel_status`, `+delete_config_channel`, `+update_config_channel_status`
226
236
  - Strategies and config items: `+delete_config_item`, `+copy_config_template`, `+manage_strategy`
227
237
  - Flows: `+save_flow`, `+modify_flow_base_info`, `+manage_flow`, `+delete_flow`
228
- - Tasks: `+manage_task`
238
+ - Tasks: `+save_task`, `+manage_task`
239
+
240
+ For task draft creation or update, use this workflow:
241
+
242
+ 1. `ae-cli engage +channel_list --project_id <projectId>`
243
+ 2. `ae-cli engage +build_task_save_guide --project_id <projectId> --req '{...}'`
244
+ 3. If the guide says QP-derived fields are needed, call `ae-cli analysis_audience +get_cluster_definition_schema --cluster_type condition`
245
+ 4. `ae-cli engage +save_task --project_id <projectId> --req '{...}'`
246
+
247
+ `+build_task_save_guide` is a read-only helper. It returns scenario-specific required fields, channel content schema, unsupported combinations, examples, and a handoff template for `save_task`.
248
+
249
+ `+save_task` only saves a draft. It does not submit approval, does not start sending, and does not trigger task execution. If `req.taskId` is omitted it creates a new draft; if `req.taskId` is present it updates an existing draft. Update mode only supports draft tasks, and omitted fields can inherit from the existing draft before validation.
250
+
251
+ The audience schema query `ae-cli analysis_audience +get_cluster_definition_schema --cluster_type condition` is not a fixed preflight step. Call it only when the guide indicates that you must construct `targetConfig.qp`, `triggerConfig.triggerRule`, `clientConfig.clientQp`, or `completionIndicatorDef.event`.
@@ -0,0 +1,283 @@
1
+ # ae-engage `+build_task_save_guide`
2
+
3
+ Build a scenario-specific guide for constructing `save_task.req`.
4
+
5
+ Mapped command: `ae-cli engage +build_task_save_guide`
6
+
7
+ This is a read-only helper. It does not save tasks, submit approvals, or trigger execution. Its job is to tell you how to build a valid `save_task` request for the current scenario.
8
+
9
+ ---
10
+
11
+ ## 1. Recommended Workflow
12
+
13
+ Use this sequence when creating or updating a task draft:
14
+
15
+ 1. Query channels with `ae-cli engage +channel_list --project_id <projectId>`.
16
+ 2. Call `ae-cli engage +build_task_save_guide --project_id <projectId> --req '{...}'`.
17
+ 3. If the guide says QP-derived fields are required, call:
18
+
19
+ ```bash
20
+ ae-cli analysis_audience +get_cluster_definition_schema --cluster_type condition
21
+ ```
22
+
23
+ 4. Build the final grouped `save_task.req`.
24
+ 5. Submit with `ae-cli engage +save_task --project_id <projectId> --req '{...}'`.
25
+
26
+ Important:
27
+
28
+ - Do not treat the audience schema query as a fixed preflight step.
29
+ - Call it only when the guide indicates that you need to construct:
30
+ - `targetConfig.qp`
31
+ - `triggerConfig.triggerRule`
32
+ - `clientConfig.clientQp`
33
+ - `completionIndicatorDef.event`
34
+
35
+ ---
36
+
37
+ ## 2. CLI Shape
38
+
39
+ The CLI call shape is:
40
+
41
+ ```bash
42
+ ae-cli engage +build_task_save_guide --project_id <projectId> --req '<req-json>'
43
+ ```
44
+
45
+ This CLI requires `--req`, but `{}` is valid when you want a generic guide without scenario context.
46
+
47
+ Common request patterns:
48
+
49
+ ```bash
50
+ ae-cli engage +build_task_save_guide --project_id 1 --req '{}'
51
+ ae-cli engage +build_task_save_guide --project_id 1 --req '{"context":{"triggerType":2,"channelId":"channel_123"}}'
52
+ ae-cli engage +build_task_save_guide --project_id 1 --req '{"draft":{"baseInfo":{"taskName":"Demo Task"}}}'
53
+ ```
54
+
55
+ Supported request fields:
56
+
57
+ - `context`
58
+ - a lightweight scenario selector
59
+ - use it when you know key dimensions such as trigger type, audience type, channel, or experiment mode
60
+ - `draft`
61
+ - a partial `save_task` request
62
+ - use it when you already have part of the final payload and want missing fields, examples, or corrections
63
+ - `reqDraft`
64
+ - alias of `draft`
65
+ - `detailLevel`
66
+ - `brief`: core requirements only
67
+ - `full`: includes enums, unsupported cases, examples, and self-check information
68
+
69
+ ---
70
+
71
+ ## 3. `context` and `draft`
72
+
73
+ ### 3.1 `context`
74
+
75
+ Use `context` when you want scenario-specific guidance without writing a partial `save_task.req`.
76
+
77
+ Typical fields:
78
+
79
+ - `triggerType`
80
+ - `targetClusterType`
81
+ - `channelType`
82
+ - `channelId`
83
+ - `channelTemplateId`
84
+ - `enableExp`
85
+ - `expIndicatorBizType`
86
+
87
+ Example:
88
+
89
+ ```json
90
+ {
91
+ "context": {
92
+ "triggerType": 2,
93
+ "targetClusterType": 2,
94
+ "channelId": "channel_123"
95
+ }
96
+ }
97
+ ```
98
+
99
+ ### 3.2 `draft`
100
+
101
+ Use `draft` when you already have a partial `save_task.req` and want the guide to tell you:
102
+
103
+ - what is still missing
104
+ - what is invalid
105
+ - whether the payload is already close to submit-ready
106
+ - what template or schema to use to finish it
107
+
108
+ Example:
109
+
110
+ ```json
111
+ {
112
+ "draft": {
113
+ "baseInfo": {
114
+ "taskName": "Demo Task"
115
+ },
116
+ "triggerConfig": {
117
+ "triggerType": 2
118
+ }
119
+ }
120
+ }
121
+ ```
122
+
123
+ ---
124
+
125
+ ## 4. Output Structure
126
+
127
+ The guide returns structured metadata rather than free-form prose. The top-level sections are:
128
+
129
+ - `valid`
130
+ - `errors`
131
+ - `warnings`
132
+ - `missingInputs`
133
+ - `saveTaskContract`
134
+ - `scenario`
135
+ - `requiredInput`
136
+ - `fieldRules`
137
+ - `handoff`
138
+
139
+ ### 4.1 `valid`
140
+
141
+ - `true` means the current scenario or draft has no structural blocking errors
142
+ - `false` means you should inspect `errors`, `missingInputs`, and `handoff.blockingPlaceholders`
143
+
144
+ ### 4.2 `errors`
145
+
146
+ Use `errors` for hard blockers such as:
147
+
148
+ - invalid enum values
149
+ - unsupported combinations
150
+ - unsupported trigger types
151
+
152
+ The guide may expose invalid values separately so you can correct them instead of silently dropping them.
153
+
154
+ ### 4.3 `warnings`
155
+
156
+ Use `warnings` for non-fatal guidance, for example:
157
+
158
+ - channel content schema is unavailable because no `channelId` was provided
159
+ - click-rate experiment setup still needs a channel context
160
+
161
+ ### 4.4 `missingInputs`
162
+
163
+ Use `missingInputs` as the to-do list for fields you still need before you can submit `save_task`.
164
+
165
+ Typical examples:
166
+
167
+ - missing `baseInfo.taskName`
168
+ - missing `channelConfig.channelId`
169
+ - missing `channelConfig.groupContentList`
170
+ - missing `triggerConfig.triggerTime` for scheduled single tasks
171
+
172
+ ### 4.5 `saveTaskContract`
173
+
174
+ This section describes the high-level contract:
175
+
176
+ - final tool is `save_task`
177
+ - required preflight is `query_channel_list -> build_task_save_guide`
178
+ - QP-derived fields may require `ae-cli analysis_audience +get_cluster_definition_schema --cluster_type condition`
179
+ - `save_task.req` must be a grouped JSON object
180
+
181
+ ### 4.6 `scenario`
182
+
183
+ This section shows the resolved scenario, such as:
184
+
185
+ - create vs update draft
186
+ - trigger type
187
+ - audience type
188
+ - channel type / channel id
189
+ - whether the scenario is unsupported
190
+
191
+ ### 4.7 `requiredInput`
192
+
193
+ This section tells you which grouped blocks and fields are required in the current scenario.
194
+
195
+ Use it to understand what must appear in:
196
+
197
+ - `baseInfo`
198
+ - `channelConfig`
199
+ - `targetConfig`
200
+ - `triggerConfig`
201
+ - `controlConfig`
202
+ - `expConfig` when experiment mode is enabled
203
+
204
+ ### 4.8 `fieldRules`
205
+
206
+ This is the most important construction section.
207
+
208
+ It includes:
209
+
210
+ - grouped block rules
211
+ - structured conditional rules
212
+ - related-parameter rules
213
+ - unsupported fields / values / combinations
214
+ - `channelContentSchema`
215
+ - enum values and wrong examples when `detailLevel=full`
216
+
217
+ #### `fieldRules.channelContentSchema`
218
+
219
+ Treat this as the source of truth for channel content construction.
220
+
221
+ Use it to get:
222
+
223
+ - valid keys
224
+ - expected item shape
225
+ - channel-specific examples
226
+ - params that must be copied exactly, such as `paramType`
227
+
228
+ Do not invent free-form content items such as:
229
+
230
+ ```json
231
+ [{"text":"hello"}]
232
+ ```
233
+
234
+ Instead, use the valid item structure and put message text into `value`.
235
+
236
+ ### 4.9 `handoff`
237
+
238
+ This is the final section before `save_task`.
239
+
240
+ Important fields:
241
+
242
+ - `reqTemplate`
243
+ - a scenario-aware grouped request template
244
+ - use it as a starting point, not as unquestioned final truth
245
+ - `readyToSubmit`
246
+ - `true` means the current scenario or draft has no blocking placeholders
247
+ - `blockingPlaceholders`
248
+ - unresolved placeholders that still block submission
249
+ - `selfCheckList`
250
+ - a final checklist before calling `save_task`
251
+ - `successUrlRule`
252
+ - after `save_task` succeeds, build the task detail URL from current page origin plus the relative hash
253
+ - do not hardcode host, IP, or port
254
+
255
+ ---
256
+
257
+ ## 5. How to Use the Guide in Practice
258
+
259
+ Recommended usage pattern:
260
+
261
+ 1. resolve a real `channelId` with `+channel_list`
262
+ 2. call `+build_task_save_guide`
263
+ 3. read `fieldRules.channelContentSchema`
264
+ 4. read `handoff.reqTemplate`
265
+ 5. fix everything in `blockingPlaceholders`
266
+ 6. if the guide points to QP-derived fields, call:
267
+
268
+ ```bash
269
+ ae-cli analysis_audience +get_cluster_definition_schema --cluster_type condition
270
+ ```
271
+
272
+ 7. fill those fields using the real condition schema
273
+ 8. call `+save_task`
274
+
275
+ ---
276
+
277
+ ## 6. Safety Notes
278
+
279
+ - `+build_task_save_guide` is read-only; it does not save a draft
280
+ - do not skip the guide and build `save_task.req` from memory alone
281
+ - do not treat the audience schema query as mandatory for every task
282
+ - do not invent `channelId`, `clusterKey`, content keys, or QP structures
283
+ - if the guide exposes an unsupported scenario, correct it before calling `save_task`
@@ -0,0 +1,304 @@
1
+ # ae-engage `+save_task`
2
+
3
+ Create or update a Hermes task draft.
4
+
5
+ Mapped command: `ae-cli engage +save_task`
6
+
7
+ This command is the final write step. Do not use it as the first step in task construction.
8
+
9
+ Recommended workflow:
10
+
11
+ 1. `ae-cli engage +channel_list --project_id <projectId>`
12
+ 2. `ae-cli engage +build_task_save_guide --project_id <projectId> --req '{...}'`
13
+ 3. If the guide indicates QP-derived fields are needed, call:
14
+
15
+ ```bash
16
+ ae-cli analysis_audience +get_cluster_definition_schema --cluster_type condition
17
+ ```
18
+
19
+ 4. Build the final grouped `req`
20
+ 5. `ae-cli engage +save_task --project_id <projectId> --req '{...}'`
21
+
22
+ The audience schema query is not a fixed preflight step. Call it only when the guide indicates that you must construct:
23
+
24
+ - `targetConfig.qp`
25
+ - `triggerConfig.triggerRule`
26
+ - `clientConfig.clientQp`
27
+ - `completionIndicatorDef.event`
28
+
29
+ For the full guide contract, request format, return sections, and handoff usage, read:
30
+
31
+ - `references/build-task-save-guide.md`
32
+
33
+ ---
34
+
35
+ ## 1. General Principles
36
+
37
+ `+save_task` accepts only the final grouped draft-save payload that Hermes can validate and persist.
38
+
39
+ The command supports two modes:
40
+
41
+ - create mode: omit `req.taskId`
42
+ - update mode: include `req.taskId` for an existing draft task
43
+
44
+ Regardless of mode, this tool only saves a draft:
45
+
46
+ - it does not submit approval
47
+ - it does not start sending
48
+ - it does not register or start trigger execution
49
+
50
+ The CLI call shape is:
51
+
52
+ ```bash
53
+ ae-cli engage +save_task --project_id <projectId> --req '<req-json>'
54
+ ```
55
+
56
+ Notes:
57
+
58
+ - `projectId` is injected into top-level `req` by the CLI
59
+ - if the caller also passes `req.projectId`, the outer `--project_id` wins
60
+ - the whole `req` must be a JSON object, not a stringified JSON string
61
+ - for update mode, Hermes only allows modifying draft tasks
62
+ - in update mode, omitted fields are backfilled from the existing draft before validation, so partial draft updates are allowed
63
+
64
+ ---
65
+
66
+ ## 2. Required Workflow
67
+
68
+ ### 2.1 Query Real Channels First
69
+
70
+ Run:
71
+
72
+ ```bash
73
+ ae-cli engage +channel_list --project_id <projectId>
74
+ ```
75
+
76
+ Purpose:
77
+
78
+ - get the real project channel list
79
+ - resolve the real `channelId`
80
+ - confirm the final `channelType`
81
+
82
+ Never invent a `channelId`.
83
+
84
+ ### 2.2 Build the Scenario Guide
85
+
86
+ Run:
87
+
88
+ ```bash
89
+ ae-cli engage +build_task_save_guide --project_id <projectId> --req '{...}'
90
+ ```
91
+
92
+ Use the guide to determine:
93
+
94
+ - required grouped blocks
95
+ - required fields for the current trigger and audience mode
96
+ - unsupported combinations
97
+ - correct content schema
98
+ - current handoff template
99
+ - whether the current payload is already close to submit-ready
100
+
101
+ ### 2.3 Query Audience Condition Schema Only When Needed
102
+
103
+ If the guide indicates that QP-derived fields are needed, run:
104
+
105
+ ```bash
106
+ ae-cli analysis_audience +get_cluster_definition_schema --cluster_type condition
107
+ ```
108
+
109
+ Use the returned schema to build:
110
+
111
+ - `targetConfig.qp`
112
+ - `triggerConfig.triggerRule`
113
+ - `clientConfig.clientQp`
114
+ - `completionIndicatorDef.event`
115
+
116
+ Do not call this command by default for every task. It is conditional, not mandatory.
117
+
118
+ ### 2.4 Build Final `req` and Save
119
+
120
+ Only after the above steps should you construct the final grouped `req` and submit it with `+save_task`.
121
+
122
+ ---
123
+
124
+ ## 3. Final `req` Shape
125
+
126
+ The final object passed to `--req` should have this grouped shape:
127
+
128
+ ```json
129
+ {
130
+ "taskId": "<string, optional>",
131
+ "baseInfo": {},
132
+ "channelConfig": {},
133
+ "targetConfig": {},
134
+ "triggerConfig": {},
135
+ "controlConfig": {},
136
+ "expConfig": {},
137
+ "activityConfig": {},
138
+ "clientConfig": {}
139
+ }
140
+ ```
141
+
142
+ Top-level notes:
143
+
144
+ - `taskId` is used only in update mode
145
+ - `baseInfo` / `channelConfig` / `targetConfig` / `triggerConfig` / `controlConfig` are the main blocks
146
+ - optional blocks should usually be omitted rather than filled with invented values
147
+ - use `build_task_save_guide` output as the source of truth for the current scenario
148
+
149
+ ---
150
+
151
+ ## 4. How To Build Major Blocks
152
+
153
+ ### 4.1 `taskId`
154
+
155
+ Use `taskId` only when you are updating an existing draft task.
156
+
157
+ - create mode: omit `taskId`
158
+ - update mode: include `taskId`
159
+ - update mode can send only the fields that need changing
160
+ - update mode still fails if the referenced task is not in draft status
161
+
162
+ ### 4.2 `channelConfig`
163
+
164
+ Core fields:
165
+
166
+ - `channelType`
167
+ - `channelId`
168
+ - `groupContentList`
169
+ - optional `channelTemplateId`
170
+
171
+ Rules:
172
+
173
+ - derive `channelType` and `channelId` from real channel metadata
174
+ - do not guess template IDs
175
+ - `groupContentList` maximum size is `5`
176
+ - `occasionKeys` are parsed from content automatically and are not accepted as input
177
+
178
+ Content guidance:
179
+
180
+ - do not invent channel-specific payload structures from memory
181
+ - use `fieldRules.channelContentSchema` from `build_task_save_guide`
182
+ - take valid keys, expected item shape, and examples from the guide
183
+ - when schema fields include `paramType`, copy it exactly
184
+ - do not use free-form content items such as `{"text":"..."}` as the primary pattern
185
+
186
+ ### 4.3 `targetConfig`
187
+
188
+ Use the guide to decide which audience shape applies:
189
+
190
+ - `targetClusterType=1`: custom audience, requires `qp`
191
+ - `targetClusterType=2`: existing cluster, requires `clusterKey`
192
+ - `targetClusterType=3`: all users, forbids both `qp` and `clusterKey`
193
+
194
+ If `qp` is required, construct it from:
195
+
196
+ ```bash
197
+ ae-cli analysis_audience +get_cluster_definition_schema --cluster_type condition
198
+ ```
199
+
200
+ ### 4.4 `triggerConfig`
201
+
202
+ Use the guide to determine the current trigger rule set:
203
+
204
+ - `triggerType=0`: requires `triggerTime`
205
+ - `triggerType=1`: requires `startDate`, `endDate`, `triggerCrontab`
206
+ - `triggerType=2`: manual, no `triggerRule`
207
+ - `triggerType=3/4/5`: requires `triggerRule`
208
+
209
+ Rules:
210
+
211
+ - `triggerType=6` is not supported
212
+ - use the guide for cron format and wrong-example checks
213
+ - if `triggerRule` is needed, build it from:
214
+
215
+ ```bash
216
+ ae-cli analysis_audience +get_cluster_definition_schema --cluster_type condition
217
+ ```
218
+
219
+ ### 4.5 `controlConfig`
220
+
221
+ Minimum required field:
222
+
223
+ - `completionIndicatorDef`
224
+
225
+ When the guide points to event-based completion or experiment-driven main-goal rules, use:
226
+
227
+ ```bash
228
+ ae-cli analysis_audience +get_cluster_definition_schema --cluster_type condition
229
+ ```
230
+
231
+ to build `completionIndicatorDef.event`.
232
+
233
+ Important constraints that still apply:
234
+
235
+ - `doNotDisturb.enableDoNotDisturb=true` requires `startTime` and `endTime` in `HH:mm`
236
+ - `pushDelay.enablePushDelay=true` requires valid `delayType`, and its dependent fields must match the selected mode
237
+ - `pushDelay.delayType=1` is only valid for `client_push`
238
+ - `pushDelay.delayUnit` must stay within `week`, `day`, `hour`, `minute`, `second`
239
+ - `timeoutControl.enableTimeoutControl=true` requires valid `time` and `unit`
240
+ - `timeoutControl.unit` must stay within `day`, `hour`, `minute`
241
+
242
+ ### 4.6 `clientConfig`
243
+
244
+ Use this block only when client-side conditions are needed.
245
+
246
+ If `clientConfig.clientQp` is required, build it from:
247
+
248
+ ```bash
249
+ ae-cli analysis_audience +get_cluster_definition_schema --cluster_type condition
250
+ ```
251
+
252
+ Only call that schema query when the guide explicitly shows that the field is needed.
253
+
254
+ ---
255
+
256
+ ## 5. Final Self-Check Before `+save_task`
257
+
258
+ Before submission, verify:
259
+
260
+ 1. `channelId` comes from a real channel query.
261
+ 2. `build_task_save_guide` has already been called for the current scenario or partial draft.
262
+ 3. `fieldRules.channelContentSchema` was used as the source of truth for content structure.
263
+ 4. Any required QP-derived fields were built from `ae-cli analysis_audience +get_cluster_definition_schema --cluster_type condition`.
264
+ 5. `targetClusterType` matches the presence or absence of `clusterKey` / `qp`.
265
+ 6. `triggerType` matches the provided scheduling or event fields.
266
+ 7. `completionIndicatorDef` is present and structurally valid for the current scenario.
267
+ 8. `taskId` is omitted for create mode and present only for updating a draft.
268
+ 9. No unsupported `triggerType=6` is used.
269
+ 10. No placeholder IDs or fabricated resource names remain in the request.
270
+
271
+ ---
272
+
273
+ ## 6. Standard Example Flow
274
+
275
+ Use this style of workflow, rather than jumping directly to `+save_task`:
276
+
277
+ ```bash
278
+ ae-cli engage +channel_list --project_id 1
279
+ ae-cli engage +build_task_save_guide --project_id 1 --req '{"context":{"triggerType":2,"channelId":"channel_123"}}'
280
+ ae-cli engage +save_task --project_id 1 --req '{...final grouped req...}'
281
+ ```
282
+
283
+ If the guide indicates QP-derived fields are needed, insert:
284
+
285
+ ```bash
286
+ ae-cli analysis_audience +get_cluster_definition_schema --cluster_type condition
287
+ ```
288
+
289
+ before building the final `req`.
290
+
291
+ ---
292
+
293
+ ## 7. Safety Constraints
294
+
295
+ This command is a write operation.
296
+
297
+ - Do not treat `save_task` as “submit and launch task”
298
+ - Do not bypass `build_task_save_guide`
299
+ - Do not pass the whole `req` as a JSON string
300
+ - Do not use `triggerType=6`
301
+ - Do not invent `channelId`, `clusterKey`, audience definitions, or content keys
302
+ - Do not use `taskId` for a non-draft task
303
+ - Do not pass `occasionKeys`; Hermes derives them from content
304
+ - Do not call the audience schema query as a reflex; call it only when guide output says QP-derived fields are needed