@thinkingai/ae-cli 6.1.6 → 6.1.8

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 (142) hide show
  1. package/dist/{auth-UPGUOKTW.js → auth-B2BRSYMS.js} +1 -1
  2. package/dist/{capability-TQ5KU5Q6.js → capability-6KPXYNO7.js} +1 -1
  3. package/dist/{capability-AJC5CBRT.js → capability-ROKYESAP.js} +1 -1
  4. package/dist/{chunk-6CHYBI64.js → chunk-EBPXT3TN.js} +1 -1
  5. package/dist/{chunk-4Q5TNP4Q.js → chunk-J7MZHDHQ.js} +48 -24
  6. package/dist/{chunk-IMMGMU54.js → chunk-JTKMDN4A.js} +64 -166
  7. package/dist/{chunk-ISY6HMHM.js → chunk-RRFK2W7I.js} +1 -1
  8. package/dist/{config-RCCGHHYA.js → config-DDYJPJX3.js} +4 -4
  9. package/dist/index.js +63 -28
  10. package/dist/{metadata-3M5F2AED.js → metadata-2ZFRMVOL.js} +2 -55
  11. package/dist/{metadata-W2MEOI4Z.js → metadata-ABQCKU5P.js} +2 -55
  12. package/dist/{model-OYQLXCQY.js → model-JASQVOFD.js} +1 -1
  13. package/dist/{raw-TPB7KSZO.js → raw-6HXFFHLV.js} +1 -1
  14. package/dist/{sync-EFJKFZK2.js → sync-BF3IWYFC.js} +2 -2
  15. package/dist/{te-agent-K2OWMZXT.js → te-agent-3GJ5H2XF.js} +195 -2
  16. package/dist/{te-analysis-I73ZS4NK.js → te-analysis-DJ6KELTU.js} +636 -668
  17. package/dist/{te-analysis-Q7AZCDU4.js → te-analysis-PCGESPLW.js} +636 -668
  18. package/dist/{te-dataops-OA7I6HBG.js → te-dataops-LXL5YULV.js} +7 -7
  19. package/dist/{te-dataops-MJV54MNY.js → te-dataops-ROHUJOX5.js} +7 -7
  20. package/dist/{te-engage-2FSDUOIZ.js → te-engage-2YDCA552.js} +87 -4
  21. package/dist/{te-engage-BMJ6UOUU.js → te-engage-VW6NJZ5V.js} +87 -4
  22. package/dist/{te-experiment-4JC7WUKW.js → te-experiment-7JGJNDXO.js} +2 -2
  23. package/dist/{te-experiment-KYRWAUZY.js → te-experiment-OYK54B72.js} +2 -2
  24. package/dist/te-meta-GBDTMPEL.js +95 -0
  25. package/dist/te-meta-ZTLTSHXC.js +95 -0
  26. package/dist/te-system-AH7DMCAQ.js +1706 -0
  27. package/dist/{te-team-PDKKW7Q5.js → te-team-RRZI4WRI.js} +1 -1
  28. package/dist/update-ER7VFU55.js +101 -0
  29. package/package.json +9 -4
  30. package/skills/ae-agent/SKILL.md +5 -1
  31. package/skills/ae-agent/references/create-automation.md +1 -0
  32. package/skills/ae-agent/references/list-sandbox-tools.md +79 -0
  33. package/skills/ae-analysis/SKILL.md +8 -9
  34. package/skills/ae-analysis/references/adhoc_export.md +8 -0
  35. package/skills/ae-analysis/references/adhoc_run.md +9 -0
  36. package/skills/ae-analysis/references/ai_models.md +3 -1
  37. package/skills/ae-analysis/references/alert_create.md +2 -3
  38. package/skills/ae-analysis/references/alert_update.md +2 -3
  39. package/skills/ae-analysis/references/analysis_data_retrieval.md +2 -0
  40. package/skills/ae-analysis/references/analysis_drilldown_contract.md +2 -0
  41. package/skills/ae-analysis/references/analysis_gateway_assets.md +15 -11
  42. package/skills/ae-analysis/references/bi_panel_create.md +12 -4
  43. package/skills/ae-analysis/references/bi_panel_update.md +11 -8
  44. package/skills/ae-analysis/references/bi_panel_version_publish.md +3 -1
  45. package/skills/ae-analysis/references/command_index.md +28 -47
  46. package/skills/ae-analysis/references/dashboard_daily_report_get.md +18 -0
  47. package/skills/ae-analysis/references/dashboard_daily_report_send.md +12 -9
  48. package/skills/ae-analysis/references/dashboard_daily_report_send_status.md +22 -0
  49. package/skills/ae-analysis/references/dashboard_daily_report_update.md +13 -6
  50. package/skills/ae-analysis/references/dashboard_report_data_export.md +4 -2
  51. package/skills/ae-analysis/references/dashboard_report_data_run.md +5 -3
  52. package/skills/ae-analysis/references/drilldown_entities_export.md +3 -0
  53. package/skills/ae-analysis/references/drilldown_entities_run.md +2 -1
  54. package/skills/ae-analysis/references/drilldown_events_export.md +3 -0
  55. package/skills/ae-analysis/references/drilldown_events_run.md +2 -1
  56. package/skills/ae-analysis/references/drilldown_user_events_export.md +8 -0
  57. package/skills/ae-analysis/references/drilldown_user_events_run.md +8 -0
  58. package/skills/ae-analysis/references/entity_id_import_options.md +1 -1
  59. package/skills/ae-analysis/references/filter_value_list.md +47 -0
  60. package/skills/ae-analysis/references/project_space_get.md +3 -3
  61. package/skills/ae-analysis/references/project_space_list.md +6 -2
  62. package/skills/ae-analysis/references/query_cancel.md +3 -1
  63. package/skills/ae-analysis/references/query_cluster_list.md +34 -0
  64. package/skills/ae-analysis/references/query_create_result_cluster.md +2 -0
  65. package/skills/ae-analysis/references/report_create.md +5 -1
  66. package/skills/ae-analysis/references/report_data_export.md +9 -2
  67. package/skills/ae-analysis/references/report_data_run.md +8 -3
  68. package/skills/ae-analysis/references/report_get.md +3 -1
  69. package/skills/ae-analysis/references/report_update.md +4 -0
  70. package/skills/ae-analysis/references/super_metadata_batch_create.md +29 -0
  71. package/skills/ae-analysis/references/super_metadata_batch_edit.md +24 -0
  72. package/skills/ae-analysis/references/virtual_event_create.md +7 -6
  73. package/skills/ae-analysis-global/SKILL.md +15 -32
  74. package/skills/ae-community/SKILL.md +1 -1
  75. package/skills/ae-data-integration-helper/SKILL.md +3 -2
  76. package/skills/ae-data-integration-helper/references/sdk_usage_notes.md +1 -1
  77. package/skills/ae-dataops/SKILL.md +2 -1
  78. package/skills/ae-dataops/references/dataops-integration.md +75 -6
  79. package/skills/ae-engage/SKILL.md +32 -5
  80. package/skills/ae-engage/references/activity-topic.md +34 -1
  81. package/skills/ae-engage/references/add-channel.md +2 -3
  82. package/skills/ae-engage/references/build-task-save-guide.md +17 -3
  83. package/skills/ae-engage/references/channel-detail.md +2 -3
  84. package/skills/ae-engage/references/channel-list.md +2 -5
  85. package/skills/ae-engage/references/channel-mgmt.md +17 -2
  86. package/skills/ae-engage/references/channel-test-send.md +1 -1
  87. package/skills/ae-engage/references/channel-update-config.md +1 -1
  88. package/skills/ae-engage/references/delete-channel.md +2 -3
  89. package/skills/ae-engage/references/save-flow.md +6 -3
  90. package/skills/ae-engage/references/save-task.md +12 -15
  91. package/skills/ae-engage/references/scene-config-channel.md +28 -4
  92. package/skills/ae-engage/references/scene-config-group.md +1 -1
  93. package/skills/ae-engage/references/scene-config-item.md +1 -1
  94. package/skills/ae-engage/references/scene-config-metric.md +1 -1
  95. package/skills/ae-engage/references/scene-config-param.md +1 -1
  96. package/skills/ae-engage/references/scene-preset-metric.md +1 -1
  97. package/skills/ae-engage/references/scene-strategy-audience.md +680 -0
  98. package/skills/ae-engage/references/scene-strategy.md +16 -1
  99. package/skills/ae-engage/references/scene-template.md +1 -1
  100. package/skills/ae-engage/references/update-channel-status.md +2 -3
  101. package/skills/ae-generate-tracking-code/SKILL.md +4 -3
  102. package/skills/ae-generate-tracking-code/references/client-sdk-insert.md +1 -1
  103. package/skills/ae-generate-tracking-code/references/server-sdk-insert.md +1 -1
  104. package/skills/ae-generate-tracking-code/references/snippet-delivery.md +1 -1
  105. package/skills/ae-generate-tracking-plan/SKILL.md +6 -2
  106. package/skills/ae-metadata/SKILL.md +8 -15
  107. package/skills/ae-metadata/references/metadata_property_dimension_table_bind_existing.md +1 -1
  108. package/skills/ae-system/SKILL.md +357 -0
  109. package/dist/te-common-ST3QPSXJ.js +0 -61
  110. package/dist/te-common-WSLIKKPC.js +0 -61
  111. package/dist/te-meta-Q4L6EE3Q.js +0 -363
  112. package/dist/te-meta-VHCN4Q62.js +0 -363
  113. package/skills/ae-analysis/references/alert_definition_schema_get.md +0 -24
  114. package/skills/ae-analysis/references/batch_create_metadata.md +0 -41
  115. package/skills/ae-analysis/references/batch_edit_metadata.md +0 -39
  116. package/skills/ae-analysis/references/cancel_query.md +0 -38
  117. package/skills/ae-analysis/references/create_alert.md +0 -47
  118. package/skills/ae-analysis/references/create_entity.md +0 -39
  119. package/skills/ae-analysis/references/create_project_mark_time.md +0 -39
  120. package/skills/ae-analysis/references/delete_alert.md +0 -32
  121. package/skills/ae-analysis/references/delete_project_mark_times.md +0 -36
  122. package/skills/ae-analysis/references/delete_track_items.md +0 -36
  123. package/skills/ae-analysis/references/generate_track_program.md +0 -52
  124. package/skills/ae-analysis/references/generate_track_sdk_sample.md +0 -44
  125. package/skills/ae-analysis/references/get_alert.md +0 -35
  126. package/skills/ae-analysis/references/get_alert_definition_schema.md +0 -33
  127. package/skills/ae-analysis/references/get_project_config.md +0 -33
  128. package/skills/ae-analysis/references/get_track_program.md +0 -34
  129. package/skills/ae-analysis/references/list_alerts.md +0 -41
  130. package/skills/ae-analysis/references/list_entities.md +0 -42
  131. package/skills/ae-analysis/references/list_project_mark_times.md +0 -43
  132. package/skills/ae-analysis/references/list_project_users.md +0 -33
  133. package/skills/ae-analysis/references/list_projects.md +0 -39
  134. package/skills/ae-analysis/references/load_filters.md +0 -47
  135. package/skills/ae-analysis/references/save_track_items.md +0 -37
  136. package/skills/ae-analysis/references/update_alert.md +0 -49
  137. package/skills/ae-analysis/references/update_project_mark_time.md +0 -40
  138. package/skills/ae-analysis-global/references/list_query_clusters.md +0 -68
  139. package/skills/ae-metadata/references/metadata_event_get.md +0 -52
  140. package/skills/ae-metadata/references/metadata_property_get.md +0 -54
  141. package/dist/{te-community-WXGB6IOX.js → te-community-QOYIYEJI.js} +3 -3
  142. package/dist/{te-community-X2AHXGCA.js → te-community-UFKI6ONP.js} +3 -3
