Commit Graph
23 Commits
Author SHA1 Message Date
Dushnilin 23aae78147 feat(migration): 1.3.11 - CLI команда import_settings и исправление миграции Forkop
- Добавлена CLI команда tachyon import_settings [файл] (и алиас import-settings) для автоматического сканирования и бесшовного импорта настроек из Forkop, Forkop Plus, Podkop, Netshift или резервных копий
- Поддержка in-place миграции прямо из активного /etc/config/tachyon при обнаружении унаследованных правил config rule
- Расширенное сканирование резервных копий и файлов конфигураций в /etc/config/, /root/ и /tmp/
- Исправлен режим миграции Forkop в Makefile, build.sh и install.sh (использование migrate-podkop для корректного преобразования старых секций config rule в config section)
- Добавлен интеграционный тест tests/import_settings.sh (119 тестов бэкенда пройдены)
2026-09-01 12:15:00 +03:00
Dushnilin c910e6368e fix(build): po2lmo собирается через Makefile luci
Upstream openwrt/luci убрал template_lmo.c из дерева: po2lmo теперь
линкуется с src/lib/lmo и генерируемым lemon plural_formula, поэтому
прямой вызов gcc больше не работает - только in-tree Makefile.
Проверка наличия template_lmo.c заменена на сборку make po2lmo,
проверено на свежем клоне master.
2026-08-21 21:41:23 +03:00
Dushnilin f29db7d5a3 fix(build): каталог defaults перед install, устойчивый ensure_po2lmo
- build_backend_root ставил defaults/config до создания родительского
  каталога usr/lib/tachyon/defaults - релизная сборка падала на install
  (обнаружено сборкой тега 1.2.89)
- ensure_po2lmo: частичный клон feeds/luci приводил к компиляции без
  template_lmo.c; теперь при отсутствии исходников делается чистый
  переклон, а финальный fallback больше не печатает путь к несуществующему
  бинарнику - сразу явная ошибка
