@thinkingai/ae-cli 6.0.55 → 6.0.57

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 (169) hide show
  1. package/README.md +35 -6
  2. package/README.zh.md +35 -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-RQBO6MTY.js → auth-YEIJLBFY.js} +61 -19
  7. package/dist/{automation-VAAQBM7Y.js → automation-NAR5DDGL.js} +94 -38
  8. package/dist/{capability-JRIFC4AJ.js → capability-P7DD4Q73.js} +50 -21
  9. package/dist/{chunk-5XJYLEVC.js → chunk-72NJKS7O.js} +4 -4
  10. package/dist/chunk-752BSLZC.js +222 -0
  11. package/dist/{chunk-RGYPSEYD.js → chunk-7ABK2PEJ.js} +3 -3
  12. package/dist/{chunk-Q5US7JC5.js → chunk-7JAVT5TK.js} +3 -3
  13. package/dist/{chunk-GHXZK54S.js → chunk-H3K5UGYC.js} +41 -13
  14. package/dist/{chunk-OP44TT4H.js → chunk-IN7KKL6K.js} +4 -2
  15. package/dist/{chunk-VZZNLV3I.js → chunk-JCWM2TYP.js} +61 -15
  16. package/dist/{chunk-S6M42KND.js → chunk-JEUXDY3B.js} +1 -1
  17. package/dist/{chunk-ZL7SGNIA.js → chunk-JNVVJ273.js} +58 -46
  18. package/dist/chunk-N6XBLRB7.js +105 -0
  19. package/dist/{chunk-AP7YP2NX.js → chunk-OAWPT7VP.js} +2 -2
  20. package/dist/{chunk-7KU2WNQE.js → chunk-QEMQKVHW.js} +37 -15
  21. package/dist/{chunk-CT7QDJS6.js → chunk-QVRIDN42.js} +2 -2
  22. package/dist/{chunk-RPBOAQQQ.js → chunk-QZUVLFNR.js} +1 -1
  23. package/dist/{chunk-3YVEAZUN.js → chunk-RJHGDWSC.js} +32 -21
  24. package/dist/{chunk-374V5R6N.js → chunk-TKVVACEJ.js} +6 -4
  25. package/dist/chunk-TULINOLS.js +2283 -0
  26. package/dist/chunk-YVG6QD3V.js +233 -0
  27. package/dist/{chunk-WNGFSIOB.js → chunk-Z3Q2AEIN.js} +237 -86
  28. package/dist/chunk-ZGIYG473.js +132 -0
  29. package/dist/{community-report-client-PEERQCX2.js → community-report-client-TJVCLZ3K.js} +1 -1
  30. package/dist/compat-check-PMEGUPZU.js +32 -0
  31. package/dist/{config-SICKWZ2A.js → config-VWVPR4WW.js} +43 -10
  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 +343 -79
  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-EMFGUI2W.js → metadata-HEQQEEG3.js} +17 -9
  39. package/dist/{model-VX5M2CJ6.js → model-7UHGWYVR.js} +4 -4
  40. package/dist/{personal-semantic-preference-SLWVVYZ4.js → personal-semantic-preference-V4L6ZWR2.js} +7 -6
  41. package/dist/{project-semantic-DPSZBKQD.js → project-semantic-NKHKJX6M.js} +7 -6
  42. package/dist/{sync-RZIAV37C.js → sync-ZJMXCRIN.js} +8 -7
  43. package/dist/{te-agent-AORRE2FM.js → te-agent-WBKIFEQD.js} +757 -94
  44. package/dist/{te-analysis-ISXKJKRT.js → te-analysis-ADX7RKO4.js} +578 -94
  45. package/dist/{te-community-42M7ICDO.js → te-community-PREDRXG3.js} +722 -228
  46. package/dist/{te-dataops-BNKNZ4F2.js → te-dataops-ITWJHO2U.js} +9 -6
  47. package/dist/{te-engage-BZE3MBKT.js → te-engage-VE2NUH5V.js} +7 -6
  48. package/dist/{te-kb-ULATOTQ3.js → te-kb-WSMOW7WS.js} +407 -83
  49. package/dist/{te-system-UGHVKBVV.js → te-system-YM657FKO.js} +6 -6
  50. package/dist/{te-team-YA6SNOJ3.js → te-team-T2WRLOOD.js} +64 -41
  51. package/dist/{things-DTCOQIQB.js → things-6QOMFXOG.js} +7 -7
  52. package/dist/{update-ESNYKUVR.js → update-I4MOUYOX.js} +11 -7
  53. package/dist/{workspace-JEOHKFPX.js → workspace-LYDAP647.js} +6 -6
  54. package/package.json +25 -11
  55. package/skills/ae-agent/SKILL.md +20 -3
  56. package/skills/ae-agent/references/command_index.md +8 -0
  57. package/skills/ae-agent/references/resource-package.md +57 -0
  58. package/skills/ae-analysis/SKILL.md +23 -10
  59. package/skills/ae-analysis/references/adhoc_export.md +1 -1
  60. package/skills/ae-analysis/references/agent_review_preflight.md +55 -10
  61. package/skills/ae-analysis/references/agent_review_priorities_comparisons.md +5 -3
  62. package/skills/ae-analysis/references/agent_review_submit_to_page.md +60 -24
  63. package/skills/ae-analysis/references/ai_models/event.md +58 -2
  64. package/skills/ae-analysis/references/ai_models/rank_list.md +1 -0
  65. package/skills/ae-analysis/references/ai_models/retention.md +2 -0
  66. package/skills/ae-analysis/references/ai_models/revenue.md +2 -0
  67. package/skills/ae-analysis/references/analysis_data_export.md +11 -1
  68. package/skills/ae-analysis/references/asset_batch_info_export.md +2 -2
  69. package/skills/ae-analysis/references/asset_batch_sql_export.md +2 -2
  70. package/skills/ae-analysis/references/asset_export.md +1 -1
  71. package/skills/ae-analysis/references/bi_panel_page_data_export.md +1 -1
  72. package/skills/ae-analysis/references/check_export.md +1 -1
  73. package/skills/ae-analysis/references/command_index.md +39 -26
  74. package/skills/ae-analysis/references/dashboard_report_data_export.md +2 -0
  75. package/skills/ae-analysis/references/dashboard_report_get.md +6 -2
  76. package/skills/ae-analysis/references/dashboard_report_update.md +24 -5
  77. package/skills/ae-analysis/references/feedback_submit.md +1 -1
  78. package/skills/ae-analysis/references/governance_recommendation_export.md +40 -18
  79. package/skills/ae-analysis/references/governance_recommendation_run_update.md +13 -0
  80. package/skills/ae-analysis/references/live_data_export.md +1 -1
  81. package/skills/ae-analysis/references/metric_create.md +29 -0
  82. package/skills/ae-analysis/references/metric_get.md +2 -0
  83. package/skills/ae-analysis/references/metric_update.md +2 -0
  84. package/skills/ae-analysis/references/operation_record_export.md +1 -1
  85. package/skills/ae-analysis/references/plan_change_log_export.md +1 -1
  86. package/skills/ae-analysis/references/plan_export.md +1 -1
  87. package/skills/ae-analysis/references/project_info_get.md +4 -0
  88. package/skills/ae-analysis/references/project_member_group_add_members.md +35 -0
  89. package/skills/ae-analysis/references/project_member_group_create.md +25 -0
  90. package/skills/ae-analysis/references/project_member_group_delete.md +34 -0
  91. package/skills/ae-analysis/references/project_member_group_list.md +29 -0
  92. package/skills/ae-analysis/references/project_member_group_members.md +28 -0
  93. package/skills/ae-analysis/references/project_member_group_remove_members.md +35 -0
  94. package/skills/ae-analysis/references/project_member_group_rename.md +26 -0
  95. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +9 -1
  96. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +6 -1
  97. package/skills/ae-analysis/references/report_data_export.md +1 -1
  98. package/skills/ae-analysis/references/scenario_append.md +31 -0
  99. package/skills/ae-analysis/references/scenario_begin.md +11 -0
  100. package/skills/ae-analysis/references/scenario_collect.md +43 -0
  101. package/skills/ae-analysis/references/scenario_evaluation.md +18 -0
  102. package/skills/ae-analysis/references/scenario_get.md +15 -0
  103. package/skills/ae-analysis/references/scenario_list.md +64 -0
  104. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +73 -4
  105. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +14 -1
  106. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +5 -1
  107. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/execution-contract.mjs +173 -0
  108. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +109 -64
  109. package/skills/ae-automation/SKILL.md +2 -2
  110. package/skills/ae-automation/references/cli.md +18 -1
  111. package/skills/ae-capability/SKILL.md +7 -3
  112. package/skills/ae-community/SKILL.md +77 -27
  113. package/skills/ae-community/references/community-analyzing-theme-comment.md +10 -8
  114. package/skills/ae-community/references/community-data-quality.md +68 -0
  115. package/skills/ae-community/references/community-query-evidence.md +85 -0
  116. package/skills/ae-community/references/community-scenario-capabilities.md +137 -0
  117. package/skills/ae-community/references/community-weekly-report.md +6 -3
  118. package/skills/ae-community/references/get_channel_info.md +7 -4
  119. package/skills/ae-community/references/get_comment_tag_analysis.md +3 -3
  120. package/skills/ae-community/references/get_comments_summary.md +4 -4
  121. package/skills/ae-community/references/get_corpus_tags.md +3 -3
  122. package/skills/ae-community/references/get_daily_summary.md +3 -3
  123. package/skills/ae-community/references/get_hot_topics.md +3 -3
  124. package/skills/ae-community/references/get_livestream_analysis.md +3 -3
  125. package/skills/ae-community/references/get_livestream_detail.md +4 -4
  126. package/skills/ae-community/references/get_livestream_list.md +3 -3
  127. package/skills/ae-community/references/get_livestream_overview.md +3 -3
  128. package/skills/ae-community/references/get_livestream_room_metrics.md +3 -3
  129. package/skills/ae-community/references/get_livestream_rooms.md +3 -3
  130. package/skills/ae-community/references/get_overview_metrics.md +3 -3
  131. package/skills/ae-community/references/get_post_detail.md +4 -4
  132. package/skills/ae-community/references/get_risk_content.md +5 -5
  133. package/skills/ae-community/references/get_sentiment_overview.md +4 -4
  134. package/skills/ae-community/references/get_tag_trends.md +3 -3
  135. package/skills/ae-community/references/get_topic_detail.md +3 -3
  136. package/skills/ae-community/references/list_sources.md +28 -0
  137. package/skills/ae-community/references/list_spaces.md +39 -0
  138. package/skills/ae-community/references/search_posts.md +21 -7
  139. package/skills/ae-data-integration/SKILL.md +6 -4
  140. package/skills/ae-data-integration/references/error-handling.md +1 -0
  141. package/skills/ae-data-integration/references/handoff.md +1 -1
  142. package/skills/ae-data-integration/references/sink-upload.md +11 -0
  143. package/skills/ae-data-integration/references/source-inspect.md +2 -1
  144. package/skills/ae-data-integration/references/transform.md +1 -1
  145. package/skills/ae-data-integration/references/ue-mapping.md +1 -1
  146. package/skills/ae-evaluation/SKILL.md +83 -0
  147. package/skills/ae-evaluation/references/access-and-members.md +55 -0
  148. package/skills/ae-evaluation/references/connections.md +78 -0
  149. package/skills/ae-evaluation/references/datasets.md +57 -0
  150. package/skills/ae-evaluation/references/evaluators.md +81 -0
  151. package/skills/ae-evaluation/references/files.md +33 -0
  152. package/skills/ae-evaluation/references/integrations.md +39 -0
  153. package/skills/ae-evaluation/references/runs.md +160 -0
  154. package/skills/ae-evaluation/references/schedules.md +31 -0
  155. package/skills/ae-kb/SKILL.md +33 -6
  156. package/skills/ae-kb/references/publication.md +81 -0
  157. package/skills/ae-kb/references/query-workflow.md +14 -1
  158. package/skills/ae-metadata/SKILL.md +3 -2
  159. package/skills/ae-metadata/references/metadata_data_table_download.md +7 -1
  160. package/skills/ae-metadata/references/metadata_data_table_get.md +37 -0
  161. package/skills/ae-team/SKILL.md +2 -2
  162. package/skills/ae-team/references/run-start.md +1 -0
  163. package/skills/ae-team/references/run-watch.md +7 -5
  164. package/skills/ae-things/SKILL.md +53 -51
  165. package/skills/ae-things/references/cli.md +56 -54
  166. package/skills/ae-things-progress/SKILL.md +20 -20
  167. package/skills/ae-things-review/SKILL.md +19 -19
  168. package/dist/chunk-6VNIR4AP.js +0 -1422
  169. 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) {
@@ -9,9 +9,6 @@ import {
9
9
  listRegisteredCapabilityDomains,
10
10
  resolveGatewayDomain
11
11
  } from "./chunk-KPQY44JQ.js";
12
- import {
13
- resolveHost
14
- } from "./chunk-OP44TT4H.js";
15
12
  import {
16
13
  CapabilityGatewayError,
17
14
  dryRunCapabilityWithEnvelope,
@@ -20,24 +17,34 @@ import {
20
17
  inspectCapabilityWithEnvelope,
21
18
  listCapabilitiesWithEnvelope,
22
19
  validateCapabilityWithEnvelope
23
- } from "./chunk-VZZNLV3I.js";
20
+ } from "./chunk-JCWM2TYP.js";
21
+ import {
22
+ resolveHost
23
+ } from "./chunk-IN7KKL6K.js";
24
24
  import {
25
25
  printError,
26
26
  printOutput,
27
27
  withOutputMetadata
28
- } from "./chunk-6VNIR4AP.js";
28
+ } from "./chunk-752BSLZC.js";
29
29
  import "./chunk-Y74WTIKJ.js";
