mirror of
https://github.com/block/buzz.git
synced 2026-11-14 13:21:02 +00:00
Show all ACP runtimes with install status and one-click install (#724)
This commit is contained in:
@@ -39,8 +39,10 @@ import type {
|
||||
CreateManagedAgentInput,
|
||||
AgentModelsResponse,
|
||||
UpdateManagedAgentInput,
|
||||
AcpProvider,
|
||||
AcpAvailabilityStatus,
|
||||
AcpProviderCatalogEntry,
|
||||
CommandAvailability,
|
||||
InstallRuntimeResult,
|
||||
OpenDmInput,
|
||||
} from "@/shared/api/types";
|
||||
|
||||
@@ -245,13 +247,33 @@ type RawManagedAgentLog = {
|
||||
log_path: string;
|
||||
};
|
||||
|
||||
type RawAcpProvider = {
|
||||
export type RawAcpProviderCatalogEntry = {
|
||||
id: string;
|
||||
label: string;
|
||||
command: string;
|
||||
binary_path: string;
|
||||
avatar_url: string;
|
||||
availability: AcpAvailabilityStatus;
|
||||
command: string | null;
|
||||
binary_path: string | null;
|
||||
default_args: string[];
|
||||
mcp_command: string | null;
|
||||
install_hint: string;
|
||||
install_instructions_url: string;
|
||||
can_auto_install: boolean;
|
||||
underlying_cli_path: string | null;
|
||||
};
|
||||
|
||||
export type RawInstallStepResult = {
|
||||
step: string;
|
||||
command: string;
|
||||
success: boolean;
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
exit_code: number | null;
|
||||
};
|
||||
|
||||
export type RawInstallRuntimeResult = {
|
||||
success: boolean;
|
||||
steps: RawInstallStepResult[];
|
||||
};
|
||||
|
||||
type RawCommandAvailability = {
|
||||
@@ -850,14 +872,38 @@ export function fromRawManagedAgent(agent: RawManagedAgent): ManagedAgent {
|
||||
};
|
||||
}
|
||||
|
||||
function fromRawAcpProvider(provider: RawAcpProvider): AcpProvider {
|
||||
function fromRawAcpProviderCatalogEntry(
|
||||
entry: RawAcpProviderCatalogEntry,
|
||||
): AcpProviderCatalogEntry {
|
||||
return {
|
||||
id: provider.id,
|
||||
label: provider.label,
|
||||
command: provider.command,
|
||||
binaryPath: provider.binary_path,
|
||||
defaultArgs: provider.default_args,
|
||||
mcpCommand: provider.mcp_command,
|
||||
id: entry.id,
|
||||
label: entry.label,
|
||||
avatarUrl: entry.avatar_url,
|
||||
availability: entry.availability,
|
||||
command: entry.command,
|
||||
binaryPath: entry.binary_path,
|
||||
defaultArgs: entry.default_args,
|
||||
mcpCommand: entry.mcp_command,
|
||||
installHint: entry.install_hint,
|
||||
installInstructionsUrl: entry.install_instructions_url,
|
||||
canAutoInstall: entry.can_auto_install,
|
||||
underlyingCliPath: entry.underlying_cli_path,
|
||||
};
|
||||
}
|
||||
|
||||
function fromRawInstallRuntimeResult(
|
||||
raw: RawInstallRuntimeResult,
|
||||
): InstallRuntimeResult {
|
||||
return {
|
||||
success: raw.success,
|
||||
steps: raw.steps.map((step) => ({
|
||||
step: step.step,
|
||||
command: step.command,
|
||||
success: step.success,
|
||||
stdout: step.stdout,
|
||||
stderr: step.stderr,
|
||||
exitCode: step.exit_code,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1013,10 +1059,22 @@ export async function getManagedAgentLog(pubkey: string, lineCount?: number) {
|
||||
};
|
||||
}
|
||||
|
||||
export async function discoverAcpProviders(): Promise<AcpProvider[]> {
|
||||
return (await invokeTauri<RawAcpProvider[]>("discover_acp_providers")).map(
|
||||
fromRawAcpProvider,
|
||||
export async function discoverAcpProviders(): Promise<
|
||||
AcpProviderCatalogEntry[]
|
||||
> {
|
||||
return (
|
||||
await invokeTauri<RawAcpProviderCatalogEntry[]>("discover_acp_providers")
|
||||
).map(fromRawAcpProviderCatalogEntry);
|
||||
}
|
||||
|
||||
export async function installAcpRuntime(
|
||||
providerId: string,
|
||||
): Promise<InstallRuntimeResult> {
|
||||
const raw = await invokeTauri<RawInstallRuntimeResult>(
|
||||
"install_acp_runtime",
|
||||
{ providerId },
|
||||
);
|
||||
return fromRawInstallRuntimeResult(raw);
|
||||
}
|
||||
|
||||
export async function discoverManagedAgentPrereqs(input: {
|
||||
|
||||
@@ -366,14 +366,46 @@ export type CancelManagedAgentTurnResult = {
|
||||
status: "sent" | "no_active_turn";
|
||||
};
|
||||
|
||||
export type AcpProvider = {
|
||||
export type AcpAvailabilityStatus =
|
||||
| "available"
|
||||
| "adapter_missing"
|
||||
| "cli_missing"
|
||||
| "not_installed";
|
||||
|
||||
export type AcpProviderCatalogEntry = {
|
||||
id: string;
|
||||
label: string;
|
||||
avatarUrl: string;
|
||||
availability: AcpAvailabilityStatus;
|
||||
command: string | null;
|
||||
binaryPath: string | null;
|
||||
defaultArgs: string[];
|
||||
mcpCommand: string | null;
|
||||
installHint: string;
|
||||
installInstructionsUrl: string;
|
||||
canAutoInstall: boolean;
|
||||
underlyingCliPath: string | null;
|
||||
};
|
||||
|
||||
/** An AcpProviderCatalogEntry that is confirmed available — command and binaryPath are non-null. */
|
||||
export type AcpProvider = AcpProviderCatalogEntry & {
|
||||
availability: "available";
|
||||
command: string;
|
||||
binaryPath: string;
|
||||
defaultArgs: string[];
|
||||
/** MCP server binary override, or `null` for the default (`sprout-mcp-server`). */
|
||||
mcpCommand: string | null;
|
||||
};
|
||||
|
||||
export type InstallStepResult = {
|
||||
step: string;
|
||||
command: string;
|
||||
success: boolean;
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
exitCode: number | null;
|
||||
};
|
||||
|
||||
export type InstallRuntimeResult = {
|
||||
success: boolean;
|
||||
steps: InstallStepResult[];
|
||||
};
|
||||
|
||||
export type CommandAvailability = {
|
||||
|
||||
Reference in New Issue
Block a user