@thinkingai/ae-cli 6.1.33 → 6.1.35

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 (85) hide show
  1. package/README.md +2 -2
  2. package/README.zh.md +2 -6
  3. package/cli-installation-guide.md +18 -4
  4. package/dist/{ai-monitor-OHTSU6SV.js → ai-monitor-TVRFVZBH.js} +10 -9
  5. package/dist/ai-monitor.js +17 -16
  6. package/dist/{auth-2MOK4OI6.js → auth-JAXLMPBB.js} +25 -317
  7. package/dist/{automation-6L6IAYRK.js → automation-OQ647CSW.js} +7 -6
  8. package/dist/{capability-EMIHQJA3.js → capability-2Z4ZXTPD.js} +18 -16
  9. package/dist/chunk-2H3SFJE3.js +344 -0
  10. package/dist/{chunk-RC3PPCYD.js → chunk-3PZNM5KN.js} +3 -3
  11. package/dist/chunk-3ZQY7SLZ.js +147 -0
  12. package/dist/{chunk-NNK3JBH4.js → chunk-6E6HCTP2.js} +2 -2
  13. package/dist/{local-data-upload-client-YTWMAAGE.js → chunk-6IUTXRAD.js} +32 -4
  14. package/dist/{chunk-VLOGOM7N.js → chunk-CYZV5AXW.js} +8 -5
  15. package/dist/{chunk-O45NOIWR.js → chunk-DE5XHQQ6.js} +2 -2
  16. package/dist/{chunk-KD5UC33N.js → chunk-E5CJI7L3.js} +7 -5
  17. package/dist/{chunk-UCMO4LKL.js → chunk-EQMGH32F.js} +2 -2
  18. package/dist/{chunk-E3ONSFUN.js → chunk-FNACCKQR.js} +211 -12
  19. package/dist/{chunk-2I5SZ5DS.js → chunk-GD5JSAGV.js} +2 -2
  20. package/dist/{chunk-EFGUBGA6.js → chunk-GYODT7C4.js} +1 -1
  21. package/dist/chunk-HBI7IQH3.js +1207 -0
  22. package/dist/{chunk-AMURHMS3.js → chunk-IGU3R2JD.js} +4 -4
  23. package/dist/{chunk-YE6MJB5V.js → chunk-IWMDPHMI.js} +3 -3
  24. package/dist/{chunk-LFJ7N36I.js → chunk-L7MT53VM.js} +5 -3
  25. package/dist/{chunk-HIMOBNEY.js → chunk-LXRALNNA.js} +2 -2
  26. package/dist/{chunk-BQFLABJQ.js → chunk-M2OCZRVX.js} +7 -5
  27. package/dist/{chunk-R2SVAO4G.js → chunk-MTK4ZE7W.js} +3 -143
  28. package/dist/{chunk-7DHSB3FL.js → chunk-NK5PS5X7.js} +3 -3
  29. package/dist/{chunk-HQED4YB4.js → chunk-NPH5J65M.js} +1 -1
  30. package/dist/{chunk-EWVEAERM.js → chunk-Q764EZND.js} +78 -72
  31. package/dist/chunk-QOJXLXDJ.js +55 -0
  32. package/dist/{chunk-THTROEGD.js → chunk-QPUPWGZ3.js} +1 -1
  33. package/dist/{chunk-XZDKAR4N.js → chunk-RLPMXKDQ.js} +8921 -10119
  34. package/dist/{chunk-DWAG2QJM.js → chunk-S74XV3A6.js} +4 -4
  35. package/dist/{chunk-COOMXFUG.js → chunk-SHB7A2JE.js} +3 -3
  36. package/dist/{chunk-PLNS5J33.js → chunk-UWQXGF44.js} +17 -9
  37. package/dist/{data-integration-UNJ7EPW2.js → chunk-V6UKLIM6.js} +160 -2258
  38. package/dist/{chunk-4IQYPWCX.js → chunk-VPLRZSMY.js} +18 -10
  39. package/dist/{chunk-KA5WKR5P.js → chunk-Z6WSCIHM.js} +2 -2
  40. package/dist/{community-report-client-ULRNXLQV.js → community-report-client-5VNT6HCV.js} +4 -2
  41. package/dist/{compat-check-CADG7GND.js → compat-check-E7AQ7UCG.js} +5 -4
  42. package/dist/{config-PFD3KWQG.js → config-PGSUWIK5.js} +15 -11
  43. package/dist/{context-SOQDFZIB.js → context-Y2A6QIS3.js} +5 -4
  44. package/dist/conversion-4FR3RA45.js +16 -0
  45. package/dist/data-integration-EIF5QHYF.js +2138 -0
  46. package/dist/{evaluation-Q3AIGFOG.js → evaluation-OZM54MES.js} +6 -5
  47. package/dist/index.js +74 -51
  48. package/dist/local-data-upload-client-2U3LFD7Z.js +16 -0
  49. package/dist/{memory-HKNGUIPK.js → memory-6QMZS4HF.js} +7 -6
  50. package/dist/{metadata-GFWR5ZHC.js → metadata-7MZ3CJ2N.js} +10 -9
  51. package/dist/{model-NAKQWK4W.js → model-LEYRQKOS.js} +8 -7
  52. package/dist/{personal-semantic-preference-JCTKXLC3.js → personal-semantic-preference-SWOUNDWJ.js} +9 -8
  53. package/dist/{project-semantic-B2NWQOKK.js → project-semantic-M2DDPAMD.js} +9 -8
  54. package/dist/{sync-UQH4J4BD.js → sync-PWC63JCO.js} +16 -15
  55. package/dist/{te-agent-L6EYFQCC.js → te-agent-S7UH657Z.js} +11 -9
  56. package/dist/{te-analysis-U7NNOY66.js → te-analysis-BK6PE333.js} +281 -214
  57. package/dist/{te-community-3UQEW3KD.js → te-community-OLNTKGCW.js} +12 -10
  58. package/dist/{te-dataops-SUNYXF5G.js → te-dataops-XUWRIF5R.js} +12 -10
  59. package/dist/{te-engage-KMXZJ2KN.js → te-engage-I3I4FJOM.js} +9 -8
  60. package/dist/{te-experiment-IEYKP6VC.js → te-experiment-XSDUL4KH.js} +9 -8
  61. package/dist/{te-kb-MT3V5ZMH.js → te-kb-QFH3YLFQ.js} +15 -13
  62. package/dist/{te-system-F4ZU2HRQ.js → te-system-DB5Z3LLF.js} +7 -6
  63. package/dist/{te-team-M6E6XQ5H.js → te-team-UADF2HBO.js} +9 -8
  64. package/dist/{things-FRLBZV2Z.js → things-G2QFXDK7.js} +9 -8
  65. package/dist/{update-NULYHVE6.js → update-6I366ICW.js} +7 -8
  66. package/dist/web-runtime-3XFREWRF.js +2367 -0
  67. package/dist/{workspace-Z7L33OBQ.js → workspace-RZESYB6T.js} +7 -6
  68. package/package.json +4 -3
  69. package/skills/ae-analysis/SKILL.md +1 -1
  70. package/skills/ae-data-integration/references/ue-mapping.md +2 -0
  71. package/skills/ae-onboarding/SKILL.md +64 -0
  72. package/skills/ae-onboarding/references/business-sdk.md +8 -0
  73. package/skills/ae-onboarding/references/demo-operations.md +79 -0
  74. package/skills/ae-onboarding/references/import.md +19 -0
  75. package/skills/ae-onboarding/references/onboarding_experiment_launch.md +12 -0
  76. package/skills/ae-onboarding/references/onboarding_experiment_plan.md +14 -0
  77. package/skills/ae-onboarding/references/onboarding_growth.md +36 -0
  78. package/skills/ae-onboarding/references/onboarding_run.md +11 -0
  79. package/skills/ae-onboarding/references/onboarding_status.md +5 -0
  80. package/skills/ae-onboarding/scripts/experiment-preset.json +252 -0
  81. package/skills/ae-onboarding/scripts/experiment-requests.mjs +120 -0
  82. package/skills/ae-onboarding/scripts/generate.mjs +170 -0
  83. package/skills/ae-onboarding/scripts/resolve-experiment-preset.mjs +26 -0
  84. package/skills/ae-onboarding/scripts/web-journey.mjs +39 -0
  85. package/dist/chunk-6ZIQV5GW.js +0 -26
