Skip to content

Latest commit

 

History

History
173 lines (121 loc) · 5.54 KB

File metadata and controls

173 lines (121 loc) · 5.54 KB

watchdeck

Python Tests License

English

웹 모니터링 파이프라인 — 페이지 변경 추적, 시각적 diff 캡처, 모니터링 안전 가드. QuartzUnit 라이브러리로 구축.

flowchart LR
    A["🔗 diffgrab\n변경 감지"] --> B["📄 markgrab\n콘텐츠 추출"]
    A --> C["📸 snapgrab\n시각적 캡처"]
    B --> D["🛡️ llm-degen-guard\n출력 품질"]
    B --> E["🔄 agent-loop-guard\n루프 감지"]
    B --> F["📋 agent-action-policy\n액션 안전"]
Loading

빠른 시작

pip install watchdeck

# 모니터링할 URL 추가
watchdeck add https://example.com
watchdeck add https://news.ycombinator.com --interval 12

# 변경사항 확인
watchdeck check

# 이력 조회
watchdeck history https://example.com

# 스냅샷 간 diff
watchdeck diff https://example.com

동작 과정

  1. 감지diffgrab으로 페이지 변경 추적 (콘텐츠 해싱 + 구조화된 diff)
  2. 추출markgrab으로 전체 콘텐츠 추출하여 품질 검증
  3. 스크린샷snapgrab으로 변경 시 시각적 스냅샷 캡처 (선택)
  4. 가드 — 세 가지 안전 레이어:

클라우드 서비스 없음, API 키 없음. 모든 것이 로컬에서 실행됩니다.

설치

pip install watchdeck

요구사항: Python 3.11+, Playwright (스크린샷용: playwright install chromium)

CLI 레퍼런스

watchdeck add <URL>

모니터링할 URL을 추가합니다. 차단 대상 URL(localhost, 사설 IP, file://)은 자동 거부됩니다.

watchdeck add https://example.com                  # 기본: 24시간마다 확인
watchdeck add https://news.ycombinator.com -i 12   # 12시간마다 확인

watchdeck check

모니터링 중인 URL의 변경사항을 확인합니다.

watchdeck check                              # 전체 확인
watchdeck check -u https://example.com       # 특정 URL
watchdeck check --screenshots                # 변경 시 스크린샷 캡처

watchdeck remove <URL>

URL 모니터링을 중지합니다.

watchdeck history <URL>

스냅샷 이력을 표시합니다.

watchdeck diff <URL>

스냅샷 간 diff를 표시합니다.

Python API

import asyncio
from watchdeck import WatchDeck

async def main():
    deck = WatchDeck()

    # URL 추가 (안전 정책 자동 적용)
    await deck.add("https://example.com", interval_hours=12)
    await deck.add("http://localhost:8080")  # → 정책에 의해 차단

    # 변경사항 확인
    report = await deck.check()
    for result in report.results:
        if result.changed:
            print(f"{result.url}: {result.summary}")
        if result.stale_warning:
            print(f"  ⚠ {result.stale_warning}")
        if result.content_warning:
            print(f"  ⚠ {result.content_warning}")

    await deck.close()

asyncio.run(main())

안전 가드

URL 정책 (agent-action-policy)

자동 차단 대상:

  • localhost, 127.0.0.1
  • 사설 네트워크 (192.168.*, 10.*, 172.16-31.*)
  • file:// URL

루프 감지 (agent-loop-guard)

URL이 N회 연속 변경되지 않으면 빈도 감소를 제안:

⚠ URL unchanged for 5 consecutive checks — consider reducing frequency

콘텐츠 품질 (llm-degen-guard)

쓰레기 콘텐츠(CAPTCHA, 봇 탐지, 반복 텍스트) 반환 시 플래그:

⚠ Content appears degenerate (score=0.78) — possible CAPTCHA or anti-bot page

동작 원리

flowchart TD
    A["watchdeck add URL"] --> B["초기 스냅샷\n(diffgrab + markgrab + snapgrab)"]
    B --> C["watchdeck check"]
    C --> D{"콘텐츠\n변경?"}
    D -->|"예"| E["diff 계산\n+ 스크린샷\n+ 가드 검사"]
    D -->|"아니오"| F["정체 임계값 확인"]
    E --> G["📊 리포트"]
    F --> G
Loading

사용된 QuartzUnit 라이브러리

라이브러리 watchdeck에서의 역할 PyPI
diffgrab 페이지 변경 감지 + 구조화된 diff pip install diffgrab
markgrab 콘텐츠 추출 (품질 검증용) pip install markgrab
snapgrab 변경 시 시각적 스크린샷 캡처 pip install snapgrab
agent-action-policy URL 안전 정책 (내부 IP 차단) pip install agent-action-policy
agent-loop-guard 정체 모니터링 감지 pip install agent-loop-guard
llm-degen-guard 쓰레기 콘텐츠 감지 pip install llm-degen-guard

참조: newswatch — 뉴스 모니터링 파이프라인 (feedkit + markgrab + embgrep + diffgrab)

라이선스

MIT