Kitsune

Records

kit.crawl and crawlOne return one final record per URL invocation, after any internal browser retries. The CLI persists those results for crawl and batch.

Record_ shape

type Record_ = {
  ts: string
  url: string
  finalUrl?: string
  tier: string
  verdict: string
  reason: string
  ms: number
  attempt?: number
  status?: number
  data?: any
  error?: string
  meta?: Record<string, any>
}
FieldMeaning
tsISO timestamp when the record is constructed.
urlRequested URL.
finalUrlHTTP final URL or accepted browser location when available; some paths use the requested URL.
tierExecution/extraction path, a string rather than a closed union.
verdictClassification; typed as string in Record_, although the classifier uses Verdict below.
reasonHuman-readable classification detail.
msElapsed invocation time including pacing, retries and solver work.
attempt, statusOptional top-level fields supported by the type. The generic crawler writes these inside meta instead.
dataAuto extraction, selector object/rows, JavaScript/JSON result, site-plugin data, or null. HTTP JSON is wrapped as { json: parsedValue }.
errorFinal browser exception message, truncated to 300 characters.
metaFree-form diagnostics and plugin additions.

Verdicts

type Verdict = 'ok' | 'empty' | 'blocked' | 'challenge' | 'tarpit' | 'unknown'
type Detection = { verdict: Verdict; reason: string; matched?: string }
VerdictMeaning in the implementation
okStructured content, a short rendered page, or acceptable substantial HTTP content. Counted as success.
emptyBlank/thin body or recipe emptyPattern; may be a shell that never mounted. The CLI also uses it for a missed ad-hoc selector. Not counted as blocked.
blockedHTTP 401/403/407/429, recognized block text, or recipe/site override.
challengeChallenge-page marker, or a known captcha widget with sitekey and no filled response token.
tarpitReserved verdict accepted as terminal by the ladder; the current generic detect function never emits it. Plugins can return it.
unknownNo classification rule, HTTP 5xx, missing recipe expectation, exceptions or exhausted attempts without a terminal result. Not success.

detect checks status and challenge/strong block markers before accepting hasData. Ambiguous block markers apply to bodies under 4000 characters. Without structured data, visible text under 80 characters is empty unless the caller marks the page rendered. shouldEscalate returns true for blocked, challenge and empty; isTerminal accepts ok and tarpit. The crawl loop also retries unknown results.

Tiers

TierProduced by
httpAccepted plain HTTP HTML or JSON.
browserAccepted auto extraction, exhausted nonterminal attempts or a final exception.
browser:autoEmpty final attempt with auto extraction.
browser:selectorsSelector extraction.
browser:jsRecipe JavaScript expression.
browser:jsonParsed browser body JSON.
browser:auto-fallbackEmpty selectors degraded to automatic extraction.
plugin:<name>Default tier for a site plugin that does not supply one.
uiThe shipped REPUVE site plugin.
Any site/plugin-supplied stringPluginSite permits an arbitrary tier; record hooks can replace records.

There is no separate interaction tier emitted by the generic crawler: recipe fill/submit still uses a browser tier. The final nonterminal return uses browser, even if extraction used another mode.

Metadata

KeyGeneric crawler value
statusHTTP response status, on accepted HTTP records.
attemptBrowser attempt number on accepted, final empty or exception records. Not present on every exhausted-attempt result.
matchedClassifier marker when supplied by Detection.
pluginSite plugin name on a takeover result.
solvedSolver result's via, or solver, on accepted browser records after a returned solver result.

The current crawler sets solved and re-extracts for any returned SolveResult, even skipped/failed. Read the verdict and reason as well; meta.solved alone does not verify a successful solve. No solver cost, token or duration is copied into generic record metadata. Plugins may add arbitrary fields through record hooks; successful HTTP returns bypass those hooks.

JSONL output and Store

The CLI creates a new file under the process working directory: kitsune-results/crawl-<stamp>-<uuid>.jsonl or kitsune-results/batch-<stamp>-<uuid>.jsonl. Stamp is an ISO timestamp with colons and periods replaced by hyphens. Root bun run kitsune delegates with --cwd packages/kitsune, so its output is under packages/kitsune/kitsune-results. Direct bun packages/kitsune/src/cli.ts ... from the root writes under the root.

Each final URL result is appended as one JSON line and flushed immediately. Internal retries do not each produce a line. Each run opens a unique file; kit.crawl alone does not write JSONL. probe, sites, plugins and doctor print diagnostics; init writes a recipe instead.

import { Store, type Record_ } from 'kitsune'

async function save(record: Record_) {
  const store = await Store.open('kitsune-results', 'custom')
  try {
    await store.write(record)
  } finally {
    await store.close()
  }
  console.log(await store.summary())
}
SignatureBehavior
Store.open(dir: string, label?: string): Promise<Store>Default label run; creates an empty unique JSONL file, then opens a writer.
write(r: Record_): Promise<void>Appends and flushes one JSON line.
close(): Promise<void>Ends the writer.
summary()Async recomputation from readonly file: string, with the shape below.
// Return type of summary():
type SummaryResult = Promise<{
  total: number
  byVerdict: Record<string, number>
  byTier: Record<string, number>
  byHost: Record<string, { ok: number; total: number }>
  avgMs: number
  rejectionRate: number
}>

Summary ignores malformed JSON when accumulating values, but total counts all nonempty lines. Rejection rate is (blocked + challenge) / total * 100, rounded to one decimal; average milliseconds is rounded to an integer. Only ok counts in each host's success total.