@thinkingai/ae-cli 6.0.24 → 6.0.28

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 (185) hide show
  1. package/dist/{auth-A2XXG5K4.js → auth-7TQRGLBC.js} +10 -8
  2. package/dist/{auth-IDPKDFSY.js → auth-MEJ642P4.js} +2 -2
  3. package/dist/chunk-2NDGFQHW.js +190 -0
  4. package/dist/{chunk-NGJDCOYA.js → chunk-7QQ4233A.js} +3 -3
  5. package/dist/{chunk-PFJFZVCK.js → chunk-AJTH7LT3.js} +3 -2
  6. package/dist/{chunk-V5R5UIRM.js → chunk-BXMXMUD7.js} +65 -6
  7. package/dist/{chunk-AKORWVHJ.js → chunk-C4DH76LX.js} +1 -1
  8. package/dist/{chunk-NXJP4CES.js → chunk-GWZ5MYWE.js} +3 -3
  9. package/dist/{chunk-F3ZDMC2W.js → chunk-KCA6BA5D.js} +2 -2
  10. package/dist/{chunk-WXBCP6SD.js → chunk-KGJQCYVC.js} +1 -1
  11. package/dist/{chunk-FIT4CFIN.js → chunk-LG5YT7P7.js} +1 -1
  12. package/dist/{chunk-IDXW6MEJ.js → chunk-MDJGDI6K.js} +2 -2
  13. package/dist/{chunk-4FQ36OGO.js → chunk-R77JT7XD.js} +53 -6
  14. package/dist/{chunk-65DKFJZB.js → chunk-YCLVYFK7.js} +49 -6
  15. package/dist/{chunk-2OW2RENH.js → chunk-YNQFYBDB.js} +64 -6
  16. package/dist/{chunk-ONOA6DYB.js → chunk-ZAOL36CG.js} +1 -1
  17. package/dist/cli-token-TVQRSE46.js +18 -0
  18. package/dist/{client-7L735LVY.js → client-2643Z5AG.js} +3 -3
  19. package/dist/{config-SXD2JKSL.js → config-ZVPARN4R.js} +4 -9
  20. package/dist/index.js +24 -24
  21. package/dist/{metadata-QWUAX625.js → metadata-IPSPQBX3.js} +5 -5
  22. package/dist/{metadata-XWTEGEN2.js → metadata-N5REJ7R7.js} +5 -5
  23. package/dist/{model-3OVX42DA.js → model-T3KZJWLW.js} +2 -2
  24. package/dist/{raw-IANB4AV5.js → raw-OHSUK42D.js} +4 -4
  25. package/dist/{sync-4HQ3CXSK.js → sync-ULT5SECP.js} +3 -3
  26. package/dist/{te-agent-OYNNTJDU.js → te-agent-QLIVKRUN.js} +1146 -61
  27. package/dist/{te-analysis-JX3V76OI.js → te-analysis-5WZKVFHI.js} +1332 -338
  28. package/dist/{te-analysis-CRPFK3LX.js → te-analysis-KAEZXLNS.js} +1332 -338
  29. package/dist/{te-audience-RO2IZOUC.js → te-audience-PVMKQAFH.js} +5 -5
  30. package/dist/{te-audience-77FGNG5E.js → te-audience-XMRMVD2V.js} +5 -5
  31. package/dist/{te-common-4TRJPRC5.js → te-common-CFGQXTFV.js} +5 -5
  32. package/dist/{te-common-PUXBUPOL.js → te-common-SDB3O2QG.js} +5 -5
  33. package/dist/{te-community-XKE526DS.js → te-community-6A7LKYUH.js} +5 -5
  34. package/dist/{te-community-NPDZQKMY.js → te-community-GMWFGILT.js} +5 -5
  35. package/dist/{te-dataops-PW74WP76.js → te-dataops-6LIPYNGH.js} +90 -68
  36. package/dist/{te-dataops-6KWLFNV4.js → te-dataops-Z53CTG2U.js} +90 -68
  37. package/dist/{te-engage-HTLMUN7G.js → te-engage-AGREUOW7.js} +30 -15
  38. package/dist/{te-engage-YPQIVF5H.js → te-engage-MIIUKY6M.js} +30 -15
  39. package/dist/{te-kb-DOGDQIU4.js → te-kb-KQJ53M3A.js} +4 -4
  40. package/dist/{te-meta-5ESSQ5B3.js → te-meta-QLANJ4B4.js} +5 -5
  41. package/dist/{te-meta-Z47X4VT3.js → te-meta-TOA6FWDE.js} +5 -5
  42. package/dist/{te-team-SOVKZIDD.js → te-team-TQGMNHQQ.js} +5 -5
  43. package/package.json +3 -1
  44. package/skills/ae-agent/SKILL.md +158 -189
  45. package/skills/ae-agent/references/accept-skill-share.md +39 -0
  46. package/skills/ae-agent/references/add-attachment.md +57 -0
  47. package/skills/ae-agent/references/add-mcp.md +75 -0
  48. package/skills/ae-agent/references/add-model.md +70 -0
  49. package/skills/ae-agent/references/add-skill.md +71 -0
  50. package/skills/ae-agent/references/approve-skill.md +41 -0
  51. package/skills/ae-agent/references/attachment-stats.md +50 -0
  52. package/skills/ae-agent/references/auto-provision-mcp-credentials.md +57 -0
  53. package/skills/ae-agent/references/cancel-skill-submission.md +39 -0
  54. package/skills/ae-agent/references/copy-skill.md +53 -0
  55. package/skills/ae-agent/references/create-agent.md +71 -0
  56. package/skills/ae-agent/references/create-automation.md +99 -0
  57. package/skills/ae-agent/references/del-agent.md +38 -0
  58. package/skills/ae-agent/references/del-attachment.md +35 -0
  59. package/skills/ae-agent/references/del-mcp.md +35 -0
  60. package/skills/ae-agent/references/del-model.md +37 -0
  61. package/skills/ae-agent/references/del-skill-asset.md +41 -0
  62. package/skills/ae-agent/references/del-skill-reference.md +41 -0
  63. package/skills/ae-agent/references/del-skill-script.md +41 -0
  64. package/skills/ae-agent/references/del-skill.md +36 -0
  65. package/skills/ae-agent/references/edit-skill.md +64 -0
  66. package/skills/ae-agent/references/get-agent.md +37 -0
  67. package/skills/ae-agent/references/get-skill-content.md +36 -0
  68. package/skills/ae-agent/references/list-agents.md +40 -0
  69. package/skills/ae-agent/references/list-attachments.md +42 -0
  70. package/skills/ae-agent/references/list-automations.md +41 -0
  71. package/skills/ae-agent/references/list-mcp-credentials.md +65 -0
  72. package/skills/ae-agent/references/list-mcp-market.md +58 -0
  73. package/skills/ae-agent/references/list-mcps.md +37 -0
  74. package/skills/ae-agent/references/list-models.md +38 -0
  75. package/skills/ae-agent/references/list-skill-assets.md +35 -0
  76. package/skills/ae-agent/references/list-skill-market.md +59 -0
  77. package/skills/ae-agent/references/list-skill-references.md +36 -0
  78. package/skills/ae-agent/references/list-skill-scripts.md +35 -0
  79. package/skills/ae-agent/references/list-skill-shares.md +49 -0
  80. package/skills/ae-agent/references/list-skill-submissions.md +45 -0
  81. package/skills/ae-agent/references/list-skills.md +37 -0
  82. package/skills/ae-agent/references/mcp-auth-disconnect.md +50 -0
  83. package/skills/ae-agent/references/mcp-auth-start.md +61 -0
  84. package/skills/ae-agent/references/mcp-auth-status.md +56 -0
  85. package/skills/ae-agent/references/mcp-stats.md +68 -0
  86. package/skills/ae-agent/references/mcp-token.md +63 -0
  87. package/skills/ae-agent/references/mcp-tools.md +55 -0
  88. package/skills/ae-agent/references/read-skill-asset.md +51 -0
  89. package/skills/ae-agent/references/read-skill-reference.md +50 -0
  90. package/skills/ae-agent/references/read-skill-script.md +51 -0
  91. package/skills/ae-agent/references/reject-skill-share.md +37 -0
  92. package/skills/ae-agent/references/reject-skill.md +42 -0
  93. package/skills/ae-agent/references/rescan-skills.md +44 -0
  94. package/skills/ae-agent/references/set-mcp-credential.md +67 -0
  95. package/skills/ae-agent/references/set-mcp-meta.md +52 -0
  96. package/skills/ae-agent/references/set-skill-meta.md +51 -0
  97. package/skills/ae-agent/references/share-skill.md +50 -0
  98. package/skills/ae-agent/references/submit-skill.md +51 -0
  99. package/skills/ae-agent/references/test-model.md +61 -0
  100. package/skills/ae-agent/references/toggle-mcp.md +39 -0
  101. package/skills/ae-agent/references/toggle-model.md +37 -0
  102. package/skills/ae-agent/references/toggle-skill.md +37 -0
  103. package/skills/ae-agent/references/update-agent.md +71 -0
  104. package/skills/ae-agent/references/update-automation.md +83 -0
  105. package/skills/ae-agent/references/update-mcp.md +79 -0
  106. package/skills/ae-agent/references/update-model.md +77 -0
  107. package/skills/ae-agent/references/upload-skill-asset.md +49 -0
  108. package/skills/ae-agent/references/upload-skill-reference.md +51 -0
  109. package/skills/ae-agent/references/upload-skill-script.md +49 -0
  110. package/skills/ae-agent/references/upload-skill.md +89 -0
  111. package/skills/ae-analysis/SKILL.md +60 -6
  112. package/skills/ae-analysis/references/analysis_gateway_assets.md +27 -10
  113. package/skills/ae-analysis/references/artifact_download.md +17 -0
  114. package/skills/ae-analysis/references/asset_abnormal_get.md +27 -0
  115. package/skills/ae-analysis/references/asset_abnormal_list.md +24 -0
  116. package/skills/ae-analysis/references/asset_authentication_list.md +23 -0
  117. package/skills/ae-analysis/references/asset_authentication_update.md +24 -0
  118. package/skills/ae-analysis/references/asset_recent_list.md +24 -0
  119. package/skills/ae-analysis/references/asset_search.md +24 -0
  120. package/skills/ae-analysis/references/bi_panel_get.md +5 -0
  121. package/skills/ae-analysis/references/bi_panel_page_data_export.md +11 -1
  122. package/skills/ae-analysis/references/bi_panel_share.md +6 -0
  123. package/skills/ae-analysis/references/bi_panel_update.md +4 -1
  124. package/skills/ae-analysis/references/bi_panel_version_get.md +23 -0
  125. package/skills/ae-analysis/references/bi_panel_version_publish.md +20 -0
  126. package/skills/ae-analysis/references/dashboard_copy.md +3 -1
  127. package/skills/ae-analysis/references/dashboard_daily_report_send.md +9 -2
  128. package/skills/ae-analysis/references/dashboard_daily_report_update.md +3 -1
  129. package/skills/ae-analysis/references/dashboard_definition_export.md +21 -3
  130. package/skills/ae-analysis/references/dashboard_report_data_export.md +17 -1
  131. package/skills/ae-analysis/references/dashboard_report_data_run.md +6 -0
  132. package/skills/ae-analysis/references/datatable_columns_get.md +24 -0
  133. package/skills/ae-analysis/references/datatable_influence_list.md +24 -0
  134. package/skills/ae-analysis/references/datatable_version_get.md +24 -0
  135. package/skills/ae-analysis/references/datatable_version_list.md +24 -0
  136. package/skills/ae-analysis/references/event_changelog_list.md +24 -0
  137. package/skills/ae-analysis/references/event_create.md +24 -0
  138. package/skills/ae-analysis/references/event_delete.md +24 -0
  139. package/skills/ae-analysis/references/event_get.md +24 -0
  140. package/skills/ae-analysis/references/event_hide_update.md +25 -0
  141. package/skills/ae-analysis/references/event_influence_list.md +24 -0
  142. package/skills/ae-analysis/references/event_list.md +23 -0
  143. package/skills/ae-analysis/references/event_relation_update.md +24 -0
  144. package/skills/ae-analysis/references/event_update.md +26 -0
  145. package/skills/ae-analysis/references/exchange_config_update.md +24 -0
  146. package/skills/ae-analysis/references/exchange_rate_refresh.md +23 -0
  147. package/skills/ae-analysis/references/exchange_rule_list.md +23 -0
  148. package/skills/ae-analysis/references/exchange_rule_update.md +24 -0
  149. package/skills/ae-analysis/references/exchange_rule_validate.md +24 -0
  150. package/skills/ae-analysis/references/metric_create.md +24 -0
  151. package/skills/ae-analysis/references/metric_delete.md +24 -0
  152. package/skills/ae-analysis/references/metric_get.md +24 -0
  153. package/skills/ae-analysis/references/metric_list.md +24 -0
  154. package/skills/ae-analysis/references/metric_update.md +24 -0
  155. package/skills/ae-analysis/references/project_space_create.md +1 -1
  156. package/skills/ae-analysis/references/property_changelog_list.md +25 -0
  157. package/skills/ae-analysis/references/property_create.md +25 -0
  158. package/skills/ae-analysis/references/property_delete.md +25 -0
  159. package/skills/ae-analysis/references/property_get.md +25 -0
  160. package/skills/ae-analysis/references/property_hide_update.md +26 -0
  161. package/skills/ae-analysis/references/property_influence_list.md +25 -0
  162. package/skills/ae-analysis/references/property_list.md +24 -0
  163. package/skills/ae-analysis/references/property_related_events.md +24 -0
  164. package/skills/ae-analysis/references/property_relation_update.md +25 -0
  165. package/skills/ae-analysis/references/property_update.md +27 -0
  166. package/skills/ae-analysis/references/run_inspect.md +22 -0
  167. package/skills/ae-analysis/references/super_metadata_export.md +36 -0
  168. package/skills/ae-analysis/references/super_metadata_import.md +24 -0
  169. package/skills/ae-analysis/references/virtual_event_create.md +25 -0
  170. package/skills/ae-analysis/references/virtual_event_delete.md +24 -0
  171. package/skills/ae-analysis/references/virtual_event_get.md +24 -0
  172. package/skills/ae-analysis/references/virtual_property_create.md +24 -0
  173. package/skills/ae-analysis/references/virtual_property_sql_rule_delete.md +25 -0
  174. package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +24 -0
  175. package/skills/ae-dataops/references/dataops-flow-create.md +2 -2
  176. package/skills/ae-dataops/references/dataops-flow-monitor.md +3 -3
  177. package/skills/ae-dataops/references/dataops-integration.md +1 -0
  178. package/skills/ae-engage/references/flow-node-config-schema.md +32 -8
  179. package/skills/ae-engage/references/save-flow.md +65 -29
  180. package/skills/ae-engage/references/validate-flow-node-config.md +28 -10
  181. package/skills/ae-generate-tracking-code/SKILL.md +16 -1
  182. package/skills/ae-generate-tracking-code/references/snippet-delivery.md +17 -1
  183. package/skills/ae-generate-tracking-plan/SKILL.md +36 -12
  184. package/dist/chunk-OCQPQYHZ.js +0 -105
  185. package/dist/cli-token-OZXHC3U2.js +0 -14
