@vybestack/llxprt-code-core 0.5.0-nightly.251123.79a9619f1 → 0.5.0-nightly.251125.6be1c4fa2

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 (135) hide show
  1. package/README.md +0 -244
  2. package/dist/src/agents/codebase-investigator.d.ts +46 -0
  3. package/dist/src/agents/codebase-investigator.js +136 -0
  4. package/dist/src/agents/codebase-investigator.js.map +1 -0
  5. package/dist/src/agents/executor.d.ts +92 -0
  6. package/dist/src/agents/executor.js +624 -0
  7. package/dist/src/agents/executor.js.map +1 -0
  8. package/dist/src/agents/invocation.d.ts +45 -0
  9. package/dist/src/agents/invocation.js +106 -0
  10. package/dist/src/agents/invocation.js.map +1 -0
  11. package/dist/src/agents/registry.d.ts +36 -0
  12. package/dist/src/agents/registry.js +61 -0
  13. package/dist/src/agents/registry.js.map +1 -0
  14. package/dist/src/agents/types.d.ts +145 -0
  15. package/dist/src/agents/types.js +17 -0
  16. package/dist/src/agents/types.js.map +1 -0
  17. package/dist/src/agents/utils.d.ts +15 -0
  18. package/dist/src/agents/utils.js +27 -0
  19. package/dist/src/agents/utils.js.map +1 -0
  20. package/dist/src/auth/types.d.ts +2 -2
  21. package/dist/src/config/config.d.ts +36 -8
  22. package/dist/src/config/config.js +63 -16
  23. package/dist/src/config/config.js.map +1 -1
  24. package/dist/src/config/constants.d.ts +11 -0
  25. package/dist/src/config/constants.js +16 -0
  26. package/dist/src/config/constants.js.map +1 -0
  27. package/dist/src/core/baseLlmClient.d.ts +77 -0
  28. package/dist/src/core/baseLlmClient.js +175 -0
  29. package/dist/src/core/baseLlmClient.js.map +1 -0
  30. package/dist/src/core/client.d.ts +12 -0
  31. package/dist/src/core/client.js +75 -109
  32. package/dist/src/core/client.js.map +1 -1
  33. package/dist/src/core/coreToolScheduler.d.ts +2 -0
  34. package/dist/src/core/coreToolScheduler.js +24 -4
  35. package/dist/src/core/coreToolScheduler.js.map +1 -1
  36. package/dist/src/core/geminiChat.d.ts +8 -1
  37. package/dist/src/core/geminiChat.js +28 -21
  38. package/dist/src/core/geminiChat.js.map +1 -1
  39. package/dist/src/core/turn.d.ts +1 -4
  40. package/dist/src/core/turn.js +2 -12
  41. package/dist/src/core/turn.js.map +1 -1
  42. package/dist/src/ide/ide-client.js +3 -3
  43. package/dist/src/index.d.ts +4 -0
  44. package/dist/src/index.js +9 -0
  45. package/dist/src/index.js.map +1 -1
  46. package/dist/src/mcp/oauth-provider.js +2 -0
  47. package/dist/src/mcp/oauth-provider.js.map +1 -1
  48. package/dist/src/mcp/sa-impersonation-provider.d.ts +33 -0
  49. package/dist/src/mcp/sa-impersonation-provider.js +130 -0
  50. package/dist/src/mcp/sa-impersonation-provider.js.map +1 -0
  51. package/dist/src/mcp/token-storage/hybrid-token-storage.js +1 -1
  52. package/dist/src/providers/anthropic/AnthropicProvider.js +2 -2
  53. package/dist/src/providers/anthropic/AnthropicProvider.js.map +1 -1
  54. package/dist/src/providers/openai/OpenAIProvider.js +4 -4
  55. package/dist/src/providers/openai/OpenAIProvider.js.map +1 -1
  56. package/dist/src/runtime/createAgentRuntimeContext.js +8 -7
  57. package/dist/src/runtime/createAgentRuntimeContext.js.map +1 -1
  58. package/dist/src/services/fileSystemService.d.ts +9 -0
  59. package/dist/src/services/fileSystemService.js +12 -1
  60. package/dist/src/services/fileSystemService.js.map +1 -1
  61. package/dist/src/services/shellExecutionService.d.ts +46 -3
  62. package/dist/src/services/shellExecutionService.js +189 -55
  63. package/dist/src/services/shellExecutionService.js.map +1 -1
  64. package/dist/src/storage/sessionTypes.d.ts +27 -0
  65. package/dist/src/storage/sessionTypes.js +10 -0
  66. package/dist/src/storage/sessionTypes.js.map +1 -0
  67. package/dist/src/telemetry/constants.d.ts +8 -0
  68. package/dist/src/telemetry/constants.js +8 -0
  69. package/dist/src/telemetry/constants.js.map +1 -1
  70. package/dist/src/telemetry/loggers.d.ts +9 -1
  71. package/dist/src/telemetry/loggers.js +154 -2
  72. package/dist/src/telemetry/loggers.js.map +1 -1
  73. package/dist/src/telemetry/metrics.d.ts +5 -0
  74. package/dist/src/telemetry/metrics.js +4 -0
  75. package/dist/src/telemetry/metrics.js.map +1 -1
  76. package/dist/src/telemetry/types.d.ts +62 -1
  77. package/dist/src/telemetry/types.js +92 -0
  78. package/dist/src/telemetry/types.js.map +1 -1
  79. package/dist/src/test-utils/config.js +14 -0
  80. package/dist/src/test-utils/config.js.map +1 -1
  81. package/dist/src/tools/glob.d.ts +3 -2
  82. package/dist/src/tools/glob.js +1 -1
  83. package/dist/src/tools/glob.js.map +1 -1
  84. package/dist/src/tools/ls.d.ts +1 -1
  85. package/dist/src/tools/ls.js +1 -1
  86. package/dist/src/tools/ls.js.map +1 -1
  87. package/dist/src/tools/mcp-client.d.ts +9 -18
  88. package/dist/src/tools/mcp-client.js +50 -97
  89. package/dist/src/tools/mcp-client.js.map +1 -1
  90. package/dist/src/tools/memoryTool.d.ts +1 -0
  91. package/dist/src/tools/memoryTool.js +2 -0
  92. package/dist/src/tools/memoryTool.js.map +1 -1
  93. package/dist/src/tools/modifiable-tool.d.ts +1 -1
  94. package/dist/src/tools/modifiable-tool.js +9 -1
  95. package/dist/src/tools/modifiable-tool.js.map +1 -1
  96. package/dist/src/tools/shell.js +66 -5
  97. package/dist/src/tools/shell.js.map +1 -1
  98. package/dist/src/tools/smart-edit.d.ts +19 -0
  99. package/dist/src/tools/smart-edit.js +105 -3
  100. package/dist/src/tools/smart-edit.js.map +1 -1
  101. package/dist/src/tools/tool-error.d.ts +1 -0
  102. package/dist/src/tools/tool-error.js +1 -0
  103. package/dist/src/tools/tool-error.js.map +1 -1
  104. package/dist/src/tools/tools.d.ts +2 -1
  105. package/dist/src/tools/tools.js.map +1 -1
  106. package/dist/src/utils/bfsFileSearch.d.ts +2 -2
  107. package/dist/src/utils/editor.js +5 -3
  108. package/dist/src/utils/editor.js.map +1 -1
  109. package/dist/src/utils/getFolderStructure.d.ts +2 -2
  110. package/dist/src/utils/getFolderStructure.js +1 -1
  111. package/dist/src/utils/getFolderStructure.js.map +1 -1
  112. package/dist/src/utils/llm-edit-fixer.js +10 -1
  113. package/dist/src/utils/llm-edit-fixer.js.map +1 -1
  114. package/dist/src/utils/memoryDiscovery.d.ts +2 -1
  115. package/dist/src/utils/memoryDiscovery.js +3 -2
  116. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  117. package/dist/src/utils/memoryImportProcessor.js +13 -20
  118. package/dist/src/utils/memoryImportProcessor.js.map +1 -1
  119. package/dist/src/utils/retry.d.ts +5 -1
  120. package/dist/src/utils/retry.js +31 -16
  121. package/dist/src/utils/retry.js.map +1 -1
  122. package/dist/src/utils/schemaValidator.js +11 -1
  123. package/dist/src/utils/schemaValidator.js.map +1 -1
  124. package/dist/src/utils/shell-utils.d.ts +1 -0
  125. package/dist/src/utils/shell-utils.js +6 -2
  126. package/dist/src/utils/shell-utils.js.map +1 -1
  127. package/dist/src/utils/terminalSerializer.d.ts +28 -0
  128. package/dist/src/utils/terminalSerializer.js +418 -0
  129. package/dist/src/utils/terminalSerializer.js.map +1 -0
  130. package/dist/src/utils/thoughtUtils.d.ts +21 -0
  131. package/dist/src/utils/thoughtUtils.js +39 -0
  132. package/dist/src/utils/thoughtUtils.js.map +1 -0
  133. package/dist/src/utils/tool-utils.js +2 -2
  134. package/dist/src/utils/tool-utils.js.map +1 -1
  135. package/package.json +2 -2
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { Config } from '../config/config.js';
7
+ import { BaseToolInvocation, type ToolResult } from '../tools/tools.js';
8
+ import type { AgentDefinition, AgentInputs } from './types.js';
9
+ import type { MessageBus } from '../confirmation-bus/message-bus.js';
10
+ import { type z } from 'zod';
11
+ /**
12
+ * Represents a validated, executable instance of a subagent tool.
13
+ *
14
+ * This class orchestrates the execution of a defined agent by:
15
+ * 1. Initializing the {@link AgentExecutor}.
16
+ * 2. Running the agent's execution loop.
17
+ * 3. Bridging the agent's streaming activity (e.g., thoughts) to the tool's
18
+ * live output stream.
19
+ * 4. Formatting the final result into a {@link ToolResult}.
20
+ */
21
+ export declare class SubagentInvocation<TOutput extends z.ZodTypeAny> extends BaseToolInvocation<AgentInputs, ToolResult> {
22
+ private readonly definition;
23
+ private readonly config;
24
+ /**
25
+ * @param params The validated input parameters for the agent.
26
+ * @param definition The definition object that configures the agent.
27
+ * @param config The global runtime configuration.
28
+ * @param messageBus Optional message bus for policy enforcement.
29
+ */
30
+ constructor(params: AgentInputs, definition: AgentDefinition<TOutput>, config: Config, messageBus?: MessageBus);
31
+ /**
32
+ * Returns a concise, human-readable description of the invocation.
33
+ * Used for logging and display purposes.
34
+ */
35
+ getDescription(): string;
36
+ /**
37
+ * Executes the subagent.
38
+ *
39
+ * @param signal An `AbortSignal` to cancel the agent's execution.
40
+ * @param updateOutput A callback to stream intermediate output, such as the
41
+ * agent's thoughts, to the user interface.
42
+ * @returns A `Promise` that resolves with the final `ToolResult`.
43
+ */
44
+ execute(signal: AbortSignal, updateOutput?: (output: string) => void): Promise<ToolResult>;
45
+ }
@@ -0,0 +1,106 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { AgentExecutor } from './executor.js';
7
+ import { BaseToolInvocation } from '../tools/tools.js';
8
+ import { ToolErrorType } from '../tools/tool-error.js';
9
+ const INPUT_PREVIEW_MAX_LENGTH = 50;
10
+ const DESCRIPTION_MAX_LENGTH = 200;
11
+ /**
12
+ * Represents a validated, executable instance of a subagent tool.
13
+ *
14
+ * This class orchestrates the execution of a defined agent by:
15
+ * 1. Initializing the {@link AgentExecutor}.
16
+ * 2. Running the agent's execution loop.
17
+ * 3. Bridging the agent's streaming activity (e.g., thoughts) to the tool's
18
+ * live output stream.
19
+ * 4. Formatting the final result into a {@link ToolResult}.
20
+ */
21
+ export class SubagentInvocation extends BaseToolInvocation {
22
+ definition;
23
+ config;
24
+ /**
25
+ * @param params The validated input parameters for the agent.
26
+ * @param definition The definition object that configures the agent.
27
+ * @param config The global runtime configuration.
28
+ * @param messageBus Optional message bus for policy enforcement.
29
+ */
30
+ constructor(params, definition, config, messageBus) {
31
+ super(params, messageBus);
32
+ this.definition = definition;
33
+ this.config = config;
34
+ }
35
+ /**
36
+ * Returns a concise, human-readable description of the invocation.
37
+ * Used for logging and display purposes.
38
+ */
39
+ getDescription() {
40
+ const inputSummary = Object.entries(this.params)
41
+ .map(([key, value]) => {
42
+ const stringValue = typeof value === 'object' && value !== null
43
+ ? JSON.stringify(value)
44
+ : String(value);
45
+ return `${key}: ${stringValue.slice(0, INPUT_PREVIEW_MAX_LENGTH)}`;
46
+ })
47
+ .join(', ');
48
+ const description = `Running subagent '${this.definition.name}' with inputs: { ${inputSummary} }`;
49
+ return description.slice(0, DESCRIPTION_MAX_LENGTH);
50
+ }
51
+ /**
52
+ * Executes the subagent.
53
+ *
54
+ * @param signal An `AbortSignal` to cancel the agent's execution.
55
+ * @param updateOutput A callback to stream intermediate output, such as the
56
+ * agent's thoughts, to the user interface.
57
+ * @returns A `Promise` that resolves with the final `ToolResult`.
58
+ */
59
+ async execute(signal, updateOutput) {
60
+ try {
61
+ if (updateOutput) {
62
+ updateOutput('Subagent starting...\n');
63
+ }
64
+ // Create an activity callback to bridge the executor's events to the
65
+ // tool's streaming output.
66
+ const onActivity = (activity) => {
67
+ if (!updateOutput)
68
+ return;
69
+ if (activity.type === 'THOUGHT_CHUNK' &&
70
+ typeof activity.data['text'] === 'string') {
71
+ updateOutput(`🤖💭 ${activity.data['text']}`);
72
+ }
73
+ };
74
+ const executor = await AgentExecutor.create(this.definition, this.config, onActivity);
75
+ const output = await executor.run(this.params, signal);
76
+ const resultContent = `Subagent '${this.definition.name}' finished.
77
+ Termination Reason: ${output.terminate_reason}
78
+ Result:
79
+ ${output.result}`;
80
+ const displayContent = `
81
+ Subagent ${this.definition.name} Finished
82
+
83
+ Termination Reason:\n ${output.terminate_reason}
84
+
85
+ Result:
86
+ ${output.result}
87
+ `;
88
+ return {
89
+ llmContent: [{ text: resultContent }],
90
+ returnDisplay: displayContent,
91
+ };
92
+ }
93
+ catch (error) {
94
+ const errorMessage = error instanceof Error ? error.message : String(error);
95
+ return {
96
+ llmContent: `Subagent '${this.definition.name}' failed. Error: ${errorMessage}`,
97
+ returnDisplay: `Subagent Failed: ${this.definition.name}\nError: ${errorMessage}`,
98
+ error: {
99
+ message: errorMessage,
100
+ type: ToolErrorType.EXECUTION_FAILED,
101
+ },
102
+ };
103
+ }
104
+ }
105
+ }
106
+ //# sourceMappingURL=invocation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invocation.js","sourceRoot":"","sources":["../../../src/agents/invocation.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { Config } from '../config/config.js';
7
+ import type { AgentDefinition } from './types.js';
8
+ import type { z } from 'zod';
9
+ /**
10
+ * Manages the discovery, loading, validation, and registration of
11
+ * AgentDefinitions.
12
+ */
13
+ export declare class AgentRegistry {
14
+ private readonly config;
15
+ private readonly agents;
16
+ constructor(config: Config);
17
+ /**
18
+ * Discovers and loads agents.
19
+ */
20
+ initialize(): Promise<void>;
21
+ private loadBuiltInAgents;
22
+ /**
23
+ * Registers an agent definition. If an agent with the same name exists,
24
+ * it will be overwritten, respecting the precedence established by the
25
+ * initialization order.
26
+ */
27
+ protected registerAgent<TOutput extends z.ZodTypeAny>(definition: AgentDefinition<TOutput>): void;
28
+ /**
29
+ * Retrieves an agent definition by name.
30
+ */
31
+ getDefinition(name: string): AgentDefinition | undefined;
32
+ /**
33
+ * Returns all active agent definitions.
34
+ */
35
+ getAllDefinitions(): AgentDefinition[];
36
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Manages the discovery, loading, validation, and registration of
8
+ * AgentDefinitions.
9
+ */
10
+ export class AgentRegistry {
11
+ config;
12
+ // Using unknown output type for the internal map to handle generic variance correctly
13
+ // Callers will cast to specific types as needed
14
+ agents = new Map();
15
+ constructor(config) {
16
+ this.config = config;
17
+ }
18
+ /**
19
+ * Discovers and loads agents.
20
+ */
21
+ async initialize() {
22
+ this.loadBuiltInAgents();
23
+ if (this.config.getDebugMode()) {
24
+ console.log(`[AgentRegistry] Initialized with ${this.agents.size} agents.`);
25
+ }
26
+ }
27
+ loadBuiltInAgents() {
28
+ // No built-in agents registered - CodebaseInvestigatorAgent was removed
29
+ // because it hardcodes DEFAULT_GEMINI_MODEL, violating multi-provider support
30
+ }
31
+ /**
32
+ * Registers an agent definition. If an agent with the same name exists,
33
+ * it will be overwritten, respecting the precedence established by the
34
+ * initialization order.
35
+ */
36
+ registerAgent(definition) {
37
+ // Basic validation
38
+ if (!definition.name || !definition.description) {
39
+ console.warn(`[AgentRegistry] Skipping invalid agent definition. Missing name or description.`);
40
+ return;
41
+ }
42
+ if (this.agents.has(definition.name) && this.config.getDebugMode()) {
43
+ console.log(`[AgentRegistry] Overriding agent '${definition.name}'`);
44
+ }
45
+ // Cast to default AgentDefinition type for storage - callers will cast back as needed
46
+ this.agents.set(definition.name, definition);
47
+ }
48
+ /**
49
+ * Retrieves an agent definition by name.
50
+ */
51
+ getDefinition(name) {
52
+ return this.agents.get(name);
53
+ }
54
+ /**
55
+ * Returns all active agent definitions.
56
+ */
57
+ getAllDefinitions() {
58
+ return Array.from(this.agents.values());
59
+ }
60
+ }
61
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/agents/registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;GAGG;AACH,MAAM,OAAO,aAAa;IAKK;IAJ7B,sFAAsF;IACtF,gDAAgD;IAC/B,MAAM,GAAG,IAAI,GAAG,EAA2B,CAAC;IAE7D,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAEzB,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CACT,oCAAoC,IAAI,CAAC,MAAM,CAAC,IAAI,UAAU,CAC/D,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,iBAAiB;QACvB,wEAAwE;QACxE,8EAA8E;IAChF,CAAC;IAED;;;;OAIG;IACO,aAAa,CACrB,UAAoC;QAEpC,mBAAmB;QACnB,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;YAChD,OAAO,CAAC,IAAI,CACV,iFAAiF,CAClF,CAAC;YACF,OAAO;QACT,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;YACnE,OAAO,CAAC,GAAG,CAAC,qCAAqC,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC;QACvE,CAAC;QAED,sFAAsF;QACtF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,UAAwC,CAAC,CAAC;IAC7E,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,IAAY;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * @fileoverview Defines the core configuration interfaces and types for the agent architecture.
8
+ */
9
+ import type { Content, FunctionDeclaration } from '@google/genai';
10
+ import type { AnyDeclarativeTool } from '../tools/tools.js';
11
+ import { type z } from 'zod';
12
+ /**
13
+ * Describes the possible termination modes for an agent.
14
+ */
15
+ export declare enum AgentTerminateMode {
16
+ ERROR = "ERROR",
17
+ TIMEOUT = "TIMEOUT",
18
+ GOAL = "GOAL",
19
+ MAX_TURNS = "MAX_TURNS",
20
+ ABORTED = "ABORTED"
21
+ }
22
+ /**
23
+ * Represents the output structure of an agent's execution.
24
+ */
25
+ export interface OutputObject {
26
+ result: string;
27
+ terminate_reason: AgentTerminateMode;
28
+ }
29
+ /**
30
+ * Represents the validated input parameters passed to an agent upon invocation.
31
+ * Used primarily for templating the system prompt. (Replaces ContextState)
32
+ */
33
+ export type AgentInputs = Record<string, unknown>;
34
+ /**
35
+ * Structured events emitted during subagent execution for user observability.
36
+ */
37
+ export interface SubagentActivityEvent {
38
+ isSubagentActivityEvent: true;
39
+ agentName: string;
40
+ type: 'TOOL_CALL_START' | 'TOOL_CALL_END' | 'THOUGHT_CHUNK' | 'ERROR';
41
+ data: Record<string, unknown>;
42
+ }
43
+ /**
44
+ * The definition for an agent.
45
+ * @template TOutput The specific Zod schema for the agent's final output object.
46
+ */
47
+ export interface AgentDefinition<TOutput extends z.ZodTypeAny = z.ZodUnknown> {
48
+ /** Unique identifier for the agent. */
49
+ name: string;
50
+ displayName?: string;
51
+ description: string;
52
+ promptConfig: PromptConfig;
53
+ modelConfig: ModelConfig;
54
+ runConfig: RunConfig;
55
+ toolConfig?: ToolConfig;
56
+ outputConfig?: OutputConfig<TOutput>;
57
+ inputConfig: InputConfig;
58
+ /**
59
+ * An optional function to process the raw output from the agent's final tool
60
+ * call into a string format.
61
+ *
62
+ * @param output The raw output value from the `complete_task` tool, now strongly typed with TOutput.
63
+ * @returns A string representation of the final output.
64
+ */
65
+ processOutput?: (output: z.infer<TOutput>) => string;
66
+ }
67
+ /**
68
+ * Configures the initial prompt for the agent.
69
+ */
70
+ export interface PromptConfig {
71
+ /**
72
+ * A single system prompt string. Supports templating using `${input_name}` syntax.
73
+ */
74
+ systemPrompt?: string;
75
+ /**
76
+ * An array of user/model content pairs for few-shot prompting.
77
+ */
78
+ initialMessages?: Content[];
79
+ /**
80
+ * The specific task or question to trigger the agent's execution loop.
81
+ * This is sent as the first user message, distinct from the systemPrompt (identity/rules)
82
+ * and initialMessages (history/few-shots). Supports templating.
83
+ * If not provided, a generic "Get Started!" message is used.
84
+ */
85
+ query?: string;
86
+ }
87
+ /**
88
+ * Configures the tools available to the agent during its execution.
89
+ */
90
+ export interface ToolConfig {
91
+ tools: Array<string | FunctionDeclaration | AnyDeclarativeTool>;
92
+ }
93
+ /**
94
+ * Configures the expected inputs (parameters) for the agent.
95
+ */
96
+ export interface InputConfig {
97
+ /**
98
+ * Defines the parameters the agent accepts.
99
+ * This is vital for generating the tool wrapper schema.
100
+ */
101
+ inputs: Record<string, {
102
+ description: string;
103
+ type: 'string' | 'number' | 'boolean' | 'integer' | 'string[]' | 'number[]';
104
+ required: boolean;
105
+ }>;
106
+ }
107
+ /**
108
+ * Configures the expected outputs for the agent.
109
+ */
110
+ export interface OutputConfig<T extends z.ZodTypeAny> {
111
+ /**
112
+ * The name of the final result parameter. This will be the name of the
113
+ * argument in the `submit_final_output` tool (e.g., "report", "answer").
114
+ */
115
+ outputName: string;
116
+ /**
117
+ * A description of the expected output. This will be used as the description
118
+ * for the tool argument.
119
+ */
120
+ description: string;
121
+ /**
122
+ * Optional JSON schema for the output. If provided, it will be used as the
123
+ * schema for the tool's argument, allowing for structured output enforcement.
124
+ * Defaults to { type: 'string' }.
125
+ */
126
+ schema: T;
127
+ }
128
+ /**
129
+ * Configures the generative model parameters for the agent.
130
+ */
131
+ export interface ModelConfig {
132
+ model: string;
133
+ temp: number;
134
+ top_p: number;
135
+ thinkingBudget?: number;
136
+ }
137
+ /**
138
+ * Configures the execution environment and constraints for the agent.
139
+ */
140
+ export interface RunConfig {
141
+ /** The maximum execution time for the agent in minutes. */
142
+ max_time_minutes: number;
143
+ /** The maximum number of conversational turns. */
144
+ max_turns?: number;
145
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Describes the possible termination modes for an agent.
8
+ */
9
+ export var AgentTerminateMode;
10
+ (function (AgentTerminateMode) {
11
+ AgentTerminateMode["ERROR"] = "ERROR";
12
+ AgentTerminateMode["TIMEOUT"] = "TIMEOUT";
13
+ AgentTerminateMode["GOAL"] = "GOAL";
14
+ AgentTerminateMode["MAX_TURNS"] = "MAX_TURNS";
15
+ AgentTerminateMode["ABORTED"] = "ABORTED";
16
+ })(AgentTerminateMode || (AgentTerminateMode = {}));
17
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/agents/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH;;GAEG;AACH,MAAM,CAAN,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,qCAAe,CAAA;IACf,yCAAmB,CAAA;IACnB,mCAAa,CAAA;IACb,6CAAuB,CAAA;IACvB,yCAAmB,CAAA;AACrB,CAAC,EANW,kBAAkB,KAAlB,kBAAkB,QAM7B"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { AgentInputs } from './types.js';
7
+ /**
8
+ * Simple template string replacement for agent prompts.
9
+ * Replaces ${key} placeholders with values from the inputs object.
10
+ *
11
+ * @param template The template string with ${key} placeholders
12
+ * @param inputs The input values to substitute
13
+ * @returns The template with placeholders replaced
14
+ */
15
+ export declare function templateString(template: string, inputs: AgentInputs): string;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Simple template string replacement for agent prompts.
8
+ * Replaces ${key} placeholders with values from the inputs object.
9
+ *
10
+ * @param template The template string with ${key} placeholders
11
+ * @param inputs The input values to substitute
12
+ * @returns The template with placeholders replaced
13
+ */
14
+ export function templateString(template, inputs) {
15
+ const placeholderRegex = /\$\{(\w+)\}/g;
16
+ // First, find all unique keys required by the template.
17
+ const requiredKeys = new Set(Array.from(template.matchAll(placeholderRegex), (match) => match[1]));
18
+ // Check if all required keys exist in the inputs.
19
+ const inputKeys = new Set(Object.keys(inputs));
20
+ const missingKeys = Array.from(requiredKeys).filter((key) => !inputKeys.has(key));
21
+ if (missingKeys.length > 0) {
22
+ throw new Error(`Missing input values for the following keys: ${missingKeys.join(', ')}`);
23
+ }
24
+ // Perform the replacement using a replacer function.
25
+ return template.replace(placeholderRegex, (_match, key) => String(inputs[key]));
26
+ }
27
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/agents/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,MAAmB;IAClE,MAAM,gBAAgB,GAAG,cAAc,CAAC;IAExC,wDAAwD;IACxD,MAAM,YAAY,GAAG,IAAI,GAAG,CAC1B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACrE,CAAC;IAEF,kDAAkD;IAClD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CACjD,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAC7B,CAAC;IAEF,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CACb,gDAAgD,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACzE,CAAC;IACJ,CAAC;IAED,qDAAqD;IACrD,OAAO,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CACxD,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CACpB,CAAC;AACJ,CAAC"}
@@ -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;
@@ -23,6 +23,7 @@ export type { MCPOAuthConfig, AnyToolInvocation };
23
23
  import type { AnyToolInvocation } from '../tools/tools.js';
24
24
  import { WorkspaceContext } from '../utils/workspaceContext.js';
25
25
  import { Storage } from './storage.js';
26
+ import type { ShellExecutionConfig } from '../services/shellExecutionService.js';
26
27
  import { FileExclusions } from '../utils/ignorePatterns.js';
27
28
  import type { EventEmitter } from 'node:events';
28
29
  import { MessageBus } from '../confirmation-bus/message-bus.js';
@@ -99,13 +100,21 @@ export interface GeminiCLIExtension {
99
100
  version: string;
100
101
  isActive: boolean;
101
102
  path: string;
103
+ installMetadata?: ExtensionInstallMetadata;
102
104
  }
103
- export interface FileFilteringOptions {
104
- respectGitIgnore: boolean;
105
- respectLlxprtIgnore: boolean;
105
+ export interface ExtensionInstallMetadata {
106
+ source: string;
107
+ type: 'git' | 'local' | 'link' | 'github-release';
108
+ releaseTag?: string;
109
+ ref?: string;
110
+ autoUpdate?: boolean;
106
111
  }
107
- export declare const DEFAULT_MEMORY_FILE_FILTERING_OPTIONS: FileFilteringOptions;
108
- export declare const DEFAULT_FILE_FILTERING_OPTIONS: FileFilteringOptions;
112
+ import type { FileFilteringOptions } from './constants.js';
113
+ import { DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, DEFAULT_FILE_FILTERING_OPTIONS } from './constants.js';
114
+ export type { FileFilteringOptions };
115
+ export { DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, DEFAULT_FILE_FILTERING_OPTIONS, };
116
+ export declare const DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD = 4000000;
117
+ export declare const DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES = 1000;
109
118
  export declare class MCPServerConfig {
110
119
  readonly command?: string | undefined;
111
120
  readonly args?: string[] | undefined;
@@ -123,11 +132,14 @@ export declare class MCPServerConfig {
123
132
  readonly extensionName?: string | undefined;
124
133
  readonly oauth?: MCPOAuthConfig | undefined;
125
134
  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);
135
+ readonly targetAudience?: string | undefined;
136
+ readonly targetServiceAccount?: string | undefined;
137
+ 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
138
  }
128
139
  export declare enum AuthProviderType {
129
140
  DYNAMIC_DISCOVERY = "dynamic_discovery",
130
- GOOGLE_CREDENTIALS = "google_credentials"
141
+ GOOGLE_CREDENTIALS = "google_credentials",
142
+ SERVICE_ACCOUNT_IMPERSONATION = "service_account_impersonation"
131
143
  }
132
144
  export interface SandboxConfig {
133
145
  command: 'docker' | 'podman' | 'sandbox-exec';
@@ -154,6 +166,7 @@ export interface ConfigParameters {
154
166
  mcpServers?: Record<string, MCPServerConfig>;
155
167
  userMemory?: string;
156
168
  llxprtMdFileCount?: number;
169
+ llxprtMdFilePaths?: string[];
157
170
  approvalMode?: ApprovalMode;
158
171
  showMemoryUsage?: boolean;
159
172
  contextLimit?: number;
@@ -203,6 +216,10 @@ export interface ConfigParameters {
203
216
  useRipgrep?: boolean;
204
217
  shouldUseNodePtyShell?: boolean;
205
218
  skipNextSpeakerCheck?: boolean;
219
+ shellExecutionConfig?: ShellExecutionConfig;
220
+ truncateToolOutputThreshold?: number;
221
+ truncateToolOutputLines?: number;
222
+ enableToolOutputTruncation?: boolean;
206
223
  extensionManagement?: boolean;
207
224
  enablePromptCompletion?: boolean;
208
225
  eventEmitter?: EventEmitter;
@@ -233,6 +250,7 @@ export declare class Config {
233
250
  private readonly mcpServers;
234
251
  private userMemory;
235
252
  private llxprtMdFileCount;
253
+ private llxprtMdFilePaths;
236
254
  private approvalMode;
237
255
  private readonly showMemoryUsage;
238
256
  private readonly accessibility;
@@ -288,6 +306,7 @@ export declare class Config {
288
306
  private readonly useRipgrep;
289
307
  private readonly shouldUseNodePtyShell;
290
308
  private readonly skipNextSpeakerCheck;
309
+ private shellExecutionConfig;
291
310
  private readonly extensionManagement;
292
311
  private readonly enablePromptCompletion;
293
312
  private initialized;
@@ -298,6 +317,9 @@ export declare class Config {
298
317
  private readonly useSmartEdit;
299
318
  private readonly messageBus;
300
319
  private readonly policyEngine;
320
+ truncateToolOutputThreshold: number;
321
+ truncateToolOutputLines: number;
322
+ enableToolOutputTruncation: boolean;
301
323
  constructor(params: ConfigParameters);
302
324
  /**
303
325
  * Must only be called once, throws if called again.
@@ -313,7 +335,7 @@ export declare class Config {
313
335
  resetModelToDefault(): void;
314
336
  setFallbackMode(active: boolean): void;
315
337
  getMaxSessionTurns(): number;
316
- getEmbeddingModel(): string;
338
+ getEmbeddingModel(): string | undefined;
317
339
  getSandbox(): SandboxConfig | undefined;
318
340
  isRestrictiveSandbox(): boolean;
319
341
  getTargetDir(): string;
@@ -335,6 +357,8 @@ export declare class Config {
335
357
  setUserMemory(newUserMemory: string): void;
336
358
  getLlxprtMdFileCount(): number;
337
359
  setLlxprtMdFileCount(count: number): void;
360
+ getLlxprtMdFilePaths(): string[];
361
+ setLlxprtMdFilePaths(paths: string[]): void;
338
362
  getApprovalMode(): ApprovalMode;
339
363
  setApprovalMode(mode: ApprovalMode): void;
340
364
  getMessageBus(): MessageBus;
@@ -435,7 +459,10 @@ export declare class Config {
435
459
  getShellReplacement(): boolean;
436
460
  getUseRipgrep(): boolean;
437
461
  getShouldUseNodePtyShell(): boolean;
462
+ getEnableInteractiveShell(): boolean;
438
463
  getSkipNextSpeakerCheck(): boolean;
464
+ getShellExecutionConfig(): ShellExecutionConfig;
465
+ setShellExecutionConfig(config: ShellExecutionConfig): void;
439
466
  getScreenReader(): boolean;
440
467
  getEnablePromptCompletion(): boolean;
441
468
  getUseSmartEdit(): boolean;
@@ -449,6 +476,7 @@ export declare class Config {
449
476
  refreshMemory(): Promise<{
450
477
  memoryContent: string;
451
478
  fileCount: number;
479
+ filePaths: string[];
452
480
  }>;
453
481
  createToolRegistry(): Promise<ToolRegistry>;
454
482
  /**