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,401 @@
|
|
|
1
|
+
import { S as Skill, E as ExecutionContext, a as SkillResult } from '../agent-Bpxmkz8W.js';
|
|
2
|
+
import { S as StorageAdapter } from '../types-CG5I-byI.js';
|
|
3
|
+
import '../provider-Dna36xA-.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Enhanced Skill Registry
|
|
7
|
+
* Advanced caching, indexing, and skill management
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
interface RegistryConfig {
|
|
11
|
+
storage?: StorageAdapter | null;
|
|
12
|
+
enableCache?: boolean;
|
|
13
|
+
enableIndexing?: boolean;
|
|
14
|
+
maxCacheSize?: number;
|
|
15
|
+
cacheTTL?: number;
|
|
16
|
+
hotReload?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare class SkillRegistry {
|
|
19
|
+
private skills;
|
|
20
|
+
private index;
|
|
21
|
+
private config;
|
|
22
|
+
private storage;
|
|
23
|
+
private watchers;
|
|
24
|
+
constructor(config?: RegistryConfig);
|
|
25
|
+
/**
|
|
26
|
+
* Register a skill in the registry
|
|
27
|
+
*/
|
|
28
|
+
register(skill: Skill): void;
|
|
29
|
+
/**
|
|
30
|
+
* Unregister a skill
|
|
31
|
+
*/
|
|
32
|
+
unregister(name: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Get a skill by name
|
|
35
|
+
*/
|
|
36
|
+
get(name: string): Skill | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Check if skill exists
|
|
39
|
+
*/
|
|
40
|
+
has(name: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Find skills by category
|
|
43
|
+
*/
|
|
44
|
+
findByCategory(category: string): Skill[];
|
|
45
|
+
/**
|
|
46
|
+
* Find skills by tag
|
|
47
|
+
*/
|
|
48
|
+
findByTag(tag: string): Skill[];
|
|
49
|
+
/**
|
|
50
|
+
* Search skills by keyword
|
|
51
|
+
*/
|
|
52
|
+
search(keyword: string): Skill[];
|
|
53
|
+
/**
|
|
54
|
+
* Get all registered skills
|
|
55
|
+
*/
|
|
56
|
+
getAll(): Skill[];
|
|
57
|
+
/**
|
|
58
|
+
* Get all skill names
|
|
59
|
+
*/
|
|
60
|
+
getNames(): string[];
|
|
61
|
+
/**
|
|
62
|
+
* Get skills by names
|
|
63
|
+
*/
|
|
64
|
+
getMany(names: string[]): Skill[];
|
|
65
|
+
/**
|
|
66
|
+
* Get registry statistics
|
|
67
|
+
*/
|
|
68
|
+
getStats(): {
|
|
69
|
+
totalSkills: number;
|
|
70
|
+
totalSize: number;
|
|
71
|
+
averageAccessCount: number;
|
|
72
|
+
cacheHitRate: number;
|
|
73
|
+
categories: string[];
|
|
74
|
+
tags: string[];
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Clear all skills
|
|
78
|
+
*/
|
|
79
|
+
clear(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Clear expired cache entries
|
|
82
|
+
*/
|
|
83
|
+
clearExpired(): number;
|
|
84
|
+
/**
|
|
85
|
+
* Optimize cache by removing least recently used entries
|
|
86
|
+
*/
|
|
87
|
+
optimizeCache(): void;
|
|
88
|
+
private indexSkill;
|
|
89
|
+
private removeFromIndex;
|
|
90
|
+
private clearIndex;
|
|
91
|
+
private calculateSkillSize;
|
|
92
|
+
private calculateCacheHitRate;
|
|
93
|
+
private watchSkill;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Built-in Skills - TypeScript Implementations
|
|
98
|
+
*
|
|
99
|
+
* Each skill follows the Agent Skills Specification:
|
|
100
|
+
* - SKILL.md with YAML frontmatter
|
|
101
|
+
* - Progressive disclosure pattern
|
|
102
|
+
* - Standardized parameters and responses
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
declare const echoSkill: Skill;
|
|
106
|
+
declare const mathSkill: Skill;
|
|
107
|
+
declare const listSkillsSkill: Skill;
|
|
108
|
+
declare const builtInSkills: Skill[];
|
|
109
|
+
declare const builtInSkillsMap: Map<string, Skill>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Agent Skills Specification Loader
|
|
113
|
+
*
|
|
114
|
+
* Loads skills following the Agent Skills Specification:
|
|
115
|
+
* - skill-name/
|
|
116
|
+
* └── SKILL.md (with YAML frontmatter)
|
|
117
|
+
* └── scripts/ (optional)
|
|
118
|
+
* └── references/ (optional)
|
|
119
|
+
* └── assets/ (optional)
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
interface SkillManifest {
|
|
123
|
+
name: string;
|
|
124
|
+
description: string;
|
|
125
|
+
license?: string;
|
|
126
|
+
compatibility?: string;
|
|
127
|
+
metadata?: Record<string, string>;
|
|
128
|
+
allowedTools?: string[];
|
|
129
|
+
}
|
|
130
|
+
interface ParsedSkill {
|
|
131
|
+
manifest: SkillManifest;
|
|
132
|
+
instructions: string;
|
|
133
|
+
skill: Skill;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Parse SKILL.md content
|
|
137
|
+
* Extracts YAML frontmatter and markdown body
|
|
138
|
+
*/
|
|
139
|
+
declare function parseSkillMd(content: string): {
|
|
140
|
+
manifest: SkillManifest;
|
|
141
|
+
instructions: string;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Convert manifest and instructions to Skill object
|
|
145
|
+
* Note: This creates a placeholder skill. Real implementation
|
|
146
|
+
* would need to load actual handler from scripts/ directory
|
|
147
|
+
*/
|
|
148
|
+
declare function createSkillFromManifest(manifest: SkillManifest, _instructions: string): Skill;
|
|
149
|
+
/**
|
|
150
|
+
* Load skill from directory
|
|
151
|
+
*/
|
|
152
|
+
declare function loadSkillFromDirectory(skillPath: string): Promise<ParsedSkill>;
|
|
153
|
+
/**
|
|
154
|
+
* Validate skill manifest
|
|
155
|
+
*/
|
|
156
|
+
declare function validateManifest(manifest: SkillManifest): {
|
|
157
|
+
valid: boolean;
|
|
158
|
+
errors: string[];
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Skill Resource Manager
|
|
163
|
+
*
|
|
164
|
+
* Manages loading and execution of skills following Agent Skills Specification
|
|
165
|
+
* Implements progressive disclosure: metadata → instructions → resources
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
interface ScriptFile {
|
|
169
|
+
name: string;
|
|
170
|
+
path: string;
|
|
171
|
+
language: 'javascript' | 'typescript' | 'python' | 'bash';
|
|
172
|
+
content: string;
|
|
173
|
+
}
|
|
174
|
+
interface ReferenceFile {
|
|
175
|
+
name: string;
|
|
176
|
+
path: string;
|
|
177
|
+
content: string;
|
|
178
|
+
}
|
|
179
|
+
interface AssetFile {
|
|
180
|
+
name: string;
|
|
181
|
+
path: string;
|
|
182
|
+
type: 'template' | 'image' | 'data' | 'other';
|
|
183
|
+
content: string;
|
|
184
|
+
}
|
|
185
|
+
type DisclosureLevel = 'metadata' | 'instructions' | 'resources';
|
|
186
|
+
interface LoadedSkill {
|
|
187
|
+
name: string;
|
|
188
|
+
path: string;
|
|
189
|
+
manifest: SkillManifest;
|
|
190
|
+
instructions?: string;
|
|
191
|
+
scripts: Map<string, ScriptFile>;
|
|
192
|
+
references: Map<string, ReferenceFile>;
|
|
193
|
+
assets: Map<string, AssetFile>;
|
|
194
|
+
currentLevel: DisclosureLevel;
|
|
195
|
+
loadedAt: Date;
|
|
196
|
+
}
|
|
197
|
+
interface SkillManagerConfig {
|
|
198
|
+
basePath?: string;
|
|
199
|
+
enableCaching?: boolean;
|
|
200
|
+
maxCacheSize?: number;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Skill Resource Manager
|
|
204
|
+
* Manages loading and execution of skills following Agent Skills Specification
|
|
205
|
+
*/
|
|
206
|
+
declare class SkillResourceManager {
|
|
207
|
+
private config;
|
|
208
|
+
private cache;
|
|
209
|
+
private metadataCache;
|
|
210
|
+
constructor(config?: SkillManagerConfig);
|
|
211
|
+
/**
|
|
212
|
+
* Level 1: Load metadata only (~100 tokens)
|
|
213
|
+
* Loaded at startup for all skills
|
|
214
|
+
*/
|
|
215
|
+
loadMetadata(skillPath: string): Promise<SkillManifest>;
|
|
216
|
+
/**
|
|
217
|
+
* Level 2: Load instructions (< 5000 tokens)
|
|
218
|
+
* Loaded when skill is activated
|
|
219
|
+
*/
|
|
220
|
+
loadInstructions(skillPath: string): Promise<string>;
|
|
221
|
+
/**
|
|
222
|
+
* Level 3: Load complete skill with resources
|
|
223
|
+
* Resources loaded as needed
|
|
224
|
+
*/
|
|
225
|
+
loadFullSkill(skillPath: string): Promise<LoadedSkill>;
|
|
226
|
+
/**
|
|
227
|
+
* Progressive loading - load up to specified level
|
|
228
|
+
*/
|
|
229
|
+
loadProgressive(skillPath: string, level?: DisclosureLevel): Promise<LoadedSkill>;
|
|
230
|
+
/**
|
|
231
|
+
* Load a specific resource on demand
|
|
232
|
+
*/
|
|
233
|
+
loadResource(skillPath: string, type: 'script' | 'reference' | 'asset', name: string): Promise<ScriptFile | ReferenceFile | AssetFile | null>;
|
|
234
|
+
/**
|
|
235
|
+
* Get reference content
|
|
236
|
+
*/
|
|
237
|
+
getReference(skillPath: string, referenceName: string): Promise<string | null>;
|
|
238
|
+
/**
|
|
239
|
+
* Get asset content
|
|
240
|
+
*/
|
|
241
|
+
getAsset(skillPath: string, assetName: string): Promise<string | null>;
|
|
242
|
+
private loadScripts;
|
|
243
|
+
private loadReferences;
|
|
244
|
+
private loadAssets;
|
|
245
|
+
private loadScript;
|
|
246
|
+
private loadReference;
|
|
247
|
+
private loadAsset;
|
|
248
|
+
private parseSkillMd;
|
|
249
|
+
private parseYaml;
|
|
250
|
+
private parseYamlValue;
|
|
251
|
+
/**
|
|
252
|
+
* Validate manifest according to Agent Skills Specification
|
|
253
|
+
*/
|
|
254
|
+
private validateManifest;
|
|
255
|
+
private detectLanguage;
|
|
256
|
+
private detectAssetType;
|
|
257
|
+
private enforceCacheLimit;
|
|
258
|
+
private readFile;
|
|
259
|
+
private listDirectory;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Enhanced Skill Script Executor
|
|
264
|
+
*
|
|
265
|
+
* Executes scripts from Skill scripts/ directory with comprehensive sandboxing
|
|
266
|
+
* Supports JavaScript, TypeScript, Python, and Bash with security controls
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
interface ScriptExecutionResult {
|
|
270
|
+
success: boolean;
|
|
271
|
+
output?: unknown;
|
|
272
|
+
error?: string;
|
|
273
|
+
executionTime: number;
|
|
274
|
+
memoryUsage?: number;
|
|
275
|
+
}
|
|
276
|
+
interface ScriptExecutorConfig {
|
|
277
|
+
timeout?: number;
|
|
278
|
+
allowedGlobals?: string[];
|
|
279
|
+
restrictedGlobals?: string[];
|
|
280
|
+
maxMemoryMB?: number;
|
|
281
|
+
allowedTools?: string[];
|
|
282
|
+
enableLogging?: boolean;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Enhanced Skill Script Executor with comprehensive sandboxing
|
|
286
|
+
*/
|
|
287
|
+
declare class SkillScriptExecutor {
|
|
288
|
+
private config;
|
|
289
|
+
private executionCount;
|
|
290
|
+
constructor(config?: ScriptExecutorConfig);
|
|
291
|
+
/**
|
|
292
|
+
* Execute a script with given operation and parameters
|
|
293
|
+
*/
|
|
294
|
+
execute(script: ScriptFile, operation: string, params: Record<string, unknown>, context: ExecutionContext): Promise<ScriptExecutionResult>;
|
|
295
|
+
/**
|
|
296
|
+
* Check if script is allowed to execute based on allowed-tools configuration
|
|
297
|
+
*/
|
|
298
|
+
private isScriptAllowed;
|
|
299
|
+
/**
|
|
300
|
+
* Execute JavaScript/TypeScript in secure sandbox
|
|
301
|
+
*/
|
|
302
|
+
private executeJavaScript;
|
|
303
|
+
/**
|
|
304
|
+
* Sanitize JavaScript code to remove dangerous patterns
|
|
305
|
+
*/
|
|
306
|
+
private sanitizeJavaScript;
|
|
307
|
+
/**
|
|
308
|
+
* Create sandbox context with allowed globals
|
|
309
|
+
*/
|
|
310
|
+
private createSandbox;
|
|
311
|
+
/**
|
|
312
|
+
* Execute JavaScript in browser using Web Worker
|
|
313
|
+
*/
|
|
314
|
+
private executeInBrowserWorker;
|
|
315
|
+
/**
|
|
316
|
+
* Execute JavaScript in Node.js using VM module
|
|
317
|
+
*/
|
|
318
|
+
private executeInNodeVM;
|
|
319
|
+
/**
|
|
320
|
+
* Execute Python code (requires Python runtime)
|
|
321
|
+
*/
|
|
322
|
+
private executePython;
|
|
323
|
+
/**
|
|
324
|
+
* Execute Bash script (Node.js only)
|
|
325
|
+
*/
|
|
326
|
+
private executeBash;
|
|
327
|
+
/**
|
|
328
|
+
* Get executor statistics
|
|
329
|
+
*/
|
|
330
|
+
getStats(): {
|
|
331
|
+
totalExecutions: number;
|
|
332
|
+
config: ScriptExecutorConfig;
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Enhanced Skill Executor
|
|
338
|
+
*
|
|
339
|
+
* Integrates SkillResourceManager and SkillScriptExecutor
|
|
340
|
+
* Provides complete Skill execution with resource loading
|
|
341
|
+
*/
|
|
342
|
+
|
|
343
|
+
interface EnhancedSkillExecutorConfig {
|
|
344
|
+
resourceManager?: SkillResourceManager;
|
|
345
|
+
scriptExecutor?: SkillScriptExecutor;
|
|
346
|
+
defaultScriptName?: string;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Enhanced Skill Executor with full resource support
|
|
350
|
+
*/
|
|
351
|
+
declare class EnhancedSkillExecutor {
|
|
352
|
+
private resourceManager;
|
|
353
|
+
private scriptExecutor;
|
|
354
|
+
private defaultScriptName;
|
|
355
|
+
constructor(config?: EnhancedSkillExecutorConfig);
|
|
356
|
+
/**
|
|
357
|
+
* Execute a skill with full resource loading
|
|
358
|
+
*
|
|
359
|
+
* This method:
|
|
360
|
+
* 1. Loads the skill with all resources (if not cached)
|
|
361
|
+
* 2. Finds the appropriate script
|
|
362
|
+
* 3. Executes the script with the operation and parameters
|
|
363
|
+
* 4. Returns the result
|
|
364
|
+
*/
|
|
365
|
+
execute(skillPath: string, operation: string, params: Record<string, unknown> | undefined, context: ExecutionContext): Promise<SkillResult>;
|
|
366
|
+
/**
|
|
367
|
+
* Execute skill with progressive loading
|
|
368
|
+
* Loads only metadata first, then instructions if needed, then resources
|
|
369
|
+
*/
|
|
370
|
+
executeProgressive(skillPath: string, operation: string, params: Record<string, unknown> | undefined, context: ExecutionContext): Promise<SkillResult>;
|
|
371
|
+
/**
|
|
372
|
+
* Get skill information without loading resources
|
|
373
|
+
*/
|
|
374
|
+
getSkillInfo(skillPath: string): Promise<{
|
|
375
|
+
name: string;
|
|
376
|
+
description: string;
|
|
377
|
+
hasScripts: boolean;
|
|
378
|
+
hasReferences: boolean;
|
|
379
|
+
hasAssets: boolean;
|
|
380
|
+
}>;
|
|
381
|
+
/**
|
|
382
|
+
* Get reference documentation
|
|
383
|
+
*/
|
|
384
|
+
getReference(skillPath: string, referenceName: string): Promise<string | null>;
|
|
385
|
+
/**
|
|
386
|
+
* Get asset content
|
|
387
|
+
*/
|
|
388
|
+
getAsset(skillPath: string, assetName: string): Promise<string | null>;
|
|
389
|
+
/**
|
|
390
|
+
* List all available skills in a directory
|
|
391
|
+
*/
|
|
392
|
+
listSkills(directoryPath: string): Promise<Array<{
|
|
393
|
+
path: string;
|
|
394
|
+
name: string;
|
|
395
|
+
description: string;
|
|
396
|
+
}>>;
|
|
397
|
+
private findScript;
|
|
398
|
+
private operationSupported;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export { type AssetFile, type DisclosureLevel, EnhancedSkillExecutor, type EnhancedSkillExecutorConfig, type LoadedSkill, type ParsedSkill, type ReferenceFile, type RegistryConfig, type LoadedSkill as ResourceLoadedSkill, type ScriptExecutionResult, type ScriptExecutorConfig, type ScriptFile, type SkillManagerConfig, type SkillManifest, SkillRegistry, SkillResourceManager, SkillScriptExecutor, builtInSkills, builtInSkillsMap, createSkillFromManifest, echoSkill, listSkillsSkill, loadSkillFromDirectory, mathSkill, parseSkillMd, validateManifest };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EnhancedSkillExecutor,
|
|
3
|
+
SkillRegistry,
|
|
4
|
+
SkillResourceManager,
|
|
5
|
+
SkillScriptExecutor,
|
|
6
|
+
builtInSkills,
|
|
7
|
+
builtInSkillsMap,
|
|
8
|
+
createSkillFromManifest,
|
|
9
|
+
echoSkill,
|
|
10
|
+
listSkillsSkill,
|
|
11
|
+
loadSkillFromDirectory,
|
|
12
|
+
mathSkill,
|
|
13
|
+
parseSkillMd,
|
|
14
|
+
validateManifest
|
|
15
|
+
} from "../chunk-HXLRBB7S.js";
|
|
16
|
+
export {
|
|
17
|
+
EnhancedSkillExecutor,
|
|
18
|
+
SkillRegistry,
|
|
19
|
+
SkillResourceManager,
|
|
20
|
+
SkillScriptExecutor,
|
|
21
|
+
builtInSkills,
|
|
22
|
+
builtInSkillsMap,
|
|
23
|
+
createSkillFromManifest,
|
|
24
|
+
echoSkill,
|
|
25
|
+
listSkillsSkill,
|
|
26
|
+
loadSkillFromDirectory,
|
|
27
|
+
mathSkill,
|
|
28
|
+
parseSkillMd,
|
|
29
|
+
validateManifest
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkJF33ZOMBcjs = require('../chunk-JF33ZOMB.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.BrowserStorageAdapter = _chunkJF33ZOMBcjs.BrowserStorageAdapter; exports.NodeStorageAdapter = _chunkJF33ZOMBcjs.NodeStorageAdapter; exports.createStorage = _chunkJF33ZOMBcjs.createStorage; exports.getDefaultStorage = _chunkJF33ZOMBcjs.getDefaultStorage; exports.resetDefaultStorage = _chunkJF33ZOMBcjs.resetDefaultStorage;
|
|
15
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["d:\\sdkwork-opensource\\sdkwork-browser-agent\\dist\\node\\storage\\index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACF,0UAAC","file":"D:\\sdkwork-opensource\\sdkwork-browser-agent\\dist\\node\\storage\\index.cjs"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { S as StorageAdapter, a as StorageConfig, F as FileMetadata } from '../types-CG5I-byI.cjs';
|
|
2
|
+
export { b as StorageAdapterFactory } from '../types-CG5I-byI.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Browser Storage Adapter
|
|
6
|
+
* Uses IndexedDB for file-like storage and fetch for remote resources
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
declare class BrowserStorageAdapter implements StorageAdapter {
|
|
10
|
+
readonly name = "browser";
|
|
11
|
+
readonly isAvailable: boolean;
|
|
12
|
+
private dbName;
|
|
13
|
+
private dbVersion;
|
|
14
|
+
private storeName;
|
|
15
|
+
private db;
|
|
16
|
+
constructor(config?: StorageConfig);
|
|
17
|
+
private getDB;
|
|
18
|
+
readFile(path: string): Promise<string | null>;
|
|
19
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
20
|
+
deleteFile(path: string): Promise<void>;
|
|
21
|
+
exists(path: string): Promise<boolean>;
|
|
22
|
+
listDirectory(path: string): Promise<string[]>;
|
|
23
|
+
createDirectory(path: string): Promise<void>;
|
|
24
|
+
deleteDirectory(path: string): Promise<void>;
|
|
25
|
+
getMetadata(path: string): Promise<FileMetadata | null>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Node.js Storage Adapter
|
|
30
|
+
* Uses native fs module for file operations
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
declare class NodeStorageAdapter implements StorageAdapter {
|
|
34
|
+
private config;
|
|
35
|
+
readonly name = "node";
|
|
36
|
+
readonly isAvailable: boolean;
|
|
37
|
+
constructor(config?: StorageConfig);
|
|
38
|
+
private resolvePath;
|
|
39
|
+
readFile(path: string): Promise<string | null>;
|
|
40
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
41
|
+
deleteFile(path: string): Promise<void>;
|
|
42
|
+
exists(path: string): Promise<boolean>;
|
|
43
|
+
listDirectory(path: string): Promise<string[]>;
|
|
44
|
+
createDirectory(path: string): Promise<void>;
|
|
45
|
+
deleteDirectory(path: string): Promise<void>;
|
|
46
|
+
getMetadata(path: string): Promise<FileMetadata | null>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Storage Module
|
|
51
|
+
* Unified storage interface for browser and Node.js environments
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Create the appropriate storage adapter for the current environment
|
|
56
|
+
*/
|
|
57
|
+
declare function createStorage(config?: StorageConfig): StorageAdapter;
|
|
58
|
+
declare function getDefaultStorage(config?: StorageConfig): StorageAdapter;
|
|
59
|
+
/**
|
|
60
|
+
* Reset the default storage adapter (useful for testing)
|
|
61
|
+
*/
|
|
62
|
+
declare function resetDefaultStorage(): void;
|
|
63
|
+
|
|
64
|
+
export { BrowserStorageAdapter, FileMetadata, NodeStorageAdapter, StorageAdapter, StorageConfig, createStorage, getDefaultStorage, resetDefaultStorage };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { S as StorageAdapter, a as StorageConfig, F as FileMetadata } from '../types-CG5I-byI.js';
|
|
2
|
+
export { b as StorageAdapterFactory } from '../types-CG5I-byI.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Browser Storage Adapter
|
|
6
|
+
* Uses IndexedDB for file-like storage and fetch for remote resources
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
declare class BrowserStorageAdapter implements StorageAdapter {
|
|
10
|
+
readonly name = "browser";
|
|
11
|
+
readonly isAvailable: boolean;
|
|
12
|
+
private dbName;
|
|
13
|
+
private dbVersion;
|
|
14
|
+
private storeName;
|
|
15
|
+
private db;
|
|
16
|
+
constructor(config?: StorageConfig);
|
|
17
|
+
private getDB;
|
|
18
|
+
readFile(path: string): Promise<string | null>;
|
|
19
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
20
|
+
deleteFile(path: string): Promise<void>;
|
|
21
|
+
exists(path: string): Promise<boolean>;
|
|
22
|
+
listDirectory(path: string): Promise<string[]>;
|
|
23
|
+
createDirectory(path: string): Promise<void>;
|
|
24
|
+
deleteDirectory(path: string): Promise<void>;
|
|
25
|
+
getMetadata(path: string): Promise<FileMetadata | null>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Node.js Storage Adapter
|
|
30
|
+
* Uses native fs module for file operations
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
declare class NodeStorageAdapter implements StorageAdapter {
|
|
34
|
+
private config;
|
|
35
|
+
readonly name = "node";
|
|
36
|
+
readonly isAvailable: boolean;
|
|
37
|
+
constructor(config?: StorageConfig);
|
|
38
|
+
private resolvePath;
|
|
39
|
+
readFile(path: string): Promise<string | null>;
|
|
40
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
41
|
+
deleteFile(path: string): Promise<void>;
|
|
42
|
+
exists(path: string): Promise<boolean>;
|
|
43
|
+
listDirectory(path: string): Promise<string[]>;
|
|
44
|
+
createDirectory(path: string): Promise<void>;
|
|
45
|
+
deleteDirectory(path: string): Promise<void>;
|
|
46
|
+
getMetadata(path: string): Promise<FileMetadata | null>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Storage Module
|
|
51
|
+
* Unified storage interface for browser and Node.js environments
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Create the appropriate storage adapter for the current environment
|
|
56
|
+
*/
|
|
57
|
+
declare function createStorage(config?: StorageConfig): StorageAdapter;
|
|
58
|
+
declare function getDefaultStorage(config?: StorageConfig): StorageAdapter;
|
|
59
|
+
/**
|
|
60
|
+
* Reset the default storage adapter (useful for testing)
|
|
61
|
+
*/
|
|
62
|
+
declare function resetDefaultStorage(): void;
|
|
63
|
+
|
|
64
|
+
export { BrowserStorageAdapter, FileMetadata, NodeStorageAdapter, StorageAdapter, StorageConfig, createStorage, getDefaultStorage, resetDefaultStorage };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BrowserStorageAdapter,
|
|
3
|
+
NodeStorageAdapter,
|
|
4
|
+
createStorage,
|
|
5
|
+
getDefaultStorage,
|
|
6
|
+
resetDefaultStorage
|
|
7
|
+
} from "../chunk-CLP6UNSV.js";
|
|
8
|
+
export {
|
|
9
|
+
BrowserStorageAdapter,
|
|
10
|
+
NodeStorageAdapter,
|
|
11
|
+
createStorage,
|
|
12
|
+
getDefaultStorage,
|
|
13
|
+
resetDefaultStorage
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkKXXS33G3cjs = require('../chunk-KXXS33G3.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.ToolRegistry = _chunkKXXS33G3cjs.ToolRegistry; exports.builtInTools = _chunkKXXS33G3cjs.builtInTools; exports.fileReadTool = _chunkKXXS33G3cjs.fileReadTool; exports.fileWriteTool = _chunkKXXS33G3cjs.fileWriteTool; exports.httpRequestTool = _chunkKXXS33G3cjs.httpRequestTool;
|
|
15
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["d:\\sdkwork-opensource\\sdkwork-browser-agent\\dist\\node\\tools\\index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACF,0RAAC","file":"D:\\sdkwork-opensource\\sdkwork-browser-agent\\dist\\node\\tools\\index.cjs"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { T as Tool, E as ExecutionContext, q as ToolOutput } from '../agent-kexkkI13.cjs';
|
|
2
|
+
import '../provider-Dna36xA-.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Tool Registry for managing and discovering tools
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface ToolRegistryConfig {
|
|
9
|
+
autoDiscover?: boolean;
|
|
10
|
+
toolDirectory?: string;
|
|
11
|
+
}
|
|
12
|
+
declare class ToolRegistry {
|
|
13
|
+
private tools;
|
|
14
|
+
private categories;
|
|
15
|
+
constructor(_config?: ToolRegistryConfig);
|
|
16
|
+
register(tool: Tool): void;
|
|
17
|
+
unregister(name: string): boolean;
|
|
18
|
+
get(name: string): Tool | undefined;
|
|
19
|
+
has(name: string): boolean;
|
|
20
|
+
list(): Tool[];
|
|
21
|
+
listNames(): string[];
|
|
22
|
+
findByCategory(category: string): Tool[];
|
|
23
|
+
findByTag(tag: string): Tool[];
|
|
24
|
+
findByConfirmation(needsConfirmation: boolean): Tool[];
|
|
25
|
+
search(query: string): Tool[];
|
|
26
|
+
execute(name: string, input: unknown, context: ExecutionContext): Promise<ToolOutput>;
|
|
27
|
+
clear(): void;
|
|
28
|
+
getCategories(): string[];
|
|
29
|
+
getStats(): {
|
|
30
|
+
total: number;
|
|
31
|
+
categories: number;
|
|
32
|
+
requireConfirmation: number;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Built-in Tools
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
declare const fileReadTool: Tool;
|
|
41
|
+
declare const fileWriteTool: Tool;
|
|
42
|
+
declare const httpRequestTool: Tool;
|
|
43
|
+
declare const builtInTools: Tool[];
|
|
44
|
+
|
|
45
|
+
export { ToolRegistry, type ToolRegistryConfig, builtInTools, fileReadTool, fileWriteTool, httpRequestTool };
|