@thinkingai/ae-cli 6.1.27 → 6.1.29

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 (177) hide show
  1. package/README.md +52 -6
  2. package/README.zh.md +52 -6
  3. package/bin/ae-cli.js +5 -0
  4. package/bin/runtime-capabilities.json +5 -0
  5. package/cli-installation-guide.md +24 -3
  6. package/dist/{auth-WA7YGGRT.js → auth-OBQ5KVQM.js} +175 -45
  7. package/dist/{automation-VAAQBM7Y.js → automation-NAR5DDGL.js} +94 -38
  8. package/dist/{capability-GAAYJ3IQ.js → capability-LFSVNI5B.js} +57 -28
  9. package/dist/chunk-2UW3Y463.js +2289 -0
  10. package/dist/{chunk-VZZNLV3I.js → chunk-3SDHJOCR.js} +68 -18
  11. package/dist/chunk-6HAUVWOQ.js +132 -0
  12. package/dist/{chunk-5XJYLEVC.js → chunk-72NJKS7O.js} +4 -4
  13. package/dist/{chunk-Q5US7JC5.js → chunk-7JAVT5TK.js} +3 -3
  14. package/dist/{chunk-7KU2WNQE.js → chunk-CVCTFLSO.js} +37 -15
  15. package/dist/{chunk-GHXZK54S.js → chunk-H3K5UGYC.js} +41 -13
  16. package/dist/{chunk-OP44TT4H.js → chunk-IN7KKL6K.js} +4 -2
  17. package/dist/{chunk-S6M42KND.js → chunk-JEUXDY3B.js} +1 -1
  18. package/dist/{chunk-ZL7SGNIA.js → chunk-JNVVJ273.js} +58 -46
  19. package/dist/chunk-N6XBLRB7.js +105 -0
  20. package/dist/{chunk-AP7YP2NX.js → chunk-OAWPT7VP.js} +2 -2
  21. package/dist/{chunk-AQJPNWZF.js → chunk-PWXDWMCW.js} +7 -7
  22. package/dist/{chunk-CT7QDJS6.js → chunk-QVRIDN42.js} +2 -2
  23. package/dist/chunk-QZLRHGVH.js +222 -0
  24. package/dist/{chunk-RPBOAQQQ.js → chunk-QZUVLFNR.js} +1 -1
  25. package/dist/{chunk-3YVEAZUN.js → chunk-RJHGDWSC.js} +32 -21
  26. package/dist/{chunk-MWIA43UJ.js → chunk-VCZE3IWO.js} +10 -8
  27. package/dist/chunk-YVG6QD3V.js +233 -0
  28. package/dist/{chunk-WNGFSIOB.js → chunk-Z3Q2AEIN.js} +237 -86
  29. package/dist/{community-report-client-PEERQCX2.js → community-report-client-TJVCLZ3K.js} +1 -1
  30. package/dist/compat-check-CII6B74E.js +32 -0
  31. package/dist/{config-JOD5DOPE.js → config-YZ6O2UQ2.js} +40 -7
  32. package/dist/{context-NGVFPCBK.js → context-F6FCGTF3.js} +4 -4
  33. package/dist/{data-integration-BCLQFTGU.js → data-integration-6UAZO4GG.js} +207 -24
  34. package/dist/evaluation-4LO2O4AF.js +3714 -0
  35. package/dist/index.js +352 -81
  36. package/dist/{local-data-upload-client-TWMHFLUA.js → local-data-upload-client-KCMG6J62.js} +1 -1
  37. package/dist/{memory-CQKH2JAV.js → memory-HHPX3NF2.js} +6 -6
  38. package/dist/{metadata-NR3PHR23.js → metadata-TIFY24LW.js} +17 -9
  39. package/dist/{model-VX5M2CJ6.js → model-7UHGWYVR.js} +4 -4
  40. package/dist/{personal-semantic-preference-2RAI36P3.js → personal-semantic-preference-WKJEGPTM.js} +7 -6
  41. package/dist/{project-semantic-3BUGP3ZM.js → project-semantic-EIQVZNHW.js} +11 -10
  42. package/dist/{sync-RZIAV37C.js → sync-RV3OPCTI.js} +8 -7
  43. package/dist/{te-agent-AORRE2FM.js → te-agent-5ENVZJUH.js} +757 -94
  44. package/dist/{te-analysis-GP7DSQ7Q.js → te-analysis-USIK6ZZG.js} +584 -100
  45. package/dist/{te-community-42M7ICDO.js → te-community-WE2UU4XV.js} +722 -228
  46. package/dist/{te-dataops-BNKNZ4F2.js → te-dataops-XNMO7MBF.js} +9 -6
  47. package/dist/{te-engage-2CO6LRCX.js → te-engage-6C3HCFQR.js} +13 -12
  48. package/dist/{te-experiment-652CLXMU.js → te-experiment-LVTRI3QK.js} +55 -21
  49. package/dist/{te-kb-ULATOTQ3.js → te-kb-TUPGMVBY.js} +409 -85
  50. package/dist/{te-system-UGHVKBVV.js → te-system-YM657FKO.js} +6 -6
  51. package/dist/{te-team-YA6SNOJ3.js → te-team-G4VEJJNL.js} +64 -41
  52. package/dist/{things-DTCOQIQB.js → things-22KQWC23.js} +7 -7
  53. package/dist/{update-ESNYKUVR.js → update-XX4ILU7X.js} +11 -7
  54. package/dist/{workspace-JEOHKFPX.js → workspace-LYDAP647.js} +6 -6
  55. package/package.json +26 -11
  56. package/skills/ae-agent/SKILL.md +22 -3
  57. package/skills/ae-agent/references/command_index.md +8 -0
  58. package/skills/ae-agent/references/resource-package.md +57 -0
  59. package/skills/ae-analysis/SKILL.md +23 -10
  60. package/skills/ae-analysis/references/adhoc_export.md +1 -1
  61. package/skills/ae-analysis/references/agent_review_preflight.md +55 -10
  62. package/skills/ae-analysis/references/agent_review_priorities_comparisons.md +5 -3
  63. package/skills/ae-analysis/references/agent_review_submit_to_page.md +60 -24
  64. package/skills/ae-analysis/references/ai_models/event.md +58 -2
  65. package/skills/ae-analysis/references/ai_models/rank_list.md +1 -0
  66. package/skills/ae-analysis/references/ai_models/retention.md +2 -0
  67. package/skills/ae-analysis/references/ai_models/revenue.md +2 -0
  68. package/skills/ae-analysis/references/analysis_data_export.md +11 -1
  69. package/skills/ae-analysis/references/asset_batch_info_export.md +2 -2
  70. package/skills/ae-analysis/references/asset_batch_sql_export.md +2 -2
  71. package/skills/ae-analysis/references/asset_export.md +1 -1
  72. package/skills/ae-analysis/references/bi_panel_page_data_export.md +1 -1
  73. package/skills/ae-analysis/references/check_export.md +1 -1
  74. package/skills/ae-analysis/references/command_index.md +39 -26
  75. package/skills/ae-analysis/references/dashboard_report_data_export.md +2 -0
  76. package/skills/ae-analysis/references/dashboard_report_get.md +6 -2
  77. package/skills/ae-analysis/references/dashboard_report_update.md +24 -5
  78. package/skills/ae-analysis/references/feedback_submit.md +1 -1
  79. package/skills/ae-analysis/references/governance_recommendation_export.md +40 -18
  80. package/skills/ae-analysis/references/governance_recommendation_run_update.md +13 -0
  81. package/skills/ae-analysis/references/live_data_export.md +1 -1
  82. package/skills/ae-analysis/references/metric_create.md +29 -0
  83. package/skills/ae-analysis/references/metric_get.md +2 -0
  84. package/skills/ae-analysis/references/metric_update.md +2 -0
  85. package/skills/ae-analysis/references/operation_record_export.md +1 -1
  86. package/skills/ae-analysis/references/plan_change_log_export.md +1 -1
  87. package/skills/ae-analysis/references/plan_export.md +1 -1
  88. package/skills/ae-analysis/references/project_info_get.md +4 -0
  89. package/skills/ae-analysis/references/project_member_group_add_members.md +35 -0
  90. package/skills/ae-analysis/references/project_member_group_create.md +25 -0
  91. package/skills/ae-analysis/references/project_member_group_delete.md +34 -0
  92. package/skills/ae-analysis/references/project_member_group_list.md +29 -0
  93. package/skills/ae-analysis/references/project_member_group_members.md +28 -0
  94. package/skills/ae-analysis/references/project_member_group_remove_members.md +35 -0
  95. package/skills/ae-analysis/references/project_member_group_rename.md +26 -0
  96. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +9 -1
  97. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +6 -1
  98. package/skills/ae-analysis/references/report_data_export.md +1 -1
  99. package/skills/ae-analysis/references/scenario_append.md +31 -0
  100. package/skills/ae-analysis/references/scenario_begin.md +11 -0
  101. package/skills/ae-analysis/references/scenario_collect.md +43 -0
  102. package/skills/ae-analysis/references/scenario_evaluation.md +18 -0
  103. package/skills/ae-analysis/references/scenario_get.md +15 -0
  104. package/skills/ae-analysis/references/scenario_list.md +64 -0
  105. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +73 -4
  106. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +14 -1
  107. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +5 -1
  108. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/execution-contract.mjs +173 -0
  109. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +109 -64
  110. package/skills/ae-automation/SKILL.md +2 -2
  111. package/skills/ae-automation/references/cli.md +18 -1
  112. package/skills/ae-capability/SKILL.md +7 -3
  113. package/skills/ae-community/SKILL.md +77 -27
  114. package/skills/ae-community/references/community-analyzing-theme-comment.md +10 -8
  115. package/skills/ae-community/references/community-data-quality.md +68 -0
  116. package/skills/ae-community/references/community-query-evidence.md +85 -0
  117. package/skills/ae-community/references/community-scenario-capabilities.md +137 -0
  118. package/skills/ae-community/references/community-weekly-report.md +6 -3
  119. package/skills/ae-community/references/get_channel_info.md +7 -4
  120. package/skills/ae-community/references/get_comment_tag_analysis.md +3 -3
  121. package/skills/ae-community/references/get_comments_summary.md +4 -4
  122. package/skills/ae-community/references/get_corpus_tags.md +3 -3
  123. package/skills/ae-community/references/get_daily_summary.md +3 -3
  124. package/skills/ae-community/references/get_hot_topics.md +3 -3
  125. package/skills/ae-community/references/get_livestream_analysis.md +3 -3
  126. package/skills/ae-community/references/get_livestream_detail.md +4 -4
  127. package/skills/ae-community/references/get_livestream_list.md +3 -3
  128. package/skills/ae-community/references/get_livestream_overview.md +3 -3
  129. package/skills/ae-community/references/get_livestream_room_metrics.md +3 -3
  130. package/skills/ae-community/references/get_livestream_rooms.md +3 -3
  131. package/skills/ae-community/references/get_overview_metrics.md +3 -3
  132. package/skills/ae-community/references/get_post_detail.md +4 -4
  133. package/skills/ae-community/references/get_risk_content.md +5 -5
  134. package/skills/ae-community/references/get_sentiment_overview.md +4 -4
  135. package/skills/ae-community/references/get_tag_trends.md +3 -3
  136. package/skills/ae-community/references/get_topic_detail.md +3 -3
  137. package/skills/ae-community/references/list_sources.md +28 -0
  138. package/skills/ae-community/references/list_spaces.md +39 -0
  139. package/skills/ae-community/references/search_posts.md +21 -7
  140. package/skills/ae-data-integration/SKILL.md +6 -4
  141. package/skills/ae-data-integration/references/error-handling.md +1 -0
  142. package/skills/ae-data-integration/references/handoff.md +1 -1
  143. package/skills/ae-data-integration/references/sink-upload.md +11 -0
  144. package/skills/ae-data-integration/references/source-inspect.md +2 -1
  145. package/skills/ae-data-integration/references/transform.md +1 -1
  146. package/skills/ae-data-integration/references/ue-mapping.md +1 -1
  147. package/skills/ae-evaluation/SKILL.md +83 -0
  148. package/skills/ae-evaluation/references/access-and-members.md +55 -0
  149. package/skills/ae-evaluation/references/connections.md +78 -0
  150. package/skills/ae-evaluation/references/datasets.md +57 -0
  151. package/skills/ae-evaluation/references/evaluators.md +81 -0
  152. package/skills/ae-evaluation/references/files.md +33 -0
  153. package/skills/ae-evaluation/references/integrations.md +39 -0
  154. package/skills/ae-evaluation/references/runs.md +160 -0
  155. package/skills/ae-evaluation/references/schedules.md +31 -0
  156. package/skills/ae-experiment/SKILL.md +7 -1
  157. package/skills/ae-experiment/references/manage_experiment.md +18 -1
  158. package/skills/ae-experiment/references/query_experiment_detail.md +7 -0
  159. package/skills/ae-experiment/references/save_experiment.md +76 -2
  160. package/skills/ae-experiment/references/save_submit_experiment.md +7 -0
  161. package/skills/ae-kb/SKILL.md +33 -7
  162. package/skills/ae-kb/references/publication.md +81 -0
  163. package/skills/ae-kb/references/query-workflow.md +14 -1
  164. package/skills/ae-metadata/SKILL.md +3 -2
  165. package/skills/ae-metadata/references/metadata_data_table_download.md +7 -1
  166. package/skills/ae-metadata/references/metadata_data_table_get.md +37 -0
  167. package/skills/ae-system/SKILL.md +1 -1
  168. package/skills/ae-team/SKILL.md +2 -2
  169. package/skills/ae-team/references/run-start.md +1 -0
  170. package/skills/ae-team/references/run-watch.md +7 -5
  171. package/skills/ae-things/SKILL.md +53 -51
  172. package/skills/ae-things/references/cli.md +56 -54
  173. package/skills/ae-things-progress/SKILL.md +20 -20
  174. package/skills/ae-things-review/SKILL.md +19 -19
  175. package/skills/ae-workspace/SKILL.md +1 -1
  176. package/dist/chunk-6VNIR4AP.js +0 -1422
  177. package/dist/chunk-CI24BDR2.js +0 -43
