@thinkingai/ae-cli 6.1.18 → 6.1.19

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 (96) hide show
  1. package/README.md +2 -0
  2. package/README.zh.md +6 -0
  3. package/dist/{auth-ROB2EDYV.js → auth-QPEVVBKT.js} +13 -7
  4. package/dist/auth-UMJAA72O.js +15 -0
  5. package/dist/{capability-DKMYUTLC.js → capability-ASI62I4A.js} +11 -10
  6. package/dist/{chunk-UW5UN47B.js → chunk-533JK3YX.js} +2 -0
  7. package/dist/{chunk-4XXOWOTA.js → chunk-6QK7SYYY.js} +5 -4
  8. package/dist/{chunk-TUKQZTMI.js → chunk-7K24F7T2.js} +2 -0
  9. package/dist/{chunk-OO6XR6LK.js → chunk-AMBFK2K3.js} +2 -0
  10. package/dist/{sync-HKIOZXQE.js → chunk-B5HMQAOM.js} +31 -540
  11. package/dist/{chunk-Y3LOALAV.js → chunk-DKEXH6Q5.js} +4 -3
  12. package/dist/{chunk-VTWMIC5L.js → chunk-E2JKXMVO.js} +2 -0
  13. package/dist/{chunk-JHENBQ5B.js → chunk-FR2EDAQM.js} +1 -0
  14. package/dist/{chunk-ZQ47LWTI.js → chunk-GJXRF7Y6.js} +6 -5
  15. package/dist/{chunk-DWO43OIB.js → chunk-JQ3ENZZH.js} +2 -0
  16. package/dist/chunk-JYMGHGCE.js +191 -0
  17. package/dist/{chunk-BYYS3ANB.js → chunk-KEWVSO64.js} +5 -4
  18. package/dist/{chunk-3FY3RJ26.js → chunk-KZ6ZHF5J.js} +2 -1
  19. package/dist/{chunk-ZQKDZXDO.js → chunk-O6K2ODUE.js} +3 -2
  20. package/dist/chunk-QL6R6TSK.js +25215 -0
  21. package/dist/{chunk-J2DEBMRF.js → chunk-RWXIXOZG.js} +22 -9
  22. package/dist/{chunk-QZ3AS4KK.js → chunk-S5PONFBM.js} +5 -4
  23. package/dist/{chunk-4NN5IWVN.js → chunk-T6OSFQZD.js} +2 -0
  24. package/dist/{chunk-3KWQYGYI.js → chunk-TKHSULJT.js} +2 -0
  25. package/dist/{chunk-6EIJSNBD.js → chunk-Y74WTIKJ.js} +2 -0
  26. package/dist/{client-L2YDMHQ6.js → client-N7NGZUNI.js} +4 -3
  27. package/dist/{community-report-client-C7WDGET3.js → community-report-client-6OL6GBQW.js} +3 -2
  28. package/dist/{config-BMYZX2UE.js → config-XNMACCKX.js} +8 -7
  29. package/dist/{data-integration-QEKDWQDY.js → data-integration-4NZGZ45E.js} +913 -92
  30. package/dist/index.js +38 -36
  31. package/dist/{local-data-upload-client-4YYHSYD6.js → local-data-upload-client-EFHDLXFG.js} +3 -2
  32. package/dist/{memory-I2WXDTV2.js → memory-HBJQ2GC5.js} +8 -7
  33. package/dist/{metadata-I4C2EWUN.js → metadata-62EWBEIG.js} +12 -11
  34. package/dist/{model-HLHIEFMU.js → model-BHLJ2QMT.js} +10 -9
  35. package/dist/{personal-semantic-preference-LIPACBDX.js → personal-semantic-preference-JBVMAI7L.js} +11 -10
  36. package/dist/{project-semantic-RT3R2VQD.js → project-semantic-BQ4MPUS5.js} +12 -11
  37. package/dist/sync-MUWPRM5I.js +522 -0
  38. package/dist/{te-agent-BR6VDBNX.js → te-agent-WQZTMEK4.js} +10 -9
  39. package/dist/{te-analysis-7VUNUYWZ.js → te-analysis-MNCG65LU.js} +107 -20
  40. package/dist/{te-community-5DMNKJWY.js → te-community-BNE6KREL.js} +8 -7
  41. package/dist/{te-dataops-6P5IKWNJ.js → te-dataops-TXLKM2W6.js} +467 -67
  42. package/dist/{te-engage-KZPR5R22.js → te-engage-TPKLRVTL.js} +84 -10
  43. package/dist/{te-experiment-6BITX4RD.js → te-experiment-6BYKTCY7.js} +85 -12
  44. package/dist/{te-kb-RCLSSH2Q.js → te-kb-BUD6N3NI.js} +311 -24
  45. package/dist/{te-system-FXITO2JG.js → te-system-44LZJDTQ.js} +573 -37
  46. package/dist/{te-team-ADOC2ROP.js → te-team-XMP47YXE.js} +10 -7
  47. package/dist/{update-YCYCKJOO.js → update-UODFOZ4P.js} +7 -6
  48. package/package.json +18 -9
  49. package/skills/ae-analysis/references/analysis_gateway_assets.md +1 -1
  50. package/skills/ae-analysis/references/audience_models.md +18 -0
  51. package/skills/ae-analysis/references/command_index.md +2 -2
  52. package/skills/ae-analysis/references/project_timezone_update.md +13 -4
  53. package/skills/ae-analysis/references/property_create.md +2 -0
  54. package/skills/ae-analysis/references/super_metadata_batch_create.md +2 -0
  55. package/skills/ae-analysis/references/user_cluster_models.md +2 -0
  56. package/skills/ae-analysis/references/user_cluster_update.md +8 -4
  57. package/skills/ae-analysis/references/user_tag_create.md +7 -1
  58. package/skills/ae-analysis/references/user_tag_models.md +8 -2
  59. package/skills/ae-data-integration/SKILL.md +1 -0
  60. package/skills/ae-data-integration/references/error-handling.md +54 -1
  61. package/skills/ae-data-integration/references/source-inspect.md +18 -2
  62. package/skills/ae-data-integration/references/transform.md +3 -1
  63. package/skills/ae-data-integration/references/ue-routing.md +23 -0
  64. package/skills/ae-dataops/SKILL.md +11 -1
  65. package/skills/ae-dataops/references/dataops-backfill.md +135 -0
  66. package/skills/ae-engage/SKILL.md +5 -0
  67. package/skills/ae-engage/references/build-task-save-guide.md +5 -1
  68. package/skills/ae-engage/references/save-flow.md +37 -1
  69. package/skills/ae-engage/references/save-task.md +6 -0
  70. package/skills/ae-experiment/SKILL.md +6 -2
  71. package/skills/ae-experiment/references/save_metric.md +20 -8
  72. package/skills/ae-kb/SKILL.md +120 -9
  73. package/skills/ae-system/SKILL.md +28 -30
  74. package/skills/ae-system/references/channel-management.md +303 -0
  75. package/dist/auth-GBMV6TEJ.js +0 -14
  76. package/dist/capability-HYVVPG25.js +0 -352
  77. package/dist/chunk-EFH4XWYC.js +0 -556
  78. package/dist/chunk-JRJY5DMJ.js +0 -71
  79. package/dist/chunk-OMPRXM3V.js +0 -349
  80. package/dist/chunk-QNOLN2LJ.js +0 -509
  81. package/dist/chunk-RJDU7NYP.js +0 -1198
  82. package/dist/chunk-RNAALWJK.js +0 -98
  83. package/dist/chunk-SERWF6G5.js +0 -13
  84. package/dist/memory-3ORCR7JH.js +0 -893
  85. package/dist/metadata-VUOQJE26.js +0 -339
  86. package/dist/model-UGRDX4MW.js +0 -139
  87. package/dist/personal-semantic-preference-OEISBRHM.js +0 -239
  88. package/dist/project-semantic-FFPWFPIW.js +0 -1114
  89. package/dist/sync-TFHU2UTG.js +0 -10261
  90. package/dist/te-agent-VLYOV7S4.js +0 -3894
  91. package/dist/te-analysis-4YGQL5RC.js +0 -9357
  92. package/dist/te-community-ISDQWJU7.js +0 -1859
  93. package/dist/te-dataops-CVULXNVB.js +0 -2209
  94. package/dist/te-engage-N5WI32H6.js +0 -4898
  95. package/dist/te-experiment-UVR4HLND.js +0 -988
  96. package/dist/te-system-K2GYMCTB.js +0 -2213
