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,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM Provider Interface
|
|
3
|
+
* Supports various LLM providers: OpenAI, Anthropic, Google, local models, etc.
|
|
4
|
+
*/
|
|
5
|
+
interface LLMMessage {
|
|
6
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
7
|
+
content: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
tool_calls?: ToolCall[];
|
|
10
|
+
tool_call_id?: string;
|
|
11
|
+
}
|
|
12
|
+
interface ToolCall {
|
|
13
|
+
id: string;
|
|
14
|
+
type: 'function';
|
|
15
|
+
function: {
|
|
16
|
+
name: string;
|
|
17
|
+
arguments: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
interface LLMRequest {
|
|
21
|
+
messages: LLMMessage[];
|
|
22
|
+
model?: string;
|
|
23
|
+
temperature?: number;
|
|
24
|
+
max_tokens?: number;
|
|
25
|
+
top_p?: number;
|
|
26
|
+
stream?: boolean;
|
|
27
|
+
tools?: ToolDefinition[];
|
|
28
|
+
tool_choice?: 'auto' | 'none' | {
|
|
29
|
+
type: 'function';
|
|
30
|
+
function: {
|
|
31
|
+
name: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
interface ToolDefinition {
|
|
36
|
+
type: 'function';
|
|
37
|
+
function: {
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
parameters: Record<string, unknown>;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
interface LLMResponse {
|
|
44
|
+
id: string;
|
|
45
|
+
model: string;
|
|
46
|
+
content: string;
|
|
47
|
+
role: 'assistant';
|
|
48
|
+
tool_calls?: ToolCall[];
|
|
49
|
+
usage?: {
|
|
50
|
+
prompt_tokens: number;
|
|
51
|
+
completion_tokens: number;
|
|
52
|
+
total_tokens: number;
|
|
53
|
+
};
|
|
54
|
+
finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter';
|
|
55
|
+
}
|
|
56
|
+
interface LLMStreamChunk {
|
|
57
|
+
id: string;
|
|
58
|
+
model: string;
|
|
59
|
+
delta: {
|
|
60
|
+
content?: string;
|
|
61
|
+
role?: 'assistant';
|
|
62
|
+
tool_calls?: ToolCall[];
|
|
63
|
+
};
|
|
64
|
+
finish_reason?: 'stop' | 'length' | 'tool_calls' | 'content_filter';
|
|
65
|
+
}
|
|
66
|
+
interface LLMProviderConfig {
|
|
67
|
+
apiKey?: string;
|
|
68
|
+
baseUrl?: string;
|
|
69
|
+
model?: string;
|
|
70
|
+
defaultParams?: Partial<LLMRequest>;
|
|
71
|
+
timeout?: number;
|
|
72
|
+
retries?: number;
|
|
73
|
+
}
|
|
74
|
+
interface LLMProvider {
|
|
75
|
+
readonly name: string;
|
|
76
|
+
readonly supportedModels: string[];
|
|
77
|
+
complete(request: LLMRequest): Promise<LLMResponse>;
|
|
78
|
+
stream(request: LLMRequest): AsyncIterableIterator<LLMStreamChunk>;
|
|
79
|
+
validateConfig(): boolean;
|
|
80
|
+
}
|
|
81
|
+
type LLMProviderFactory = (config: LLMProviderConfig) => LLMProvider;
|
|
82
|
+
declare class LLMProviderRegistry {
|
|
83
|
+
private providers;
|
|
84
|
+
private instances;
|
|
85
|
+
register(name: string, factory: LLMProviderFactory): void;
|
|
86
|
+
create(name: string, config: LLMProviderConfig): LLMProvider;
|
|
87
|
+
get(name: string): LLMProvider | undefined;
|
|
88
|
+
listProviders(): string[];
|
|
89
|
+
isRegistered(name: string): boolean;
|
|
90
|
+
}
|
|
91
|
+
declare const globalProviderRegistry: LLMProviderRegistry;
|
|
92
|
+
declare class LLMManager {
|
|
93
|
+
private registry;
|
|
94
|
+
private providers;
|
|
95
|
+
private defaultProvider?;
|
|
96
|
+
constructor(registry?: LLMProviderRegistry);
|
|
97
|
+
addProvider(name: string, config: LLMProviderConfig): LLMProvider;
|
|
98
|
+
setDefaultProvider(name: string): void;
|
|
99
|
+
getProvider(name?: string): LLMProvider;
|
|
100
|
+
complete(request: LLMRequest, providerName?: string): Promise<LLMResponse>;
|
|
101
|
+
stream(request: LLMRequest, providerName?: string): AsyncIterableIterator<LLMStreamChunk>;
|
|
102
|
+
listProviders(): string[];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export { type LLMProvider as L, type ToolDefinition as T, type LLMMessage as a, type LLMRequest as b, type LLMResponse as c, type LLMStreamChunk as d, LLMManager as e, type LLMProviderConfig as f, type LLMProviderFactory as g, LLMProviderRegistry as h, type ToolCall as i, globalProviderRegistry as j };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM Provider Interface
|
|
3
|
+
* Supports various LLM providers: OpenAI, Anthropic, Google, local models, etc.
|
|
4
|
+
*/
|
|
5
|
+
interface LLMMessage {
|
|
6
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
7
|
+
content: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
tool_calls?: ToolCall[];
|
|
10
|
+
tool_call_id?: string;
|
|
11
|
+
}
|
|
12
|
+
interface ToolCall {
|
|
13
|
+
id: string;
|
|
14
|
+
type: 'function';
|
|
15
|
+
function: {
|
|
16
|
+
name: string;
|
|
17
|
+
arguments: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
interface LLMRequest {
|
|
21
|
+
messages: LLMMessage[];
|
|
22
|
+
model?: string;
|
|
23
|
+
temperature?: number;
|
|
24
|
+
max_tokens?: number;
|
|
25
|
+
top_p?: number;
|
|
26
|
+
stream?: boolean;
|
|
27
|
+
tools?: ToolDefinition[];
|
|
28
|
+
tool_choice?: 'auto' | 'none' | {
|
|
29
|
+
type: 'function';
|
|
30
|
+
function: {
|
|
31
|
+
name: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
interface ToolDefinition {
|
|
36
|
+
type: 'function';
|
|
37
|
+
function: {
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
parameters: Record<string, unknown>;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
interface LLMResponse {
|
|
44
|
+
id: string;
|
|
45
|
+
model: string;
|
|
46
|
+
content: string;
|
|
47
|
+
role: 'assistant';
|
|
48
|
+
tool_calls?: ToolCall[];
|
|
49
|
+
usage?: {
|
|
50
|
+
prompt_tokens: number;
|
|
51
|
+
completion_tokens: number;
|
|
52
|
+
total_tokens: number;
|
|
53
|
+
};
|
|
54
|
+
finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter';
|
|
55
|
+
}
|
|
56
|
+
interface LLMStreamChunk {
|
|
57
|
+
id: string;
|
|
58
|
+
model: string;
|
|
59
|
+
delta: {
|
|
60
|
+
content?: string;
|
|
61
|
+
role?: 'assistant';
|
|
62
|
+
tool_calls?: ToolCall[];
|
|
63
|
+
};
|
|
64
|
+
finish_reason?: 'stop' | 'length' | 'tool_calls' | 'content_filter';
|
|
65
|
+
}
|
|
66
|
+
interface LLMProviderConfig {
|
|
67
|
+
apiKey?: string;
|
|
68
|
+
baseUrl?: string;
|
|
69
|
+
model?: string;
|
|
70
|
+
defaultParams?: Partial<LLMRequest>;
|
|
71
|
+
timeout?: number;
|
|
72
|
+
retries?: number;
|
|
73
|
+
}
|
|
74
|
+
interface LLMProvider {
|
|
75
|
+
readonly name: string;
|
|
76
|
+
readonly supportedModels: string[];
|
|
77
|
+
complete(request: LLMRequest): Promise<LLMResponse>;
|
|
78
|
+
stream(request: LLMRequest): AsyncIterableIterator<LLMStreamChunk>;
|
|
79
|
+
validateConfig(): boolean;
|
|
80
|
+
}
|
|
81
|
+
type LLMProviderFactory = (config: LLMProviderConfig) => LLMProvider;
|
|
82
|
+
declare class LLMProviderRegistry {
|
|
83
|
+
private providers;
|
|
84
|
+
private instances;
|
|
85
|
+
register(name: string, factory: LLMProviderFactory): void;
|
|
86
|
+
create(name: string, config: LLMProviderConfig): LLMProvider;
|
|
87
|
+
get(name: string): LLMProvider | undefined;
|
|
88
|
+
listProviders(): string[];
|
|
89
|
+
isRegistered(name: string): boolean;
|
|
90
|
+
}
|
|
91
|
+
declare const globalProviderRegistry: LLMProviderRegistry;
|
|
92
|
+
declare class LLMManager {
|
|
93
|
+
private registry;
|
|
94
|
+
private providers;
|
|
95
|
+
private defaultProvider?;
|
|
96
|
+
constructor(registry?: LLMProviderRegistry);
|
|
97
|
+
addProvider(name: string, config: LLMProviderConfig): LLMProvider;
|
|
98
|
+
setDefaultProvider(name: string): void;
|
|
99
|
+
getProvider(name?: string): LLMProvider;
|
|
100
|
+
complete(request: LLMRequest, providerName?: string): Promise<LLMResponse>;
|
|
101
|
+
stream(request: LLMRequest, providerName?: string): AsyncIterableIterator<LLMStreamChunk>;
|
|
102
|
+
listProviders(): string[];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export { type LLMProvider as L, type ToolDefinition as T, type LLMMessage as a, type LLMRequest as b, type LLMResponse as c, type LLMStreamChunk as d, LLMManager as e, type LLMProviderConfig as f, type LLMProviderFactory as g, LLMProviderRegistry as h, type ToolCall as i, globalProviderRegistry as j };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkYDHQCPSNcjs = require('../chunk-YDHQCPSN.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
exports.EnhancedSkillExecutor = _chunkYDHQCPSNcjs.EnhancedSkillExecutor; exports.SkillRegistry = _chunkYDHQCPSNcjs.SkillRegistry; exports.SkillResourceManager = _chunkYDHQCPSNcjs.SkillResourceManager; exports.SkillScriptExecutor = _chunkYDHQCPSNcjs.SkillScriptExecutor; exports.builtInSkills = _chunkYDHQCPSNcjs.builtInSkills; exports.builtInSkillsMap = _chunkYDHQCPSNcjs.builtInSkillsMap; exports.createSkillFromManifest = _chunkYDHQCPSNcjs.createSkillFromManifest; exports.echoSkill = _chunkYDHQCPSNcjs.echoSkill; exports.listSkillsSkill = _chunkYDHQCPSNcjs.listSkillsSkill; exports.loadSkillFromDirectory = _chunkYDHQCPSNcjs.loadSkillFromDirectory; exports.mathSkill = _chunkYDHQCPSNcjs.mathSkill; exports.parseSkillMd = _chunkYDHQCPSNcjs.parseSkillMd; exports.validateManifest = _chunkYDHQCPSNcjs.validateManifest;
|
|
31
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["d:\\sdkwork-opensource\\sdkwork-browser-agent\\dist\\node\\skills\\index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,kzBAAC","file":"D:\\sdkwork-opensource\\sdkwork-browser-agent\\dist\\node\\skills\\index.cjs"}
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { S as Skill, E as ExecutionContext, a as SkillResult } from '../agent-kexkkI13.cjs';
|
|
2
|
+
import { S as StorageAdapter } from '../types-CG5I-byI.cjs';
|
|
3
|
+
import '../provider-Dna36xA-.cjs';
|
|
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 };
|