tabby-ai-assistant 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +3 -3
  3. package/src/components/chat/ai-sidebar.component.scss +43 -0
  4. package/src/components/chat/ai-sidebar.component.ts +43 -1
  5. package/src/components/settings/ai-settings-tab.component.html +13 -5
  6. package/src/components/settings/ai-settings-tab.component.scss +164 -33
  7. package/src/components/settings/ai-settings-tab.component.ts +1 -0
  8. package/src/components/settings/context-settings.component.html +87 -0
  9. package/src/components/settings/context-settings.component.scss +133 -0
  10. package/src/components/settings/context-settings.component.ts +91 -0
  11. package/src/components/settings/provider-config.component.ts +12 -6
  12. package/src/i18n/translations/en-US.ts +27 -1
  13. package/src/i18n/translations/ja-JP.ts +27 -1
  14. package/src/i18n/translations/zh-CN.ts +27 -1
  15. package/src/i18n/types.ts +28 -0
  16. package/src/index.ts +6 -0
  17. package/src/services/chat/ai-sidebar.service.ts +1 -1
  18. package/src/services/chat/chat-session.service.ts +91 -2
  19. package/src/services/context/manager.ts +33 -2
  20. package/src/services/core/ai-assistant.service.ts +35 -11
  21. package/src/services/core/config-provider.service.ts +66 -0
  22. package/src/services/core/toast.service.ts +70 -0
  23. package/src/services/providers/anthropic-provider.service.ts +12 -4
  24. package/src/services/providers/glm-provider.service.ts +12 -4
  25. package/src/services/providers/minimax-provider.service.ts +12 -4
  26. package/src/styles/ai-assistant.scss +23 -0
  27. package/src/types/ai.types.ts +3 -3
  28. package/src/types/provider.types.ts +1 -0
  29. package/dist/components/chat/ai-sidebar.component.d.ts +0 -160
  30. package/dist/components/chat/chat-input.component.d.ts +0 -69
  31. package/dist/components/chat/chat-interface.component.d.ts +0 -124
  32. package/dist/components/chat/chat-message.component.d.ts +0 -53
  33. package/dist/components/chat/chat-settings.component.d.ts +0 -72
  34. package/dist/components/common/error-message.component.d.ts +0 -11
  35. package/dist/components/common/loading-spinner.component.d.ts +0 -4
  36. package/dist/components/security/consent-dialog.component.d.ts +0 -11
  37. package/dist/components/security/password-prompt.component.d.ts +0 -10
  38. package/dist/components/security/risk-confirm-dialog.component.d.ts +0 -36
  39. package/dist/components/settings/ai-settings-tab.component.d.ts +0 -82
  40. package/dist/components/settings/general-settings.component.d.ts +0 -94
  41. package/dist/components/settings/provider-config.component.d.ts +0 -300
  42. package/dist/components/settings/security-settings.component.d.ts +0 -33
  43. package/dist/components/terminal/ai-toolbar-button.component.d.ts +0 -10
  44. package/dist/components/terminal/command-preview.component.d.ts +0 -53
  45. package/dist/components/terminal/command-suggestion.component.d.ts +0 -16
  46. package/dist/i18n/index.d.ts +0 -48
  47. package/dist/i18n/translations/en-US.d.ts +0 -5
  48. package/dist/i18n/translations/ja-JP.d.ts +0 -5
  49. package/dist/i18n/translations/zh-CN.d.ts +0 -5
  50. package/dist/i18n/types.d.ts +0 -198
  51. package/dist/index-full.d.ts +0 -8
  52. package/dist/index-minimal.d.ts +0 -3
  53. package/dist/index.d.ts +0 -12
  54. package/dist/main.d.ts +0 -8
  55. package/dist/providers/tabby/ai-config.provider.d.ts +0 -70
  56. package/dist/providers/tabby/ai-hotkey.provider.d.ts +0 -15
  57. package/dist/providers/tabby/ai-settings-tab.provider.d.ts +0 -11
  58. package/dist/providers/tabby/ai-toolbar-button.provider.d.ts +0 -16
  59. package/dist/services/chat/ai-sidebar.service.d.ts +0 -111
  60. package/dist/services/chat/chat-history.service.d.ts +0 -145
  61. package/dist/services/chat/chat-session.service.d.ts +0 -113
  62. package/dist/services/chat/command-generator.service.d.ts +0 -49
  63. package/dist/services/context/compaction.d.ts +0 -90
  64. package/dist/services/context/manager.d.ts +0 -69
  65. package/dist/services/context/memory.d.ts +0 -116
  66. package/dist/services/context/token-budget.d.ts +0 -105
  67. package/dist/services/core/ai-assistant.service.d.ts +0 -127
  68. package/dist/services/core/ai-provider-manager.service.d.ts +0 -119
  69. package/dist/services/core/checkpoint.service.d.ts +0 -130
  70. package/dist/services/core/config-provider.service.d.ts +0 -137
  71. package/dist/services/core/logger.service.d.ts +0 -21
  72. package/dist/services/core/theme.service.d.ts +0 -53
  73. package/dist/services/core/toast.service.d.ts +0 -15
  74. package/dist/services/platform/escape-sequence.service.d.ts +0 -132
  75. package/dist/services/platform/platform-detection.service.d.ts +0 -146
  76. package/dist/services/providers/anthropic-provider.service.d.ts +0 -44
  77. package/dist/services/providers/base-provider.service.d.ts +0 -142
  78. package/dist/services/providers/glm-provider.service.d.ts +0 -96
  79. package/dist/services/providers/minimax-provider.service.d.ts +0 -102
  80. package/dist/services/providers/ollama-provider.service.d.ts +0 -76
  81. package/dist/services/providers/openai-compatible.service.d.ts +0 -44
  82. package/dist/services/providers/openai-provider.service.d.ts +0 -43
  83. package/dist/services/providers/vllm-provider.service.d.ts +0 -82
  84. package/dist/services/security/consent-manager.service.d.ts +0 -65
  85. package/dist/services/security/password-manager.service.d.ts +0 -67
  86. package/dist/services/security/risk-assessment.service.d.ts +0 -65
  87. package/dist/services/security/security-validator.service.d.ts +0 -36
  88. package/dist/services/terminal/buffer-analyzer.service.d.ts +0 -128
  89. package/dist/services/terminal/command-analyzer.service.d.ts +0 -20
  90. package/dist/services/terminal/context-menu.service.d.ts +0 -24
  91. package/dist/services/terminal/hotkey.service.d.ts +0 -28
  92. package/dist/services/terminal/terminal-context.service.d.ts +0 -100
  93. package/dist/services/terminal/terminal-manager.service.d.ts +0 -185
  94. package/dist/services/terminal/terminal-tools.service.d.ts +0 -79
  95. package/dist/types/ai.types.d.ts +0 -199
  96. package/dist/types/provider.types.d.ts +0 -105
  97. package/dist/types/security.types.d.ts +0 -85
  98. package/dist/types/terminal.types.d.ts +0 -150
  99. package/dist/utils/encryption.utils.d.ts +0 -83
  100. package/dist/utils/formatting.utils.d.ts +0 -106
  101. package/dist/utils/validation.utils.d.ts +0 -83
  102. package/jest.config.js +0 -47
  103. package/webpack-docker.config.js +0 -42
  104. package/webpack.config.js +0 -81