@@ -20,6 +20,7 @@ The AE Data Development and Operations domain provides capabilities for data war
20
20
  | `dataops_flow` | Flow creation, node deletion, and orchestration | `dataops-flow-create` |
21
21
  | `dataops_flow` | Flow execution and monitoring | `dataops-flow-monitor` |
22
22
  | `dataops_operations` | Operations instance search, details, and task logs | `dataops-flow-monitor` |
23
+ | `dataops_operations` | Backfill job creation, full draft update, deletion, execution, plans, stop, and rerun | `dataops-backfill` |
23
24
  | `dataops_ide` | Data exploration and SQL queries | `dataops-query` |
24
25
  | `dataops_integration` | Datasource and data integration | `dataops-integration` |
25
26
 
@@ -63,6 +64,7 @@ You must understand the following key concepts before use, otherwise errors are
63
64
  |----|--------|-------------|
64
65
  | **executeId** | Returned by `dataops_flow +execute_flow` | Early stop handle before the scheduler `flowInstanceId` is available |
65
66
  | **flowInstanceId** | Returned by `dataops_operations +search_flow_instances` | Operations perspective instance inspection and stop |
67
+ | **jobId** | Returned by `dataops_operations +create_backfill_job` or `+search_backfill_jobs` | Persistent backfill job detail and lifecycle actions |
66
68
 
67
69
  ### Environment and Defaults
68
70
 
@@ -73,6 +75,8 @@ You must understand the following key concepts before use, otherwise errors are
73
75
  | `dataops_operations +get_flow_instance_detail` | Instance detail | Inspect one instance DAG and task statuses |
74
76
  | `dataops_operations +get_task_instance_detail` | Task detail/logs | Inspect one task and include logs only when needed |
75
77
  | `dataops_operations +stop_flow_instance` | Instance stop | Stop by exactly one of `executeId` or `flowInstanceId` |
78
+ | `dataops_operations +list_backfill_flows` | Backfill source discovery | Returns eligible PROD flows and whether ST is required |
79
+ | `dataops_operations +search_backfill_jobs` | Backfill job search | Filter persistent jobs and obtain `jobId` |
76
80
 
77
81
  ### Schema Naming Rules
78
82
 
@@ -92,6 +96,8 @@ You must understand the following key concepts before use, otherwise errors are
92
96
  Create DEV Flow → Create/Update DEV SQL, Integration, Workflow Instance Check, or Task Instance Check Tasks → Configure Dependencies/Schedule → Preview Release → Release to PROD → PROD Manual Execution / Operations Troubleshooting