@@ -1,15 +1,22 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ resolveWorkspaceTarget
4
+ } from "./chunk-7JAVT5TK.js";
5
+ import {
6
+ currentAgentSpaceId
7
+ } from "./chunk-RK6GLDGI.js";
8
+ import "./chunk-N6XBLRB7.js";
2
9
  import {
3
10
  TeAgentApiError,
4
11
  deleteFromMainApp,
5
12
  getFromMainApp,
6
13
  patchToMainApp,
7
14
  postToMainApp
8
- } from "./chunk-3YVEAZUN.js";
15
+ } from "./chunk-RJHGDWSC.js";
9
16
  import "./chunk-Y74WTIKJ.js";
10
- import "./chunk-GHXZK54S.js";
11
- import "./chunk-ZL7SGNIA.js";
12
- import "./chunk-WNGFSIOB.js";
17
+ import "./chunk-H3K5UGYC.js";
18
+ import "./chunk-JNVVJ273.js";
19
+ import "./chunk-Z3Q2AEIN.js";
13
20
 
14
21
  // src/commands/automation/index.ts
15
22
  import { randomUUID } from "crypto";
@@ -24,7 +31,7 @@ var typeFlag = flag(
24
31
  );
25
32
  var scopeFlag = flag(
26
33
  "agent-space-id",
27
- "Explicit space; otherwise server resolves sandbox context or personal space"
34
+ "Explicit space; otherwise current AgentSpace, then personal space"
28
35
  );
