commands to acp+ migration: extensions management (#8733)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { getClient } from "@/shared/api/acpConnection";
|
||||
import type { ExtensionConfig, ExtensionEntry } from "../types";
|
||||
|
||||
export function nameToKey(name: string): string {
|
||||
@@ -9,7 +9,9 @@ export function nameToKey(name: string): string {
|
||||
}
|
||||
|
||||
export async function listExtensions(): Promise<ExtensionEntry[]> {
|
||||
return invoke("list_extensions");
|
||||
const client = await getClient();
|
||||
const response = await client.goose.GooseConfigExtensions({});
|
||||
return response.extensions as ExtensionEntry[];
|
||||
}
|
||||
|
||||
export async function addExtension(
|
||||
@@ -17,7 +19,8 @@ export async function addExtension(
|
||||
extensionConfig: ExtensionConfig,
|
||||
enabled: boolean,
|
||||
): Promise<void> {
|
||||
return invoke("add_extension", {
|
||||
const client = await getClient();
|
||||
await client.goose.GooseConfigExtensionsAdd({
|
||||
name,
|
||||
extensionConfig,
|
||||
enabled,
|
||||
@@ -25,12 +28,14 @@ export async function addExtension(
|
||||
}
|
||||
|
||||
export async function removeExtension(configKey: string): Promise<void> {
|
||||
return invoke("remove_extension", { configKey });
|
||||
const client = await getClient();
|
||||
await client.goose.GooseConfigExtensionsRemove({ configKey });
|
||||
}
|
||||
|
||||
export async function toggleExtension(
|
||||
configKey: string,
|
||||
enabled: boolean,
|
||||
): Promise<void> {
|
||||
return invoke("toggle_extension", { configKey, enabled });
|
||||
const client = await getClient();
|
||||
await client.goose.GooseConfigExtensionsToggle({ configKey, enabled });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user