@thinkingai/ae-cli 6.1.43 → 6.1.45

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 (47) hide show
  1. package/README.md +2 -0
  2. package/README.zh.md +2 -0
  3. package/cli-installation-guide.md +13 -9
  4. package/dist/{ai-monitor-4VPHXQTL.js → ai-monitor-CAK6LX3J.js} +4 -4
  5. package/dist/ai-monitor.js +5 -5
  6. package/dist/{auth-RDSS2LUT.js → auth-CARBYPT2.js} +3 -3
  7. package/dist/{capability-CUOEIB5F.js → capability-CD2TODQN.js} +2 -2
  8. package/dist/{chunk-3FSYICDW.js → chunk-6SXMN2HQ.js} +1 -1
  9. package/dist/{chunk-TFEGYB4X.js → chunk-DR6IAQLM.js} +1 -1
  10. package/dist/{chunk-3TV24AVQ.js → chunk-FN4Y4XQG.js} +3 -3
  11. package/dist/{chunk-IAZ4AMVY.js → chunk-GXHCY75L.js} +145 -84
  12. package/dist/{chunk-LSELMDKQ.js → chunk-P56F3AO6.js} +1 -1
  13. package/dist/{chunk-BFSWGXM2.js → chunk-PHQHSCUW.js} +1 -1
  14. package/dist/{chunk-4MOCV6HU.js → chunk-PIZBBGBC.js} +1 -1
  15. package/dist/{compat-check-L3C7HCVG.js → compat-check-YXTLKMRM.js} +1 -1
  16. package/dist/{config-LAF5MMYK.js → config-5LO3IDS5.js} +3 -3
  17. package/dist/index.js +22 -21
  18. package/dist/{metadata-T6HYAU7E.js → metadata-JAN6NDRD.js} +4 -4
  19. package/dist/{personal-semantic-preference-WCZBOA7V.js → personal-semantic-preference-5FWTTPZW.js} +3 -3
  20. package/dist/{project-semantic-WW5AZST3.js → project-semantic-ZWDZ6RUS.js} +3 -3
  21. package/dist/{sync-6PL25V42.js → sync-WCN2LED5.js} +2 -2
  22. package/dist/{te-analysis-KKRECQ7F.js → te-analysis-OU3EUF3U.js} +106 -7
  23. package/dist/{te-community-6RGX7IWH.js → te-community-RWUUPHQJ.js} +3 -3
  24. package/dist/{te-dataops-RSPBC6WJ.js → te-dataops-RPKBT3JE.js} +2 -2
  25. package/dist/{te-engage-FIPP5L2Z.js → te-engage-4NZ26PAP.js} +3 -3
  26. package/dist/{te-experiment-KQ5CBYKI.js → te-experiment-PQD3SIKN.js} +3 -3
  27. package/dist/{te-kb-XYSDXZUG.js → te-kb-NX7E4CTY.js} +2 -2
  28. package/dist/{te-team-R6MZ4RK2.js → te-team-GMEOSXKP.js} +2 -2
  29. package/dist/{update-C6G4P3C7.js → update-273NPGJJ.js} +2 -2
  30. package/dist/{web-runtime-UGKPTBOK.js → web-runtime-ULVLVEJ4.js} +90 -38
  31. package/package.json +2 -2
  32. package/skills/ae-analysis-global/SKILL.md +2 -2
  33. package/skills/ae-community/SKILL.md +1 -1
  34. package/skills/ae-data-integration/SKILL.md +1 -1
  35. package/skills/ae-data-integration-helper/SKILL.md +1 -1
  36. package/skills/ae-generate-tracking-code/SKILL.md +1 -1
  37. package/skills/ae-generate-tracking-plan/SKILL.md +2 -2
  38. package/skills/ae-migrate-tracking-code/SKILL.md +2 -2
  39. package/skills/ae-onboarding/SKILL.md +26 -14
  40. package/skills/ae-onboarding/references/about-ae.md +28 -6
  41. package/skills/ae-onboarding/references/business-data.md +3 -3
  42. package/skills/ae-onboarding/references/demo-journey.md +4 -2
  43. package/skills/ae-onboarding/references/demo-operations.md +14 -5
  44. package/skills/ae-onboarding/references/member_invitation_send.md +21 -0
  45. package/skills/ae-onboarding/references/onboarding_growth.md +3 -5
  46. package/skills/ae-onboarding/references/onboarding_run.md +31 -5
  47. package/skills/ae-onboarding/references/presentation.md +18 -18
@@ -328,10 +328,22 @@ var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-
328
328
  var DEMO_SAMPLE_IDS = ["star-island", "season-pass"];
329
329
  var CHECKOUT_RECOVERY = "checkout-recovery";
330
330
  var OVERSEAS_TEST_PRODUCT_HOSTNAME = "plg-test-overseas-web.thinkingai.io";