93
97
  ```
94
98
 
99
+ Backfill lifecycle: Discover eligible PROD flow → Create or fully update DRAFT job → Run explicitly → Search / inspect plans → Stop or rerun the complete job; delete only after target inspection
100
+
95
101
  ### CRON Format (6 fields)
96
102
 
97
103
  `second minute hour day month weekday` — Note: one more "second" field than standard 5-field format.
@@ -115,6 +121,7 @@ Choose the appropriate scenario skill based on user intent to get complete step-
115
121
  | Create flow, add or delete nodes, configure schedule, release | `dataops-flow-create` | create flow, new workflow, configure schedule, add task node, delete task node, release, cron, scheduled execution |
116
122
  | View execution status, troubleshoot failures, view logs | `dataops-flow-monitor` | execute flow, running instance, monitor, logs, stop, DAG, troubleshoot |
117
123
  | Search operation instances across a space | `dataops-flow-monitor` | operations instance, flow instance search, status statistics, owner statistics |
124
+ | Create or operate a persistent multi-date backfill job | `dataops-backfill` | backfill, fill historical data, base date range, backfill plans, stop backfill, rerun backfill |
118
125
  | Create datasource, configure sync solution, execute sync | `dataops-integration` | datasource, sync, integration, field mapping, data ingestion, MySQL, ClickHouse, DatabricksJdbc |
119
126
  | Browse metadata, search tables, execute SQL queries | `dataops-query` | query, SQL, data exploration, search tables, view table structure, IDE, catalog, select |
120
127
  | Create tables and views | `dataops-table` | create table, table creation, view, data dictionary, table details, DDL |
@@ -155,13 +162,16 @@ Flow orchestration is divided into two scenario skills: **creation and configura
155
162
 
156
163
  **Lifecycle: DEV configuration and preview → Release to PROD → PROD manual execution and operations troubleshooting**
157
164
 
158
- Detailed creation/configuration commands live in [`references/dataops-flow-create.md`](references/dataops-flow-create.md). Detailed execution, monitoring, operation instance, task log, and stop commands live in [`references/dataops-flow-monitor.md`](references/dataops-flow-monitor.md).
165
+ Detailed creation/configuration commands live in [`references/dataops-flow-create.md`](references/dataops-flow-create.md). Detailed execution, monitoring, operation instance, task log, and stop commands live in [`references/dataops-flow-monitor.md`](references/dataops-flow-monitor.md). Persistent multi-date backfill jobs live in [`references/dataops-backfill.md`](references/dataops-backfill.md).
159
166
 
160
167
  Key constraints:
161
168
  - Create and update tasks in DEV, preview/release before PROD execution.
162
169
  - Treat `+delete_task` as high-risk: verify the target with `+get_flow_overview`, preview with `--dry-run`, and use `--yes` only after explicit user confirmation. Deletion affects DEV; release the flow to apply it to PROD.
163
170
  - `+execute_flow` always runs PROD; it returns `executeId` for early stop.
164
171
  - Prefer `flowInstanceId` from operations search for stable inspection and troubleshooting.
172
+ - A backfill job is persistent and batches multiple base dates; do not emulate it by looping `+execute_flow`.
173
+ - Create and run backfill jobs as separate steps. `+rerun_backfill_job` reruns the complete job, not only failed plans.
174
+ - `+update_backfill_job` replaces a DRAFT job's complete configuration; inspect the job first and do not treat it as a partial patch. Treat `+delete_backfill_job` as high-risk and preview it with `--dry-run` before confirmation.
165
175
  - Reference workspace parameters in task SQL as `${paramKey}`.
166
176
 
167
177
  ---
@@ -0,0 +1,135 @@
1
+ ---
2
+ name: dataops-backfill
3
+ version: 1.0.0
4
+ description: "Backfill job lifecycle: discover eligible PROD flows, create or update drafts, delete jobs, run jobs, inspect plans, stop running jobs, and rerun complete jobs."
5
+ metadata:
6
+ requires:
7
+ bins: ["ae-cli"]
8
+ ---
9
+
10
+ # DataOps Backfill Jobs
11
+
12
+ > **Prerequisites:** Read [`ae-dataops/SKILL.md`](../SKILL.md) for authentication, output, and safety rules.
13
+
14
+ A backfill job is a persistent operations object that runs one PROD task flow for multiple base dates. It is not a single manual flow execution and is not a retry of an existing failed flow instance.
15
+
16
+ ## Lifecycle
17
+
18
+ ### 1. Discover an eligible PROD flow
19
+
20
+ ```bash
21
+ ae-cli dataops_operations +list_backfill_flows --spaceCode "${spaceCode}"
22
+ ```
23
+
24
+ Use only a returned flow whose `completeDataInfo.canRun` is true. When `completeDataInfo.hasSt` is true, pass `--stTime` while creating the job.
25
+
26
+ ### 2. Create a draft
27
+
28
+ Always pass the backfill date range. For manual selection, also pass `--completeDates`; every selected date must be inside that inclusive range.
29
+
30
+ ```bash
31
+ # Range mode
32
+ ae-cli dataops_operations +create_backfill_job --spaceCode "${spaceCode}" \
33
+ --jobName "August backfill" --flowCode ${flowCode} \
34
+ --startDate "2026-08-01" --endDate "2026-08-07"
35
+
36
+ # Custom-date mode
37
+ ae-cli dataops_operations +create_backfill_job --spaceCode "${spaceCode}" \
38
+ --jobName "Selected dates" --flowCode ${flowCode} \
39
+ --startDate "2026-08-01" --endDate "2026-08-07" \
40
+ --completeDates '["2026-08-01","2026-08-03"]'
41
+ ```
42
+
43
+ Creation returns a `DRAFT` job and does not run it. Defaults are `jobType=TASK_ALL`, `failureStrategy=END`, `parallel=true`, `reverse=false`, `step=1`, and `unit=DAY`. For `TASK_ONLY`, `TASK_PRE`, or `TASK_POST`, also pass `--startNode`.
44
+
45
+ ### 3. Update a draft when needed
46
+
47
+ Update is a complete replacement, not a partial patch. Inspect the DRAFT job first, then pass `--jobId`, `--jobName`, `--flowCode`, and the complete date and strategy configuration just as for creation. Updating does not run the job.
48
+
49
+ ```bash
50
+ ae-cli dataops_operations +update_backfill_job --spaceCode "${spaceCode}" \
51
+ --jobId ${jobId} --jobName "Revised August backfill" --flowCode ${flowCode} \
52
+ --startDate "2026-08-01" --endDate "2026-08-10" \
53
+ --failureStrategy END --parallel true --reverse false
54
+ ```
55
+
56
+ ### 4. Run the draft explicitly
57
+
58
+ ```bash
59
+ ae-cli dataops_operations +run_backfill_job --spaceCode "${spaceCode}" \
60
+ --jobId ${jobId}
61
+ ```
62
+
63
+ ### 5. Search jobs and inspect plans
64
+
65
+ ```bash
66
+ ae-cli dataops_operations +search_backfill_jobs --spaceCode "${spaceCode}" \
67
+ --status "RUNNING,FAIL,SUCCESS" --pageNum 1 --pageSize 20
68
+
69
+ ae-cli dataops_operations +get_backfill_job_detail --spaceCode "${spaceCode}" \
70
+ --jobId ${jobId}
71
+ ```
72
+
73
+ Detail returns the job and its plans together. A draft has an empty plan list.
74
+
75
+ ### 6. Stop, rerun, or delete
76
+
77
+ Stopping affects every unfinished plan in the running job. Inspect the job, preview the request, obtain explicit confirmation, and then pass `--yes`.
78
+
79
+ ```bash
80
+ ae-cli dataops_operations +stop_backfill_job --spaceCode "${spaceCode}" \
81
+ --jobId ${jobId} --dry-run
82
+ # After explicit confirmation, execute the same target; the CLI prompts before dispatch.
83
+ ae-cli dataops_operations +stop_backfill_job --spaceCode "${spaceCode}" \
84
+ --jobId ${jobId}
85
+ ```
86
+
87
+ Rerun applies to every plan only when the job is `FAIL` or `STOP`. A `SUCCESS` job cannot be rerun. Rerun reuses the same job and does not create a new backfill job. The CLI does not support rerunning only failed plans.
88
+
89
+ ```bash
90
+ ae-cli dataops_operations +rerun_backfill_job --spaceCode "${spaceCode}" \
91
+ --jobId ${jobId} --dry-run
92
+ ae-cli dataops_operations +rerun_backfill_job --spaceCode "${spaceCode}" \
93
+ --jobId ${jobId}
94
+ ```
95
+
96
+ Deletion is high-risk. The server accepts only supported `DRAFT`, `FAIL`, or `SUCCESS` jobs. Inspect the exact target and preview the scoped request before confirmation; the CLI sends only `spaceCode` and `jobId` and does not pre-query or guess state.
97
+
98
+ ```bash
99
+ ae-cli dataops_operations +delete_backfill_job --spaceCode "${spaceCode}" \
100
+ --jobId ${jobId} --dry-run
101
+ ae-cli dataops_operations +delete_backfill_job --spaceCode "${spaceCode}" \
102
+ --jobId ${jobId}
103
+ ```
104
+
105
+ ## Command Reference
106
+
107
+ | Command | Purpose | Flags |
108
+ |---|---|---|
109
+ | `+list_backfill_flows` | List eligible PROD flows | `--spaceCode` |
110
+ | `+create_backfill_job` | Create a draft | `--spaceCode` `--jobName` `--flowCode` `--startDate` `--endDate`; optional in-range `--completeDates`, scope, failure, parallel, order, and ST flags |
111
+ | `+update_backfill_job` | Replace a DRAFT job's complete configuration | `--spaceCode` `--jobId` `--jobName` `--flowCode` and the same complete configuration as create |
112
+ | `+delete_backfill_job` | Delete a supported job | `--spaceCode` `--jobId`; high-risk, requires confirmation or `--yes` |
113
+ | `+run_backfill_job` | Run a draft | `--spaceCode` `--jobId` |
114
+ | `+search_backfill_jobs` | Search jobs | `--spaceCode` plus optional keyword, date, type, status, owner, sort, and paging filters |
115
+ | `+get_backfill_job_detail` | Get job and plans | `--spaceCode` `--jobId` |
116
+ | `+stop_backfill_job` | Stop a running job | `--spaceCode` `--jobId`; high-risk, requires confirmation or `--yes` |
117
+ | `+rerun_backfill_job` | Rerun the complete job | `--spaceCode` `--jobId` |
118
+
119
+ Statuses are `DRAFT`, `RUNNING`, `STOP`, `FAIL`, `SUCCESS`, and `READY_STOP`. Range units are `DAY`, `WEEK`, and `MONTH`. Custom dates must be a non-empty JSON array of unique `yyyy-MM-dd` strings inside the configured date range.
120
+
121
+ ## Transport Status
122
+
123
+ Transition status: transitional
124
+
125
+ Owning module: Gaia operations
126
+
127
+ Current transport: DataOps CLI REST
128
+
129
+ Covered tools: `operations_list_backfill_flows`, `operations_create_backfill_job`, `operations_update_backfill_job`, `operations_delete_backfill_job`, `operations_run_backfill_job`, `operations_search_backfill_jobs`, `operations_get_backfill_job_detail`, `operations_stop_backfill_job`, and `operations_rerun_backfill_job`
130
+
131
+ Gateway target: TBD after the DataOps operations Capability Gateway schema review
132
+
133
+ Review after: 2026-11-20
134
+
135
+ Exit condition: Migrate these commands after Gaia exposes equivalent capabilities and the command contract tests pass against the Capability Gateway transport.
@@ -398,6 +398,8 @@ When the user wants to "create a flow / generate a flow canvas / save a flow", d
398
398
  3. Build condition-related nodes with semantic `targetDefinitionRequest` and
399
399
  `triggerDefinition` objects. Resolve real event and property names through Analysis metadata;
400
400
  do not create an intermediate cluster merely to obtain persisted QP.
401
+ For `ab_split_flow` indicators, use `indicatorsDef[].eventDefinition`; always provide the
402
+ aggregate `operator`/`value` and every event-property filter's `operator`/`values`.
401
403
 
402
404
  4. Before building touchpoint nodes such as `message_push`, `wechat_push`, or `webhook_push`, you must call:
403
405
 
@@ -585,6 +587,9 @@ For task draft creation or update, use this workflow:
585
587
  and every-completion events use count/eq/1. Completion target and experiment main-goal event
586
588
  filters must not use properties whose metadata `select_type` is `datetime`. Never construct
587
589
  persisted QP fields.
590
+ Select the audience by delivery side: server-side channels allow custom (`1`) or existing (`2`)
591
+ and reject all users (`3`); `client_push` (`channelType=3`) allows custom (`1`) or all users (`3`)
592
+ and rejects existing (`2`). Do not infer audience support from `triggerType` alone.
588
593
  4. `ae-cli engage-task task save --project-id <projectId> --req '{...}'`
589
594
  5. `ae-cli engage-task task submit-approval --project-id <projectId> --task-id <taskId>`
590
595
 
@@ -36,12 +36,16 @@ compounds when reusing `definition_request`; flattening them changes audience se
36
36
  For the second sequence step, omit `relative_to_first` or set it to `false`; use `true` only
37
37
  from the third step onward when its window must be measured from step 1.
38
38
 
39
- For existing-cluster audiences (`targetClusterType=2`), you may copy server-authored definitions via:
39
+ For server-side existing-cluster audiences (`targetClusterType=2`), you may copy server-authored definitions via:
40
40
 
41
41
  ```bash