@@ -66,9 +66,14 @@ var Logger = class {
66
66
  }
67
67
  this.info(parts.join(" | "));
68
68
  }
69
- /** Log command execution */
69
+ /** Log command execution (sensitive flags redacted to ***) */
70
70
  command(name, args) {
71
- const filtered = Object.entries(args).filter(([, v]) => v !== void 0 && v !== null && v !== "").map(([k, v]) => `--${k}=${JSON.stringify(v)}`).join(" ");
71
+ const SENSITIVE = ["token", "apikey", "secret", "accesstoken", "headers"];
72
+ const isSensitive = (k) => {
73
+ const lk = k.toLowerCase();
74
+ return SENSITIVE.some((s) => lk.includes(s));
75
+ };
76
+ const filtered = Object.entries(args).filter(([, v]) => v !== void 0 && v !== null && v !== "").map(([k, v]) => `--${k}=${isSensitive(k) ? "***" : JSON.stringify(v)}`).join(" ");
72
77
  this.info(`CMD ${name}${filtered ? " " + filtered : ""}`);
73
78
  }
74
79
  };
@@ -88,6 +93,15 @@ function safeReadJsonFile(filePath) {
88
93
  return safeJsonParse(content);
89
94
  }
90
95
 
96
+ // src/core/url-utils.ts
97
+ function normalizeUrl(url) {
98
+ if (!url) return url;
99
+ if (!url.startsWith("http://") && !url.startsWith("https://")) {
100
+ url = `https://${url}`;
101
+ }
102
+ return url.replace(/\/$/, "");
103
+ }
104
+
91
105
  // src/core/config.ts
