sdkwork-browser-agent 1.0.0
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/README.md +228 -0
- package/README.zh.md +228 -0
- package/dist/agent-Bpxmkz8W.d.ts +197 -0
- package/dist/agent-kexkkI13.d.cts +197 -0
- package/dist/browser/agent-Bpxmkz8W.d.ts +197 -0
- package/dist/browser/chunk-7W2JJCSS.js +276 -0
- package/dist/browser/chunk-7W2JJCSS.js.map +1 -0
- package/dist/browser/chunk-BHRFRGR7.js +144 -0
- package/dist/browser/chunk-BHRFRGR7.js.map +1 -0
- package/dist/browser/chunk-CLP6UNSV.js +285 -0
- package/dist/browser/chunk-CLP6UNSV.js.map +1 -0
- package/dist/browser/chunk-HXLRBB7S.js +1569 -0
- package/dist/browser/chunk-HXLRBB7S.js.map +1 -0
- package/dist/browser/chunk-VJEFLRZT.js +1720 -0
- package/dist/browser/chunk-VJEFLRZT.js.map +1 -0
- package/dist/browser/index.d.ts +842 -0
- package/dist/browser/index.js +3293 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/llm/index.d.ts +235 -0
- package/dist/browser/llm/index.js +29 -0
- package/dist/browser/llm/index.js.map +1 -0
- package/dist/browser/mcp/index.d.ts +63 -0
- package/dist/browser/mcp/index.js +9 -0
- package/dist/browser/mcp/index.js.map +1 -0
- package/dist/browser/provider-Dna36xA-.d.ts +105 -0
- package/dist/browser/skills/index.d.ts +401 -0
- package/dist/browser/skills/index.js +31 -0
- package/dist/browser/skills/index.js.map +1 -0
- package/dist/browser/storage/index.d.ts +64 -0
- package/dist/browser/storage/index.js +15 -0
- package/dist/browser/storage/index.js.map +1 -0
- package/dist/browser/tools/index.d.ts +45 -0
- package/dist/browser/tools/index.js +15 -0
- package/dist/browser/tools/index.js.map +1 -0
- package/dist/browser/types-CG5I-byI.d.ts +30 -0
- package/dist/chunk-56J3IBXZ.js +144 -0
- package/dist/chunk-56J3IBXZ.js.map +1 -0
- package/dist/chunk-5XTVS5MB.js +1720 -0
- package/dist/chunk-5XTVS5MB.js.map +1 -0
- package/dist/chunk-6AYIRBGI.js +166 -0
- package/dist/chunk-6AYIRBGI.js.map +1 -0
- package/dist/chunk-C2EYJHXW.cjs +276 -0
- package/dist/chunk-C2EYJHXW.cjs.map +1 -0
- package/dist/chunk-HOZQ445W.cjs +166 -0
- package/dist/chunk-HOZQ445W.cjs.map +1 -0
- package/dist/chunk-KZNZ6CGD.cjs +144 -0
- package/dist/chunk-KZNZ6CGD.cjs.map +1 -0
- package/dist/chunk-XFMT5ZA4.js +276 -0
- package/dist/chunk-XFMT5ZA4.js.map +1 -0
- package/dist/chunk-XPGICLEJ.cjs +1720 -0
- package/dist/chunk-XPGICLEJ.cjs.map +1 -0
- package/dist/index.cjs +1311 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +395 -0
- package/dist/index.d.ts +395 -0
- package/dist/index.js +1311 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/index.cjs +29 -0
- package/dist/llm/index.cjs.map +1 -0
- package/dist/llm/index.d.cts +235 -0
- package/dist/llm/index.d.ts +235 -0
- package/dist/llm/index.js +29 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/mcp/index.cjs +9 -0
- package/dist/mcp/index.cjs.map +1 -0
- package/dist/mcp/index.d.cts +63 -0
- package/dist/mcp/index.d.ts +63 -0
- package/dist/mcp/index.js +9 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/node/agent-Bpxmkz8W.d.ts +197 -0
- package/dist/node/agent-kexkkI13.d.cts +197 -0
- package/dist/node/chunk-7W2JJCSS.js +276 -0
- package/dist/node/chunk-7W2JJCSS.js.map +1 -0
- package/dist/node/chunk-BHRFRGR7.js +144 -0
- package/dist/node/chunk-BHRFRGR7.js.map +1 -0
- package/dist/node/chunk-CLP6UNSV.js +285 -0
- package/dist/node/chunk-CLP6UNSV.js.map +1 -0
- package/dist/node/chunk-HXLRBB7S.js +1569 -0
- package/dist/node/chunk-HXLRBB7S.js.map +1 -0
- package/dist/node/chunk-IYG37UN3.cjs +144 -0
- package/dist/node/chunk-IYG37UN3.cjs.map +1 -0
- package/dist/node/chunk-JF33ZOMB.cjs +285 -0
- package/dist/node/chunk-JF33ZOMB.cjs.map +1 -0
- package/dist/node/chunk-KXXS33G3.cjs +276 -0
- package/dist/node/chunk-KXXS33G3.cjs.map +1 -0
- package/dist/node/chunk-MTFOABGC.cjs +1720 -0
- package/dist/node/chunk-MTFOABGC.cjs.map +1 -0
- package/dist/node/chunk-VJEFLRZT.js +1720 -0
- package/dist/node/chunk-VJEFLRZT.js.map +1 -0
- package/dist/node/chunk-YDHQCPSN.cjs +1569 -0
- package/dist/node/chunk-YDHQCPSN.cjs.map +1 -0
- package/dist/node/index.cjs +3293 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +842 -0
- package/dist/node/index.d.ts +842 -0
- package/dist/node/index.js +3293 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/llm/index.cjs +29 -0
- package/dist/node/llm/index.cjs.map +1 -0
- package/dist/node/llm/index.d.cts +235 -0
- package/dist/node/llm/index.d.ts +235 -0
- package/dist/node/llm/index.js +29 -0
- package/dist/node/llm/index.js.map +1 -0
- package/dist/node/mcp/index.cjs +9 -0
- package/dist/node/mcp/index.cjs.map +1 -0
- package/dist/node/mcp/index.d.cts +63 -0
- package/dist/node/mcp/index.d.ts +63 -0
- package/dist/node/mcp/index.js +9 -0
- package/dist/node/mcp/index.js.map +1 -0
- package/dist/node/provider-Dna36xA-.d.cts +105 -0
- package/dist/node/provider-Dna36xA-.d.ts +105 -0
- package/dist/node/skills/index.cjs +31 -0
- package/dist/node/skills/index.cjs.map +1 -0
- package/dist/node/skills/index.d.cts +401 -0
- package/dist/node/skills/index.d.ts +401 -0
- package/dist/node/skills/index.js +31 -0
- package/dist/node/skills/index.js.map +1 -0
- package/dist/node/storage/index.cjs +15 -0
- package/dist/node/storage/index.cjs.map +1 -0
- package/dist/node/storage/index.d.cts +64 -0
- package/dist/node/storage/index.d.ts +64 -0
- package/dist/node/storage/index.js +15 -0
- package/dist/node/storage/index.js.map +1 -0
- package/dist/node/tools/index.cjs +15 -0
- package/dist/node/tools/index.cjs.map +1 -0
- package/dist/node/tools/index.d.cts +45 -0
- package/dist/node/tools/index.d.ts +45 -0
- package/dist/node/tools/index.js +15 -0
- package/dist/node/tools/index.js.map +1 -0
- package/dist/node/types-CG5I-byI.d.cts +30 -0
- package/dist/node/types-CG5I-byI.d.ts +30 -0
- package/dist/provider-Dna36xA-.d.cts +105 -0
- package/dist/provider-Dna36xA-.d.ts +105 -0
- package/dist/skills/index.cjs +15 -0
- package/dist/skills/index.cjs.map +1 -0
- package/dist/skills/index.d.cts +43 -0
- package/dist/skills/index.d.ts +43 -0
- package/dist/skills/index.js +15 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/tools/index.cjs +15 -0
- package/dist/tools/index.cjs.map +1 -0
- package/dist/tools/index.d.cts +45 -0
- package/dist/tools/index.d.ts +45 -0
- package/dist/tools/index.js +15 -0
- package/dist/tools/index.js.map +1 -0
- package/package.json +150 -0
|
@@ -0,0 +1,842 @@
|
|
|
1
|
+
import { S as Skill, T as Tool, a as SkillResult, A as Agent, b as AgentConfig, P as Plugin, c as PluginContext } from './agent-Bpxmkz8W.js';
|
|
2
|
+
export { d as AgentHooks, e as AgentMiddleware, E as ExecutionContext, M as MCPResource, f as MCPResourceContent, g as MCPResourceMetadata, h as MCPTool, i as MCPToolResult, j as ParameterProperty, k as ParameterSchema, l as PluginMetadata, m as SkillHandler, n as SkillMetadata, o as ToolExecutor, p as ToolMetadata, q as ToolOutput } from './agent-Bpxmkz8W.js';
|
|
3
|
+
import { a as LLMMessage } from './provider-Dna36xA-.js';
|
|
4
|
+
export { e as LLMManager, L as LLMProvider, f as LLMProviderConfig, g as LLMProviderFactory, h as LLMProviderRegistry, b as LLMRequest, c as LLMResponse, d as LLMStreamChunk, i as ToolCall, T as ToolDefinition, j as globalProviderRegistry } from './provider-Dna36xA-.js';
|
|
5
|
+
export { AnthropicConfig, AnthropicProvider, DeepSeekConfig, DeepSeekProvider, DoubaoConfig, DoubaoProvider, GeminiConfig, GeminiProvider, MiniMaxConfig, MiniMaxProvider, MoonshotConfig, MoonshotProvider, OpenAIConfig, OpenAIProvider, QwenConfig, QwenProvider, ZhipuConfig, ZhipuProvider } from './llm/index.js';
|
|
6
|
+
export { AssetFile, DisclosureLevel, EnhancedSkillExecutor, EnhancedSkillExecutorConfig, ParsedSkill, ReferenceFile, RegistryConfig, LoadedSkill as ResourceLoadedSkill, ScriptExecutionResult, ScriptExecutorConfig, ScriptFile, SkillManagerConfig, SkillManifest, SkillRegistry, SkillResourceManager, SkillScriptExecutor, builtInSkills, builtInSkillsMap, createSkillFromManifest, echoSkill, listSkillsSkill, loadSkillFromDirectory, mathSkill, parseSkillMd, validateManifest } from './skills/index.js';
|
|
7
|
+
export { ToolRegistry, ToolRegistryConfig, builtInTools, fileReadTool, fileWriteTool, httpRequestTool } from './tools/index.js';
|
|
8
|
+
export { MCPClient, MCPClientConfig, MCPServer, MCPServerConfig } from './mcp/index.js';
|
|
9
|
+
export { BrowserStorageAdapter, NodeStorageAdapter, createStorage, getDefaultStorage, resetDefaultStorage } from './storage/index.js';
|
|
10
|
+
export { F as FileMetadata, S as StorageAdapter, b as StorageAdapterFactory, a as StorageConfig } from './types-CG5I-byI.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Decision Engine for automatic skill selection
|
|
14
|
+
* Optimized for minimal token consumption
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
interface Decision {
|
|
18
|
+
type: 'skill' | 'tool' | 'llm' | 'multi';
|
|
19
|
+
skills?: string[];
|
|
20
|
+
tools?: string[];
|
|
21
|
+
reasoning?: string;
|
|
22
|
+
confidence: number;
|
|
23
|
+
fallback?: string;
|
|
24
|
+
}
|
|
25
|
+
interface DecisionContext {
|
|
26
|
+
input: string;
|
|
27
|
+
history?: string[];
|
|
28
|
+
availableSkills: string[];
|
|
29
|
+
availableTools: string[];
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
interface DecisionEngineConfig {
|
|
33
|
+
threshold?: number;
|
|
34
|
+
maxSkills?: number;
|
|
35
|
+
enableEmbeddings?: boolean;
|
|
36
|
+
enableCaching?: boolean;
|
|
37
|
+
similarityThreshold?: number;
|
|
38
|
+
}
|
|
39
|
+
interface EmbeddingProvider {
|
|
40
|
+
embed(text: string): Promise<number[]>;
|
|
41
|
+
similarity(a: number[], b: number[]): number;
|
|
42
|
+
}
|
|
43
|
+
declare class SimpleEmbeddingProvider implements EmbeddingProvider {
|
|
44
|
+
private vocabulary;
|
|
45
|
+
private vocabSize;
|
|
46
|
+
private readonly maxVocabSize;
|
|
47
|
+
embed(text: string): Promise<number[]>;
|
|
48
|
+
similarity(a: number[], b: number[]): number;
|
|
49
|
+
private tokenize;
|
|
50
|
+
}
|
|
51
|
+
declare class DecisionEngine {
|
|
52
|
+
private skillEmbeddings;
|
|
53
|
+
private embeddingProvider;
|
|
54
|
+
private decisionCache;
|
|
55
|
+
private config;
|
|
56
|
+
constructor(config?: DecisionEngineConfig, embeddingProvider?: EmbeddingProvider);
|
|
57
|
+
/**
|
|
58
|
+
* Index skills for fast retrieval
|
|
59
|
+
*/
|
|
60
|
+
indexSkill(skill: Skill): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Make decision based on input
|
|
63
|
+
*/
|
|
64
|
+
decide(context: DecisionContext): Promise<Decision>;
|
|
65
|
+
/**
|
|
66
|
+
* Find relevant skills using similarity matching
|
|
67
|
+
*/
|
|
68
|
+
private findRelevantSkills;
|
|
69
|
+
/**
|
|
70
|
+
* Fallback matching using keyword extraction
|
|
71
|
+
*/
|
|
72
|
+
private fallbackSkillMatching;
|
|
73
|
+
/**
|
|
74
|
+
* Find relevant tools
|
|
75
|
+
*/
|
|
76
|
+
private findRelevantTools;
|
|
77
|
+
/**
|
|
78
|
+
* Extract keywords from skill
|
|
79
|
+
*/
|
|
80
|
+
private extractKeywords;
|
|
81
|
+
/**
|
|
82
|
+
* Extract keywords from text
|
|
83
|
+
*/
|
|
84
|
+
private extractKeywordsFromText;
|
|
85
|
+
/**
|
|
86
|
+
* Generate cache key
|
|
87
|
+
*/
|
|
88
|
+
private generateCacheKey;
|
|
89
|
+
/**
|
|
90
|
+
* Clear cache
|
|
91
|
+
*/
|
|
92
|
+
clearCache(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Get cache stats
|
|
95
|
+
*/
|
|
96
|
+
getCacheStats(): {
|
|
97
|
+
size: number;
|
|
98
|
+
hitRate?: number;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Dynamic Skill Loader
|
|
104
|
+
* Lazy loading and caching of skills
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
interface SkillLoaderConfig {
|
|
108
|
+
skillDirectory?: string;
|
|
109
|
+
enableLazyLoading?: boolean;
|
|
110
|
+
enableCaching?: boolean;
|
|
111
|
+
cacheSize?: number;
|
|
112
|
+
hotReload?: boolean;
|
|
113
|
+
}
|
|
114
|
+
interface SkillSource {
|
|
115
|
+
name: string;
|
|
116
|
+
type: 'builtin' | 'file' | 'url' | 'module';
|
|
117
|
+
source: string;
|
|
118
|
+
metadata?: Record<string, unknown>;
|
|
119
|
+
}
|
|
120
|
+
interface LoadedSkill extends Skill {
|
|
121
|
+
loadedAt: Date;
|
|
122
|
+
source: SkillSource;
|
|
123
|
+
size?: number;
|
|
124
|
+
}
|
|
125
|
+
declare class DynamicSkillLoader {
|
|
126
|
+
private loadedSkills;
|
|
127
|
+
private skillCache;
|
|
128
|
+
private skillSources;
|
|
129
|
+
private config;
|
|
130
|
+
constructor(config?: SkillLoaderConfig);
|
|
131
|
+
/**
|
|
132
|
+
* Register a skill source for lazy loading
|
|
133
|
+
*/
|
|
134
|
+
registerSource(source: SkillSource): void;
|
|
135
|
+
/**
|
|
136
|
+
* Load a skill dynamically
|
|
137
|
+
*/
|
|
138
|
+
load(name: string): Promise<Skill | null>;
|
|
139
|
+
/**
|
|
140
|
+
* Load multiple skills
|
|
141
|
+
*/
|
|
142
|
+
loadMultiple(names: string[]): Promise<Map<string, Skill>>;
|
|
143
|
+
/**
|
|
144
|
+
* Unload a skill
|
|
145
|
+
*/
|
|
146
|
+
unload(name: string): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Check if skill is loaded
|
|
149
|
+
*/
|
|
150
|
+
isLoaded(name: string): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Get loaded skill info
|
|
153
|
+
*/
|
|
154
|
+
getLoadedSkill(name: string): LoadedSkill | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* List all loaded skills
|
|
157
|
+
*/
|
|
158
|
+
listLoaded(): LoadedSkill[];
|
|
159
|
+
/**
|
|
160
|
+
* List available skill sources
|
|
161
|
+
*/
|
|
162
|
+
listSources(): SkillSource[];
|
|
163
|
+
/**
|
|
164
|
+
* Preload skills (eager loading)
|
|
165
|
+
*/
|
|
166
|
+
preload(names: string[]): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Get memory usage stats
|
|
169
|
+
*/
|
|
170
|
+
getStats(): {
|
|
171
|
+
loaded: number;
|
|
172
|
+
cached: number;
|
|
173
|
+
sources: number;
|
|
174
|
+
totalSize: number;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Clear cache
|
|
178
|
+
*/
|
|
179
|
+
clearCache(): void;
|
|
180
|
+
/**
|
|
181
|
+
* Clear all loaded skills
|
|
182
|
+
*/
|
|
183
|
+
clear(): void;
|
|
184
|
+
private loadBuiltin;
|
|
185
|
+
private loadFromFile;
|
|
186
|
+
private loadFromUrl;
|
|
187
|
+
private loadFromModule;
|
|
188
|
+
private validateSkill;
|
|
189
|
+
private enforceCacheLimit;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Token Optimizer
|
|
194
|
+
* Minimize token consumption for LLM calls
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
interface TokenOptimizerConfig {
|
|
198
|
+
maxContextTokens?: number;
|
|
199
|
+
maxSkillDescriptionLength?: number;
|
|
200
|
+
enableCompression?: boolean;
|
|
201
|
+
preserveSystemPrompt?: boolean;
|
|
202
|
+
}
|
|
203
|
+
interface TokenEstimate {
|
|
204
|
+
prompt: number;
|
|
205
|
+
completion: number;
|
|
206
|
+
total: number;
|
|
207
|
+
}
|
|
208
|
+
declare class TokenOptimizer {
|
|
209
|
+
private config;
|
|
210
|
+
constructor(config?: TokenOptimizerConfig);
|
|
211
|
+
/**
|
|
212
|
+
* Optimize skills for minimal token usage
|
|
213
|
+
*/
|
|
214
|
+
optimizeSkills(skills: Skill[], forQuery?: string): Skill[];
|
|
215
|
+
/**
|
|
216
|
+
* Compress a single skill
|
|
217
|
+
*/
|
|
218
|
+
private compressSkill;
|
|
219
|
+
/**
|
|
220
|
+
* Optimize tools for minimal token usage
|
|
221
|
+
*/
|
|
222
|
+
optimizeTools(tools: Tool[]): Tool[];
|
|
223
|
+
/**
|
|
224
|
+
* Optimize messages for context window
|
|
225
|
+
*/
|
|
226
|
+
optimizeMessages(messages: LLMMessage[], maxTokens?: number): LLMMessage[];
|
|
227
|
+
/**
|
|
228
|
+
* Build optimized prompt with skills
|
|
229
|
+
*/
|
|
230
|
+
buildOptimizedPrompt(userInput: string, availableSkills: Skill[], context?: string): string;
|
|
231
|
+
/**
|
|
232
|
+
* Estimate tokens for text
|
|
233
|
+
*/
|
|
234
|
+
estimateTokens(text: string): number;
|
|
235
|
+
/**
|
|
236
|
+
* Estimate tokens for messages
|
|
237
|
+
*/
|
|
238
|
+
estimateMessagesTokens(messages: LLMMessage[]): number;
|
|
239
|
+
/**
|
|
240
|
+
* Estimate tokens for skills
|
|
241
|
+
*/
|
|
242
|
+
estimateSkillsTokens(skills: Skill[]): number;
|
|
243
|
+
/**
|
|
244
|
+
* Get optimization stats
|
|
245
|
+
*/
|
|
246
|
+
getOptimizationStats(original: Skill[], optimized: Skill[]): {
|
|
247
|
+
originalTokens: number;
|
|
248
|
+
optimizedTokens: number;
|
|
249
|
+
savings: number;
|
|
250
|
+
savingsPercent: number;
|
|
251
|
+
};
|
|
252
|
+
private truncateDescription;
|
|
253
|
+
private compressParameters;
|
|
254
|
+
private isMetadataRelevant;
|
|
255
|
+
private formatSkillForPrompt;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Smart Agent with automatic skill selection
|
|
260
|
+
* Token-optimized decision making
|
|
261
|
+
*/
|
|
262
|
+
|
|
263
|
+
interface SmartAgentConfig extends AgentConfig {
|
|
264
|
+
decisionEngine?: DecisionEngineConfig;
|
|
265
|
+
skillLoader?: SkillLoaderConfig;
|
|
266
|
+
tokenOptimizer?: TokenOptimizerConfig;
|
|
267
|
+
autoDecide?: boolean;
|
|
268
|
+
maxAutoIterations?: number;
|
|
269
|
+
enableStreaming?: boolean;
|
|
270
|
+
}
|
|
271
|
+
interface AutoExecutionResult {
|
|
272
|
+
decision: Decision;
|
|
273
|
+
result: SkillResult | string;
|
|
274
|
+
tokensUsed: number;
|
|
275
|
+
executionTime: number;
|
|
276
|
+
skillsLoaded?: string[];
|
|
277
|
+
}
|
|
278
|
+
declare class SmartAgent extends Agent {
|
|
279
|
+
private decisionEngine;
|
|
280
|
+
private skillLoader;
|
|
281
|
+
private tokenOptimizer;
|
|
282
|
+
private executionHistory;
|
|
283
|
+
constructor(config: SmartAgentConfig);
|
|
284
|
+
/**
|
|
285
|
+
* Initialize the smart agent
|
|
286
|
+
*/
|
|
287
|
+
initialize(): Promise<void>;
|
|
288
|
+
/**
|
|
289
|
+
* Auto-process user input with smart decision making
|
|
290
|
+
*/
|
|
291
|
+
process(input: string, context?: string): Promise<AutoExecutionResult>;
|
|
292
|
+
/**
|
|
293
|
+
* Stream process user input
|
|
294
|
+
*/
|
|
295
|
+
streamProcess(input: string, context?: string): AsyncIterableIterator<{
|
|
296
|
+
type: 'decision' | 'skill' | 'tool' | 'llm' | 'complete';
|
|
297
|
+
data?: unknown;
|
|
298
|
+
}>;
|
|
299
|
+
/**
|
|
300
|
+
* Make decision based on input
|
|
301
|
+
*/
|
|
302
|
+
private makeDecision;
|
|
303
|
+
/**
|
|
304
|
+
* Extract parameters from input for a skill
|
|
305
|
+
*/
|
|
306
|
+
private extractParameters;
|
|
307
|
+
/**
|
|
308
|
+
* Coordinate multiple skills
|
|
309
|
+
*/
|
|
310
|
+
private coordinateSkills;
|
|
311
|
+
/**
|
|
312
|
+
* Coordinate multiple tools
|
|
313
|
+
*/
|
|
314
|
+
private coordinateTools;
|
|
315
|
+
/**
|
|
316
|
+
* Execute mixed skills and tools
|
|
317
|
+
*/
|
|
318
|
+
private executeMixed;
|
|
319
|
+
/**
|
|
320
|
+
* Direct LLM response
|
|
321
|
+
*/
|
|
322
|
+
private directLLMResponse;
|
|
323
|
+
/**
|
|
324
|
+
* Build parameter extraction prompt
|
|
325
|
+
*/
|
|
326
|
+
private buildParameterExtractionPrompt;
|
|
327
|
+
/**
|
|
328
|
+
* Simple parameter extraction without LLM
|
|
329
|
+
*/
|
|
330
|
+
private simpleParameterExtraction;
|
|
331
|
+
/**
|
|
332
|
+
* Register a skill source for dynamic loading
|
|
333
|
+
*/
|
|
334
|
+
registerSkillSource(name: string, source: string, type: 'file' | 'url' | 'module'): void;
|
|
335
|
+
/**
|
|
336
|
+
* Get execution history
|
|
337
|
+
*/
|
|
338
|
+
getExecutionHistory(): Array<{
|
|
339
|
+
input: string;
|
|
340
|
+
decision: Decision;
|
|
341
|
+
timestamp: Date;
|
|
342
|
+
}>;
|
|
343
|
+
/**
|
|
344
|
+
* Get decision engine stats
|
|
345
|
+
*/
|
|
346
|
+
getDecisionStats(): {
|
|
347
|
+
cacheSize: number;
|
|
348
|
+
loadedSkills: number;
|
|
349
|
+
historySize: number;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Clear execution history
|
|
353
|
+
*/
|
|
354
|
+
clearHistory(): void;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Advanced Decision Engine
|
|
359
|
+
*
|
|
360
|
+
* Features:
|
|
361
|
+
* - Multi-stage decision making with confidence scoring
|
|
362
|
+
* - Intent classification with hierarchical matching
|
|
363
|
+
* - Context-aware skill selection
|
|
364
|
+
* - Adaptive learning from execution history
|
|
365
|
+
*/
|
|
366
|
+
|
|
367
|
+
interface AdvancedDecision extends Decision {
|
|
368
|
+
intent: string;
|
|
369
|
+
intentConfidence: number;
|
|
370
|
+
subDecisions?: AdvancedDecision[];
|
|
371
|
+
estimatedTokens: number;
|
|
372
|
+
estimatedTime: number;
|
|
373
|
+
prerequisites?: string[];
|
|
374
|
+
postProcessing?: string[];
|
|
375
|
+
}
|
|
376
|
+
interface IntentPattern {
|
|
377
|
+
name: string;
|
|
378
|
+
patterns: RegExp[];
|
|
379
|
+
keywords: string[];
|
|
380
|
+
weight: number;
|
|
381
|
+
relatedSkills: string[];
|
|
382
|
+
}
|
|
383
|
+
interface ExecutionContext$1 {
|
|
384
|
+
previousDecisions: AdvancedDecision[];
|
|
385
|
+
userPreferences: Record<string, unknown>;
|
|
386
|
+
sessionContext: Record<string, unknown>;
|
|
387
|
+
constraints: {
|
|
388
|
+
maxTokens?: number;
|
|
389
|
+
maxTime?: number;
|
|
390
|
+
allowedSkills?: string[];
|
|
391
|
+
blockedSkills?: string[];
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
declare class AdvancedDecisionEngine {
|
|
395
|
+
private skillEmbeddings;
|
|
396
|
+
private intentPatterns;
|
|
397
|
+
private embeddingProvider;
|
|
398
|
+
private decisionCache;
|
|
399
|
+
private executionHistory;
|
|
400
|
+
private config;
|
|
401
|
+
constructor(config?: DecisionEngineConfig & {
|
|
402
|
+
enableIntentClassification?: boolean;
|
|
403
|
+
enableContextualMemory?: boolean;
|
|
404
|
+
learningRate?: number;
|
|
405
|
+
}, embeddingProvider?: EmbeddingProvider);
|
|
406
|
+
/**
|
|
407
|
+
* Initialize common intent patterns
|
|
408
|
+
*/
|
|
409
|
+
private initializeIntentPatterns;
|
|
410
|
+
/**
|
|
411
|
+
* Make advanced decision with full context analysis
|
|
412
|
+
*/
|
|
413
|
+
decide(context: DecisionContext, executionContext?: ExecutionContext$1): Promise<AdvancedDecision>;
|
|
414
|
+
/**
|
|
415
|
+
* Classify user intent from input
|
|
416
|
+
*/
|
|
417
|
+
private classifyIntent;
|
|
418
|
+
/**
|
|
419
|
+
* Find relevant skills with intent boosting
|
|
420
|
+
*/
|
|
421
|
+
private findRelevantSkills;
|
|
422
|
+
/**
|
|
423
|
+
* Find relevant tools with intent consideration
|
|
424
|
+
*/
|
|
425
|
+
private findRelevantTools;
|
|
426
|
+
/**
|
|
427
|
+
* Build comprehensive decision
|
|
428
|
+
*/
|
|
429
|
+
private buildDecision;
|
|
430
|
+
/**
|
|
431
|
+
* Build sub-decisions for complex scenarios
|
|
432
|
+
*/
|
|
433
|
+
private buildSubDecisions;
|
|
434
|
+
/**
|
|
435
|
+
* Enrich decision with execution context
|
|
436
|
+
*/
|
|
437
|
+
private enrichDecisionWithContext;
|
|
438
|
+
/**
|
|
439
|
+
* Estimate token usage
|
|
440
|
+
*/
|
|
441
|
+
private estimateTokenUsage;
|
|
442
|
+
/**
|
|
443
|
+
* Estimate execution time
|
|
444
|
+
*/
|
|
445
|
+
private estimateExecutionTime;
|
|
446
|
+
/**
|
|
447
|
+
* Learn from execution result
|
|
448
|
+
*/
|
|
449
|
+
learn(input: string, decision: AdvancedDecision, success: boolean, executionTime: number): void;
|
|
450
|
+
/**
|
|
451
|
+
* Index skill for retrieval
|
|
452
|
+
*/
|
|
453
|
+
indexSkill(skill: Skill): Promise<void>;
|
|
454
|
+
/**
|
|
455
|
+
* Extract keywords from skill
|
|
456
|
+
*/
|
|
457
|
+
private extractKeywords;
|
|
458
|
+
/**
|
|
459
|
+
* Extract keywords from text
|
|
460
|
+
*/
|
|
461
|
+
private extractKeywordsFromText;
|
|
462
|
+
/**
|
|
463
|
+
* Generate cache key
|
|
464
|
+
*/
|
|
465
|
+
private generateCacheKey;
|
|
466
|
+
/**
|
|
467
|
+
* Limit cache size
|
|
468
|
+
*/
|
|
469
|
+
private limitCacheSize;
|
|
470
|
+
/**
|
|
471
|
+
* Get performance statistics
|
|
472
|
+
*/
|
|
473
|
+
getStats(): {
|
|
474
|
+
cacheSize: number;
|
|
475
|
+
historySize: number;
|
|
476
|
+
intentPatterns: Array<{
|
|
477
|
+
name: string;
|
|
478
|
+
weight: number;
|
|
479
|
+
}>;
|
|
480
|
+
averageSuccessRate: number;
|
|
481
|
+
};
|
|
482
|
+
/**
|
|
483
|
+
* Clear all data
|
|
484
|
+
*/
|
|
485
|
+
clear(): void;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Advanced Parameter Extractor
|
|
490
|
+
*
|
|
491
|
+
* Features:
|
|
492
|
+
* - Multi-strategy parameter extraction (LLM, pattern, context)
|
|
493
|
+
* - Type coercion and validation
|
|
494
|
+
* - Required/optional parameter handling
|
|
495
|
+
* - Context-aware extraction
|
|
496
|
+
*/
|
|
497
|
+
|
|
498
|
+
interface ParameterSchema {
|
|
499
|
+
type: 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
500
|
+
description: string;
|
|
501
|
+
required?: boolean;
|
|
502
|
+
default?: unknown;
|
|
503
|
+
enum?: unknown[];
|
|
504
|
+
pattern?: string;
|
|
505
|
+
min?: number;
|
|
506
|
+
max?: number;
|
|
507
|
+
items?: ParameterSchema;
|
|
508
|
+
properties?: Record<string, ParameterSchema>;
|
|
509
|
+
}
|
|
510
|
+
interface ExtractionResult {
|
|
511
|
+
params: Record<string, unknown>;
|
|
512
|
+
confidence: number;
|
|
513
|
+
missing: string[];
|
|
514
|
+
invalid: Array<{
|
|
515
|
+
param: string;
|
|
516
|
+
reason: string;
|
|
517
|
+
}>;
|
|
518
|
+
suggestions: Array<{
|
|
519
|
+
param: string;
|
|
520
|
+
suggestion: string;
|
|
521
|
+
}>;
|
|
522
|
+
}
|
|
523
|
+
interface ExtractionContext {
|
|
524
|
+
previousParams?: Record<string, unknown>;
|
|
525
|
+
userPreferences?: Record<string, unknown>;
|
|
526
|
+
conversationHistory?: string[];
|
|
527
|
+
extractedEntities?: Record<string, unknown>;
|
|
528
|
+
}
|
|
529
|
+
interface ExtractorConfig {
|
|
530
|
+
useLLM?: boolean;
|
|
531
|
+
usePatternMatching?: boolean;
|
|
532
|
+
useContextInference?: boolean;
|
|
533
|
+
confidenceThreshold?: number;
|
|
534
|
+
maxRetries?: number;
|
|
535
|
+
}
|
|
536
|
+
declare class ParameterExtractor {
|
|
537
|
+
private config;
|
|
538
|
+
constructor(config?: ExtractorConfig);
|
|
539
|
+
/**
|
|
540
|
+
* Extract parameters from input using multiple strategies
|
|
541
|
+
*/
|
|
542
|
+
extract(input: string, skill: Skill, context?: ExtractionContext, llmProvider?: {
|
|
543
|
+
complete(prompt: string): Promise<{
|
|
544
|
+
content: string;
|
|
545
|
+
}>;
|
|
546
|
+
}): Promise<ExtractionResult>;
|
|
547
|
+
/**
|
|
548
|
+
* Extract parameters using pattern matching
|
|
549
|
+
*/
|
|
550
|
+
private extractWithPatterns;
|
|
551
|
+
/**
|
|
552
|
+
* Convert ParameterProperty to ParameterSchema
|
|
553
|
+
*/
|
|
554
|
+
private convertPropertyToSchema;
|
|
555
|
+
/**
|
|
556
|
+
* Extract a single value using patterns
|
|
557
|
+
*/
|
|
558
|
+
private extractValueWithPatterns;
|
|
559
|
+
/**
|
|
560
|
+
* Extract array values
|
|
561
|
+
*/
|
|
562
|
+
private extractArrayValue;
|
|
563
|
+
/**
|
|
564
|
+
* Coerce value to correct type
|
|
565
|
+
*/
|
|
566
|
+
private coerceValue;
|
|
567
|
+
/**
|
|
568
|
+
* Validate extracted value
|
|
569
|
+
*/
|
|
570
|
+
private validateValue;
|
|
571
|
+
/**
|
|
572
|
+
* Extract parameters from context
|
|
573
|
+
*/
|
|
574
|
+
private extractFromContext;
|
|
575
|
+
/**
|
|
576
|
+
* Extract parameters using LLM
|
|
577
|
+
*/
|
|
578
|
+
private extractWithLLM;
|
|
579
|
+
/**
|
|
580
|
+
* Build LLM extraction prompt
|
|
581
|
+
*/
|
|
582
|
+
private buildExtractionPrompt;
|
|
583
|
+
/**
|
|
584
|
+
* Merge extraction results from multiple strategies
|
|
585
|
+
*/
|
|
586
|
+
private mergeResults;
|
|
587
|
+
/**
|
|
588
|
+
* Generate helpful suggestion for invalid parameter
|
|
589
|
+
*/
|
|
590
|
+
private generateSuggestion;
|
|
591
|
+
/**
|
|
592
|
+
* Validate all parameters against schema
|
|
593
|
+
*/
|
|
594
|
+
validate(params: Record<string, unknown>, skill: Skill): ExtractionResult;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Perfect Agent Execution Architecture
|
|
599
|
+
*
|
|
600
|
+
* Design Principles:
|
|
601
|
+
* 1. **Deterministic Execution**: Every decision is traceable and reproducible
|
|
602
|
+
* 2. **Graceful Degradation**: Fallback chains ensure robustness
|
|
603
|
+
* 3. **Token Efficiency**: Minimal LLM calls with maximum context utilization
|
|
604
|
+
* 4. **Observability**: Full execution tracing and metrics
|
|
605
|
+
* 5. **Extensibility**: Plugin-based architecture for custom behaviors
|
|
606
|
+
* 6. **Type Safety**: Full TypeScript coverage with runtime validation
|
|
607
|
+
*
|
|
608
|
+
* Architecture Layers:
|
|
609
|
+
* - Execution Layer: Orchestrates skill/tool/LLM execution
|
|
610
|
+
* - Decision Layer: Intelligent routing and planning
|
|
611
|
+
* - Optimization Layer: Token and performance optimization
|
|
612
|
+
* - Observability Layer: Metrics, tracing, and logging
|
|
613
|
+
*/
|
|
614
|
+
type ExecutionStatus = 'pending' | 'planning' | 'executing' | 'waiting_for_input' | 'retrying' | 'completed' | 'failed' | 'cancelled';
|
|
615
|
+
type ExecutionPhase = 'initialization' | 'decision' | 'parameter_extraction' | 'execution' | 'result_processing' | 'completion';
|
|
616
|
+
interface ExecutionContext {
|
|
617
|
+
executionId: string;
|
|
618
|
+
parentExecutionId?: string;
|
|
619
|
+
sessionId: string;
|
|
620
|
+
userId?: string;
|
|
621
|
+
timestamp: Date;
|
|
622
|
+
metadata: Record<string, unknown>;
|
|
623
|
+
}
|
|
624
|
+
interface ExecutionPlan {
|
|
625
|
+
id: string;
|
|
626
|
+
steps: ExecutionStep[];
|
|
627
|
+
strategy: ExecutionStrategy;
|
|
628
|
+
estimatedTokens: number;
|
|
629
|
+
estimatedTime: number;
|
|
630
|
+
fallbackPlan?: ExecutionPlan;
|
|
631
|
+
}
|
|
632
|
+
interface ExecutionStep {
|
|
633
|
+
id: string;
|
|
634
|
+
type: 'skill' | 'tool' | 'llm' | 'condition' | 'parallel' | 'sequence';
|
|
635
|
+
target: string;
|
|
636
|
+
parameters?: Record<string, unknown>;
|
|
637
|
+
dependencies?: string[];
|
|
638
|
+
timeout?: number;
|
|
639
|
+
retries?: number;
|
|
640
|
+
onError?: 'fail' | 'skip' | 'fallback';
|
|
641
|
+
condition?: StepCondition;
|
|
642
|
+
}
|
|
643
|
+
interface StepCondition {
|
|
644
|
+
operator: 'and' | 'or' | 'not';
|
|
645
|
+
conditions?: StepCondition[];
|
|
646
|
+
stepId?: string;
|
|
647
|
+
expectedResult?: unknown;
|
|
648
|
+
}
|
|
649
|
+
type ExecutionStrategy = 'sequential' | 'parallel' | 'adaptive' | 'retry_with_backoff';
|
|
650
|
+
interface ExecutionResult {
|
|
651
|
+
executionId: string;
|
|
652
|
+
status: ExecutionStatus;
|
|
653
|
+
plan: ExecutionPlan;
|
|
654
|
+
stepResults: StepResult[];
|
|
655
|
+
finalOutput: unknown;
|
|
656
|
+
metrics: ExecutionMetrics;
|
|
657
|
+
errors: ExecutionError[];
|
|
658
|
+
trace: ExecutionTrace;
|
|
659
|
+
}
|
|
660
|
+
interface StepResult {
|
|
661
|
+
stepId: string;
|
|
662
|
+
status: ExecutionStatus;
|
|
663
|
+
output?: unknown;
|
|
664
|
+
error?: ExecutionError;
|
|
665
|
+
executionTime: number;
|
|
666
|
+
tokensUsed: number;
|
|
667
|
+
startTime: Date;
|
|
668
|
+
endTime: Date;
|
|
669
|
+
}
|
|
670
|
+
interface ExecutionError {
|
|
671
|
+
stepId: string;
|
|
672
|
+
code: string;
|
|
673
|
+
message: string;
|
|
674
|
+
stack?: string;
|
|
675
|
+
recoverable: boolean;
|
|
676
|
+
suggestedAction?: string;
|
|
677
|
+
}
|
|
678
|
+
interface ExecutionMetrics {
|
|
679
|
+
totalTime: number;
|
|
680
|
+
totalTokens: number;
|
|
681
|
+
llmCalls: number;
|
|
682
|
+
skillCalls: number;
|
|
683
|
+
toolCalls: number;
|
|
684
|
+
cacheHits: number;
|
|
685
|
+
cacheMisses: number;
|
|
686
|
+
retryCount: number;
|
|
687
|
+
}
|
|
688
|
+
interface ExecutionTrace {
|
|
689
|
+
phases: PhaseTrace[];
|
|
690
|
+
decisions: DecisionTrace[];
|
|
691
|
+
llmCalls: LLMCallTrace[];
|
|
692
|
+
}
|
|
693
|
+
interface PhaseTrace {
|
|
694
|
+
phase: ExecutionPhase;
|
|
695
|
+
startTime: Date;
|
|
696
|
+
endTime: Date;
|
|
697
|
+
duration: number;
|
|
698
|
+
metadata?: Record<string, unknown>;
|
|
699
|
+
}
|
|
700
|
+
interface DecisionTrace {
|
|
701
|
+
timestamp: Date;
|
|
702
|
+
input: string;
|
|
703
|
+
decision: string;
|
|
704
|
+
confidence: number;
|
|
705
|
+
alternatives: string[];
|
|
706
|
+
reasoning: string;
|
|
707
|
+
}
|
|
708
|
+
interface LLMCallTrace {
|
|
709
|
+
timestamp: Date;
|
|
710
|
+
model: string;
|
|
711
|
+
promptTokens: number;
|
|
712
|
+
completionTokens: number;
|
|
713
|
+
totalTokens: number;
|
|
714
|
+
duration: number;
|
|
715
|
+
purpose: string;
|
|
716
|
+
}
|
|
717
|
+
interface RetryPolicy {
|
|
718
|
+
maxRetries: number;
|
|
719
|
+
backoffStrategy: 'fixed' | 'linear' | 'exponential';
|
|
720
|
+
baseDelay: number;
|
|
721
|
+
maxDelay: number;
|
|
722
|
+
retryableErrors: string[];
|
|
723
|
+
onRetry?: (attempt: number, error: Error, delay: number) => void;
|
|
724
|
+
}
|
|
725
|
+
interface CircuitBreakerConfig {
|
|
726
|
+
failureThreshold: number;
|
|
727
|
+
resetTimeout: number;
|
|
728
|
+
halfOpenMaxCalls: number;
|
|
729
|
+
}
|
|
730
|
+
interface ResilienceContext {
|
|
731
|
+
retryPolicy: RetryPolicy;
|
|
732
|
+
circuitBreaker?: CircuitBreakerConfig;
|
|
733
|
+
timeout?: number;
|
|
734
|
+
}
|
|
735
|
+
interface ExecutionObserver {
|
|
736
|
+
onExecutionStart?(context: ExecutionContext): void;
|
|
737
|
+
onPhaseStart?(phase: ExecutionPhase, context: ExecutionContext): void;
|
|
738
|
+
onPhaseEnd?(phase: ExecutionPhase, duration: number, context: ExecutionContext): void;
|
|
739
|
+
onStepStart?(step: ExecutionStep, context: ExecutionContext): void;
|
|
740
|
+
onStepEnd?(step: ExecutionStep, result: StepResult, context: ExecutionContext): void;
|
|
741
|
+
onDecision?(decision: DecisionTrace, context: ExecutionContext): void;
|
|
742
|
+
onLLMCall?(call: LLMCallTrace, context: ExecutionContext): void;
|
|
743
|
+
onError?(error: ExecutionError, context: ExecutionContext): void;
|
|
744
|
+
onExecutionEnd?(result: ExecutionResult, context: ExecutionContext): void;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Perfect Execution Engine - Part 1: Core Engine
|
|
749
|
+
*
|
|
750
|
+
* Features:
|
|
751
|
+
* - Deterministic execution with full traceability
|
|
752
|
+
* - Multi-strategy execution (sequential, parallel, adaptive)
|
|
753
|
+
* - Comprehensive retry and circuit breaker patterns
|
|
754
|
+
* - Real-time execution monitoring
|
|
755
|
+
*/
|
|
756
|
+
|
|
757
|
+
interface ExecutionEngineConfig {
|
|
758
|
+
defaultTimeout?: number;
|
|
759
|
+
defaultRetryPolicy?: RetryPolicy;
|
|
760
|
+
enableTracing?: boolean;
|
|
761
|
+
enableMetrics?: boolean;
|
|
762
|
+
maxConcurrentExecutions?: number;
|
|
763
|
+
observers?: ExecutionObserver[];
|
|
764
|
+
}
|
|
765
|
+
declare class ExecutionEngine {
|
|
766
|
+
private config;
|
|
767
|
+
private activeExecutions;
|
|
768
|
+
private circuitBreakers;
|
|
769
|
+
private metrics;
|
|
770
|
+
constructor(config?: ExecutionEngineConfig);
|
|
771
|
+
execute(plan: ExecutionPlan, context?: Partial<ExecutionContext>, resilience?: ResilienceContext): Promise<ExecutionResult>;
|
|
772
|
+
private executeSteps;
|
|
773
|
+
private executeStepWithResilience;
|
|
774
|
+
private executeStep;
|
|
775
|
+
private executeWithTimeout;
|
|
776
|
+
private executePhase;
|
|
777
|
+
private validatePlan;
|
|
778
|
+
private processResults;
|
|
779
|
+
private determineFinalStatus;
|
|
780
|
+
private calculateBackoff;
|
|
781
|
+
private isRetryableError;
|
|
782
|
+
private getCircuitBreaker;
|
|
783
|
+
cancelExecution(executionId: string): boolean;
|
|
784
|
+
getMetrics(): ExecutionMetrics;
|
|
785
|
+
resetMetrics(): void;
|
|
786
|
+
addObserver(observer: ExecutionObserver): void;
|
|
787
|
+
removeObserver(observer: ExecutionObserver): void;
|
|
788
|
+
private notifyObservers;
|
|
789
|
+
private generateId;
|
|
790
|
+
private sleep;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Plugin System
|
|
795
|
+
* Extensible architecture for adding capabilities
|
|
796
|
+
*/
|
|
797
|
+
|
|
798
|
+
interface PluginManagerConfig {
|
|
799
|
+
autoLoad?: boolean;
|
|
800
|
+
pluginDirectory?: string;
|
|
801
|
+
allowedPlugins?: string[];
|
|
802
|
+
}
|
|
803
|
+
declare class PluginManager {
|
|
804
|
+
private agent;
|
|
805
|
+
private config;
|
|
806
|
+
private plugins;
|
|
807
|
+
private contexts;
|
|
808
|
+
constructor(agent: Agent, config?: PluginManagerConfig);
|
|
809
|
+
load(plugin: Plugin, config?: Record<string, unknown>): Promise<void>;
|
|
810
|
+
unload(name: string): Promise<void>;
|
|
811
|
+
get(name: string): Plugin | undefined;
|
|
812
|
+
getContext(name: string): PluginContext | undefined;
|
|
813
|
+
list(): Plugin[];
|
|
814
|
+
listNames(): string[];
|
|
815
|
+
isLoaded(name: string): boolean;
|
|
816
|
+
reload(name: string): Promise<void>;
|
|
817
|
+
unloadAll(): Promise<void>;
|
|
818
|
+
getStats(): {
|
|
819
|
+
total: number;
|
|
820
|
+
withDestroy: number;
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
interface PluginFactory {
|
|
824
|
+
create(config: Record<string, unknown>): Plugin | Promise<Plugin>;
|
|
825
|
+
}
|
|
826
|
+
declare class PluginLoader {
|
|
827
|
+
private factories;
|
|
828
|
+
registerFactory(type: string, factory: PluginFactory): void;
|
|
829
|
+
loadFromSource(type: string, source: string, config?: Record<string, unknown>): Promise<Plugin>;
|
|
830
|
+
private loadConfig;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* Main exports for sdkwork-browser-agent
|
|
835
|
+
* Browser and Node.js compatible agent architecture
|
|
836
|
+
*/
|
|
837
|
+
|
|
838
|
+
declare const VERSION = "1.0.0";
|
|
839
|
+
declare const isBrowser: boolean;
|
|
840
|
+
declare const isNode: boolean;
|
|
841
|
+
|
|
842
|
+
export { type AdvancedDecision, AdvancedDecisionEngine, type ExecutionContext$1 as AdvancedExecutionContext, Agent, AgentConfig, type AutoExecutionResult, type Decision, type DecisionContext, DecisionEngine, type DecisionEngineConfig, DynamicSkillLoader, type EmbeddingProvider, ExecutionEngine, type ExecutionEngineConfig, type ExtractionContext, type ExtractionResult, type ExtractorConfig, type ParameterSchema as ExtractorParameterSchema, type IntentPattern, LLMMessage, type LoadedSkill, ParameterExtractor, Plugin, PluginContext, type PluginFactory, PluginLoader, PluginManager, type PluginManagerConfig, SimpleEmbeddingProvider, Skill, type SkillLoaderConfig, SkillResult, type SkillSource, SmartAgent, type SmartAgentConfig, type TokenEstimate, TokenOptimizer, type TokenOptimizerConfig, Tool, VERSION, isBrowser, isNode };
|