0a97324f1b
R56–R59: agent.ts 2731→1529줄 god-file 분해 (25 modules) · attrParsers + LLM 메서드 8개 (callNonStreaming, streamChatOnce 등) · executeActions 415줄 → 8 handler 그룹 (file/run/list/brain/calendar/sheets/tasks) · handlePrompt 1100줄 → 7 phase 모듈 (system prompt + budget + autoContinue 등) R50–R55: extension.ts 1145→349줄 (telegram/settings/provider commands 분리) Stocks feature 신규: /stocks slash command (v2.2.152~158) · .astra/stocks.json 저장소 + Yahoo Finance 현재가 갱신 · 8 키워드 필터 (ROE/성장성/유동성/수익성/영업효율/기술력/안정성/PBR) · Naver 시가총액 페이지 JSON API (m.stock.naver.com) 발굴 · LLM Top 5 매력도 분석 + Telegram 자동 보고서 · KST 09:00/15:00 watcher 자동 모니터링 대화 연속성 (v2.2.150~157): · [PRIOR TURN CONCLUSION] block 으로 직전 결론 anchor · thin follow-up 분류 → boilerplate 헤더 suppression · slash 명령 결과 chatHistory mirror (capture wrapper) · echo/parrot 금지 system prompt rule 기타: /stocks 슬래시 자동완성 dropdown UI, Naver JSON API 전환 (cheerio 제거) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
20 lines
1.0 KiB
TypeScript
20 lines
1.0 KiB
TypeScript
import type { ChatMessage } from '../../agent';
|
|
|
|
/**
|
|
* v2.2.69 — chatHistory 의 마지막 user 턴에서 사용자가 무슨 주제를 다루고
|
|
* 있었는지 한 줄로 뽑아 모드 전환 bridge 의 "이전 맥락" 문장에 쓴다.
|
|
*
|
|
* 비어 있으면 빈 문자열. 너무 길면 120자 cap (bridge 문장은 짧아야 의미 있음).
|
|
*
|
|
* agent.ts 의 private 메서드를 추출 — 옛 버전은 `this.chatHistory` 를 직접 읽어
|
|
* stateful 했지만, history 를 명시 arg 로 받게 만들어 stateless 화. 호출자가
|
|
* 이미 자기 history 를 들고 있으니 의존 방향이 자연스럽다.
|
|
*/
|
|
export function buildLastTopicLine(history: ChatMessage[]): string {
|
|
const recent = history.filter(m => !m.internal && (m.role === 'user' || m.role === 'assistant'));
|
|
if (recent.length === 0) return '';
|
|
const lastUser = [...recent].reverse().find(m => m.role === 'user');
|
|
if (!lastUser || typeof lastUser.content !== 'string') return '';
|
|
return lastUser.content.replace(/\s+/g, ' ').trim().slice(0, 120);
|
|
}
|