@@ -1,33 +0,0 @@
1
- import { OnInit, OnDestroy } from '@angular/core';
2
- import { ConfigProviderService } from '../../services/core/config-provider.service';
3
- import { LoggerService } from '../../services/core/logger.service';
4
- import { TranslateService } from '../../i18n';
5
- export declare class SecuritySettingsComponent implements OnInit, OnDestroy {
6
- private config;
7
- private logger;
8
- private translate;
9
- settings: {
10
- enablePasswordProtection: boolean;
11
- enableRiskAssessment: boolean;
12
- defaultRiskLevel: string;
13
- enableConsentPersistence: boolean;
14
- consentExpiryDays: number;
15
- autoApproveLowRisk: boolean;
16
- promptForMediumRisk: boolean;
17
- requirePasswordForHighRisk: boolean;
18
- };
19
- password: string;
20
- newPattern: string;
21
- dangerousPatterns: string[];
22
- t: any;
23
- private destroy$;
24
- constructor(config: ConfigProviderService, logger: LoggerService, translate: TranslateService);
25
- ngOnInit(): void;
26
- ngOnDestroy(): void;
27
- private loadSettings;
28
- updateSetting(key: string, value: any): void;
29
- addDangerousPattern(pattern: string): void;
30
- removeDangerousPattern(index: number): void;
31
- saveSettings(): void;
32
- resetToDefaults(): void;
33
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * AI工具栏按钮组件
3
- * 在Tabby工具栏显示AI助手按钮
4
- */
5
- export declare class AiToolbarButtonComponent {
6
- label: string;
7
- tooltip: string;
8
- showLabel: boolean;
9
- onClick(): void;
10
- }
@@ -1,53 +0,0 @@
1
- import { EventEmitter } from '@angular/core';
2
- import { CommandResponse } from '../../types/ai.types';
3
- import { RiskLevel } from '../../types/security.types';
4
- import { TerminalManagerService, TerminalInfo } from '../../services/terminal/terminal-manager.service';
5
- import { LoggerService } from '../../services/core/logger.service';
6
- export declare class CommandPreviewComponent {
7
- private terminalManager;
8
- private logger;
9
- command: CommandResponse | null;
10
- riskLevel: RiskLevel;
11
- executed: EventEmitter<CommandResponse>;
12
- closed: EventEmitter<void>;
13
- terminals: TerminalInfo[];
14
- selectedTerminalIndex: number;
15
- showTerminalSelector: boolean;
16
- executionStatus: 'idle' | 'executing' | 'success' | 'error';
17
- statusMessage: string;
18
- constructor(terminalManager: TerminalManagerService, logger: LoggerService);
19
- /**
20
- * 加载可用终端列表
21
- */
22
- loadTerminals(): void;
23
- getRiskText(): string;
24
- getRiskIcon(): string;
25
- /**
26
- * 复制命令到剪贴板
27
- */
28
- copyCommand(): void;
29
- /**
30
- * 执行命令到终端
31
- */
32
- execute(): void;
33
- /**
34
- * 仅插入命令(不执行)
35
- */
36
- insertOnly(): void;
37
- /**
38
- * 切换终端选择器
39
- */
40
- toggleTerminalSelector(): void;
41
- /**
42
- * 选择终端
43
- */
44
- selectTerminal(index: number): void;
45
- /**
46
- * 关闭预览
47
- */
48
- close(): void;
49
- /**
50
- * 选择替代命令
51
- */
52
- selectAlternative(alt: any): void;
53
- }
@@ -1,16 +0,0 @@
1
- import { EventEmitter, OnInit, OnDestroy } from '@angular/core';
2
- import { CommandResponse } from '../../types/ai.types';
3
- export declare class CommandSuggestionComponent implements OnInit, OnDestroy {
4
- inputText: string;
5
- suggestionSelected: EventEmitter<CommandResponse>;
6
- closed: EventEmitter<void>;
7
- suggestions: CommandResponse[];
8
- private inputSubject;
9
- private destroy$;
10
- ngOnInit(): void;
11
- ngOnDestroy(): void;
12
- onInputChange(text: string): void;
13
- private generateSuggestions;
14
- selectSuggestion(suggestion: CommandResponse): void;
15
- close(): void;
16
- }
@@ -1,48 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { TranslationKeys, SupportedLanguage, LanguageConfig } from './types';
3
- import { ConfigProviderService } from '../services/core/config-provider.service';
4
- export declare const languageConfigs: LanguageConfig[];
5
- export { TranslationKeys, SupportedLanguage, LanguageConfig } from './types';
6
- export declare class TranslateService {
7
- private config;
8
- private currentLang$;
9
- private currentTranslation$;
10
- constructor(config: ConfigProviderService);
11
- /**
12
- * 获取当前语言
13
- */
14
- get currentLanguage(): SupportedLanguage;
15
- /**
16
- * 监听语言变化
17
- */
18
- get language$(): Observable<SupportedLanguage>;
19
- /**
20
- * 获取翻译对象
21
- */
22
- get t(): TranslationKeys;
23
- /**
24
- * 监听翻译变化
25
- */
26
- get translation$(): Observable<TranslationKeys>;
27
- /**
28
- * 获取所有语言配置
29
- */
30
- get languages(): LanguageConfig[];
31
- /**
32
- * 设置语言
33
- */
34
- setLanguage(lang: SupportedLanguage): void;
35
- /**
36
- * 获取翻译 - 支持插值
37
- * 例如: translate('general.providerCount', { count: 3 })
38
- */
39
- translate(key: string, params?: Record<string, any>): string;
40
- /**
41
- * 简写方法
42
- */
43
- _(key: string, params?: Record<string, any>): string;
44
- /**
45
- * 获取指定语言的翻译
46
- */
47
- getTranslationForLang(lang: SupportedLanguage): TranslationKeys;
48
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * English translations
3
- */
4
- import { TranslationKeys } from '../types';
5
- export declare const enUS: TranslationKeys;
@@ -1,5 +0,0 @@
1
- /**
2
- * 日本語翻訳
3
- */
4
- import { TranslationKeys } from '../types';
5
- export declare const jaJP: TranslationKeys;
@@ -1,5 +0,0 @@
1
- /**
2
- * 中文翻译
3
- */
4
- import { TranslationKeys } from '../types';
5
- export declare const zhCN: TranslationKeys;
@@ -1,198 +0,0 @@
1
- /**
2
- * 翻译键类型定义
3
- */
4
- export interface CommonTranslations {
5
- save: string;
6
- cancel: string;
7
- delete: string;
8
- confirm: string;
9
- enabled: string;
10
- disabled: string;
11
- online: string;
12
- offline: string;
13
- testing: string;
14
- error: string;
15
- success: string;
16
- notConfigured: string;
17
- add: string;
18
- remove: string;
19
- close: string;
20
- yes: string;
21
- no: string;
22
- reset: string;
23
- default: string;
24
- today: string;
25
- }
26
- export interface SettingsTranslations {
27
- title: string;
28
- generalTab: string;
29
- providersTab: string;
30
- securityTab: string;
31
- chatTab: string;
32
- advancedTab: string;
33
- }
34
- export interface GeneralTranslations {
35
- title: string;
36
- enableAssistant: string;
37
- enableAssistantDesc: string;
38
- defaultProvider: string;
39
- providerCount: string;
40
- language: string;
41
- theme: string;
42
- themeAuto: string;
43
- themeLight: string;
44
- themeDark: string;
45
- themePixel: string;
46
- themeTech: string;
47
- shortcuts: string;
48
- shortcutOpenChat: string;
49
- shortcutOpenChatDesc: string;
50
- shortcutGenerate: string;
51
- shortcutGenerateDesc: string;
52
- shortcutExplain: string;
53
- shortcutExplainDesc: string;
54
- shortcutTip: string;
55
- }
56
- export interface ChatSettingsTranslations {
57
- title: string;
58
- appearance: string;
59
- theme: string;
60
- fontSize: string;
61
- compactMode: string;
62
- compactModeDesc: string;
63
- behavior: string;
64
- enterToSend: string;
65
- enterToSendDesc: string;
66
- showTimestamps: string;
67
- showTimestampsDesc: string;
68
- showAvatars: string;
69
- showAvatarsDesc: string;
70
- soundEnabled: string;
71
- soundEnabledDesc: string;
72
- history: string;
73
- enableHistory: string;
74
- enableHistoryDesc: string;
75
- maxHistory: string;
76
- maxHistoryUnit: string;
77
- autoSave: string;
78
- autoSaveDesc: string;
79
- exportSettings: string;
80
- clearHistory: string;
81
- resetDefaults: string;
82
- clearHistoryConfirm: string;
83
- resetConfirm: string;
84
- }
85
- export interface SecurityTranslations {
86
- title: string;
87
- accessControl: string;
88
- passwordProtection: string;
89
- passwordProtectionDesc: string;
90
- setPassword: string;
91
- passwordPlaceholder: string;
92
- riskAssessment: string;
93
- riskAssessmentDesc: string;
94
- defaultRiskLevel: string;
95
- riskLow: string;
96
- riskMedium: string;
97
- riskHigh: string;
98
- userConsent: string;
99
- rememberConsent: string;
100
- rememberConsentDesc: string;
101
- consentExpiryDays: string;
102
- dangerousPatterns: string;
103
- addPattern: string;
104
- patternPlaceholder: string;
105
- saveSettings: string;
106
- resetDefaults: string;
107
- resetConfirm: string;
108
- }
109
- export interface ProvidersTranslations {
110
- title: string;
111
- cloudProviders: string;
112
- cloudProvidersDesc: string;
113
- localProviders: string;
114
- localProvidersDesc: string;
115
- configured: string;
116
- displayName: string;
117
- status: string;
118
- apiKey: string;
119
- baseURL: string;
120
- model: string;
121
- saveConfig: string;
122
- testConnection: string;
123
- detectService: string;
124
- delete: string;
125
- deleteConfirm: string;
126
- testSuccess: string;
127
- testFail: string;
128
- testError: string;
129
- configSaved: string;
130
- configDeleted: string;
131
- }
132
- export interface ProviderNamesTranslations {
133
- openai: string;
134
- anthropic: string;
135
- minimax: string;
136
- glm: string;
137
- openaiCompatible: string;
138
- ollama: string;
139
- vllm: string;
140
- }
141
- export interface ChatInterfaceTranslations {
142
- title: string;
143
- welcomeMessage: string;
144
- inputPlaceholder: string;
145
- thinking: string;
146
- executingTool: string;
147
- toolComplete: string;
148
- errorPrefix: string;
149
- tipCommand: string;
150
- tipShortcut: string;
151
- clearChat: string;
152
- clearChatConfirm: string;
153
- exportChat: string;
154
- switchProvider: string;
155
- providerBadge: string;
156
- }
157
- export interface RiskLevelTranslations {
158
- low: string;
159
- medium: string;
160
- high: string;
161
- unknown: string;
162
- }
163
- export interface AdvancedSettingsTranslations {
164
- title: string;
165
- configManagement: string;
166
- validateConfig: string;
167
- resetDefaults: string;
168
- logSettings: string;
169
- logLevel: string;
170
- logLevels: {
171
- debug: string;
172
- info: string;
173
- warn: string;
174
- error: string;
175
- };
176
- systemInfo: string;
177
- pluginVersion: string;
178
- supportedProviders: string;
179
- currentProvider: string;
180
- }
181
- export interface TranslationKeys {
182
- common: CommonTranslations;
183
- settings: SettingsTranslations;
184
- general: GeneralTranslations;
185
- chatSettings: ChatSettingsTranslations;
186
- security: SecurityTranslations;
187
- providers: ProvidersTranslations;
188
- providerNames: ProviderNamesTranslations;
189
- chatInterface: ChatInterfaceTranslations;
190
- riskLevel: RiskLevelTranslations;
191
- advancedSettings: AdvancedSettingsTranslations;
192
- }
193
- export type SupportedLanguage = 'zh-CN' | 'en-US' | 'ja-JP';
194
- export interface LanguageConfig {
195
- code: SupportedLanguage;
196
- label: string;
197
- flag: string;
198
- }
@@ -1,8 +0,0 @@
1
- import { AiAssistantService } from './services/core/ai-assistant.service';
2
- import { ConfigProviderService } from './services/core/config-provider.service';
3
- export default class AiAssistantModule {
4
- private app;
5
- private aiService;
6
- private config;
7
- constructor(app: any, aiService: AiAssistantService, config: ConfigProviderService);
8
- }
@@ -1,3 +0,0 @@
1
- export default class AiAssistantModule {
2
- constructor();
3
- }
package/dist/index.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import './styles/ai-assistant.scss';
2
- import { AppService, ConfigService, HotkeysService } from 'tabby-core';
3
- import { AiAssistantService } from './services/core/ai-assistant.service';
4
- import { AiSidebarService } from './services/chat/ai-sidebar.service';
5
- export default class AiAssistantModule {
6
- private app;
7
- private config;
8
- private aiService;
9
- private sidebarService;
10
- constructor(app: AppService, config: ConfigService, aiService: AiAssistantService, sidebarService: AiSidebarService, hotkeys: HotkeysService);
11
- }
12
- export declare const forRoot: () => typeof AiAssistantModule;
package/dist/main.d.ts DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * Tabby AI Assistant Plugin - Main Entry Point
3
- *
4
- * This file serves as the main entry point for the Tabby AI Assistant plugin.
5
- * It initializes the Angular module and integrates with Tabby's plugin system.
6
- */
7
- import AiAssistantModule from './index';
8
- export default AiAssistantModule;
@@ -1,70 +0,0 @@
1
- import { ConfigProvider } from 'tabby-core';
2
- import { ConfigProviderService } from '../../services/core/config-provider.service';
3
- /**
4
- * Tabby配置提供者
5
- * 为Tabby提供AI助手配置管理
6
- */
7
- export declare class AiConfigProvider extends ConfigProvider {
8
- private configService;
9
- /**
10
- * 默认配置
11
- */
12
- defaults: {
13
- hotkeys: {
14
- 'ai-assistant-toggle': string[];
15
- 'ai-command-generation': string[];
16
- 'ai-explain-command': string[];
17
- };
18
- aiAssistant: {
19
- enabled: boolean;
20
- defaultProvider: string;
21
- autoSuggestCommands: boolean;
22
- enableSecurityChecks: boolean;
23
- providers: {
24
- openai: {
25
- apiKey: string;
26
- model: string;
27
- baseURL: string;
28
- };
29
- anthropic: {
30
- apiKey: string;
31
- model: string;
32
- baseURL: string;
33
- };
34
- minimax: {
35
- apiKey: string;
36
- model: string;
37
- baseURL: string;
38
- };
39
- glm: {
40
- apiKey: string;
41
- model: string;
42
- baseURL: string;
43
- };
44
- openaiCompatible: {
45
- apiKey: string;
46
- model: string;
47
- baseURL: string;
48
- };
49
- };
50
- security: {
51
- passwordProtection: boolean;
52
- riskAssessmentLevel: string;
53
- consentPersistenceDays: number;
54
- };
55
- };
56
- };
57
- /**
58
- * 平台特定默认配置
59
- */
60
- platformDefaults: {
61
- macOS: {
62
- hotkeys: {
63
- 'ai-assistant-toggle': string[];
64
- 'ai-command-generation': string[];
65
- 'ai-explain-command': string[];
66
- };
67
- };
68
- };
69
- constructor(configService: ConfigProviderService);
70
- }
@@ -1,15 +0,0 @@
1
- import { HotkeyProvider, HotkeyDescription, TranslateService } from 'tabby-core';
2
- import { AiSidebarService } from '../../services/chat/ai-sidebar.service';
3
- /**
4
- * Tabby热键提供者
5
- * 为Tabby添加AI助手热键支持
6
- *
7
- * 注意:热键 ID 必须与 AiConfigProvider.defaults.hotkeys 中定义的一致
8
- */
9
- export declare class AiHotkeyProvider extends HotkeyProvider {
10
- private sidebarService;
11
- private translate;
12
- hotkeys: HotkeyDescription[];
13
- constructor(sidebarService: AiSidebarService, translate: TranslateService);
14
- provide(): Promise<HotkeyDescription[]>;
15
- }
@@ -1,11 +0,0 @@
1
- import { SettingsTabProvider } from 'tabby-settings';
2
- /**
3
- * Tabby设置页面提供者
4
- * 为Tabby添加AI助手设置页面
5
- */
6
- export declare class AiSettingsTabProvider extends SettingsTabProvider {
7
- id: string;
8
- icon: string;
9
- title: string;
10
- getComponentType(): any;
11
- }
@@ -1,16 +0,0 @@
1
- import { ToolbarButtonProvider, ToolbarButton, AppService } from 'tabby-core';
2
- import { AiSidebarService } from '../../services/chat/ai-sidebar.service';
3
- /**
4
- * Tabby工具栏按钮提供者
5
- * 为Tabby工具栏添加AI助手按钮,使用侧边栏方式
6
- */
7
- export declare class AiToolbarButtonProvider extends ToolbarButtonProvider {
8
- private app;
9
- private sidebarService;
10
- constructor(app: AppService, sidebarService: AiSidebarService);
11
- provide(): ToolbarButton[];
12
- /**
13
- * 打开设置页面
14
- */
15
- private openSettings;
16
- }
@@ -1,111 +0,0 @@
1
- import { ComponentFactoryResolver, ApplicationRef, Injector } from '@angular/core';
2
- import { ConfigService } from 'tabby-core';
3
- /**
4
- * AI Sidebar 配置接口
5
- */
6
- export interface AiSidebarConfig {
7
- enabled?: boolean;
8
- position?: 'left' | 'right';
9
- showInToolbar?: boolean;
10
- sidebarVisible?: boolean;
11
- sidebarCollapsed?: boolean;
12
- sidebarWidth?: number;
13
- }
14
- /**
15
- * AI Sidebar 服务 - 管理 AI 聊天侧边栏的生命周期
16
- *
17
- * 采用 Flexbox 布局方式,将 sidebar 插入到 app-root 作为第一个子元素,
18
- * app-root 变为水平 flex 容器,sidebar 在左侧
19
- */
20
- export declare class AiSidebarService {
21
- private componentFactoryResolver;
22
- private appRef;
23
- private injector;
24
- private config;
25
- private sidebarComponentRef;
26
- private sidebarElement;
27
- private styleElement;
28
- private resizeHandle;
29
- private _isVisible;
30
- private readonly MIN_WIDTH;
31
- private readonly MAX_WIDTH;
32
- private readonly DEFAULT_WIDTH;
33
- private currentWidth;
34
- private isResizing;
35
- /**
36
- * 侧边栏是否可见
37
- */
38
- get sidebarVisible(): boolean;
39
- constructor(componentFactoryResolver: ComponentFactoryResolver, appRef: ApplicationRef, injector: Injector, config: ConfigService);
40
- /**
41
- * 显示 sidebar
42
- */
43
- show(): void;
44
- /**
45
- * 隐藏 sidebar
46
- */
47
- hide(): void;
48
- /**
49
- * 切换 sidebar 显示状态
50
- */
51
- toggle(): void;
52
- /**
53
- * 获取当前显示状态
54
- */
55
- get visible(): boolean;
56
- /**
57
- * 初始化 - 应用启动时调用
58
- */
59
- initialize(): void;
60
- /**
61
- * 创建 sidebar 组件
62
- *
63
- * 使用固定定位方案:
64
- * 1. 侧边栏 position: fixed,固定在左侧
65
- * 2. 主内容区通过 margin-left 推开
66
- * 这样不改变任何现有元素的 flex 布局
67
- */
68
- private createSidebar;
69
- /**
70
- * 销毁 sidebar 组件
71
- */
72
- private destroySidebar;
73
- /**
74
- * 调整 .content 元素样式 - 只处理第二个(更深层的).content
75
- */
76
- private adjustContentStyles;
77
- /**
78
- * 注入布局 CSS - 使用 margin-left 把主内容推开
79
- *
80
- * 固定定位方案:侧边栏 fixed,主内容区 margin-left
81
- */
82
- private injectLayoutCSS;
83
- /**
84
- * 移除布局 CSS
85
- */
86
- private removeLayoutCSS;
87
- /**
88
- * 设置 resize handle 拖动逻辑
89
- */
90
- private setupResizeHandler;
91
- /**
92
- * 更新布局 CSS(resize 时调用)
93
- */
94
- private updateLayoutCSS;
95
- /**
96
- * 加载保存的侧边栏宽度
97
- */
98
- private loadSidebarWidth;
99
- /**
100
- * 保存侧边栏宽度到配置
101
- */
102
- private saveSidebarWidth;
103
- /**
104
- * 获取插件配置
105
- */
106
- private getPluginConfig;
107
- /**
108
- * 保存插件配置
109
- */
110
- private savePluginConfig;
111
- }