@vybestack/llxprt-code-core 0.5.0-nightly.251122.cbc3e5b17 → 0.5.0-nightly.251124.0158ea13c

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 (94) hide show
  1. package/README.md +0 -244
  2. package/dist/src/auth/types.d.ts +2 -2
  3. package/dist/src/config/config.d.ts +58 -8
  4. package/dist/src/config/config.js +103 -21
  5. package/dist/src/config/config.js.map +1 -1
  6. package/dist/src/config/constants.d.ts +11 -0
  7. package/dist/src/config/constants.js +16 -0
  8. package/dist/src/config/constants.js.map +1 -0
  9. package/dist/src/core/baseLlmClient.d.ts +77 -0
  10. package/dist/src/core/baseLlmClient.js +175 -0
  11. package/dist/src/core/baseLlmClient.js.map +1 -0
  12. package/dist/src/core/client.d.ts +10 -0
  13. package/dist/src/core/client.js +70 -109
  14. package/dist/src/core/client.js.map +1 -1
  15. package/dist/src/core/coreToolScheduler.d.ts +2 -0
  16. package/dist/src/core/coreToolScheduler.js +24 -4
  17. package/dist/src/core/coreToolScheduler.js.map +1 -1
  18. package/dist/src/core/geminiChat.js +21 -14
  19. package/dist/src/core/geminiChat.js.map +1 -1
  20. package/dist/src/core/subagent.d.ts +12 -0
  21. package/dist/src/core/subagent.js +26 -0
  22. package/dist/src/core/subagent.js.map +1 -1
  23. package/dist/src/core/subagentOrchestrator.js +5 -0
  24. package/dist/src/core/subagentOrchestrator.js.map +1 -1
  25. package/dist/src/core/turn.d.ts +1 -4
  26. package/dist/src/core/turn.js +2 -12
  27. package/dist/src/core/turn.js.map +1 -1
  28. package/dist/src/index.d.ts +2 -0
  29. package/dist/src/index.js +2 -0
  30. package/dist/src/index.js.map +1 -1
  31. package/dist/src/mcp/oauth-provider.js +2 -0
  32. package/dist/src/mcp/oauth-provider.js.map +1 -1
  33. package/dist/src/mcp/sa-impersonation-provider.d.ts +33 -0
  34. package/dist/src/mcp/sa-impersonation-provider.js +130 -0
  35. package/dist/src/mcp/sa-impersonation-provider.js.map +1 -0
  36. package/dist/src/providers/anthropic/AnthropicProvider.js +2 -2
  37. package/dist/src/providers/anthropic/AnthropicProvider.js.map +1 -1
  38. package/dist/src/providers/openai/OpenAIProvider.js +4 -4
  39. package/dist/src/providers/openai/OpenAIProvider.js.map +1 -1
  40. package/dist/src/services/fileSystemService.d.ts +9 -0
  41. package/dist/src/services/fileSystemService.js +12 -1
  42. package/dist/src/services/fileSystemService.js.map +1 -1
  43. package/dist/src/telemetry/types.d.ts +1 -1
  44. package/dist/src/telemetry/types.js.map +1 -1
  45. package/dist/src/tools/glob.d.ts +3 -2
  46. package/dist/src/tools/glob.js +1 -1
  47. package/dist/src/tools/glob.js.map +1 -1
  48. package/dist/src/tools/ls.d.ts +1 -1
  49. package/dist/src/tools/ls.js +1 -1
  50. package/dist/src/tools/ls.js.map +1 -1
  51. package/dist/src/tools/mcp-client.d.ts +6 -16
  52. package/dist/src/tools/mcp-client.js +22 -67
  53. package/dist/src/tools/mcp-client.js.map +1 -1
  54. package/dist/src/tools/memoryTool.d.ts +1 -0
  55. package/dist/src/tools/memoryTool.js +2 -0
  56. package/dist/src/tools/memoryTool.js.map +1 -1
  57. package/dist/src/tools/modifiable-tool.d.ts +1 -1
  58. package/dist/src/tools/modifiable-tool.js +9 -1
  59. package/dist/src/tools/modifiable-tool.js.map +1 -1
  60. package/dist/src/tools/shell.js +59 -3
  61. package/dist/src/tools/shell.js.map +1 -1
  62. package/dist/src/tools/smart-edit.d.ts +19 -0
  63. package/dist/src/tools/smart-edit.js +105 -3
  64. package/dist/src/tools/smart-edit.js.map +1 -1
  65. package/dist/src/tools/tool-error.d.ts +1 -0
  66. package/dist/src/tools/tool-error.js +1 -0
  67. package/dist/src/tools/tool-error.js.map +1 -1
  68. package/dist/src/utils/bfsFileSearch.d.ts +2 -2
  69. package/dist/src/utils/editor.js +5 -3
  70. package/dist/src/utils/editor.js.map +1 -1
  71. package/dist/src/utils/getFolderStructure.d.ts +2 -2
  72. package/dist/src/utils/getFolderStructure.js +1 -1
  73. package/dist/src/utils/getFolderStructure.js.map +1 -1
  74. package/dist/src/utils/llm-edit-fixer.js +10 -1
  75. package/dist/src/utils/llm-edit-fixer.js.map +1 -1
  76. package/dist/src/utils/memoryDiscovery.d.ts +1 -1
  77. package/dist/src/utils/memoryDiscovery.js +1 -1
  78. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  79. package/dist/src/utils/memoryImportProcessor.js +13 -20
  80. package/dist/src/utils/memoryImportProcessor.js.map +1 -1
  81. package/dist/src/utils/retry.d.ts +5 -1
  82. package/dist/src/utils/retry.js +20 -5
  83. package/dist/src/utils/retry.js.map +1 -1
  84. package/dist/src/utils/schemaValidator.js +11 -1
  85. package/dist/src/utils/schemaValidator.js.map +1 -1
  86. package/dist/src/utils/shell-utils.d.ts +1 -0
  87. package/dist/src/utils/shell-utils.js +6 -2
  88. package/dist/src/utils/shell-utils.js.map +1 -1
  89. package/dist/src/utils/thoughtUtils.d.ts +21 -0
  90. package/dist/src/utils/thoughtUtils.js +39 -0
  91. package/dist/src/utils/thoughtUtils.js.map +1 -0
  92. package/dist/src/utils/tool-utils.js +2 -2
  93. package/dist/src/utils/tool-utils.js.map +1 -1
  94. package/package.json +2 -2
