Initial commit
This commit is contained in:
852
src/lib/tauri.ts
Normal file
852
src/lib/tauri.ts
Normal file
@@ -0,0 +1,852 @@
|
||||
import { invoke } from "@tauri-apps/api/core"
|
||||
import type {
|
||||
AgentType,
|
||||
ConversationSummary,
|
||||
ConversationDetail,
|
||||
DbConversationDetail,
|
||||
FolderInfo,
|
||||
AgentStats,
|
||||
SidebarData,
|
||||
ConnectionInfo,
|
||||
AcpAgentInfo,
|
||||
AgentSkillScope,
|
||||
AgentSkillLayout,
|
||||
AgentSkillItem,
|
||||
AgentSkillsListResult,
|
||||
AgentSkillContent,
|
||||
FolderHistoryEntry,
|
||||
FolderDetail,
|
||||
DbConversationSummary,
|
||||
ImportResult,
|
||||
OpenedConversation,
|
||||
GitStatusEntry,
|
||||
GitBranchList,
|
||||
GitPullResult,
|
||||
GitPushResult,
|
||||
GitMergeResult,
|
||||
GitCommitResult,
|
||||
PreflightResult,
|
||||
FolderCommand,
|
||||
TerminalInfo,
|
||||
PromptInputBlock,
|
||||
FileTreeNode,
|
||||
FilePreviewContent,
|
||||
FileEditContent,
|
||||
FileSaveResult,
|
||||
GitLogEntry,
|
||||
SystemProxySettings,
|
||||
McpAppType,
|
||||
LocalMcpServer,
|
||||
McpMarketplaceProvider,
|
||||
McpMarketplaceItem,
|
||||
McpMarketplaceServerDetail,
|
||||
} from "./types"
|
||||
|
||||
export async function listConversations(params?: {
|
||||
agent_type?: AgentType | null
|
||||
search?: string | null
|
||||
sort_by?: string | null
|
||||
folder_path?: string | null
|
||||
}): Promise<ConversationSummary[]> {
|
||||
return invoke("list_conversations", {
|
||||
agentType: params?.agent_type ?? null,
|
||||
search: params?.search ?? null,
|
||||
sortBy: params?.sort_by ?? null,
|
||||
folderPath: params?.folder_path ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function getConversation(
|
||||
agentType: AgentType,
|
||||
conversationId: string
|
||||
): Promise<ConversationDetail> {
|
||||
return invoke("get_conversation", { agentType, conversationId })
|
||||
}
|
||||
|
||||
export async function listFolders(): Promise<FolderInfo[]> {
|
||||
return invoke("list_folders")
|
||||
}
|
||||
|
||||
export async function getStats(): Promise<AgentStats> {
|
||||
return invoke("get_stats")
|
||||
}
|
||||
|
||||
export async function getSidebarData(): Promise<SidebarData> {
|
||||
return invoke("get_sidebar_data")
|
||||
}
|
||||
|
||||
// ACP commands
|
||||
|
||||
export async function acpConnect(
|
||||
agentType: AgentType,
|
||||
workingDir?: string,
|
||||
sessionId?: string
|
||||
): Promise<string> {
|
||||
return invoke("acp_connect", {
|
||||
agentType,
|
||||
workingDir: workingDir ?? null,
|
||||
sessionId: sessionId ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function acpPrompt(
|
||||
connectionId: string,
|
||||
blocks: PromptInputBlock[]
|
||||
): Promise<void> {
|
||||
return invoke("acp_prompt", { connectionId, blocks })
|
||||
}
|
||||
|
||||
export async function acpSetMode(
|
||||
connectionId: string,
|
||||
modeId: string
|
||||
): Promise<void> {
|
||||
return invoke("acp_set_mode", { connectionId, modeId })
|
||||
}
|
||||
|
||||
export async function acpSetConfigOption(
|
||||
connectionId: string,
|
||||
configId: string,
|
||||
valueId: string
|
||||
): Promise<void> {
|
||||
return invoke("acp_set_config_option", { connectionId, configId, valueId })
|
||||
}
|
||||
|
||||
export async function acpCancel(connectionId: string): Promise<void> {
|
||||
return invoke("acp_cancel", { connectionId })
|
||||
}
|
||||
|
||||
export async function acpRespondPermission(
|
||||
connectionId: string,
|
||||
requestId: string,
|
||||
optionId: string
|
||||
): Promise<void> {
|
||||
return invoke("acp_respond_permission", {
|
||||
connectionId,
|
||||
requestId,
|
||||
optionId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function acpDisconnect(connectionId: string): Promise<void> {
|
||||
return invoke("acp_disconnect", { connectionId })
|
||||
}
|
||||
|
||||
export async function acpListConnections(): Promise<ConnectionInfo[]> {
|
||||
return invoke("acp_list_connections")
|
||||
}
|
||||
|
||||
export async function acpListAgents(): Promise<AcpAgentInfo[]> {
|
||||
return invoke("acp_list_agents")
|
||||
}
|
||||
|
||||
export async function acpClearBinaryCache(agentType: AgentType): Promise<void> {
|
||||
return invoke("acp_clear_binary_cache", { agentType })
|
||||
}
|
||||
|
||||
export async function acpDownloadAgentBinary(
|
||||
agentType: AgentType
|
||||
): Promise<void> {
|
||||
return invoke("acp_download_agent_binary", { agentType })
|
||||
}
|
||||
|
||||
export async function acpDetectAgentLocalVersion(
|
||||
agentType: AgentType
|
||||
): Promise<string | null> {
|
||||
return invoke("acp_detect_agent_local_version", { agentType })
|
||||
}
|
||||
|
||||
export async function acpPrepareNpxAgent(
|
||||
agentType: AgentType,
|
||||
registryVersion?: string | null
|
||||
): Promise<string> {
|
||||
return invoke("acp_prepare_npx_agent", {
|
||||
agentType,
|
||||
registryVersion: registryVersion ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function acpPrepareUvxAgent(
|
||||
agentType: AgentType,
|
||||
registryVersion?: string | null
|
||||
): Promise<string> {
|
||||
return invoke("acp_prepare_uvx_agent", {
|
||||
agentType,
|
||||
registryVersion: registryVersion ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function acpUninstallAgent(agentType: AgentType): Promise<void> {
|
||||
return invoke("acp_uninstall_agent", { agentType })
|
||||
}
|
||||
|
||||
export async function acpUpdateAgentPreferences(
|
||||
agentType: AgentType,
|
||||
params: {
|
||||
enabled: boolean
|
||||
env: Record<string, string>
|
||||
config_json?: string | null
|
||||
opencode_auth_json?: string | null
|
||||
codex_auth_json?: string | null
|
||||
codex_config_toml?: string | null
|
||||
}
|
||||
): Promise<void> {
|
||||
return invoke("acp_update_agent_preferences", {
|
||||
agentType,
|
||||
enabled: params.enabled,
|
||||
env: params.env,
|
||||
configJson: params.config_json ?? null,
|
||||
opencodeAuthJson: params.opencode_auth_json ?? null,
|
||||
codexAuthJson: params.codex_auth_json ?? null,
|
||||
codexConfigToml: params.codex_config_toml ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function acpReorderAgents(agentTypes: AgentType[]): Promise<void> {
|
||||
return invoke("acp_reorder_agents", { agentTypes })
|
||||
}
|
||||
|
||||
export async function acpPreflight(
|
||||
agentType: AgentType
|
||||
): Promise<PreflightResult> {
|
||||
return invoke("acp_preflight", { agentType })
|
||||
}
|
||||
|
||||
export async function acpListAgentSkills(params: {
|
||||
agentType: AgentType
|
||||
workspacePath?: string | null
|
||||
}): Promise<AgentSkillsListResult> {
|
||||
return invoke("acp_list_agent_skills", {
|
||||
agentType: params.agentType,
|
||||
workspacePath: params.workspacePath ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function acpReadAgentSkill(params: {
|
||||
agentType: AgentType
|
||||
scope: AgentSkillScope
|
||||
skillId: string
|
||||
workspacePath?: string | null
|
||||
}): Promise<AgentSkillContent> {
|
||||
return invoke("acp_read_agent_skill", {
|
||||
agentType: params.agentType,
|
||||
scope: params.scope,
|
||||
skillId: params.skillId,
|
||||
workspacePath: params.workspacePath ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function acpSaveAgentSkill(params: {
|
||||
agentType: AgentType
|
||||
scope: AgentSkillScope
|
||||
skillId: string
|
||||
content: string
|
||||
workspacePath?: string | null
|
||||
layout?: AgentSkillLayout | null
|
||||
}): Promise<AgentSkillItem> {
|
||||
return invoke("acp_save_agent_skill", {
|
||||
agentType: params.agentType,
|
||||
scope: params.scope,
|
||||
skillId: params.skillId,
|
||||
content: params.content,
|
||||
workspacePath: params.workspacePath ?? null,
|
||||
layout: params.layout ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function acpDeleteAgentSkill(params: {
|
||||
agentType: AgentType
|
||||
scope: AgentSkillScope
|
||||
skillId: string
|
||||
workspacePath?: string | null
|
||||
}): Promise<void> {
|
||||
return invoke("acp_delete_agent_skill", {
|
||||
agentType: params.agentType,
|
||||
scope: params.scope,
|
||||
skillId: params.skillId,
|
||||
workspacePath: params.workspacePath ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function getSystemProxySettings(): Promise<SystemProxySettings> {
|
||||
return invoke("get_system_proxy_settings")
|
||||
}
|
||||
|
||||
export async function updateSystemProxySettings(
|
||||
settings: SystemProxySettings
|
||||
): Promise<SystemProxySettings> {
|
||||
return invoke("update_system_proxy_settings", { settings })
|
||||
}
|
||||
|
||||
export async function mcpScanLocal(): Promise<LocalMcpServer[]> {
|
||||
return invoke("mcp_scan_local")
|
||||
}
|
||||
|
||||
export async function mcpListMarketplaces(): Promise<McpMarketplaceProvider[]> {
|
||||
return invoke("mcp_list_marketplaces")
|
||||
}
|
||||
|
||||
export async function mcpSearchMarketplace(params: {
|
||||
providerId: string
|
||||
query?: string | null
|
||||
limit?: number | null
|
||||
}): Promise<McpMarketplaceItem[]> {
|
||||
return invoke("mcp_search_marketplace", {
|
||||
providerId: params.providerId,
|
||||
query: params.query ?? null,
|
||||
limit: params.limit ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function mcpGetMarketplaceServerDetail(params: {
|
||||
providerId: string
|
||||
serverId: string
|
||||
}): Promise<McpMarketplaceServerDetail> {
|
||||
return invoke("mcp_get_marketplace_server_detail", {
|
||||
providerId: params.providerId,
|
||||
serverId: params.serverId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function mcpInstallFromMarketplace(params: {
|
||||
providerId: string
|
||||
serverId: string
|
||||
apps: McpAppType[]
|
||||
specOverride?: Record<string, unknown> | null
|
||||
optionId?: string | null
|
||||
protocol?: string | null
|
||||
parameterValues?: Record<string, unknown> | null
|
||||
}): Promise<LocalMcpServer> {
|
||||
return invoke("mcp_install_from_marketplace", {
|
||||
providerId: params.providerId,
|
||||
serverId: params.serverId,
|
||||
apps: params.apps,
|
||||
specOverride: params.specOverride ?? null,
|
||||
optionId: params.optionId ?? null,
|
||||
protocol: params.protocol ?? null,
|
||||
parameterValues: params.parameterValues ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function mcpUpsertLocalServer(params: {
|
||||
serverId: string
|
||||
spec: Record<string, unknown>
|
||||
apps: McpAppType[]
|
||||
}): Promise<LocalMcpServer> {
|
||||
return invoke("mcp_upsert_local_server", {
|
||||
serverId: params.serverId,
|
||||
spec: params.spec,
|
||||
apps: params.apps,
|
||||
})
|
||||
}
|
||||
|
||||
export async function mcpSetServerApps(
|
||||
serverId: string,
|
||||
apps: McpAppType[]
|
||||
): Promise<LocalMcpServer | null> {
|
||||
return invoke("mcp_set_server_apps", { serverId, apps })
|
||||
}
|
||||
|
||||
export async function mcpRemoveServer(
|
||||
serverId: string,
|
||||
apps?: McpAppType[] | null
|
||||
): Promise<boolean> {
|
||||
return invoke("mcp_remove_server", {
|
||||
serverId,
|
||||
apps: apps ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
// Folder history commands
|
||||
|
||||
export async function loadFolderHistory(): Promise<FolderHistoryEntry[]> {
|
||||
return invoke("load_folder_history")
|
||||
}
|
||||
|
||||
export async function getFolder(folderId: number): Promise<FolderDetail> {
|
||||
return invoke("get_folder", { folderId })
|
||||
}
|
||||
|
||||
export async function listFolderConversations(params: {
|
||||
folder_id: number
|
||||
agent_type?: AgentType | null
|
||||
search?: string | null
|
||||
sort_by?: string | null
|
||||
status?: string | null
|
||||
}): Promise<DbConversationSummary[]> {
|
||||
return invoke("list_folder_conversations", {
|
||||
folderId: params.folder_id,
|
||||
agentType: params.agent_type ?? null,
|
||||
search: params.search ?? null,
|
||||
sortBy: params.sort_by ?? null,
|
||||
status: params.status ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function importLocalConversations(
|
||||
folderId: number
|
||||
): Promise<ImportResult> {
|
||||
return invoke("import_local_conversations", { folderId })
|
||||
}
|
||||
|
||||
export async function getFolderConversation(
|
||||
conversationId: number
|
||||
): Promise<DbConversationDetail> {
|
||||
return invoke("get_folder_conversation", { conversationId })
|
||||
}
|
||||
|
||||
export async function saveFolderOpenedConversations(
|
||||
folderId: number,
|
||||
items: OpenedConversation[]
|
||||
): Promise<void> {
|
||||
return invoke("save_folder_opened_conversations", { folderId, items })
|
||||
}
|
||||
|
||||
export async function setFolderParentBranch(
|
||||
path: string,
|
||||
parentBranch: string | null
|
||||
): Promise<void> {
|
||||
return invoke("set_folder_parent_branch", {
|
||||
path,
|
||||
parentBranch,
|
||||
})
|
||||
}
|
||||
|
||||
export async function removeFolderFromHistory(path: string): Promise<void> {
|
||||
return invoke("remove_folder_from_history", { path })
|
||||
}
|
||||
|
||||
export async function createFolderDirectory(path: string): Promise<void> {
|
||||
return invoke("create_folder_directory", { path })
|
||||
}
|
||||
|
||||
export async function cloneRepository(
|
||||
url: string,
|
||||
targetDir: string
|
||||
): Promise<void> {
|
||||
return invoke("clone_repository", { url, targetDir })
|
||||
}
|
||||
|
||||
export async function getGitBranch(path: string): Promise<string | null> {
|
||||
return invoke("get_git_branch", { path })
|
||||
}
|
||||
|
||||
export async function gitInit(path: string): Promise<void> {
|
||||
return invoke("git_init", { path })
|
||||
}
|
||||
|
||||
export async function gitPull(path: string): Promise<GitPullResult> {
|
||||
return invoke("git_pull", { path })
|
||||
}
|
||||
|
||||
export async function gitFetch(path: string): Promise<string> {
|
||||
return invoke("git_fetch", { path })
|
||||
}
|
||||
|
||||
export async function gitPush(path: string): Promise<GitPushResult> {
|
||||
return invoke("git_push", { path })
|
||||
}
|
||||
|
||||
export async function gitNewBranch(
|
||||
path: string,
|
||||
branchName: string,
|
||||
startPoint?: string
|
||||
): Promise<void> {
|
||||
return invoke("git_new_branch", {
|
||||
path,
|
||||
branchName,
|
||||
startPoint: startPoint ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function gitWorktreeAdd(
|
||||
path: string,
|
||||
branchName: string,
|
||||
worktreePath: string
|
||||
): Promise<void> {
|
||||
return invoke("git_worktree_add", { path, branchName, worktreePath })
|
||||
}
|
||||
|
||||
export async function gitCheckout(
|
||||
path: string,
|
||||
branchName: string
|
||||
): Promise<void> {
|
||||
return invoke("git_checkout", { path, branchName })
|
||||
}
|
||||
|
||||
export async function gitListBranches(path: string): Promise<string[]> {
|
||||
return invoke("git_list_branches", { path })
|
||||
}
|
||||
|
||||
export async function gitListAllBranches(path: string): Promise<GitBranchList> {
|
||||
return invoke("git_list_all_branches", { path })
|
||||
}
|
||||
|
||||
export async function gitMerge(
|
||||
path: string,
|
||||
branchName: string
|
||||
): Promise<GitMergeResult> {
|
||||
return invoke("git_merge", { path, branchName })
|
||||
}
|
||||
|
||||
export async function gitRebase(
|
||||
path: string,
|
||||
branchName: string
|
||||
): Promise<string> {
|
||||
return invoke("git_rebase", { path, branchName })
|
||||
}
|
||||
|
||||
export async function gitDeleteBranch(
|
||||
path: string,
|
||||
branchName: string,
|
||||
force = false
|
||||
): Promise<string> {
|
||||
return invoke("git_delete_branch", { path, branchName, force })
|
||||
}
|
||||
|
||||
export async function gitStash(path: string): Promise<string> {
|
||||
return invoke("git_stash", { path })
|
||||
}
|
||||
|
||||
export async function gitStashPop(path: string): Promise<string> {
|
||||
return invoke("git_stash_pop", { path })
|
||||
}
|
||||
|
||||
export async function gitStatus(path: string): Promise<GitStatusEntry[]> {
|
||||
return invoke("git_status", { path })
|
||||
}
|
||||
|
||||
export async function gitDiff(path: string, file?: string): Promise<string> {
|
||||
return invoke("git_diff", { path, file: file ?? null })
|
||||
}
|
||||
|
||||
export async function gitDiffWithBranch(
|
||||
path: string,
|
||||
branch: string,
|
||||
file?: string
|
||||
): Promise<string> {
|
||||
return invoke("git_diff_with_branch", {
|
||||
path,
|
||||
branch,
|
||||
file: file ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function gitShowDiff(
|
||||
path: string,
|
||||
commit: string,
|
||||
file?: string
|
||||
): Promise<string> {
|
||||
return invoke("git_show_diff", { path, commit, file: file ?? null })
|
||||
}
|
||||
|
||||
export async function gitShowFile(
|
||||
path: string,
|
||||
file: string,
|
||||
refName?: string
|
||||
): Promise<string> {
|
||||
return invoke("git_show_file", {
|
||||
path,
|
||||
file,
|
||||
refName: refName ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function gitIsTracked(
|
||||
path: string,
|
||||
file: string
|
||||
): Promise<boolean> {
|
||||
return invoke("git_is_tracked", { path, file })
|
||||
}
|
||||
|
||||
export async function gitCommit(
|
||||
path: string,
|
||||
message: string,
|
||||
files: string[]
|
||||
): Promise<GitCommitResult> {
|
||||
return invoke("git_commit", { path, message, files })
|
||||
}
|
||||
|
||||
export async function gitRollbackFile(
|
||||
path: string,
|
||||
file: string
|
||||
): Promise<void> {
|
||||
return invoke("git_rollback_file", { path, file })
|
||||
}
|
||||
|
||||
export async function gitAddFiles(
|
||||
path: string,
|
||||
files: string[]
|
||||
): Promise<void> {
|
||||
return invoke("git_add_files", { path, files })
|
||||
}
|
||||
|
||||
// Window management commands
|
||||
|
||||
export async function openFolderWindow(path: string): Promise<void> {
|
||||
return invoke("open_folder_window", { path })
|
||||
}
|
||||
|
||||
export async function openCommitWindow(folderId: number): Promise<void> {
|
||||
return invoke("open_commit_window", { folderId })
|
||||
}
|
||||
|
||||
export type SettingsSection =
|
||||
| "appearance"
|
||||
| "agents"
|
||||
| "mcp"
|
||||
| "skills"
|
||||
| "shortcuts"
|
||||
| "system"
|
||||
|
||||
interface OpenSettingsWindowOptions {
|
||||
agentType?: AgentType | null
|
||||
}
|
||||
|
||||
export async function openSettingsWindow(
|
||||
section?: SettingsSection,
|
||||
options?: OpenSettingsWindowOptions
|
||||
): Promise<void> {
|
||||
return invoke("open_settings_window", {
|
||||
section: section ?? null,
|
||||
agentType: options?.agentType ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function listOpenFolders(): Promise<FolderHistoryEntry[]> {
|
||||
return invoke("list_open_folders")
|
||||
}
|
||||
|
||||
export async function focusFolderWindow(folderId: number): Promise<void> {
|
||||
return invoke("focus_folder_window", { folderId })
|
||||
}
|
||||
|
||||
// Conversation CRUD commands
|
||||
|
||||
export async function createConversation(
|
||||
folderId: number,
|
||||
agentType: AgentType,
|
||||
title?: string
|
||||
): Promise<number> {
|
||||
return invoke("create_conversation", {
|
||||
folderId,
|
||||
agentType,
|
||||
title: title ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function updateConversationStatus(
|
||||
conversationId: number,
|
||||
status: string
|
||||
): Promise<void> {
|
||||
return invoke("update_conversation_status", { conversationId, status })
|
||||
}
|
||||
|
||||
export async function updateConversationTitle(
|
||||
conversationId: number,
|
||||
title: string
|
||||
): Promise<void> {
|
||||
return invoke("update_conversation_title", { conversationId, title })
|
||||
}
|
||||
|
||||
export async function updateConversationExternalId(
|
||||
conversationId: number,
|
||||
externalId: string
|
||||
): Promise<void> {
|
||||
return invoke("update_conversation_external_id", {
|
||||
conversationId,
|
||||
externalId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function deleteConversation(
|
||||
conversationId: number
|
||||
): Promise<void> {
|
||||
return invoke("delete_conversation", { conversationId })
|
||||
}
|
||||
|
||||
// Folder command management
|
||||
|
||||
export async function listFolderCommands(
|
||||
folderId: number
|
||||
): Promise<FolderCommand[]> {
|
||||
return invoke("list_folder_commands", { folderId })
|
||||
}
|
||||
|
||||
export async function createFolderCommand(
|
||||
folderId: number,
|
||||
name: string,
|
||||
command: string
|
||||
): Promise<FolderCommand> {
|
||||
return invoke("create_folder_command", { folderId, name, command })
|
||||
}
|
||||
|
||||
export async function updateFolderCommand(
|
||||
id: number,
|
||||
name?: string,
|
||||
command?: string,
|
||||
sortOrder?: number
|
||||
): Promise<FolderCommand> {
|
||||
return invoke("update_folder_command", {
|
||||
id,
|
||||
name: name ?? null,
|
||||
command: command ?? null,
|
||||
sortOrder: sortOrder ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function deleteFolderCommand(id: number): Promise<void> {
|
||||
return invoke("delete_folder_command", { id })
|
||||
}
|
||||
|
||||
export async function reorderFolderCommands(
|
||||
folderId: number,
|
||||
ids: number[]
|
||||
): Promise<void> {
|
||||
return invoke("reorder_folder_commands", { folderId, ids })
|
||||
}
|
||||
|
||||
export async function bootstrapFolderCommandsFromPackageJson(
|
||||
folderId: number,
|
||||
folderPath: string
|
||||
): Promise<FolderCommand[]> {
|
||||
return invoke("bootstrap_folder_commands_from_package_json", {
|
||||
folderId,
|
||||
folderPath,
|
||||
})
|
||||
}
|
||||
|
||||
// File tree and git log commands
|
||||
|
||||
export async function getFileTree(
|
||||
path: string,
|
||||
maxDepth?: number
|
||||
): Promise<FileTreeNode[]> {
|
||||
return invoke("get_file_tree", { path, maxDepth: maxDepth ?? null })
|
||||
}
|
||||
|
||||
export async function startFileTreeWatch(rootPath: string): Promise<void> {
|
||||
return invoke("start_file_tree_watch", { rootPath })
|
||||
}
|
||||
|
||||
export async function stopFileTreeWatch(rootPath: string): Promise<void> {
|
||||
return invoke("stop_file_tree_watch", { rootPath })
|
||||
}
|
||||
|
||||
export async function readFilePreview(
|
||||
rootPath: string,
|
||||
path: string,
|
||||
maxBytes?: number
|
||||
): Promise<FilePreviewContent> {
|
||||
return invoke("read_file_preview", {
|
||||
rootPath,
|
||||
path,
|
||||
maxBytes: maxBytes ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function readFileForEdit(
|
||||
rootPath: string,
|
||||
path: string,
|
||||
maxBytes?: number
|
||||
): Promise<FileEditContent> {
|
||||
return invoke("read_file_for_edit", {
|
||||
rootPath,
|
||||
path,
|
||||
maxBytes: maxBytes ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function saveFileContent(
|
||||
rootPath: string,
|
||||
path: string,
|
||||
content: string,
|
||||
expectedEtag?: string | null
|
||||
): Promise<FileSaveResult> {
|
||||
return invoke("save_file_content", {
|
||||
rootPath,
|
||||
path,
|
||||
content,
|
||||
expectedEtag: expectedEtag ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function saveFileCopy(
|
||||
rootPath: string,
|
||||
path: string,
|
||||
content: string
|
||||
): Promise<FileSaveResult> {
|
||||
return invoke("save_file_copy", {
|
||||
rootPath,
|
||||
path,
|
||||
content,
|
||||
})
|
||||
}
|
||||
|
||||
export async function renameFileTreeEntry(
|
||||
rootPath: string,
|
||||
path: string,
|
||||
newName: string
|
||||
): Promise<string> {
|
||||
return invoke("rename_file_tree_entry", { rootPath, path, newName })
|
||||
}
|
||||
|
||||
export async function deleteFileTreeEntry(
|
||||
rootPath: string,
|
||||
path: string
|
||||
): Promise<void> {
|
||||
return invoke("delete_file_tree_entry", { rootPath, path })
|
||||
}
|
||||
|
||||
export async function gitLog(
|
||||
path: string,
|
||||
limit?: number,
|
||||
branch?: string
|
||||
): Promise<GitLogEntry[]> {
|
||||
return invoke("git_log", {
|
||||
path,
|
||||
limit: limit ?? null,
|
||||
branch: branch ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function gitCommitBranches(
|
||||
path: string,
|
||||
commit: string
|
||||
): Promise<string[]> {
|
||||
return invoke("git_commit_branches", { path, commit })
|
||||
}
|
||||
|
||||
// Terminal commands
|
||||
|
||||
export async function terminalSpawn(
|
||||
workingDir: string,
|
||||
initialCommand?: string
|
||||
): Promise<string> {
|
||||
return invoke("terminal_spawn", {
|
||||
workingDir,
|
||||
initialCommand: initialCommand ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function terminalWrite(
|
||||
terminalId: string,
|
||||
data: string
|
||||
): Promise<void> {
|
||||
return invoke("terminal_write", { terminalId, data })
|
||||
}
|
||||
|
||||
export async function terminalResize(
|
||||
terminalId: string,
|
||||
cols: number,
|
||||
rows: number
|
||||
): Promise<void> {
|
||||
return invoke("terminal_resize", { terminalId, cols, rows })
|
||||
}
|
||||
|
||||
export async function terminalKill(terminalId: string): Promise<void> {
|
||||
return invoke("terminal_kill", { terminalId })
|
||||
}
|
||||
|
||||
export async function terminalList(): Promise<TerminalInfo[]> {
|
||||
return invoke("terminal_list")
|
||||
}
|
||||
Reference in New Issue
Block a user