@thinkingai/ae-cli 6.0.32 → 6.0.34

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 (201) hide show
  1. package/README.md +3 -2
  2. package/README.zh.md +3 -2
  3. package/dist/{auth-MEJ642P4.js → auth-ENM3FE6L.js} +3 -2
  4. package/dist/{auth-7H3HAAJ3.js → auth-UPGUOKTW.js} +13 -6
  5. package/dist/{capability-QW4AVJHI.js → capability-AJC5CBRT.js} +49 -17
  6. package/dist/{capability-SCRFGODD.js → capability-TQ5KU5Q6.js} +49 -17
  7. package/dist/chunk-24BAVOX3.js +51 -0
  8. package/dist/{chunk-MDJGDI6K.js → chunk-3KI3RRXX.js} +5 -5
  9. package/dist/{chunk-PKRD2IEM.js → chunk-3P3562ZX.js} +9 -7
  10. package/dist/{chunk-R77JT7XD.js → chunk-4Q5TNP4Q.js} +4 -4
  11. package/dist/{chunk-7OLGDQQ2.js → chunk-6CHYBI64.js} +2 -2
  12. package/dist/{chunk-6LEYLOV3.js → chunk-CPVTECJ3.js} +9 -7
  13. package/dist/{chunk-KCA6BA5D.js → chunk-DB4Q3ANU.js} +5 -3
  14. package/dist/{chunk-2NDGFQHW.js → chunk-E7UXXHO3.js} +11 -3
  15. package/dist/{chunk-I4A62X3N.js → chunk-HQ2A7ITL.js} +23 -14
  16. package/dist/chunk-IMMGMU54.js +674 -0
  17. package/dist/{chunk-AJTH7LT3.js → chunk-IR4ZLVPW.js} +4 -2
  18. package/dist/{chunk-TBHBYKXZ.js → chunk-ISY6HMHM.js} +2 -2
  19. package/dist/{chunk-KGJQCYVC.js → chunk-LCXU3AAT.js} +4 -2
  20. package/dist/chunk-LYVNONC4.js +86 -0
  21. package/dist/{chunk-DYOS6YY7.js → chunk-RGXCNC4N.js} +23 -14
  22. package/dist/{chunk-YCLVYFK7.js → chunk-V6FR6WTW.js} +45 -87
  23. package/dist/chunk-VTWMIC5L.js +27 -0
  24. package/dist/{cli-token-TVQRSE46.js → cli-token-4SBMXAUK.js} +6 -3
  25. package/dist/{client-2643Z5AG.js → client-PP5FETMW.js} +4 -3
  26. package/dist/community-report-client-KK2QBANO.js +145 -0
  27. package/dist/{config-7UZWDE74.js → config-RCCGHHYA.js} +6 -3
  28. package/dist/index.js +505 -220
  29. package/dist/{metadata-BFDL6RUK.js → metadata-3M5F2AED.js} +14 -13
  30. package/dist/{metadata-FCLDBXX2.js → metadata-W2MEOI4Z.js} +14 -13
  31. package/dist/{model-T3KZJWLW.js → model-OYQLXCQY.js} +3 -2
  32. package/dist/{raw-CN542NGT.js → raw-TPB7KSZO.js} +6 -4
  33. package/dist/{sync-ERNHDPB5.js → sync-EFJKFZK2.js} +6 -3
  34. package/dist/{te-agent-FCCWUDTJ.js → te-agent-K2OWMZXT.js} +3 -2
  35. package/dist/{te-analysis-PUVF5IF4.js → te-analysis-I73ZS4NK.js} +903 -33
  36. package/dist/{te-analysis-UJDOKPAN.js → te-analysis-Q7AZCDU4.js} +903 -33
  37. package/dist/{te-common-XLAGWNIV.js → te-common-ST3QPSXJ.js} +7 -6
  38. package/dist/{te-common-VUX3VOXZ.js → te-common-WSLIKKPC.js} +7 -6
  39. package/dist/te-community-WXGB6IOX.js +1659 -0
  40. package/dist/te-community-X2AHXGCA.js +1659 -0
  41. package/dist/{te-dataops-ZNJBQ6VT.js → te-dataops-MJV54MNY.js} +10 -8
  42. package/dist/{te-dataops-F36T656A.js → te-dataops-OA7I6HBG.js} +10 -8
  43. package/dist/{te-engage-QBCCME22.js → te-engage-2FSDUOIZ.js} +973 -1585
  44. package/dist/{te-engage-K4AEUPK5.js → te-engage-BMJ6UOUU.js} +973 -1585
  45. package/dist/{te-kb-AYCODNU6.js → te-kb-E7NSCBRB.js} +74 -12
  46. package/dist/{te-meta-UUROEODR.js → te-meta-Q4L6EE3Q.js} +7 -6
  47. package/dist/{te-meta-ARDIW3YI.js → te-meta-VHCN4Q62.js} +7 -6
  48. package/dist/{te-team-OKCOX7OE.js → te-team-PDKKW7Q5.js} +7 -6
  49. package/dist/tracking/i18n/resources/cli/en.json +4 -3
  50. package/dist/tracking/i18n/resources/cli/ja.json +4 -3
  51. package/dist/tracking/i18n/resources/cli/ko.json +4 -3
  52. package/dist/tracking/i18n/resources/cli/zh.json +4 -3
  53. package/package.json +6 -2
  54. package/skills/ae-agent/SKILL.md +2 -1
  55. package/skills/ae-analysis/SKILL.md +12 -1
  56. package/skills/ae-analysis/references/adhoc_export.md +2 -0
  57. package/skills/ae-analysis/references/adhoc_run.md +2 -0
  58. package/skills/ae-analysis/references/alert_create.md +25 -0
  59. package/skills/ae-analysis/references/alert_definition_schema_get.md +24 -0
  60. package/skills/ae-analysis/references/alert_delete.md +26 -0
  61. package/skills/ae-analysis/references/alert_detail_list.md +27 -0
  62. package/skills/ae-analysis/references/alert_get.md +25 -0
  63. package/skills/ae-analysis/references/alert_job_list.md +24 -0
  64. package/skills/ae-analysis/references/alert_list.md +27 -0
  65. package/skills/ae-analysis/references/alert_notice_config_list.md +24 -0
  66. package/skills/ae-analysis/references/alert_start.md +25 -0
  67. package/skills/ae-analysis/references/alert_stop.md +25 -0
  68. package/skills/ae-analysis/references/alert_update.md +26 -0
  69. package/skills/ae-analysis/references/bi_panel_create.md +3 -3
  70. package/skills/ae-analysis/references/check_delete.md +27 -0
  71. package/skills/ae-analysis/references/check_export.md +27 -0
  72. package/skills/ae-analysis/references/check_get.md +27 -0
  73. package/skills/ae-analysis/references/check_list.md +24 -0
  74. package/skills/ae-analysis/references/check_retry.md +27 -0
  75. package/skills/ae-analysis/references/check_run.md +25 -0
  76. package/skills/ae-analysis/references/command_index.md +61 -27
  77. package/skills/ae-analysis/references/dashboard_create.md +3 -3
  78. package/skills/ae-analysis/references/dashboard_daily_report_send.md +1 -0
  79. package/skills/ae-analysis/references/dashboard_daily_report_update.md +2 -0
  80. package/skills/ae-analysis/references/dashboard_report_data_export.md +3 -3
  81. package/skills/ae-analysis/references/dashboard_report_data_run.md +3 -3
  82. package/skills/ae-analysis/references/event_blacklist_add.md +25 -0
  83. package/skills/ae-analysis/references/event_blacklist_list.md +24 -0
  84. package/skills/ae-analysis/references/event_blacklist_update.md +26 -0
  85. package/skills/ae-analysis/references/ingest_error_list.md +27 -0
  86. package/skills/ae-analysis/references/ingest_summary.md +26 -0
  87. package/skills/ae-analysis/references/live_data_export.md +27 -0
  88. package/skills/ae-analysis/references/live_data_list.md +27 -0
  89. package/skills/ae-analysis/references/plan_change_log_export.md +27 -0
  90. package/skills/ae-analysis/references/plan_change_log_list.md +24 -0
  91. package/skills/ae-analysis/references/plan_delete_items.md +30 -0
  92. package/skills/ae-analysis/references/plan_export.md +26 -0
  93. package/skills/ae-analysis/references/plan_generate.md +27 -0
  94. package/skills/ae-analysis/references/plan_get.md +24 -0
  95. package/skills/ae-analysis/references/plan_import_excel.md +26 -0
  96. package/skills/ae-analysis/references/plan_save_items.md +27 -0
  97. package/skills/ae-analysis/references/plan_sync_from_meta.md +24 -0
  98. package/skills/ae-analysis/references/project_role_delete.md +4 -3
  99. package/skills/ae-analysis/references/project_role_get.md +4 -3
  100. package/skills/ae-analysis/references/project_role_user_list.md +4 -3
  101. package/skills/ae-analysis/references/query_create_result_cluster.md +2 -1
  102. package/skills/ae-analysis/references/report_data_export.md +3 -1
  103. package/skills/ae-analysis/references/report_data_run.md +12 -2
  104. package/skills/ae-analysis/references/sdk_sample_generate.md +24 -0
  105. package/skills/ae-analysis/references/user_cluster_create.md +2 -0
  106. package/skills/ae-analysis/references/user_cluster_create_id.md +2 -0
  107. package/skills/ae-analysis/references/user_cluster_update.md +2 -0
  108. package/skills/ae-analysis/references/user_cluster_update_id.md +2 -0
  109. package/skills/ae-analysis/references/user_tag_create.md +2 -0
  110. package/skills/ae-analysis/references/user_tag_create_id.md +2 -0
  111. package/skills/ae-analysis/references/user_tag_update.md +2 -0
  112. package/skills/ae-analysis/references/user_tag_update_id.md +2 -0
  113. package/skills/ae-analysis-global/SKILL.md +2 -0
  114. package/skills/ae-capability/SKILL.md +7 -5
  115. package/skills/ae-community/SKILL.md +72 -8
  116. package/skills/ae-community/references/community-chat-analysis.md +341 -0
  117. package/skills/ae-community/references/community-data-report.md +301 -0
  118. package/skills/ae-dataops/SKILL.md +2 -1
  119. package/skills/ae-engage/SKILL.md +129 -105
  120. package/skills/ae-engage/references/activity-activity-type.md +1 -1
  121. package/skills/ae-engage/references/activity-activity.md +1 -1
  122. package/skills/ae-engage/references/activity-approval.md +5 -7
  123. package/skills/ae-engage/references/activity-task.md +12 -18
  124. package/skills/ae-engage/references/activity-topic.md +39 -22
  125. package/skills/ae-engage/references/add-approver.md +4 -4
  126. package/skills/ae-engage/references/add-channel.md +10 -5
  127. package/skills/ae-engage/references/approval-approver-delete.md +1 -1
  128. package/skills/ae-engage/references/approver-list.md +4 -4
  129. package/skills/ae-engage/references/build-task-save-guide.md +13 -13
  130. package/skills/ae-engage/references/cancel-query-by-request-id.md +7 -6
  131. package/skills/ae-engage/references/channel-detail.md +14 -9
  132. package/skills/ae-engage/references/channel-list.md +15 -10
  133. package/skills/ae-engage/references/channel-mgmt.md +109 -0
  134. package/skills/ae-engage/references/channel-test-send.md +1 -1
  135. package/skills/ae-engage/references/channel-update-config.md +1 -1
  136. package/skills/ae-engage/references/channel_touch_limits_list.md +1 -1
  137. package/skills/ae-engage/references/client-param.md +34 -16
  138. package/skills/ae-engage/references/common-metric.md +85 -18
  139. package/skills/ae-engage/references/config-item-analysis-report.md +8 -27
  140. package/skills/ae-engage/references/config-item-strategy-comparison.md +7 -18
  141. package/skills/ae-engage/references/config-item-trigger-report.md +8 -35
  142. package/skills/ae-engage/references/delete-channel.md +5 -5
  143. package/skills/ae-engage/references/delete-flow.md +5 -5
  144. package/skills/ae-engage/references/flow-ab-split-node-report.md +11 -45
  145. package/skills/ae-engage/references/flow-detail.md +15 -10
  146. package/skills/ae-engage/references/flow-list.md +9 -4
  147. package/skills/ae-engage/references/flow-node-config-schema.md +9 -8
  148. package/skills/ae-engage/references/flow-node-detail-report.md +11 -46
  149. package/skills/ae-engage/references/flow-node-overview-report.md +11 -43
  150. package/skills/ae-engage/references/flow-process-report.md +12 -50
  151. package/skills/ae-engage/references/flow-update-remark.md +19 -0
  152. package/skills/ae-engage/references/manage-flow.md +19 -19
  153. package/skills/ae-engage/references/manage-task.md +5 -5
  154. package/skills/ae-engage/references/modify-flow-base-info.md +8 -8
  155. package/skills/ae-engage/references/preset-event.md +1 -1
  156. package/skills/ae-engage/references/push-language.md +1 -1
  157. package/skills/ae-engage/references/save-flow.md +54 -52
  158. package/skills/ae-engage/references/save-task.md +23 -17
  159. package/skills/ae-engage/references/scene-config-channel.md +90 -10
  160. package/skills/ae-engage/references/scene-config-group.md +1 -1
  161. package/skills/ae-engage/references/scene-config-item.md +27 -4
  162. package/skills/ae-engage/references/scene-config-metric.md +1 -1
  163. package/skills/ae-engage/references/scene-config-param.md +2 -2
  164. package/skills/ae-engage/references/scene-preset-metric.md +1 -1
  165. package/skills/ae-engage/references/scene-strategy.md +19 -3
  166. package/skills/ae-engage/references/scene-template.md +10 -4
  167. package/skills/ae-engage/references/task-data-detail.md +5 -67
  168. package/skills/ae-engage/references/task-data-overview.md +5 -35
  169. package/skills/ae-engage/references/task-detail.md +5 -5
  170. package/skills/ae-engage/references/task-experiment-report.md +5 -38
  171. package/skills/ae-engage/references/task-list.md +4 -4
  172. package/skills/ae-engage/references/task-metric-detail.md +5 -43
  173. package/skills/ae-engage/references/task-stats.md +5 -5
  174. package/skills/ae-engage/references/update-channel-status.md +6 -6
  175. package/skills/ae-engage/references/validate-flow-node-config.md +12 -11
  176. package/skills/ae-engage/references/whitelist-list.md +4 -4
  177. package/skills/ae-engage/references/whitelist.md +1 -1
  178. package/skills/ae-engage/references/workbench-workbench.md +1 -1
  179. package/skills/ae-generate-tracking-code/SKILL.md +4 -4
  180. package/skills/ae-generate-tracking-plan/SKILL.md +132 -11
  181. package/skills/ae-generate-tracking-plan/references/business-dimension-mapping.md +98 -33
  182. package/skills/ae-generate-tracking-plan/references/xlsx-schema.md +16 -14
  183. package/skills/ae-kb/SKILL.md +11 -6
  184. package/skills/ae-metadata/SKILL.md +2 -1
  185. package/skills/ae-team/SKILL.md +2 -1
  186. package/dist/chunk-NOO24N7W.js +0 -11
  187. package/dist/chunk-TNW2CI4W.js +0 -129
  188. package/dist/te-community-PEZ2VEF7.js +0 -687
  189. package/dist/te-community-TSKJ652U.js +0 -687
  190. package/skills/ae-engage/references/config-channel-detail.md +0 -31
  191. package/skills/ae-engage/references/config-channel-list.md +0 -26
  192. package/skills/ae-engage/references/config-item-detail.md +0 -29
  193. package/skills/ae-engage/references/config-item-list.md +0 -18
  194. package/skills/ae-engage/references/copy-config-template.md +0 -28
  195. package/skills/ae-engage/references/delete-config-channel.md +0 -23
  196. package/skills/ae-engage/references/delete-config-item.md +0 -24
  197. package/skills/ae-engage/references/engage-scene-config-item.md +0 -69
  198. package/skills/ae-engage/references/manage-strategy.md +0 -73
  199. package/skills/ae-engage/references/strategy-detail.md +0 -72
  200. package/skills/ae-engage/references/strategy-list.md +0 -20
  201. package/skills/ae-engage/references/update-config-channel-status.md +0 -31
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  getSandboxClusterInfoFilePath,
3
- logger,
4
3
  safeReadJsonFile