42
42
  ae-cli analysis user-cluster get --project-id <projectId> --cluster-names '["<cluster_name>"]'
43
43
  ```
44
44
 
45
+ Server-side channels allow custom (`1`) or existing (`2`) audiences and reject all users (`3`).
46
+ `client_push` (`channelType=3`) allows custom (`1`) or all users (`3`) and rejects existing (`2`).
47
+ Always pass `channelType` in `context` so the guide can validate this matrix.
48
+
45
49
  4. Build the final grouped `save_task.req`.
46
50
  5. Submit with `ae-cli engage-task task save --project-id <projectId> --req '{...}'`.
47
51
 
@@ -305,9 +305,45 @@ Fallback branch keeps only `branchId` + `branchType: 2`.
305
305
  #### `ab_split_flow`
306
306
 
307
307
  ```json
308
- { "branchList": [ { "branchId": "<branchId>", "branchName": "Control Group", "branchType": 1, "order": 1, "percentageInExperiment": 34 }, { "branchId": "<branchId>", "branchName": "Experiment Group A", "branchType": 2, "order": 2, "percentageInExperiment": 33 } ], "indicatorsDef": [], "activateIndicatorsDef": null }
308
+ {
309
+ "branchList": [
310
+ { "branchId": "control", "branchName": "Control Group", "branchType": 1, "order": 1, "percentageInExperiment": 50 },
311
+ { "branchId": "experiment_a", "branchName": "Experiment Group A", "branchType": 2, "order": 2, "percentageInExperiment": 50 }
312
+ ],
313
+ "indicatorsDef": [
314
+ {
315
+ "indicatorsUuid": "metric_1",
316
+ "name": "Maximum payment amount",
317
+ "desc": "",
318
+ "completionIndicatorType": 0,
319
+ "touch_cycle_num": 1,
320
+ "touch_cycle_num_unit": "day",
321
+ "eventDefinition": {
322
+ "type": "event",
323
+ "event": "payment",
324
+ "aggregation": "max",
325
+ "property": "pay_amount",
326
+ "operator": "gt",
327
+ "value": 0,
328
+ "filters": {
329
+ "relation": "and",
330
+ "items": [
331
+ { "field": "gold", "operator": "gt", "values": [20] }
332
+ ]
333
+ }
334
+ }
335
+ }
336
+ ],
337
+ "activateIndicatorsDef": null
338
+ }
309
339
  ```
310
340
 
341
+ Use `eventDefinition` for new Capability requests. Its top-level `operator` compares the aggregate
342
+ result with `value`; each `filters.items[].operator` compares an event property with its `values`.
343
+ Both comparison levels are explicit and must not be omitted. Do not construct persisted fields such
344
+ as `event`, `taPropQuota`, `uceCalcuSymbol`, `num`, `filts`, or `calcuSymbol`; Hermes compiles them.
345
+ Legacy `event` remains accepted temporarily for older clients, but never send both fields.
346
+
311
347
  #### `event_judge`
312
348
 
313
349
  ```json
