mirror of
https://github.com/block/buzz.git
synced 2026-11-01 23:11:58 +00:00
Guide CLI installation and subscription sign-in (#1980)
Signed-off-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
55
desktop/src/shared/api/tauriAgentAuth.ts
Normal file
55
desktop/src/shared/api/tauriAgentAuth.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
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 },
|
||||
});
|
||||
}
|
||||
@@ -550,6 +550,24 @@ export type InstallRuntimeResult = {
|
||||
failedRestartCount: number;
|
||||
};
|
||||
|
||||
export type AcpAuthMethod = {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
type: string | null;
|
||||
args: string[];
|
||||
command: string[];
|
||||
meta: unknown | null;
|
||||
};
|
||||
|
||||
export type AcpAuthMethodsResult = {
|
||||
methods: AcpAuthMethod[];
|
||||
};
|
||||
|
||||
export type ConnectAcpRuntimeResult = {
|
||||
launched: boolean;
|
||||
};
|
||||
|
||||
export type CommandAvailability = {
|
||||
command: string;
|
||||
resolvedPath: string | null;
|
||||
|
||||
Reference in New Issue
Block a user