mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Signed-off-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co>
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
import type {
|
|
AcpAuthMethod,
|
|
AcpAuthMethodsResult,
|
|
ConnectAcpRuntimeResult,
|
|
} from "@/shared/api/types";
|
|
import { invokeTauri } from "@/shared/api/tauri";
|
|
|
|
type RawAcpAuthMethod = {
|
|
id: string;
|
|
name: string;
|
|
description?: string | null;
|
|
type?: string | null;
|
|
args?: string[];
|
|
command?: string[];
|
|
_meta?: unknown;
|
|
};
|
|
|
|
export type RawAcpAuthMethodsResult = {
|
|
methods: RawAcpAuthMethod[];
|
|
};
|
|
|
|
export type RawConnectAcpRuntimeResult = {
|
|
launched: boolean;
|
|
};
|
|
|
|
function fromRawAcpAuthMethod(method: RawAcpAuthMethod): AcpAuthMethod {
|
|
return {
|
|
id: method.id,
|
|
name: method.name,
|
|
description: method.description ?? null,
|
|
type: method.type ?? null,
|
|
args: method.args ?? [],
|
|
command: method.command ?? [],
|
|
meta: method._meta ?? null,
|
|
};
|
|
}
|
|
|
|
export async function discoverAcpAuthMethods(
|
|
runtimeId: string,
|
|
): Promise<AcpAuthMethodsResult> {
|
|
const raw = await invokeTauri<RawAcpAuthMethodsResult>(
|
|
"discover_acp_auth_methods",
|
|
{ runtimeId },
|
|
);
|
|
return { methods: raw.methods.map(fromRawAcpAuthMethod) };
|
|
}
|
|
|
|
export async function connectAcpRuntime(
|
|
runtimeId: string,
|
|
methodId: string,
|
|
): Promise<ConnectAcpRuntimeResult> {
|
|
return invokeTauri<RawConnectAcpRuntimeResult>("connect_acp_runtime", {
|
|
request: { runtimeId, methodId },
|
|
});
|
|
}
|