@@ -245,6 +245,12 @@ Use the guide to decide which audience shape applies:
245
245
  - `targetClusterType=2`: existing cluster, requires `clusterKey`
246
246
  - `targetClusterType=3`: all users, forbids `definitionRequest` and `clusterKey`
247
247
 
248
+ Audience availability depends on delivery side:
249
+
250
+ - Server-side channels support `targetClusterType=1` (custom) and `2` (existing), but not `3` (all users).
251
+ - `client_push` (`channelType=3`) supports `targetClusterType=1` (custom) and `3` (all users), but not `2` (existing).
252
+ - Determine the delivery side from the selected real channel; do not infer audience support from `triggerType` alone.
253
+
248
254
  For a custom audience, pass the semantic definition directly. Do not create an intermediate
249
255
  cluster or copy persisted QP.
250
256
 
@@ -33,10 +33,14 @@ Naming and response boundary:
33
33
  `targeting.definition_request`. Never generate or submit `targetConfig`.
34
34
  - Metric QP is semantic at the CLI boundary: write `metricDefinition`; read
35
35
  `metric_definition`. Never generate or submit `metricConfig`, `calcType`, or `Axxx` codes.
36
+ - Event-property comparisons belong in `metricDefinition.filters`, using
37
+ `{relation,items:[{field,operator,values}]}`. Never put comparison fields directly on
38
+ `metricDefinition`, and never submit raw `filts`, `calcuSymbol`, or `ftv` fields.
36
39
  - For metric aggregations `sum` / `avg` / `max` / `distinct_count`, `metricDefinition.property`
37
40
  is **required** and must be a concrete available event property from Analysis metadata.
38
41
  Never create property aggregations without `property` (for example `metric_avg_no_property_*`).
39
- - Event-count aggregations `total_count` / `user_count` / `active_days` omit `property`.
42
+ - Preset event aggregations `total_count` / `user_count` / `active_days` omit `property`.
43
+ - Experiment metric creation does not support `avg_per_user` / `A105`.
40
44
  - Resolve event and property names with Analysis metadata before saving semantic definitions.
41
45
  - Lists return `data.items` and `data.total`; detail commands return `data.item`.
42
46
  - Readiness returns `data.readiness`; reports return `data.report`; save guides return `data.guide`; save dry-run validation returns `data.validation`; writes return `data.result`.
@@ -72,7 +76,7 @@ If an experiment save returns `error_code: METRIC_NOT_FOUND`, list metrics for t
72
76
  ```bash
73
77
  ae-cli experiment experiment get --project-id 1 --exp-id exp_123
74
78
  ae-cli experiment experiment save --project-id 1 --req '{"expName":"Demo"}' --dry-run
75
- ae-cli experiment metric save --project-id 1 --req '{"metricId":"login_users","metricName":"Login users","createType":"event","goalDirection":"up","metricDesc":"Users who logged in","metricDefinition":{"type":"event","event":"login","aggregation":"user_count"}}' --dry-run
79
+ ae-cli experiment metric save --project-id 1 --req '{"metricId":"payment_gold_sum","metricName":"Payment gold sum","createType":"event","goalDirection":"up","metricDesc":"Gold sum for payments above 10","metricDefinition":{"type":"event","event":"payment","aggregation":"sum","property":"gold","filters":{"relation":"and","items":[{"field":"gold","operator":"gt","values":[10]}]}}}' --dry-run
76
80
  ae-cli experiment report metric-trend --project-id 1 --exp-id exp_123 --metric-id metric_1 --start-time 2026-07-01 --end-time 2026-07-07
77
81
  ```
78
82
 