@@ -5,19 +5,21 @@ import {
5
5
  import {
6
6
  internalCallSourceHeaders,
7
7
  peekCliToken
8
- } from "./chunk-PLNS5J33.js";
8
+ } from "./chunk-UWQXGF44.js";
9
9
  import {
10
10
  getActiveHost,
11
11
  getConfigDir,
12
12
  isAeSandboxRuntime,
13
13
  readSandboxCliTokenEntry
14
- } from "./chunk-AMURHMS3.js";
14
+ } from "./chunk-IGU3R2JD.js";
15
15
  import {
16
- PermissionError,
17
16
  externalCliTokenRequestOptions,
18
17
  normalizeUrl,
19
18
  readExternalCliToken
20
- } from "./chunk-R2SVAO4G.js";
19
+ } from "./chunk-MTK4ZE7W.js";
20
+ import {
21
+ PermissionError
22
+ } from "./chunk-3ZQY7SLZ.js";
21
23
 
22
24
  // src/core/compat-check.ts
23
25
  import fs10 from "fs";
@@ -324,6 +326,10 @@ import fs2 from "fs";
324
326
  import os from "os";
325
327
  import path2 from "path";
326
328
  import { parseDocument } from "yaml";
329
+ var ON_DEMAND_SKILLS = /* @__PURE__ */ new Set(["ae-onboarding"]);
330
+ function readInstallableSkills(directory, select) {
331
+ return readBundledSkills(directory, (name) => !ON_DEMAND_SKILLS.has(name) && (!select || select(name)));
332
+ }
327
333
  function globalSkillsDirectory() {
328
334
  return path2.join(os.homedir(), ".agents", "skills");
329
335
  }