@@ -5,7 +5,7 @@ import {
5
5
  printError,
6
6
  printOutput,
7
7
  runHostCompatCheck
8
- } from "./chunk-IMMGMU54.js";
8
+ } from "./chunk-JTKMDN4A.js";
9
9
  import {
10
10
  clearCliToken,
11
11
  mintCliToken
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  printError,
18
18
  printOutput
19
- } from "./chunk-IMMGMU54.js";
19
+ } from "./chunk-JTKMDN4A.js";
20
20
  import "./chunk-E7UXXHO3.js";
21
21
  import {
22
22
  SecureStoreAuthError,
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  printError,
18
18
  printOutput
19
- } from "./chunk-IMMGMU54.js";
19
+ } from "./chunk-JTKMDN4A.js";
20
20
  import "./chunk-E7UXXHO3.js";
21
21
  import {
22
22
  SecureStoreAuthError,
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-RGXCNC4N.js";
9
9
  import {
10
10
  withOutputMetadata
11
- } from "./chunk-IMMGMU54.js";
11
+ } from "./chunk-JTKMDN4A.js";
12
12
 
13
13
  // src/core/capability-command.ts
14
14
  import { randomBytes } from "crypto";
@@ -122,18 +122,18 @@ async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_TIMEOUT_MS) {
122
122
  clearTimeout(timer);
123
123
  }