package/README.md CHANGED
@@ -1,244 +0,0 @@
1
- # LLxprt Code
2
-
3
- [![LLxprt Code CI](https://github.com/vybestack/llxprt-code/actions/workflows/ci.yml/badge.svg)](https://github.com/vybestack/llxprt-code/actions/workflows/ci.yml)
4
-  [![Mentioned in Awesome Gemini CLI](https://awesome.re/mentioned-badge.svg)](https://github.com/Piebald-AI/awesome-gemini-cli) [![Discord Server](https://dcbadge.limes.pink/api/server/https://discord.gg/Wc6dZqWWYv?style=flat)](https://discord.gg/Wc6dZqWWYv) ![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/vybestack/llxprt-code?utm_source=oss&utm_medium=github&utm_campaign=vybestack%2Fllxprt-code&labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviews)
5
-
6
- ![LLxprt Code Screenshot](./docs/assets/llxprt-screenshot.png)
7
-
8
- **AI-powered coding assistant that works with any LLM provider.** Command-line interface for querying and editing codebases, generating applications, and automating development workflows.
9
-
10
- ## Free & Subscription Options
11
-
12
- Get started immediately with powerful LLM options:
13
-
14
- ```bash
15
- # Free Gemini models
16
- /auth gemini enable
17
- /provider gemini
18
- /model gemini-2.5-flash
19
-
20
- # Free Qwen models
21
- /auth qwen enable
22
- /provider qwen
23
- /model qwen-3-coder
24
-
25
- # Your Claude Pro / Max subscription
26
- /auth anthropic enable
27
- /provider anthropic
28
- /model claude-sonnet-4-5
29
- ```
30
-
31
- ## Why Choose LLxprt Code?
32
-
33
- - **Free Tier Support**: Start coding immediately with Gemini, Qwen, or your existing Claude account
34
- - **Provider Flexibility**: Switch between any Anthropic, Gemini, or OpenAI-compatible provider
35
- - **Top Open Models**: Works seamlessly with GLM 4.6, MiniMax-2, and Qwen 3 Coder
36
- - **Local Models**: Run models locally with LM Studio, llama.cpp for complete privacy
37
- - **Privacy First**: No telemetry by default, local processing available
38
- - **Subagent Flexibility**: Create agents with different models, providers, or settings
39
- - **[ACTION] Real-time**: Interactive REPL with beautiful themes
40
- - **Zed Integration**: Native Zed editor integration for seamless workflow
41
-
42
- ```bash
43
- # Install and get started
44
- npm install -g @vybestack/llxprt-code
45
- llxprt
46
-
47
- # Try without installing
48
- npx @vybestack/llxprt-code --provider synthetic --model hf:zai-org/GLM-4.6 --keyfile ~/.synthetic_key "simplify the README.md"
49
- ```
50
-
51
- ## What is LLxprt Code?
52
-
53
- LLxprt Code is a command-line AI assistant designed for developers who want powerful LLM capabilities without leaving their terminal. Unlike GitHub Copilot or ChatGPT, LLxprt Code works with **any provider** and can run **locally** for complete privacy.
54
-
55
- **Key differences:**
56
-
57
- - **Open source & community driven**: Not locked into proprietary ecosystems
58
- - **Provider agnostic**: Not locked into one AI service
59
- - **Local-first**: Run entirely offline if needed
60
- - **Developer-centric**: Built specifically for coding workflows
61
- - **Terminal native**: Designed for CLI workflows, not web interfaces
62
-
63
- ## Quick Start
64
-
65
- 1. **Prerequisites:** Node.js 20+ installed
66
- 2. **Install:**
67
- ```bash
68
- npm install -g @vybestack/llxprt-code
69
- # Or try without installing:
70
- npx @vybestack/llxprt-code
71
- ```
72
- 3. **Run:** `llxprt`
73
- 4. **Choose provider:** Use `/provider` to select your preferred LLM service
74
- 5. **Start coding:** Ask questions, generate code, or analyze projects
75
-
76
- **First session example:**
77
-
78
- ```bash
79
- cd your-project/
80
- llxprt
81
- > Explain the architecture of this codebase and suggest improvements
82
- > Create a test file for the user authentication module
83
- > Help me debug this error: [paste error message]
84
- ```
85
-
86
- ## Key Features
87
-
88
- - **Free & Subscription Options** - Gemini, Qwen (free), Claude Pro/Max (subscription)
89
- - **Extensive Provider Support** - Any Anthropic, Gemini, or OpenAI-compatible provider [**Provider Guide →**](./docs/providers/quick-reference.md)
90
- - **Top Open Models** - GLM 4.6, MiniMax-2, Qwen 3 Coder
91
- - **Local Model Support** - LM Studio, llama.cpp, Ollama for complete privacy
92
- - **Profile System** - Save provider configurations and model settings
93
- - **Advanced Subagents** - Isolated AI assistants with different models/providers
94
- - **MCP Integration** - Connect to external tools and services
95
- - **Beautiful Terminal UI** - Multiple themes with syntax highlighting
96
-
97
- ## Interactive vs Non-Interactive Workflows
98
-
99
- **Interactive Mode (REPL):**
100
- Perfect for exploration, rapid prototyping, and iterative development:
101
-
102
- ```bash
103
- # Start interactive session
104
- llxprt
105
-
106
- > Explore this codebase and suggest improvements
107
- > Create a REST API endpoint with tests
108
- > Debug this authentication issue
109
- > Optimize this database query
110
- ```
111
-
112
- **Non-Interactive Mode:**
113
- Ideal for automation, CI/CD, and scripted workflows:
114
-
115
- ```bash
116
- # Single command with immediate response
117
- llxprt --profile-load zai-glm46 "Refactor this function for better readability"
118
- llxprt "Generate unit tests for payment module" > tests/payment.test.js
119
- ```
120
-
121
- ## Top Open Weight Models
122
-
123
- LLxprt Code works seamlessly with the best open-weight models:
124
-
125
- ### GLM 4.6
126
-
127
- - **Context Window**: 200,000 tokens
128
- - **Architecture**: Mixture-of-Experts with 355B total parameters (32B active)
129
- - **Strengths**: Coding, multi-step planning, tool integration
130
- - **15% fewer tokens** for equivalent tasks vs previous generation
131
-
132
- ### MiniMax-2
133
-
134
- - **Context Window**: ~204,800 tokens
135
- - **Architecture**: MoE with 230B total parameters (10B active)
136
- - **Strengths**: Coding workflows, multi-step agents, tool calling
137
- - **Cost**: Only 8% of Claude Sonnet, ~2x faster
138
-
139
- ### Qwen 3 Coder
140
-
141
- - **Context Window**: 256,000 tokens (extendable to 1M)
142
- - **Architecture**: MoE with 480B total parameters (35B active)
143
- - **Strengths**: Agentic coding, browser automation, tool usage
144
- - **Performance**: State-of-the-art on SWE-bench Verified (69.6%)
145
-
146
- ## Local Models
147
-
148
- Run models completely offline for maximum privacy:
149
-
150
- ```bash
151
- # With LM Studio
152
- /provider openai
153
- /baseurl http://localhost:1234/v1/
154
- /model your-local-model
155
-
156
- # With Ollama
157
- /provider ollama
158
- /model codellama:13b
159
- ```
160
-
161
- Supported local providers:
162
-
163
- - **LM Studio**: Easy Windows/Mac/Linux setup
164
- - **llama.cpp**: Maximum performance and control
165
- - **Ollama**: Simple model management
166
- - **Any OpenAI-compatible API**: Full flexibility
167
-
168
- ## Advanced Subagents
169
-
170
- Create specialized AI assistants with isolated contexts and different configurations:
171
-
172
- ```bash
173
- # Subagents run with custom profiles and tool access
174
- # Access via the commands interface
175
- /subagent list
176
- /subagent create <name>
177
- ```
178
-
179
- Each subagent can be configured with:
180
-
181
- - **Different providers** (Gemini vs Anthropic vs Qwen vs Local)
182
- - **Different models** (Flash vs Sonnet vs GLM 4.6 vs Custom)
183
- - **Different tool access** (Restrict or allow specific tools)
184
- - **Different settings** (Temperature, timeouts, max turns)
185
- - **Isolated runtime context** (No memory or state crossover)
186
-
187
- Subagents are designed for:
188
-
189
- - **Specialized tasks** (Code review, debugging, documentation)
190
- - **Different expertise areas** (Frontend vs Backend vs DevOps)
191
- - **Tool-limited environments** (Read-only analysis vs Full development)
192
- - **Experimental configurations** (Testing new models or settings)
193
-
194
- **[Full Subagent Documentation →](./docs/subagents.md)**
195
-
196
- ## Zed Integration
197
-
198
- Native Zed editor support for seamless development workflow:
199
-
200
- ```bash
201
- # Install Zed extension
202
- zed:install llxprt-code
203
-
204
- # Use within Zed
205
- # (See docs for Zed integration setup)
206
- ```
207
-
208
- Features:
209
-
210
- - **In-editor chat**: Direct AI interaction without leaving Zed
211
- - **Code selection**: Ask about specific code selections
212
- - **Inline suggestions**: Get AI help while typing
213
- - **Project awareness**: Full context of your open workspace
214
-
215
- ** [Zed Integration Guide →](./docs/zed-integration.md)**
216
-
217
- ** [Complete Provider Guide →](./docs/cli/providers.md)**
218
-
219
- ## Advanced Features
220
-
221
- - **Settings & Profiles**: Fine-tune model parameters and save configurations
222
- - **Subagents**: Create specialized assistants for different tasks
223
- - **MCP Servers**: Connect external tools and data sources
224
- - **Checkpointing**: Save and resume complex conversations
225
- - **IDE Integration**: Connect to VS Code and other editors
226
-
227
- ** [Full Documentation →](./docs/index.md)**
228
-
229
- ## Migration & Resources
230
-
231
- - **From Gemini CLI**: [Migration Guide](./docs/gemini-cli-tips.md)
232
- - **Local Models Setup**: [Local Models Guide](./docs/local-models.md)
233
- - **Command Reference**: [CLI Commands](./docs/cli/commands.md)
234
- - **Troubleshooting**: [Common Issues](./docs/troubleshooting.md)
235
-
236
- ## Privacy & Terms
237
-
238
- LLxprt Code does not collect telemetry by default. Your data stays with you unless you choose to send it to external AI providers.
239
-
240
- When using external services, their respective terms of service apply:
241
-
242
- - [OpenAI Terms](https://openai.com/policies/terms-of-use)
243
- - [Anthropic Terms](https://www.anthropic.com/legal/terms)
244
- - [Google Terms](https://policies.google.com/terms)
@@ -111,14 +111,14 @@ export declare const AuthStatusSchema: z.ZodObject<{
111
111
  expiresIn: z.ZodOptional<z.ZodNumber>;
112
112
  oauthEnabled: z.ZodOptional<z.ZodBoolean>;
113
113
  }, "strip", z.ZodTypeAny, {
114
- provider: string;
115
114
  authType: "none" | "api-key" | "oauth";
115
+ provider: string;
116
116
  authenticated: boolean;
117
117
  expiresIn?: number | undefined;
118
118
  oauthEnabled?: boolean | undefined;
119
119
  }, {
120
- provider: string;
121
120
  authType: "none" | "api-key" | "oauth";
121
+ provider: string;
122
122
  authenticated: boolean;
123
123
  expiresIn?: number | undefined;
124
124
  oauthEnabled?: boolean | undefined;
@@ -99,13 +99,21 @@ export interface GeminiCLIExtension {
99
99
  version: string;
100
100
  isActive: boolean;
101
101
  path: string;
102
+ installMetadata?: ExtensionInstallMetadata;
102
103
  }
103
- export interface FileFilteringOptions {
104
- respectGitIgnore: boolean;
105
- respectLlxprtIgnore: boolean;
104
+ export interface ExtensionInstallMetadata {
105
+ source: string;
106
+ type: 'git' | 'local' | 'link' | 'github-release';
107
+ releaseTag?: string;
108
+ ref?: string;
109
+ autoUpdate?: boolean;
106
110
  }
107
- export declare const DEFAULT_MEMORY_FILE_FILTERING_OPTIONS: FileFilteringOptions;
108
- export declare const DEFAULT_FILE_FILTERING_OPTIONS: FileFilteringOptions;
111
+ import type { FileFilteringOptions } from './constants.js';
112
+ import { DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, DEFAULT_FILE_FILTERING_OPTIONS } from './constants.js';
113
+ export type { FileFilteringOptions };
114
+ export { DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, DEFAULT_FILE_FILTERING_OPTIONS, };
115
+ export declare const DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD = 4000000;
116
+ export declare const DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES = 1000;
109
117
  export declare class MCPServerConfig {
110
118
  readonly command?: string | undefined;
111
119
  readonly args?: string[] | undefined;
@@ -123,11 +131,14 @@ export declare class MCPServerConfig {
123
131
  readonly extensionName?: string | undefined;
124
132
  readonly oauth?: MCPOAuthConfig | undefined;
125
133
  readonly authProviderType?: AuthProviderType | undefined;
126
- constructor(command?: string | undefined, args?: string[] | undefined, env?: Record<string, string> | undefined, cwd?: string | undefined, url?: string | undefined, httpUrl?: string | undefined, headers?: Record<string, string> | undefined, tcp?: string | undefined, timeout?: number | undefined, trust?: boolean | undefined, description?: string | undefined, includeTools?: string[] | undefined, excludeTools?: string[] | undefined, extensionName?: string | undefined, oauth?: MCPOAuthConfig | undefined, authProviderType?: AuthProviderType | undefined);
134
+ readonly targetAudience?: string | undefined;
135
+ readonly targetServiceAccount?: string | undefined;
136
+ constructor(command?: string | undefined, args?: string[] | undefined, env?: Record<string, string> | undefined, cwd?: string | undefined, url?: string | undefined, httpUrl?: string | undefined, headers?: Record<string, string> | undefined, tcp?: string | undefined, timeout?: number | undefined, trust?: boolean | undefined, description?: string | undefined, includeTools?: string[] | undefined, excludeTools?: string[] | undefined, extensionName?: string | undefined, oauth?: MCPOAuthConfig | undefined, authProviderType?: AuthProviderType | undefined, targetAudience?: string | undefined, targetServiceAccount?: string | undefined);
127
137
  }
128
138
  export declare enum AuthProviderType {
129
139
  DYNAMIC_DISCOVERY = "dynamic_discovery",
130
- GOOGLE_CREDENTIALS = "google_credentials"
140
+ GOOGLE_CREDENTIALS = "google_credentials",
141
+ SERVICE_ACCOUNT_IMPERSONATION = "service_account_impersonation"
131
142
  }
132
143
  export interface SandboxConfig {
133
144
  command: 'docker' | 'podman' | 'sandbox-exec';
@@ -209,6 +220,9 @@ export interface ConfigParameters {
209
220
  useSmartEdit?: boolean;
210
221
  settingsService?: SettingsService;
211
222
  policyEngineConfig?: PolicyEngineConfig;
223
+ truncateToolOutputThreshold?: number;
224
+ truncateToolOutputLines?: number;
225
+ enableToolOutputTruncation?: boolean;
212
226
  }
213
227
  export declare class Config {
214
228
  private toolRegistry;
@@ -268,6 +282,7 @@ export declare class Config {
268
282
  private profileManager?;
269
283
  private subagentManager?;
270
284
  private subagentSchedulerFactory?;
285
+ private allPotentialTools;
271
286
  setProviderManager(providerManager: ProviderManager): void;
272
287
  getProviderManager(): ProviderManager | undefined;
273
288
  setProfileManager(manager: ProfileManager | undefined): void;
@@ -297,6 +312,9 @@ export declare class Config {
297
312
  private readonly useSmartEdit;
298
313
  private readonly messageBus;
299
314
  private readonly policyEngine;
315
+ truncateToolOutputThreshold: number;
316
+ truncateToolOutputLines: number;
317
+ enableToolOutputTruncation: boolean;
300
318
  constructor(params: ConfigParameters);
301
319
  /**
302
320
  * Must only be called once, throws if called again.
@@ -312,7 +330,7 @@ export declare class Config {
312
330
  resetModelToDefault(): void;
313
331
  setFallbackMode(active: boolean): void;
314
332
  getMaxSessionTurns(): number;
315
- getEmbeddingModel(): string;
333
+ getEmbeddingModel(): string | undefined;
316
334
  getSandbox(): SandboxConfig | undefined;
317
335
  isRestrictiveSandbox(): boolean;
318
336
  getTargetDir(): string;
@@ -450,5 +468,37 @@ export declare class Config {
450
468
  fileCount: number;
451
469
  }>;
452
470
  createToolRegistry(): Promise<ToolRegistry>;
471
+ /**
472
+ * Get all potential tools (both registered and unregistered) for settings UI
473
+ */
474
+ getAllPotentialTools(): {
475
+ toolClass: any;
476
+ toolName: string;
477
+ displayName: string;
478
+ isRegistered: boolean;
479
+ reason?: string;
480
+ args: any[];
481
+ }[];
482
+ /**
483
+ * Get tool registry information with registered/unregistered separation
484
+ */
485
+ getToolRegistryInfo(): {
486
+ registered: {
487
+ toolClass: any;
488
+ toolName: string;
489
+ displayName: string;
490
+ isRegistered: boolean;
491
+ reason?: string;
492
+ args: any[];
493
+ }[];
494
+ unregistered: {
495
+ toolClass: any;
496
+ toolName: string;
497
+ displayName: string;
498
+ isRegistered: boolean;
499
+ reason?: string;
500
+ args: any[];
501
+ }[];
502
+ };
453
503
  }
454
504
  export { DEFAULT_GEMINI_FLASH_MODEL };
@@ -39,7 +39,7 @@ import { loadServerHierarchicalMemory } from '../utils/memoryDiscovery.js';
39
39
  import {
40
40
  // TELEMETRY: Re-enabled for local file logging only
41
41
  initializeTelemetry, DEFAULT_TELEMETRY_TARGET, DEFAULT_OTLP_ENDPOINT, logCliConfiguration, StartSessionEvent, } from '../telemetry/index.js';
42
- import { DEFAULT_GEMINI_EMBEDDING_MODEL, DEFAULT_GEMINI_FLASH_MODEL, } from './models.js';
42
+ import { DEFAULT_GEMINI_FLASH_MODEL } from './models.js';
43
43
  import { shouldAttemptBrowserLaunch } from '../utils/browser.js';
44
44
  import { IdeClient } from '../ide/ide-client.js';
45
45
  import { ideContext } from '../ide/ideContext.js';
@@ -59,16 +59,10 @@ export var ApprovalMode;
59
59
  ApprovalMode["AUTO_EDIT"] = "autoEdit";
60
60
  ApprovalMode["YOLO"] = "yolo";
61
61
  })(ApprovalMode || (ApprovalMode = {}));
62
- // For memory files
63
- export const DEFAULT_MEMORY_FILE_FILTERING_OPTIONS = {
64
- respectGitIgnore: false,
65
- respectLlxprtIgnore: true,
66
- };
67
- // For all other files
68
- export const DEFAULT_FILE_FILTERING_OPTIONS = {
69
- respectGitIgnore: true,
70
- respectLlxprtIgnore: true,
71
- };
62
+ import { DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, DEFAULT_FILE_FILTERING_OPTIONS, } from './constants.js';
63
+ export { DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, DEFAULT_FILE_FILTERING_OPTIONS, };
64
+ export const DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD = 4_000_000;
65
+ export const DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES = 1000;
72
66
  export class MCPServerConfig {
73
67
  command;
74
68
  args;
@@ -86,6 +80,8 @@ export class MCPServerConfig {
86
80
  extensionName;
87
81
  oauth;
88
82
  authProviderType;
83
+ targetAudience;
84
+ targetServiceAccount;
89
85
  constructor(
90
86
  // For stdio transport
91
87
  command, args, env, cwd,
@@ -100,7 +96,12 @@ export class MCPServerConfig {
100
96
  // Metadata
101
97
  description, includeTools, excludeTools, extensionName,
102
98
  // OAuth configuration
103
- oauth, authProviderType) {
99
+ oauth, authProviderType,
100
+ // Service Account Configuration
101
+ /* targetAudience format: CLIENT_ID.apps.googleusercontent.com */
102
+ targetAudience,
103
+ /* targetServiceAccount format: <service-account-name>@<project-num>.iam.gserviceaccount.com */
104
+ targetServiceAccount) {
104
105
  this.command = command;
105
106
  this.args = args;
106
107
  this.env = env;
@@ -117,12 +118,15 @@ export class MCPServerConfig {
117
118
  this.extensionName = extensionName;
118
119
  this.oauth = oauth;
119
120
  this.authProviderType = authProviderType;
121
+ this.targetAudience = targetAudience;
122
+ this.targetServiceAccount = targetServiceAccount;
120
123
  }
121
124
  }
122
125
  export var AuthProviderType;
123
126
  (function (AuthProviderType) {
124
127
  AuthProviderType["DYNAMIC_DISCOVERY"] = "dynamic_discovery";
125
128
  AuthProviderType["GOOGLE_CREDENTIALS"] = "google_credentials";
129
+ AuthProviderType["SERVICE_ACCOUNT_IMPERSONATION"] = "service_account_impersonation";
126
130
  })(AuthProviderType || (AuthProviderType = {}));
127
131
  export class Config {
128
132
  toolRegistry;
@@ -182,6 +186,8 @@ export class Config {
182
186
  profileManager;
183
187
  subagentManager;
184
188
  subagentSchedulerFactory;
189
+ // Track all potential tools for settings UI
190
+ allPotentialTools = [];
185
191
  setProviderManager(providerManager) {
186
192
  this.providerManager = providerManager;
187
193
  }
@@ -227,6 +233,9 @@ export class Config {
227
233
  useSmartEdit;
228
234
  messageBus;
229
235
  policyEngine;
236
+ truncateToolOutputThreshold;
237
+ truncateToolOutputLines;
238
+ enableToolOutputTruncation;
230
239
  constructor(params) {
231
240
  const providedSettingsService = params.settingsService;
232
241
  if (providedSettingsService) {
@@ -261,8 +270,8 @@ export class Config {
261
270
  });
262
271
  }
263
272
  this.sessionId = params.sessionId;
264
- this.embeddingModel =
265
- params.embeddingModel ?? DEFAULT_GEMINI_EMBEDDING_MODEL;
273
+ // Embedding models not currently configured for llxprt-code
274
+ this.embeddingModel = params.embeddingModel;
266
275
  this.fileSystemService = new StandardFileSystemService();
267
276
  this.sandbox = params.sandbox;
268
277
  this.targetDir = path.resolve(params.targetDir);
@@ -340,6 +349,12 @@ export class Config {
340
349
  this.useRipgrep = params.useRipgrep ?? false;
341
350
  this.shouldUseNodePtyShell = params.shouldUseNodePtyShell ?? false;
342
351
  this.skipNextSpeakerCheck = params.skipNextSpeakerCheck ?? false;
352
+ this.truncateToolOutputThreshold =
353
+ params.truncateToolOutputThreshold ??
354
+ DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD;
355
+ this.truncateToolOutputLines =
356
+ params.truncateToolOutputLines ?? DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES;
357
+ this.enableToolOutputTruncation = params.enableToolOutputTruncation ?? true;
343
358
  this.useSmartEdit = params.useSmartEdit ?? false;
344
359
  this.extensionManagement = params.extensionManagement ?? false;
345
360
  this.storage = new Storage(this.targetDir);
@@ -1118,6 +1133,7 @@ export class Config {
1118
1133
  const coreTools = effectiveCoreTools;
1119
1134
  const excludeTools = this.getExcludeTools() || [];
1120
1135
  let isEnabled = true; // Enabled by default if coreTools is not set.
1136
+ let reason;
1121
1137
  if (coreTools) {
1122
1138
  isEnabled = coreTools.some((tool) => tool === className ||
1123
1139
  tool === toolName ||
@@ -1127,10 +1143,27 @@ export class Config {
1127
1143
  const isExcluded = excludeTools.some((tool) => tool === className || tool === toolName);
1128
1144
  if (isExcluded) {
1129
1145
  isEnabled = false;
1146
+ reason = 'excluded by excludeTools setting';
1130
1147
  }
1148
+ // Record tool attempt for settings UI
1149
+ const toolRecord = {
1150
+ toolClass: ToolClass,
1151
+ toolName: className,
1152
+ displayName: toolName,
1153
+ isRegistered: false,
1154
+ reason,
1155
+ args,
1156
+ };
1131
1157
  if (isEnabled) {
1132
1158
  registry.registerTool(new ToolClass(...args));
1159
+ toolRecord.isRegistered = true;
1160
+ toolRecord.reason = undefined;
1133
1161
  }
1162
+ else if (!reason) {
1163
+ reason = 'not included in coreTools configuration';
1164
+ toolRecord.reason = reason;
1165
+ }
1166
+ this.allPotentialTools.push(toolRecord);
1134
1167
  };
1135
1168
  registerCoreTool(LSTool, this);
1136
1169
  registerCoreTool(ReadFileTool, this);
@@ -1171,19 +1204,68 @@ export class Config {
1171
1204
  subagentManager = new SubagentManager(subagentsDir, profileManager);
1172
1205
  this.setSubagentManager(subagentManager);
1173
1206
  }
1207
+ // Handle TaskTool with dependency checking
1208
+ const taskToolArgs = {
1209
+ profileManager,
1210
+ subagentManager,
1211
+ schedulerFactoryProvider: () => this.getInteractiveSubagentSchedulerFactory(),
1212
+ };
1174
1213
  if (profileManager && subagentManager) {
1175
- registerCoreTool(TaskTool, this, {
1176
- profileManager,
1177
- subagentManager,
1178
- schedulerFactoryProvider: () => this.getInteractiveSubagentSchedulerFactory(),
1179
- });
1214
+ registerCoreTool(TaskTool, this, taskToolArgs);
1215
+ }
1216
+ else {
1217
+ // Record TaskTool as unregistered due to missing dependencies
1218
+ const taskToolRecord = {
1219
+ toolClass: TaskTool,
1220
+ toolName: 'TaskTool',
1221
+ displayName: TaskTool.Name || 'TaskTool',
1222
+ isRegistered: false,
1223
+ reason: !profileManager && !subagentManager
1224
+ ? 'requires profile manager and subagent manager'
1225
+ : !profileManager
1226
+ ? 'requires profile manager'
1227
+ : 'requires subagent manager',
1228
+ args: [this, taskToolArgs],
1229
+ };
1230
+ this.allPotentialTools.push(taskToolRecord);
1180
1231
  }
1181
- registerCoreTool(ListSubagentsTool, this, {
1232
+ // Handle ListSubagentsTool with dependency checking
1233
+ const listSubagentsArgs = {
1182
1234
  getSubagentManager: () => this.getSubagentManager(),
1183
- });
1235
+ };
1236
+ if (subagentManager) {
1237
+ registerCoreTool(ListSubagentsTool, this, listSubagentsArgs);
1238
+ }
1239
+ else {
1240
+ // Record ListSubagentsTool as unregistered due to missing subagent manager
1241
+ const listSubagentsRecord = {
1242
+ toolClass: ListSubagentsTool,
1243
+ toolName: 'ListSubagentsTool',
1244
+ displayName: ListSubagentsTool.Name || 'ListSubagentsTool',
1245
+ isRegistered: false,
1246
+ reason: 'requires subagent manager',
1247
+ args: [this, listSubagentsArgs],
1248
+ };
1249
+ this.allPotentialTools.push(listSubagentsRecord);
1250
+ }
1184
1251
  await registry.discoverAllTools();
1185
1252
  return registry;
1186
1253
  }
1254
+ /**
1255
+ * Get all potential tools (both registered and unregistered) for settings UI
1256
+ */
1257
+ getAllPotentialTools() {
1258
+ return this.allPotentialTools;
1259
+ }
1260
+ /**
1261
+ * Get tool registry information with registered/unregistered separation
1262
+ */
1263
+ getToolRegistryInfo() {
1264
+ return {
1265
+ registered: this.allPotentialTools.filter((t) => t.isRegistered),
1266
+ unregistered: this.allPotentialTools.filter((t) => !t.isRegistered),
1267
+ };
1268
+ }
1187
1269
  }
1188
1270
  // Export model constants for use in CLI
1189
1271
  export { DEFAULT_GEMINI_FLASH_MODEL };