@@ -396,6 +402,123 @@ function verifyGlobalSkills(skills, directory) {
396
402
  });
397
403
  }
398
404
 
405
+ // src/core/onboarding/contracts.ts
406
+ var DEMO_CONTEXT = "project.plg_demo.context";
407
+ var DEMO_ENSURE = "project.plg_demo.ensure";
408
+ var DEMO_STATUS = "project.plg_demo.status";
409
+ var RUN_BUDGET_MS = 45e3;
410
+ var NETWORK_BUDGET_MS = 35e3;
411
+ var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
412
+ var DEMO_SAMPLE_IDS = ["star-island", "season-pass"];
413
+ var CHECKOUT_RECOVERY = "checkout-recovery";
414
+ function onboardingGrowthScenario(value) {
415
+ if (value === void 0 || value === "item-coupon") return "item-coupon";
416
+ if (value === CHECKOUT_RECOVERY) return CHECKOUT_RECOVERY;
417
+ throw new Error("Use --scenario item-coupon or checkout-recovery.");
418
+ }
419
+
420
+ // src/core/website-entry.ts
421
+ var LOGIN_PATHS = { jp: "/jp/experience-login/", kr: "/kr/experience-login/", us: "/en/experience-login/" };
422
+ var WEBSITE_MARKETS = Object.keys(LOGIN_PATHS);
423
+ var PRODUCTION_ISSUER = "https://thinkingai.io";
424
+ var PRODUCTION_BROWSER_ORIGIN = "https://www.thinkingai.io";
425
+ function isWebsiteMarket(market) {
426
+ return Object.hasOwn(LOGIN_PATHS, market);
427
+ }
428
+ function websiteEnvironment(value, env = process.env) {
429
+ const selected = value ?? env.AE_CLI_WEBSITE_ENV ?? "production";
430
+ if (selected !== "production") throw new Error("Website onboarding supports only the production environment.");
431
+ return "production";
432
+ }
433
+ function websiteOrigin(market, environment) {
434
+ websiteEnvironment(environment, {});
435
+ if (!isWebsiteMarket(market)) throw new Error("Website onboarding is available in Japan, Korea, and the United States. Use --region jp, kr, or us.");
436
+ return PRODUCTION_ISSUER;
437
+ }
438
+ function isProductionWebsiteOrigin(origin) {
439
+ return origin === PRODUCTION_ISSUER || origin === PRODUCTION_BROWSER_ORIGIN;
440
+ }
441
+ function environmentForWebsiteOrigin(origin) {
442
+ if (isProductionWebsiteOrigin(origin)) return "production";
443
+ throw new Error("Untrusted onboarding website.");
444
+ }
445
+ function cliEntrySource(source, env = process.env) {
446
+ const selected = source ?? (UUID_PATTERN.test(env.CODEX_THREAD_ID ?? "") ? "codex" : "other");
447
+ if (!["codex", "cursor", "claude-code", "other"].includes(selected)) throw new Error("Unsupported local AI tool source.");
448
+ return selected;
449
+ }
450
+ function cliToolReference(source, env = process.env) {
451
+ return source === "codex" && UUID_PATTERN.test(env.CODEX_THREAD_ID ?? "") ? env.CODEX_THREAD_ID : void 0;
452
+ }
453
+ function withCliEntryContext(value, source, market, toolReference) {
454
+ const url = new URL(value);
455
+ if (url.protocol !== "https:" || url.username || url.password) throw new Error("Untrusted website continuation URL.");
456
+ if ([...url.searchParams.keys()].some((key) => /^(device_code|poll_token|access_token|refresh_token|cli[_-]token|token)$/i.test(key))) {
457
+ throw new Error("The website returned a private credential in its public continuation URL.");
458
+ }
459
+ const references = url.searchParams.getAll("tool_reference");
460
+ if (references.length > 1 || references.some((reference) => !UUID_PATTERN.test(reference))) throw new Error("Invalid AI tool continuation reference.");
461
+ url.searchParams.set("entry", "cli");
462
+ url.searchParams.set("source", cliEntrySource(source));
463
+ if (market && !url.searchParams.has("market")) url.searchParams.set("market", market);
464
+ if (toolReference) {
465
+ if (source !== "codex" || !UUID_PATTERN.test(toolReference)) throw new Error("Invalid AI tool continuation reference.");
466
+ if (references.length && references[0] !== toolReference) throw new Error("The website returned a mismatched AI tool continuation reference.");
467
+ if (!url.searchParams.has("tool_reference")) url.searchParams.set("tool_reference", toolReference);
468
+ }
469
+ return url.toString();
470
+ }
471
+ function websiteLoginUrl(market, environment, source, toolReference) {
472
+ websiteEnvironment(environment, {});
473
+ if (!isWebsiteMarket(market)) throw new Error("Website onboarding is available in Japan, Korea, and the United States. Use --region jp, kr, or us.");
474
+ return withCliEntryContext(`${PRODUCTION_BROWSER_ORIGIN}${LOGIN_PATHS[market]}`, source, market, toolReference);
475
+ }
476
+
477
+ // src/core/host-guidance.ts
478
+ function normalizeRegistrationLanguage(value) {
479
+ const language = value.trim().toLowerCase().split(/[_.:@-]/)[0];
480
+ if (language === "zh" || language === "cn") return "zh-CN";
481
+ if (language === "ja" || language === "jp") return "ja-JP";
482
+ if (language === "ko" || language === "kr") return "ko-KR";
483
+ return language === "en" ? "en-US" : void 0;
484
+ }
485
+ function registrationLanguage(language, env = process.env) {
486
+ const value = language || env.AE_LANG || env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE || "";
487
+ return normalizeRegistrationLanguage(value) ?? "en-US";
488
+ }
489
+ function registrationMarket(language) {
490
+ return { "zh-CN": "cn", "en-US": "us", "ja-JP": "jp", "ko-KR": "kr" }[language];
491
+ }
492
+ function aeRegistrationUrl(language, env = process.env, source) {
493
+ const market = registrationMarket(registrationLanguage(language, env));
494
+ if (!isWebsiteMarket(market)) return AE_TRIAL_URL;
495
+ const tool = cliEntrySource(source, env);
496
+ return websiteLoginUrl(market, "production", tool, cliToolReference(tool, env));
497
+ }
498
+ var AE_TRIAL_URL = "https://thinkingai.cn/request-demo";
499
+ var AE_HOST_SETUP_COMMAND = "ae-cli config set-host <url>";
500
+ function missingAeHostHint(additionalAction) {
501
+ const registration = aeRegistrationUrl();
502
+ const actions = [
503
+ `If your organization already uses AgenticEngine, ask your administrator for its AE URL, then run: ${AE_HOST_SETUP_COMMAND} and ae-cli auth login --host <url>. Keep your existing account's environment.`,
504
+ registration === AE_TRIAL_URL ? `To request a trial, visit ${registration}.` : `To register or sign in, visit ${registration}, or run ae-cli analysis onboarding run for guided setup.`
505
+ ];
506
+ if (additionalAction) actions.push(additionalAction);
507
+ return actions.join(" ");
508
+ }
509
+ function missingAeHostGuidance() {
510
+ const registration = aeRegistrationUrl();
511
+ return {
512
+ configure_host: AE_HOST_SETUP_COMMAND,
513
+ existing_customer: "Use the original AE environment URL when known, or ask your administrator.",
514
+ request_trial_url: registration,
515
+ ...registration === AE_TRIAL_URL ? {} : {
516
+ registration_login_url: registration,
517
+ onboarding_command: "ae-cli analysis onboarding run"
518
+ }
519
+ };
520
+ }
521
+
399
522
  // src/core/business-config.ts