@@ -21,9 +21,13 @@ See [`save_build_guide.md`](save_build_guide.md) / [`save_validate.md`](save_val
21
21
  - Supply metric QP as `req.metricDefinition`.
22
22
  - Never submit internal `metricConfig`, `calcType`, or an `Axxx` calculation code.
23
23
  - Experiment metrics currently accept event definitions only.
24
+ - Event-property comparisons belong in `metricDefinition.filters`. Each item uses
25
+ `field`, `operator`, and `values`; do not place `operator` or `value` directly on
26
+ `metricDefinition`.
24
27
  - Supported aggregations:
25
- - Event-count (no property): `total_count`, `user_count`, `active_days`
28
+ - Preset event metrics (omit `property`): `total_count`, `user_count`, `active_days`
26
29
  - Property-based (**`property` REQUIRED**): `sum`, `avg`, `max`, `distinct_count`
30
+ - `avg_per_user` (`A105`) is not supported for experiment metric creation.
27
31
 
28
32
  ### Property rule (mandatory)
29
33
 
@@ -38,6 +42,12 @@ When `aggregation` is `sum`, `avg`, `max`, or `distinct_count`:
38
42
 
39
43
  When `aggregation` is `total_count`, `user_count`, or `active_days`, omit `property`.
40
44
 
45
+ ### Preset event metric example (no property)
46
+
47
+ ```bash
48
+ ae-cli experiment metric save --project-id 1 --req '{"metricId":"payment_users","metricName":"Payment users","createType":"event","goalDirection":"up","metricDesc":"Users who triggered payment","metricDefinition":{"type":"event","event":"payment","aggregation":"user_count"}}'
49
+ ```
50
+
41
51
  ### Correct example (avg with property)
42
52
 
43
53
  ```bash
@@ -51,7 +61,11 @@ ae-cli experiment metric save --project-id 1 --req '{
51
61
  "type":"event",
52
62
  "event":"payment",
53
63
  "aggregation":"avg",
54
- "property":"amount"
64
+ "property":"amount",
65
+ "filters":{
66
+ "relation":"and",
67
+ "items":[{"field":"amount","operator":"gt","values":[10]}]
68
+ }
55
69
  }
56
70
  }'
57
71
  ```
@@ -69,11 +83,9 @@ ae-cli experiment metric save --project-id 1 --req '{
69
83
  }
70
84
  ```
71
85
 
72
- ### Event-count example (no property)
86
+ Filters use the semantic `filters` tree with `relation=and|or` and items containing
87
+ `field`, `operator`, and `values`. For the frontend example `gold > 10`, use:
73
88
 
74
- ```bash
75
- ae-cli experiment metric save --project-id 1 --req '{"metricId":"purchase_users","metricName":"Purchase users","createType":"event","goalDirection":"up","metricDesc":"Unique purchasers","metricDefinition":{"type":"event","event":"purchase","aggregation":"user_count"}}'
89
+ ```json
90
+ {"filters":{"relation":"and","items":[{"field":"gold","operator":"gt","values":[10]}]}}
76
91
  ```
77
-
78
- Filters use the semantic `filters` tree with `relation=and|or` and items containing
79
- `field`, `operator`, and `values`.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ae-kb
3
3
  version: 1.0.0
4
- description: "AE/TE knowledge base CLI manual for creating, querying, LLM-powered ask, listing accessible knowledge bases, deterministic index/grep/read retrieval, checking status, uploading, compiling, schema generation, URL sources, source deletion, and knowledge base deletion. Use when the user asks to manage TE/AE/ThinkingEngine knowledge bases, upload documents or URLs to a knowledge base, query knowledge, ask knowledge bases with an LLM, list accessible knowledge bases, inspect knowledge base indexes, search knowledge base pages, read a specific knowledge base page, check knowledge base status, generate schemas, compile knowledge, remove sources, or delete a knowledge base. To choose which knowledge base is worth searching, use the ae-kb-discovery skill first; this skill runs the retrieval once a target is chosen. Must use ae-cli kb commands and must not guess knowledge base names, scopes, page paths, source display names, JSON payload shapes, or URL formats."
4
+ description: 'AE/TE knowledge base CLI manual for creating, importing read-only compiled snapshots, querying, LLM-powered ask, listing accessible knowledge bases and their sources, deterministic index/grep/read retrieval, checking status, uploading, compiling, schema generation, URL sources, source deletion, and knowledge base deletion. Use when the user asks to manage TE/AE/ThinkingEngine knowledge bases, import a compiled Markdown ZIP snapshot, upload documents or URLs to a knowledge base, query knowledge, ask knowledge bases with an LLM, list accessible knowledge bases or source metadata, inspect knowledge base indexes, search knowledge base pages, read a specific knowledge base page, check knowledge base status, generate schemas, compile knowledge, remove sources, or delete a knowledge base. To choose which knowledge base is worth searching, use the ae-kb-discovery skill first; this skill runs the retrieval once a target is chosen. Must use ae-cli kb commands and must not guess knowledge base names, scopes, page paths, source IDs, source display names, JSON payload shapes, or URL formats.'
5
5
  ---
6
6
 
7
7
  # ae-kb
@@ -14,11 +14,11 @@ ae-cli kb +<command> [options]
14
14
 
15
15
  ## Global Rules
16
16
 
