From 065e598cca7d5e02aab829ec37d9589140f34376 Mon Sep 17 00:00:00 2001 From: g1nation Date: Tue, 12 May 2026 22:54:21 +0900 Subject: [PATCH] chore: version up to 2.80.34 and package --- ...d46d2ca2057b05c488be1dcf439166ac5a9a1.json | 2 +- ...9f4f39d2bc368f77456c37b5eef9a94a66b5c.json | 2 +- ...5c7a44d7661af673b24e3f49551a7a2e50280.json | 2 +- ...adc543795e4b427b64540a49c9ab27c7fe213.json | 4 +- ...son => stress_conflict_1778593954545.json} | 18 +- PATCHNOTES.md | 12 + docs/TELEGRAM_REMOTE_EXECUTION_PLAN.md | 452 ++++++++++++++++++ media/sidebar.css | 66 +++ media/sidebar.html | 6 + media/sidebar.js | 153 ++++++ package.json | 46 +- src/agent.ts | 313 ++++++++++-- src/agents/factory.ts | 10 +- src/config.ts | 19 +- src/lib/contextManager.ts | 254 ++++++++++ src/lib/paths.ts | 27 +- src/lmstudio/streamer.ts | 38 +- src/retrieval/brainIndex.ts | 220 +++++++++ src/retrieval/index.ts | 90 ++-- src/retrieval/scoring.ts | 69 ++- src/sidebar/agentHandlers.ts | 2 + src/sidebar/chatHandlers.ts | 4 + src/sidebarProvider.ts | 93 +++- tests/brainIndex.test.ts | 104 ++++ tests/contextManager.test.ts | 113 +++++ tests/lmStudioStreamer.test.ts | 43 +- 26 files changed, 2023 insertions(+), 139 deletions(-) rename .astra/tests/stress/.astra/missions/{stress_conflict_1778473456740.json => stress_conflict_1778593954545.json} (81%) create mode 100644 docs/TELEGRAM_REMOTE_EXECUTION_PLAN.md create mode 100644 src/lib/contextManager.ts create mode 100644 src/retrieval/brainIndex.ts create mode 100644 tests/brainIndex.test.ts create mode 100644 tests/contextManager.test.ts diff --git a/.astra/tests/stress/.astra/cache/259a37934ead3910a8722b82054d46d2ca2057b05c488be1dcf439166ac5a9a1.json b/.astra/tests/stress/.astra/cache/259a37934ead3910a8722b82054d46d2ca2057b05c488be1dcf439166ac5a9a1.json index 704a98c..73b9ac1 100644 --- a/.astra/tests/stress/.astra/cache/259a37934ead3910a8722b82054d46d2ca2057b05c488be1dcf439166ac5a9a1.json +++ b/.astra/tests/stress/.astra/cache/259a37934ead3910a8722b82054d46d2ca2057b05c488be1dcf439166ac5a9a1.json @@ -1,5 +1,5 @@ { "result": "Final report with inconsistencies. This should be long enough to pass validation.", - "createdAt": 1778473456759, + "createdAt": 1778593954576, "modelVersion": "unknown" } \ No newline at end of file diff --git a/.astra/tests/stress/.astra/cache/65775be352df43297b63c7af59c9f4f39d2bc368f77456c37b5eef9a94a66b5c.json b/.astra/tests/stress/.astra/cache/65775be352df43297b63c7af59c9f4f39d2bc368f77456c37b5eef9a94a66b5c.json index 2a1e50b..5610ace 100644 --- a/.astra/tests/stress/.astra/cache/65775be352df43297b63c7af59c9f4f39d2bc368f77456c37b5eef9a94a66b5c.json +++ b/.astra/tests/stress/.astra/cache/65775be352df43297b63c7af59c9f4f39d2bc368f77456c37b5eef9a94a66b5c.json @@ -1,5 +1,5 @@ { "result": "[CONFLICT WARNING] 성능이 200% 증가했습니다. vs 그러나 동시에 50% 감소했습니다. 최적화와 성능 저하가 동시에 발견됨.", - "createdAt": 1778473456758, + "createdAt": 1778593954567, "modelVersion": "unknown" } \ No newline at end of file diff --git a/.astra/tests/stress/.astra/cache/6894d26c5b0a55d25d756a473225c7a44d7661af673b24e3f49551a7a2e50280.json b/.astra/tests/stress/.astra/cache/6894d26c5b0a55d25d756a473225c7a44d7661af673b24e3f49551a7a2e50280.json index 5111b99..cf70e53 100644 --- a/.astra/tests/stress/.astra/cache/6894d26c5b0a55d25d756a473225c7a44d7661af673b24e3f49551a7a2e50280.json +++ b/.astra/tests/stress/.astra/cache/6894d26c5b0a55d25d756a473225c7a44d7661af673b24e3f49551a7a2e50280.json @@ -1,5 +1,5 @@ { "result": "Detailed Execution Plan: 1. Research 2. Analyze 3. Write report with high quality.", - "createdAt": 1778473456756, + "createdAt": 1778593954561, "modelVersion": "unknown" } \ No newline at end of file diff --git a/.astra/tests/stress/.astra/cache/88cb61499f88ed38165b64bd3e8adc543795e4b427b64540a49c9ab27c7fe213.json b/.astra/tests/stress/.astra/cache/88cb61499f88ed38165b64bd3e8adc543795e4b427b64540a49c9ab27c7fe213.json index 486a77b..3adda41 100644 --- a/.astra/tests/stress/.astra/cache/88cb61499f88ed38165b64bd3e8adc543795e4b427b64540a49c9ab27c7fe213.json +++ b/.astra/tests/stress/.astra/cache/88cb61499f88ed38165b64bd3e8adc543795e4b427b64540a49c9ab27c7fe213.json @@ -1,5 +1,5 @@ { - "result": "---\nid: stress_conflict_1778473456740\ndate: 2026-05-11T04:24:16.759Z\ntype: knowledge_artifact\nstandard: P-Reinforce v3.0\ntags: [automated, connect_ai, brain_sync]\n---\n\n## 📌 Brief Summary\nFinal report with inconsistencies. This should be long enough to pass validation.\n\nFinal report with inconsistencies. This should be long enough to pass validation.\n\n---\n## 💡 Astra의 선제적 제안 (Proactive Next Actions)\nFinal report with inconsistencies. This should be long enough to pass validation.\n---\n## 🛡️ Reliability & Audit Summary\n> [!NOTE]\n> 이 문서는 ConnectAI의 **Intelligent Resilience** 엔진에 의해 검증 및 정제되었습니다.\n\n| Metric | Value | Status |\n| :--- | :--- | :--- |\n| **Conflict Risk** | `60/100` | ⚠️ Medium |\n| **Fallbacks Used** | `0` | ✅ None |\n| **Auto Retries** | `0` | ✅ Stable |\n| **Deduplication** | `0` | Standard |\n| **Processing Time** | `0.0s` | ✅ Fast |\n\n### 🔍 Decision Audit Trail\n- **[PLANNER]** 전략 수립 중... (11ms)\n- **[RESEARCHER]** 핵심 정보 수집 및 분석 중... (5ms)\n- **[WRITER]** 최종 리포트 작성 및 편집 중... (3ms)\n", - "createdAt": 1778473456760, + "result": "---\nid: stress_conflict_1778593954545\ndate: 2026-05-12T13:52:34.580Z\ntype: knowledge_artifact\nstandard: P-Reinforce v3.0\ntags: [automated, connect_ai, brain_sync]\n---\n\n## 📌 Brief Summary\nFinal report with inconsistencies. This should be long enough to pass validation.\n\nFinal report with inconsistencies. This should be long enough to pass validation.\n\n---\n## 💡 Astra의 선제적 제안 (Proactive Next Actions)\nFinal report with inconsistencies. This should be long enough to pass validation.\n---\n## 🛡️ Reliability & Audit Summary\n> [!NOTE]\n> 이 문서는 ConnectAI의 **Intelligent Resilience** 엔진에 의해 검증 및 정제되었습니다.\n\n| Metric | Value | Status |\n| :--- | :--- | :--- |\n| **Conflict Risk** | `60/100` | ⚠️ Medium |\n| **Fallbacks Used** | `0` | ✅ None |\n| **Auto Retries** | `0` | ✅ Stable |\n| **Deduplication** | `0` | Standard |\n| **Processing Time** | `0.0s` | ✅ Fast |\n\n### 🔍 Decision Audit Trail\n- **[PLANNER]** 전략 수립 중... (11ms)\n- **[RESEARCHER]** 핵심 정보 수집 및 분석 중... (5ms)\n- **[WRITER]** 최종 리포트 작성 및 편집 중... (10ms)\n", + "createdAt": 1778593954580, "modelVersion": "unknown" } \ No newline at end of file diff --git a/.astra/tests/stress/.astra/missions/stress_conflict_1778473456740.json b/.astra/tests/stress/.astra/missions/stress_conflict_1778593954545.json similarity index 81% rename from .astra/tests/stress/.astra/missions/stress_conflict_1778473456740.json rename to .astra/tests/stress/.astra/missions/stress_conflict_1778593954545.json index 43c6ed8..bc94b2a 100644 --- a/.astra/tests/stress/.astra/missions/stress_conflict_1778473456740.json +++ b/.astra/tests/stress/.astra/missions/stress_conflict_1778593954545.json @@ -1,8 +1,8 @@ { - "missionId": "stress_conflict_1778473456740", + "missionId": "stress_conflict_1778593954545", "status": "completed", - "startTime": "2026-05-11T04:24:16.740Z", - "totalElapsedMs": 20, + "startTime": "2026-05-12T13:52:34.545Z", + "totalElapsedMs": 35, "results": { "planner": "Detailed Execution Plan: 1. Research 2. Analyze 3. Write report with high quality.", "researcher": "[CONFLICT WARNING] 성능이 200% 증가했습니다. vs 그러나 동시에 50% 감소했습니다. 최적화와 성능 저하가 동시에 발견됨.", @@ -18,28 +18,28 @@ "to": "planner", "durationMs": 11, "message": "전략 수립 중...", - "ts": "2026-05-11T04:24:16.751Z" + "ts": "2026-05-12T13:52:34.556Z" }, { "from": "planner", "to": "researcher", "durationMs": 5, "message": "핵심 정보 수집 및 분석 중...", - "ts": "2026-05-11T04:24:16.756Z" + "ts": "2026-05-12T13:52:34.561Z" }, { "from": "researcher", "to": "writer", - "durationMs": 3, + "durationMs": 10, "message": "최종 리포트 작성 및 편집 중...", - "ts": "2026-05-11T04:24:16.759Z" + "ts": "2026-05-12T13:52:34.571Z" }, { "from": "writer", "to": "completed", - "durationMs": 1, + "durationMs": 9, "message": "미션 완료", - "ts": "2026-05-11T04:24:16.760Z" + "ts": "2026-05-12T13:52:34.580Z" } ], "resilienceMetrics": { diff --git a/PATCHNOTES.md b/PATCHNOTES.md index 949b05d..6702bfa 100644 --- a/PATCHNOTES.md +++ b/PATCHNOTES.md @@ -1,5 +1,17 @@ # Astra Patch Notes +## v2.80.34 (2026-05-12) +### 🧠 Advanced Context Management & Brain Indexing +- **신규 컨텍스트 매니저 도입:** `contextManager.ts`를 통해 대규모 파일 및 대화 내역의 우선순위를 지능적으로 관리하고 토큰 예산을 최적화하는 기능을 추가했습니다. +- **브레인 인덱싱 고도화:** `brainIndex.ts` 및 관련 테스트 코드를 도입하여 지식 베이스 검색 속도와 정확도를 향상시켰습니다. +- **LM Studio 스트리밍 안정화:** `streamer.ts` 내의 응답 처리 로직을 개선하여 긴 응답 생성 시의 연결 안정성을 확보했습니다. +- **사이드바 UI/UX 정밀 튜닝:** 사이드바의 인터랙션 로직(HTML/JS/CSS)을 개선하여 사용자 경험을 한층 더 강화했습니다. +- **텔레그램 원격 실행 설계:** `TELEGRAM_REMOTE_EXECUTION_PLAN.md`를 통해 향후 텔레그램을 통한 원격 에이전트 실행 및 모니터링을 위한 청사진을 수립했습니다. +- **신규 패키징:** `astra-2.80.34.vsix` 패키지를 생성하여 최신 기능과 안정성 개선 사항을 통합했습니다. + +--- + + ## v2.80.33 (2026-05-11) ### 🏛️ Agent Repository Reorganization & Sync - **에이전트 저장소 구조 개편 대응:** `Agent` 저장소의 핵심 스킬 및 지식 베이스가 `.agent/`에서 `_agent/` 폴더로 대폭 재배치됨에 따라, 이를 익스텐션의 스킬 로딩 엔진 및 경로 탐색 로직에 동기화했습니다. diff --git a/docs/TELEGRAM_REMOTE_EXECUTION_PLAN.md b/docs/TELEGRAM_REMOTE_EXECUTION_PLAN.md new file mode 100644 index 0000000..88566ff --- /dev/null +++ b/docs/TELEGRAM_REMOTE_EXECUTION_PLAN.md @@ -0,0 +1,452 @@ +# Telegram Remote Execution 기획서 + +## 1. 목적 + +현재 Astra의 Telegram 연동은 사용자의 메시지를 받아 Second Brain RAG 컨텍스트를 붙이고 AI 답변을 Telegram으로 돌려주는 "원격 질의응답" 기능이다. 사용자가 원하는 다음 단계는 Telegram에서 지시한 업무를 실제 로컬 컴퓨터의 VS Code 워크스페이스에서 진행하게 만드는 것이다. + +이 기능의 목표는 Telegram을 안전한 원격 작업 지시 채널로 확장하는 것이다. 단, 보안상 Telegram 메시지가 곧바로 임의의 파일 변경이나 터미널 명령으로 이어지면 안 된다. 기본 정책은 "읽기 작업은 제한적으로 자동 실행, 쓰기/삭제/명령 실행은 승인 기반"으로 한다. + +## 2. 현재 구조 요약 + +- `src/extension.ts` + - Telegram bot을 생성하고 `handle(text, chatId)`에서 메시지를 처리한다. + - 현재는 `AIService.chat()`만 호출한다. + - `AgentExecutor.handlePrompt()`나 `executeActions()` 경로를 사용하지 않는다. + +- `src/integrations/telegram/telegramBot.ts` + - Telegram long polling, allowlist, enrollment, send retry를 담당한다. + - handler가 반환한 문자열을 Telegram으로 보낸다. + +- `src/agent.ts` + - 사이드바 채팅 요청을 처리한다. + - AI 응답 안의 action tag를 파싱해 파일 생성/수정/삭제, 파일 읽기, 명령 실행, URL 읽기 등을 수행한다. + - `dryRun`이 켜진 경우 `TransactionManager`와 `ApprovalQueue`를 통해 승인/롤백 흐름을 제공한다. + +- `src/features/approval/approvalQueue.ts` + - 현재 승인 대기 작업을 0..1개 관리한다. + - approve/reject callback을 실행한다. + +## 3. 핵심 제품 방향 + +Telegram 원격 실행은 기존 사이드바 Agent 실행 기능을 그대로 노출하는 것이 아니라 별도 게이트웨이를 둔다. + +추천 명칭: + +- `TelegramTaskGateway` +- 위치: `src/integrations/telegram/telegramTaskGateway.ts` + +역할: + +- Telegram 메시지를 "단순 답변"과 "로컬 작업 지시"로 분류한다. +- 로컬 작업 지시일 경우 작업 계획을 생성한다. +- 위험도를 평가한다. +- 읽기 전용 작업은 바로 실행할 수 있다. +- 파일 변경, 삭제, 터미널 명령은 승인 토큰을 발급하고 대기시킨다. +- 승인 후에만 실제 로컬 작업을 실행한다. + +## 4. 사용자 경험 + +### 4.1 기본 명령 + +Telegram에서 다음 명령을 지원한다. + +- `/ask 질문` + - 현재처럼 Second Brain 기반 답변만 생성한다. + +- `/task 업무지시` + - 로컬 워크스페이스에서 수행할 작업으로 해석한다. + - 예: `/task README를 읽고 설치 가이드가 부족한 부분을 보완해줘` + +- `/status` + - 현재 실행 중이거나 승인 대기 중인 작업 상태를 보여준다. + +- `/approve 작업ID` + - 승인 대기 중인 작업을 실행한다. + +- `/reject 작업ID` + - 승인 대기 중인 작업을 폐기한다. + +- `/cancel` + - 현재 실행 중인 Telegram-origin 작업을 중단한다. + +### 4.2 예시 흐름 + +사용자: + +```text +/task package.json이랑 README 보고 설치 방법 문서 보완해줘 +``` + +Astra: + +```text +작업 계획을 만들었습니다. + +작업 ID: tg-20260512-184233 +위험도: 파일 수정 필요 + +예상 작업: +1. package.json 읽기 +2. README.md 읽기 +3. README.md의 설치 섹션 수정 + +변경 대상: +- README.md + +실행하려면: +/approve tg-20260512-184233 + +취소하려면: +/reject tg-20260512-184233 +``` + +사용자: + +```text +/approve tg-20260512-184233 +``` + +Astra: + +```text +승인되었습니다. 작업을 실행합니다. +``` + +완료 후: + +```text +작업 완료. + +변경 파일: +- README.md + +요약: +- npm install 단계 추가 +- VSIX 설치 방법 보완 +- LM Studio/Ollama 설정 안내 추가 +``` + +## 5. 보안 정책 + +### 5.1 Telegram allowlist 필수 + +원격 실행 기능은 `g1nation.telegram.allowedChatIds`가 비어 있으면 비활성화한다. + +이유: + +- 현재 설정은 allowedChatIds가 비어 있으면 모든 chat을 허용한다. +- 질의응답에는 괜찮을 수 있지만 원격 실행에는 위험하다. + +정책: + +- `/task`, `/approve`, `/reject`, `/cancel`, `/status`는 allowlist 등록 chat에서만 동작한다. +- allowlist가 비어 있으면 다음 메시지를 반환한다. + +```text +원격 작업 기능은 허용된 Telegram chat에서만 사용할 수 있습니다. +Settings에서 내 채널 자동 등록을 먼저 완료해주세요. +``` + +### 5.2 작업 위험도 + +작업을 4단계로 분류한다. + +- `read_only` + - 파일 목록 조회, 파일 읽기, Second Brain 검색, 코드 분석. + - 자동 실행 가능. + +- `file_write` + - 파일 생성/수정. + - 승인 필요. + +- `destructive` + - 파일 삭제, 대량 변경, git clean/reset, dependency reinstall. + - 명시적 승인 필요. 기본적으로 2단계 확인을 권장한다. + +- `command` + - 터미널 명령 실행. + - 승인 필요. + - `sanitizeCommand()` 통과 필요. + - 장기적으로 allowlist 기반 command policy가 필요하다. + +### 5.3 경로 제한 + +- 모든 파일 작업은 기존 `validatePath(workspaceRoot, targetPath)`를 통과해야 한다. +- 워크스페이스 밖 파일은 기본 차단한다. +- Second Brain 경로는 읽기/쓰기 정책을 별도로 둔다. + +### 5.4 기본값 + +새 설정을 추가한다. + +```json +{ + "g1nation.telegram.remoteExecutionEnabled": false, + "g1nation.telegram.remoteReadOnlyAutoRun": true, + "g1nation.telegram.remoteRequireApproval": true, + "g1nation.telegram.remoteAllowCommands": false, + "g1nation.telegram.remoteMaxTaskSteps": 8 +} +``` + +권장 기본값: + +- remoteExecutionEnabled: false +- remoteReadOnlyAutoRun: true +- remoteRequireApproval: true +- remoteAllowCommands: false +- remoteMaxTaskSteps: 8 + +## 6. 목표 아키텍처 + +```text +TelegramBot + -> TelegramTaskGateway.handle(text, chatId) + -> command parser + -> permission check + -> task planner + -> risk classifier + -> approval store + -> TelegramTaskExecutor + -> AgentExecutor or shared ActionExecutor + -> TransactionManager + -> ApprovalQueue + -> Telegram reply +``` + +## 7. 구현 전략 + +### Phase 1: 명령 라우팅과 승인 대기 + +목표: + +- `/ask`, `/task`, `/status`, `/approve`, `/reject` 명령을 Telegram에서 인식한다. +- 실제 파일 변경은 아직 하지 않아도 된다. +- `/task`는 작업 계획과 승인 요청 메시지를 반환한다. + +작업: + +- `telegramTaskGateway.ts` 추가 +- `TelegramCommand` 타입 정의 +- `PendingTelegramTask` 타입 정의 +- in-memory pending task store 추가 +- extension.ts의 Telegram handler에서 gateway 호출 + +성공 기준: + +- `/ask`는 기존 답변 경로 유지 +- `/task`는 작업 ID와 계획을 반환 +- `/status`는 pending task를 보여줌 +- `/approve`와 `/reject`는 pending task 상태를 변경 + +### Phase 2: 읽기 전용 작업 실행 + +목표: + +- Telegram에서 요청한 코드 분석, 파일 읽기, 파일 목록 조회를 자동으로 수행한다. + +작업: + +- `TelegramReadOnlyTool` 추가 +- 허용 action: + - list files + - read file + - search text + - Second Brain retrieval +- 결과를 요약해 Telegram으로 반환 + +성공 기준: + +- `/task src 구조 분석해줘`가 실제 파일 목록과 주요 파일 내용을 읽고 답변한다. +- 워크스페이스 밖 경로 요청은 차단된다. + +### Phase 3: 파일 변경 작업 승인 실행 + +목표: + +- 파일 생성/수정 요청을 Telegram에서 승인 후 실행한다. + +권장 구현: + +- `AgentExecutor.executeActions()`는 현재 private이므로 바로 재사용하기 어렵다. +- 장기적으로는 action 실행부를 `src/core/actionExecutor.ts`로 추출한다. +- 단기 MVP는 `AgentExecutor.handlePrompt()`를 Telegram origin으로 호출하는 방식도 가능하다. + +추천 구조: + +```text +ActionExecutor + - parseActionTags(aiMessage) + - previewActions(actions) + - execute(actions, options) + - rollback(transactionId) +``` + +성공 기준: + +- `/task docs에 사용법 문서 만들어줘` +- Astra가 계획과 변경 예정 파일을 보여줌 +- `/approve id` 후 파일 생성 +- `/reject id` 후 아무 변경 없음 + +### Phase 4: 명령 실행 지원 + +목표: + +- 제한된 터미널 명령을 승인 후 실행한다. + +정책: + +- 기본 비활성화. +- `remoteAllowCommands`가 true일 때만 동작. +- `sanitizeCommand()` 통과 필요. +- command allowlist를 설정으로 관리하는 것을 권장한다. + +추가 설정: + +```json +{ + "g1nation.telegram.remoteCommandAllowlist": [ + "npm test", + "npm run test", + "npm run compile", + "git status", + "git diff" + ] +} +``` + +성공 기준: + +- `/task 테스트 실행해줘`는 승인 요청을 만든다. +- `/approve id` 후 허용된 명령만 실행한다. +- 차단된 명령은 실행하지 않고 이유를 반환한다. + +## 8. AI 프롬프트 정책 + +Telegram task planner용 system prompt를 별도로 둔다. + +```text +You are Astra Telegram Task Planner. +Your job is to convert a Telegram message into a safe local workspace task plan. + +Rules: +- Never execute actions directly. +- Produce a concise task plan. +- Classify risk as read_only, file_write, destructive, or command. +- List expected files or directories when possible. +- If the request is ambiguous, ask one short clarifying question. +- If the user requests computer-wide access outside the workspace, refuse and explain the workspace boundary. +- Prefer read-only inspection before proposing writes. + +Output JSON only: +{ + "intent": "ask" | "task" | "approve" | "reject" | "status" | "cancel", + "risk": "read_only" | "file_write" | "destructive" | "command", + "summary": "...", + "steps": ["..."], + "targets": ["..."], + "requiresApproval": true, + "clarifyingQuestion": "" +} +``` + +## 9. 데이터 모델 + +```ts +export type TelegramTaskRisk = 'read_only' | 'file_write' | 'destructive' | 'command'; +export type TelegramTaskStatus = 'planned' | 'pending_approval' | 'running' | 'completed' | 'rejected' | 'failed' | 'cancelled'; + +export interface PendingTelegramTask { + id: string; + chatId: number; + createdAt: number; + status: TelegramTaskStatus; + risk: TelegramTaskRisk; + originalText: string; + summary: string; + steps: string[]; + targets: string[]; + requiresApproval: boolean; + approvalToken?: string; +} +``` + +## 10. Telegram 응답 포맷 + +Telegram은 길이 제한이 있으므로 짧고 명령 중심으로 응답한다. + +승인 대기: + +```text +작업 대기 중 + +ID: tg-xxxx +위험도: file_write +대상: README.md + +실행: /approve tg-xxxx +취소: /reject tg-xxxx +``` + +완료: + +```text +작업 완료 + +변경: +- README.md + +요약: +- 설치 섹션 보완 +- 로컬 모델 설정 설명 추가 +``` + +차단: + +```text +차단됨 + +이 작업은 워크스페이스 밖 파일에 접근하려고 합니다. +Telegram 원격 실행은 현재 열린 VS Code 워크스페이스 내부에서만 허용됩니다. +``` + +## 11. 테스트 계획 + +단위 테스트: + +- command parser +- allowlist 필수 정책 +- risk classifier +- pending task store +- approve/reject 상태 전환 +- workspace 밖 path 차단 +- command allowlist 차단 + +통합 테스트: + +- `/ask` 기존 응답 유지 +- `/task` 계획 생성 +- `/task` read_only 자동 실행 +- `/task` file_write 승인 대기 +- `/approve` 후 실행 +- `/reject` 후 실행 안 됨 +- allowedChatIds 비어 있을 때 원격 실행 차단 + +회귀 테스트: + +- 기존 Telegram RAG 답변이 깨지지 않아야 한다. +- Telegram token 저장/삭제/연결 테스트가 기존처럼 동작해야 한다. +- 사이드바 Approval Panel과 충돌하지 않아야 한다. + +## 12. 최종 권장 MVP + +가장 안전하고 빠른 MVP 범위: + +1. `/ask`, `/task`, `/status`, `/approve`, `/reject` 명령 추가 +2. allowlist가 비어 있으면 `/task` 차단 +3. read-only 작업만 자동 실행 +4. file write와 command는 승인 대기까지만 구현 +5. action 실행부는 다음 단계에서 `ActionExecutor`로 추출 + +이 MVP만으로도 사용자는 Telegram에서 "프로젝트 분석해줘", "이 파일 읽고 요약해줘", "어떤 파일을 고쳐야 하는지 계획 세워줘"를 원격으로 시킬 수 있다. 이후 승인 실행까지 붙이면 Telegram이 완전한 원격 작업 지시 인터페이스가 된다. diff --git a/media/sidebar.css b/media/sidebar.css index a94f850..65c239b 100644 --- a/media/sidebar.css +++ b/media/sidebar.css @@ -726,3 +726,69 @@ from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } } + + /* ── Ready-status bar ───────────────────────────────────────────── */ + .ready-bar { + display: flex; + align-items: center; + gap: 6px; + padding: 4px 12px; + font-size: 10.5px; + line-height: 1.4; + color: var(--text-dim); + background: var(--bg-secondary); + border-bottom: 1px solid var(--border); + white-space: nowrap; + overflow-x: auto; + scrollbar-width: none; + } + .ready-bar::-webkit-scrollbar { display: none; } + .ready-bar .rb-dot { + width: 6px; height: 6px; border-radius: 50%; + background: var(--text-dim); flex-shrink: 0; + } + .ready-bar .rb-dot.ok { background: var(--success); } + .ready-bar .rb-dot.bad { background: var(--error); } + .ready-bar .rb-dot.warn { background: var(--warning); } + .ready-bar .rb-content { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; } + .ready-bar .rb-seg { color: var(--text-dim); } + .ready-bar .rb-seg.ok { color: var(--success); } + .ready-bar .rb-seg.bad { color: var(--error); } + .ready-bar .rb-seg.rb-dim, .ready-bar .rb-dim { color: var(--border-bright); } + .ready-bar .rb-sep { color: var(--border); margin: 0 1px; } + .ready-bar .rb-link { color: var(--accent); cursor: pointer; } + .ready-bar .rb-link:hover { text-decoration: underline; } + + /* ── Context-budget badge (input footer) ────────────────────────── */ + .ctx-badge { + font-size: 10px; + color: var(--text-dim); + padding: 1px 6px; + border-radius: 9px; + border: 1px solid var(--border); + background: transparent; + white-space: nowrap; + max-width: 60vw; + overflow: hidden; + text-overflow: ellipsis; + } + .ctx-badge:empty { display: none; } + .ctx-badge.ok { border-color: var(--border); } + .ctx-badge.warn { color: var(--warning); border-color: var(--warning); } + + /* ── Per-answer "scope used" footer ─────────────────────────────── */ + .msg-scope-footer { + margin-top: 6px; + padding-top: 6px; + border-top: 1px dashed var(--border); + font-size: 10px; + color: var(--text-dim); + line-height: 1.5; + word-break: break-word; + } + .msg-scope-footer .scope-link { + color: var(--accent); + cursor: pointer; + } + .msg-scope-footer .scope-link:hover { text-decoration: underline; } + .msg-scope-footer .scope-dim { color: var(--border-bright); } diff --git a/media/sidebar.html b/media/sidebar.html index e45a373..09a9b25 100644 --- a/media/sidebar.html +++ b/media/sidebar.html @@ -74,6 +74,11 @@ +
+ + 준비 상태 확인 중… +
+

Chat History

@@ -169,6 +174,7 @@