andy-stack_vaultkeeper-ai/Services/StatusBarService.ts
Andrew Beal db054744ba Add token counting service and refactor dependencies
- Implement ITokenService interface and GeminiTokenService for token counting
- Add StatusBarService for managing status bar messages
- Extract AIProviderModel enum to centralize model configuration
- Remove unused MessageService and AIThoughtMessage classes
- Update dependency registration to include new services
- Clean up main plugin initialization and status bar handling
2025-10-17 22:23:30 +01:00

33 lines
No EOL
909 B
TypeScript

import type AIAgentPlugin from "main";
import { Resolve } from "./DependencyService";
import { Services } from "./Services";
export class StatusBarService {
private readonly plugin: AIAgentPlugin;
private statusBarItem: HTMLElement | null;
public constructor() {
this.plugin = Resolve<AIAgentPlugin>(Services.AIAgentPlugin);
}
public setStatusBarMessage(message: string) {
if (this.statusBarItem == null) {
this.createStatusBarMessage();
}
this.statusBarItem?.empty();
this.statusBarItem?.createEl("span", { text: message });
}
public removeStatusBarMessage() {
this.statusBarItem?.remove();
this.statusBarItem = null;
}
private createStatusBarMessage() {
this.statusBarItem?.remove();
this.statusBarItem = this.plugin.addStatusBarItem();
this.statusBarItem.empty();
}
}