continue-custom/core/context/providers/WebContextProvider.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

57 lines
1.4 KiB
TypeScript

import { BaseContextProvider } from "..";
import {
ContextItem,
ContextProviderDescription,
ContextProviderExtras,
FetchFunction,
} from "../..";
import { getHeaders } from "../../continueServer/stubs/headers";
const TRIAL_PROXY_URL = "https://proxy-server-blue-l6vsfbzhba-uw.a.run.app";
export const fetchSearchResults = async (
query: string,
n: number,
fetchFn: FetchFunction,
): Promise<ContextItem[]> => {
const resp = await fetchFn(WebContextProvider.ENDPOINT, {
method: "POST",
headers: {
"Content-Type": "application/json",
...(await getHeaders()),
},
body: JSON.stringify({
query,
n,
}),
});
if (!resp.ok) {
const text = await resp.text();
throw new Error(`Failed to fetch web context: ${text}`);
}
return await resp.json();
};
export default class WebContextProvider extends BaseContextProvider {
public static ENDPOINT = new URL("web", TRIAL_PROXY_URL);
private static DEFAULT_N = 6;
static description: ContextProviderDescription = {
title: "web",
displayTitle: "Web",
description: "Search the web",
type: "normal",
renderInlineAs: "",
};
async getContextItems(
query: string,
extras: ContextProviderExtras,
): Promise<ContextItem[]> {
return await fetchSearchResults(
extras.fullInput,
this.options.n ?? WebContextProvider.DEFAULT_N,
extras.fetch,
);
}
}