Docs

Pilot Integration

@cuitty/scrape/pilot provides a structural adapter for Cuitty Pilot. The boundary is the Scrape client: Pilot delegates browser goals over HTTP or the mock client, instead of importing Scrape engine internals.

Browser Delegate

createScrapeBrowserDelegate(config) wraps createScrapeClient(config) and exposes runGoal(goal, options).

import { createScrapeBrowserDelegate } from "@cuitty/scrape/pilot";

const delegate = createScrapeBrowserDelegate({ mock: true });

const result = await delegate.runGoal({
  url: "https://example.com/dashboard",
  intent: "Click the Save button and verify the dashboard remains visible",
  mode: "interactive",
});

console.log(result.status, result.provenance.steps.length);

Pilot Executor

createScrapePilotExecutor(config) returns a structural executor with id, supports(action), executeStep(step, context), and health().

import { createScrapePilotExecutor } from "@cuitty/scrape/pilot";

const executor = createScrapePilotExecutor({ mock: true });

console.log(executor.id);
console.log(executor.supports("click"));

const stepResult = await executor.executeStep(
  {
    action: "click",
    intent: "Click the primary call-to-action",
    executor_config: { mode: "interactive" },
  },
  { url: "https://example.com" },
);

console.log(stepResult.ok, stepResult.detail);

Delegation Boundary

The adapter uses the Scrape client and structural types. That keeps Pilot and Scrape independently buildable and matches the Cuitty Test precedent: products communicate over a stable product boundary.

Session Handoff

Pilot can pass auth and captureSessionAs through the delegate goal. Scrape then hydrates or captures sessions through the configured credential provider, typically Cuitty Safe.

import { createScrapeBrowserDelegate } from "@cuitty/scrape/pilot";

const delegate = createScrapeBrowserDelegate({ baseUrl: "http://127.0.0.1:4340" });

await delegate.runGoal({
  url: "https://app.example.com",
  intent: "Open settings after sign-in",
  mode: "hybrid",
  auth: { kind: "session", sessionRef: "safe://sessions/app-example" },
  captureSessionAs: "safe://sessions/app-example",
});

Current Scope

The adapter is additive and off by default. Pilot owns registration. Scrape owns the delegate and executor shapes so they can be tested without a Pilot dependency.