5
- } from "./chunk-YCLVYFK7.js";
4
+ } from "./chunk-V6FR6WTW.js";
5
+ import {
6
+ logger
7
+ } from "./chunk-LYVNONC4.js";
6
8
 
7
9
  // src/core/cluster-info.ts
8
10
  import fs from "fs";
@@ -0,0 +1,86 @@
1
+ // src/core/logger.ts
2
+ import fs from "fs";
3
+ import path from "path";
4
+ var LOG_DIR = path.join(process.env.HOME || "", ".ae-cli", "log");
5
+ var Logger = class {
6
+ logDir;
7
+ date;
8
+ constructor() {
9
+ this.logDir = LOG_DIR;
10
+ this.date = this.today();
11
+ this.ensureDir();
12
+ }
13
+ today() {
14
+ const d = /* @__PURE__ */ new Date();
15
+ return `${d.getFullYear()}${String(d.getMonth() + 1).padStart(2, "0")}${String(d.getDate()).padStart(2, "0")}`;
16
+ }
17
+ timestamp() {
18
+ return (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").split(".")[0];
19
+ }
20
+ ensureDir() {
21
+ if (!fs.existsSync(this.logDir)) {
22
+ fs.mkdirSync(this.logDir, { recursive: true });
23
+ }
24
+ }
25
+ filePath(level) {
26
+ const today = this.today();
27
+ if (today !== this.date) {
28
+ this.date = today;
29
+ }
30
+ return path.join(this.logDir, `${this.date}_${level}.log`);
31
+ }
32
+ /**
33
+ * Write a log entry to file (not printed to the console; console output is handled by existing process.stderr.write calls)
34
+ */
35
+ write(level, message) {
36
+ const ts = this.timestamp();
37
+ const line = `[${ts}] ${message}
38
+ `;
39
+ try {
40
+ fs.appendFileSync(this.filePath(level), line);
41
+ } catch {
42
+ }
43
+ }
44
+ /** Informational log */
45
+ info(message) {
46
+ this.write("info", message);
47
+ }
48
+ /** Warning log */
49
+ warn(message) {
50
+ this.write("warning", message);
51
+ }
52
+ /** Error log */
53
+ error(message) {
54
+ this.write("error", message);
55
+ }
56
+ /** Log HTTP API request details */
57
+ api(method, url, status, reqBody, respBody) {
58
+ const parts = [`API ${method} ${url} \u2192 HTTP ${status}`];
59
+ if (reqBody !== void 0 && reqBody !== null) {
60
+ const s = typeof reqBody === "string" ? reqBody : JSON.stringify(reqBody);
61
+ parts.push(`REQ: ${s.slice(0, 500)}`);
62
+ }
63
+ if (respBody !== void 0 && respBody !== null) {
64
+ const s = typeof respBody === "string" ? respBody : JSON.stringify(respBody);
65
+ parts.push(`RESP: ${s.slice(0, 500)}`);
66
+ }
67
+ this.info(parts.join(" | "));
68
+ }
69
+ /** Log command execution (sensitive flags redacted to ***) */
70
+ command(name, args, sensitiveFlags = []) {
71
+ const normalizeFlagName = (name2) => name2.toLowerCase().replace(/[-_]/g, "");
72
+ const explicitSensitive = new Set(Array.from(sensitiveFlags, normalizeFlagName));
73
+ const SENSITIVE = ["token", "apikey", "secret", "accesstoken", "headers"];
74
+ const isSensitive = (k) => {
75
+ const normalized = normalizeFlagName(k);
76
+ return explicitSensitive.has(normalized) || SENSITIVE.some((s) => normalized.includes(s));
77
+ };
78
+ const filtered = Object.entries(args).filter(([, v]) => v !== void 0 && v !== null && v !== "").map(([k, v]) => `--${k}=${isSensitive(k) ? "***" : JSON.stringify(v)}`).join(" ");
79
+ this.info(`CMD ${name}${filtered ? " " + filtered : ""}`);
80
+ }
81
+ };
82
+ var logger = new Logger();
83
+
84
+ export {
85
+ logger
86
+ };
@@ -1,14 +1,16 @@
1
- import {
2
- PermissionError
3
- } from "./chunk-NOO24N7W.js";
4
1
  import {
5
2
  clearCliToken,
6
3
  getCliToken
7
- } from "./chunk-2NDGFQHW.js";
4
+ } from "./chunk-E7UXXHO3.js";
8
5
  import {
9
- logger,
10
6
  safeJsonParse
11
- } from "./chunk-YCLVYFK7.js";
7
+ } from "./chunk-V6FR6WTW.js";
8
+ import {
9
+ PermissionError
10
+ } from "./chunk-24BAVOX3.js";
11
+ import {
12
+ logger
13
+ } from "./chunk-LYVNONC4.js";
12
14
 
