feat: nvr_snapshot — 모델이 집 CCTV 화면을 직접 보고 답한다

"마당에 누구 있어?", "택배 왔나 봐줘" 같은 요청에 NVR/독립카메라의 현재 프레임을
ffmpeg로 한 장 캡처해 비전 모델에 임베드한다.

- src/tools/nvr.ts: RTSP → ffmpeg 단일 프레임 → workspace/nvr-snapshots/ → ![](/api/files/…).
  카메라는 이름("현관")·채널번호("2")·자유입력 모두 해석, 못 찾으면 목록 반환.
  main 실패 시 sub 스트림으로 1회 재시도. 파일명은 ASCII(썸네일 execSync 한글경로 회피).
- routes/nvr.ts: getNvrConfig/getExtraCameras/getChannelLabels export + buildRtspUrl 추출
  (라이브 스트림 라우트와 공유, 중복 제거).
- tool-scope.ts: hasCctvKeyword 게이트 — CCTV/카메라/마당/현관/택배/"누구 있" 등에만.
- handle-chat.ts: 비전 판정을 _modelSupportsVision 헬퍼로 통일 + **gemma 추가**
  (gemma4:31b-cloud는 멀티모달인데 4곳의 정규식에서 다 빠져 있어 weather_map_screenshot
  등에서도 "이미지 못 봄" 취급받고 있었음 — 2026-09-07 실측으로 비전 정상 확인).
  _imagingTools 3곳에 nvr_snapshot 추가.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rfme1WVEPkpNwnf5oVNXXc
This commit is contained in:
kimandClaude Sonnet 5 committed 2026-09-07 11:05:13 +09:00
1 parent 5834242261
commit 1a40512270
7 files changed
+207 -38

No files matched your search