17
- - Use this skill for TE/AE knowledge base tasks: create, query, ask with LLM, list accessible knowledge bases, inspect indexes, grep pages, read pages, check status, upload sources, add URL sources, generate schema, compile, remove source files, and delete knowledge bases.
17
+ - Use this skill for TE/AE knowledge base tasks: create, import a compiled snapshot, query, ask with LLM, list accessible knowledge bases and their sources, inspect indexes, grep pages, read pages, check status, upload sources, add URL sources, generate schema, compile, remove source files, and delete knowledge bases.
18
18
  - **Searching a knowledge base for an answer is the most common task. If that is what you are doing, go straight to [Explore Knowledge Base Pages](#explore-knowledge-base-pages) and read [`references/query-workflow.md`](references/query-workflow.md) first — it is the retrieval procedure. The other commands below are for managing knowledge bases, not answering from them.**
19
19
  - Read operations can run directly after required inputs are known. Write operations require explicit user intent and normally keep the confirmation prompt unless the user asks to bypass it.
20
20
  - Prefer `--dry-run` before destructive or broad writes when the user has not already validated the target.
21
- - Do not invent knowledge base names, scopes, source display names, or JSON payloads. Ask the user or query known context when values are missing.
21
+ - Do not invent knowledge base names, scopes, source IDs, source display names, or JSON payloads. Ask the user or query known context when values are missing.
22
22
  - When building a `--sources` ref (or `+read --source`), copy the exact `scope` and `name` from `+list` output — run `ae-cli kb +list` first when the scope of a named knowledge base is unknown.
23
23
  - JSON flags must be valid JSON strings, usually wrapped in single quotes in shell commands.
24
24
  - Successful commands return JSON by default. Use `--format table` only when a table is easier for a human to scan. Envelope may include optional `_notice.host_compat`.
@@ -33,16 +33,19 @@ ae-cli kb +<command> [options]
33
33
  | `+ask` | read | LLM-powered Q&A over knowledge bases; for multi-page synthesis or multi-hop questions. |
34
34
  | `+ask-status` | read | Query the current status of an ask execution by `--execution-id` without polling. |
35
35
  | `+list` | read | List accessible knowledge bases filtered by buildStatus (default: compiled). |
36
+ | `+list-sources` | read | List source metadata for one knowledge base so exact source identifiers can be discovered safely. |
36
37
  | `+index` | read | List accessible knowledge bases and their `index.md` navigation maps. |
37
38
  | `+grep` | read | Keyword-search knowledge base pages and return matched lines with context. |
38
39
  | `+read` | read | Read a full knowledge base page, a line window, or (with `--outline`) only the page heading tree. |
39
40
  | `+new` | write | Create a new personal or company knowledge base. |
41
+ | `+import` | write | Import a compiled Markdown ZIP as a personal read-only snapshot. |
42
+ | `+import-status` | read | Query one snapshot import task by `--request-id` without polling. |
40
43
  | `+add` | write | Upload local files, a non-recursive directory, or HTTP(S) pages converted to markdown. |
41
44
  | `+url` | write | Upload a URL source directly with optional display name and parsing instruction. |
42
45
  | `+schema` | write | Generate the compile schema for a knowledge base. |
43
46
  | `+compile` | write | Compile a knowledge base in incremental or full mode. |
44
47
  | `+status` | read | Query the current status of a knowledge base. |
45
- | `+rm-source` | write | Delete one source file from a knowledge base by display name. |
48
+ | `+rm-source` | high-risk-write | Delete one source from a knowledge base by stable ID; exact display name is legacy compatibility only. |
46
49
  | `+remove` | write | Delete an entire knowledge base. |
47
50
 
48
51
  ## Common Workflows
@@ -67,6 +70,36 @@ Optional fields:
67
70
  - `--project-id`: optional project ID to bind.
68
71
  - `--project-name`: optional project display name.
69
72
 
73
+ ### Import a Compiled Snapshot
74
+
75
+ Use `+import` only for a ZIP whose root contains `index.md` and at least one
76
+ `wiki/**/*.md` page. The server validates all archive paths, limits, UTF-8 text, and Wiki links.
77
+
78
+ ```bash
79
+ ae-cli kb +import \
80
+ --file ./knowledge-base.zip \
81
+ --name "Imported handbook" \
82
+ --description "Compiled documentation snapshot" \
83
+ --tags '["docs","handbook"]'
84
+
85
+ # The submission returns requestId + queued. Query one snapshot later:
86
+ ae-cli kb +import-status --request-id <requestId>
87
+ ```
88
+
89
+ - The result is always a `personal` read-only snapshot; there is no `--scope`, `--force`, or replace option.
90
+ - Imported snapshots support list, Index/Wiki reading, grep/read, Ask, and deletion. They do not expose source, Schema, usage, compile, member, settings, ownership-transfer, or company-publish operations.
91
+ - The ZIP is limited to 50 MB and supports Markdown text only. Local images, attachments, other binaries, broken Wiki links, and ambiguous Wiki links are rejected by the server.
92
+ - Submission returns `{requestId, status: "queued"}` immediately. It does not wait for ZIP validation or publication.
93
+ - `+import-status` returns one of `queued`, `running`, `succeeded`, or `failed`; success includes `knowledgeBaseId`, and failure includes a stable error code/message.
94
+ - If a `requestId` was returned, query it before retrying. If no request ID was received, run `ae-cli kb +list` before retrying the same name. A repeated same-name import is rejected.
95
+
96
+ - Transition status: transitional
97
+ - Owning module: te-claude External Knowledge Base Import API
98
+ - Current transport: authenticated KB external REST through `kbUpload` for submission and `kbApi` for status lookup.
99
+ - Gateway target: TBD (`kb.snapshot.import` proposed)
100
+ - Review after: 2026-12-01
101
+ - Exit condition: migrate to a typed Gateway capability when the equivalent multipart import capability is available, or remove this command if dynamic Gateway execution provides the same file-handling and output contract.
102
+
70
103
  ### Upload Files or Directories
71
104
 
72
105
  Use `+add` when sources are local files, local directories, or pages that should be fetched and converted to markdown before upload.
@@ -107,7 +140,17 @@ Generate the schema first when the knowledge base needs a compile schema.
107
140
  ae-cli kb +schema --name engineering-handbook
108
141
  ```
109
142
 
110
- Use `--force` only to recover a stuck `generating` status. Use `--model` only when the user provides the model display name.
143
+ Use `--force` only when `+status` reports `schema_generating` and the user explicitly wants to replace the current generation attempt. The replacement may consume additional tokens. Use `--model` only when the user provides the model display name.
144
+
145
+ To add one-time guidance for this generation without changing stored knowledge base metadata, pass `--custom-instructions`. The server trims the value, treats whitespace-only input as absent, and accepts up to 10,000 Unicode characters. Do not include secrets or credentials.
146
+
147
+ ```bash
148
+ ae-cli kb +schema \
149
+ --name engineering-handbook \
150
+ --custom-instructions "Prioritize troubleshooting workflows and preserve command examples"
151
+ ```
152
+
153
+ Use `--dry-run` to inspect the request body before sending it. While generation is running, a request without `--force` is idempotent only when it supplies no new model or effective custom instructions; otherwise it fails with `KB_SCHEMA_GENERATION_IN_PROGRESS`. With `--force`, the selected model and custom instructions apply to the replacement attempt. Invalid text fails with `KB_SCHEMA_CUSTOM_INSTRUCTIONS_INVALID`.
111
154
 
112
155
  Compile after sources and schema are ready:
113
156
 
@@ -213,9 +256,34 @@ ae-cli kb +read \
213
256
  --limit 60
214
257
  ```
215
258
 
259
+ ### List Sources
260
+
261
+ List sources first to discover the stable identifier for the intended source:
262
+
263
+ ```bash
264
+ ae-cli kb +list-sources --name engineering-handbook
265
+ ```
266
+
267
+ Copy the exact `id` from the response into `+rm-source`. Do not guess a source ID from a local filename, URL, display name, or an older upload response.
268
+
269
+ - Transition status: transitional
270
+ - Owning module: te-claude External Knowledge Base Sources API
271
+ - Current transport: authenticated KB external REST through `kbApi`.
272
+ - Gateway target: TBD (`kb.source.list` proposed)
273
+ - Review after: 2026-12-03
274
+ - Exit condition: migrate to a typed Gateway capability when an equivalent source-list capability is available, or remove this command if dynamic Gateway execution provides the same discoverability and safe output contract.
275
+
216
276
  ### Remove One Source
217
277
 
218
- Use `+rm-source` only when the source display name is known exactly.
278
+ Use `+rm-source --id` with the exact ID returned by the current `+list-sources` response. This is a `high-risk-write`; keep the interactive confirmation unless the user has explicitly authorized `--yes`.
279
+
280
+ ```bash
281
+ ae-cli kb +rm-source \
282
+ --name engineering-handbook \
283
+ --id cm-source-id
284
+ ```
285
+
286
+ `--display-name` is retained for legacy compatibility only when a stable source ID is unavailable:
219
287
 
220
288
  ```bash
221
289
  ae-cli kb +rm-source \
@@ -223,7 +291,7 @@ ae-cli kb +rm-source \
223
291
  --display-name kb-1780046712-guide.md
224
292
  ```
225
293
 
226
- If the user only gives a loose source name, do not guess. Ask for the exact uploaded display name.
294
+ If the user only gives a loose source name, do not guess a source ID. Run `+list-sources`, identify the intended row from returned metadata, and ask only when multiple rows remain ambiguous.
227
295
 
228
296
  ### Delete a Knowledge Base
229
297
 
@@ -316,6 +384,30 @@ ae-cli kb +new --name "<name>" [--scope personal|company] [--description "..."]
316
384
  ae-cli kb +add --name "<name>" --files '["./a.md","./docs","https://example.com/page"]'
317
385
  ```
318
386
 
387
+ ### `+import`
388
+
389
+ ```bash
390
+ ae-cli kb +import --file "./knowledge-base.zip" --name "<name>" [--description "..."] [--tags '["t1","t2"]'] [--project-id "..."]
391
+ ```
392
+
393
+ - `--file`: required local `.zip` file.
394
+ - `--name`: required personal knowledge-base name, up to 30 characters.
395
+ - `--description`: optional, up to 200 characters.
396
+ - `--tags`: optional JSON array, max 2 unique tags, each up to 15 characters.
397
+ - `--project-id`: optional project binding.
398
+ - Scope and terminal build state are generated by the server and cannot be supplied by the client.
399
+ - Output: `{requestId, status: "queued"}`. Use `+import-status`; the command does not poll.
400
+
401
+ ### `+import-status`
402
+
403
+ ```bash
404
+ ae-cli kb +import-status --request-id <requestId>
405
+ ```
406
+
407
+ - `--request-id`: required ID returned by `+import`.
408
+ - Output: `{requestId, status, knowledgeBaseId?, errorCode?, errorMessage?}`.
409
+ - Returns a single snapshot and does not poll. A failed import is returned as `status: "failed"` with its stable error code/message; an unknown or inaccessible request exits non-zero.
410
+
319
411
  ### `+url`
320
412
 
321
413
  ```bash
@@ -325,9 +417,14 @@ ae-cli kb +url --name "<name>" --url "https://example.com/page" [--display-name
325
417
  ### `+schema`
326
418
 
327
419
  ```bash
328
- ae-cli kb +schema --name "<name>" [--force] [--model "<model displayName>"]
420
+ ae-cli kb +schema --name "<name>" [--force] [--model "<model displayName>"] [--custom-instructions "<one-time guidance>"]
329
421
  ```
330
422
 
423
+ - `--custom-instructions`: Optional per-run schema-generation guidance. It is not persisted; whitespace-only input is omitted. The server allows at most 10,000 Unicode characters and rejects disallowed control characters. Do not include secrets or credentials.
424
+ - `--force`: Replace the current attempt only when schema generation is already running and the user explicitly requests the replacement. The selected model and custom instructions apply to the new attempt, which may consume additional tokens.
425
+ - `--dry-run`: Shows the same `customInstructions` request field that execution will send.
426
+ - Errors: `KB_SCHEMA_CUSTOM_INSTRUCTIONS_INVALID` means the field failed validation. `KB_SCHEMA_GENERATION_IN_PROGRESS` means generation is active and a request without `--force` supplied a new model or effective custom instructions.
427
+
331
428
  ### `+compile`
332
429
 
333
430
  ```bash
@@ -340,12 +437,26 @@ ae-cli kb +compile --name "<name>" [--mode incremental|full]
340
437
  ae-cli kb +status --name "<name>"
341
438
  ```
342
439
 
440
+ ### `+list-sources`
441
+
442
+ ```bash
443
+ ae-cli kb +list-sources --name "<name>"
444
+ ```
445
+
446
+ - `--name`: required knowledge base name.
447
+ - Output: Safe source metadata including the stable `id` needed by `+rm-source`; raw paths, hashes, credentials, and source content are not returned.
448
+ - Copy the exact `id` from the current response before deleting a source; never guess it.
449
+
343
450
  ### `+rm-source`
344
451
 
345
452
  ```bash
346
- ae-cli kb +rm-source --name "<name>" --display-name "<uploaded source display name>"
453
+ ae-cli kb +rm-source --name "<name>" --id "<source-id>"
347
454
  ```
348
455
 
456
+ - `--id`: preferred stable source identifier copied from `+list-sources`.
457
+ - `--display-name`: legacy compatibility selector used only when an ID is unavailable.
458
+ - If both are supplied, `--id` wins. The command removes one source only.
459
+
349
460
  ### `+remove`
350
461
 
351
462
  ```bash