124
124
  }
125
- function teClaudeBaseFromActiveHost() {
126
- const override = process.env.TE_CLAUDE_BASE_URL;
125
+ function teClaudeBaseFromActiveHost(hostOverride) {
126
+ const override = hostOverride ? void 0 : process.env.TE_CLAUDE_BASE_URL;
127
127
  if (override) return override.replace(/\/+$/, "");
128
- const h = getActiveHost();
128
+ const h = hostOverride || getActiveHost();
129
129
  if (!h) return void 0;
130
130
  const base = h.replace(/\/+$/, "");
131
131
  const bp = process.env.TE_CLAUDE_BASE_PATH || "/agent";
132
132
  return base.endsWith(bp) ? base : base + bp;
133
133
  }
134
- async function signRequest(method, path, rawBody) {
134
+ async function signRequest(method, path, rawBody, hostOverride) {
135
135
  const sandboxCred = tryLoadTeAgentSandboxCredentials();
136
- if (sandboxCred && sandboxCred.sandboxId && sandboxCred.sandboxSecretKey) {
136
+ if (!hostOverride && sandboxCred && sandboxCred.sandboxId && sandboxCred.sandboxSecretKey) {
137
137
  const headers = {
138
138
  "X-Sandbox-Id": sandboxCred.sandboxId,
139
139
  "X-Sandbox-Secret-Key": sandboxCred.sandboxSecretKey
@@ -149,14 +149,14 @@ async function signRequest(method, path, rawBody) {
149
149
  }
150
150
  const { getToken } = await import("./auth-ENM3FE6L.js");
151
151
  const { getCliToken } = await import("./cli-token-4SBMXAUK.js");
152
- const baseUrl = sandboxCred?.url || teClaudeBaseFromActiveHost();
153
- const hostForToken = getActiveHost() || baseUrl;
152
+ const baseUrl = hostOverride ? teClaudeBaseFromActiveHost(hostOverride) : sandboxCred?.url || teClaudeBaseFromActiveHost();
154
153
  if (!baseUrl) {
155
154
  throw new TeAgentCredentialsError(
156
155
  "Cannot determine the te-claude service URL",
157
156
  "Run ae-cli config set-host <url> to configure the service URL, or execute inside a te-agent sandbox"
158
157
  );
159
158
  }
159
+ const hostForToken = hostOverride || getActiveHost() || baseUrl;
160
160
  const contentTypeHeader = method === "POST" || method === "PATCH" || method === "PUT" ? { "Content-Type": "application/json" } : {};
161
161
  let accessToken = null;
162
162
  try {
@@ -220,9 +220,9 @@ async function parseResponse(response, defaultErrorPrefix) {
220
220
  }
221
221
  return parsed;
222
222
  }
223
- async function postToMainApp(path, body) {
223
+ async function postToMainApp(path, body, hostOverride) {
224
224
  const rawBody = JSON.stringify(body);
225
- const signed = await signRequest("POST", path, rawBody);
225
+ const signed = await signRequest("POST", path, rawBody, hostOverride);
226
226
  const response = await fetchWithTimeout(signed.url, {
227
227
  method: "POST",
228
228
  headers: signed.headers,
@@ -230,8 +230,8 @@ async function postToMainApp(path, body) {
230
230
  });
231
231
  return parseResponse(response, "Main app returned");
232
232
  }
233
- async function getFromMainApp(path) {
234
- const signed = await signRequest("GET", path, "");
233
+ async function getFromMainApp(path, hostOverride) {
234
+ const signed = await signRequest("GET", path, "", hostOverride);
235
235
  const response = await fetchWithTimeout(signed.url, {
236
236
  method: "GET",
237
237
  headers: signed.headers
@@ -264,17 +264,17 @@ async function postSandboxSyncPull(args) {
264
264
  mode: "merge"
265
265
  });
266
266
  }
267
- async function deleteFromMainApp(path) {
268
- const signed = await signRequest("DELETE", path, "");
267
+ async function deleteFromMainApp(path, hostOverride) {
268
+ const signed = await signRequest("DELETE", path, "", hostOverride);
269
269
  const response = await fetchWithTimeout(signed.url, {
270
270
  method: "DELETE",
271
271
  headers: signed.headers
272
272
  });
273
273
  return parseResponse(response, "Main app returned");
274
274
  }
275
- async function patchToMainApp(path, body) {
275
+ async function patchToMainApp(path, body, hostOverride) {
276
276
  const rawBody = JSON.stringify(body);
277
- const signed = await signRequest("PATCH", path, rawBody);
277
+ const signed = await signRequest("PATCH", path, rawBody, hostOverride);
278
278
  const response = await fetchWithTimeout(signed.url, {
279
279
  method: "PATCH",
280
280
  headers: signed.headers,
@@ -282,9 +282,9 @@ async function patchToMainApp(path, body) {
282
282
  });
283
283
  return parseResponse(response, "Main app returned");
284
284
  }
285
- async function putToMainApp(path, body) {
285
+ async function putToMainApp(path, body, hostOverride) {
286
286
  const rawBody = JSON.stringify(body);
287
- const signed = await signRequest("PUT", path, rawBody);
287
+ const signed = await signRequest("PUT", path, rawBody, hostOverride);
288
288
  const response = await fetchWithTimeout(signed.url, {
289
289
  method: "PUT",
290
290
  headers: signed.headers,
@@ -292,8 +292,8 @@ async function putToMainApp(path, body) {
292
292
  });
293
293
  return parseResponse(response, "Main app returned");
294
294
  }
295
- async function getBufferFromMainApp(path) {
296
- const signed = await signRequest("GET", path, "");
295
+ async function getBufferFromMainApp(path, hostOverride) {
296
+ const signed = await signRequest("GET", path, "", hostOverride);
297
297
  const response = await fetchWithTimeout(signed.url, {
298
298
  method: "GET",
299
299
  headers: signed.headers
@@ -327,11 +327,11 @@ async function getBufferFromMainApp(path) {
327
327
  const fileName = match ? decodeURIComponent(match[1]) : null;
328
328
  return { buffer, fileName };
329
329
  }
330
- async function uploadToMainApp(path, formData) {
330
+ async function uploadToMainApp(path, formData, hostOverride) {
331
331
  const sandboxCred = tryLoadTeAgentSandboxCredentials();
332
332
  let baseUrl;
333
333
  let authHeaders;
334
- if (sandboxCred && sandboxCred.sandboxId && sandboxCred.sandboxSecretKey) {
334
+ if (!hostOverride && sandboxCred && sandboxCred.sandboxId && sandboxCred.sandboxSecretKey) {
335
335
  baseUrl = sandboxCred.url.replace(/\/$/, "");
336
336
  authHeaders = {
337
337
  "X-Sandbox-Id": sandboxCred.sandboxId,
@@ -339,15 +339,38 @@ async function uploadToMainApp(path, formData) {
339
339
  };
340
340
  } else {
341
341
  const { getToken } = await import("./auth-ENM3FE6L.js");
342
- baseUrl = (sandboxCred?.url || teClaudeBaseFromActiveHost() || "").replace(/\/$/, "");
342
+ const { getCliToken } = await import("./cli-token-4SBMXAUK.js");
343
+ baseUrl = (hostOverride ? teClaudeBaseFromActiveHost(hostOverride) : sandboxCred?.url || teClaudeBaseFromActiveHost())?.replace(/\/$/, "") || "";
343
344
  if (!baseUrl) {
344
345
  throw new TeAgentCredentialsError(
345
346
  "Cannot determine the te-claude service URL",
346
347
  "Run ae-cli config set-host <url> to configure the service URL, or execute inside a te-agent sandbox"
347
348
  );
348
349
  }
349
- const accessToken = await getToken(getActiveHost() || baseUrl);
350
- authHeaders = { "Authorization": `bearer ${accessToken}` };
350
+ const hostForToken = hostOverride || getActiveHost() || baseUrl;
351
+ let accessToken = null;
352
+ try {
353
+ accessToken = await getToken(hostForToken);
354
+ } catch {
355
+ accessToken = null;
356
+ }
357
+ if (accessToken) {
358
+ authHeaders = { "Authorization": `bearer ${accessToken}` };
359
+ } else {
360
+ let cliToken = null;
361
+ try {
362
+ cliToken = await getCliToken(hostForToken);
363
+ } catch {
364
+ cliToken = null;
365
+ }
366
+ if (!cliToken) {
367
+ throw new TeAgentCredentialsError(
368
+ "No te-claude credentials available",
369
+ "Run ae-cli auth login, or execute inside a te-agent sandbox"
370
+ );
371
+ }
372
+ authHeaders = { "cli-token": cliToken };
373
+ }
351
374
  }
352
375
  const response = await fetchWithTimeout(
353
376
  `${baseUrl}${path}`,
@@ -363,6 +386,7 @@ async function uploadToMainApp(path, formData) {
363
386
 
364
387
  export {
365
388
  TeAgentCredentialsError,
389
+ tryLoadTeAgentSandboxCredentials,
366
390
  getClaudeConfigDir,
367
391
  TeAgentApiError,
368
392
  postToMainApp,
@@ -15,20 +15,15 @@ import {
15
15
  } from "./chunk-LYVNONC4.js";
16
16
 
17
17
  // src/core/update-check.ts
18
- import fs from "fs";
19
- import path from "path";
20
- var CONFIG_DIR = path.join(process.env.HOME || "", ".ae-cli");
21
- var CACHE_FILE = path.join(CONFIG_DIR, "update-check.json");
22
- var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
23
- var FETCH_TIMEOUT_MS = 3e3;
24
- var REGISTRY_BY_PACKAGE = {
25
- "@thinkingai/ae-cli": "https://registry.npmjs.org"
26
- };
27
- var UPDATE_CHECK_PACKAGE = "@thinkingai/ae-cli";
28
- function isUpdateCheckEnabled(packageName) {
29
- return packageName === UPDATE_CHECK_PACKAGE;
18
+ function shouldSkipUpdateCheck(argv = process.argv) {
19
+ if (process.env.AE_CLI_NO_UPDATE_CHECK === "1") return true;
20
+ if (process.env.CI === "true" || process.env.CI === "1") return true;
21
+ return argv.slice(2).some((arg) => {
22
+ if (arg === "--no-update-check") return true;
23
+ if (arg === "--version" || arg === "-V" || arg === "--help" || arg === "-h") return true;
24
+ return false;
25
+ });
30
26
  }
31
- var DEFAULT_REGISTRY = "https://registry.npmjs.org";
32
27
  function parseVersion(version) {
33
28
  const core = version.trim().split("-")[0];
34
29
  return core.split(".").map((part) => {
@@ -48,116 +43,6 @@ function isNewer(latest, current) {
48
43
  }
49
44
  return false;
50
45
  }
51
- function resolveRegistry(packageName) {
52
- if (REGISTRY_BY_PACKAGE[packageName]) {
53
- return REGISTRY_BY_PACKAGE[packageName];
54
- }
55
- const envRegistry = process.env.npm_config_registry?.replace(/\/$/, "");
56
- return envRegistry || DEFAULT_REGISTRY;
57
- }
58
- function buildInstallCommand(packageName, registry) {
59
- const base = `npm install -g ${packageName}@latest`;
60
- if (registry === DEFAULT_REGISTRY) {
61
- return base;
62
- }
63
- return `${base} --registry=${registry}`;
64
- }
65
- function shouldSkipUpdateCheck(argv = process.argv) {
66
- if (process.env.AE_CLI_NO_UPDATE_CHECK === "1") return true;
67
- if (process.env.CI === "true" || process.env.CI === "1") return true;
68
- return argv.slice(2).some((arg) => {
69
- if (arg === "--no-update-check") return true;
70
- if (arg === "--version" || arg === "-V" || arg === "--help" || arg === "-h") return true;
71
- return false;
72
- });
73
- }
74
- function ensureConfigDir() {
75
- if (!fs.existsSync(CONFIG_DIR)) {
76
- fs.mkdirSync(CONFIG_DIR, { recursive: true });
77
- }
78
- }
79
- function readCache() {
80
- try {
81
- if (!fs.existsSync(CACHE_FILE)) return null;
82
- const raw = fs.readFileSync(CACHE_FILE, "utf8");
83
- const data = JSON.parse(raw);
84
- if (!data.packageName || !data.latestVersion || !data.lastCheckedAt) return null;
85
- return data;
86
- } catch {
87
- return null;
88
- }
89
- }
90
- function writeCache(cache) {
91
- try {
92
- ensureConfigDir();
93
- fs.writeFileSync(CACHE_FILE, JSON.stringify(cache, null, 2));
94
- } catch {
95
- }
96
- }
97
- function cacheIsStale(cache, packageName) {
98
- if (!cache || cache.packageName !== packageName) return true;
99
- const age = Date.now() - new Date(cache.lastCheckedAt).getTime();
100
- return age >= CHECK_INTERVAL_MS;
101
- }
102
- function printUpdateNotice(current, latest, installCommand) {
103
- process.stderr.write(`[ae-cli] Update available: ${current} \u2192 ${latest}
104
- `);
105
- process.stderr.write(` Run: ${installCommand}
106
- `);
107
- }
108
- async function fetchLatestVersion(packageName, registry) {
109
- const url = `${registry.replace(/\/$/, "")}/${encodeURIComponent(packageName)}`;
110
- const controller = new AbortController();
111
- const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
112
- try {
113
- const resp = await fetch(url, {
114
- signal: controller.signal,
115
- headers: { Accept: "application/json" }
116
- });
117
- if (!resp.ok) return null;
118
- const data = await resp.json();
119
- const latest = data["dist-tags"]?.latest;
120
- return typeof latest === "string" && latest.trim() ? latest.trim() : null;
121
- } catch {
122
- return null;
123
- } finally {
124
- clearTimeout(timer);
125
- }
126
- }
127
- async function refreshCache(pkg, registry) {
128
- const latest = await fetchLatestVersion(pkg.name, registry);
129
- if (!latest) return readCache();
130
- const cache = {
131
- packageName: pkg.name,
132
- currentVersion: pkg.version,
133
- latestVersion: latest,
134
- lastCheckedAt: (/* @__PURE__ */ new Date()).toISOString()
135
- };
136
- writeCache(cache);
137
- return cache;
138
- }
139
- function maybeNotifyFromCache(pkg, cache, registry) {
140
- if (!cache || cache.packageName !== pkg.name) return;
141
- if (!isNewer(cache.latestVersion, pkg.version)) return;
142
- printUpdateNotice(pkg.version, cache.latestVersion, buildInstallCommand(pkg.name, registry));
143
- }
144
- function notifyIfUpdateAvailable(pkg) {
145
- if (!isUpdateCheckEnabled(pkg.name)) return;
146
- if (shouldSkipUpdateCheck()) return;
147
- const registry = resolveRegistry(pkg.name);
148
- const cache = readCache();
149
- maybeNotifyFromCache(pkg, cache, registry);
150
- if (!cacheIsStale(cache, pkg.name)) return;
151
- void refreshCache(pkg, registry).then((fresh) => {
152
- if (!fresh) return;
153
- if (cache && fresh.latestVersion === cache.latestVersion) return;
154
- maybeNotifyFromCache(pkg, fresh, registry);
155
- });
156
- }
157
-
158
- // src/core/compat-check.ts
159
- import fs2 from "fs";
160
- import path2 from "path";
161
46
 
162
47
  // src/core/legacy-cli-version-map.ts
163
48
  var HISTORICAL_CLUSTER_TO_PUBLIC_PIN = {
@@ -302,19 +187,17 @@ function formatUpgradeCommands(expectedVersion) {
302
187
  `npx skills add ${AE_CLI_SKILLS_REPO}#v${ver} -g -y`
303
188
  ];
304
189
  }
190
+ function formatUnifiedUpdateCommand() {
191
+ return "ae-cli update";
192
+ }
305
193
  function formatCompatNotice(verdict) {
306
194
  if (verdict.kind === "ok") return void 0;
307
- const pinTarget = resolvePinTarget(verdict.expected);
308
- const pins = formatPinCommands(verdict.expected);
309
- const pinBlock = pins.map((c) => ` ${c}`).join("\n");
310
- const pinNote = pinTarget && pinTarget !== verdict.expected ? ` (historical match: public ${pinTarget} for cluster ${verdict.expected}; GitHub usually published later)` : void 0;
195
+ const canUpdateToHost = formatUpgradeCommands(verdict.expected).length > 0;
311
196
  if (verdict.kind === "local_newer") {
312
- if (pins.length > 0) {
197
+ if (canUpdateToHost) {
313
198
  return [
314
199
  `[ae-cli] Host compat: local ${verdict.local} > environment ${verdict.expected} (cluster ${verdict.line}).`,
315
- ` Pin CLI + skills to the matched public release:`,
316
- pinBlock,
317
- ...pinNote ? [pinNote] : [],
200
+ ` Run: ${formatUnifiedUpdateCommand()} to sync CLI + skills to this host.`,
318
201
  ` Or update cluster components to the latest version.`
319
202
  ].join("\n");
320
203
  }
@@ -325,12 +208,10 @@ function formatCompatNotice(verdict) {
325
208
  ].join("\n");
326
209
  }
327
210
  if (verdict.kind === "local_older") {
328
- const upgrades = formatUpgradeCommands(verdict.expected);
329
- if (upgrades.length > 0) {
211
+ if (canUpdateToHost) {
330
212
  return [
331
213
  `[ae-cli] Host compat: local ${verdict.local} < environment ${verdict.expected} (cluster ${verdict.line}).`,
332
- ` Upgrade CLI + skills to the environment version:`,
333
- ...upgrades.map((c) => ` ${c}`)
214
+ ` Run: ${formatUnifiedUpdateCommand()} to sync CLI + skills to this host.`
334
215
  ].join("\n");
335
216
  }
336
217
  return [
@@ -339,12 +220,10 @@ function formatCompatNotice(verdict) {
339
220
  ` Ask the platform owner for the install package, or wait for a published build.`
340
221
  ].join("\n");
341
222
  }
342
- if (pins.length > 0) {
223
+ if (canUpdateToHost) {
343
224
  return [
344
225
  `[ae-cli] Host compat: local ${verdict.local} line mismatches environment ${verdict.expected} (cluster ${verdict.line}).`,
345
- ` Switch to the matched public release (CLI + skills):`,
346
- pinBlock,
347
- ...pinNote ? [pinNote] : [],
226
+ ` Run: ${formatUnifiedUpdateCommand()} to sync CLI + skills to this host.`,
348
227
  ` Or update cluster components to the latest version to match your CLI line.`
349
228
  ].join("\n");
350
229
  }
@@ -355,17 +234,19 @@ function formatCompatNotice(verdict) {
355
234
  }
356
235
 
357
236
  // src/core/compat-check.ts
358
- var CHECK_INTERVAL_MS2 = 24 * 60 * 60 * 1e3;
359
- var FETCH_TIMEOUT_MS2 = 3e3;
237
+ import fs from "fs";
238
+ import path from "path";
239
+ var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
240
+ var FETCH_TIMEOUT_MS = 3e3;
360
241
  var CLI_CONFIG_PATH = "/v1/ta/cli/config";
361
242
  function cacheFilePath() {
362
- return path2.join(getConfigDir(), "compat-check.json");
243
+ return path.join(getConfigDir(), "compat-check.json");
363
244
  }
364
245
  function readStore() {
365
246
  try {
366
247
  const file = cacheFilePath();
367
- if (!fs2.existsSync(file)) return { hosts: {} };
368
- const raw = JSON.parse(fs2.readFileSync(file, "utf8"));
248
+ if (!fs.existsSync(file)) return { hosts: {} };
249
+ const raw = JSON.parse(fs.readFileSync(file, "utf8"));
369
250
  if (!raw || typeof raw !== "object" || !raw.hosts) return { hosts: {} };
370
251
  return raw;
371
252
  } catch {
@@ -375,8 +256,8 @@ function readStore() {
375
256
  function writeStore(store) {
376
257
  try {
377
258
  const dir = getConfigDir();
378
- if (!fs2.existsSync(dir)) fs2.mkdirSync(dir, { recursive: true });
379
- fs2.writeFileSync(cacheFilePath(), JSON.stringify(store, null, 2));
259
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
260
+ fs.writeFileSync(cacheFilePath(), JSON.stringify(store, null, 2));
380
261
  } catch {
381
262
  }
382
263
  }
@@ -386,12 +267,12 @@ function hostKey(host) {
386
267
  function isStale(entry) {
387
268
  if (!entry?.lastFetchedAt) return true;
388
269
  const age = Date.now() - new Date(entry.lastFetchedAt).getTime();
389
- return age >= CHECK_INTERVAL_MS2;
270
+ return age >= CHECK_INTERVAL_MS;
390
271
  }
391
272
  function shouldNotify(entry) {
392
273
  if (!entry?.lastNotifiedAt) return true;
393
274
  const age = Date.now() - new Date(entry.lastNotifiedAt).getTime();
394
- return age >= CHECK_INTERVAL_MS2;
275
+ return age >= CHECK_INTERVAL_MS;
395
276
  }
396
277
  function shouldSkipCompatCheck(argv = process.argv) {
397
278
  if (process.env.AE_CLI_NO_COMPAT_CHECK === "1") return true;
@@ -410,7 +291,7 @@ async function fetchCliConfig(host, cliToken) {
410
291
  } catch {
411
292
  }
412
293
  const controller = new AbortController();
413
- const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS2);
294
+ const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
414
295
  try {
415
296
  const resp = await fetch(url.toString(), {
416
297
  signal: controller.signal,
@@ -437,13 +318,14 @@ function printNotice(text) {
437
318
  process.stderr.write(`${text}
438
319
  `);
439
320
  }
440
- function isNonInteractiveOutput() {
441
- return !process.stdout.isTTY || !process.stderr.isTTY;
442
- }
443
321
  var pendingHostCompatNotice;
322
+ var pendingUpdateNotice;
444
323
  function getPendingHostCompatNotice() {
445
324
  return pendingHostCompatNotice;
446
325
  }
326
+ function getPendingUpdateNotice() {
327
+ return pendingUpdateNotice;
328
+ }
447
329
  function getCachedCompatForHost(host) {
448
330
  return readStore().hosts[hostKey(host)];
449
331
  }
@@ -502,9 +384,9 @@ async function refreshAndMaybeNotify(host, pkg) {
502
384
  const notice = formatCompatNotice(verdict);
503
385
  if (!notice) {
504
386
  pendingHostCompatNotice = void 0;
387
+ pendingUpdateNotice = void 0;
505
388
  return;
506
389
  }
507
- pendingHostCompatNotice = notice;
508
390
  const entry = store.hosts[key] ?? {
509
391
  host: key,
510
392
  localVersion: pkg.version,
@@ -512,15 +394,28 @@ async function refreshAndMaybeNotify(host, pkg) {
512
394
  clusterVersion: cluster || "",
513
395
  lastFetchedAt: fetchedAt || (/* @__PURE__ */ new Date()).toISOString()
514
396
  };
515
- const dueForHumanTip = shouldNotify(entry);
516
- if (!dueForHumanTip && !isNonInteractiveOutput()) return;
517
- printNotice(notice);
518
- if (dueForHumanTip) {
519
- entry.lastNotifiedAt = (/* @__PURE__ */ new Date()).toISOString();
520
- }
521
397
  entry.localVersion = pkg.version;
522
398
  entry.expectedVersion = expected;
523
399
  entry.clusterVersion = cluster || entry.clusterVersion;
400
+ const dueForTip = shouldNotify(entry);
401
+ if (!dueForTip) {
402
+ pendingHostCompatNotice = void 0;
403
+ pendingUpdateNotice = void 0;
404
+ store.hosts[key] = entry;
405
+ writeStore(store);
406
+ return;
407
+ }
408
+ pendingHostCompatNotice = notice;
409
+ pendingUpdateNotice = {
410
+ command: "ae-cli update",
411
+ current: pkg.version,
412
+ expected,
413
+ cluster: cluster || "",
414
+ reason: verdict.kind,
415
+ message: `Current ae-cli is ${pkg.version}; this host requires ${expected}. Run: ae-cli update`
416
+ };
417
+ printNotice(notice);
418
+ entry.lastNotifiedAt = (/* @__PURE__ */ new Date()).toISOString();
524
419
  store.hosts[key] = entry;
525
420
  writeStore(store);
526
421
  }
@@ -631,12 +526,17 @@ async function formatOutput(data, format, jqExpr) {
631
526
  return formatTable(processed);
632
527
  }
633
528
  const hostCompat = getPendingHostCompatNotice();
529
+ const updateNotice = getPendingUpdateNotice();
530
+ const notices = {
531
+ ...updateNotice ? {} : hostCompat ? { host_compat: hostCompat } : {},
532
+ ...updateNotice ? { update: updateNotice } : {}
533
+ };
634
534
  const envelope = {
635
535
  ok: true,
636
536
  data: processed,
637
537
  ...meta ? { meta } : {},
638
538
  // Soft tip lives only under _notice (not mirrored into meta) to avoid duplicate fields.
639
- ...hostCompat ? { _notice: { host_compat: hostCompat } } : {}
539
+ ...Object.keys(notices).length > 0 ? { _notice: notices } : {}
640
540
  };
641
541
  return JSON.stringify(envelope, null, 2);
642
542
  }
@@ -657,15 +557,13 @@ function printError(type, message, hint, code, meta, options = {}) {
657
557
  }
658
558
  async function printOutput(data, format, jqExpr) {
659
559
  process.stdout.write(await formatOutput(data, format, jqExpr) + "\n");
660
- const hostCompat = getPendingHostCompatNotice();
661
- if (hostCompat && (!process.stdout.isTTY || !process.stderr.isTTY)) {
662
- process.stderr.write(`${hostCompat}
663
- `);
664
- }
665
560
  }
666
561
 
667
562
  export {
668
- notifyIfUpdateAvailable,
563
+ OPEN_SOURCE_AE_CLI_PACKAGE,
564
+ AE_CLI_SKILLS_REPO,
565
+ fetchCliConfig,
566
+ getCachedCompatForHost,
669
567
  formatCapabilityMissCompatHint,
670
568
  runHostCompatCheck,
671
569
  withOutputMetadata,
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-HQ2A7ITL.js";
9
9
  import {
10
10
  withOutputMetadata
11
- } from "./chunk-IMMGMU54.js";
11
+ } from "./chunk-JTKMDN4A.js";
12
12
 
13
13
  // src/core/capability-command.ts
14
14
  import { randomBytes } from "crypto";
@@ -1,7 +1,3 @@
1
- import {
2
- printError,
3
- printOutput
4
- } from "./chunk-IMMGMU54.js";
5
1
  import {
6
2
  GLOBAL_QUERY_CONFIG_KEY,
7
3
  getAnalysisMappingPathForClusterMode,
@@ -9,6 +5,10 @@ import {
9
5
  isGlobalQueryModeEnabled,
10
6
  setGlobalQueryModeEnabled
11
7
  } from "./chunk-LCXU3AAT.js";
8
+ import {
9
+ printError,
10
+ printOutput
11
+ } from "./chunk-JTKMDN4A.js";
12
12
  import "./chunk-E7UXXHO3.js";
13
13
  import "./chunk-IR4ZLVPW.js";
14
14
  import {