13
15
  // src/core/capability-api.ts
14
16
  import { readFile } from "fs/promises";
@@ -147,11 +149,11 @@ async function requestMultipartOnce(url, token, form) {
147
149
  body: form
148
150
  });
149
151
  }
150
- async function callGateway(host, domain, pathAfterV1, method, body) {
151
- return (await callGatewayWithEnvelope(host, domain, pathAfterV1, method, body)).data;
152
+ async function callGateway(host, domain, pathAfterV1, method, body, queryParams = {}) {
153
+ return (await callGatewayWithEnvelope(host, domain, pathAfterV1, method, body, queryParams)).data;
152
154
  }
153
- async function callGatewayWithEnvelope(host, domain, pathAfterV1, method, body) {
154
- const url = buildCapabilityGatewayUrl(host, domain, pathAfterV1);
155
+ async function callGatewayWithEnvelope(host, domain, pathAfterV1, method, body, queryParams = {}) {
156
+ const url = buildCapabilityGatewayUrl(host, domain, pathAfterV1, queryParams);
155
157
  const token = await getCliToken(host);
156
158
  let resp = await requestOnce(url, method, token, body);
157
159
  let permissionMsg;
@@ -212,11 +214,18 @@ async function requestCapabilityGatewayWithEnvelope(host, domain, pathAfterV1, m
212
214
  const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body);
213
215
  return parseCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
214
216
  }
215
- async function listCapabilities(host, domain) {
216
- return callGateway(host, domain, "capabilities", "GET");
217
+ async function listCapabilities(host, domain, projectId) {
218
+ return callGateway(host, domain, "capabilities", "GET", void 0, { project_id: projectId });
217
219
  }
218
- async function inspectCapability(host, domain, capabilityId) {
219
- return callGateway(host, domain, `capabilities/${capabilityId}`, "GET");
220
+ async function inspectCapability(host, domain, capabilityId, projectId) {
221
+ return callGateway(
222
+ host,
223
+ domain,
224
+ `capabilities/${capabilityId}`,
225
+ "GET",
226
+ void 0,
227
+ { project_id: projectId }
228
+ );
220
229
  }
221
230
  async function executeCapability(host, domain, capabilityId, input = {}) {
222
231
  return callGateway(host, domain, `capabilities/${capabilityId}/execute`, "POST", { input });
@@ -1,95 +1,40 @@
1
- // src/core/logger.ts
1
+ import {
2
+ logger
3
+ } from "./chunk-LYVNONC4.js";
4
+
5
+ // src/core/json-utils.ts
2
6
  import fs from "fs";
3
- import path from "path";
4
- var LOG_DIR = path.join(process.env.HOME || "", ".ae-cli", "log");
5
- var Logger = class {
6
- logDir;
7
- date;
8
- constructor() {
9
- this.logDir = LOG_DIR;
10
- this.date = this.today();
11
- this.ensureDir();
12
- }
13
- today() {
14
- const d = /* @__PURE__ */ new Date();
15
- return `${d.getFullYear()}${String(d.getMonth() + 1).padStart(2, "0")}${String(d.getDate()).padStart(2, "0")}`;
16
- }
17
- timestamp() {
18
- return (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").split(".")[0];
19
- }
20
- ensureDir() {
21
- if (!fs.existsSync(this.logDir)) {
22
- fs.mkdirSync(this.logDir, { recursive: true });
23
- }
24
- }
25
- filePath(level) {
26
- const today = this.today();
27
- if (today !== this.date) {
28
- this.date = today;
7
+ import { createRequire } from "module";
8
+ var require2 = createRequire(import.meta.url);
9
+ var JSONbig = require2("json-bigint");
10
+ var jsonParser = JSONbig({ storeAsString: true });
11
+ var INTEGER_TOKEN = /^-?(?:0|[1-9]\d*)$/;
12
+ function normalizeParsedNumbers(lossless, native) {
13
+ if (typeof lossless === "string" && typeof native === "number") {
14
+ if (INTEGER_TOKEN.test(lossless) && !Number.isSafeInteger(native)) {
15
+ return lossless;
29
16
  }
30
- return path.join(this.logDir, `${this.date}_${level}.log`);
17
+ return native;
31
18
  }
32
- /**
33
- * Write a log entry to file (not printed to the console; console output is handled by existing process.stderr.write calls)
34
- */
35
- write(level, message) {
36
- const ts = this.timestamp();
37
- const line = `[${ts}] ${message}
38
- `;
39
- try {
40
- fs.appendFileSync(this.filePath(level), line);
41
- } catch {
19
+ if (Array.isArray(lossless) && Array.isArray(native)) {
20
+ for (let index = 0; index < lossless.length; index++) {
21
+ lossless[index] = normalizeParsedNumbers(lossless[index], native[index]);
42
22
  }
23
+ return lossless;
43
24
  }
44
- /** Informational log */
45
- info(message) {
46
- this.write("info", message);
47
- }
48
- /** Warning log */
49
- warn(message) {
50
- this.write("warning", message);
51
- }
52
- /** Error log */
53
- error(message) {
54
- this.write("error", message);
55
- }
56
- /** Log HTTP API request details */
57
- api(method, url, status, reqBody, respBody) {
58
- const parts = [`API ${method} ${url} \u2192 HTTP ${status}`];
59
- if (reqBody !== void 0 && reqBody !== null) {
60
- const s = typeof reqBody === "string" ? reqBody : JSON.stringify(reqBody);
61
- parts.push(`REQ: ${s.slice(0, 500)}`);
62
- }
63
- if (respBody !== void 0 && respBody !== null) {
64
- const s = typeof respBody === "string" ? respBody : JSON.stringify(respBody);
65
- parts.push(`RESP: ${s.slice(0, 500)}`);
25
+ if (lossless !== null && native !== null && typeof lossless === "object" && typeof native === "object") {
26
+ for (const key of Object.keys(lossless)) {
27
+ lossless[key] = normalizeParsedNumbers(lossless[key], native[key]);
66
28
  }
67
- this.info(parts.join(" | "));
68
29
  }
69
- /** Log command execution (sensitive flags redacted to ***) */
70
- command(name, args) {
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(" ");
77
- this.info(`CMD ${name}${filtered ? " " + filtered : ""}`);
78
- }
79
- };
80
- var logger = new Logger();
81
-
82
- // src/core/json-utils.ts
83
- import fs2 from "fs";
84
- import { createRequire } from "module";
85
- var require2 = createRequire(import.meta.url);
86
- var JSONbig = require2("json-bigint");
87
- var jsonParser = JSONbig({ storeAsString: true });
30
+ return lossless;
31
+ }
88
32
  function safeJsonParse(text) {
89
- return jsonParser.parse(text);
33
+ const lossless = jsonParser.parse(text);
34
+ return normalizeParsedNumbers(lossless, JSON.parse(text));
90
35
  }
91
36
  function safeReadJsonFile(filePath) {
92
- const content = fs2.readFileSync(filePath, "utf-8");
37
+ const content = fs.readFileSync(filePath, "utf-8");
93
38
  return safeJsonParse(content);
94
39
  }
95
40
 
@@ -104,11 +49,12 @@ function normalizeUrl(url) {
104
49
 
105
50
  // src/core/config.ts
106
51
  import fs3 from "fs";
107
- import path2 from "path";
52
+ import path from "path";
108
53
 
109
54
  // src/core/sandbox-runtime.ts
110
55
  import { homedir } from "os";
111
56
  import { join } from "path";
57
+ import fs2 from "fs";
112
58
  var LINUX_SANDBOX_RUNTIME_ROOT = "/home/ta/te_agent_ta";
113
59
  function getDefaultSandboxRuntimeRoot() {
114
60
  if (process.platform === "linux") {
@@ -128,13 +74,25 @@ function getSandboxCliTokenFilePath() {
128
74
  function getSandboxClusterInfoFilePath() {
129
75
  return join(getSandboxAeConfigDir(), "cluster-info.json");
130
76
  }
77
+ function isAeSandboxRuntime() {
78
+ if (process.env.SANDBOX_RUNTIME_ROOT) {
79
+ return true;
80
+ }
81
+ try {
82
+ if (fs2.existsSync(getSandboxCliTokenFilePath())) {
83
+ return true;
84
+ }
85
+ } catch {
86
+ }
87
+ return false;
88
+ }
131
89
 
132
90
  // src/core/config.ts
133
- var CONFIG_DIR = path2.join(process.env.HOME || "", ".ae-cli");
134
- var CONFIG_FILE = path2.join(CONFIG_DIR, "config.json");
91
+ var CONFIG_DIR = path.join(process.env.HOME || "", ".ae-cli");
92
+ var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
135
93
  function sandboxCliTokenCandidatePaths() {
136
94
  const paths = [getSandboxCliTokenFilePath()];
137
- const homeFallback = path2.join(process.env.HOME || "", ".ae-config", "cli-token.json");
95
+ const homeFallback = path.join(process.env.HOME || "", ".ae-config", "cli-token.json");
138
96
  if (!paths.includes(homeFallback)) {
139
97
  paths.push(homeFallback);
140
98
  }
@@ -289,12 +247,12 @@ function getConfigDir() {
289
247
  }
290
248
 
291
249
  export {
292
- logger,
293
250
  safeJsonParse,
294
251
  safeReadJsonFile,
295
252
  normalizeUrl,
296
253
  getSandboxRuntimeRoot,
297
254
  getSandboxClusterInfoFilePath,
255
+ isAeSandboxRuntime,
298
256
  getFallbackCliToken,
299
257
  loadConfig,
300
258
  saveConfig,
@@ -0,0 +1,27 @@
1
+ // src/core/package-info.ts
2
+ import fs from "fs";
3
+ import path from "path";
4
+ import { fileURLToPath } from "url";
5
+ function getLocalCliPackageInfo() {
6
+ let dir = path.dirname(fileURLToPath(import.meta.url));
7
+ for (let i = 0; i < 8; i += 1) {
8
+ const candidate = path.join(dir, "package.json");
9
+ try {
10
+ if (fs.existsSync(candidate)) {
11
+ const pkg = JSON.parse(fs.readFileSync(candidate, "utf8"));
12
+ if (pkg.name && pkg.version && String(pkg.name).includes("ae-cli")) {
13
+ return { name: pkg.name, version: pkg.version };
14
+ }
15
+ }
16
+ } catch {
17
+ }
18
+ const parent = path.dirname(dir);
19
+ if (parent === dir) break;
20
+ dir = parent;
21
+ }
22
+ return { name: "@tant/ae-cli", version: "0.0.0" };
23
+ }
24
+
25
+ export {
26
+ getLocalCliPackageInfo
27
+ };
@@ -4,15 +4,18 @@ import {
4
4
  getCliToken,
5
5
  localRenewDate,
6
6
  mintCliToken,
7
+ peekCliToken,
7
8
  setCliTokenManual
8
- } from "./chunk-2NDGFQHW.js";
9
- import "./chunk-AJTH7LT3.js";
10
- import "./chunk-YCLVYFK7.js";
9
+ } from "./chunk-E7UXXHO3.js";
10
+ import "./chunk-IR4ZLVPW.js";
11
+ import "./chunk-V6FR6WTW.js";
12
+ import "./chunk-LYVNONC4.js";
11
13
  export {
12
14
  _resetRenewMemoryForTest,
13
15
  clearCliToken,
14
16
  getCliToken,
15
17
  localRenewDate,
16
18
  mintCliToken,
19
+ peekCliToken,
17
20
  setCliTokenManual
18
21
  };
@@ -7,9 +7,10 @@ import {
7
7
  queryReportData,
8
8
  querySql,
9
9
  wsQuery
10
- } from "./chunk-KCA6BA5D.js";
11
- import "./chunk-AJTH7LT3.js";
12
- import "./chunk-YCLVYFK7.js";
10
+ } from "./chunk-DB4Q3ANU.js";
11
+ import "./chunk-IR4ZLVPW.js";
12
+ import "./chunk-V6FR6WTW.js";
13
+ import "./chunk-LYVNONC4.js";
13
14
  export {
14
15
  httpDelete,
15
16
  httpGet,
@@ -0,0 +1,145 @@
1
+ import {
2
+ CommunityReportError
3
+ } from "./chunk-24BAVOX3.js";
4
+ import {
5
+ logger
6
+ } from "./chunk-LYVNONC4.js";
7
+
8
+ // src/core/community-report-client.ts
9
+ var DEFAULT_TIMEOUT_MS = 3e4;
10
+ async function communityReport(endpoint, rawBody, options = {}) {
11
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
12
+ const fetchImpl = options.fetchImpl ?? fetch;
13
+ const requestBytes = Buffer.byteLength(rawBody, "utf8");
14
+ const controller = new AbortController();
15
+ const timeout = setTimeout(() => controller.abort(), timeoutMs);
16
+ let response;
17
+ let responseText;
18
+ try {
19
+ response = await fetchImpl(endpoint, {
20
+ method: "POST",
21
+ headers: {
22
+ "Content-Type": "application/json",
23
+ "Accept": "application/json"
24
+ },
25
+ body: rawBody,
26
+ redirect: "error",
27
+ signal: controller.signal
28
+ });
29
+ responseText = await response.text();
30
+ } catch (error) {
31
+ const timedOut = controller.signal.aborted || isAbortError(error);
32
+ logCommunityReport(endpoint, response?.status ?? "unavailable", requestBytes, 0);
33
+ if (timedOut) {
34
+ throw new CommunityReportError(
35
+ `Community data report timed out after ${timeoutMs} ms. Delivery state is unknown.`,
36
+ {
37
+ code: "COMMUNITY_REPORT_TIMEOUT",
38
+ hint: "Check downstream query or storage before deciding whether to submit again. The CLI did not retry.",
39
+ meta: { persistence_verified: false, retry_attempted: false },
40
+ cause: error
41
+ }
42
+ );
43
+ }
44
+ throw new CommunityReportError("Community data report request failed before a response was received.", {
45
+ code: "COMMUNITY_REPORT_NETWORK_ERROR",
46
+ hint: "Verify the endpoint and network path. The CLI did not retry.",
47
+ meta: { persistence_verified: false, retry_attempted: false },
48
+ cause: error
49
+ });
50
+ } finally {
51
+ clearTimeout(timeout);
52
+ }
53
+ const responseBytes = Buffer.byteLength(responseText, "utf8");
54
+ logCommunityReport(endpoint, response.status, requestBytes, responseBytes);
55
+ const responseBody = parseResponseBody(responseText, response.status);
56
+ if (!response.ok) {
57
+ if (response.status === 400) {
58
+ const returnMessage = getReturnMessage(responseBody);
59
+ throw new CommunityReportError(returnMessage ?? "Iris rejected the community data report.", {
60
+ code: getReturnCode(responseBody) ?? "COMMUNITY_REPORT_HTTP_400",
61
+ httpStatus: response.status,
62
+ meta: safeResponseMeta(requestBytes, responseBytes)
63
+ });
64
+ }
65
+ throw new CommunityReportError(`Iris sync endpoint returned HTTP ${response.status}.`, {
66
+ code: `COMMUNITY_REPORT_HTTP_${response.status}`,
67
+ httpStatus: response.status,
68
+ hint: response.status >= 500 ? "The server response was suppressed. Check Iris or gateway logs; the CLI did not retry." : void 0,
69
+ meta: safeResponseMeta(requestBytes, responseBytes)
70
+ });
71
+ }
72
+ if (!isRecord(responseBody) || typeof responseBody.return_code !== "number") {
73
+ throw new CommunityReportError("Iris sync endpoint returned an invalid API response: missing numeric return_code.", {
74
+ code: "COMMUNITY_REPORT_INVALID_RESPONSE",
75
+ httpStatus: response.status,
76
+ meta: safeResponseMeta(requestBytes, responseBytes)
77
+ });
78
+ }
79
+ if (responseBody.return_code !== 0) {
80
+ throw new CommunityReportError(
81
+ getReturnMessage(responseBody) ?? "Iris rejected the community data report.",
82
+ {
83
+ code: responseBody.return_code,
84
+ httpStatus: response.status,
85
+ meta: safeResponseMeta(requestBytes, responseBytes)
86
+ }
87
+ );
88
+ }
89
+ return {
90
+ return_code: 0,
91
+ return_message: getReturnMessage(responseBody) ?? "success",
92
+ http_status: response.status,
93
+ request_bytes: requestBytes,
94
+ response_bytes: responseBytes
95
+ };
96
+ }
97
+ function parseResponseBody(text, httpStatus) {
98
+ if (!text.trim()) {
99
+ if (httpStatus >= 500) return void 0;
100
+ throw new CommunityReportError("Iris sync endpoint returned an empty API response.", {
101
+ code: "COMMUNITY_REPORT_INVALID_RESPONSE",
102
+ httpStatus
103
+ });
104
+ }
105
+ try {
106
+ return JSON.parse(text);
107
+ } catch {
108
+ if (httpStatus >= 500) return void 0;
109
+ throw new CommunityReportError("Iris sync endpoint returned a non-JSON API response.", {
110
+ code: "COMMUNITY_REPORT_INVALID_RESPONSE",
111
+ httpStatus
112
+ });
113
+ }
114
+ }
115
+ function isRecord(value) {
116
+ return value !== null && typeof value === "object" && !Array.isArray(value);
117
+ }
118
+ function getReturnCode(value) {
119
+ if (!isRecord(value)) return void 0;
120
+ return typeof value.return_code === "number" || typeof value.return_code === "string" ? value.return_code : void 0;
121
+ }
122
+ function getReturnMessage(value) {
123
+ if (!isRecord(value)) return void 0;
124
+ return typeof value.return_message === "string" && value.return_message.trim() ? value.return_message.trim() : void 0;
125
+ }
126
+ function isAbortError(error) {
127
+ return error instanceof Error && error.name === "AbortError";
128
+ }
129
+ function safeResponseMeta(requestBytes, responseBytes) {
130
+ return {
131
+ request_bytes: requestBytes,
132
+ response_bytes: responseBytes,
133
+ persistence_verified: false,
134
+ retry_attempted: false
135
+ };
136
+ }
137
+ function logCommunityReport(endpoint, status, requestBytes, responseBytes) {
138
+ logger.info(
139
+ `COMMUNITY_REPORT POST ${endpoint} status=${status} request_bytes=${requestBytes} response_bytes=${responseBytes}`
140
+ );
141
+ }
142
+ export {
143
+ CommunityReportError,
144
+ communityReport
145
+ };
@@ -1,20 +1,23 @@
1
1
  import {
2
2
  printError,
3
3
  printOutput
4
- } from "./chunk-TNW2CI4W.js";
4
+ } from "./chunk-IMMGMU54.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-KGJQCYVC.js";
11
+ } from "./chunk-LCXU3AAT.js";
12
+ import "./chunk-E7UXXHO3.js";
13
+ import "./chunk-IR4ZLVPW.js";
12
14
  import {
13
15
  addHost,
14
16
  loadConfig,
15
17
  normalizeUrl,
16
18
  setActiveHost
17
- } from "./chunk-YCLVYFK7.js";
19
+ } from "./chunk-V6FR6WTW.js";
20
+ import "./chunk-LYVNONC4.js";
18
21
 
19
22
  // src/commands/config.ts
20
23
  function registerConfig(program) {