Corfedo.Client
0.0.2
Prefix Reserved
dotnet add package Corfedo.Client --version 0.0.2
NuGet\Install-Package Corfedo.Client -Version 0.0.2
<PackageReference Include="Corfedo.Client" Version="0.0.2" />
<PackageVersion Include="Corfedo.Client" Version="0.0.2" />
<PackageReference Include="Corfedo.Client" />
paket add Corfedo.Client --version 0.0.2
#r "nuget: Corfedo.Client, 0.0.2"
#:package Corfedo.Client@0.0.2
#addin nuget:?package=Corfedo.Client&version=0.0.2
#tool nuget:?package=Corfedo.Client&version=0.0.2
Corfedo.Client
Search and read code across every repository your Corfedo workspace indexes, and ask Corfedo AI, from .NET.
Corfedo is a self-hosted code search and AI service. It indexes the repositories you choose
across your code hosts and answers searches and questions across them, for people and coding agents.
Corfedo.Client is the typed, framework-neutral client for its public HTTP API: code search, file, tree and symbol
reads, saved contexts, dependency and security reads, Corfedo AI runs, and API-key or browser sign-in.
It is NativeAOT-compatible and has no framework dependencies.
To give your own model Corfedo's tools, or to use Corfedo AI as an IChatClient, add
Corfedo.Extensions.AI.
Install
dotnet add package Corfedo.Client
The package targets .NET 10.
Quick start
Create an API key in your Corfedo workspace and download its key file. The key file holds the API address and the key's connection binding (API keys).
using Corfedo.Client;
using Corfedo.Client.Models;
using var corfedo = await CorfedoClient.FromApiKeyFileAsync("/run/secrets/corfedo.key.json");
var page = await corfedo.Search.SearchAsync(new SearchCode { Query = "where are search requests parsed" });
foreach (var hit in page.Results.OfType<CodeFileSearchResult>())
Console.WriteLine($"{hit.Repository} {hit.Path} @{hit.Revision}");
Bare words find the most relevant files, text in double quotes matches exactly, /…/ is a regular expression, and
filters such as repo:, file: and lang: narrow the search. The
sample application adds coverage
and continuation handling.
Sign in as a person
Local tools can sign a person in through the browser instead of using an API key:
using Corfedo.Client;
using Corfedo.Client.Authentication;
var credentials = await CorfedoAuthentication.SignInAsync(new()
{
ApiBaseUri = new Uri("https://corfedo.example.com/")
});
using var proofKey = credentials.ProofKey; // the session's proof key; the caller owns it
using var corfedo = new CorfedoClient(credentials);
Ask Corfedo AI
With the Ask Corfedo AI permission, corfedo.Ai sends a message to Corfedo AI and streams its run. Corfedo keeps
the conversation and answers with links to the lines it used. Sending a message needs the scopes
corfedo:ai:invoke and corfedo:repositories:code:read. Browser sign-in requests corfedo:ai:invoke only when
HumanAuthenticationOptions.Scopes lists it, and a custom scope list keeps offline_access.
The example continues either setup above and needs using Corfedo.Client.Models; at the top of the file, which the
API-key quick start already has.
var run = corfedo.Ai.Stream(new() { Text = "How does shard selection work?" });
await foreach (var item in run)
if (item is AiTextDeltaEvent delta) Console.Write(delta.Text); // provisional text
Console.WriteLine(run.Answer?.GetString()); // the final Markdown answer
Your own functions can join a run as client-owned tools.
Documentation
- .NET SDK guide on docs.corfedo.ai
- Client behavior: connection, sign-in, renewal, addressing, pages, wire format and AI runs
- API keys and authentication discovery
- Source and samples on GitHub, where issues are welcome
Related packages
- Corfedo.Extensions.AI: Corfedo's read tools as
AIFunctions and Corfedo AI as anIChatClient, for Microsoft.Extensions.AI, Semantic Kernel and Microsoft Agent Framework - corfedo on PyPI and @corfedo/client on npm: the Python and TypeScript clients
License
Apache-2.0, see LICENSE and
NOTICE. The bundled API contract has its own notice
in contracts/NOTICE. Corfedo names, logos and brand assets are reserved and not covered by these licenses.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- OpenIddict.Client.SystemIntegration (>= 7.7.2)
- OpenIddict.Client.SystemNetHttp (>= 7.7.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Corfedo.Client:
| Package | Downloads |
|---|---|
|
Corfedo.Extensions.AI
Corfedo search and read functions for Microsoft.Extensions.AI. |
GitHub repositories
This package is not used by any popular GitHub repositories.