331
+ var US_ONBOARDING_LANGUAGE = "en-US";
332
+ var GLOBAL_PRODUCT_HOSTNAME = "ae-web-global.thinkingai.io";
333
+ var US_SAAS_PRODUCT_HOST = `https://${GLOBAL_PRODUCT_HOSTNAME}`;
334
+ var CHINA_TRIAL_SAAS_PRODUCT_HOST = "https://ae-web.thinkingai.cn";
335
+ function isDomesticProductHost(hostname) {
336
+ return Boolean(hostname?.endsWith(".thinkingai.cn") || hostname?.endsWith(".thinkingdata.cn"));
337
+ }
338
+ function isUsOnboarding(host, market) {
339
+ const hostname = host ? new URL(host).hostname : void 0;
340
+ if (isDomesticProductHost(hostname)) return false;
341
+ return market ? market === "us" : hostname === GLOBAL_PRODUCT_HOSTNAME || hostname === OVERSEAS_TEST_PRODUCT_HOSTNAME;
342
+ }
331
343
  function onboardingDemoCurrency(host, region) {
332
344
  const hostname = host ? new URL(host).hostname : void 0;
333
- if (hostname === "ae-web-global.thinkingai.io" || hostname === OVERSEAS_TEST_PRODUCT_HOSTNAME) return "USD";
334
- if (hostname?.endsWith(".thinkingai.cn") || hostname?.endsWith(".thinkingdata.cn")) return "CNY";
345
+ if (hostname === GLOBAL_PRODUCT_HOSTNAME || hostname === OVERSEAS_TEST_PRODUCT_HOSTNAME) return "USD";
346
+ if (isDomesticProductHost(hostname)) return "CNY";
335
347
  return region === "us" ? "USD" : "CNY";
336
348
  }
337
349
  function onboardingGrowthScenario(value) {
@@ -423,6 +435,9 @@ function websiteOrigin(market, environment) {
423
435
  }
424
436
  return market === "cn" ? CHINA_PRODUCTION_ORIGIN : PRODUCTION_ISSUER;
425
437
  }
438
+ function productionWebsiteLoginPage(market) {
439
+ return `${websiteOrigin(market, "production")}${LOGIN_PATHS[market]}`;
440
+ }
426
441
  function isProductionWebsiteOrigin(origin) {
427
442
  return origin === PRODUCTION_ISSUER || origin === PRODUCTION_BROWSER_ORIGIN || origin === CHINA_PRODUCTION_ORIGIN;
428
443
  }
