Commit Graph

15 Commits

Author SHA1 Message Date
Yuriy
0bfe1ee02e feat: deep analysis — security scanning, code quality, dependency checks 2026-02-12 09:34:18 +03:00
Yuriy
af3c81b04d feat: AI code generation — LLM generates fix actions from findings 2026-02-12 09:16:21 +03:00
Yuriy
2be548d078 fix(lint): replace useEffect with useCallback for provider change 2026-02-12 09:06:16 +03:00
Yuriy
d4871d3030 feat: LLM integration — OpenAI/Anthropic/Ollama support 2026-02-11 23:09:19 +03:00
Yuriy
52c905011c fix(lint): remove impure Date.now() from Dashboard render 2026-02-11 22:33:24 +03:00
Yuriy
233c3fe6f4 fix(ci): ESM import in tailwind, remove catch(_), add Tauri system deps 2026-02-11 22:26:17 +03:00
Yuriy
febcde0cfc fix: remove unused FileText import from PolicyEngine 2026-02-11 22:18:20 +03:00
Yuriy
1c91f51a1d Replace repo with papayu-refactored: desktop/ structure, Tailwind UI, simplified Tauri backend
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 22:00:43 +03:00
Yuriy
289b1b6dac AI-аудитор: narrative от LLM, AuditLogger, SecretsGuard, PolicyEngine, RAG по проекту
П.1 — LLM-narrative: fetch_narrative_for_report в llm_planner, вызов из
analyze_project_cmd и run_batch; fallback на шаблон при отсутствии API.

П.2 — В промпт «Предложить исправления» добавлен приоритет по findings из отчёта.

П.3 — AuditLogger (audit_log.rs, /audit), SecretsGuard (secrets_guard.rs, /secrets),
PolicyEngine (policy_engine.rs, /policies): Rust-модули + страницы в навигации.

П.5 — RAG упрощённый: rag_query.rs, rag_query_cmd, страница «Вопрос по проекту» (/project-chat).

Документ: docs/ПЛАН_AI_АУДИТОР.md с планом и секцией «Реализовано».

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 21:29:24 +03:00
Yuriy
de9c2660d5 Установка в Программы, убраны ТМЦ/Регламенты, фикс updater и версий Tauri
- tauri.conf.json: добавлен pubkey для плагина updater
- package.json: @tauri-apps/api и plugin-updater закреплены на 2.9.x
- App.tsx: убраны разделы ТМЦ и Регламенты из навигации и маршрутов
- scripts/install-to-applications.sh: установка .app в /Applications + сброс Launchpad
- Установить в Программы.command: запуск установки двойным кликом
- README: инструкция по установке в Программы и npm run install-app

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-10 16:48:16 +03:00
Yuriy
65e95a458d feat: мульти-провайдер LLM, тренды дизайна, Snyk/Documatic sync, личная автоматизация
- Мульти-провайдер: PAPAYU_LLM_PROVIDERS — сбор планов от нескольких ИИ (Claude, OpenAI), агрегация
- Тренды дизайна и иконок: вкладка в модалке, поиск по безопасным доменам (Tavily include_domains)
- Snyk Code: PAPAYU_SNYK_SYNC, REST API issues → snyk_findings в agent-sync
- Documatic: architecture_summary из .papa-yu/architecture.md в agent-sync
- Личная автоматизация: capability personal-automation (терминал git/npm/cargo, открытие URL)
- agent_sync расширен: snyk_findings, architecture_summary; analyze_project_cmd и run_batch пишут sync
- Документация: SNYK_AND_DOCUMATIC_SYNC.md, SECURITY_AND_PERSONAL_AUTOMATION.md, обновлён CLAUDE_AND_AGENT_SYNC

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-10 15:05:39 +03:00
Yuriy
764003fc09 Commit X4: Auto inject Online Research summary into plan context
This commit implements fully automatic injection of online research results into the LLM prompt without user clicks.

## Backend

### Environment Variables
- Added `PAPAYU_ONLINE_AUTO_USE_AS_CONTEXT=1` (default: 0) to enable automatic injection of online research results into subsequent `proposeActions` calls.
- Added `is_online_auto_use_as_context()` helper function in `online_research/mod.rs`.

### Command Changes
- **`propose_actions` command**: Added `online_fallback_reason: Option<String>` parameter to track the error code that triggered online fallback.
- **`llm_planner::plan` function**: Added `online_fallback_reason: Option<&str>` parameter for tracing.
- **Trace Enhancements**: Added `online_fallback_reason` field to trace when `online_fallback_executed` is true.

### Module Exports
- Made `extract_error_code_prefix` public in `online_research/fallback.rs` for frontend use.

## Frontend

### Project Settings
- Added `onlineAutoUseAsContext` state (persisted in `localStorage` as `papa_yu_online_auto_use_as_context`).
- Initialized from localStorage or defaults to `false`.
- Auto-saved to localStorage on change.

