@defai.digital/ax-cli 4.1.10 → 4.1.14
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.
- package/.ax-cli/settings.json +1 -0
- package/README.md +140 -589
- package/dist/agent/dependency-resolver.d.ts +7 -0
- package/dist/agent/dependency-resolver.js +46 -18
- package/dist/agent/dependency-resolver.js.map +1 -1
- package/dist/agent/execution/tool-executor.d.ts +4 -0
- package/dist/agent/execution/tool-executor.js +76 -52
- package/dist/agent/execution/tool-executor.js.map +1 -1
- package/dist/agent/parallel-tools.d.ts +4 -0
- package/dist/agent/parallel-tools.js +65 -24
- package/dist/agent/parallel-tools.js.map +1 -1
- package/dist/agent/planning/plan-executor.d.ts +0 -5
- package/dist/agent/planning/plan-executor.js +23 -6
- package/dist/agent/planning/plan-executor.js.map +1 -1
- package/dist/agent/streaming/stream-handler.js +7 -4
- package/dist/agent/streaming/stream-handler.js.map +1 -1
- package/dist/agent/subagent-orchestrator.d.ts +35 -2
- package/dist/agent/subagent-orchestrator.js +188 -146
- package/dist/agent/subagent-orchestrator.js.map +1 -1
- package/dist/agent/subagent-types.js +3 -1
- package/dist/agent/subagent-types.js.map +1 -1
- package/dist/agent/subagent.d.ts +15 -4
- package/dist/agent/subagent.js +91 -72
- package/dist/agent/subagent.js.map +1 -1
- package/dist/design/figma-alias.d.ts +77 -0
- package/dist/design/figma-alias.js +246 -0
- package/dist/design/figma-alias.js.map +1 -1
- package/dist/design/figma-client.d.ts +4 -0
- package/dist/design/figma-client.js +24 -4
- package/dist/design/figma-client.js.map +1 -1
- package/dist/design/figma-map.js +78 -6
- package/dist/design/figma-map.js.map +1 -1
- package/dist/design/figma-tokens.js +6 -2
- package/dist/design/figma-tokens.js.map +1 -1
- package/dist/design/index.d.ts +1 -1
- package/dist/design/index.js +3 -1
- package/dist/design/index.js.map +1 -1
- package/dist/design/types.d.ts +9 -0
- package/dist/mcp/client-v2.js +4 -0
- package/dist/mcp/client-v2.js.map +1 -1
- package/dist/mcp/config-detector.js +3 -4
- package/dist/mcp/config-detector.js.map +1 -1
- package/dist/mcp/debug.d.ts +207 -0
- package/dist/mcp/debug.js +398 -0
- package/dist/mcp/debug.js.map +1 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.js +4 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/reconnection.js +6 -3
- package/dist/mcp/reconnection.js.map +1 -1
- package/dist/mcp/validation.js +15 -6
- package/dist/mcp/validation.js.map +1 -1
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/index.js +2 -0
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/provider-context-store.d.ts +127 -0
- package/dist/memory/provider-context-store.js +385 -0
- package/dist/memory/provider-context-store.js.map +1 -0
- package/dist/sdk/errors.d.ts +2 -0
- package/dist/sdk/errors.js +2 -0
- package/dist/sdk/errors.js.map +1 -1
- package/dist/sdk/index.d.ts +633 -62
- package/dist/sdk/index.js +854 -116
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/testing.d.ts +46 -4
- package/dist/sdk/testing.js +58 -6
- package/dist/sdk/testing.js.map +1 -1
- package/dist/sdk/version.d.ts +13 -9
- package/dist/sdk/version.js +13 -9
- package/dist/sdk/version.js.map +1 -1
- package/dist/utils/file-lock.d.ts +141 -0
- package/dist/utils/file-lock.js +559 -0
- package/dist/utils/file-lock.js.map +1 -0
- package/dist/utils/provider-context.d.ts +243 -0
- package/dist/utils/provider-context.js +421 -0
- package/dist/utils/provider-context.js.map +1 -0
- package/dist/utils/provider-file-cache.d.ts +91 -0
- package/dist/utils/provider-file-cache.js +165 -0
- package/dist/utils/provider-file-cache.js.map +1 -0
- package/dist/utils/provider-settings.d.ts +181 -0
- package/dist/utils/provider-settings.js +450 -0
- package/dist/utils/provider-settings.js.map +1 -0
- package/package.json +2 -2
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,54 +1,116 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AX CLI SDK - Programmatic API for AX CLI
|
|
2
|
+
* AX CLI SDK v1.4.0 - Programmatic API for AX CLI
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Use AX CLI as a library for integrations, VSCode extensions, and programmatic AI agents.
|
|
5
|
+
*
|
|
6
|
+
* ## Installation
|
|
7
|
+
*
|
|
8
|
+
* ```bash
|
|
9
|
+
* npm install @defai.digital/ax-cli
|
|
10
|
+
* ```
|
|
6
11
|
*
|
|
7
12
|
* ## Quick Start
|
|
8
13
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { createAgent, createGLMAgent, createGrokAgent } from '@defai.digital/ax-cli/sdk';
|
|
16
|
+
*
|
|
17
|
+
* // Option 1: Auto-detect provider
|
|
18
|
+
* const agent = await createAgent();
|
|
19
|
+
*
|
|
20
|
+
* // Option 2: Explicit provider
|
|
21
|
+
* const glmAgent = await createGLMAgent(); // Uses ~/.ax-glm/config.json
|
|
22
|
+
* const grokAgent = await createGrokAgent(); // Uses ~/.ax-grok/config.json
|
|
23
|
+
*
|
|
24
|
+
* // Process messages
|
|
25
|
+
* const result = await agent.processUserMessage('Analyze this code');
|
|
26
|
+
* agent.dispose();
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* ## Public API (v1.4.0)
|
|
30
|
+
*
|
|
31
|
+
* ### Agent Creation
|
|
32
|
+
* - `createAgent(options?)` - Create agent with auto-detected or specified provider
|
|
33
|
+
* - `createGLMAgent(options?)` - Create GLM (Z.AI) agent
|
|
34
|
+
* - `createGrokAgent(options?)` - Create Grok (xAI) agent
|
|
35
|
+
* - `tryCreateAgent(options?)` - Create agent without throwing (returns result object)
|
|
36
|
+
* - `withAgent(fn, options?)` - Run function with auto-disposed agent
|
|
37
|
+
*
|
|
38
|
+
* ### Error Handling
|
|
39
|
+
* - `SDKError` - Structured error class with error codes
|
|
40
|
+
* - `SDKErrorCode` - Error code enum (SETUP_NOT_RUN, API_KEY_MISSING, etc.)
|
|
41
|
+
*
|
|
42
|
+
* ### Agent Utilities
|
|
43
|
+
* - `getAgentInfo(agent)` - Get provider, model, config info
|
|
44
|
+
* - `getAgentStatus(agent)` - Check if agent is available/busy/disposed
|
|
45
|
+
* - `isAgentDisposed(agent)` - Check disposal state
|
|
46
|
+
* - `disposeAsync(agent)` - Dispose with async hook support
|
|
47
|
+
*
|
|
48
|
+
* ### Provider Utilities
|
|
49
|
+
* - `detectProvider()` - Auto-detect configured provider
|
|
50
|
+
* - `checkProviderHealth(provider?)` - Check if provider is configured
|
|
51
|
+
* - `getAllProviderHealth()` - Check all providers
|
|
52
|
+
*
|
|
53
|
+
* ### Version Info
|
|
54
|
+
* - `SDK_VERSION`, `CLI_VERSION` - Version constants
|
|
55
|
+
* - `getSDKVersion()`, `getCLIVersion()` - Version strings
|
|
56
|
+
* - `isSDKVersionCompatible(minVersion)` - Version check
|
|
57
|
+
*
|
|
58
|
+
* ### Testing
|
|
59
|
+
* - `createMockAgent(responses)` - Create mock for testing
|
|
60
|
+
* - `createMockSettings(overrides)` - Mock settings manager
|
|
61
|
+
*
|
|
62
|
+
* ## Example: Streaming Responses
|
|
11
63
|
*
|
|
12
|
-
* @example
|
|
13
64
|
* ```typescript
|
|
14
|
-
* import {
|
|
65
|
+
* import { createGLMAgent, SDKError, SDKErrorCode } from '@defai.digital/ax-cli/sdk';
|
|
15
66
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
67
|
+
* const agent = await createGLMAgent();
|
|
68
|
+
*
|
|
69
|
+
* agent.on('stream', (chunk) => {
|
|
70
|
+
* if (chunk.type === 'content') {
|
|
71
|
+
* process.stdout.write(chunk.content);
|
|
72
|
+
* }
|
|
19
73
|
* });
|
|
20
74
|
*
|
|
21
75
|
* try {
|
|
22
|
-
*
|
|
23
|
-
* agent.on('stream', (chunk) => {
|
|
24
|
-
* if (chunk.type === 'content') {
|
|
25
|
-
* console.log(chunk.content);
|
|
26
|
-
* }
|
|
27
|
-
* });
|
|
28
|
-
*
|
|
29
|
-
* // Process messages
|
|
30
|
-
* const result = await agent.processUserMessage('List all TypeScript files');
|
|
31
|
-
* console.log('Done!', result.length, 'messages');
|
|
76
|
+
* await agent.processUserMessage('Explain async/await');
|
|
32
77
|
* } catch (error) {
|
|
33
|
-
* // Handle structured errors
|
|
34
78
|
* if (SDKError.isSDKError(error)) {
|
|
35
|
-
*
|
|
36
|
-
* console.error('Please run: ax-cli setup');
|
|
37
|
-
* }
|
|
79
|
+
* console.error(`Error [${error.code}]: ${error.message}`);
|
|
38
80
|
* }
|
|
39
81
|
* } finally {
|
|
40
|
-
* // Always cleanup resources
|
|
41
82
|
* agent.dispose();
|
|
42
83
|
* }
|
|
43
84
|
* ```
|
|
44
85
|
*
|
|
45
|
-
* ##
|
|
86
|
+
* ## Example: Parallel Providers
|
|
87
|
+
*
|
|
88
|
+
* ```typescript
|
|
89
|
+
* import { createGLMAgent, createGrokAgent } from '@defai.digital/ax-cli/sdk';
|
|
90
|
+
*
|
|
91
|
+
* // Run GLM and Grok in parallel
|
|
92
|
+
* const [glm, grok] = await Promise.all([
|
|
93
|
+
* createGLMAgent(),
|
|
94
|
+
* createGrokAgent(),
|
|
95
|
+
* ]);
|
|
96
|
+
*
|
|
97
|
+
* const [glmResult, grokResult] = await Promise.all([
|
|
98
|
+
* glm.processUserMessage('Analyze with GLM'),
|
|
99
|
+
* grok.processUserMessage('Analyze with Grok'),
|
|
100
|
+
* ]);
|
|
101
|
+
*
|
|
102
|
+
* glm.dispose();
|
|
103
|
+
* grok.dispose();
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* ## Example: Testing
|
|
46
107
|
*
|
|
47
108
|
* ```typescript
|
|
48
|
-
* import { createMockAgent } from '@defai.digital/ax-cli/sdk
|
|
109
|
+
* import { createMockAgent } from '@defai.digital/ax-cli/sdk';
|
|
49
110
|
*
|
|
50
|
-
* const
|
|
51
|
-
* const result = await
|
|
111
|
+
* const mock = createMockAgent(['Hello!', 'How can I help?']);
|
|
112
|
+
* const result = await mock.processUserMessage('Hi');
|
|
113
|
+
* expect(result).toContain('Hello!');
|
|
52
114
|
* ```
|
|
53
115
|
*
|
|
54
116
|
* @packageDocumentation
|
|
@@ -59,54 +121,67 @@ export { SubagentOrchestrator } from '../agent/subagent-orchestrator.js';
|
|
|
59
121
|
export { ContextManager } from '../agent/context-manager.js';
|
|
60
122
|
import { LLMAgent } from '../agent/llm-agent.js';
|
|
61
123
|
import { Subagent } from '../agent/subagent.js';
|
|
124
|
+
import { SDKError } from './errors.js';
|
|
125
|
+
import { type ProviderType } from '../utils/provider-context.js';
|
|
126
|
+
export { withFileLock, withFileLockSync, SafeJsonFile, LockGuard, cleanupStaleLocks, type LockOptions, } from '../utils/file-lock.js';
|
|
62
127
|
export { LLMClient } from '../llm/client.js';
|
|
63
128
|
export type { LLMMessage, LLMTool, LLMToolCall, LLMResponse, SearchParameters, SearchOptions, } from '../llm/client.js';
|
|
64
129
|
export type { ChatOptions, ThinkingConfig, SamplingConfig, GLM46StreamChunk, } from '../llm/types.js';
|
|
65
130
|
export type { ChatEntry, StreamingChunk } from '../agent/llm-agent.js';
|
|
66
131
|
export type { ToolResult, Tool, EditorCommand, AgentState } from '../types/index.js';
|
|
67
132
|
export { SubagentRole, SubagentState, type SubagentConfig, type SubagentTask, type SubagentResult, type SubagentStatus, } from '../agent/subagent-types.js';
|
|
68
|
-
export { getSettingsManager } from '../utils/settings-manager.js';
|
|
69
|
-
export type { SettingsManager } from '../utils/settings-manager.js';
|
|
70
|
-
export { createTokenCounter } from '../utils/token-counter.js';
|
|
71
|
-
export type { TokenCounter } from '../utils/token-counter.js';
|
|
72
|
-
export { loadCustomInstructions } from '../utils/custom-instructions.js';
|
|
73
|
-
export { buildSystemPrompt } from '../utils/prompt-builder.js';
|
|
74
|
-
export { getUsageTracker } from '../utils/usage-tracker.js';
|
|
75
|
-
export { extractErrorMessage, createErrorMessage, ErrorCategory } from '../utils/error-handler.js';
|
|
76
|
-
export { loadMCPConfig } from '../mcp/config.js';
|
|
77
|
-
export { getMCPManager, initializeMCPServers, getMcpConnectionCount, getMCPConnectionStatus, getMCPPrompts, discoverMCPPrompts, getMCPResources, } from '../llm/tools.js';
|
|
78
|
-
export type { MCPConfig } from '../mcp/config.js';
|
|
79
|
-
export type { MCPServerConfig, MCPTool } from '../mcp/client.js';
|
|
80
|
-
export { MCPManager } from '../mcp/client.js';
|
|
81
|
-
export { MCPManagerV2, createServerName, createToolName, type ServerName, type ToolName, type ConnectionState, type MCPPrompt, } from '../mcp/client-v2.js';
|
|
82
|
-
export { promptToSlashCommand, parsePromptCommand, formatPromptResult, getPromptDescription, } from '../mcp/prompts.js';
|
|
83
|
-
export { listAllResources, getResourceContent, parseMCPReference, extractMCPReferences, resolveMCPReferences, searchResources, type MCPResource, } from '../mcp/resources.js';
|
|
84
|
-
export { ZAI_SERVER_NAMES, ZAI_ENDPOINTS, ZAI_VISION_PACKAGE, ZAI_MCP_TEMPLATES, ZAI_QUOTA_LIMITS, generateZAIServerConfig, getAllZAIServerNames, isZAIServer, getZAITemplate, type ZAIServerName, type ZAIPlanTier, type ZAIMCPTemplate, } from '../mcp/zai-templates.js';
|
|
85
|
-
export { detectZAIServices, getEnabledZAIServers, validateZAIApiKey, getZAIApiKey, isZAIMCPConfigured, getRecommendedServers, isGLMModel, isZAIBaseURL, formatZAIStatus, type ZAIServiceStatus, } from '../mcp/zai-detector.js';
|
|
86
|
-
export { getPermissionManager, initializePermissionManager, PermissionManager, PermissionTier, type PermissionRequest, type PermissionResult, type RiskLevel, } from '../permissions/permission-manager.js';
|
|
87
|
-
export { getTaskPlanner, isComplexRequest } from '../planner/index.js';
|
|
88
|
-
export type { TaskPlanner, TaskPlan, TaskPhase, PhaseResult, PlanResult, } from '../planner/index.js';
|
|
89
|
-
export { getCheckpointManager } from '../checkpoint/index.js';
|
|
90
|
-
export type { CheckpointManager, Checkpoint } from '../checkpoint/index.js';
|
|
91
|
-
export { ContextStore, getContextStore, resetDefaultStore } from '../memory/context-store.js';
|
|
92
|
-
export type { StoreResult } from '../memory/context-store.js';
|
|
93
|
-
export type { ProjectMemory, CacheStats } from '../memory/types.js';
|
|
94
|
-
export { ProgressReporter, getProgressReporter, ProgressEventType, type ProgressEvent } from './progress-reporter.js';
|
|
95
|
-
export { UnifiedLogger, getUnifiedLogger, LogLevel, parseLogLevel, getLogLevelName, type LogEntry, type LogSource, type LogFilter } from './unified-logger.js';
|
|
96
|
-
export { ToolRegistry, getToolRegistry, registerTools, createToolExecutor, type RegisteredTool, type ToolExecutor, type ToolExecutionContext, type ToolRegistrationOptions } from './tool-registry.js';
|
|
97
|
-
export { ToolRegistry as InternalToolRegistry, type ToolDefinition, type ToolCategory } from '../tools/registry.js';
|
|
98
|
-
export { GLM_MODELS, DEFAULT_MODEL, AGENT_CONFIG, PLANNER_CONFIG, VerbosityLevel, UI_CONFIG, type SupportedModel, } from '../constants.js';
|
|
99
133
|
export { CLI_VERSION, SDK_VERSION, SDK_API_VERSION, getCLIVersion, getSDKVersion, getSDKInfo, getVersionString, isSDKVersionCompatible, } from './version.js';
|
|
100
134
|
export { SDKError, SDKErrorCode } from './errors.js';
|
|
101
135
|
export { MockAgent, createMockAgent, MockSettingsManager, createMockSettings, MockMCPServer, createMockMCPServer, waitForAgent, createMockToolResult, assertToolSuccess, assertToolFailure } from './testing.js';
|
|
102
136
|
export type { MockMCPServerOptions } from './testing.js';
|
|
137
|
+
export type { ProviderType } from '../utils/provider-context.js';
|
|
138
|
+
export { detectProvider } from '../utils/provider-context.js';
|
|
103
139
|
/**
|
|
104
140
|
* Agent configuration options for SDK users
|
|
105
141
|
*
|
|
106
142
|
* SECURITY: Credentials (apiKey, baseURL) must be configured via "ax-cli setup"
|
|
107
143
|
* and are NOT exposed through the SDK API to prevent security vulnerabilities.
|
|
144
|
+
*
|
|
145
|
+
* MULTI-PROVIDER SUPPORT (v5.0):
|
|
146
|
+
* When running multiple providers in parallel (ax-glm and ax-grok), use the
|
|
147
|
+
* `provider` option to specify which provider's configuration to use.
|
|
148
|
+
* Each provider has isolated:
|
|
149
|
+
* - Configuration files (~/.ax-glm/ vs ~/.ax-grok/)
|
|
150
|
+
* - Cache directories
|
|
151
|
+
* - Memory stores
|
|
152
|
+
* - History
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* // Run GLM and Grok agents in parallel
|
|
157
|
+
* const glmAgent = await createAgent({ provider: 'glm' });
|
|
158
|
+
* const grokAgent = await createAgent({ provider: 'grok' });
|
|
159
|
+
*
|
|
160
|
+
* // Use both simultaneously
|
|
161
|
+
* const [glmResult, grokResult] = await Promise.all([
|
|
162
|
+
* glmAgent.processUserMessage('Analyze with GLM'),
|
|
163
|
+
* grokAgent.processUserMessage('Analyze with Grok'),
|
|
164
|
+
* ]);
|
|
165
|
+
* ```
|
|
108
166
|
*/
|
|
109
167
|
export interface AgentOptions {
|
|
168
|
+
/**
|
|
169
|
+
* Provider to use for configuration
|
|
170
|
+
*
|
|
171
|
+
* When specified, the agent will use the provider-specific configuration
|
|
172
|
+
* from the corresponding directory:
|
|
173
|
+
* - 'glm': Uses ~/.ax-glm/config.json
|
|
174
|
+
* - 'grok': Uses ~/.ax-grok/config.json
|
|
175
|
+
* - 'generic': Uses ~/.ax-cli/config.json
|
|
176
|
+
*
|
|
177
|
+
* If not specified, automatically detects based on:
|
|
178
|
+
* 1. AX_PROVIDER environment variable
|
|
179
|
+
* 2. Which provider's API key is set (ZAI_API_KEY, XAI_API_KEY)
|
|
180
|
+
* 3. Falls back to 'generic'
|
|
181
|
+
*
|
|
182
|
+
* @default auto-detect
|
|
183
|
+
*/
|
|
184
|
+
provider?: ProviderType;
|
|
110
185
|
/** Maximum number of tool execution rounds (1-1000, default: 400) */
|
|
111
186
|
maxToolRounds?: number;
|
|
112
187
|
/**
|
|
@@ -212,6 +287,7 @@ export interface AgentOptions {
|
|
|
212
287
|
* @throws {SDKError} With code SETUP_NOT_RUN if ax-cli setup has not been run
|
|
213
288
|
* @throws {SDKError} With code API_KEY_MISSING if API key not configured
|
|
214
289
|
* @throws {SDKError} With code BASE_URL_MISSING if base URL not configured
|
|
290
|
+
* @throws {SDKError} With code MODEL_MISSING if model not configured
|
|
215
291
|
* @throws {SDKError} With code VALIDATION_ERROR if options are invalid
|
|
216
292
|
*
|
|
217
293
|
* @example
|
|
@@ -252,20 +328,175 @@ export interface AgentOptions {
|
|
|
252
328
|
* ```
|
|
253
329
|
*/
|
|
254
330
|
export declare function createAgent(options?: AgentOptions): Promise<LLMAgent>;
|
|
331
|
+
/**
|
|
332
|
+
* Create an agent configured for GLM (Z.AI)
|
|
333
|
+
*
|
|
334
|
+
* Convenience function that creates an agent with provider: 'glm'.
|
|
335
|
+
* Uses configuration from ~/.ax-glm/config.json.
|
|
336
|
+
*
|
|
337
|
+
* @param options - Agent options (provider is set to 'glm')
|
|
338
|
+
* @returns Configured LLM Agent for GLM
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```typescript
|
|
342
|
+
* const agent = await createGLMAgent();
|
|
343
|
+
* const result = await agent.processUserMessage('Hello');
|
|
344
|
+
* agent.dispose();
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
export declare function createGLMAgent(options?: Omit<AgentOptions, 'provider'>): Promise<LLMAgent>;
|
|
348
|
+
/**
|
|
349
|
+
* Create an agent configured for Grok (xAI)
|
|
350
|
+
*
|
|
351
|
+
* Convenience function that creates an agent with provider: 'grok'.
|
|
352
|
+
* Uses configuration from ~/.ax-grok/config.json.
|
|
353
|
+
*
|
|
354
|
+
* @param options - Agent options (provider is set to 'grok')
|
|
355
|
+
* @returns Configured LLM Agent for Grok
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```typescript
|
|
359
|
+
* const agent = await createGrokAgent();
|
|
360
|
+
* const result = await agent.processUserMessage('Hello');
|
|
361
|
+
* agent.dispose();
|
|
362
|
+
* ```
|
|
363
|
+
*/
|
|
364
|
+
export declare function createGrokAgent(options?: Omit<AgentOptions, 'provider'>): Promise<LLMAgent>;
|
|
365
|
+
/**
|
|
366
|
+
* Result type for tryCreateAgent
|
|
367
|
+
*/
|
|
368
|
+
export type CreateAgentResult = {
|
|
369
|
+
success: true;
|
|
370
|
+
agent: LLMAgent;
|
|
371
|
+
error: undefined;
|
|
372
|
+
} | {
|
|
373
|
+
success: false;
|
|
374
|
+
agent: undefined;
|
|
375
|
+
error: SDKError;
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* Create an agent without throwing errors
|
|
379
|
+
*
|
|
380
|
+
* Unlike createAgent(), this function returns a result object instead of throwing.
|
|
381
|
+
* Useful for graceful error handling without try-catch blocks.
|
|
382
|
+
*
|
|
383
|
+
* @param options - Agent configuration options
|
|
384
|
+
* @returns Result object with either agent or error
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* ```typescript
|
|
388
|
+
* const result = await tryCreateAgent({ provider: 'glm' });
|
|
389
|
+
*
|
|
390
|
+
* if (result.success) {
|
|
391
|
+
* // Use agent
|
|
392
|
+
* await result.agent.processUserMessage('Hello');
|
|
393
|
+
* result.agent.dispose();
|
|
394
|
+
* } else {
|
|
395
|
+
* // Handle error without try-catch
|
|
396
|
+
* console.error('Failed:', result.error.code, result.error.message);
|
|
397
|
+
* }
|
|
398
|
+
* ```
|
|
399
|
+
*/
|
|
400
|
+
export declare function tryCreateAgent(options?: AgentOptions): Promise<CreateAgentResult>;
|
|
401
|
+
/**
|
|
402
|
+
* Run a function with a temporary agent that is automatically disposed
|
|
403
|
+
*
|
|
404
|
+
* This helper creates an agent, runs your function, and ensures the agent
|
|
405
|
+
* is properly disposed even if an error occurs. Useful for:
|
|
406
|
+
* - One-off agent operations
|
|
407
|
+
* - Scripts that need cleanup guarantees
|
|
408
|
+
* - Testing scenarios
|
|
409
|
+
*
|
|
410
|
+
* @param fn - Function to run with the agent
|
|
411
|
+
* @param options - Agent configuration options
|
|
412
|
+
* @returns Result of the function
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```typescript
|
|
416
|
+
* // Simple usage
|
|
417
|
+
* const result = await withAgent(async (agent) => {
|
|
418
|
+
* return await agent.processUserMessage('Analyze this code');
|
|
419
|
+
* });
|
|
420
|
+
*
|
|
421
|
+
* // With options
|
|
422
|
+
* const result = await withAgent(
|
|
423
|
+
* async (agent) => {
|
|
424
|
+
* agent.on('stream', console.log);
|
|
425
|
+
* return await agent.processUserMessage('Hello');
|
|
426
|
+
* },
|
|
427
|
+
* { provider: 'glm', maxToolRounds: 50 }
|
|
428
|
+
* );
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
export declare function withAgent<T>(fn: (agent: LLMAgent) => Promise<T>, options?: AgentOptions): Promise<T>;
|
|
432
|
+
/**
|
|
433
|
+
* Run a function with a temporary agent, returning result or error
|
|
434
|
+
*
|
|
435
|
+
* Combines withAgent and tryCreateAgent - creates agent, runs function,
|
|
436
|
+
* disposes, and returns result without throwing. Ideal for error-tolerant
|
|
437
|
+
* workflows.
|
|
438
|
+
*
|
|
439
|
+
* @param fn - Function to run with the agent
|
|
440
|
+
* @param options - Agent configuration options
|
|
441
|
+
* @returns Result object with either value or error
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```typescript
|
|
445
|
+
* const result = await tryWithAgent(async (agent) => {
|
|
446
|
+
* return await agent.processUserMessage('Hello');
|
|
447
|
+
* }, { provider: 'grok' });
|
|
448
|
+
*
|
|
449
|
+
* if (result.success) {
|
|
450
|
+
* console.log('Got response:', result.value);
|
|
451
|
+
* } else {
|
|
452
|
+
* console.error('Failed:', result.error.message);
|
|
453
|
+
* }
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
export declare function tryWithAgent<T>(fn: (agent: LLMAgent) => Promise<T>, options?: AgentOptions): Promise<{
|
|
457
|
+
success: true;
|
|
458
|
+
value: T;
|
|
459
|
+
error: undefined;
|
|
460
|
+
} | {
|
|
461
|
+
success: false;
|
|
462
|
+
value: undefined;
|
|
463
|
+
error: SDKError;
|
|
464
|
+
}>;
|
|
465
|
+
/**
|
|
466
|
+
* Options for creating a subagent
|
|
467
|
+
*/
|
|
468
|
+
export interface SubagentOptions extends Partial<import('../agent/subagent-types.js').SubagentConfig> {
|
|
469
|
+
/**
|
|
470
|
+
* Provider to use for this subagent's configuration
|
|
471
|
+
*
|
|
472
|
+
* When specified, the subagent will use provider-specific settings.
|
|
473
|
+
* Important for parallel multi-provider scenarios.
|
|
474
|
+
*
|
|
475
|
+
* @default auto-detect based on environment
|
|
476
|
+
*/
|
|
477
|
+
provider?: ProviderType;
|
|
478
|
+
}
|
|
255
479
|
/**
|
|
256
480
|
* Create a specialized subagent for specific tasks
|
|
257
481
|
*
|
|
258
482
|
* @param role - The role/specialty of the subagent
|
|
259
|
-
* @param
|
|
483
|
+
* @param options - Optional configuration including provider
|
|
260
484
|
* @returns Configured Subagent instance
|
|
261
485
|
*
|
|
262
486
|
* @example
|
|
263
487
|
* ```typescript
|
|
488
|
+
* // Basic usage
|
|
264
489
|
* const testAgent = createSubagent(SubagentRole.TESTING, {
|
|
265
490
|
* maxToolRounds: 20,
|
|
266
491
|
* priority: 2
|
|
267
492
|
* });
|
|
268
493
|
*
|
|
494
|
+
* // With provider for parallel support
|
|
495
|
+
* const glmSubagent = createSubagent(SubagentRole.ANALYSIS, {
|
|
496
|
+
* provider: 'glm',
|
|
497
|
+
* maxToolRounds: 30
|
|
498
|
+
* });
|
|
499
|
+
*
|
|
269
500
|
* const result = await testAgent.execute({
|
|
270
501
|
* id: 'task-1',
|
|
271
502
|
* description: 'Write unit tests for auth module',
|
|
@@ -273,7 +504,7 @@ export declare function createAgent(options?: AgentOptions): Promise<LLMAgent>;
|
|
|
273
504
|
* });
|
|
274
505
|
* ```
|
|
275
506
|
*/
|
|
276
|
-
export declare function createSubagent(role: import('../agent/subagent-types.js').SubagentRole,
|
|
507
|
+
export declare function createSubagent(role: import('../agent/subagent-types.js').SubagentRole, options?: SubagentOptions): Subagent;
|
|
277
508
|
/**
|
|
278
509
|
* Remove auto-cleanup handlers from an agent
|
|
279
510
|
*
|
|
@@ -328,3 +559,343 @@ export declare function removeCleanupHandlers(agent: LLMAgent): void;
|
|
|
328
559
|
* Only call this if you need to pre-initialize MCP servers.
|
|
329
560
|
*/
|
|
330
561
|
export declare function initializeSDK(): Promise<void>;
|
|
562
|
+
/**
|
|
563
|
+
* Information about an agent's configuration
|
|
564
|
+
*/
|
|
565
|
+
export interface AgentInfo {
|
|
566
|
+
/** Provider type ('glm', 'grok', or 'generic') */
|
|
567
|
+
provider: ProviderType;
|
|
568
|
+
/** Provider display name */
|
|
569
|
+
providerDisplayName: string;
|
|
570
|
+
/** Current model in use */
|
|
571
|
+
model: string | undefined;
|
|
572
|
+
/** Base URL for API calls */
|
|
573
|
+
baseURL: string | undefined;
|
|
574
|
+
/** Whether the agent has been disposed */
|
|
575
|
+
isDisposed: boolean;
|
|
576
|
+
/** Configuration directory path */
|
|
577
|
+
configDir: string;
|
|
578
|
+
/** CLI command name for this provider */
|
|
579
|
+
cliName: string;
|
|
580
|
+
/** When the agent was created */
|
|
581
|
+
createdAt: Date;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Get information about an agent created with createAgent()
|
|
585
|
+
*
|
|
586
|
+
* This function extracts the provider, model, and configuration information
|
|
587
|
+
* from an agent instance. Useful for debugging, logging, and multi-provider
|
|
588
|
+
* scenarios where you need to know which provider an agent is using.
|
|
589
|
+
*
|
|
590
|
+
* @param agent - The agent instance created with createAgent()
|
|
591
|
+
* @returns AgentInfo object with provider/model details, or null if not SDK-created
|
|
592
|
+
*
|
|
593
|
+
* @example
|
|
594
|
+
* ```typescript
|
|
595
|
+
* const glmAgent = await createAgent({ provider: 'glm' });
|
|
596
|
+
* const grokAgent = await createAgent({ provider: 'grok' });
|
|
597
|
+
*
|
|
598
|
+
* const glmInfo = getAgentInfo(glmAgent);
|
|
599
|
+
* console.log(glmInfo?.provider); // 'glm'
|
|
600
|
+
* console.log(glmInfo?.model); // 'glm-4.6'
|
|
601
|
+
*
|
|
602
|
+
* const grokInfo = getAgentInfo(grokAgent);
|
|
603
|
+
* console.log(grokInfo?.provider); // 'grok'
|
|
604
|
+
* console.log(grokInfo?.model); // 'grok-3'
|
|
605
|
+
* ```
|
|
606
|
+
*/
|
|
607
|
+
export declare function getAgentInfo(agent: LLMAgent): AgentInfo | null;
|
|
608
|
+
/**
|
|
609
|
+
* Get the model an agent is using
|
|
610
|
+
*
|
|
611
|
+
* Quick accessor to get just the model name from an SDK-created agent.
|
|
612
|
+
* Returns undefined if the agent was not created via createAgent().
|
|
613
|
+
*
|
|
614
|
+
* @param agent - The agent instance
|
|
615
|
+
* @returns The model name or undefined
|
|
616
|
+
*
|
|
617
|
+
* @example
|
|
618
|
+
* ```typescript
|
|
619
|
+
* const agent = await createAgent({ provider: 'glm' });
|
|
620
|
+
* console.log(getAgentModel(agent)); // 'glm-4.6'
|
|
621
|
+
* ```
|
|
622
|
+
*/
|
|
623
|
+
export declare function getAgentModel(agent: LLMAgent): string | undefined;
|
|
624
|
+
/**
|
|
625
|
+
* Get the base URL an agent is using
|
|
626
|
+
*
|
|
627
|
+
* Quick accessor to get just the base URL from an SDK-created agent.
|
|
628
|
+
* Returns undefined if the agent was not created via createAgent().
|
|
629
|
+
*
|
|
630
|
+
* @param agent - The agent instance
|
|
631
|
+
* @returns The base URL or undefined
|
|
632
|
+
*
|
|
633
|
+
* @example
|
|
634
|
+
* ```typescript
|
|
635
|
+
* const agent = await createAgent({ provider: 'grok' });
|
|
636
|
+
* console.log(getAgentBaseURL(agent)); // 'https://api.x.ai/v1'
|
|
637
|
+
* ```
|
|
638
|
+
*/
|
|
639
|
+
export declare function getAgentBaseURL(agent: LLMAgent): string | undefined;
|
|
640
|
+
/**
|
|
641
|
+
* Get the provider an agent is using
|
|
642
|
+
*
|
|
643
|
+
* Quick accessor to get just the provider type from an SDK-created agent.
|
|
644
|
+
* Returns undefined if the agent was not created via createAgent().
|
|
645
|
+
*
|
|
646
|
+
* @param agent - The agent instance
|
|
647
|
+
* @returns The provider type or undefined
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* ```typescript
|
|
651
|
+
* const agent = await createAgent({ provider: 'glm' });
|
|
652
|
+
* console.log(getAgentProvider(agent)); // 'glm'
|
|
653
|
+
* ```
|
|
654
|
+
*/
|
|
655
|
+
export declare function getAgentProvider(agent: LLMAgent): ProviderType | undefined;
|
|
656
|
+
/**
|
|
657
|
+
* Get when an agent was created
|
|
658
|
+
*
|
|
659
|
+
* Quick accessor to get the creation timestamp from an SDK-created agent.
|
|
660
|
+
* Useful for logging, monitoring, and debugging agent lifecycle.
|
|
661
|
+
* Returns undefined if the agent was not created via createAgent().
|
|
662
|
+
*
|
|
663
|
+
* @param agent - The agent instance
|
|
664
|
+
* @returns The creation Date or undefined
|
|
665
|
+
*
|
|
666
|
+
* @example
|
|
667
|
+
* ```typescript
|
|
668
|
+
* const agent = await createAgent();
|
|
669
|
+
* console.log(getAgentCreatedAt(agent)); // Date object
|
|
670
|
+
* ```
|
|
671
|
+
*/
|
|
672
|
+
export declare function getAgentCreatedAt(agent: LLMAgent): Date | undefined;
|
|
673
|
+
/**
|
|
674
|
+
* Get how long an agent has been running (age in milliseconds)
|
|
675
|
+
*
|
|
676
|
+
* Returns the time elapsed since the agent was created. Useful for:
|
|
677
|
+
* - Monitoring long-running agents
|
|
678
|
+
* - Implementing agent timeouts
|
|
679
|
+
* - Debugging performance issues
|
|
680
|
+
* - Logging agent lifecycle metrics
|
|
681
|
+
*
|
|
682
|
+
* @param agent - The agent instance
|
|
683
|
+
* @returns Age in milliseconds, or undefined if not SDK-created
|
|
684
|
+
*
|
|
685
|
+
* @example
|
|
686
|
+
* ```typescript
|
|
687
|
+
* const agent = await createAgent();
|
|
688
|
+
*
|
|
689
|
+
* // ... some work ...
|
|
690
|
+
*
|
|
691
|
+
* const ageMs = getAgentAge(agent);
|
|
692
|
+
* if (ageMs !== undefined) {
|
|
693
|
+
* console.log(`Agent running for ${Math.round(ageMs / 1000)}s`);
|
|
694
|
+
*
|
|
695
|
+
* // Implement timeout
|
|
696
|
+
* if (ageMs > 5 * 60 * 1000) { // 5 minutes
|
|
697
|
+
* console.warn('Agent running too long, disposing');
|
|
698
|
+
* agent.dispose();
|
|
699
|
+
* }
|
|
700
|
+
* }
|
|
701
|
+
* ```
|
|
702
|
+
*/
|
|
703
|
+
export declare function getAgentAge(agent: LLMAgent): number | undefined;
|
|
704
|
+
/**
|
|
705
|
+
* Format agent age as human-readable string
|
|
706
|
+
*
|
|
707
|
+
* Convenience function to get agent age as a formatted string.
|
|
708
|
+
* Returns undefined if agent was not created via createAgent().
|
|
709
|
+
*
|
|
710
|
+
* @param agent - The agent instance
|
|
711
|
+
* @returns Formatted age string (e.g., "1m 30s", "2h 15m"), or undefined
|
|
712
|
+
*
|
|
713
|
+
* @example
|
|
714
|
+
* ```typescript
|
|
715
|
+
* const agent = await createAgent();
|
|
716
|
+
* // ... work ...
|
|
717
|
+
* console.log(`Agent age: ${formatAgentAge(agent)}`); // "Agent age: 1m 30s"
|
|
718
|
+
* ```
|
|
719
|
+
*/
|
|
720
|
+
export declare function formatAgentAge(agent: LLMAgent): string | undefined;
|
|
721
|
+
/**
|
|
722
|
+
* Check if an agent is busy (bash executing) or disposed
|
|
723
|
+
*
|
|
724
|
+
* This function provides a quick check to determine if an agent is available
|
|
725
|
+
* to process new messages. An agent is considered "busy" if:
|
|
726
|
+
* - It has been disposed (cannot be used at all)
|
|
727
|
+
* - It is currently executing a bash command
|
|
728
|
+
*
|
|
729
|
+
* Useful for:
|
|
730
|
+
* - Pre-flight checks before sending messages
|
|
731
|
+
* - Implementing request queuing
|
|
732
|
+
* - Health monitoring dashboards
|
|
733
|
+
*
|
|
734
|
+
* @param agent - The agent instance to check
|
|
735
|
+
* @returns Object with availability status
|
|
736
|
+
*
|
|
737
|
+
* @example
|
|
738
|
+
* ```typescript
|
|
739
|
+
* const agent = await createAgent();
|
|
740
|
+
*
|
|
741
|
+
* // Check before processing
|
|
742
|
+
* const status = getAgentStatus(agent);
|
|
743
|
+
* if (!status.available) {
|
|
744
|
+
* console.log('Agent not available:', status.reason);
|
|
745
|
+
* return;
|
|
746
|
+
* }
|
|
747
|
+
*
|
|
748
|
+
* await agent.processUserMessage('Hello');
|
|
749
|
+
* ```
|
|
750
|
+
*/
|
|
751
|
+
export declare function getAgentStatus(agent: LLMAgent): {
|
|
752
|
+
/** Whether the agent is available to process messages */
|
|
753
|
+
available: boolean;
|
|
754
|
+
/** Whether the agent has been disposed */
|
|
755
|
+
isDisposed: boolean;
|
|
756
|
+
/** Whether the agent is executing bash command */
|
|
757
|
+
isBusy: boolean;
|
|
758
|
+
/** Reason why agent is unavailable (if not available) */
|
|
759
|
+
reason?: string;
|
|
760
|
+
/** Agent age in milliseconds (if SDK-created) */
|
|
761
|
+
ageMs?: number;
|
|
762
|
+
};
|
|
763
|
+
/**
|
|
764
|
+
* Result of a provider health check
|
|
765
|
+
*/
|
|
766
|
+
export interface ProviderHealthResult {
|
|
767
|
+
/** Whether the provider is healthy and ready */
|
|
768
|
+
healthy: boolean;
|
|
769
|
+
/** Provider type checked */
|
|
770
|
+
provider: ProviderType;
|
|
771
|
+
/** Whether API key is configured */
|
|
772
|
+
hasApiKey: boolean;
|
|
773
|
+
/** Whether base URL is configured */
|
|
774
|
+
hasBaseURL: boolean;
|
|
775
|
+
/** Whether model is configured */
|
|
776
|
+
hasModel: boolean;
|
|
777
|
+
/** Human-readable status message */
|
|
778
|
+
message: string;
|
|
779
|
+
/** Error details if unhealthy */
|
|
780
|
+
error?: string;
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Check if a provider is properly configured and ready to use
|
|
784
|
+
*
|
|
785
|
+
* This function validates that a provider has all required configuration
|
|
786
|
+
* (API key, base URL, model) without actually creating an agent or making
|
|
787
|
+
* API calls. Useful for:
|
|
788
|
+
* - Pre-flight checks before creating agents
|
|
789
|
+
* - Setup wizards and configuration UIs
|
|
790
|
+
* - Health checks in long-running services
|
|
791
|
+
*
|
|
792
|
+
* @param provider - Provider to check (defaults to auto-detect)
|
|
793
|
+
* @returns ProviderHealthResult with configuration status
|
|
794
|
+
*
|
|
795
|
+
* @example
|
|
796
|
+
* ```typescript
|
|
797
|
+
* // Check specific provider
|
|
798
|
+
* const glmHealth = checkProviderHealth('glm');
|
|
799
|
+
* if (!glmHealth.healthy) {
|
|
800
|
+
* console.error('GLM not configured:', glmHealth.message);
|
|
801
|
+
* console.log('Run: ax-glm setup');
|
|
802
|
+
* }
|
|
803
|
+
*
|
|
804
|
+
* // Check all providers
|
|
805
|
+
* const providers: ProviderType[] = ['glm', 'grok'];
|
|
806
|
+
* for (const p of providers) {
|
|
807
|
+
* const health = checkProviderHealth(p);
|
|
808
|
+
* console.log(`${p}: ${health.healthy ? '✓' : '✗'} ${health.message}`);
|
|
809
|
+
* }
|
|
810
|
+
* ```
|
|
811
|
+
*/
|
|
812
|
+
export declare function checkProviderHealth(provider?: ProviderType): ProviderHealthResult;
|
|
813
|
+
/**
|
|
814
|
+
* Get health status for all supported providers
|
|
815
|
+
*
|
|
816
|
+
* @returns Array of health results for all providers
|
|
817
|
+
*
|
|
818
|
+
* @example
|
|
819
|
+
* ```typescript
|
|
820
|
+
* const allHealth = getAllProviderHealth();
|
|
821
|
+
* const configured = allHealth.filter(h => h.healthy);
|
|
822
|
+
* console.log(`${configured.length} providers ready`);
|
|
823
|
+
* ```
|
|
824
|
+
*/
|
|
825
|
+
export declare function getAllProviderHealth(): ProviderHealthResult[];
|
|
826
|
+
/**
|
|
827
|
+
* Check if an agent has been disposed
|
|
828
|
+
*
|
|
829
|
+
* This function provides a reliable way to check if an agent created with
|
|
830
|
+
* createAgent() has been disposed. Works regardless of the `autoCleanup` setting.
|
|
831
|
+
*
|
|
832
|
+
* @param agent - The agent instance to check
|
|
833
|
+
* @returns true if the agent has been disposed, false otherwise
|
|
834
|
+
* @returns undefined if the agent was not created via createAgent()
|
|
835
|
+
*
|
|
836
|
+
* @example
|
|
837
|
+
* ```typescript
|
|
838
|
+
* const agent = await createAgent();
|
|
839
|
+
* console.log(isAgentDisposed(agent)); // false
|
|
840
|
+
*
|
|
841
|
+
* agent.dispose();
|
|
842
|
+
* console.log(isAgentDisposed(agent)); // true
|
|
843
|
+
* ```
|
|
844
|
+
*/
|
|
845
|
+
export declare function isAgentDisposed(agent: LLMAgent): boolean | undefined;
|
|
846
|
+
/**
|
|
847
|
+
* Dispose an agent asynchronously, properly awaiting the onDispose hook
|
|
848
|
+
*
|
|
849
|
+
* The standard `agent.dispose()` is synchronous and fires async onDispose hooks
|
|
850
|
+
* in a fire-and-forget manner. Use this function when you need to ensure the
|
|
851
|
+
* onDispose hook completes before continuing.
|
|
852
|
+
*
|
|
853
|
+
* @param agent - The agent instance to dispose
|
|
854
|
+
* @returns Promise that resolves when disposal is complete
|
|
855
|
+
*
|
|
856
|
+
* @example
|
|
857
|
+
* ```typescript
|
|
858
|
+
* const agent = await createAgent({
|
|
859
|
+
* onDispose: async () => {
|
|
860
|
+
* await saveState(); // This WILL be awaited with disposeAsync
|
|
861
|
+
* }
|
|
862
|
+
* });
|
|
863
|
+
*
|
|
864
|
+
* // ... use agent ...
|
|
865
|
+
*
|
|
866
|
+
* // Properly await cleanup
|
|
867
|
+
* await disposeAsync(agent);
|
|
868
|
+
* console.log('Cleanup complete, state saved');
|
|
869
|
+
* ```
|
|
870
|
+
*/
|
|
871
|
+
export declare function disposeAsync(agent: LLMAgent): Promise<void>;
|
|
872
|
+
/**
|
|
873
|
+
* Information about a subagent's configuration
|
|
874
|
+
*/
|
|
875
|
+
export interface SubagentInfo {
|
|
876
|
+
/** Provider type if configured */
|
|
877
|
+
provider: ProviderType | undefined;
|
|
878
|
+
/** Provider display name if configured */
|
|
879
|
+
providerDisplayName: string | undefined;
|
|
880
|
+
/** Configuration directory path if configured */
|
|
881
|
+
configDir: string | undefined;
|
|
882
|
+
/** CLI command name for this provider if configured */
|
|
883
|
+
cliName: string | undefined;
|
|
884
|
+
/** The subagent's role */
|
|
885
|
+
role: import('../agent/subagent-types.js').SubagentRole;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Get information about a subagent created with createSubagent()
|
|
889
|
+
*
|
|
890
|
+
* @param subagent - The subagent instance
|
|
891
|
+
* @returns SubagentInfo object with provider details
|
|
892
|
+
*
|
|
893
|
+
* @example
|
|
894
|
+
* ```typescript
|
|
895
|
+
* const subagent = createSubagent(SubagentRole.TESTING, { provider: 'glm' });
|
|
896
|
+
* const info = getSubagentInfo(subagent);
|
|
897
|
+
* console.log(info.provider); // 'glm'
|
|
898
|
+
* console.log(info.role); // SubagentRole.TESTING
|
|
899
|
+
* ```
|
|
900
|
+
*/
|
|
901
|
+
export declare function getSubagentInfo(subagent: Subagent): SubagentInfo;
|