diff --git a/src/plugin.ts b/src/plugin.ts index 90da26b..82efaec 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -1,7 +1,6 @@ import { Plugin, WorkspaceLeaf, - WorkspaceSplit, Notice, requestUrl, } from "obsidian"; @@ -525,7 +524,7 @@ export default class AgentClientPlugin extends Plugin { const tabGroup = sidebarLeaf.parent; // Index is clamped by Obsidian, so a large value appends to the end return workspace.createLeafInParent( - tabGroup as unknown as WorkspaceSplit, + tabGroup, Number.MAX_SAFE_INTEGER, ); } @@ -652,7 +651,7 @@ export default class AgentClientPlugin extends Plugin { name: `Switch agent to ${agent.displayName}`, callback: () => { this.app.workspace.trigger( - "agent-client:new-chat-requested" as "quit", + "agent-client:new-chat-requested", this.lastActiveChatViewId, agent.id, ); @@ -667,7 +666,7 @@ export default class AgentClientPlugin extends Plugin { name: "Approve active permission", callback: () => { this.app.workspace.trigger( - "agent-client:approve-active-permission" as "quit", + "agent-client:approve-active-permission", this.lastActiveChatViewId, ); }, @@ -678,7 +677,7 @@ export default class AgentClientPlugin extends Plugin { name: "Reject active permission", callback: () => { this.app.workspace.trigger( - "agent-client:reject-active-permission" as "quit", + "agent-client:reject-active-permission", this.lastActiveChatViewId, ); }, @@ -689,7 +688,7 @@ export default class AgentClientPlugin extends Plugin { name: "Toggle auto-mention", callback: () => { this.app.workspace.trigger( - "agent-client:toggle-auto-mention" as "quit", + "agent-client:toggle-auto-mention", this.lastActiveChatViewId, ); }, @@ -700,7 +699,7 @@ export default class AgentClientPlugin extends Plugin { name: "New chat", callback: () => { this.app.workspace.trigger( - "agent-client:new-chat-requested" as "quit", + "agent-client:new-chat-requested", this.lastActiveChatViewId, ); }, @@ -711,7 +710,7 @@ export default class AgentClientPlugin extends Plugin { name: "Cancel current message", callback: () => { this.app.workspace.trigger( - "agent-client:cancel-message" as "quit", + "agent-client:cancel-message", this.lastActiveChatViewId, ); }, @@ -722,7 +721,7 @@ export default class AgentClientPlugin extends Plugin { name: "Export chat", callback: () => { this.app.workspace.trigger( - "agent-client:export-chat" as "quit", + "agent-client:export-chat", this.lastActiveChatViewId, ); }, diff --git a/src/ui/ChatPanel.tsx b/src/ui/ChatPanel.tsx index c641622..f803300 100644 --- a/src/ui/ChatPanel.tsx +++ b/src/ui/ChatPanel.tsx @@ -552,7 +552,7 @@ export function ChatPanel({ ) => { target.addEventListener(type, callback); registeredListenersRef.current.push({ target, type, callback }); - }) as IChatViewHost["registerDomEvent"], + }), }; }, [viewHostProp, plugin.app]);