@@ -515,10 +530,11 @@ async function request(origin, endpoint, init, signal) {
515
530
  async function createBootstrap(market, source, host, signal, toolReference, environment, language) {
516
531
  const origin = bootstrapOrigin(market, environment);
517
532
  const tool = cliEntrySource(source);
533
+ const displayLanguage = market === "us" ? US_ONBOARDING_LANGUAGE : language;
518
534
  if (toolReference && (tool !== "codex" || !UUID_PATTERN.test(toolReference))) throw new Error("Invalid AI tool continuation reference.");
519
535
  const data = await request(origin, PATH, { method: "POST", headers: {
520
536
  "X-AE-CLI-Login-Mode": "website_login",
521
- ...language ? { "Accept-Language": language } : {}
537
+ ...displayLanguage ? { "Accept-Language": displayLanguage } : {}
522
538
  }, body: JSON.stringify({
523
539
  market,
524
540
  source,
@@ -759,7 +775,6 @@ function onboardingExperimentUrl(projectId, experimentId, host) {
759
775
 
760
776
  // src/core/onboarding/markdown-charts.ts
761
777
  var barWidth = 12;
762
- var ringMarks = ["\u2588", "\u2592"];
763
778
  var stackedMarks = ["\u{1F7E6}", "\u{1F7EA}", "\u2B1C"];
764
779
  function share(value, total) {
765
780
  return total ? `${(value * 100 / total).toFixed(1)}%` : "\u2014";
@@ -775,21 +790,15 @@ function comparisonMarkdown(points, maximum, percent = false) {
775
790
  function compositionTable(points, total, marks) {
776
791
  return ["| Group | Players | Share |", "| --- | ---: | ---: |", ...points.map(({ label, value }, index) => `| ${marks[index]} ${label} | ${value} | ${share(value, total)} |`)].join("\n");
777
792
  }
778
- function checkoutRingMarkdown(points) {
793
+ function checkoutShareMarkdown(points) {
779
794
  const total = points[0].value + points[1].value;
780
795
  if (!total) return null;
781
- const firstShare = points[0].value / total;
782
- const rows = [];
783
- for (let y = -4; y <= 4; y += 1) {
784
- let row = "";
785
- for (let x = -9; x <= 9; x += 1) {
786
- const radius = Math.hypot(x / 2, y);
787
- const angle = (Math.atan2(x / 2, -y) + 2 * Math.PI) % (2 * Math.PI);
788
- row += radius < 2.7 || radius > 4.5 ? " " : ringMarks[angle / (2 * Math.PI) < firstShare ? 0 : 1];
789
- }
790
- rows.push(row.trimEnd());
791
- }
792
- return ["```text", ...rows, "```", "", compositionTable(points, total, ringMarks)].join("\n");
796
+ const [unpaidMark, otherMark] = stackedMarks;
797
+ const unpaidWidth = Math.round(points[0].value * barWidth / total);
798
+ const bar = unpaidMark.repeat(unpaidWidth) + otherMark.repeat(barWidth - unpaidWidth);
799
+ return `${bar}
800
+
801
+ ${compositionTable(points, total, [unpaidMark, otherMark])}`;
793
802
  }
794
803
  function audienceShareMarkdown(points) {
795
804
  const total = points.reduce((sum, point) => sum + point.value, 0);
@@ -808,56 +817,30 @@ function audienceShareMarkdown(points) {
808
817
 
809
818
  ${compositionTable(points, total, stackedMarks)}`;
810
819
  }
811
- function dailyTrendMarkdown(points) {
812
- const levels = 6;
813
- const counts = points.map((point) => point.value);
814
- const minimum = Math.min(...counts);
815
- const maximum = Math.max(...counts);
816
- const step = Math.max(1, Math.ceil((maximum - minimum) / levels));
817
- const baseline = Math.max(0, maximum - step * levels);
818
- const spacing = 6;
819
- const grid = Array.from({ length: levels + 1 }, () => Array((points.length - 1) * spacing + 1).fill(" "));
820
- const heights = counts.map((value) => Math.round((value - baseline) / step));
821
- for (let index = 1; index < heights.length; index += 1) {
822
- const rise = heights[index] - heights[index - 1];
823
- for (let offset = 1; offset < spacing; offset += 1) {
824
- const height = Math.round(heights[index - 1] + rise * offset / spacing);
825
- const before = Math.round(heights[index - 1] + rise * (offset - 1) / spacing);
826
- const after = Math.round(heights[index - 1] + rise * (offset + 1) / spacing);
827
- const stroke = before === after ? "\u2500" : rise > 0 ? "\u2571" : "\u2572";
828
- grid[levels - height][(index - 1) * spacing + offset] = stroke;
829
- }
830
- }
831
- heights.forEach((height, index) => {
832
- grid[levels - height][index * spacing] = "\u25CF";
820
+ function dailyViewerChangesMarkdown(points) {
821
+ const rows = points.map(({ label, value }, index) => {
822
+ const date2 = label.slice(5).replace("-", "/");
823
+ const previousDay = points[index - 1];
824
+ let change = "\u2014";
825
+ if (previousDay) {
826
+ const difference = value - previousDay.value;
827
+ change = difference === 0 ? "No change" : `${difference > 0 ? "\u2191" : "\u2193"} ${Math.abs(difference)}`;
828
+ }
829
+ return `| ${date2} | ${value} | ${change} |`;
833
830
  });
834
- const labelWidth = String(baseline + step * levels).length;
835
- const dates = points.map((point) => point.label.slice(5).replace("-", "/"));
836
- const axis = grid.map((row, index) => `${String(baseline + (levels - index) * step).padStart(labelWidth)} \u2502 ${row.join("")}`.trimEnd());
837
- const table = [
838
- `| Date | ${dates.join(" | ")} |`,
839
- `| --- | ${dates.map(() => "---:").join(" | ")} |`,
840
- `| Viewers | ${points.map((point) => point.value).join(" | ")} |`
841
- ];
842
- return [
843
- "```text",
844
- ...axis,
845
- `${" ".repeat(labelWidth + 1)} \u2514${"\u2500".repeat(grid[0].length + 2)}`,
846
- `${" ".repeat(labelWidth + 1)}${dates.join(" ")}`,
847
- "```",
848
- "",
849
- ...table
850
- ].join("\n");
831
+ return ["| Date | Viewers | Change vs prior day |", "| --- | ---: | ---: |", ...rows].join("\n");
851
832
  }
852
- function funnelMarkdown(points, transitions) {
853
- const peak = points[0].value;
854
- const rows = points.map(({ label, value }, index) => {
855
- const width = peak ? Math.round(value * barWidth / peak) : 0;
856
- const transition = transitions[index - 1];
833
+ function purchasePathMarkdown(points, transitions) {
834
+ const path13 = points.map(({ label, value }) => `**${value}** ${label}`).join(" \u2192 ");
835
+ const details = points.slice(1).map(({ label }, index) => {
836
+ const transition = transitions[index];
857
837
  const rate = transition?.conversion_rate;
858
- return `| ${label} | ${value} | ${"\u2501".repeat(width)} | ${transition?.dropoff_accounts ?? "\u2014"} | ${rate == null ? "\u2014" : share(rate, 1)} |`;
838
+ const conversion = rate == null ? "\u2014" : share(rate, 1);
839
+ return `${points[index].label} \u2192 ${label} **${conversion}** (${transition?.dropoff_accounts ?? "\u2014"} lost)`;
859
840
  });
860
- return ["| Step | Players | Scale | Drop-off | Conversion |", "| --- | ---: | :---: | ---: | ---: |", ...rows].join("\n");
841
+ return `${path13}
842
+
843
+ ${details.join(" \xB7 ")}`;
861
844
  }
862
845
 
863
846
  // src/core/onboarding/growth.ts
@@ -950,12 +933,12 @@ async function resolveEventSource(call, projectId) {
950
933
  if (!["#event_time", "$part_date", "$part_event", "plg_sample_id", "item_id", "plg_seed_event_id"].every((name) => columns.has(name))) {
951
934
  throw new Error("The authorized Demo view is missing the fields required for growth analysis.");
952
935
  }
953
- if (columns.has("#account_id")) return { from: `${event} e`, account: 'e."#account_id"' };
936
+ if (columns.has("#account_id")) return { from: `${event} e`, account: 'e."#account_id"', eventColumns: columns };
954
937
  if (!columns.has("#user_id") || users.size !== 1) throw new Error("AE did not expose a verified Demo account-ID mapping.");
955
938
  const user = [...users][0];
956
939
  const userColumns = await readColumns(user);
957
940
  if (!userColumns.has("#user_id") || !userColumns.has("#account_id")) throw new Error("AE did not expose a verified Demo account-ID mapping.");
958
- return { from: `${event} e LEFT JOIN ${user} u ON e."#user_id" = u."#user_id"`, account: 'u."#account_id"' };
941
+ return { from: `${event} e LEFT JOIN ${user} u ON e."#user_id" = u."#user_id"`, account: 'u."#account_id"', eventColumns: columns };
959
942
  }
960
943
  function growthSql(scope, source) {
961
944
  const dailyCounts = sampleDates(scope.startDate).map((day) => `count_if(contains(view_dates, DATE '${day}'))`);
@@ -1243,11 +1226,11 @@ async function runOnboardingGrowth(store, deps, input, preview) {
1243
1226
  { label: "Single-day viewers", value: singleRate === null ? null : singleRate * 100 },
1244
1227
  { label: "Multi-day viewers", value: multiRate === null ? null : multiRate * 100 }
1245
1228
  ], 100, true),
1246
- checkout_share: checkoutRingMarkdown(checkoutShare),
1229
+ checkout_share: checkoutShareMarkdown(checkoutShare),
1247
1230
  audience_overlap: audienceShareMarkdown(audienceOverlap),
1248
- purchase_funnel: funnelMarkdown(funnelData, funnelTransitions),
1231
+ purchase_funnel: purchasePathMarkdown(funnelData, funnelTransitions),
1249
1232
  follow_up: comparisonMarkdown(followUpData, maxCount),
1250
- ...dailyData ? { daily_viewers: dailyTrendMarkdown(dailyData) } : {}
1233
+ ...dailyData ? { daily_viewers: dailyViewerChangesMarkdown(dailyData) } : {}
1251
1234
  },
1252
1235
  follow_up_chart: { type: "bar", data: followUpData, markdown: followUpMarkdown },
1253
1236
  follow_up_count: scenario === CHECKOUT_RECOVERY ? checkoutUnpaid : evidence.accountIds.length,
@@ -1278,8 +1261,8 @@ async function runOnboardingGrowth(store, deps, input, preview) {
1278
1261
  // src/core/onboarding/progress.ts
1279
1262
  var PROGRESS = "analysis.plg_onboarding.progress";
1280
1263
  var progressOrigins = /* @__PURE__ */ new Set([
1281
- "https://ae-web.thinkingai.cn",
1282
- "https://ae-web-global.thinkingai.io",
1264
+ CHINA_TRIAL_SAAS_PRODUCT_HOST,
1265
+ US_SAAS_PRODUCT_HOST,
1283
1266
  `https://${OVERSEAS_TEST_PRODUCT_HOSTNAME}`
1284
1267
  ]);
1285
1268
  function isOnboardingProgressHost(host) {
@@ -1302,15 +1285,25 @@ async function readProgress(deps, host) {
1302
1285
  return { state: error?.httpStatus === 404 || error?.code === "CAPABILITY_NOT_FOUND" ? "disabled" : "unavailable" };
1303
1286
  }
1304
1287
  }
1305
- async function verifyAndCompleteProgress(deps, host, runId) {
1288
+ function exposureColumn(columns, name) {
1289
+ if (columns.has(`#${name}`)) return `e."#${name}"`;
1290
+ if (columns.has(name)) return `e.${name}`;
1291
+ throw new Error("The authorized Demo view is missing the fields required to verify experiment exposure.");
1292
+ }
1293
+ async function verifyAndCompleteProgress(deps, host, runId, market) {
1306
1294
  const progress = await readProgress(deps, host);
1307
1295
  if (progress.state !== "in_progress") return progress;
1308
1296
  const { receipt, experiment_id, journey_id, demo_project_id } = progress;
1309
1297
  if (progress.run_id !== runId || !receipt || !experiment_id || !journey_id || !demo_project_id) {
1310
1298
  throw new Error("The current Demo replay checkpoint is not ready. Resume the experiment in the session that started it.");
1311
1299
  }
1300
+ if (isUsOnboarding(host, market) && receipt.currency !== "USD") {
1301
+ throw new Error("The saved Demo replay does not use USD. Continue with a USD Demo run.");
1302
+ }
1312
1303
  const call = (id, input) => deps.capability(host, id, input, AbortSignal.timeout(1e4));
1313
1304
  const source = await resolveEventSource(call, demo_project_id);
1305
+ const experimentColumn = exposureColumn(source.eventColumns, "experiment_id");
1306
+ const groupColumn = exposureColumn(source.eventColumns, "experiment_group_id");
1314
1307
  const dates = replayReportDates(receipt);
1315
1308
  const shiftDate2 = (date2, days) => new Date(Date.parse(date2) + days * 864e5).toISOString().slice(0, 10);
1316
1309
  const expected = /* @__PURE__ */ new Set();
@@ -1322,10 +1315,10 @@ async function verifyAndCompleteProgress(deps, host, runId) {
1322
1315
  }
1323
1316
  if (!expected.size) throw new Error("The Demo replay checkpoint contains no events.");
1324
1317
  const sql = `SELECT DISTINCT e."$part_event", CAST(${source.account} AS varchar),
1325
- CASE WHEN e."$part_event" = 'te_experiment_exposure' THEN CAST(e.experiment_group_id AS varchar) ELSE '' END
1318
+ CASE WHEN e."$part_event" = 'te_experiment_exposure' THEN CAST(${groupColumn} AS varchar) ELSE '' END
1326
1319
  FROM ${source.from}
1327
1320
  WHERE e."$part_date" BETWEEN ${sqlString(shiftDate2(dates.start_time, -1))} AND ${sqlString(shiftDate2(dates.end_time, 1))}
1328
- AND ((e."$part_event" = 'te_experiment_exposure' AND CAST(e.experiment_id AS varchar) = ${sqlString(experiment_id)})
1321
+ AND ((e."$part_event" = 'te_experiment_exposure' AND CAST(${experimentColumn} AS varchar) = ${sqlString(experiment_id)})
1329
1322
  OR (e.demo_run_id = ${sqlString(runId)} AND e.plg_sample_id = ${sqlString(receipt.sample_id)}
1330
1323
  AND e.item_id = ${sqlString(receipt.item_id)}
1331
1324
  AND (e."$part_event" = 'demo_coupon_claim'
@@ -1474,7 +1467,54 @@ function aeRegistrationUrl(language, env = process.env, source) {
1474
1467
  const tool = cliEntrySource(source, env);
1475
1468
  return websiteLoginUrl(market, "production", tool, cliToolReference(tool, env));
1476
1469
  }
1470
+ var existingDeployments = {
1471
+ step: "choose_existing_deployment",
1472
+ question: "Which type of AE environment do you use?",
1473
+ options: [
1474
+ { value: "saas", label: "ThinkingAI cloud (SaaS)" },
1475
+ { value: "private", label: "Privately deployed AE" },
1476
+ { value: "unsure", label: "I'm not sure" }
1477
+ ]
1478
+ };
1479
+ var existingSaasOptions = [
1480
+ {
1481
+ value: "us",
1482
+ label: "United States SaaS",
1483
+ login_url: productionWebsiteLoginPage("us"),
1484
+ login_method: "website",
1485
+ website_market: "us",
1486
+ ae_host: US_SAAS_PRODUCT_HOST
1487
+ },
1488
+ { value: "cn_paid", label: "China SaaS (paid)", login_url: "https://ta.thinkingdata.cn/", login_method: "device" },
1489
+ {
1490
+ value: "cn_free",
1491
+ label: "China SaaS (free)",
1492
+ login_url: productionWebsiteLoginPage("cn"),
1493
+ login_method: "website",
1494
+ website_market: "cn",
1495
+ ae_host: CHINA_TRIAL_SAAS_PRODUCT_HOST
1496
+ },
1497
+ { value: "other_address", label: "Use another AE address" }
1498
+ ];
1499
+ function existingAccountOptions(language) {
1500
+ return {
1501
+ deployment: existingDeployments,
1502
+ saas: {
1503
+ step: "choose_existing_saas",
1504
+ question: "Which ThinkingAI SaaS environment is your account in?",
1505
+ options: language === "zh-CN" ? existingSaasOptions.filter((option) => option.value !== "us") : existingSaasOptions,
1506
+ ...language === "en-US" ? { default_value: "us" } : {}
1507
+ }
1508
+ };
1509
+ }
1477
1510
  var AE_HOST_SETUP_COMMAND = "ae-cli config set-host <url>";
1511
+ var AE_CLI_SUPPORT_HELP = [
1512
+ "",
1513
+ "AE CLI support",
1514
+ " United States https://thinkingai.io/ or support.us@thinkingai.io",
1515
+ " China https://www.thinkingai.cn/ or 400-086-0901",
1516
+ ""
1517
+ ].join("\n");
1478
1518
  function missingAeHostHint(additionalAction) {
1479
1519
  const registration = aeRegistrationUrl();
1480
1520
  const actions = [
@@ -2694,7 +2734,7 @@ async function readBusinessConfigForExecution(hostOverride, synchronizeSkills =
2694
2734
  const token = peekCliToken(host);
2695
2735
  if (!token) return {};
2696
2736
  return await resolveBusinessConfig(host, token, async () => {
2697
- const { fetchCliConfig: fetchCliConfig2 } = await import("./compat-check-L3C7HCVG.js");
2737
+ const { fetchCliConfig: fetchCliConfig2 } = await import("./compat-check-YXTLKMRM.js");
2698
2738
  return fetchCliConfig2(host, token);
2699
2739
  }, Date.now(), synchronizeSkills);
2700
2740
  } catch {
@@ -2716,6 +2756,7 @@ var accountChoice = {
2716
2756
  { value: "existing_account", label: "Sign in to my existing AE account" }
2717
2757
  ]
2718
2758
  };
2759
+ var usOnboardingGuidance = `Use English (${US_ONBOARDING_LANGUAGE}) throughout US onboarding. Put a dollar sign before every displayed amount, such as $100. The market takes precedence over the device and conversation language.`;
2719
2760
  function distribution(packageName) {
2720
2761
  if (packageName === "@thinkingai/ae-cli") return { registry: "https://registry.npmjs.org", repository: "ThinkingAIAgenticEngine/ae-cli" };
2721
2762
  if (packageName === "@tant/ae-cli") return { registry: "https://npm.thinkingdata.cn:3443", repository: "http://10.27.249.150:8888/te-ai/te-cli.git" };
@@ -2728,6 +2769,7 @@ function newInstallationReport(packageName, version, dryRun = false) {
2728
2769
  // Keep the next interaction and detected language visible before Skill synchronization details.
2729
2770
  next_action: void 0,
2730
2771
  interaction: void 0,
2772
+ existing_account_options: void 0,
2731
2773
  local_language: void 0,
2732
2774
  cli: { package: packageName, version, path: null, entrypoint: null, verified: false, action: "pending", warnings: [] },
2733
2775
  skills: {
@@ -2960,20 +3002,26 @@ function runInstallation(options = {}) {
2960
3002
  report.ok = true;
2961
3003
  return report;
2962
3004
  }
3005
+ const confirmedHost = options.host || report.auth.authenticated === true ? report.auth.host : null;
3006
+ const usOnboarding = isUsOnboarding(confirmedHost ?? void 0);
2963
3007
  if (guideAccountSetup) {
2964
3008
  const localLanguage = localRegistrationLanguage(env, platform, runner);
2965
3009
  if (localLanguage) report.local_language = localLanguage;
2966
- report.onboarding_market = onboardingDeviceMarket(localLanguage);
3010
+ report.onboarding_market = usOnboarding ? "us" : onboardingDeviceMarket(localLanguage);
2967
3011
  const onboardingSkillPath = path9.join(packageRoot, "skills", "ae-onboarding", "SKILL.md");
2968
3012
  if (fs7.existsSync(onboardingSkillPath)) report.onboarding_skill_path = onboardingSkillPath;
2969
3013
  if (report.auth.authenticated === true) {
2970
3014
  report.next_action = isOnboardingProgressHost(report.auth.host ?? void 0) ? "check_onboarding" : "continue_using_ae";
2971
3015
  } else if (report.auth.warnings.length > 0) report.next_action = "check_authentication";
2972
- else report.next_action = "choose_account";
3016
+ else {
3017
+ report.next_action = "choose_account";
3018
+ if (!options.host) report.existing_account_options = existingAccountOptions(localLanguage);
3019
+ }
2973
3020
  }
2974
3021
  if (report.auth.authenticated === true) {
2975
3022
  if (report.next_action === "check_onboarding") {
2976
- report.next_steps.push("Check the signed-in account with ae-cli analysis onboarding progress --format json. Offer the current Demo only for not_started or in_progress. Continue the user\u2019s specific AE task first when one was requested.");
3023
+ report.next_steps.push(`Check the signed-in account with ae-cli analysis onboarding progress --format json --host ${report.auth.host}. Offer the current Demo only for not_started or in_progress. Continue the user\u2019s specific AE task first when one was requested.`);
3024
+ if (usOnboarding) report.next_steps.push(usOnboardingGuidance);
2977
3025
  } else {
2978
3026
  report.next_steps.push("You are signed in. Continue your AE task in this AI tool using the existing environment.");
2979
3027
  }
@@ -2982,20 +3030,20 @@ function runInstallation(options = {}) {
2982
3030
  report.next_steps.push(`Check the configured AE environment with ae-cli auth status${hostOption} --format json. If it still cannot be verified, confirm the intended environment before starting signup or login.`);
2983
3031
  } else {
2984
3032
  const chooseAccount = report.next_action === "choose_account";
3033
+ const source = cliEntrySource(void 0, env);
2985
3034
  if (chooseAccount) {
2986
3035
  report.interaction = accountChoice;
2987
3036
  report.next_steps.push(
2988
- "After verifying a fresh install, when the user has left the account route open, offer \u201CCreate an AE account\u201D and \u201CSign in to my existing AE account\u201D in the user\u2019s language. In an AI Agent, show these options in the same turn using the native choice dialog, even for a request that only asks to install. Keep the turn open until the user chooses or dismisses the dialog. If the dialog is unavailable or fails, ask with the same options in chat. A supplied host only identifies the environment. Wait for the account choice before starting signup or device authorization. For an explicit existing-account login request, use the original AE environment."
3037
+ `After verifying a fresh install, when the user has left the account route open, offer \u201CCreate an AE account\u201D and \u201CSign in to my existing AE account\u201D in the resolved onboarding language. ${usOnboardingGuidance} In an AI Agent, show these options in the same turn using the native choice dialog, even for a request that only asks to install. Keep the turn open until the user chooses or dismisses the dialog. If the dialog is unavailable or fails, ask with the same options in chat. A supplied host only identifies the environment. Wait for the account choice before starting signup or device authorization. For an explicit existing-account login request, use the original AE environment.`
2989
3038
  );
2990
3039
  report.next_steps.push("For an explicit onboarding or walkthrough that needs a new account, show \u201CCreate an AE account\u201D and \u201CLearn about AE\u201D using the localized labels from references/about-ae.md next to onboarding_skill_path. If they choose \u201CLearn about AE\u201D, show the localized introduction and available product resources from that reference. Offer \u201CCreate an AE account\u201D and wait for their choice.");
2991
3040
  }
2992
3041
  if (chooseAccount || !report.auth.host) {
2993
- const source = cliEntrySource(void 0, env);
2994
3042
  if (chooseAccount) {
2995
3043
  report.next_steps.push(`After the user confirms signup in the overseas test environment, run ae-cli analysis onboarding run --website-env test --region us --source ${source} --browser system --format json. Use jp or kr for the corresponding requested test market and keep the returned session_id.`);
2996
3044
  report.next_steps.push(
2997
- "For production signup, honor an explicitly requested or confirmed market first. Otherwise compare local_language with the language of the user\u2019s own request, excluding commands, links, quoted text, and picker labels. Map Chinese to cn, English to us, Japanese to jp, and Korean to kr. If both signals agree or only one maps to a market, use that market. When the two markets differ, show only those two options and wait. Use us if neither language maps to a market.",
2998
- `After the user chooses \u201CCreate an AE account\u201D or directly asks to sign up, run ae-cli analysis onboarding run --region <market> --source ${source} --browser system --format json with the resolved market. Pass --language separately for the display preference. If the browser cannot open, share the returned login_url. Read the returned skill_path and resume with its session_id after sign-in.`
3045
+ "For production signup, honor an explicitly requested or confirmed market first. Use the US free trial for an English device and the China free trial for a Chinese device. For other or unknown device languages, compare local_language with the language of the user\u2019s own request, excluding commands, links, quoted text, and picker labels. Map Chinese to cn, English to us, Japanese to jp, and Korean to kr. If both signals agree or only one maps to a market, use that market. When the two markets differ, show only those two options and wait. Use us if neither language maps to a market.",
3046
+ `After the user chooses \u201CCreate an AE account\u201D or directly asks to sign up, run ae-cli analysis onboarding run --region <market> --website-env production --source ${source} --browser system --format json with the resolved production market. Pass --language separately for the display preference. If the browser cannot open, share the returned login_url. Read the returned skill_path and resume with its session_id after sign-in.`
2999
3047
  );
3000
3048
  } else {
3001
3049
  const language = registrationLanguage(void 0, env);
@@ -3003,10 +3051,19 @@ function runInstallation(options = {}) {
3003
3051
  report.next_steps.push(`New or returning website users: for guided website verification, run ae-cli analysis onboarding run --language ${language} --source ${source} --browser system. For manual registration or sign-in, use ${registration} in the system default browser.`);
3004
3052
  }
3005
3053
  }
3006
- if (chooseAccount) report.next_steps.push("Existing AE users: confirm their original AE environment URL and use it for login. Ask for that URL if it is unknown.");
3054
+ if (chooseAccount) report.next_steps.push(
3055
+ "Existing AE users: confirm their original AE environment URL when already known. " + (report.existing_account_options ? "Otherwise present existing_account_options.deployment and, for SaaS, existing_account_options.saas. Wait for confirmation of the SaaS choice, including any default. Ask for the usual AE login URL for private, unsure, or another address. Use the confirmed service host for any login commands that follow. " : "Use the supplied host for the existing account when it matches the user\u2019s intended environment. ") + "Follow the existing-account sign-in guide and check auth status on the selected AE service host before starting sign-in."
3056
+ );
3007
3057
  else if (!report.auth.host) report.next_steps.push("Existing AE users: use your original environment URL, or ask your administrator.");
3008
- report.next_steps.push(`ae-cli auth login --host ${report.auth.host ?? "<AE_HOST>"} --no-wait`);
3009
- report.next_steps.push("Complete browser authorization, then resume the same login using its returned host and device code. Keep the private device code local.");
3058
+ if (chooseAccount && usOnboarding && confirmedHost) {
3059
+ const websiteEnv = new URL(confirmedHost).hostname === OVERSEAS_TEST_PRODUCT_HOSTNAME ? "test" : "production";
3060
+ report.next_steps.push(`For US onboarding with an existing account, run ae-cli analysis onboarding run --host ${confirmedHost} --region us --language ${US_ONBOARDING_LANGUAGE} --website-env ${websiteEnv} --source ${source} --browser system --format json. Resume with the returned session_id after signing in on the official website.`);
3061
+ } else if (chooseAccount && confirmedHost === CHINA_TRIAL_SAAS_PRODUCT_HOST) {
3062
+ report.next_steps.push(`For China free SaaS onboarding with an existing account, run ae-cli analysis onboarding run --host ${confirmedHost} --region cn --website-env production --source ${source} --browser system --format json. Resume with the returned session_id after signing in on the official website.`);
3063
+ } else {
3064
+ report.next_steps.push(`ae-cli auth login --host ${confirmedHost ?? "<AE_HOST>"} --no-wait`);
3065
+ report.next_steps.push("Complete browser authorization, then resume the same login using its returned host and device code. Keep the private device code local.");
3066
+ }
3010
3067
  }
3011
3068
  report.ok = true;
3012
3069
  return report;
@@ -3670,6 +3727,8 @@ export {
3670
3727
  DEMO_SAMPLE_IDS,
3671
3728
  CHECKOUT_RECOVERY,
3672
3729
  OVERSEAS_TEST_PRODUCT_HOSTNAME,
3730
+ US_ONBOARDING_LANGUAGE,
3731
+ isUsOnboarding,
3673
3732
  onboardingDemoCurrency,
3674
3733
  onboardingGrowthScenario,
3675
3734
  replayReportDates,
@@ -3707,6 +3766,8 @@ export {
3707
3766
  registrationLanguage,
3708
3767
  registrationMarket,
3709
3768
  aeRegistrationUrl,
3769
+ existingAccountOptions,
3770
+ AE_CLI_SUPPORT_HELP,
3710
3771
  missingAeHostHint,
3711
3772
  missingAeHostGuidance,
3712
3773
  businessForCommand,
@@ -6,7 +6,7 @@ import {
6
6
  readOutputMetadata,
7
7
  unwrapOutputData,
8
8
  withOutputMetadata
9
- } from "./chunk-4MOCV6HU.js";
9
+ } from "./chunk-PIZBBGBC.js";
10
10
  import {
11
11
  CapabilityGatewayError,
12
12
  fetchCapabilityGateway,
@@ -6,7 +6,7 @@ import {
6
6
  rememberBusinessConfig,
7
7
  reserveBusinessSkillContext,
8
8
  syncBusinessSkills
9
- } from "./chunk-IAZ4AMVY.js";
9
+ } from "./chunk-GXHCY75L.js";
10
10
  import {
11
11
  getLocalCliPackageInfo
12
12
  } from "./chunk-7KBENPQF.js";
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from 'node:module'; const require =
2
2
  import {
3
3
  getPendingHostCompatNotice,
4
4
  getPendingUpdateNotice
5
- } from "./chunk-IAZ4AMVY.js";
5
+ } from "./chunk-GXHCY75L.js";
6
6
  import {
7
7
  logger,
8
8
  redactExternalCliToken
@@ -12,7 +12,7 @@ import {
12
12
  shouldNotifyCompat,
13
13
  shouldSkipAutoSync,
14
14
  shouldSkipCompatCheck
15
- } from "./chunk-IAZ4AMVY.js";
15
+ } from "./chunk-GXHCY75L.js";
16
16
  import "./chunk-7KBENPQF.js";
17
17
  import "./chunk-FKTVD63C.js";
18
18
  import "./chunk-FEYZBUFQ.js";
@@ -4,7 +4,7 @@ import {
4
4
  invalidateBusinessSkillSynchronization,
5
5
  refreshEnvironmentAfterLogin,
6
6
  refreshEnvironmentConfig
7
- } from "./chunk-BFSWGXM2.js";
7
+ } from "./chunk-PHQHSCUW.js";
8
8
  import {
9
9
  MultiselectCancelled,
10
10
  promptSingleSelect
@@ -12,14 +12,14 @@ import {
12
12
  import {
13
13
  printError,
14
14
  printOutput
15
- } from "./chunk-4MOCV6HU.js";
15
+ } from "./chunk-PIZBBGBC.js";
16
16
  import {
17
17
  aeRegistrationUrl,
18
18
  fetchCliConfig,
19
19
  missingAeHostHint,
20
20
  readCurrentBusinessConfig,
21
21
  resolveKbAutoDiscoveryFeature
22
- } from "./chunk-IAZ4AMVY.js";
22
+ } from "./chunk-GXHCY75L.js";
23
23
  import "./chunk-7KBENPQF.js";
24
24
  import {
25
25
  peekCliToken