@iola_adm/iola-cli 0.2.40 → 0.2.41
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 +1 -1
- package/src/cli.js +14 -6
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -3826,7 +3826,7 @@ async function resolveYandexGoPoint(query) {
|
|
|
3826
3826
|
|
|
3827
3827
|
function isAmbiguousPersonalYandexGoPoint(query) {
|
|
3828
3828
|
const text = String(query || "").trim().toLocaleLowerCase("ru-RU");
|
|
3829
|
-
return /^(
|
|
3829
|
+
return /^(?:дом|дома|из дома|с дома|мой дом|у меня|у меня дома|от меня|здесь|тут|текущее место|моя геопозиция|мое местоположение)$/iu.test(text);
|
|
3830
3830
|
}
|
|
3831
3831
|
|
|
3832
3832
|
function normalizeYandexGoGeocoderQuery(query) {
|
|
@@ -3922,11 +3922,13 @@ function extractYandexGoRouteFromText(text) {
|
|
|
3922
3922
|
const source = String(text || "").trim();
|
|
3923
3923
|
const tariffMatch = source.match(/(эконом|комфорт\+?|комфорт плюс|бизнес|минивен|детск\w*|econom|business|comfortplus|minivan|vip)/iu);
|
|
3924
3924
|
const cleaned = source
|
|
3925
|
+
.replace(/(?:^|\s)(?:так|мне\s+нужно|мне\s+надо|нужно|надо)(?=\s|$)/giu, " ")
|
|
3925
3926
|
.replace(/^(?:построй|создай|дай|открой|сделай|подготовь|вызови|закажи)\s+/iu, "")
|
|
3926
|
-
.replace(
|
|
3927
|
+
.replace(/(?:^|\s)(?:яндекс\s*go|яндекс\s*го|такси|маршрут|ссылк[ау]?|диплинк|deeplink)(?=\s|$)/giu, " ")
|
|
3927
3928
|
.replace(/\s+/g, " ")
|
|
3928
3929
|
.trim();
|
|
3929
|
-
const match = cleaned.match(/(?:от|из|с)\s+(.+?)\s+(?:до|в|на)\s+(.+)$/iu)
|
|
3930
|
+
const match = cleaned.match(/(?:от|из|с)\s+(.+?)\s+(?:до|в|на)\s+(.+)$/iu)
|
|
3931
|
+
|| cleaned.match(/^(.+?)\s*,?\s+(?:до|в)\s+(.+)$/iu);
|
|
3930
3932
|
if (!match) return { from: "", to: "", tariff: tariffMatch ? normalizeYandexGoTariff(tariffMatch[1]) : "econom" };
|
|
3931
3933
|
const from = match[1].replace(/[,.;]\s*$/u, "").trim();
|
|
3932
3934
|
const to = match[2].replace(/[,.;]\s*(?:тариф|эконом|комфорт\+?|комфорт плюс|бизнес|минивен|детск\w*).*$/iu, "").trim();
|
|
@@ -5297,7 +5299,8 @@ async function yandexMailReply(args = {}) {
|
|
|
5297
5299
|
if (!original || original.status === "not-found") throw new Error(`Письмо #${uid} не найдено.`);
|
|
5298
5300
|
const to = [extractEmailAddress(original.from)].filter(Boolean);
|
|
5299
5301
|
if (!to.length) throw new Error("Не удалось определить получателя ответа из поля From.");
|
|
5300
|
-
const
|
|
5302
|
+
const requestedSubject = String(args.subject || "").trim();
|
|
5303
|
+
const subject = requestedSubject || (/^re:/iu.test(original.subject || "") ? original.subject : `Re: ${original.subject || "(без темы)"}`);
|
|
5301
5304
|
const result = await yandexMailSend({
|
|
5302
5305
|
to,
|
|
5303
5306
|
subject,
|
|
@@ -12651,8 +12654,11 @@ async function buildYandexDirectAnswer(question, history = []) {
|
|
|
12651
12654
|
if (/(ответь|ответить|напиши\s+ответ)/iu.test(normalized)) {
|
|
12652
12655
|
const reply = parseYandexMailReplyRequest(question, previousAssistantText);
|
|
12653
12656
|
if (!reply.uid || !reply.text) return "Для ответа укажите письмо и текст. Пример: ответь на письмо #2382 текст: спасибо, получил.";
|
|
12657
|
+
if (/(пометь|отметь|сделай)/iu.test(normalized) && /(прочитан)/iu.test(normalized)) {
|
|
12658
|
+
await yandexMailMark(reply.uid, !/непрочитан/iu.test(normalized), { mailbox: await resolveYandexMailbox(reply.mailbox || "INBOX") });
|
|
12659
|
+
}
|
|
12654
12660
|
const result = await yandexMailReply({ ...reply, confirm: true });
|
|
12655
|
-
return
|
|
12661
|
+
return `Письмо #${result.replyToUid} обработано. Ответ отправлен: ${result.to.join(", ")}. Тема: ${result.subject}.`;
|
|
12656
12662
|
}
|
|
12657
12663
|
if (/(перешли|переслать|перешли\s+письмо|fwd|forward)/iu.test(normalized)) {
|
|
12658
12664
|
const uid = resolveYandexMailUidFromQuestion(question, previousAssistantText);
|
|
@@ -13295,7 +13301,7 @@ function resolveYandexMailUidFromQuestion(question, previousAssistantText = "")
|
|
|
13295
13301
|
const uid = extractYandexMailUidByOrdinal(previousAssistantText, Number(actionOrdinal));
|
|
13296
13302
|
if (uid) return uid;
|
|
13297
13303
|
}
|
|
13298
|
-
if (/(самое\s+свеж|последн|получи|получить|текст\s+(?:то\s+)?(?:письм|где)
|
|
13304
|
+
if (/(самое\s+свеж|последн|получи|получить|текст\s+(?:то\s+)?(?:письм|где)|содержим|ответь|ответить|им\b|ему\b|ей\b|пометь|отметь|сделай|удали|удалить)/iu.test(String(question || ""))) {
|
|
13299
13305
|
return extractFirstYandexMailUid(previousAssistantText);
|
|
13300
13306
|
}
|
|
13301
13307
|
return 0;
|
|
@@ -13330,10 +13336,12 @@ function isExplicitYandexDiskPathDelete(question) {
|
|
|
13330
13336
|
function parseYandexMailReplyRequest(question, previousAssistantText = "") {
|
|
13331
13337
|
const text = String(question || "").replace(/\s+/g, " ").trim();
|
|
13332
13338
|
const uid = resolveYandexMailUidFromQuestion(text, previousAssistantText);
|
|
13339
|
+
const subjectMatch = text.match(/(?:тема|subject)\s*:\s*(.*?)(?=\s+(?:текст|body|сообщение)\s*:|$)/iu);
|
|
13333
13340
|
const bodyMatch = text.match(/(?:текст|body|сообщение)\s*:\s*(.*)$/iu)
|
|
13334
13341
|
|| text.match(/(?:ответь|ответить|напиши\s+ответ)(?:\s+на\s+письмо\s+#?\d+|\s+#?\d+)?\s*:?\s*(.*)$/iu);
|
|
13335
13342
|
return {
|
|
13336
13343
|
uid,
|
|
13344
|
+
subject: (subjectMatch?.[1] || "").trim(),
|
|
13337
13345
|
text: (bodyMatch?.[1] || "").trim(),
|
|
13338
13346
|
mailbox: extractYandexMailboxName(question) || "INBOX",
|
|
13339
13347
|
};
|