@iola_adm/iola-cli 0.2.26 → 0.2.27

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iola_adm/iola-cli",
3
- "version": "0.2.26",
3
+ "version": "0.2.27",
4
4
  "description": "CLI и AI-агент городского округа Йошкар-Ола.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/adm-iola/iola-cli#readme",
package/src/cli.js CHANGED
@@ -9588,7 +9588,7 @@ async function buildYandexDirectAnswer(question, history = []) {
9588
9588
  const normalized = String(question || "").toLocaleLowerCase("ru-RU");
9589
9589
  const previousAssistantText = [...(history || [])].reverse().find((item) => item.role === "assistant")?.content || "";
9590
9590
  const mailContext = /Яндекс Почта|Письмо #|\bUID\b|#\d{3,}/iu.test(previousAssistantText);
9591
- if (!/(яндекс|yandex|почт|письм|календар|контакт|телемост)/iu.test(normalized) && !(/^\s*\d{3,}\s*$/u.test(question) && mailContext)) return "";
9591
+ if (!isYandexServiceQuestion(normalized) && !(/^\s*\d{3,}\s*$/u.test(question) && mailContext)) return "";
9592
9592
  try {
9593
9593
  if (/^\s*\d{3,}\s*$/u.test(question) && mailContext) {
9594
9594
  const uid = extractYandexMailUid(question);
@@ -9597,7 +9597,7 @@ async function buildYandexDirectAnswer(question, history = []) {
9597
9597
  return formatYandexMailRead(row);
9598
9598
  }
9599
9599
 
9600
- if (/(аккаунт|профил|логин|кто подключен)/iu.test(normalized) && /(яндекс|yandex)/iu.test(normalized)) {
9600
+ if (isYandexIdentityQuestion(normalized)) {
9601
9601
  const profile = await getYandexIdentityProfile();
9602
9602
  return [
9603
9603
  "Подключен Yandex ID:",
@@ -9658,6 +9658,16 @@ async function buildYandexDirectAnswer(question, history = []) {
9658
9658
  return "";
9659
9659
  }
9660
9660
 
9661
+ function isYandexServiceQuestion(normalized) {
9662
+ return /(яндекс|яндес|язндекс|язндекс|яндкс|yandex|почт|письм|календар|контакт|телемост)/iu.test(String(normalized || ""));
9663
+ }
9664
+
9665
+ function isYandexIdentityQuestion(normalized) {
9666
+ const text = String(normalized || "");
9667
+ return /(аккаунт|профил|логин|кто подключен|какой.*подключен|email|e-mail)/iu.test(text)
9668
+ && /(яндекс|яндес|язндекс|язндекс|яндкс|yandex)/iu.test(text);
9669
+ }
9670
+
9661
9671
  function cleanupYandexQuery(question) {
9662
9672
  const stop = /^(?:в|на|у|из|для|по|яндекс|yandex|найди|поиск|покажи|посмотри|проверь|почт\p{L}*|письм\p{L}*|календар\p{L}*|контакт\p{L}*)$/iu;
9663
9673
  return String(question || "")
@@ -76,6 +76,8 @@ assertIncludes(cliSource, "partial (", "Yandex connector status should report pa
76
76
  assertIncludes(cliSource, "hasYandexOAuthAppToken", "Yandex setup should detect tokens per OAuth app");
77
77
  assertIncludes(cliSource, "isYandexConnectorFullyConnected", "Yandex master status should require all OAuth app tokens");
78
78
  assertIncludes(cliSource, "--app", "Yandex token command should persist tokens by OAuth app group");
79
+ assertIncludes(cliSource, "isYandexIdentityQuestion", "Yandex ID questions should be handled directly");
80
+ assertIncludes(cliSource, "язндекс", "Yandex direct router should tolerate common typos");
79
81
  assertNotIncludes(cliSource, "Сервисы через запятую [identity,disk]", "Yandex setup should not ask for services during connector setup");
80
82
  if (!packageJson.files.includes("docs/assets/iola-oauth-icon.png")) {
81
83
  throw new Error("package files should include the Yandex OAuth icon");