+14
View File
@@ -1088,6 +1088,20 @@ export function createBuildTools(isOrchestrationSkillEnabled: () => boolean) {
},
},
},
{
type: 'function',
function: {
name: 'nvr_snapshot',
description: '집 CCTV(감시 카메라)의 지금 화면을 한 장 캡처해 실제로 보고 확인한다. "마당에 누구 있어?", "택배 왔어?", "현관 확인해줘", "고양이 있나 봐줘" 같은 요청에 사용. 캡처한 이미지를 직접 보고 화면에 실제로 보이는 것만 설명하고, 어두우면 어둡다고 하고 추측은 하지 말 것.',
parameters: {
type: 'object', required: ['camera'],
properties: {
camera: { type: 'string', description: '카메라 이름("현관","마당","주차장" 등) 또는 채널 번호("0"~"3","채널 2"). 이름을 모르면 아무 값이나 넣어 호출하면 사용 가능한 카메라 목록이 반환됨.' },
stream: { type: 'string', enum: ['main', 'sub'], description: '화질(기본 main). 신호 약한 무선 카메라가 안 잡히면 sub.' },
},
},
},
},
{
type: 'function',
function: {
+13 -7
View File
@@ -266,6 +266,12 @@ async function handleChat(
// kimi/gemini/qwen run through Ollama so primaryProvider is always 'ollama'.
const _activeModelName: string = rawCfgForPreempt.llm?.providers?.[primaryProvider]?.model
|| rawCfgForPreempt.models?.primary || '';
// Vision-capable model check. kimi/gemini/gemma/etc. all run through the Ollama provider,
// so this keys on the model NAME, not the provider. gemma4:31b-cloud (our default primary)
// is multimodal — verified 2026-09-07 that it reads shapes/colors/text from an image
// correctly — so it belongs here even though the name looks local-ish.
const _modelSupportsVision = (name: unknown): boolean =>
/kimi|openai|claude|gemini|gemma|gpt(?!-oss)/i.test(String(name || ''));
const preemptCfg: {
enabled: boolean;
stallThresholdMs: number;
@@ -628,8 +634,8 @@ async function handleChat(
const toolMessageContent = (multiAgentActive && (isBrowserTool || isDesktopTool))
? (isBrowserTool ? buildBrowserAck(toolName, toolResult) : buildDesktopAck(toolName, toolResult))
: toolResult.result;
const _imagingTools3 = new Set(['image_edit', 'image_info', 'image_read', 'python_eval', 'weather_map_screenshot']);
const _supportsVision3 = /kimi|openai|claude|gemini|gpt(?!-oss)/i.test(String(_activeModelName || primaryProvider || ''));
const _imagingTools3 = new Set(['image_edit', 'image_info', 'image_read', 'python_eval', 'weather_map_screenshot', 'nvr_snapshot']);
const _supportsVision3 = _modelSupportsVision(_activeModelName);
if (_imagingTools3.has(toolName)) console.log(`[v2] IMG-VISION tool=${toolName} embedVision=${_supportsVision3} model=${_activeModelName || primaryProvider}`);
const _resolvedToolContent3 = _imagingTools3.has(toolName) && typeof toolMessageContent === 'string'
? resolveToolImageContent(toolMessageContent, workspacePath, _supportsVision3)
@@ -1167,8 +1173,8 @@ async function handleChat(
const toolMessageContent = (multiAgentActive && (isBrowserTool || isDesktopTool))
? (isBrowserTool ? buildBrowserAck(toolName, toolResult) : buildDesktopAck(toolName, toolResult))
: toolResult.result;
const _imagingTools2 = new Set(['image_edit', 'image_info', 'image_read', 'python_eval', 'weather_map_screenshot']);
const _supportsVision2 = /kimi|openai|claude|gemini|gpt(?!-oss)/i.test(String(_activeModelName || primaryProvider || ''));
const _imagingTools2 = new Set(['image_edit', 'image_info', 'image_read', 'python_eval', 'weather_map_screenshot', 'nvr_snapshot']);
const _supportsVision2 = _modelSupportsVision(_activeModelName);
if (_imagingTools2.has(toolName)) console.log(`[v2] IMG-VISION tool=${toolName} embedVision=${_supportsVision2} model=${_activeModelName || primaryProvider}`);
const _resolvedContent2 = _imagingTools2.has(toolName) && typeof toolMessageContent === 'string'
? resolveToolImageContent(toolMessageContent, workspacePath, _supportsVision2)
@@ -1311,7 +1317,7 @@ async function handleChat(
const needsLongOutput = /pptx|powerpoint|presentation|슬라이드|발표|프레젠테이션|게임|코드|스크립트|함수|클래스|구현해|만들어줘|만들어\s*줘|작성해|짜줘|build.*app|create.*app|write.*code|implement.*class|game.*make|전체.*코드|완성된.*코드/i.test(message);
// Vision fallback: if primary doesn't support vision but messages contain images, use secondary vision model
const _visionFallbackModel: string | undefined = (() => {
if (/kimi|openai|claude|gemini|gpt(?!-oss)/i.test(String(_activeModelName || ''))) return undefined;
if (_modelSupportsVision(_activeModelName)) return undefined;
const hasImages = messages.some((m: any) =>
Array.isArray(m.content) && m.content.some((p: any) => p.type === 'image_url')
);
@@ -3066,8 +3072,8 @@ async function handleChat(
const toolMessageContent = (multiAgentActive && (isBrowserTool || isDesktopTool))
? (isBrowserTool ? buildBrowserAck(toolName, toolResult) : buildDesktopAck(toolName, toolResult))
: toolResult.result;
const _imagingTools = new Set(['image_edit', 'image_info', 'image_read', 'python_eval', 'weather_map_screenshot']);
const _supportsVision = /kimi|openai|claude|gemini|gpt(?!-oss)/i.test(String(_activeModelName || primaryProvider || ''));
const _imagingTools = new Set(['image_edit', 'image_info', 'image_read', 'python_eval', 'weather_map_screenshot', 'nvr_snapshot']);
const _supportsVision = _modelSupportsVision(_activeModelName);
if (_imagingTools.has(toolName)) console.log(`[v2] IMG-VISION tool=${toolName} embedVision=${_supportsVision} model=${_activeModelName || primaryProvider}`);
const _resolvedToolContent = _imagingTools.has(toolName) && typeof toolMessageContent === 'string'
? resolveToolImageContent(toolMessageContent, workspacePath, _supportsVision)
+5
View File
@@ -167,6 +167,10 @@ export function buildSkillToolFilter(input: ToolScopeInput): (toolName: string)
// eonet_events/satellite_snapshot — casual "what's happening on Earth" feature,
// not relevant to unrelated turns.
const hasSatelliteKeyword = /위성|자연재해|산불|태풍|화산|지진|산사태|가뭄|황사|연무|해빙|satellite|wildfire|volcano|eonet|natural\s*disaster/i.test(message);
// nvr_snapshot — 집 CCTV 한 프레임 캡처해 모델이 직접 확인. "마당에 누구 있어?", "택배 왔나
// 봐줘", "현관/주차장 확인", "고양이 있나" 같은 요청에만. 카메라/감시 어휘 + "확인해줘·봐줘"류
// 동사, 또는 알려진 카메라 위치명이 있을 때 연다.
const hasCctvKeyword = /cctv|감시\s*카메라|카메라(로|에|를|\s|$)|웹캠|현관(?:문|앞|쪽)?|마당|주차장|차고|대문|택배|초인종|누가?\s*(?:왔|있|지나)|누구\s*(?:있|왔)|밖에?\s*(?:누구|뭐|무슨)|집\s*(?:앞|밖|상황)|door\s*cam|security\s*cam|who'?s?\s*(?:at\s*the\s*door|outside)/i.test(message);
// 2026-08-10: news_search was gated on the literal word "뉴스" (hasNewsKeyword below), so a
// disaster question with no news-flavored wording ("돌핀 지금 어디 있지?") never got access to
// it — even after handle-chat.ts's reminder started explicitly recommending news_search for
@@ -356,6 +360,7 @@ export function buildSkillToolFilter(input: ToolScopeInput): (toolName: string)
if ((name === 'pdf_read' || name === 'pdf_extract_images') && !hasPdfAttachment) return false;
if (name === 'schedule_job' && !hasScheduleKeyword) return false;
if ((name === 'eonet_events' || name === 'satellite_snapshot') && !hasSatelliteKeyword) return false;
if (name === 'nvr_snapshot' && !hasCctvKeyword) return false;
if (name === 'run_command' && !hasRunCommandKeyword) return false;
return true;
};
+36 -31
View File
@@ -22,7 +22,7 @@ interface NvrConfig {
// 경로 쿼리의 user=/password=는 NVR이 raw로 매치(authority의 user:pass는 ffmpeg가 인코딩).
const DEFAULT_RTSP_PATH = '/user={username}&password={password}&channel={channel}&stream={stream}';
function getNvrConfig(): NvrConfig {
export function getNvrConfig(): NvrConfig {
const cm = getConfig();
const cfg = cm.getConfig() as any;
const nvr = cfg?.nvr || {};
@@ -53,7 +53,7 @@ interface ExtraCamera {
ptz: boolean;
onvifPort: number;
}
function getExtraCameras(): ExtraCamera[] {
export function getExtraCameras(): ExtraCamera[] {
const cm = getConfig();
const cfg = cm.getConfig() as any;
const list = cfg?.nvr?.extraCameras;
@@ -76,6 +76,35 @@ function getExtraCameras(): ExtraCamera[] {
}));
}
// 채널 ID(0-based) → 사용자 지정 라벨("현관" 등). config nvr.channelLabels에 저장됨.
export function getChannelLabels(): Record<string, string> {
const cfg = getConfig().getConfig() as any;
return (cfg?.nvr?.channelLabels && typeof cfg.nvr.channelLabels === 'object') ? cfg.nvr.channelLabels : {};
}
// 채널(메인 NVR 0~3 또는 독립 카메라 1000+)의 RTSP URL을 조립한다. 라이브 스트림 라우트와
// nvr_snapshot 도구가 공유한다. stream: 0=메인(고화질) 1=서브(저화질).
export function buildRtspUrl(channelId: number, stream: 0 | 1 = 0): { url: string } | { error: string } {
const extraCam = getExtraCameras().find((c) => c.id === channelId);
if (extraCam) {
if (!extraCam.host) return { error: 'camera host not configured' };
let p = extraCam.rtspPath;
if (stream === 1 && /stream1$/i.test(p)) p = p.replace(/stream1$/i, 'stream2');
if (!p.startsWith('/')) p = '/' + p;
return { url: `rtsp://${encodeURIComponent(extraCam.username)}:${encodeURIComponent(extraCam.password)}@${extraCam.host}:${extraCam.rtspPort}${p}` };
}
const { host, rtspPort, username, password, rtspPathTemplate } = getNvrConfig();
if (!host) return { error: 'NVR host not configured' };
let rtspPath = rtspPathTemplate
.replaceAll('{username}', username)
.replaceAll('{password}', password)
.replaceAll('{channel0}', String(channelId - 1))
.replaceAll('{channel}', String(channelId))
.replaceAll('{stream}', String(stream));
if (!rtspPath.startsWith('/')) rtspPath = '/' + rtspPath;
return { url: `rtsp://${encodeURIComponent(username)}:${encodeURIComponent(password)}@${host}:${rtspPort}${rtspPath}` };
}
// ── 독립 카메라 ONVIF PTZ ────────────────────────────────────────────────
// ONVIF 연결(디바이스 능력 조회 등)은 왕복이 있어 버튼 누를 때마다 새로 맺으면 반응이
// 느리다 — 카메라 id별로 연결을 캐싱해 재사용한다.
@@ -494,36 +523,12 @@ export function registerNvrRoutes(app: Express): void {
const streamQuery = req.query.stream;
const stream = streamQuery === '1' ? 1 : streamQuery === '0' ? 0 : (getChannelStreamPrefs()[String(channelId)] ?? 0);
// 독립 카메라(메인 NVR과 별개, id 1000+)면 그 카메라 자신의 host/계정/경로로 URL을
// 직접 만든다(템플릿 치환 없음 — Mercusys 등은 이미 완전한 경로를 그대로 씀).
// RTSP URL 조립(독립 카메라 vs 메인 NVR 템플릿)은 buildRtspUrl로 통일 — nvr_snapshot
// 도구와 공유한다.
const extraCam = getExtraCameras().find((c) => c.id === channelId);
let rtspUrl: string;
if (extraCam) {
if (!extraCam.host) return res.status(400).json({ error: 'camera host not configured' });
let path = extraCam.rtspPath;
// stream=1(서브)이 오면 흔한 관례로 stream1→stream2 치환 시도(정확한 매핑은 카메라마다
// 달라 완벽하진 않음 — 안 맞으면 그냥 rtspPath 그대로 유지).
if (stream === 1 && /stream1$/i.test(path)) path = path.replace(/stream1$/i, 'stream2');
if (!path.startsWith('/')) path = '/' + path;
rtspUrl = `rtsp://${encodeURIComponent(extraCam.username)}:${encodeURIComponent(extraCam.password)}@${extraCam.host}:${extraCam.rtspPort}${path}`;
} else {
const { host, rtspPort, username, password, rtspPathTemplate } = getNvrConfig();
if (!host) return res.status(400).json({ error: 'NVR host not configured' });
// RTSP 경로 조립 — 템플릿 치환. 치환자:
// {username} {password} — 기기 계정(경로 쿼리용, raw 치환 — NVR이 raw 매치)
// {channel} — 1-based 채널번호(Movols /user=...&channel=A 형식용)
// {channel0} — 0-based 채널번호(이 기기 실제 형식 /ch{N}_{S}.264 — ch0=첫카메라)
// {stream} — 0(main)/1(sub)
// 경로가 '/'로 시작 안 하면 자동 붙임(사용자가 'ch0_0.264'만 적어도 동작).
let rtspPath = rtspPathTemplate
.replaceAll('{username}', username)
.replaceAll('{password}', password)
.replaceAll('{channel0}', String(channelId - 1))
.replaceAll('{channel}', String(channelId))
.replaceAll('{stream}', String(stream));
if (!rtspPath.startsWith('/')) rtspPath = '/' + rtspPath;
rtspUrl = `rtsp://${encodeURIComponent(username)}:${encodeURIComponent(password)}@${host}:${rtspPort}${rtspPath}`;
}
const _rtsp = buildRtspUrl(channelId, stream as 0 | 1);
if ('error' in _rtsp) return res.status(400).json({ error: _rtsp.error });
const rtspUrl = _rtsp.url;
const streamKey = `${channelId}:${stream}`;
+127
View File
@@ -0,0 +1,127 @@
import { spawn } from 'child_process';
import fs from 'fs';
import path from 'path';
import { ToolResult } from '../types.js';
import { getWorkspacePath } from '../config/paths.js';
import { buildImageMarkdown } from './image.js';
import { buildRtspUrl, getExtraCameras, getChannelLabels } from '../gateway/routes/nvr.js';
// 집 CCTV(NVR K8210-3WS 4채널 + 독립 IP카메라)의 현재 화면을 한 프레임 캡처해서
// 모델이 직접 보게 한다. RTSP → ffmpeg 단일 프레임 → workspace/nvr-snapshots/ 에 JPG 저장 →
// ![](/api/files/...) 마크다운 반환(resolveToolImageContent가 비전 모델에 임베드).
interface CamInfo { id: number; label: string; source: 'nvr' | 'standalone'; }
function listCameras(): CamInfo[] {
const labels = getChannelLabels();
const cams: CamInfo[] = [];
// 메인 NVR은 채널 개수를 조회하려면 /netsdk 왕복이 필요한데, 이 기기는 항상 4채널(0~3)
// 고정이라 그냥 4개로 둔다. 라벨 없는 채널은 "채널 N"으로 표기.
for (let i = 0; i < 4; i++) {
cams.push({ id: i, label: labels[String(i)] || `채널 ${i}`, source: 'nvr' });
}
for (const c of getExtraCameras()) {
cams.push({ id: c.id, label: c.label || `카메라 ${c.id}`, source: 'standalone' });
}
return cams;
}
// "현관", "채널 2", "2", "머큐시스" 등 자유 입력을 채널 ID로 해석.
function resolveCameraId(input: unknown): { id: number; label: string } | { error: string } {
const cams = listCameras();
const list = () => cams.map((c) => `${c.label}(${c.id})`).join(', ');
if (input == null || String(input).trim() === '') {
return { error: `어느 카메라인지 지정하세요. 사용 가능: ${list()}` };
}
const raw = String(input).trim();
// 순수 숫자면 채널 ID로 직접
if (/^\d+$/.test(raw)) {
const id = Number(raw);
const hit = cams.find((c) => c.id === id);
return hit ? { id: hit.id, label: hit.label } : { error: `채널 ${id}은 없습니다. 사용 가능: ${list()}` };
}
// "채널 N" / "channel N"
const chMatch = raw.match(/(?:채널|channel|ch)\s*(\d+)/i);
if (chMatch) {
const id = Number(chMatch[1]);
const hit = cams.find((c) => c.id === id);
return hit ? { id: hit.id, label: hit.label } : { error: `채널 ${id}은 없습니다. 사용 가능: ${list()}` };
}
// 라벨 부분일치(대소문자·공백 무시)
const norm = (s: string) => s.replace(/\s+/g, '').toLowerCase();
const n = norm(raw);
const hit = cams.find((c) => norm(c.label) === n) || cams.find((c) => norm(c.label).includes(n) || n.includes(norm(c.label)));
if (hit) return { id: hit.id, label: hit.label };
return { error: `"${raw}"에 해당하는 카메라를 찾지 못했습니다. 카메라에 이름이 아직 안 붙어 있을 수 있습니다. 사용 가능: ${list()}` };
}
function grabFrame(rtspUrl: string, outPath: string, timeoutMs: number): Promise<{ ok: true } | { ok: false; detail: string }> {
return new Promise((resolve) => {
const proc = spawn('ffmpeg', [
'-nostdin', '-y',
'-rtsp_transport', 'tcp',
// NVR SDP가 hevc 크기를 안 알려줘서(SDP "hevc, none") 프레임을 직접 프로브해야 함.
'-probesize', '5000000',
'-analyzeduration', '5000000',
'-i', rtspUrl,
'-frames:v', '1',
'-q:v', '3',
outPath,
], { stdio: ['ignore', 'ignore', 'pipe'] });
let stderr = '';
proc.stderr?.on('data', (d: Buffer) => { stderr += d.toString('utf8'); if (stderr.length > 4000) stderr = stderr.slice(-4000); });
const killTimer = setTimeout(() => { try { proc.kill('SIGKILL'); } catch {} }, timeoutMs);
proc.on('error', (e) => { clearTimeout(killTimer); resolve({ ok: false, detail: String(e.message || e) }); });
proc.on('close', (code) => {
clearTimeout(killTimer);
if (code === 0 && fs.existsSync(outPath) && fs.statSync(outPath).size > 1000) resolve({ ok: true });
else resolve({ ok: false, detail: `ffmpeg exit ${code}. ${stderr.slice(-500)}` });
});
});
}
export const nvrSnapshotTool = {
name: 'nvr_snapshot',
description: '집 CCTV(감시 카메라)의 지금 화면을 한 장 캡처해서 확인한다. "마당에 누구 있어?", "택배 왔나 봐줘", "현관 확인해줘" 같은 요청에 사용. camera에 카메라 이름("현관", "마당") 또는 채널 번호("0"~"3", "채널 2")를 넣는다. 이름을 모르면 아무 값이나 넣어 호출하면 사용 가능한 카메라 목록이 반환된다. 캡처된 이미지를 실제로 보고 답하되, 화면에 실제로 보이는 것만 설명하고 추측하지 말 것.',
schema: { camera: 'string' },
jsonSchema: {
type: 'object',
required: ['camera'],
properties: {
camera: { type: 'string', description: '카메라 이름("현관", "마당", "주차장" 등) 또는 채널 번호("0","1","2","3","채널 2"). 잘 모르면 아무 값이나 넣으면 목록이 나옴.' },
stream: { type: 'string', enum: ['main', 'sub'], description: '화질. 기본 main(고화질). 신호 약한 무선 카메라가 안 잡히면 sub.' },
},
additionalProperties: false,
},
execute: async (args: any): Promise<ToolResult> => {
const resolved = resolveCameraId(args?.camera);
if ('error' in resolved) return { success: false, error: resolved.error };
const stream: 0 | 1 = String(args?.stream) === 'sub' ? 1 : 0;
const rtsp = buildRtspUrl(resolved.id, stream);
if ('error' in rtsp) return { success: false, error: `${resolved.label}: ${rtsp.error}` };
const workspacePath = getWorkspacePath(args);
const outDir = path.join(workspacePath, 'nvr-snapshots');
if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true });
// 파일명은 순수 ASCII로 — resolveToolImageContent가 큰 이미지를 execSync(python3 …) 셸
// 명령으로 썸네일하는데 한글 경로가 섞이면 불안정하다. 한글 라벨은 stdout 텍스트에만.
const outPath = path.join(outDir, `cam${resolved.id}_${Date.now()}.jpg`);
let grab = await grabFrame(rtsp.url, outPath, 20_000);
// main 스트림이 첫 시도에 실패하면(NVR 바쁨/HEVC 프로브 실패) sub로 한 번 재시도.
if (!grab.ok && stream === 0) {
const rtspSub = buildRtspUrl(resolved.id, 1);
if (!('error' in rtspSub)) grab = await grabFrame(rtspSub.url, outPath, 20_000);
}
if (!grab.ok) {
return { success: false, error: `${resolved.label} 카메라 화면을 가져오지 못했습니다 (RTSP 연결 실패 또는 카메라 오프라인). ${grab.detail}` };
}
const now = new Date().toLocaleString('ko-KR', { timeZone: 'Asia/Seoul', hour12: false });
return {
success: true,
stdout: `${resolved.label} 카메라 — ${now} 현재 화면:\n\n${buildImageMarkdown(outPath, workspacePath)}\n\n위 이미지를 보고 화면에 실제로 보이는 것만 설명하세요(사람/차량/택배/동물/조명 상태 등). 어두워서 안 보이거나 화면이 흐리면 그렇다고 말하고, 보이지 않는 것을 추측하지 마세요.`,
};
},
};
+3
View File
@@ -30,6 +30,7 @@ import { koreanLawSearchTool, koreanLawFetchTool, usCaseSearchTool } from './leg
import { excelReadTool, excelWriteTool } from './excel.js';
import { cmsHospitalCompareTool } from './cms.js';
import { drugDurCheckTool } from './mfds.js';
import { nvrSnapshotTool } from './nvr.js';
export interface Tool {
name: string;
@@ -233,6 +234,8 @@ class ToolRegistry {
// NASA EONET (natural event tracker) + Worldview Snapshots (satellite imagery) — both public, no API key
this.registerSafe(eonetEventsTool);
this.registerSafe(satelliteSnapshotTool);
// 집 CCTV 한 프레임 캡처 → 비전 모델이 직접 확인 (감시카메라/마당/현관/택배 확인 요청)
this.registerSafe(nvrSnapshotTool);
// News (NewsData.io — real headlines with real publish dates, for news queries)
this.registerSafe(newsSearchTool);
// Email tools (IMAP + SMTP)
+9
View File
@@ -178,6 +178,15 @@ describe('키워드 게이트 — 필요할 때 확실히 나타난다', () => {
assert.equal(filterFor('산불 위성사진 보여줘')('satellite_snapshot'), true);
});
test('nvr_snapshot — CCTV 확인 요청에만 열린다', () => {
assert.equal(filterFor('안녕')('nvr_snapshot'), false);
assert.equal(filterFor('오늘 뭐 먹지')('nvr_snapshot'), false);
assert.equal(filterFor('마당에 누구 있어?')('nvr_snapshot'), true);
assert.equal(filterFor('택배 왔나 봐줘')('nvr_snapshot'), true);
assert.equal(filterFor('현관 카메라 확인해줘')('nvr_snapshot'), true);
assert.equal(filterFor('CCTV 좀 보자')('nvr_snapshot'), true);
});
// [2026-08-10] 실제 사고: "태풍 돌핀 지금 어디 있지?"에 일반 채팅에서 news_search와
// weather_map_screenshot(기상청/JMA 태풍 진로 지도) 둘 다 안 열려 있어서 web_search만
// 쓰다가 검색결과를 놓쳤다(실제로는 중국 상륙·100만명 대피 중이었는데 "이미 소멸했을