feat(chat): 일정/할일 질의에 Google Calendar·Tasks 실데이터 주입 (v2.2.221)

"오늘 업무 목록 알려줘" 류 질문에 채팅이 캘린더를 못 읽던 문제 수정.
채팅 경로(RAG)는 두뇌·기억만 검색해 캘린더가 연결돼 있어도 일정 질의에
모른다고 하거나 지어내던 구조적 공백.

- scheduleContext.ts: 일정/할일 질의 감지(isScheduleRequest) 시
  iCal 캐시 새로고침 + 기간 내 일정 + Tasks(기간 마감/기한 경과/조건부)
  실데이터 블록을 contextBlock 에 주입. "데이터에 없으면 없다고 답하라"
  지시 포함 (환각 방지). 기간 해석: 기본 오늘 · "내일" · "이번 주".
- 미연결이면 연결 명령 안내 블록 — 지어내지 않고 정직하게 안내.
- Tasks 조회 실패(토큰 만료 등) 시 에러를 그대로 사용자에게 전달.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 18:34:06 +09:00
parent b72501fae5
commit c7c84702af
4 changed files with 113 additions and 4 deletions
+13 -1
View File
@@ -19,6 +19,7 @@ import { TransactionManager } from './core/transaction';
import { SessionManager } from './core/session';
import { AgentWorkflowManager } from './agents/AgentWorkflowManager';
import { buildAstraModeArchitectureContext } from './lib/contextBuilders/astraModeArchitecture';
import { isScheduleRequest, buildScheduleContext } from './lib/contextBuilders/scheduleContext';
import { shouldUseMultiAgentWorkflow } from './lib/contextBuilders/multiAgentRouting';
import { buildThinkingPartnerResponseContract } from './lib/contextBuilders/thinkingPartnerContract';
import { buildDroppedHistorySummary } from './lib/contextBuilders/droppedHistorySummary';
@@ -505,7 +506,7 @@ export class AgentExecutor {
: getActiveBrainProfile();
// Per-turn context blocks → src/agent/handlePrompt/buildTurnContextBlocks.ts
const {
contextBlock,
contextBlock: baseContextBlock,
brainContext,
brainInventoryCtx,
brainFiles,
@@ -523,6 +524,17 @@ export class AgentExecutor {
rootPath,
});
void brainPreview;
// [일정/할일 실데이터] "오늘 업무 목록" 류 질의는 RAG(두뇌)가 아니라
// Google Calendar/Tasks 가 진실의 원천 — 감지 시 실데이터 블록을 주입.
// 미주입 시 모델이 모른다고 하거나 지어내는 문제의 수정.
let contextBlock = baseContextBlock;
if (prompt && loopDepth === 0 && !isCasualConversation && isScheduleRequest(prompt)) {
try {
contextBlock += `\n\n${await buildScheduleContext(this.context, prompt)}`;
} catch (e: any) {
logError('Schedule context 주입 실패 (계속 진행).', { error: e?.message ?? String(e) });
}
}
// 2. Setup History
if (prompt !== null) {