2026-08-21 21:34:08 +03:00
Dushnilin 8996790f25 fix(core): хотфиксы issues #23, #32, #39, #41
- service_check: lan_interface() запрашивала несуществующий конфиг
  forkop/podkop, из-за чего все проверки сервисов смотрели в br-lan вместо
  настроенных LAN-интерфейсов - секции AWG/WireGuard всегда получали вердикт
  "не отвечает" при рабочем kernel-конфиге (#41, #32, #39)
- rag: у push() были перепутаны аргументы - коллекция эмбеддингов оставалась
  пустой для всех провайдеров OpenAI-формата; кэш эмбеддингов теперь
  инвалидируется по отпечатку индекса (mtime+size), null model_override
  обрабатывается корректно
- warp_generator: curl к Clash API без таймаута и матрица ретраев без общего
  дедлайна могли блокировать выполнение минутами и ловить XHR timeout LuCI
  (#39); добавлены -m 5 на локальные вызовы и бюджеты 40с/90с на весь цикл
- build.sh: релизные пакеты теперь содержат тот же состав файлов, что и
  сборка через OpenWrt Makefile (hotplug WAN-монитор, агентский CGI в
  /usr/lib/cgi-bin, defaults/config, профили servicecheck); конфиги с
  секретами ставятся с правами 0600; тест паритета инвентаря
- updates UI: после самообновления tachyon страница перезагружается только
  когда перезапущенный бэкенд снова отвечает на get_ui_state, вместо
  фиксированной задержки 8 секунд (#23)
2026-08-21 19:19:17 +03:00
Dushnilin 421a4fd796 feat: add RAG (Retrieval-Augmented Generation) for AI Doctor
New files:
- tools/rag_build_index.sh: build-time ingestion pipeline
  Chunks docs/knowledge-base/*.md into 2000-char chunks with 200-char overlap
  Produces rag_index.json (39 chunks, ~74KB) for runtime embedding
- tachyon/files/usr/lib/diagnostics/rag.uc: runtime RAG module
  Embeds chunks via same LLM provider API (OpenAI-compatible /v1/embeddings)
  Cosine similarity search, top-3 retrieval, 24h cache in /tmp
  Graceful fallback if embedding API unavailable
- tachyon/files/usr/lib/tachyon/rag_index.json: pre-built chunk index

Modified files:
- runtime.uc: integrated RAG into ai_doctor() function
  Retrieves relevant docs based on user query or diagnostic context
  Injects 'Relevant Documentation' section into LLM prompt
- renderAdvancedSettings.ts: added 'Enable RAG' toggle in AI Doctor settings
- tachyon config: added enable_rag option (default '1')
- build.sh: added rag_build_index.sh step

Architecture:
- Provider-agnostic: uses same API key/provider as LLM for embeddings
- Embedding model: text-embedding-3-small (OpenAI), nomic-embed-text (Ollama),
  local-model (LMStudio), deepseek-embedding (DeepSeek)
- Cache: embeddings cached in /tmp/tachyon_rag_embeddings.json (24h TTL)
- Fallback: if embedding fails, AI Doctor works without RAG (as before)
- 39 chunks from 14 docs, ~66K chars, cosine search <1ms

623 tests pass (101 backend + 522 frontend)
2026-08-20 10:27:56 +03:00
Dushnilin 999686fea3 fix(ui): display short commit SHA next to Tachyon version in UI and constants 2026-08-11 19:06:00 +03:00
DushnilinandClaude Opus 5 84924a0fff fix(build): bound the prerm hooks build.sh writes into the packages
build.sh assembles the APK and IPK packages itself rather than going through
OpenWrt's packaging, so it carries its own copies of the prerm-family hooks.
Bounding Package/tachyon/prerm in tachyon/Makefile therefore never reached the
released artifacts: 1.2.66 shipped with

    exit(system("/usr/bin/tachyon package_prerm upgrade >/dev/null 2>&1"));

which is both unbounded and status-propagating. `exit(system(...))` returns a raw
wait status, so a cleanup that was merely killed took the upgrade down with it —
on the router that surfaced as

    ERROR: lib/apk/exec/tachyon-1.2.66.pre-upgrade: exited with error 247

247 being 128+119, the cleanup SIGKILLed by its own sweep.

All three hooks written here (APK pre-upgrade, APK pre-deinstall, backend IPK
prerm) now probe the BusyBox timeout spelling against /bin/true, bound the
cleanup at 90s, and exit 0 unconditionally — matching the Makefile.

tests/package_lifecycle.sh gains contracts over all three: each must be bounded,
must not propagate the cleanup's status, and must compile. They live inside
heredocs, so ucode_syntax_lint.sh never sees them and a syntax error would only
surface on a router mid-upgrade.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-09 21:13:33 +03:00
Dushnilin 1ce9c4a3ae fix(build): replace JS-style method call with ucode global split() in apk postinst/post-upgrade scripts 2026-08-07 18:04:04 +03:00
Dushnilin 22a236e5d1 feat: commit-level version tracking for same-release updates
Backend:
- constants.uc: add TACHYON_COMMIT_SHA constant (placeholder __COMPILED_COMMIT_SHA__)
- build.sh: capture git rev-parse HEAD and sed-replace commit SHA placeholder
- Makefile: same commit SHA sed replacement for OpenWrt builds
- action.uc: modify check_tachyon() to compare installed commit SHA with
  target_commitish from GitHub release, new status 'outdated_same_release'
- action.uc: reuse release_json for both version and commit SHA extraction
- updater.uc: add release_commit_sha helper to extract target_commitish
- updates.uc: extend cacheable status to include outdated_same_release

Frontend:
- main.js: handle outdated_same_release status in renderComponentCard
- main.js: include outdated_same_release in shouldShowInstallAfterCheck
- main.js: include outdated_same_release in applyCachedCheckResults

i18n:
- Add 'Update is available for current release' and 'Update is available
  for current release:' to .pot and .ru.po files

78 tests pass.
2026-08-03 21:35:06 +03:00
Dushnilin c7febcb0dc fix: atomic writes, crash safety, deadlock prevention across 10 files
watchdog.uc:
- H-4: ai_heal_uci_config atomic write (tmp → rename)
- H-5: backup validation via uci valid before restart
- H-6: proxy restart cooldown (max 3 per 10 min)
- H-7: restart lock file prevents parallel restarts
- H-13: ai_heal_wan_interface reads 'network' not 'tachyon' config
- M-3: nslookup -port=53 → plain nslookup (BusyBox compat)

generator.uc: atomic_write_json_file for main config output
hosts.uc: atomic cache write (tmp + mv), TOCTOU double stat fix
telegram.uc: atomic config restore, persistent /etc/.tachyon/ paths
migration.uc: UCI commit before cache removal
updates.uc: background reload inside locked section (deadlock prevention)
lifecycle.uc: uci commit return check, watchdog/telegram failure logging
package.uc: postinst_restore returns actual start result
build.sh/install.sh: Wave 1 backup/restore fixes
2026-08-03 19:43:10 +03:00
Dushnilin 2be70f397c fix(build): ensure feeds/luci and po2lmo source presence during package compilation
- Automatically update and install luci feed, or fallback to shallow git clone of luci repository if feeds/luci directory is missing in OpenWrt SDK
- Compile po2lmo directly using gcc as fallback if make -C feeds/luci fails
2026-07-25 14:50:08 +03:00
Dushnilin 97b29f230c feat(telegram): добавить динамические инлайн-кнопки и инструменты диагностики в боте, установить права исполнения для скриптов 2026-07-15 22:23:58 +03:00
Dushnilin 46ef97fe89 Release 1.0.6: синхронизировать изменения из upstream и исправить баг фильтра URLTest/Priority 2026-07-14 08:56:31 +03:00
Dushnilin f017d01a52 Рефакторинг кода: дедупликация ucode, исправления shellcheck и глобальное улучшение install.sh 2026-07-13 22:38:24 +03:00
Dushnilin 8c9bb8734b Рефакторинг и стабилизация: обновление установщика, бэкенд-утилит и оптимизация фронтенда
- Установщик (install.sh): внедрена верификация хешей sha256sums.txt, нормализована очерёдность бутстрапа ucode до языковых проверок.
- Сборщик (build.sh): добавлена автоматическая генерация sha256sums.txt для пакетов релиза.
- Бэкенд: права на honeypot FIFO ограничены до 0660 в watchdog.uc, исправлена опечатка в SUBNETS_TELEGRAM, удалён helpers.old.uc.
- Тесты бэкенда: написаны тесты для core_ip, core_url и config_connections.
- Фронтенд: реализовано автопереподключение WebSocket с экспоненциальным бэкоффом, проведена дедупликация виджетов и модальных окон в initController.ts, мигрирован CSS-префикс с fkp_ на tachyon_.
- Тесты фронтенда: добавлен initController.test.ts для тестирования загрузки дашборда.
2026-07-13 20:23:33 +03:00
Dushnilin 9fafa73468 ci: удаление жестких зависимостей kmod из бэкенд-пакета и добавление мягкой установки в install.sh 2026-07-13 14:55:57 +03:00
Dushnilin 63a2690bb5 ci: исправление ошибки ucode stat в скрипте postinst пакета apk 2026-07-13 14:47:15 +03:00
Dushnilin a67be6dc11 ci: полное удаление совместимости с forkop и сборка чистых пакетов tachyon 2026-07-13 14:39:01 +03:00
Dushnilin f57dac6b52 refactor(rebrand): полный ребрендинг в Tachyon и перенос служб watchdog/doctor на Ucode 2026-07-13 14:09:38 +03:00
Dushnilin cd3591fbff refactor: обновление URL репозитория на github.com/Dushnilin/tachyon 2026-07-13 11:03:35 +03:00
ushan0v afc05c9100 Restore per-interface domain resolvers 2026-07-12 21:38:58 +03:00
ushan0v b5f2eb3724 Rebrand project as Forkop 2026-07-11 18:23:20 +03:00
ushan0v dc052f03a7 Simplify build and backend test layout 2026-07-11 05:11:50 +03:00