AOM-derived extraction, grounding, and diff helpers for crater
Dependencies
npx @mizchi/crater-browser https://example.com --arc90// コンテンツ抽出
let result = @arc90.extract_content(tree, config)
// 結果のサマリー
result.to_summary()npx @mizchi/crater-browser https://example.com --grounding// 領域内の要素を検索
let results = @grounding.find_by_spatial(tree, InRegion(TopRight), viewport)
// 特定ロールを領域内で検索
let links = @grounding.find_by_spatial(tree, RoleInRegion(Link, TopRight), viewport)
// 要素からの相対位置で検索
let below = @grounding.find_by_spatial(tree, RelativeTo(Below, "form-id"), viewport)
// クリック座標を取得
let coords = @grounding.get_click_coords(tree, "ref_1")// ツリーの差分を計算
let result = @diff.diff_trees(before, after, config)
// 差分の種類
match diff.kind {
Added => "新規追加"
Removed => "削除"
Moved => "位置移動"
Resized => "サイズ変更"
RoleChanged => "ロール変更"
NameChanged => "名前変更"
StateChanged => "状態変更"
}let config = DiffConfig::{
ignore_position: false, // 位置変更を無視
ignore_size: false, // サイズ変更を無視
size_threshold: 5.0, // サイズ変更の閾値(px)
match_by_role: true, // ロールでマッチング
match_by_name: true, // 名前でマッチング
}fn diff_trees(before : AccessibilityTree, after : AccessibilityTree, config : DiffConfig) -> DiffResultfn find_best(tree : AccessibilityTree, query : SpatialQuery, viewport : Viewport) -> GroundingResult?fn find_by_spatial(tree : AccessibilityTree, query : SpatialQuery, viewport : Viewport) -> Array[GroundingResult]AOM-derived extraction, grounding, and diff helpers for crater
Dependencies