29
36
  var runFlag = flag(
30
37
  "run-id",
@@ -62,7 +69,21 @@ var configFlags = [
62
69
  flag("time", "HH:mm in server timezone"),
63
70
  flag("minute", "Hourly minute, 0-59", "number"),
64
71
  flag("weekday", "Weekly day, 0=Sunday through 6=Saturday", "number"),
65
- flag("day-of-month", "Monthly day, 1-28", "number"),
72
+ flag(
73
+ "weekdays",
74
+ "Weekly days as JSON array, 0=Sunday through 6=Saturday",
75
+ "json"
76
+ ),
77
+ flag(
78
+ "day-of-month",
79
+ "Monthly day, 1-31; missing dates are skipped",
80
+ "number"
81
+ ),
82
+ flag(
83
+ "days-of-month",
84
+ 'Monthly days as JSON array: integers 1-31 or "L" for last day; missing dates are skipped',
85
+ "json"
86
+ ),
66
87
  flag("model", "Agent model configuration ID; null clears the override"),
67
88
  flag("reuse-conversation", "Agent: true | false", "json"),
68
89
  {
@@ -71,12 +92,12 @@ var configFlags = [
71
92
  },
72
93
  flag(
73
94
  "channels",
74
- "Team notification channel array; [] clears channels",
95
+ "Agent or Team notification channel array; [] clears external notifications",
75
96
  "json"
76
97
  ),
77
- flag("feishu-chat-id", "Team Feishu destination; null clears it"),
78
- flag("lark-chat-id", "Team Lark destination; null clears it"),
79
- flag("slack-channel-id", "Team Slack destination; null clears it"),
98
+ flag("feishu-chat-id", "Feishu destination; null clears it"),
99
+ flag("lark-chat-id", "Lark destination; null clears it"),
100
+ flag("slack-channel-id", "Slack destination; null clears it"),
80
101
  flag(
81
102
  "save-to-knowledge-base-id",
82
103
  "Team output knowledge base ID; null clears it"
@@ -133,11 +154,33 @@ function configuration(ctx, create) {
133
154
  const kind = ctx.str("scheduleKind"), cron = ctx.str("cronExpression");
134
155
  enumValue(kind, ["hourly", "daily", "weekly", "monthly"], "schedule-kind");
135
156
  if (kind && cron) throw new Error("Use --schedule-kind or --cron-expression");
136
- if (!kind && ["time", "minute", "weekday", "dayOfMonth"].some((name2) => ctx.str(name2)))
157
+ if (!kind && (["time", "minute", "weekday", "dayOfMonth"].some(
158
+ (name2) => ctx.str(name2)
159
+ ) || ctx.json("weekdays") !== void 0 || ctx.json("daysOfMonth") !== void 0))
137
160
  throw new Error("Schedule details require --schedule-kind");
138
- if (kind && ctx.str("weekday") && kind !== "weekly" || kind && ctx.str("dayOfMonth") && kind !== "monthly" || kind && ctx.str("minute") && kind !== "hourly")
161
+ if (kind && (ctx.str("weekday") || ctx.json("weekdays") !== void 0) && kind !== "weekly" || kind && (ctx.str("dayOfMonth") || ctx.json("daysOfMonth") !== void 0) && kind !== "monthly" || kind && ctx.str("minute") && kind !== "hourly")
139
162
  throw new Error("Schedule field is not applicable to this frequency");
140
163
  if (kind) {
164
+ const dateSelection = (single, multiple, min, max, label, allowLastDay = false) => {
165
+ const values = ctx.json(multiple);
166
+ if (values === void 0)
167
+ return {
168
+ [single]: range(ctx.optionalNum(single) ?? NaN, min, max, label)
169
+ };
170
+ if (ctx.optionalNum(single) !== void 0)
171
+ throw new Error(`Use --${label} or its plural array, not both`);
172
+ if (!Array.isArray(values) || !values.length || values.length > max - min + 1 + Number(allowLastDay) || values.some(
173
+ (value) => !(allowLastDay && value === "L") && (!Number.isInteger(value) || value < min || value > max)
174
+ ))
175
+ throw new Error(
176
+ `${multiple} must be a non-empty JSON array of integers from ${min} to ${max}${allowLastDay ? ' or "L" for last day' : ""}`
177
+ );
178
+ return {
179
+ [multiple]: [...new Set(values)].sort(
180
+ (a, b) => (a === "L" ? 32 : a) - (b === "L" ? 32 : b)
181
+ )
182
+ };
183
+ };
141
184
  const schedule = { kind };
142
185
  if (kind === "hourly")
143
186
  schedule.minute = range(ctx.optionalNum("minute") ?? 0, 0, 59, "minute");
@@ -146,18 +189,21 @@ function configuration(ctx, create) {
146
189
  throw new Error("--time must use HH:mm");
147
190
  schedule.time = ctx.str("time");
148
191
  if (kind === "weekly")
149
- schedule.weekday = range(
150
- ctx.optionalNum("weekday") ?? NaN,
151
- 0,
152
- 6,
153
- "weekday"
192
+ Object.assign(
193
+ schedule,
194
+ dateSelection("weekday", "weekdays", 0, 6, "weekday")
154
195
  );
155
196
  if (kind === "monthly")
156
- schedule.dayOfMonth = range(
157
- ctx.optionalNum("dayOfMonth") ?? NaN,
158
- 1,
159
- 28,
160
- "day-of-month"
197
+ Object.assign(
198
+ schedule,
199
+ dateSelection(
200
+ "dayOfMonth",
201
+ "daysOfMonth",
202
+ 1,
203
+ 31,
204
+ "day-of-month",
205
+ true
206
+ )
161
207
  );
162
208
  }
163
209
  result.schedule = schedule;
@@ -165,8 +211,11 @@ function configuration(ctx, create) {
165
211
  if (cron) {
166
212
  const parts = cron.trim().split(/\s+/);
167
213
  const validNumber = (v, a, b) => /^\d+$/.test(v) && Number(v) >= a && Number(v) <= b;
214
+ const validDays = (v, a, b, allowLastDay = false) => v.split(",").length <= b - a + 1 + Number(allowLastDay) && v.split(",").every(
215
+ (day) => allowLastDay && day === "L" || validNumber(day, a, b)
216
+ );
168
217
  const [m, h, d, mo, w] = parts;
169
- if (parts.length !== 5 || !validNumber(m, 0, 59) || !(h === "*" || validNumber(h, 0, 23)) || mo !== "*" || !(d === "*" || validNumber(d, 1, 28)) || !(w === "*" || validNumber(w, 0, 6)) || d !== "*" && w !== "*" || h === "*" && (d !== "*" || w !== "*"))
218
+ if (parts.length !== 5 || !validNumber(m, 0, 59) || !(h === "*" || validNumber(h, 0, 23)) || mo !== "*" || !(d === "*" || validDays(d, 1, 31, true)) || !(w === "*" || validDays(w, 0, 6)) || d !== "*" && w !== "*" || h === "*" && (d !== "*" || w !== "*"))
170
219
  throw new Error(
171
220
  "--cron-expression must specify an hourly, daily, weekly or monthly schedule"
172
221
  );
@@ -175,19 +224,18 @@ function configuration(ctx, create) {
175
224
  if (create && (ctx.str("triggerType") || "scheduled") === "scheduled" && !kind && !cron)
176
225
  throw new Error("Scheduled automation requires a schedule");
177
226
  const agentNames = ["model", "reuseConversation"];
178
- const teamNames = [
179
- "scope",
227
+ const teamNames = ["scope", "saveToKnowledgeBaseId"];
228
+ const notificationNames = [
180
229
  "channels",
181
230
  "feishuChatId",
182
231
  "larkChatId",
183
- "slackChannelId",
184
- "saveToKnowledgeBaseId"
232
+ "slackChannelId"
185
233
  ];
186
- for (const name2 of [...agentNames, ...teamNames]) {
234
+ for (const name2 of [...agentNames, ...teamNames, ...notificationNames]) {
187
235
  const json = ["scope", "channels", "reuseConversation"].includes(name2);
188
236
  const value = json ? ctx.json(name2) : ctx.str(name2) || void 0;
189
237
  if (value === void 0) continue;
190
- if ((agentNames.includes(name2) ? "agent" : "team") !== targetType)
238
+ if (!notificationNames.includes(name2) && (agentNames.includes(name2) ? "agent" : "team") !== targetType)
191
239
  throw new Error(`${name2} is not applicable to ${targetType} automations`);
192
240
  if (name2 === "reuseConversation" && typeof value !== "boolean")
193
241
  throw new Error("--reuse-conversation must be true or false");
@@ -217,9 +265,13 @@ function configuration(ctx, create) {
217
265
  if (create) result.triggerImmediately = ctx.bool("triggerImmediately");
218
266
  return result;
219
267
  }
220
- function query(ctx, list = false, typed = false) {
268
+ async function query(ctx, list = false, typed = false) {
221
269
  const p = new URLSearchParams();
222
- if (ctx.str("agentSpaceId")) p.set("agentSpaceId", ctx.str("agentSpaceId"));
270
+ let spaceId = ctx.str("agentSpaceId").trim() || currentAgentSpaceId();
271
+ if (!spaceId && process.env.TE_AGENT_CONVERSATION_ID?.trim()) {
272
+ spaceId = (await resolveWorkspaceTarget(ctx)).agentSpaceId;
273
+ }
274
+ if (spaceId) p.set("agentSpaceId", spaceId);
223
275
  if (typed && ctx.str("targetType"))
224
276
  p.set("targetType", ctx.str("targetType"));
225
277
  if (list) {
@@ -232,23 +284,27 @@ async function request(ctx, method, path, body) {
232
284
  if (method === "GET")
233
285
  return getFromMainApp(
234
286
  path,
235
- ctx.hostOverride ? ctx.hostOverride() : ctx.host()
287
+ ctx.hostOverride ? ctx.hostOverride() : ctx.host(),
288
+ "cli-token"
236
289
  );
237
290
  if (method === "POST")
238
291
  return postToMainApp(
239
292
  path,
240
293
  body,
241
- ctx.hostOverride ? ctx.hostOverride() : ctx.host()
294
+ ctx.hostOverride ? ctx.hostOverride() : ctx.host(),
295
+ "cli-token"
242
296
  );
243
297
  if (method === "PATCH")
244
298
  return patchToMainApp(
245
299
  path,
246
300
  body,
247
- ctx.hostOverride ? ctx.hostOverride() : ctx.host()
301
+ ctx.hostOverride ? ctx.hostOverride() : ctx.host(),
302
+ "cli-token"
248
303
  );
249
304
  return deleteFromMainApp(
250
305
  path,
251
- ctx.hostOverride ? ctx.hostOverride() : ctx.host()
306
+ ctx.hostOverride ? ctx.hostOverride() : ctx.host(),
307
+ "cli-token"
252
308
  );
253
309
  }
254
310
  function withDryRun(path) {
@@ -267,7 +323,7 @@ async function waitForRun(ctx, id, runId) {
267
323
  const result = await request(
268
324
  ctx,
269
325
  "GET",
270
- `${base}/${encodeURIComponent(id)}/runs/${encodeURIComponent(runId)}/result${query(ctx)}`
326
+ `${base}/${encodeURIComponent(id)}/runs/${encodeURIComponent(runId)}/result${await query(ctx)}`
271
327
  );
272
328
  if (result.status !== "running")
273
329
  return { ...result, executionCompleted: true, timedOut: false };
@@ -397,7 +453,7 @@ var automationCommands = actions.map((a) => ({
397
453
  ...body,
398
454
  ...a.wait ? { commandId } : {}
399
455
  };
400
- const path = base + a.suffix(ctx) + query(ctx, a.list, a.typed);
456
+ const path = base + a.suffix(ctx) + await query(ctx, a.list, a.typed);
401
457
  return {
402
458
  request: redactedPreview(a.method, path, requestBody),
403
459
  validation: await request(ctx, a.method, withDryRun(path), requestBody)
@@ -410,7 +466,7 @@ var automationCommands = actions.map((a) => ({
410
466
  output = await request(
411
467
  ctx,
412
468
  a.method,
413
- base + a.suffix(ctx) + query(ctx, a.list, a.typed),
469
+ base + a.suffix(ctx) + await query(ctx, a.list, a.typed),
414
470
  body && { ...body, ...a.wait ? { commandId } : {} }
415
471
  );
416
472
  } catch (error) {
@@ -4,40 +4,47 @@ import {
4
4
  requiresConfirmation
5
5
  } from "./chunk-AMBFK2K3.js";
6
6
  import {
7
- CapabilityGatewayError,
8
- dryRunCapabilityWithEnvelope,
9
- executeCapabilityWithEnvelope,
10
- inspectCapability,
11
- inspectCapabilityWithEnvelope,
12
- listCapabilitiesWithEnvelope,
13
- validateCapabilityWithEnvelope
14
- } from "./chunk-VZZNLV3I.js";
7
+ resolveHost
8
+ } from "./chunk-IN7KKL6K.js";
15
9
  import {
16
10
  findGatewayDomain,
17
11
  listCapabilityDiscoveryPrefixes,
18
12
  listRegisteredCapabilityDomains,
19
13
  resolveGatewayDomain
20
14
  } from "./chunk-KPQY44JQ.js";
21
- import {
22
- resolveHost
23
- } from "./chunk-OP44TT4H.js";
24
15
  import {
25
16
  printError,
26
17
  printOutput,
27
18
  withOutputMetadata
28
- } from "./chunk-6VNIR4AP.js";
19
+ } from "./chunk-QZLRHGVH.js";
20
+ import {
21
+ CapabilityGatewayError,
22
+ dryRunCapabilityWithEnvelope,
23
+ executeCapabilityWithEnvelope,
24
+ inspectCapability,
25
+ inspectCapabilityWithEnvelope,
26
+ listCapabilitiesWithEnvelope,
27
+ validateCapabilityWithEnvelope
28
+ } from "./chunk-3SDHJOCR.js";
29
29
  import "./chunk-Y74WTIKJ.js";
30
+ import {
31
+ assertBusinessEnabled,
32
+ businessForCapability,
33
+ readBusinessConfigForExecution,
34
+ readCurrentBusinessConfig
35
+ } from "./chunk-2UW3Y463.js";
30
36
  import {
31
37
  CredentialStoreUnreadableError,
32
38
  SecureStoreAuthError
33
- } from "./chunk-GHXZK54S.js";
39
+ } from "./chunk-H3K5UGYC.js";
34
40
  import {
35
- safeJsonParse
36
- } from "./chunk-ZL7SGNIA.js";
41
+ parseJsonRequest
42
+ } from "./chunk-JNVVJ273.js";
37
43
  import {
38
44
  CliValidationError,
45
+ ExternalCliTokenError,
39
46
  PermissionError
40
- } from "./chunk-WNGFSIOB.js";
47
+ } from "./chunk-Z3Q2AEIN.js";
41
48
 
42
49
  // src/commands/capability/index.ts
43
50
  import * as readline from "readline";
@@ -81,7 +88,7 @@ function resolveCapabilityGatewayDomain(capabilityId, domainOverride) {
81
88
  }
82
89
  return resolveGatewayDomain(cliDomain, findGatewayDomain(cliDomain) ?? cliDomain);
83
90
  }
84
- function resolveCapabilityListDomain(cliDomain) {
91
+ function resolveCapabilityListDomain(cliDomain, businesses = {}) {
85
92
  if (!cliDomain) {
86
93
  throw new CapabilityCommandValidationError(
87
94
  "Cannot determine the capability domain.",
@@ -90,7 +97,10 @@ function resolveCapabilityListDomain(cliDomain) {
90
97
  }
91
98
  const gatewayDomain = findGatewayDomain(cliDomain);
92
99
  if (gatewayDomain === void 0) {
93
- const registeredDomains = listRegisteredCapabilityDomains();
100
+ const registeredDomains = listRegisteredCapabilityDomains().filter((domain) => {
101
+ const business = businessForCapability(domain);
102
+ return !business || businesses[business] !== false;
103
+ });
94
104
  const registeredHint = registeredDomains.length > 0 ? `Registered domains: ${registeredDomains.join(", ")}.` : "No capability domains are registered in this ae-cli process.";
95
105
  throw new CapabilityCommandValidationError(
96
106
  `Capability domain '${cliDomain}' is not registered.`,
@@ -134,10 +144,12 @@ function normalizeCapabilityList(value) {
134
144
  return item !== null && typeof item === "object" && typeof item.id === "string";
135
145
  });
136
146
  }
137
- function filterCapabilities(capabilities, domain, query) {
147
+ function filterCapabilities(capabilities, domain, query, businesses = {}) {
138
148
  const prefixes = listCapabilityDiscoveryPrefixes(domain);
139
149
  const terms = query?.trim().toLowerCase().split(/\s+/).filter(Boolean) ?? [];
140
150
  return capabilities.filter((capability) => {
151
+ const business = businessForCapability(capability.id);
152
+ if (business && businesses[business] === false) return false;
141
153
  if (RETIRED_CAPABILITY_REPLACEMENTS[capability.id.toLowerCase()]) {
142
154
  return false;
143
155
  }
@@ -160,12 +172,12 @@ function parseCapabilityInput(raw) {
160
172
  let parsed;
161
173
  try {
162
174
  if (trimmed === "-") {
163
- parsed = safeJsonParse(readFileSync(0, "utf8"));
175
+ parsed = parseJsonRequest(readFileSync(0, "utf8"));
164
176
  } else if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
165
- parsed = safeJsonParse(trimmed);
177
+ parsed = parseJsonRequest(trimmed);
166
178
  } else {
167
179
  const path = trimmed.startsWith("@") ? trimmed.slice(1) : trimmed;
168
- parsed = safeJsonParse(readFileSync(path, "utf8"));
180
+ parsed = parseJsonRequest(readFileSync(path, "utf8"));
169
181
  }
170
182
  } catch (error) {
171
183
  const message = error instanceof Error ? error.message : String(error);
@@ -199,11 +211,16 @@ function registerCapability(program) {
199
211
  });
200
212
  capability.command("list").description("List capability summaries in a domain").requiredOption("--domain <domain>", "Capability namespace, such as analysis or metadata").option("--project-id <project-id>", "Filter by project membership, permissions, and enabled features").action(async (opts) => {
201
213
  await executeAndPrint(program, async (host) => {
202
- const gatewayDomain = resolveCapabilityListDomain(opts.domain);
214
+ const business = businessForCapability(opts.domain);
215
+ const businesses = business ? await readBusinessConfigForExecution(host) : readCurrentBusinessConfig(host);
216
+ const gatewayDomain = resolveCapabilityListDomain(opts.domain, businesses);
203
217
  const projectId = parseOptionalProjectId(opts.projectId);
218
+ if (business && businesses[business] === false) {
219
+ return { domain: opts.domain, count: 0, capabilities: [], warning: `The '${business}' business is not enabled for the current environment.` };
220
+ }
204
221
  const envelope = await listCapabilitiesWithEnvelope(host, gatewayDomain, projectId);
205
222
  const catalog = normalizeCapabilityList(envelope.data);
206
- const capabilities = filterCapabilities(catalog, opts.domain);
223
+ const capabilities = filterCapabilities(catalog, opts.domain, void 0, businesses);
207
224
  const warning = emptyCapabilityCatalogWarning(catalog);
208
225
  return withOutputMetadata({
209
226
  domain: opts.domain,
@@ -221,11 +238,16 @@ function registerCapability(program) {
221
238
  "Capability namespace. One of: analysis, project, system, tracking, metadata, experiment, engage-flow, engage-task, engage-setting, engage-scene, engage-activity, engage-workbench, community"
222
239
  ).option("--project-id <project-id>", "Filter by project membership, permissions, and enabled features").action(async (query, opts) => {
223
240
  await executeAndPrint(program, async (host) => {
224
- const gatewayDomain = resolveCapabilityListDomain(opts.domain);
241
+ const business = businessForCapability(opts.domain);
242
+ const businesses = business ? await readBusinessConfigForExecution(host) : readCurrentBusinessConfig(host);
243
+ const gatewayDomain = resolveCapabilityListDomain(opts.domain, businesses);
225
244
  const projectId = parseOptionalProjectId(opts.projectId);
245
+ if (business && businesses[business] === false) {
246
+ return { domain: opts.domain, query, count: 0, capabilities: [], warning: `The '${business}' business is not enabled for the current environment.` };
247
+ }
226
248
  const envelope = await listCapabilitiesWithEnvelope(host, gatewayDomain, projectId);
227
249
  const catalog = normalizeCapabilityList(envelope.data);
228
- const capabilities = filterCapabilities(catalog, opts.domain, query);
250
+ const capabilities = filterCapabilities(catalog, opts.domain, query, businesses);
229
251
  const warning = emptyCapabilityCatalogWarning(catalog);
230
252
  return withOutputMetadata({
231
253
  domain: opts.domain,
@@ -242,6 +264,7 @@ function registerCapability(program) {
242
264
  capability.command("inspect").description("Inspect one capability schema, risk, auth, and output metadata").argument("<capability-id>", "Capability ID, such as analysis.report.list").option("--domain <domain>", "Override the capability namespace used for gateway routing").option("--project-id <project-id>", "Check availability in a project before returning metadata").action(async (capabilityId, opts) => {
243
265
  await executeAndPrint(program, async (host) => {
244
266
  assertCapabilityIsNotRetired(capabilityId);
267
+ await assertCapabilityBusinessEnabled(capabilityId, host);
245
268
  const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
246
269
  return gatewayOutput(await inspectCapabilityWithEnvelope(host, gatewayDomain, capabilityId, parseOptionalProjectId(opts.projectId)), host);
247
270
  });
@@ -254,6 +277,7 @@ function registerCapability(program) {
254
277
  ).argument("<capability-id>", "Capability ID, such as metadata.data_table.sql_write").option("--domain <domain>", "Override the capability namespace used for gateway routing").option("--input <json-or-path>", "Input JSON object, file path, @<path>, or - for stdin").action(async (capabilityId, opts) => {
255
278
  await executeAndPrint(program, async (host) => {
256
279
  assertCapabilityIsNotRetired(capabilityId);
280
+ await assertCapabilityBusinessEnabled(capabilityId, host);
257
281
  const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
258
282
  return gatewayOutput(await validateCapabilityWithEnvelope(host, gatewayDomain, capabilityId, parseCapabilityInput(opts.input)), host);
259
283
  });
@@ -277,6 +301,7 @@ Examples:
277
301
  ).argument("<capability-id>", "Capability ID, such as analysis.query.export").option("--domain <domain>", "Override the capability namespace used for gateway routing").option("--input <json-or-path>", "Input JSON object, file path, @<path>, or - for stdin").action(async (capabilityId, opts) => {
278
302
  await executeAndPrint(program, async (host) => {
279
303
  assertCapabilityIsNotRetired(capabilityId);
304
+ await assertCapabilityBusinessEnabled(capabilityId, host);
280
305
  const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
281
306
  return gatewayOutput(await dryRunCapabilityWithEnvelope(host, gatewayDomain, capabilityId, parseCapabilityInput(opts.input)), host);
282
307
  });
@@ -290,6 +315,7 @@ Examples:
290
315
  capability.command("run").description("Execute one capability by ID").argument("<capability-id>", "Capability ID, such as analysis.report.list").option("--domain <domain>", "Override the capability namespace used for gateway routing").option("--input <json-or-path>", "Input JSON object, file path, @<path>, or - for stdin").action(async (capabilityId, opts) => {
291
316
  await executeAndPrint(program, async (host, globalOpts) => {
292
317
  assertCapabilityIsNotRetired(capabilityId);
318
+ await assertCapabilityBusinessEnabled(capabilityId, host);
293
319
  const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
294
320
  const input = parseCapabilityInput(opts.input);
295
321
  if (globalOpts.validate && globalOpts.dryRun) {
@@ -325,6 +351,9 @@ Examples:
325
351
  ae-cli capability run analysis.dashboard.list --input input.json`
326
352
  );
327
353
  }
354
+ async function assertCapabilityBusinessEnabled(capabilityId, host) {
355
+ await assertBusinessEnabled(businessForCapability(capabilityId), host);
356
+ }
328
357
  function gatewayOutput(envelope, host) {
329
358
  return withOutputMetadata(withPageUrl(envelope.data, host), envelope.meta);
330
359
  }
@@ -368,7 +397,7 @@ function printCapabilityError(error, host) {
368
397
  );
369
398
  return;
370
399
  }
371
- if (error instanceof CredentialStoreUnreadableError) {
400
+ if (error instanceof CredentialStoreUnreadableError || error instanceof ExternalCliTokenError) {
372
401
  printError("config", error.message, error.hint, error.code);
373
402
  return;
374
403
  }
@@ -377,7 +406,7 @@ function printCapabilityError(error, host) {
377
406
  return;
378
407
  }
379
408
  if (error instanceof PermissionError) {
380
- printError("permission", error.message, void 0, error.code);
409
+ printError("permission", error.message, error.hint, error.code);
381
410
  return;
382
411
  }
383
412
  if (error instanceof CapabilityGatewayError) {