30
+ import {
31
+ assertBusinessEnabled,
32
+ businessForCapability,
33
+ readBusinessConfigForExecution,
34
+ readCurrentBusinessConfig
35
+ } from "./chunk-TULINOLS.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,
@@ -218,11 +235,16 @@ function registerCapability(program) {
218
235
  );
219
236
  capability.command("search").description("Search capability IDs and descriptions in a domain").argument("<query>", "Case-insensitive search terms").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 (query, opts) => {
220
237
  await executeAndPrint(program, async (host) => {
221
- const gatewayDomain = resolveCapabilityListDomain(opts.domain);
238
+ const business = businessForCapability(opts.domain);
239
+ const businesses = business ? await readBusinessConfigForExecution(host) : readCurrentBusinessConfig(host);
240
+ const gatewayDomain = resolveCapabilityListDomain(opts.domain, businesses);
222
241
  const projectId = parseOptionalProjectId(opts.projectId);
242
+ if (business && businesses[business] === false) {
243
+ return { domain: opts.domain, query, count: 0, capabilities: [], warning: `The '${business}' business is not enabled for the current environment.` };
244
+ }
223
245
  const envelope = await listCapabilitiesWithEnvelope(host, gatewayDomain, projectId);
224
246
  const catalog = normalizeCapabilityList(envelope.data);
225
- const capabilities = filterCapabilities(catalog, opts.domain, query);
247
+ const capabilities = filterCapabilities(catalog, opts.domain, query, businesses);
226
248
  const warning = emptyCapabilityCatalogWarning(catalog);
227
249
  return withOutputMetadata({
228
250
  domain: opts.domain,
@@ -239,6 +261,7 @@ function registerCapability(program) {
239
261
  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) => {
240
262
  await executeAndPrint(program, async (host) => {
241
263
  assertCapabilityIsNotRetired(capabilityId);
264
+ await assertCapabilityBusinessEnabled(capabilityId, host);
242
265
  const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
243
266
  return gatewayOutput(await inspectCapabilityWithEnvelope(host, gatewayDomain, capabilityId, parseOptionalProjectId(opts.projectId)), host);
244
267
  });
@@ -251,6 +274,7 @@ function registerCapability(program) {
251
274
  ).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) => {
252
275
  await executeAndPrint(program, async (host) => {
253
276
  assertCapabilityIsNotRetired(capabilityId);
277
+ await assertCapabilityBusinessEnabled(capabilityId, host);
254
278
  const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
255
279
  return gatewayOutput(await validateCapabilityWithEnvelope(host, gatewayDomain, capabilityId, parseCapabilityInput(opts.input)), host);
256
280
  });
@@ -274,6 +298,7 @@ Examples:
274
298
  ).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) => {
275
299
  await executeAndPrint(program, async (host) => {
276
300
  assertCapabilityIsNotRetired(capabilityId);
301
+ await assertCapabilityBusinessEnabled(capabilityId, host);
277
302
  const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
278
303
  return gatewayOutput(await dryRunCapabilityWithEnvelope(host, gatewayDomain, capabilityId, parseCapabilityInput(opts.input)), host);
279
304
  });
@@ -287,6 +312,7 @@ Examples:
287
312
  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) => {
288
313
  await executeAndPrint(program, async (host, globalOpts) => {
289
314
  assertCapabilityIsNotRetired(capabilityId);
315
+ await assertCapabilityBusinessEnabled(capabilityId, host);
290
316
  const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
291
317
  const input = parseCapabilityInput(opts.input);
292
318
  if (globalOpts.validate && globalOpts.dryRun) {
@@ -322,6 +348,9 @@ Examples:
322
348
  ae-cli capability run analysis.dashboard.list --input input.json`
323
349
  );
324
350
  }
351
+ async function assertCapabilityBusinessEnabled(capabilityId, host) {
352
+ await assertBusinessEnabled(businessForCapability(capabilityId), host);
353
+ }
325
354
  function gatewayOutput(envelope, host) {
326
355
  return withOutputMetadata(withPageUrl(envelope.data, host), envelope.meta);
327
356
  }
@@ -365,7 +394,7 @@ function printCapabilityError(error, host) {
365
394
  );
366
395
  return;
367
396
  }
368
- if (error instanceof CredentialStoreUnreadableError) {
397
+ if (error instanceof CredentialStoreUnreadableError || error instanceof ExternalCliTokenError) {
369
398
  printError("config", error.message, error.hint, error.code);
370
399
  return;
371
400
  }
@@ -374,7 +403,7 @@ function printCapabilityError(error, host) {
374
403
  return;
375
404
  }
376
405
  if (error instanceof PermissionError) {
377
- printError("permission", error.message, void 0, error.code);
406
+ printError("permission", error.message, error.hint, error.code);
378
407
  return;
379
408
  }
380
409
  if (error instanceof CapabilityGatewayError) {
@@ -1,20 +1,20 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  require_lib
4
- } from "./chunk-CT7QDJS6.js";
4
+ } from "./chunk-QVRIDN42.js";
5
5
  import {
6
6
  require_archiver,
7
7
  require_string_decoder
8
- } from "./chunk-AP7YP2NX.js";
8
+ } from "./chunk-OAWPT7VP.js";
9
9
  import {
10
10
  require_inherits,
11
11
  require_node
12
- } from "./chunk-S6M42KND.js";
12
+ } from "./chunk-JEUXDY3B.js";
13
13
  import {
14
14
  __commonJS,
15
15
  __require,
16
16
  __toESM
17
- } from "./chunk-WNGFSIOB.js";
17
+ } from "./chunk-Z3Q2AEIN.js";
18
18
 
19
19
  // node_modules/exceljs/lib/utils/under-dash.js
20
20
  var require_under_dash = __commonJS({