The tracker-mapping and common-pattern enrichment agents only had web search, which returns title/url/snippet, so they could never open a cookie-database or cookie-policy page to read which vendor actually sets a tracker. This mis-attributed setters whose snippet is misleading (e.g. _li_* read as LinkedIn rather than LiveIntent). Wire the read-only headless-browser toolset into both agents, gated on a configured Chrome endpoint, mirroring the common-third-party enrichment worker: agent construction moves into the run path so each run can carry a per-run browser that is closed when the run returns. The prompts now direct the agent to open a promising result and read the named setter from the full page text. Both agents stay unchanged when no Chrome endpoint is configured. Signed-off-by: Émile Ré <emile@probo.com>
65 lines
2.6 KiB
Go
65 lines
2.6 KiB
Go
// Copyright (c) 2026 Probo Inc <hello@probo.com>.
|
|
//
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
// copyright notice and this permission notice appear in all copies.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
// PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
package cookiebanner
|
|
|
|
import (
|
|
"time"
|
|
|
|
"go.probo.inc/probo/pkg/llm"
|
|
)
|
|
|
|
// TrackerMappingAgentConfig configures the tracker-mapping agent
|
|
// (catalog identification). It uses DB-backed search tools and may also
|
|
// use Firecrawl for web search when an API key is supplied.
|
|
//
|
|
// MaxTokens and Temperature bound and steer the LLM call (the output is
|
|
// tiny structured JSON). Timeout caps a single agent run and MaxTurns
|
|
// bounds the agent reasoning loop. Zero-valued tuning fields fall back
|
|
// to package defaults. ChromeAddr enables the read-only browser toolset
|
|
// (so the agent can open cookie-database and cookie-policy pages to read
|
|
// the true setter); when empty the agent relies on web search alone.
|
|
type TrackerMappingAgentConfig struct {
|
|
LLMClient *llm.Client
|
|
Model string
|
|
FirecrawlAPIKey string
|
|
ChromeAddr string
|
|
MaxTokens *int
|
|
Temperature *float64
|
|
Timeout time.Duration
|
|
MaxTurns int
|
|
}
|
|
|
|
// TrackerEnrichmentAgentConfig configures the common-pattern enrichment
|
|
// agent (description research). It uses DB-backed search tools and may
|
|
// also use Firecrawl for web search when an API key is supplied.
|
|
//
|
|
// MaxTokens and Temperature bound and steer the LLM call (the output is
|
|
// tiny structured JSON). Timeout caps a single agent run and MaxTurns
|
|
// bounds the agent reasoning loop. Zero-valued tuning fields fall back
|
|
// to package defaults. ChromeAddr enables the read-only browser toolset
|
|
// (so the agent can open authoritative vendor and cookie-database pages
|
|
// to ground a description); when empty the agent relies on web search
|
|
// alone.
|
|
type TrackerEnrichmentAgentConfig struct {
|
|
LLMClient *llm.Client
|
|
Model string
|
|
FirecrawlAPIKey string
|
|
ChromeAddr string
|
|
MaxTokens *int
|
|
Temperature *float64
|
|
Timeout time.Duration
|
|
MaxTurns int
|
|
}
|