92
106
  import fs3 from "fs";
93
107
  import path2 from "path";
@@ -159,16 +173,41 @@ function getFallbackCliToken(hostUrl) {
159
173
  function ensureDir() {
160
174
  if (!fs3.existsSync(CONFIG_DIR)) fs3.mkdirSync(CONFIG_DIR, { recursive: true });
161
175
  }
176
+ function dedupeNormalizedHosts(config) {
177
+ const hosts = {};
178
+ for (const [url, entry] of Object.entries(config.hosts)) {
179
+ const key = normalizeUrl(url);
180
+ if (!hosts[key]) {
181
+ hosts[key] = entry;
182
+ }
183
+ }
184
+ return {
185
+ activeHost: config.activeHost ? normalizeUrl(config.activeHost) : "",
186
+ hosts
187
+ };
188
+ }
189
+ function configNeedsNormalization(config) {
190
+ if (config.activeHost && normalizeUrl(config.activeHost) !== config.activeHost) return true;
191
+ const keys = Object.keys(config.hosts);
192
+ if (keys.some((url) => normalizeUrl(url) !== url)) return true;
193
+ return new Set(keys.map(normalizeUrl)).size !== keys.length;
194
+ }
162
195
  function loadConfig() {
163
196
  try {
164
197
  if (fs3.existsSync(CONFIG_FILE)) {
165
198
  const raw = safeReadJsonFile(CONFIG_FILE);
166
199
  if (raw.defaultHost && !raw.activeHost) {
167
- const migrated = migrateConfig(raw);
200
+ const migrated = dedupeNormalizedHosts(migrateConfig(raw));
168
201
  saveConfig(migrated);
169
202
  return migrated;
170
203
  }
171
- return raw;
204
+ const rawConfig = raw;
205
+ if (configNeedsNormalization(rawConfig)) {
206
+ const config = dedupeNormalizedHosts(rawConfig);
207
+ saveConfig(config);
208
+ return config;
209
+ }
210
+ return rawConfig;
172
211
  }
173
212
  } catch (err) {
174
213
  logger.error(`Error loading config: ${err.message}`);
@@ -181,11 +220,11 @@ function migrateConfig(old) {
181
220
  const oldHost = old.defaultHost;
182
221
  if (old.hosts) {
183
222
  for (const [key, val] of Object.entries(old.hosts)) {
184
- const url = key.startsWith("http") ? key : `https://${key}`;
223
+ const url = normalizeUrl(key.startsWith("http") ? key : `https://${key}`);
185
224
  hosts[url] = val;
186
225
  }
187
226
  }
188
- const activeHost = oldHost.startsWith("http") ? oldHost : `https://${oldHost}`;
227
+ const activeHost = normalizeUrl(oldHost.startsWith("http") ? oldHost : `https://${oldHost}`);
189
228
  if (!hosts[activeHost]) {
190
229
  hosts[activeHost] = { label: "default" };
191
230
  }
@@ -203,6 +242,7 @@ function getActiveHost() {
203
242
  return config.activeHost || "";
204
243
  }
205
244
  function setActiveHost(url) {
245
+ url = normalizeUrl(url);
206
246
  const config = loadConfig();
207
247
  if (!config.hosts[url]) {
208
248
  throw new Error(`Host ${url} is not in the configured hosts list. Add it first.`);
@@ -211,6 +251,7 @@ function setActiveHost(url) {
211
251
  saveConfig(config);
212
252
  }
213
253
  function addHost(url, label) {
254
+ url = normalizeUrl(url);
214
255
  const config = loadConfig();
215
256
  assertUniqueHostLabel(config, label, url);
216
257
  config.hosts[url] = { label };
@@ -226,6 +267,7 @@ function assertUniqueHostLabel(config, label, excludeUrl) {
226
267
  }
227
268
  }
228
269
  function removeHost(url) {
270
+ url = normalizeUrl(url);
229
271
  const config = loadConfig();
230
272
  delete config.hosts[url];
231
273
  if (config.activeHost === url) {
@@ -250,6 +292,7 @@ export {
250
292
  logger,
251
293
  safeJsonParse,
252
294
  safeReadJsonFile,
295
+ normalizeUrl,
253
296
  getSandboxRuntimeRoot,
254
297
  getSandboxClusterInfoFilePath,
255
298
  getFallbackCliToken,
@@ -4,11 +4,11 @@ import {
4
4
  import {
5
5
  clearCliToken,
6
6
  getCliToken
7
- } from "./chunk-OCQPQYHZ.js";
7
+ } from "./chunk-2NDGFQHW.js";
8
8
  import {
9
9
  logger,
10
10
  safeJsonParse
11
- } from "./chunk-65DKFJZB.js";
11
+ } from "./chunk-YCLVYFK7.js";
12
12
 
13
13
  // src/core/capability-api.ts
14
14
  import { readFile } from "fs/promises";
@@ -48,6 +48,9 @@ async function permissionMessage(resp) {
48
48
  }
49
49
  return "Permission denied for this resource (HTTP 403)";
50
50
  }
51
+ function isInvalidCliTokenMessage(message) {
52
+ return /\byour token is invalid\b/i.test(message) || /\bcli[-_\s]?token\b.*\binvalid\b/i.test(message) || /\binvalid\b.*\bcli[-_\s]?token\b/i.test(message);
53
+ }
51
54
  function parseCapabilityResponse(text) {
52
55
  if (!text) return void 0;
53
56
  try {
@@ -118,15 +121,28 @@ async function requestMultipartOnce(url, token, form) {
118
121
  body: form
119
122
  });
120
123
  }
124
+ async function requestDownloadOnce(url, token) {
125
+ return fetch(url, {
126
+ method: "GET",
127
+ headers: {
128
+ "cli-token": token,
129
+ "Accept": "*/*"
130
+ }
131
+ });
132
+ }
121
133
  async function callGateway(host, domain, pathAfterV1, method, body) {
122
134
  const url = buildCapabilityGatewayUrl(host, domain, pathAfterV1);
123
135
  const token = await getCliToken(host);
124
136
  let resp = await requestOnce(url, method, token, body);
137
+ let permissionMsg;
125
138
  if (resp.status === 403) {
126
- throw new PermissionError(await permissionMessage(resp));
139
+ permissionMsg = await permissionMessage(resp);
140
+ if (!isInvalidCliTokenMessage(permissionMsg)) {
141
+ throw new PermissionError(permissionMsg);
142
+ }
127
143
  }
128
- if (resp.status === 401) {
129
- logger.warn(`Capability gateway request failed (HTTP 401) for ${host}, refreshing CLI token`);
144
+ if (resp.status === 401 || resp.status === 403 && permissionMsg) {
145
+ logger.warn(`Capability gateway request failed (${resp.status === 403 ? permissionMsg : "HTTP 401"}) for ${host}, refreshing CLI token`);
130
146
  clearCliToken(host);
131
147
  const newToken = await getCliToken(host);
132
148
  process.stderr.write(`[ae-cli] CLI token refreshed for ${host}
@@ -183,11 +199,53 @@ async function uploadInputFileBytes(host, domain, projectId, purpose, bytes, fil
183
199
  }
184
200
  return unwrapCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
185
201
  }
202
+ async function downloadCapabilityArtifact(host, domain, runId, artifactId) {
203
+ const url = buildCapabilityGatewayUrl(
204
+ host,
205
+ domain,
206
+ `runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(artifactId)}/download`
207
+ );
208
+ const token = await getCliToken(host);
209
+ let resp = await requestDownloadOnce(url, token);
210
+ if (resp.status === 403) {
211
+ throw new PermissionError(await permissionMessage(resp));
212
+ }
213
+ if (resp.status === 401) {
214
+ logger.warn(`Capability gateway artifact download failed (HTTP 401) for ${host}, refreshing CLI token`);
215
+ clearCliToken(host);
216
+ const newToken = await getCliToken(host);
217
+ process.stderr.write(`[ae-cli] CLI token refreshed for ${host}
218
+ `);
219
+ resp = await requestDownloadOnce(url, newToken);
220
+ if (resp.status === 403) {
221
+ throw new PermissionError(await permissionMessage(resp));
222
+ }
223
+ if (!resp.ok) {
224
+ await throwCapabilityHttpError(resp);
225
+ }
226
+ } else if (!resp.ok) {
227
+ await throwCapabilityHttpError(resp);
228
+ }
229
+ return {
230
+ bytes: Buffer.from(await resp.arrayBuffer()),
231
+ contentType: resp.headers.get("content-type") ?? void 0,
232
+ contentDisposition: resp.headers.get("content-disposition") ?? void 0
233
+ };
234
+ }
235
+ async function callCapabilityApi(host, domain, action, method = "POST", params = {}) {
236
+ const isGet = method === "GET";
237
+ if (isGet) {
238
+ return callGateway(host, domain, action.replace(/^\/+|\/+$/g, ""), "GET");
239
+ }
240
+ return callGateway(host, domain, action.replace(/^\/+|\/+$/g, ""), method, params);
241
+ }
186
242
 
187
243
  export {
188
244
  CapabilityGatewayError,
189
245
  buildCapabilityGatewayUrl,
190
246
  executeCapability,
191
247
  uploadInputFile,
192
- uploadInputFileBytes
248
+ uploadInputFileBytes,
249
+ downloadCapabilityArtifact,
250
+ callCapabilityApi
193
251
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-65DKFJZB.js";
3
+ } from "./chunk-YCLVYFK7.js";
4
4
 
5
5
  // src/framework/output.ts
6
6
  import Table from "cli-table3";
@@ -0,0 +1,18 @@
1
+ import {
2
+ _resetRenewMemoryForTest,
3
+ clearCliToken,
4
+ getCliToken,
5
+ localRenewDate,
6
+ mintCliToken,
7
+ setCliTokenManual
8
+ } from "./chunk-2NDGFQHW.js";
9
+ import "./chunk-AJTH7LT3.js";
10
+ import "./chunk-YCLVYFK7.js";
11
+ export {
12
+ _resetRenewMemoryForTest,
13
+ clearCliToken,
14
+ getCliToken,
15
+ localRenewDate,
16
+ mintCliToken,
17
+ setCliTokenManual
18
+ };
@@ -7,9 +7,9 @@ import {
7
7
  queryReportData,
8
8
  querySql,
9
9
  wsQuery
10
- } from "./chunk-F3ZDMC2W.js";
11
- import "./chunk-PFJFZVCK.js";
12
- import "./chunk-65DKFJZB.js";
10
+ } from "./chunk-KCA6BA5D.js";
11
+ import "./chunk-AJTH7LT3.js";
12
+ import "./chunk-YCLVYFK7.js";
13
13
  export {
14
14
  httpDelete,
15
15
  httpGet,
@@ -1,19 +1,20 @@
1
1
  import {
2
2
  printError,
3
3
  printOutput
4
- } from "./chunk-ONOA6DYB.js";
4
+ } from "./chunk-ZAOL36CG.js";
5
5
  import {
6
6
  GLOBAL_QUERY_CONFIG_KEY,
7
7
  getAnalysisMappingPathForClusterMode,
8
8
  getClusterInfoFilePath,
9
9
  isGlobalQueryModeEnabled,
10
10
  setGlobalQueryModeEnabled
11
- } from "./chunk-WXBCP6SD.js";
11
+ } from "./chunk-KGJQCYVC.js";
12
12
  import {
13
13
  addHost,
14
14
  loadConfig,
15
+ normalizeUrl,
15
16
  setActiveHost
16
- } from "./chunk-65DKFJZB.js";
17
+ } from "./chunk-YCLVYFK7.js";
17
18
 
18
19
  // src/commands/config.ts
19
20
  function registerConfig(program) {
@@ -119,12 +120,6 @@ function failConfig(message, hint) {
119
120
  printError("config", message, hint);
120
121
  process.exitCode = 1;
121
122
  }
122
- function normalizeUrl(url) {
123
- if (!url.startsWith("http://") && !url.startsWith("https://")) {
124
- url = `https://${url}`;
125
- }
126
- return url.replace(/\/$/, "");
127
- }
128
123
  export {
129
124
  registerConfig
130
125
  };
package/dist/index.js CHANGED
@@ -1,33 +1,33 @@
1
1
  import {
2
2
  TeAgentApiError,
3
3
  TeAgentCredentialsError
4
- } from "./chunk-4FQ36OGO.js";
4
+ } from "./chunk-R77JT7XD.js";
5
5
  import {
6
6
  printError,
7
7
  printOutput
8
- } from "./chunk-ONOA6DYB.js";
8
+ } from "./chunk-ZAOL36CG.js";
9
9
  import {
10
10
  CapabilityGatewayError,
11
11
  executeCapability,
12
12
  uploadInputFileBytes
13
- } from "./chunk-2OW2RENH.js";
13
+ } from "./chunk-YNQFYBDB.js";
14
14
  import {
15
15
  PermissionError
16
16
  } from "./chunk-NOO24N7W.js";
17
17
  import {
18
18
  clearCliToken,
19
19
  getCliToken
20
- } from "./chunk-OCQPQYHZ.js";
20
+ } from "./chunk-2NDGFQHW.js";
21
21
  import {
22
22
  SecureStoreAuthError,
23
23
  resolveHost
24
- } from "./chunk-PFJFZVCK.js";
24
+ } from "./chunk-AJTH7LT3.js";
25
25
  import {
26
26
  getActiveHost,
27
27
  getConfigDir,
28
28
  logger,
29
29
  safeJsonParse
30
- } from "./chunk-65DKFJZB.js";
30
+ } from "./chunk-YCLVYFK7.js";
31
31
 
32
32
  // src/index.ts
33
33
  import { Command as CommanderCommand } from "commander";
@@ -120,7 +120,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
120
120
  let _clientModule = null;
121
121
  async function getClient() {
122
122
  if (!_clientModule) {
123
- _clientModule = await import("./client-7L735LVY.js");
123
+ _clientModule = await import("./client-2643Z5AG.js");
124
124
  }
125
125
  return _clientModule;
126
126
  }
@@ -168,7 +168,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
168
168
  return client.queryReportData(projectId, reportId, qp, eventModel, options, ctx.host());
169
169
  },
170
170
  async token() {
171
- const { getToken } = await import("./auth-IDPKDFSY.js");
171
+ const { getToken } = await import("./auth-MEJ642P4.js");
172
172
  return getToken(ctx.host());
173
173
  },
174
174
  host() {
@@ -3001,57 +3001,57 @@ program.name("ae-cli").version(version).description("CLI tool for ThinkingAI (AE
3001
3001
  async function loadCommands() {
3002
3002
  const commands = [];
3003
3003
  try {
3004
- const teAnalysis = await import("./te-analysis-CRPFK3LX.js");
3004
+ const teAnalysis = await import("./te-analysis-KAEZXLNS.js");
3005
3005
  commands.push(...teAnalysis.default);
3006
3006
  } catch {
3007
3007
  }
3008
3008
  try {
3009
- const teAudience = await import("./te-audience-RO2IZOUC.js");
3009
+ const teAudience = await import("./te-audience-PVMKQAFH.js");
3010
3010
  commands.push(...teAudience.default);
3011
3011
  } catch {
3012
3012
  }
3013
3013
  try {
3014
- const teMeta = await import("./te-meta-5ESSQ5B3.js");
3014
+ const teMeta = await import("./te-meta-TOA6FWDE.js");
3015
3015
  commands.push(...teMeta.default);
3016
3016
  } catch {
3017
3017
  }
3018
3018
  try {
3019
- const teCommon = await import("./te-common-PUXBUPOL.js");
3019
+ const teCommon = await import("./te-common-CFGQXTFV.js");
3020
3020
  commands.push(...teCommon.default);
3021
3021
  } catch {
3022
3022
  }
3023
3023
  try {
3024
- const engage = await import("./te-engage-YPQIVF5H.js");
3024
+ const engage = await import("./te-engage-AGREUOW7.js");
3025
3025
  commands.push(...engage.default);
3026
3026
  } catch {
3027
3027
  }
3028
3028
  try {
3029
- const community = await import("./te-community-NPDZQKMY.js");
3029
+ const community = await import("./te-community-6A7LKYUH.js");
3030
3030
  commands.push(...community.default);
3031
3031
  } catch {
3032
3032
  }
3033
3033
  try {
3034
- const dataops = await import("./te-dataops-6KWLFNV4.js");
3034
+ const dataops = await import("./te-dataops-Z53CTG2U.js");
3035
3035
  commands.push(...dataops.default);
3036
3036
  } catch {
3037
3037
  }
3038
3038
  try {
3039
- const teKb = await import("./te-kb-DOGDQIU4.js");
3039
+ const teKb = await import("./te-kb-KQJ53M3A.js");
3040
3040
  commands.push(...teKb.default);
3041
3041
  } catch {
3042
3042
  }
3043
3043
  try {
3044
- const teTeam = await import("./te-team-SOVKZIDD.js");
3044
+ const teTeam = await import("./te-team-TQGMNHQQ.js");
3045
3045
  commands.push(...teTeam.default);
3046
3046
  } catch {
3047
3047
  }
3048
3048
  try {
3049
- const teAgent = await import("./te-agent-OYNNTJDU.js");
3049
+ const teAgent = await import("./te-agent-QLIVKRUN.js");
3050
3050
  commands.push(...teAgent.default);
3051
3051
  } catch {
3052
3052
  }
3053
3053
  try {
3054
- const metadata = await import("./metadata-XWTEGEN2.js");
3054
+ const metadata = await import("./metadata-IPSPQBX3.js");
3055
3055
  commands.push(...metadata.default);
3056
3056
  } catch {
3057
3057
  }
@@ -3059,35 +3059,35 @@ async function loadCommands() {
3059
3059
  }
3060
3060
  async function registerAuthCommands() {
3061
3061
  try {
3062
- const { registerAuth } = await import("./auth-A2XXG5K4.js");
3062
+ const { registerAuth } = await import("./auth-7TQRGLBC.js");
3063
3063
  registerAuth(program);
3064
3064
  } catch {
3065
3065
  }
3066
3066
  }
3067
3067
  async function registerConfigCommands() {
3068
3068
  try {
3069
- const { registerConfig } = await import("./config-SXD2JKSL.js");
3069
+ const { registerConfig } = await import("./config-ZVPARN4R.js");
3070
3070
  registerConfig(program);
3071
3071
  } catch {
3072
3072
  }
3073
3073
  }
3074
3074
  async function registerApiCommand() {
3075
3075
  try {
3076
- const { registerApi } = await import("./raw-IANB4AV5.js");
3076
+ const { registerApi } = await import("./raw-OHSUK42D.js");
3077
3077
  registerApi(program);
3078
3078
  } catch {
3079
3079
  }
3080
3080
  }
3081
3081
  async function registerSyncCommand() {
3082
3082
  try {
3083
- const { registerSync } = await import("./sync-4HQ3CXSK.js");
3083
+ const { registerSync } = await import("./sync-ULT5SECP.js");
3084
3084
  registerSync(program);
3085
3085
  } catch {
3086
3086
  }
3087
3087
  }
3088
3088
  async function registerModelCommand() {
3089
3089
  try {
3090
- const { registerModel } = await import("./model-3OVX42DA.js");
3090
+ const { registerModel } = await import("./model-T3KZJWLW.js");
3091
3091
  registerModel(program);
3092
3092
  } catch {
3093
3093
  }
@@ -2,15 +2,15 @@ import {
2
2
  createCapabilityCommand,
3
3
  registerCapabilityGatewayRoute,
4
4
  resolveGatewayDomain
5
- } from "./chunk-AKORWVHJ.js";
5
+ } from "./chunk-LG5YT7P7.js";
6
6
  import {
7
7
  buildCapabilityGatewayUrl,
8
8
  uploadInputFile
9
- } from "./chunk-V5R5UIRM.js";
9
+ } from "./chunk-YNQFYBDB.js";
10
10
  import "./chunk-NOO24N7W.js";
11
- import "./chunk-OCQPQYHZ.js";
12
- import "./chunk-PFJFZVCK.js";
13
- import "./chunk-65DKFJZB.js";
11
+ import "./chunk-2NDGFQHW.js";
12
+ import "./chunk-AJTH7LT3.js";
13
+ import "./chunk-YCLVYFK7.js";
14
14
 
15
15
  // src/commands/metadata/shared.ts
16
16
  function createCapabilityCommand2(config) {
@@ -2,15 +2,15 @@ import {
2
2
  createCapabilityCommand,
3
3
  registerCapabilityGatewayRoute,
4
4
  resolveGatewayDomain
5
- } from "./chunk-FIT4CFIN.js";
5
+ } from "./chunk-C4DH76LX.js";
6
6
  import {
7
7
  buildCapabilityGatewayUrl,
8
8
  uploadInputFile
9
- } from "./chunk-2OW2RENH.js";
9
+ } from "./chunk-BXMXMUD7.js";
10
10
  import "./chunk-NOO24N7W.js";
11
- import "./chunk-OCQPQYHZ.js";
12
- import "./chunk-PFJFZVCK.js";
13
- import "./chunk-65DKFJZB.js";
11
+ import "./chunk-2NDGFQHW.js";
12
+ import "./chunk-AJTH7LT3.js";
13
+ import "./chunk-YCLVYFK7.js";
14
14
 
15
15
  // src/commands/metadata/shared.ts
16
16
  function createCapabilityCommand2(config) {
@@ -9,8 +9,8 @@ import {
9
9
  getClaudeConfigDir,
10
10
  getSandboxModels,
11
11
  postSandboxModelSelection
12
- } from "./chunk-4FQ36OGO.js";
13
- import "./chunk-65DKFJZB.js";
12
+ } from "./chunk-R77JT7XD.js";
13
+ import "./chunk-YCLVYFK7.js";
14
14
 
15
15
  // src/commands/model/index.ts
16
16
  import { existsSync, readFileSync } from "fs";
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  printError,
3
3
  printOutput
4
- } from "./chunk-ONOA6DYB.js";
4
+ } from "./chunk-ZAOL36CG.js";
5
5
  import {
6
6
  httpGet,
7
7
  httpPost
8
- } from "./chunk-F3ZDMC2W.js";
8
+ } from "./chunk-KCA6BA5D.js";
9
9
  import {
10
10
  SecureStoreAuthError,
11
11
  resolveHost
12
- } from "./chunk-PFJFZVCK.js";
12
+ } from "./chunk-AJTH7LT3.js";
13
13
  import {
14
14
  safeJsonParse
15
- } from "./chunk-65DKFJZB.js";
15
+ } from "./chunk-YCLVYFK7.js";
16
16
 
17
17
  // src/api/raw.ts
18
18
  function registerApi(program) {
@@ -19,11 +19,11 @@ import {
19
19
  getSandboxSyncPullCandidates,
20
20
  postSandboxSyncPull,
21
21
  postToMainApp
22
- } from "./chunk-4FQ36OGO.js";
22
+ } from "./chunk-R77JT7XD.js";
23
23
  import {
24
24
  printError
25
- } from "./chunk-ONOA6DYB.js";
26
- import "./chunk-65DKFJZB.js";
25
+ } from "./chunk-ZAOL36CG.js";
26
+ import "./chunk-YCLVYFK7.js";
27
27
 
28
28
  // src/commands/sync/index.ts
29
29
  import Table from "cli-table3";