feat(pro): add Svelte components for commercial phases
BudgetManager (budget+router), ProjectMemory (persistent memory), CodeIntelligence (symbols+git+branch policy). Updated pro-bridge.ts with all new IPC functions.
This commit is contained in:
parent
191b869b43
commit
be084c8f17
4 changed files with 826 additions and 0 deletions
|
|
@ -150,3 +150,43 @@ export const proMarketplaceUpdate = (pluginId: string) =>
|
|||
|
||||
export const proStatus = () =>
|
||||
invoke<string>('plugin:agor-pro|pro_status');
|
||||
|
||||
// --- Budget Governor ---
|
||||
|
||||
export interface BudgetStatus { limit: number; used: number; remaining: number; percent: number; resetDate: string; }
|
||||
export interface BudgetDecision { allowed: boolean; reason: string; remaining: number; }
|
||||
export const proBudgetSet = (projectId: string, monthlyLimitTokens: number) => invoke<void>('plugin:agor-pro|pro_budget_set', { projectId, monthlyLimitTokens });
|
||||
export const proBudgetGet = (projectId: string) => invoke<BudgetStatus>('plugin:agor-pro|pro_budget_get', { projectId });
|
||||
export const proBudgetCheck = (projectId: string, estimatedTokens: number) => invoke<BudgetDecision>('plugin:agor-pro|pro_budget_check', { projectId, estimatedTokens });
|
||||
export const proBudgetLogUsage = (projectId: string, sessionId: string, tokensUsed: number) => invoke<void>('plugin:agor-pro|pro_budget_log_usage', { projectId, sessionId, tokensUsed });
|
||||
export const proBudgetList = () => invoke<Array<BudgetStatus & { projectId: string }>>('plugin:agor-pro|pro_budget_list');
|
||||
|
||||
// --- Smart Model Router ---
|
||||
|
||||
export interface ModelRecommendation { model: string; reason: string; estimatedCostFactor: number; }
|
||||
export const proRouterRecommend = (projectId: string, role: string, promptLength: number, provider: string) => invoke<ModelRecommendation>('plugin:agor-pro|pro_router_recommend', { projectId, role, promptLength, provider });
|
||||
export const proRouterSetProfile = (projectId: string, profile: string) => invoke<void>('plugin:agor-pro|pro_router_set_profile', { projectId, profile });
|
||||
export const proRouterGetProfile = (projectId: string) => invoke<string>('plugin:agor-pro|pro_router_get_profile', { projectId });
|
||||
|
||||
// --- Persistent Memory ---
|
||||
|
||||
export interface MemoryFragment { id: number; projectId: string; content: string; source: string; trust: string; confidence: number; createdAt: number; ttlDays: number; tags: string; }
|
||||
export const proMemoryAdd = (projectId: string, content: string, source: string, tags: string) => invoke<number>('plugin:agor-pro|pro_memory_add', { projectId, content, source, tags });
|
||||
export const proMemoryList = (projectId: string, limit: number) => invoke<MemoryFragment[]>('plugin:agor-pro|pro_memory_list', { projectId, limit });
|
||||
export const proMemorySearch = (projectId: string, query: string) => invoke<MemoryFragment[]>('plugin:agor-pro|pro_memory_search', { projectId, query });
|
||||
export const proMemoryDelete = (id: number) => invoke<void>('plugin:agor-pro|pro_memory_delete', { id });
|
||||
export const proMemoryInject = (projectId: string, maxTokens: number) => invoke<string>('plugin:agor-pro|pro_memory_inject', { projectId, maxTokens });
|
||||
|
||||
// --- Git Context ---
|
||||
|
||||
export interface GitContext { branch: string; lastCommits: Array<{hash: string; message: string; author: string; timestamp: number}>; modifiedFiles: string[]; hasUnstaged: boolean; }
|
||||
export interface PolicyDecision { allowed: boolean; branch: string; matchedPolicy: string | null; reason: string; }
|
||||
export const proGitContext = (projectPath: string) => invoke<GitContext>('plugin:agor-pro|pro_git_context', { projectPath });
|
||||
export const proGitInject = (projectPath: string, maxTokens: number) => invoke<string>('plugin:agor-pro|pro_git_inject', { projectPath, maxTokens });
|
||||
export const proBranchCheck = (projectPath: string) => invoke<PolicyDecision>('plugin:agor-pro|pro_branch_check', { projectPath });
|
||||
|
||||
// --- Symbols ---
|
||||
|
||||
export interface Symbol { name: string; kind: string; filePath: string; lineNumber: number; }
|
||||
export const proSymbolsScan = (projectPath: string) => invoke<{filesScanned: number; symbolsFound: number; durationMs: number}>('plugin:agor-pro|pro_symbols_scan', { projectPath });
|
||||
export const proSymbolsSearch = (projectPath: string, query: string) => invoke<Symbol[]>('plugin:agor-pro|pro_symbols_search', { projectPath, query });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue