continue-custom/core/indexing/docs/crawlers/DefaultCrawler.ts
Patrick Erichsen b60273502e refactor: remove Hub/Mission Control connection code (CON-5885)
Remove all ControlPlaneClient infrastructure, WorkOS auth, managed proxy,
platform profile loading, org policy enforcement, and credits UI.
Config is now fully local — only file-based config.yaml and .env secrets.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 12:55:19 -07:00

34 lines
1,017 B
TypeScript

import { URL } from "node:url";
import { getHeaders } from "../../../continueServer/stubs/headers";
const TRIAL_PROXY_URL = "https://proxy-server-blue-l6vsfbzhba-uw.a.run.app";
import { PageData } from "./DocsCrawler";
export class DefaultCrawler {
constructor(
private readonly startUrl: URL,
private readonly maxRequestsPerCrawl: number,
private readonly maxDepth: number,
) {}
async crawl(): Promise<PageData[]> {
const resp = await fetch(new URL("crawl", TRIAL_PROXY_URL).toString(), {
method: "POST",
headers: {
"Content-Type": "application/json",
...(await getHeaders()),
},
body: JSON.stringify({
startUrl: this.startUrl.toString(),
maxDepth: this.maxDepth,
limit: this.maxRequestsPerCrawl,
}),
});
if (!resp.ok) {
const text = await resp.text();
throw new Error(`Failed to crawl site (${resp.status}): ${text}`);
}
const json = (await resp.json()) as PageData[];
return json;
}
}