@olane/o-tools-common 0.4.4 → 0.5.1
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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/storage/providers/secure-storage-provider.tool.d.ts.map +1 -1
- package/dist/web/index.d.ts +4 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +3 -0
- package/dist/web/interfaces/index.d.ts +2 -0
- package/dist/web/interfaces/index.d.ts.map +1 -0
- package/dist/web/interfaces/index.js +1 -0
- package/dist/web/interfaces/web-interpreter.interface.d.ts +75 -0
- package/dist/web/interfaces/web-interpreter.interface.d.ts.map +1 -0
- package/dist/web/interfaces/web-interpreter.interface.js +1 -0
- package/dist/web/parameters/web-interpreter.parameters.d.ts +5 -0
- package/dist/web/parameters/web-interpreter.parameters.d.ts.map +1 -0
- package/dist/web/parameters/web-interpreter.parameters.js +65 -0
- package/dist/web/web.tool.d.ts +18 -0
- package/dist/web/web.tool.d.ts.map +1 -0
- package/dist/web/web.tool.js +157 -0
- package/package.json +10 -5
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secure-storage-provider.tool.d.ts","sourceRoot":"","sources":["../../../src/storage/providers/secure-storage-provider.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"secure-storage-provider.tool.d.ts","sourceRoot":"","sources":["../../../src/storage/providers/secure-storage-provider.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,UAAU,iBAAkB,SAAQ,WAAW;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAOD,qBAAa,qBAAsB,SAAQ,mBAAmB;gBAChD,MAAM,EAAE,iBAAiB;IASrC;;;;OAIG;IACG,SAAS,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAoCvD;;;;OAIG;IACG,SAAS,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC;CAsB7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,4CAA4C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/web/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './web-interpreter.interface.js';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ToolResult } from '@olane/o-tool';
|
|
2
|
+
export interface WebPageAnalysis {
|
|
3
|
+
url: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
content: string;
|
|
6
|
+
metadata: {
|
|
7
|
+
description?: string;
|
|
8
|
+
keywords?: string[];
|
|
9
|
+
author?: string;
|
|
10
|
+
publishedDate?: string;
|
|
11
|
+
modifiedDate?: string;
|
|
12
|
+
language?: string;
|
|
13
|
+
charset?: string;
|
|
14
|
+
};
|
|
15
|
+
structure: {
|
|
16
|
+
headings: Array<{
|
|
17
|
+
level: number;
|
|
18
|
+
text: string;
|
|
19
|
+
}>;
|
|
20
|
+
links: Array<{
|
|
21
|
+
text: string;
|
|
22
|
+
url: string;
|
|
23
|
+
isExternal: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
images: Array<{
|
|
26
|
+
src: string;
|
|
27
|
+
alt?: string;
|
|
28
|
+
title?: string;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
performance: {
|
|
32
|
+
loadTime?: number;
|
|
33
|
+
contentLength: number;
|
|
34
|
+
responseStatus: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface WebInterpreterRequest {
|
|
38
|
+
url: string;
|
|
39
|
+
options?: {
|
|
40
|
+
includeImages?: boolean;
|
|
41
|
+
includeLinks?: boolean;
|
|
42
|
+
maxContentLength?: number;
|
|
43
|
+
timeout?: number;
|
|
44
|
+
userAgent?: string;
|
|
45
|
+
extractMode?: 'full' | 'text-only' | 'structured';
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface WebInterpreterResponse extends ToolResult {
|
|
49
|
+
analysis: WebPageAnalysis;
|
|
50
|
+
aiOptimized: {
|
|
51
|
+
summary: string;
|
|
52
|
+
keyPoints: string[];
|
|
53
|
+
topics: string[];
|
|
54
|
+
sentiment?: 'positive' | 'negative' | 'neutral';
|
|
55
|
+
readingTime: number;
|
|
56
|
+
contentType: 'article' | 'blog' | 'news' | 'product' | 'documentation' | 'other';
|
|
57
|
+
};
|
|
58
|
+
extracted: {
|
|
59
|
+
mainContent: string;
|
|
60
|
+
cleanedText: string;
|
|
61
|
+
codeBlocks?: Array<{
|
|
62
|
+
language?: string;
|
|
63
|
+
code: string;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface WebInterpreterConfig {
|
|
68
|
+
maxConcurrentRequests?: number;
|
|
69
|
+
defaultTimeout?: number;
|
|
70
|
+
cacheEnabled?: boolean;
|
|
71
|
+
cacheTtl?: number;
|
|
72
|
+
allowedDomains?: string[];
|
|
73
|
+
blockedDomains?: string[];
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=web-interpreter.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-interpreter.interface.d.ts","sourceRoot":"","sources":["../../../src/web/interfaces/web-interpreter.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACR,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,SAAS,EAAE;QACT,QAAQ,EAAE,KAAK,CAAC;YACd,KAAK,EAAE,MAAM,CAAC;YACd,IAAI,EAAE,MAAM,CAAC;SACd,CAAC,CAAC;QACH,KAAK,EAAE,KAAK,CAAC;YACX,IAAI,EAAE,MAAM,CAAC;YACb,GAAG,EAAE,MAAM,CAAC;YACZ,UAAU,EAAE,OAAO,CAAC;SACrB,CAAC,CAAC;QACH,MAAM,EAAE,KAAK,CAAC;YACZ,GAAG,EAAE,MAAM,CAAC;YACZ,GAAG,CAAC,EAAE,MAAM,CAAC;YACb,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC,CAAC;KACJ,CAAC;IACF,WAAW,EAAE;QACX,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE;QACR,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,YAAY,CAAC;KACnD,CAAC;CACH;AAED,MAAM,WAAW,sBAAuB,SAAQ,UAAU;IACxD,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,SAAS,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;QAChD,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EACP,SAAS,GACT,MAAM,GACN,MAAM,GACN,SAAS,GACT,eAAe,GACf,OAAO,CAAC;KACb,CAAC;IACF,SAAS,EAAE;QACT,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,KAAK,CAAC;YACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,IAAI,EAAE,MAAM,CAAC;SACd,CAAC,CAAC;KACJ,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-interpreter.parameters.d.ts","sourceRoot":"","sources":["../../../src/web/parameters/web-interpreter.parameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,eAAO,MAAM,sBAAsB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAiE5D,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export const WEB_INTERPRETER_PARAMS = {
|
|
2
|
+
interpret: {
|
|
3
|
+
name: 'interpret',
|
|
4
|
+
description: 'Interprets a webpage and returns AI-optimized content analysis',
|
|
5
|
+
dependencies: [],
|
|
6
|
+
parameters: [
|
|
7
|
+
{
|
|
8
|
+
name: 'url',
|
|
9
|
+
type: 'string',
|
|
10
|
+
value: 'string',
|
|
11
|
+
description: 'The URL of the webpage to interpret',
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'options',
|
|
16
|
+
type: 'object',
|
|
17
|
+
value: 'object',
|
|
18
|
+
description: 'Optional configuration for webpage interpretation',
|
|
19
|
+
required: false,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
extractText: {
|
|
24
|
+
name: 'extractText',
|
|
25
|
+
description: 'Extracts clean text content from a webpage',
|
|
26
|
+
dependencies: [],
|
|
27
|
+
parameters: [
|
|
28
|
+
{
|
|
29
|
+
name: 'url',
|
|
30
|
+
type: 'string',
|
|
31
|
+
value: 'string',
|
|
32
|
+
description: 'The URL of the webpage to extract text from',
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'options',
|
|
37
|
+
type: 'object',
|
|
38
|
+
value: 'object',
|
|
39
|
+
description: 'Optional extraction configuration',
|
|
40
|
+
required: false,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
analyze: {
|
|
45
|
+
name: 'analyze',
|
|
46
|
+
description: 'Analyzes webpage structure and metadata',
|
|
47
|
+
dependencies: [],
|
|
48
|
+
parameters: [
|
|
49
|
+
{
|
|
50
|
+
name: 'url',
|
|
51
|
+
type: 'string',
|
|
52
|
+
value: 'string',
|
|
53
|
+
description: 'The URL of the webpage to analyze',
|
|
54
|
+
required: true,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'options',
|
|
58
|
+
type: 'object',
|
|
59
|
+
value: 'object',
|
|
60
|
+
description: 'Optional analysis configuration',
|
|
61
|
+
required: false,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { oToolConfig, oVirtualTool } from '@olane/o-tool';
|
|
2
|
+
import { oRequest } from '@olane/o-core';
|
|
3
|
+
import { ToolResult } from '@olane/o-tool';
|
|
4
|
+
import { WebInterpreterResponse, WebInterpreterConfig } from './interfaces/web-interpreter.interface.js';
|
|
5
|
+
export declare class WebInterpreterTool extends oVirtualTool {
|
|
6
|
+
private config;
|
|
7
|
+
constructor(config: oToolConfig & {
|
|
8
|
+
webConfig?: WebInterpreterConfig;
|
|
9
|
+
});
|
|
10
|
+
_tool_interpret(request: oRequest): Promise<WebInterpreterResponse>;
|
|
11
|
+
_tool_extractText(request: oRequest): Promise<ToolResult>;
|
|
12
|
+
_tool_analyze(request: oRequest): Promise<ToolResult>;
|
|
13
|
+
private validateUrl;
|
|
14
|
+
private analyzeWebpage;
|
|
15
|
+
private generateAiOptimizedContent;
|
|
16
|
+
private extractContent;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=web.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.tool.d.ts","sourceRoot":"","sources":["../../src/web/web.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAEL,sBAAsB,EAEtB,oBAAoB,EACrB,MAAM,2CAA2C,CAAC;AAEnD,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,OAAO,CAAC,MAAM,CAAuB;gBAEzB,MAAM,EAAE,WAAW,GAAG;QAAE,SAAS,CAAC,EAAE,oBAAoB,CAAA;KAAE;IAoBhE,eAAe,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAmCnE,iBAAiB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAoBzD,aAAa,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;YAmB7C,WAAW;YA8BX,cAAc;YA+Bd,0BAA0B;YAkB1B,cAAc;CAc7B"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { oVirtualTool } from '@olane/o-tool';
|
|
2
|
+
import { oAddress } from '@olane/o-core';
|
|
3
|
+
import { WEB_INTERPRETER_PARAMS } from './parameters/web-interpreter.parameters.js';
|
|
4
|
+
export class WebInterpreterTool extends oVirtualTool {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
super({
|
|
7
|
+
...config,
|
|
8
|
+
address: new oAddress('o://web-interpreter'),
|
|
9
|
+
methods: WEB_INTERPRETER_PARAMS,
|
|
10
|
+
description: 'Resolve internet URL references and return AI-optimized content analysis',
|
|
11
|
+
});
|
|
12
|
+
this.config = {
|
|
13
|
+
maxConcurrentRequests: 5,
|
|
14
|
+
defaultTimeout: 30000,
|
|
15
|
+
cacheEnabled: true,
|
|
16
|
+
cacheTtl: 3600,
|
|
17
|
+
allowedDomains: [],
|
|
18
|
+
blockedDomains: ['localhost', '127.0.0.1'],
|
|
19
|
+
...config.webConfig,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async _tool_interpret(request) {
|
|
23
|
+
const { url, options } = request.params;
|
|
24
|
+
this.logger.debug('Interpreting webpage:', url);
|
|
25
|
+
try {
|
|
26
|
+
// Validate URL
|
|
27
|
+
await this.validateUrl(url);
|
|
28
|
+
// Fetch and analyze webpage
|
|
29
|
+
const analysis = await this.analyzeWebpage(url, options);
|
|
30
|
+
// Generate AI-optimized content
|
|
31
|
+
const aiOptimized = await this.generateAiOptimizedContent(analysis);
|
|
32
|
+
// Extract clean content
|
|
33
|
+
const extracted = await this.extractContent(analysis);
|
|
34
|
+
return {
|
|
35
|
+
success: true,
|
|
36
|
+
data: {
|
|
37
|
+
analysis,
|
|
38
|
+
aiOptimized,
|
|
39
|
+
extracted,
|
|
40
|
+
},
|
|
41
|
+
analysis,
|
|
42
|
+
aiOptimized,
|
|
43
|
+
extracted,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
this.logger.error('Error interpreting webpage:', error);
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async _tool_extractText(request) {
|
|
52
|
+
const { url, options } = request.params;
|
|
53
|
+
this.logger.debug('Extracting text from webpage:', url);
|
|
54
|
+
try {
|
|
55
|
+
await this.validateUrl(url);
|
|
56
|
+
const analysis = await this.analyzeWebpage(url, options);
|
|
57
|
+
const extracted = await this.extractContent(analysis);
|
|
58
|
+
return {
|
|
59
|
+
success: true,
|
|
60
|
+
data: extracted,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
this.logger.error('Error extracting text from webpage:', error);
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async _tool_analyze(request) {
|
|
69
|
+
const { url, options } = request.params;
|
|
70
|
+
this.logger.debug('Analyzing webpage:', url);
|
|
71
|
+
try {
|
|
72
|
+
await this.validateUrl(url);
|
|
73
|
+
const analysis = await this.analyzeWebpage(url, options);
|
|
74
|
+
return {
|
|
75
|
+
success: true,
|
|
76
|
+
data: analysis,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
this.logger.error('Error analyzing webpage:', error);
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async validateUrl(url) {
|
|
85
|
+
try {
|
|
86
|
+
const parsedUrl = new URL(url);
|
|
87
|
+
// Check blocked domains
|
|
88
|
+
if (this.config.blockedDomains?.includes(parsedUrl.hostname)) {
|
|
89
|
+
throw new Error(`Domain ${parsedUrl.hostname} is blocked`);
|
|
90
|
+
}
|
|
91
|
+
// Check allowed domains (if specified)
|
|
92
|
+
if (this.config.allowedDomains && this.config.allowedDomains.length > 0) {
|
|
93
|
+
if (!this.config.allowedDomains.includes(parsedUrl.hostname)) {
|
|
94
|
+
throw new Error(`Domain ${parsedUrl.hostname} is not in allowed list`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Ensure https or http
|
|
98
|
+
if (!['http:', 'https:'].includes(parsedUrl.protocol)) {
|
|
99
|
+
throw new Error('Only HTTP and HTTPS protocols are supported');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (error instanceof TypeError) {
|
|
104
|
+
throw new Error('Invalid URL format');
|
|
105
|
+
}
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async analyzeWebpage(url, options) {
|
|
110
|
+
// TODO: Implement actual webpage fetching and analysis
|
|
111
|
+
// This is a placeholder that will be implemented with proper tools
|
|
112
|
+
this.logger.debug('Analyzing webpage structure and content...');
|
|
113
|
+
return {
|
|
114
|
+
url,
|
|
115
|
+
title: 'Placeholder Title',
|
|
116
|
+
content: 'Placeholder content - to be implemented',
|
|
117
|
+
metadata: {
|
|
118
|
+
description: 'Placeholder description',
|
|
119
|
+
keywords: ['placeholder'],
|
|
120
|
+
language: 'en',
|
|
121
|
+
charset: 'utf-8',
|
|
122
|
+
},
|
|
123
|
+
structure: {
|
|
124
|
+
headings: [],
|
|
125
|
+
links: [],
|
|
126
|
+
images: [],
|
|
127
|
+
},
|
|
128
|
+
performance: {
|
|
129
|
+
contentLength: 0,
|
|
130
|
+
responseStatus: 200,
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
async generateAiOptimizedContent(analysis) {
|
|
135
|
+
// TODO: Implement AI content optimization
|
|
136
|
+
// This will use AI services to generate summaries, key points, etc.
|
|
137
|
+
this.logger.debug('Generating AI-optimized content...');
|
|
138
|
+
return {
|
|
139
|
+
summary: 'Placeholder summary - to be implemented with AI',
|
|
140
|
+
keyPoints: ['Placeholder key point 1', 'Placeholder key point 2'],
|
|
141
|
+
topics: ['placeholder', 'topic'],
|
|
142
|
+
sentiment: 'neutral',
|
|
143
|
+
readingTime: 1,
|
|
144
|
+
contentType: 'other',
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
async extractContent(analysis) {
|
|
148
|
+
// TODO: Implement content extraction and cleaning
|
|
149
|
+
// This will use proper text extraction tools
|
|
150
|
+
this.logger.debug('Extracting and cleaning content...');
|
|
151
|
+
return {
|
|
152
|
+
mainContent: analysis.content,
|
|
153
|
+
cleanedText: analysis.content,
|
|
154
|
+
codeBlocks: [],
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-tools-common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"test": "echo 'No tests'",
|
|
20
20
|
"dev": "DEBUG=o-protocol:* npx tsx src/tests/index.ts",
|
|
21
21
|
"build": "tsc",
|
|
22
|
+
"deep:clean": "rm -rf node_modules && rm package-lock.json",
|
|
22
23
|
"start:prod": "node dist/index.js",
|
|
23
24
|
"prepublishOnly": "npm run build",
|
|
24
25
|
"update:lib": "npm install @olane/o-core@latest",
|
|
@@ -34,6 +35,10 @@
|
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@eslint/eslintrc": "^3.3.1",
|
|
36
37
|
"@eslint/js": "^9.29.0",
|
|
38
|
+
"@olane/o-config": "0.5.1",
|
|
39
|
+
"@olane/o-core": "0.5.1",
|
|
40
|
+
"@olane/o-protocol": "0.5.1",
|
|
41
|
+
"@olane/o-tool": "0.5.1",
|
|
37
42
|
"@tsconfig/node20": "^20.1.6",
|
|
38
43
|
"@types/jest": "^30.0.0",
|
|
39
44
|
"@typescript-eslint/eslint-plugin": "^8.34.1",
|
|
@@ -51,10 +56,10 @@
|
|
|
51
56
|
"typescript": "5.4.5"
|
|
52
57
|
},
|
|
53
58
|
"peerDependencies": {
|
|
54
|
-
"@olane/o-config": "^0.
|
|
55
|
-
"@olane/o-core": "^0.
|
|
56
|
-
"@olane/o-protocol": "^0.
|
|
57
|
-
"@olane/o-tool": "^0.
|
|
59
|
+
"@olane/o-config": "^0.5.1",
|
|
60
|
+
"@olane/o-core": "^0.5.1",
|
|
61
|
+
"@olane/o-protocol": "^0.5.1",
|
|
62
|
+
"@olane/o-tool": "^0.5.1"
|
|
58
63
|
},
|
|
59
64
|
"dependencies": {
|
|
60
65
|
"debug": "^4.4.1",
|