400
523
  import crypto2 from "crypto";
401
524
  import fs6 from "fs";
@@ -415,6 +538,7 @@ var skill_businesses_default = {
415
538
  "ae-generate-tracking-plan",
416
539
  "ae-metadata",
417
540
  "ae-migrate-tracking-code",
541
+ "ae-onboarding",
418
542
  "ae-tracking-matrix"
419
543
  ],
420
544
  dataops: [
@@ -1276,7 +1400,7 @@ function syncBusinessSkills(options) {
1276
1400
  writeJson(ledgerFile, ledger);
1277
1401
  }
1278
1402
  }
1279
- const bundled = readBundledSkills(options.skillsDirectory, select);
1403
+ const bundled = readInstallableSkills(options.skillsDirectory, select);
1280
1404
  const skills = new Set(bundled.map((skill) => skill.name));
1281
1405
  if (options.mode !== "adopt") {
1282
1406
  for (const name of [...history.names, ...Object.values(ledger.copies).map((copy) => copy.skill)]) {
@@ -1592,7 +1716,7 @@ async function readBusinessConfigForExecution(hostOverride, synchronizeSkills =
1592
1716
  const token = peekCliToken(host);
1593
1717
  if (!token) return {};
1594
1718
  return await resolveBusinessConfig(host, token, async () => {
1595
- const { fetchCliConfig: fetchCliConfig2 } = await import("./compat-check-CADG7GND.js");
1719
+ const { fetchCliConfig: fetchCliConfig2 } = await import("./compat-check-E7AQ7UCG.js");
1596
1720
  return fetchCliConfig2(host, token);
1597
1721
  }, Date.now(), synchronizeSkills);
1598
1722
  } catch {
@@ -1749,7 +1873,7 @@ function runInstallation(options = {}) {
1749
1873
  if (!fs7.existsSync(path7.join(stateDirectory, "business-skills.json")) && installedBefore?.name === packageName) {
1750
1874
  const previousSkills = path7.join(packageRoot, "skills");
1751
1875
  try {
1752
- readBundledSkills(previousSkills);
1876
+ readInstallableSkills(previousSkills);
1753
1877
  syncSkills({ ...context, skillsDirectory: previousSkills, businesses: {}, mode: "adopt", packageVersion: installedBefore.version });
1754
1878
  } catch {
1755
1879
  report.next_steps.push("Existing Skills could not be adopted from the previous package; unmatched copies will be preserved.");
@@ -1791,7 +1915,7 @@ function runInstallation(options = {}) {
1791
1915
  } else if (context) {
1792
1916
  stage = "skills_local";
1793
1917
  const skillsPath = path7.join(packageRoot, "skills");
1794
- const skills = readBundledSkills(skillsPath);
1918
+ const skills = readInstallableSkills(skillsPath);
1795
1919
  if (!isBusinessSkillContextCurrent(context)) {
1796
1920
  return failInstallation(report, stage, "The active environment changed during CLI installation. Re-run install or update to synchronize its Skills.");
1797
1921
  }
@@ -1824,6 +1948,14 @@ function runInstallation(options = {}) {
1824
1948
  }
1825
1949
  }
1826
1950
  progress("[ae-cli] [4/4] Checking authentication guidance...");
1951
+ const guideAccountSetup = options.guideAccountSetup && report.skills.status === "success";
1952
+ if (guideAccountSetup && !report.auth.host && context?.host) {
1953
+ try {
1954
+ report.auth.host = installHost(context.host);
1955
+ } catch {
1956
+ report.auth.warnings.push("The configured AE host could not be used to check authentication.");
1957
+ }
1958
+ }
1827
1959
  if (report.auth.host) {
1828
1960
  const result2 = runner(bin, ["--no-update-check", "--format", "json", "auth", "status", "--host", report.auth.host], INSTALL_TIMEOUT_MS);
1829
1961
  try {
@@ -1834,9 +1966,44 @@ function runInstallation(options = {}) {
1834
1966
  report.auth.warnings.push("Authentication status could not be verified. Run auth status for this host.");
1835
1967
  }
1836
1968
  }
1837
- if (report.auth.authenticated !== true) {
1969
+ if (options.guideAccountSetup && !guideAccountSetup) {
1970
+ report.ok = true;
1971
+ return report;
1972
+ }
1973
+ const language = registrationLanguage(void 0, env);
1974
+ const market = registrationMarket(language);
1975
+ const websiteOnboarding = isWebsiteMarket(market);
1976
+ if (guideAccountSetup) {
1977
+ if (report.auth.authenticated === true) report.next_action = "continue_using_ae";
1978
+ else if (report.auth.warnings.length > 0) report.next_action = "check_authentication";
1979
+ else if (websiteOnboarding) report.next_action = "choose_account";
1980
+ }
1981
+ if (report.auth.authenticated === true) {
1982
+ report.next_steps.push("You are signed in. Continue your AE task in this AI tool using the existing environment.");
1983
+ } else if (report.next_action === "check_authentication") {
1984
+ const hostOption = report.auth.host ? ` --host ${report.auth.host}` : "";
1985
+ 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.`);
1986
+ } else {
1987
+ const chooseAccount = report.next_action === "choose_account";
1988
+ if (chooseAccount) {
1989
+ report.next_steps.push("For an install-only request, report the verified result. If the user explicitly asked for AE onboarding, the new-user walkthrough, or signup, run the website onboarding command below in the same turn. If they asked to sign in to an existing account, follow the existing-account guidance below. Use the account picker only when the user wants to get started and has not chosen a route: offer \u201CCreate an account and get started\u201D and \u201CSign in to my existing account\u201D.");
1990
+ }
1991
+ if (websiteOnboarding && (chooseAccount || !report.auth.host)) {
1992
+ const source = cliEntrySource(void 0, env);
1993
+ const registration = aeRegistrationUrl(language, env, source);
1994
+ if (chooseAccount) {
1995
+ report.next_steps.push(`For website onboarding, run ae-cli analysis onboarding run --language ${language} --source ${source} --browser system --format json. Pass --region for the user's requested market. The CLI opens the system default browser. If it cannot open the page, share the returned login_url for that browser. Read the returned skill_path and continue with its session_id. For manual signup outside the guided session, use ${registration}.`);
1996
+ } else {
1997
+ 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.`);
1998
+ }
1999
+ report.next_steps.push(`The default new-account region is ${market}. Select another supported production market with --region jp|kr|us before registration. Language does not change an existing account's environment.`);
2000
+ } else if (!websiteOnboarding && !report.auth.host) {
2001
+ report.next_steps.push(`To request an AE trial in China, visit ${aeRegistrationUrl(language, env)}.`);
2002
+ }
2003
+ 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.");
2004
+ else if (!report.auth.host) report.next_steps.push("Existing AE users: use your original environment URL, or ask your administrator.");
1838
2005
  report.next_steps.push(`ae-cli auth login --host ${report.auth.host ?? "<AE_HOST>"} --no-wait`);
1839
- report.next_steps.push("Complete browser authorization, then run ae-cli auth login --host <AE_HOST> --device-code <DEVICE_CODE>.");
2006
+ 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.");
1840
2007
  }
1841
2008
  report.ok = true;
1842
2009
  return report;
@@ -2198,7 +2365,7 @@ function shouldSkipAutoSync(argv = process.argv) {
2198
2365
  const command = rootCommand(argv);
2199
2366
  return command === "update" || command === "install" || command === "auth" || command === "config";
2200
2367
  }
2201
- async function fetchCliConfig(host, cliToken) {
2368
+ async function fetchCliConfig(host, cliToken, signal) {
2202
2369
  const url = new URL(CLI_CONFIG_PATH, host.endsWith("/") ? host : `${host}/`);
2203
2370
  const external = readExternalCliToken(host)?.token === cliToken;
2204
2371
  if (!external) url.searchParams.set("cli-token", cliToken);
@@ -2207,6 +2374,12 @@ async function fetchCliConfig(host, cliToken) {
2207
2374
  let cleanup;
2208
2375
  const destroy = () => cleanup ??= dispatcher.destroy().catch(() => {
2209
2376
  });
2377
+ const abort = () => {
2378
+ controller.abort();
2379
+ void destroy();
2380
+ };
2381
+ signal?.addEventListener("abort", abort, { once: true });
2382
+ if (signal?.aborted) abort();
2210
2383
  const timer = setTimeout(() => {
2211
2384
  controller.abort();
2212
2385
  void destroy();
@@ -2217,7 +2390,8 @@ async function fetchCliConfig(host, cliToken) {
2217
2390
  dispatcher,
2218
2391
  signal: controller.signal,
2219
2392
  headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {}, ...internalCallSourceHeaders() },
2220
- ...externalCliTokenRequestOptions(url.toString())
2393
+ ...externalCliTokenRequestOptions(url.toString()),
2394
+ ...signal ? { redirect: "error" } : {}
2221
2395
  };
2222
2396
  resp = await fetch(url.toString(), options);
2223
2397
  if (!resp.ok) return null;
@@ -2234,8 +2408,10 @@ async function fetchCliConfig(host, cliToken) {
2234
2408
  ...typeof data.features?.projectSemanticKbAutoDiscovery === "boolean" ? { projectSemanticKbAutoDiscovery: data.features.projectSemanticKbAutoDiscovery } : {}
2235
2409
  };
2236
2410
  } catch {
2411
+ signal?.throwIfAborted();
2237
2412
  return null;
2238
2413
  } finally {
2414
+ signal?.removeEventListener("abort", abort);
2239
2415
  clearTimeout(timer);
2240
2416
  const destroyed = destroy();
2241
2417
  if (resp?.body && !resp.bodyUsed) await Promise.allSettled([resp.body.cancel(), destroyed]);
@@ -2482,6 +2658,29 @@ function notifyIfHostCompat(pkg, hostOverride) {
2482
2658
  export {
2483
2659
  exactVersion,
2484
2660
  installHost,
2661
+ DEMO_CONTEXT,
2662
+ DEMO_ENSURE,
2663
+ DEMO_STATUS,
2664
+ RUN_BUDGET_MS,
2665
+ NETWORK_BUDGET_MS,
2666
+ UUID_PATTERN,
2667
+ DEMO_SAMPLE_IDS,
2668
+ CHECKOUT_RECOVERY,
2669
+ onboardingGrowthScenario,
2670
+ WEBSITE_MARKETS,
2671
+ websiteEnvironment,
2672
+ websiteOrigin,
2673
+ isProductionWebsiteOrigin,
2674
+ environmentForWebsiteOrigin,
2675
+ cliEntrySource,
2676
+ withCliEntryContext,
2677
+ normalizeRegistrationLanguage,
2678
+ registrationLanguage,
2679
+ registrationMarket,
2680
+ aeRegistrationUrl,
2681
+ AE_TRIAL_URL,
2682
+ missingAeHostHint,
2683
+ missingAeHostGuidance,
2485
2684
  businessForCommand,
2486
2685
  businessForCapability,
2487
2686
  canManageGlobalSkills,
@@ -5,14 +5,14 @@ import {
5
5
  require_node,
6
6
  require_process_nextick_args,
7
7
  require_util
8
- } from "./chunk-HQED4YB4.js";
8
+ } from "./chunk-NPH5J65M.js";
9
9
  import {
10
10
  __commonJS,
11
11
  __esm,
12
12
  __export,
13
13
  __require,
14
14
  __toCommonJS
15
- } from "./chunk-R2SVAO4G.js";
15
+ } from "./chunk-3ZQY7SLZ.js";
16
16
 
17
17
  // node_modules/readdir-glob/node_modules/minimatch/lib/path.js
18
18
  var require_path = __commonJS({
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  CliValidationError
4
- } from "./chunk-R2SVAO4G.js";
4
+ } from "./chunk-3ZQY7SLZ.js";
5
5
 
6
6
  // src/core/capability-risk.ts
7
7
  var HIGH_RISK_LEVELS = /* @__PURE__ */ new Set(["high-risk-write"]);