feat: remote agent backend providers (#134)

This commit is contained in:
tlongwell-block
2026-03-20 20:32:55 -04:00
committed by GitHub
parent cba19f8c15
commit 168c1ca8de
34 changed files with 2006 additions and 213 deletions
+34 -2
View File
@@ -3,6 +3,8 @@ import { invoke as tauriInvoke } from "@tauri-apps/api/core";
import type {
AddChannelMembersInput,
AddChannelMembersResult,
BackendProviderCandidate,
BackendProviderProbeResult,
CanvasResponse,
Channel,
ChannelDetail,
@@ -16,6 +18,7 @@ import type {
MintTokenResponse,
MintManagedAgentTokenInput,
ManagedAgent,
ManagedAgentBackend,
RelayAgent,
PresenceLookup,
PresenceStatus,
@@ -215,6 +218,7 @@ type RawRelayAgent = {
name: string;
agent_type: string;
channels: string[];
channel_ids: string[];
capabilities: string[];
status: RelayAgent["status"];
};
@@ -243,6 +247,8 @@ export type RawManagedAgent = {
last_error: string | null;
log_path: string;
start_on_app_launch: boolean;
backend: ManagedAgentBackend;
backend_agent_id: string | null;
};
type RawCreateManagedAgentResponse = {
@@ -775,6 +781,7 @@ function fromRawRelayAgent(agent: RawRelayAgent): RelayAgent {
name: agent.name,
agentType: agent.agent_type,
channels: agent.channels,
channelIds: agent.channel_ids ?? [],
capabilities: agent.capabilities,
status: agent.status,
};
@@ -805,6 +812,8 @@ export function fromRawManagedAgent(agent: RawManagedAgent): ManagedAgent {
lastError: agent.last_error,
logPath: agent.log_path,
startOnAppLaunch: agent.start_on_app_launch,
backend: agent.backend,
backendAgentId: agent.backend_agent_id,
};
}
@@ -898,6 +907,7 @@ export async function createManagedAgent(input: CreateManagedAgentInput) {
tokenName: input.tokenName,
spawnAfterCreate: input.spawnAfterCreate,
startOnAppLaunch: input.startOnAppLaunch,
backend: input.backend,
},
},
);
@@ -925,8 +935,14 @@ export async function stopManagedAgent(pubkey: string): Promise<ManagedAgent> {
return fromRawManagedAgent(response);
}
export async function deleteManagedAgent(pubkey: string): Promise<void> {
await invokeTauri("delete_managed_agent", { pubkey });
export async function deleteManagedAgent(
pubkey: string,
forceRemoteDelete?: boolean,
): Promise<void> {
await invokeTauri("delete_managed_agent", {
pubkey,
forceRemoteDelete: forceRemoteDelete ?? null,
});
}
export async function mintManagedAgentToken(input: MintManagedAgentTokenInput) {
@@ -1003,3 +1019,19 @@ export async function updateManagedAgent(
});
return fromRawManagedAgent(response);
}
// ── Backend provider discovery ────────────────────────────────────────────────
export async function discoverBackendProviders(): Promise<
BackendProviderCandidate[]
> {
return invokeTauri<BackendProviderCandidate[]>("discover_backend_providers");
}
export async function probeBackendProvider(
binaryPath: string,
): Promise<BackendProviderProbeResult> {
return invokeTauri<BackendProviderProbeResult>("probe_backend_provider", {
binaryPath,
});
}
+22 -1
View File
@@ -267,10 +267,15 @@ export type RelayAgent = {
name: string;
agentType: string;
channels: string[];
channelIds: string[];
capabilities: string[];
status: "online" | "away" | "offline";
};
export type ManagedAgentBackend =
| { type: "local" }
| { type: "provider"; id: string; config: Record<string, unknown> };
export type ManagedAgent = {
pubkey: string;
name: string;
@@ -285,7 +290,7 @@ export type ManagedAgent = {
systemPrompt: string | null;
model: string | null;
hasApiToken: boolean;
status: "running" | "stopped";
status: "running" | "stopped" | "deployed" | "not_deployed";
pid: number | null;
createdAt: string;
updatedAt: string;
@@ -295,6 +300,21 @@ export type ManagedAgent = {
lastError: string | null;
logPath: string;
startOnAppLaunch: boolean;
backend: ManagedAgentBackend;
backendAgentId: string | null;
};
export type BackendProviderCandidate = {
id: string;
binaryPath: string;
};
export type BackendProviderProbeResult = {
ok: boolean;
name?: string;
version?: string;
description?: string;
config_schema?: Record<string, unknown>;
};
export type CreateManagedAgentInput = {
@@ -315,6 +335,7 @@ export type CreateManagedAgentInput = {
tokenName?: string;
spawnAfterCreate?: boolean;
startOnAppLaunch?: boolean;
backend?: ManagedAgentBackend;
};
export type CreateManagedAgentResponse = {