### Auto-Chain Flow
- When `plan.ok === false` and `plan.online_fallback_suggested` is present:
  - If `onlineAutoUseAsContext === true` and not already attempted for this goal (cycle protection via `lastGoalWithOnlineFallbackRef`):
    - Automatically calls `researchAnswer(query)`.
    - Truncates result to `8000` chars and `10` sources (frontend-side limits).
    - Immediately calls `proposeActions` again with:
      - `online_context_md`
      - `online_context_sources`
      - `online_fallback_executed: true`
      - `online_fallback_reason: error_code`
      - `online_fallback_attempted: true`
    - Displays the new plan/error without requiring "Use as context" button click.
  - If `onlineAutoUseAsContext === false` or already attempted:
    - Falls back to manual mode (shows online research block with "Use as context (once)" button).

### Cycle Protection
- `lastGoalWithOnlineFallbackRef` tracks the last goal that triggered online fallback.
- If the same goal triggers fallback again, auto-chain is skipped to prevent infinite loops.
- Maximum 1 auto-chain per user query.

### UI Enhancements
- **Online Research Block**:
  - When `onlineAutoUseAsContext === true`: displays "Auto-used ✓" badge.
  - Hides "Use as context (once)" button when auto-use is enabled.
  - Adds "Disable auto-use" button (red) to disable auto-use for the current project.
  - When disabled, shows system message: "Auto-use отключён для текущего проекта."

### API Updates
- **`proposeActions` in `tauri.ts`**: Added `onlineFallbackReason?: string | null` parameter.

## Tests

- **`online_context_auto_test.rs`**: Added unit tests for:
  - `test_is_online_auto_use_disabled_by_default`
  - `test_is_online_auto_use_enabled_when_set`
  - `test_extract_error_code_prefix_timeout`
  - `test_extract_error_code_prefix_schema`
  - `test_extract_error_code_prefix_empty_when_no_prefix`

All tests pass.

## Documentation

### README.md
- Added "Auto-use (X4)" subsection under "Online Research":
  - Describes `PAPAYU_ONLINE_AUTO_USE_AS_CONTEXT=1` env var (default: 0).
  - Explains cycle protection: maximum 1 auto-chain per goal.
  - Documents UI behavior: "Auto-used ✓" badge and "Disable auto-use" button.

## Behavior Summary

**Without auto-use (default):**
1. `proposeActions` → error + `online_fallback_suggested`
2. UI calls `researchAnswer`
3. UI displays online research block with "Use as context (once)" button
4. User clicks button → sets `onlineContextPending` → next `proposeActions` includes context

**With auto-use enabled (`PAPAYU_ONLINE_AUTO_USE_AS_CONTEXT=1`):**
1. `proposeActions` → error + `online_fallback_suggested`
2. UI calls `researchAnswer` automatically
3. UI displays online research block with "Auto-used ✓" badge
4. UI immediately calls `proposeActions` again with online context → displays new plan
5. If still fails → no retry (cycle protection)

## Build Status

-  Backend: `cargo build --lib` (2 warnings about unused code for future features)
-  Frontend: `npm run build`
-  Tests: `cargo test online_context_auto_test --lib` (5 passed)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 14:39:40 +03:00
Yuriy
a88c34aa15 Protocol v2 schema plumbing (Commit 2)
- llm_response_schema_v2.json: object-only, PATCH_FILE, base_sha256
- PAPAYU_PROTOCOL_VERSION=1|2 (default 1)
- schema_version and schema_hash dynamic in trace/log
- compiled_response_schema uses v1 or v2 by protocol
- response_format sends v2 schema when protocol=2
- Tests: test_schema_v2_compiles, test_schema_hash_non_empty_v2
- trace_to_golden: schema_hash_for_version by trace schema_version

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 11:58:49 +03:00
Yuriy
f2f33e24d6 Protocol v1 release: golden traces, CI, make/npm, policy
- Golden traces: docs/golden_traces/v1/, format protocol/request/context/result
- trace_to_golden bin, golden_traces_v1_validate test
- Makefile: make golden, make test-protocol
- npm scripts: golden, test-protocol
- CI: .github/workflows/protocol-check.yml
- PROTOCOL_V1.md, PROTOCOL_V2_PLAN.md
- Policy for updating golden traces in README

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 11:54:33 +03:00
Yuriy
e76236dc55 Initial commit: papa-yu v2.4.4
- Schema version (x_schema_version, schema_hash) в prompt/trace
- Кеш read/search/logs/env (ContextCache) в plan-цикле
- Контекст-диета: MAX_FILES=8, MAX_FILE_CHARS=20k, MAX_TOTAL_CHARS=120k
- Plan→Apply двухфазность, NO_CHANGES, path sanitization
- Protected paths, content validation, EOL normalization
- Trace (PAPAYU_TRACE), redaction (PAPAYU_TRACE_RAW)
- Preview diff, undo/redo, transactional apply

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 11:33:19 +03:00