@framers/agentos-ext-content-extraction 0.1.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/LICENSE +98 -0
- package/dist/ContentExtractionService.d.ts +94 -0
- package/dist/ContentExtractionService.d.ts.map +1 -0
- package/dist/ContentExtractionService.js +408 -0
- package/dist/ContentExtractionService.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/pdf.d.ts +30 -0
- package/dist/tools/pdf.d.ts.map +1 -0
- package/dist/tools/pdf.js +33 -0
- package/dist/tools/pdf.js.map +1 -0
- package/dist/tools/structured.d.ts +49 -0
- package/dist/tools/structured.d.ts.map +1 -0
- package/dist/tools/structured.js +42 -0
- package/dist/tools/structured.js.map +1 -0
- package/dist/tools/url.d.ts +36 -0
- package/dist/tools/url.d.ts.map +1 -0
- package/dist/tools/url.js +38 -0
- package/dist/tools/url.js.map +1 -0
- package/dist/tools/wikipedia.d.ts +35 -0
- package/dist/tools/wikipedia.d.ts.map +1 -0
- package/dist/tools/wikipedia.js +34 -0
- package/dist/tools/wikipedia.js.map +1 -0
- package/dist/tools/youtube.d.ts +30 -0
- package/dist/tools/youtube.d.ts.map +1 -0
- package/dist/tools/youtube.js +33 -0
- package/dist/tools/youtube.js.map +1 -0
- package/manifest.json +24 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
12
|
+
|
|
13
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
14
|
+
|
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
16
|
+
|
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
18
|
+
|
|
19
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
20
|
+
|
|
21
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
22
|
+
|
|
23
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
24
|
+
|
|
25
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
26
|
+
|
|
27
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
28
|
+
|
|
29
|
+
2. Grant of Copyright License.
|
|
30
|
+
|
|
31
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
32
|
+
|
|
33
|
+
3. Grant of Patent License.
|
|
34
|
+
|
|
35
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
36
|
+
|
|
37
|
+
4. Redistribution.
|
|
38
|
+
|
|
39
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
40
|
+
|
|
41
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
42
|
+
|
|
43
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
44
|
+
|
|
45
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
46
|
+
|
|
47
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
48
|
+
|
|
49
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
50
|
+
|
|
51
|
+
5. Submission of Contributions.
|
|
52
|
+
|
|
53
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
54
|
+
|
|
55
|
+
6. Trademarks.
|
|
56
|
+
|
|
57
|
+
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
58
|
+
|
|
59
|
+
7. Disclaimer of Warranty.
|
|
60
|
+
|
|
61
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
62
|
+
|
|
63
|
+
8. Limitation of Liability.
|
|
64
|
+
|
|
65
|
+
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
66
|
+
|
|
67
|
+
9. Accepting Warranty or Additional Liability.
|
|
68
|
+
|
|
69
|
+
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
70
|
+
|
|
71
|
+
END OF TERMS AND CONDITIONS
|
|
72
|
+
|
|
73
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
74
|
+
|
|
75
|
+
To apply the Apache License to your work, attach the following
|
|
76
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
77
|
+
replaced with your own identifying information. (Don't include
|
|
78
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
79
|
+
comment syntax for the file format. We also recommend that a
|
|
80
|
+
file or class name and description of purpose be included on the
|
|
81
|
+
same "printed page" as the copyright notice for easier
|
|
82
|
+
identification within third-party archives.
|
|
83
|
+
|
|
84
|
+
Copyright (c) 2025 Framers
|
|
85
|
+
|
|
86
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
87
|
+
you may not use this file except in compliance with the License.
|
|
88
|
+
You may obtain a copy of the License at
|
|
89
|
+
|
|
90
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
91
|
+
|
|
92
|
+
Unless required by applicable law or agreed to in writing, software
|
|
93
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
94
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
95
|
+
See the License for the specific language governing permissions and
|
|
96
|
+
limitations under the License.
|
|
97
|
+
|
|
98
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Content Extraction service layer.
|
|
3
|
+
*
|
|
4
|
+
* Provides URL content extraction, YouTube transcript retrieval,
|
|
5
|
+
* Wikipedia article extraction, PDF text extraction, and structured
|
|
6
|
+
* data extraction via CSS selectors.
|
|
7
|
+
*/
|
|
8
|
+
export interface UrlExtractionResult {
|
|
9
|
+
url: string;
|
|
10
|
+
title: string;
|
|
11
|
+
content: string;
|
|
12
|
+
format: string;
|
|
13
|
+
wordCount: number;
|
|
14
|
+
metadata: {
|
|
15
|
+
description?: string;
|
|
16
|
+
author?: string;
|
|
17
|
+
publishedDate?: string;
|
|
18
|
+
siteName?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface YouTubeExtractionResult {
|
|
22
|
+
videoId: string;
|
|
23
|
+
title: string;
|
|
24
|
+
author: string;
|
|
25
|
+
transcript: string;
|
|
26
|
+
duration?: string;
|
|
27
|
+
metadata: {
|
|
28
|
+
channelUrl?: string;
|
|
29
|
+
thumbnail?: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface WikipediaExtractionResult {
|
|
34
|
+
title: string;
|
|
35
|
+
content: string;
|
|
36
|
+
summary: string;
|
|
37
|
+
url: string;
|
|
38
|
+
language: string;
|
|
39
|
+
metadata: {
|
|
40
|
+
description?: string;
|
|
41
|
+
thumbnail?: string;
|
|
42
|
+
lastModified?: string;
|
|
43
|
+
categories?: string[];
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface PdfExtractionResult {
|
|
47
|
+
url: string;
|
|
48
|
+
content: string;
|
|
49
|
+
pageCount?: number;
|
|
50
|
+
metadata: {
|
|
51
|
+
title?: string;
|
|
52
|
+
author?: string;
|
|
53
|
+
subject?: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export interface StructuredExtractionResult {
|
|
57
|
+
url: string;
|
|
58
|
+
title: string;
|
|
59
|
+
tables: Array<{
|
|
60
|
+
headers: string[];
|
|
61
|
+
rows: string[][];
|
|
62
|
+
}>;
|
|
63
|
+
lists: string[][];
|
|
64
|
+
metadata: Record<string, string>;
|
|
65
|
+
links: Array<{
|
|
66
|
+
text: string;
|
|
67
|
+
href: string;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
export declare class ContentExtractionService {
|
|
71
|
+
private httpClient;
|
|
72
|
+
private running;
|
|
73
|
+
constructor();
|
|
74
|
+
initialize(): Promise<void>;
|
|
75
|
+
shutdown(): Promise<void>;
|
|
76
|
+
get isRunning(): boolean;
|
|
77
|
+
extractUrl(url: string, format?: string): Promise<UrlExtractionResult>;
|
|
78
|
+
extractYouTube(videoIdOrUrl: string): Promise<YouTubeExtractionResult>;
|
|
79
|
+
extractWikipedia(title: string, language?: string): Promise<WikipediaExtractionResult>;
|
|
80
|
+
extractPdf(url: string): Promise<PdfExtractionResult>;
|
|
81
|
+
extractStructured(url: string, selectors?: Record<string, string>): Promise<StructuredExtractionResult>;
|
|
82
|
+
private extractTitle;
|
|
83
|
+
private extractMetaTags;
|
|
84
|
+
private extractMainContent;
|
|
85
|
+
private htmlToText;
|
|
86
|
+
private htmlToMarkdown;
|
|
87
|
+
private extractTables;
|
|
88
|
+
private extractLists;
|
|
89
|
+
private extractLinks;
|
|
90
|
+
private extractTextFromPdfBuffer;
|
|
91
|
+
private parseYouTubeId;
|
|
92
|
+
private requireRunning;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=ContentExtractionService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentExtractionService.d.ts","sourceRoot":"","sources":["../src/ContentExtractionService.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAQH,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE;QACR,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,Q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ck
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Content Extraction service layer.
|
|
5
|
+
*
|
|
6
|
+
* Provides URL content extraction, YouTube transcript retrieval,
|
|
7
|
+
* Wikipedia article extraction, PDF text extraction, and structured
|
|
8
|
+
* data extraction via CSS selectors.
|
|
9
|
+
*/
|
|
10
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.ContentExtractionService = void 0;
|
|
15
|
+
const axios_1 = __importDefault(require("axios"));
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Service
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
class ContentExtractionService {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.running = false;
|
|
22
|
+
this.httpClient = axios_1.default.create({
|
|
23
|
+
timeout: 30000,
|
|
24
|
+
headers: { 'User-Agent': 'AgentOS-ContentExtraction/0.1.0' },
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async initialize() {
|
|
28
|
+
this.running = true;
|
|
29
|
+
}
|
|
30
|
+
async shutdown() {
|
|
31
|
+
this.running = false;
|
|
32
|
+
}
|
|
33
|
+
get isRunning() {
|
|
34
|
+
return this.running;
|
|
35
|
+
}
|
|
36
|
+
// ── URL Extraction ──
|
|
37
|
+
async extractUrl(url, format = 'text') {
|
|
38
|
+
this.requireRunning();
|
|
39
|
+
const response = await this.httpClient.get(url, {
|
|
40
|
+
headers: { Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' },
|
|
41
|
+
timeout: 15000,
|
|
42
|
+
});
|
|
43
|
+
const html = response.data;
|
|
44
|
+
const title = this.extractTitle(html);
|
|
45
|
+
const meta = this.extractMetaTags(html);
|
|
46
|
+
const rawContent = this.htmlToText(html);
|
|
47
|
+
let content;
|
|
48
|
+
switch (format) {
|
|
49
|
+
case 'markdown':
|
|
50
|
+
content = this.htmlToMarkdown(html);
|
|
51
|
+
break;
|
|
52
|
+
case 'html':
|
|
53
|
+
content = this.extractMainContent(html);
|
|
54
|
+
break;
|
|
55
|
+
case 'text':
|
|
56
|
+
default:
|
|
57
|
+
content = rawContent;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
url,
|
|
62
|
+
title,
|
|
63
|
+
content,
|
|
64
|
+
format,
|
|
65
|
+
wordCount: content.split(/\s+/).filter(Boolean).length,
|
|
66
|
+
metadata: {
|
|
67
|
+
description: meta['description'],
|
|
68
|
+
author: meta['author'],
|
|
69
|
+
publishedDate: meta['article:published_time'] ?? meta['date'],
|
|
70
|
+
siteName: meta['og:site_name'],
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
// ── YouTube Extraction ──
|
|
75
|
+
async extractYouTube(videoIdOrUrl) {
|
|
76
|
+
this.requireRunning();
|
|
77
|
+
const videoId = this.parseYouTubeId(videoIdOrUrl);
|
|
78
|
+
// Fetch video metadata via oEmbed
|
|
79
|
+
const oembed = await this.httpClient.get(`https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=${videoId}&format=json`);
|
|
80
|
+
// Attempt to fetch transcript via YouTube's timedtext API
|
|
81
|
+
let transcript = '';
|
|
82
|
+
try {
|
|
83
|
+
// Fetch the video page to extract caption track URL
|
|
84
|
+
const pageRes = await this.httpClient.get(`https://www.youtube.com/watch?v=${videoId}`, {
|
|
85
|
+
headers: { 'Accept-Language': 'en-US,en;q=0.9' },
|
|
86
|
+
});
|
|
87
|
+
const pageHtml = pageRes.data;
|
|
88
|
+
// Extract captions from the page data
|
|
89
|
+
const captionMatch = pageHtml.match(/"captions":\s*(\{[\s\S]*?"playerCaptionsTracklistRenderer"[\s\S]*?\})\s*,\s*"/);
|
|
90
|
+
if (captionMatch) {
|
|
91
|
+
const captionData = captionMatch[1];
|
|
92
|
+
const urlMatch = captionData.match(/"baseUrl"\s*:\s*"([^"]+)"/);
|
|
93
|
+
if (urlMatch) {
|
|
94
|
+
const captionUrl = urlMatch[1].replace(/\\u0026/g, '&');
|
|
95
|
+
const captionRes = await this.httpClient.get(captionUrl);
|
|
96
|
+
const captionXml = captionRes.data;
|
|
97
|
+
// Extract text from XML caption format
|
|
98
|
+
const textSegments = captionXml.match(/<text[^>]*>([\s\S]*?)<\/text>/g) ?? [];
|
|
99
|
+
transcript = textSegments
|
|
100
|
+
.map((seg) => seg.replace(/<[^>]+>/g, '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/'/g, "'").replace(/"/g, '"'))
|
|
101
|
+
.join(' ')
|
|
102
|
+
.trim();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
transcript = '(Transcript not available)';
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
videoId,
|
|
111
|
+
title: oembed.data.title ?? '',
|
|
112
|
+
author: oembed.data.author_name ?? '',
|
|
113
|
+
transcript: transcript || '(Transcript not available)',
|
|
114
|
+
metadata: {
|
|
115
|
+
channelUrl: oembed.data.author_url,
|
|
116
|
+
thumbnail: oembed.data.thumbnail_url,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
// ── Wikipedia Extraction ──
|
|
121
|
+
async extractWikipedia(title, language = 'en') {
|
|
122
|
+
this.requireRunning();
|
|
123
|
+
const encodedTitle = encodeURIComponent(title.replace(/ /g, '_'));
|
|
124
|
+
// Fetch summary via REST API
|
|
125
|
+
const summaryRes = await this.httpClient.get(`https://${language}.wikipedia.org/api/rest_v1/page/summary/${encodedTitle}`);
|
|
126
|
+
const summary = summaryRes.data;
|
|
127
|
+
// Fetch full content via MediaWiki API
|
|
128
|
+
const contentRes = await this.httpClient.get(`https://${language}.wikipedia.org/w/api.php`, {
|
|
129
|
+
params: {
|
|
130
|
+
action: 'query',
|
|
131
|
+
titles: title,
|
|
132
|
+
prop: 'extracts|categories|revisions',
|
|
133
|
+
explaintext: true,
|
|
134
|
+
exlimit: 1,
|
|
135
|
+
rvprop: 'timestamp',
|
|
136
|
+
format: 'json',
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
const pages = contentRes.data?.query?.pages ?? {};
|
|
140
|
+
const page = Object.values(pages)[0];
|
|
141
|
+
const fullContent = page?.extract ?? summary.extract ?? '';
|
|
142
|
+
const categories = (page?.categories ?? []).map((c) => c.title?.replace('Category:', '') ?? '');
|
|
143
|
+
const lastModified = page?.revisions?.[0]?.timestamp;
|
|
144
|
+
return {
|
|
145
|
+
title: summary.title ?? title,
|
|
146
|
+
content: fullContent,
|
|
147
|
+
summary: summary.extract ?? '',
|
|
148
|
+
url: summary.content_urls?.desktop?.page ?? `https://${language}.wikipedia.org/wiki/${encodedTitle}`,
|
|
149
|
+
language,
|
|
150
|
+
metadata: {
|
|
151
|
+
description: summary.description,
|
|
152
|
+
thumbnail: summary.thumbnail?.source,
|
|
153
|
+
lastModified,
|
|
154
|
+
categories,
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
// ── PDF Extraction ──
|
|
159
|
+
async extractPdf(url) {
|
|
160
|
+
this.requireRunning();
|
|
161
|
+
const response = await this.httpClient.get(url, {
|
|
162
|
+
responseType: 'arraybuffer',
|
|
163
|
+
timeout: 30000,
|
|
164
|
+
});
|
|
165
|
+
const buffer = Buffer.from(response.data);
|
|
166
|
+
const content = this.extractTextFromPdfBuffer(buffer);
|
|
167
|
+
// Try to extract basic PDF metadata
|
|
168
|
+
const pdfString = buffer.toString('latin1');
|
|
169
|
+
const titleMatch = pdfString.match(/\/Title\s*\(([^)]*)\)/);
|
|
170
|
+
const authorMatch = pdfString.match(/\/Author\s*\(([^)]*)\)/);
|
|
171
|
+
const subjectMatch = pdfString.match(/\/Subject\s*\(([^)]*)\)/);
|
|
172
|
+
// Count pages
|
|
173
|
+
const pageCountMatch = pdfString.match(/\/Type\s*\/Page[^s]/g);
|
|
174
|
+
const pageCount = pageCountMatch?.length;
|
|
175
|
+
return {
|
|
176
|
+
url,
|
|
177
|
+
content,
|
|
178
|
+
pageCount,
|
|
179
|
+
metadata: {
|
|
180
|
+
title: titleMatch?.[1],
|
|
181
|
+
author: authorMatch?.[1],
|
|
182
|
+
subject: subjectMatch?.[1],
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
// ── Structured Extraction ──
|
|
187
|
+
async extractStructured(url, selectors) {
|
|
188
|
+
this.requireRunning();
|
|
189
|
+
const response = await this.httpClient.get(url, {
|
|
190
|
+
headers: { Accept: 'text/html,application/xhtml+xml' },
|
|
191
|
+
timeout: 15000,
|
|
192
|
+
});
|
|
193
|
+
const html = response.data;
|
|
194
|
+
const title = this.extractTitle(html);
|
|
195
|
+
// Extract tables
|
|
196
|
+
const tables = this.extractTables(html);
|
|
197
|
+
// Extract lists
|
|
198
|
+
const lists = this.extractLists(html);
|
|
199
|
+
// Extract metadata from meta tags
|
|
200
|
+
const metadata = this.extractMetaTags(html);
|
|
201
|
+
// Extract links
|
|
202
|
+
const links = this.extractLinks(html);
|
|
203
|
+
return { url, title, tables, lists, metadata, links };
|
|
204
|
+
}
|
|
205
|
+
// ── Private: HTML Processing ──
|
|
206
|
+
extractTitle(html) {
|
|
207
|
+
const match = html.match(/<title[^>]*>([\s\S]*?)<\/title>/i);
|
|
208
|
+
return match?.[1]?.trim().replace(/\s+/g, ' ') ?? '';
|
|
209
|
+
}
|
|
210
|
+
extractMetaTags(html) {
|
|
211
|
+
const meta = {};
|
|
212
|
+
const metaRegex = /<meta\s+(?:[^>]*?\s+)?(?:name|property)\s*=\s*["']([^"']+)["']\s+(?:[^>]*?\s+)?content\s*=\s*["']([^"']*)["'][^>]*>/gi;
|
|
213
|
+
let match;
|
|
214
|
+
while ((match = metaRegex.exec(html)) !== null) {
|
|
215
|
+
meta[match[1].toLowerCase()] = match[2];
|
|
216
|
+
}
|
|
217
|
+
// Also handle content-first meta tags
|
|
218
|
+
const altRegex = /<meta\s+(?:[^>]*?\s+)?content\s*=\s*["']([^"']*)["']\s+(?:[^>]*?\s+)?(?:name|property)\s*=\s*["']([^"']+)["'][^>]*>/gi;
|
|
219
|
+
while ((match = altRegex.exec(html)) !== null) {
|
|
220
|
+
meta[match[2].toLowerCase()] = match[1];
|
|
221
|
+
}
|
|
222
|
+
return meta;
|
|
223
|
+
}
|
|
224
|
+
extractMainContent(html) {
|
|
225
|
+
// Try to extract main/article content
|
|
226
|
+
const articleMatch = html.match(/<article[^>]*>([\s\S]*?)<\/article>/i);
|
|
227
|
+
if (articleMatch)
|
|
228
|
+
return articleMatch[1];
|
|
229
|
+
const mainMatch = html.match(/<main[^>]*>([\s\S]*?)<\/main>/i);
|
|
230
|
+
if (mainMatch)
|
|
231
|
+
return mainMatch[1];
|
|
232
|
+
const bodyMatch = html.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
|
|
233
|
+
return bodyMatch?.[1] ?? html;
|
|
234
|
+
}
|
|
235
|
+
htmlToText(html) {
|
|
236
|
+
const mainHtml = this.extractMainContent(html);
|
|
237
|
+
return mainHtml
|
|
238
|
+
.replace(/<script[\s\S]*?<\/script>/gi, '')
|
|
239
|
+
.replace(/<style[\s\S]*?<\/style>/gi, '')
|
|
240
|
+
.replace(/<nav[\s\S]*?<\/nav>/gi, '')
|
|
241
|
+
.replace(/<footer[\s\S]*?<\/footer>/gi, '')
|
|
242
|
+
.replace(/<header[\s\S]*?<\/header>/gi, '')
|
|
243
|
+
.replace(/<br\s*\/?>/gi, '\n')
|
|
244
|
+
.replace(/<\/p>/gi, '\n\n')
|
|
245
|
+
.replace(/<\/div>/gi, '\n')
|
|
246
|
+
.replace(/<\/h[1-6]>/gi, '\n\n')
|
|
247
|
+
.replace(/<li[^>]*>/gi, '- ')
|
|
248
|
+
.replace(/<[^>]+>/g, '')
|
|
249
|
+
.replace(/ /g, ' ')
|
|
250
|
+
.replace(/&/g, '&')
|
|
251
|
+
.replace(/</g, '<')
|
|
252
|
+
.replace(/>/g, '>')
|
|
253
|
+
.replace(/'/g, "'")
|
|
254
|
+
.replace(/"/g, '"')
|
|
255
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
256
|
+
.replace(/[ \t]+/g, ' ')
|
|
257
|
+
.trim();
|
|
258
|
+
}
|
|
259
|
+
htmlToMarkdown(html) {
|
|
260
|
+
const mainHtml = this.extractMainContent(html);
|
|
261
|
+
return mainHtml
|
|
262
|
+
.replace(/<script[\s\S]*?<\/script>/gi, '')
|
|
263
|
+
.replace(/<style[\s\S]*?<\/style>/gi, '')
|
|
264
|
+
.replace(/<nav[\s\S]*?<\/nav>/gi, '')
|
|
265
|
+
.replace(/<footer[\s\S]*?<\/footer>/gi, '')
|
|
266
|
+
.replace(/<h1[^>]*>([\s\S]*?)<\/h1>/gi, '# $1\n\n')
|
|
267
|
+
.replace(/<h2[^>]*>([\s\S]*?)<\/h2>/gi, '## $1\n\n')
|
|
268
|
+
.replace(/<h3[^>]*>([\s\S]*?)<\/h3>/gi, '### $1\n\n')
|
|
269
|
+
.replace(/<h4[^>]*>([\s\S]*?)<\/h4>/gi, '#### $1\n\n')
|
|
270
|
+
.replace(/<h5[^>]*>([\s\S]*?)<\/h5>/gi, '##### $1\n\n')
|
|
271
|
+
.replace(/<h6[^>]*>([\s\S]*?)<\/h6>/gi, '###### $1\n\n')
|
|
272
|
+
.replace(/<strong[^>]*>([\s\S]*?)<\/strong>/gi, '**$1**')
|
|
273
|
+
.replace(/<b[^>]*>([\s\S]*?)<\/b>/gi, '**$1**')
|
|
274
|
+
.replace(/<em[^>]*>([\s\S]*?)<\/em>/gi, '*$1*')
|
|
275
|
+
.replace(/<i[^>]*>([\s\S]*?)<\/i>/gi, '*$1*')
|
|
276
|
+
.replace(/<code[^>]*>([\s\S]*?)<\/code>/gi, '`$1`')
|
|
277
|
+
.replace(/<a\s+[^>]*href\s*=\s*["']([^"']*)["'][^>]*>([\s\S]*?)<\/a>/gi, '[$2]($1)')
|
|
278
|
+
.replace(/<img\s+[^>]*src\s*=\s*["']([^"']*)["'][^>]*alt\s*=\s*["']([^"']*)["'][^>]*\/?>/gi, '')
|
|
279
|
+
.replace(/<br\s*\/?>/gi, '\n')
|
|
280
|
+
.replace(/<\/p>/gi, '\n\n')
|
|
281
|
+
.replace(/<li[^>]*>([\s\S]*?)<\/li>/gi, '- $1\n')
|
|
282
|
+
.replace(/<blockquote[^>]*>([\s\S]*?)<\/blockquote>/gi, '> $1\n')
|
|
283
|
+
.replace(/<[^>]+>/g, '')
|
|
284
|
+
.replace(/ /g, ' ')
|
|
285
|
+
.replace(/&/g, '&')
|
|
286
|
+
.replace(/</g, '<')
|
|
287
|
+
.replace(/>/g, '>')
|
|
288
|
+
.replace(/'/g, "'")
|
|
289
|
+
.replace(/"/g, '"')
|
|
290
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
291
|
+
.trim();
|
|
292
|
+
}
|
|
293
|
+
extractTables(html) {
|
|
294
|
+
const tables = [];
|
|
295
|
+
const tableRegex = /<table[^>]*>([\s\S]*?)<\/table>/gi;
|
|
296
|
+
let tableMatch;
|
|
297
|
+
while ((tableMatch = tableRegex.exec(html)) !== null) {
|
|
298
|
+
const tableHtml = tableMatch[1];
|
|
299
|
+
// Extract headers
|
|
300
|
+
const headers = [];
|
|
301
|
+
const thRegex = /<th[^>]*>([\s\S]*?)<\/th>/gi;
|
|
302
|
+
let thMatch;
|
|
303
|
+
while ((thMatch = thRegex.exec(tableHtml)) !== null) {
|
|
304
|
+
headers.push(thMatch[1].replace(/<[^>]+>/g, '').trim());
|
|
305
|
+
}
|
|
306
|
+
// Extract rows
|
|
307
|
+
const rows = [];
|
|
308
|
+
const trRegex = /<tr[^>]*>([\s\S]*?)<\/tr>/gi;
|
|
309
|
+
let trMatch;
|
|
310
|
+
while ((trMatch = trRegex.exec(tableHtml)) !== null) {
|
|
311
|
+
const cells = [];
|
|
312
|
+
const tdRegex = /<td[^>]*>([\s\S]*?)<\/td>/gi;
|
|
313
|
+
let tdMatch;
|
|
314
|
+
while ((tdMatch = tdRegex.exec(trMatch[1])) !== null) {
|
|
315
|
+
cells.push(tdMatch[1].replace(/<[^>]+>/g, '').trim());
|
|
316
|
+
}
|
|
317
|
+
if (cells.length > 0) {
|
|
318
|
+
rows.push(cells);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (headers.length > 0 || rows.length > 0) {
|
|
322
|
+
tables.push({ headers, rows });
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return tables;
|
|
326
|
+
}
|
|
327
|
+
extractLists(html) {
|
|
328
|
+
const lists = [];
|
|
329
|
+
const listRegex = /<(?:ul|ol)[^>]*>([\s\S]*?)<\/(?:ul|ol)>/gi;
|
|
330
|
+
let listMatch;
|
|
331
|
+
while ((listMatch = listRegex.exec(html)) !== null) {
|
|
332
|
+
const items = [];
|
|
333
|
+
const liRegex = /<li[^>]*>([\s\S]*?)<\/li>/gi;
|
|
334
|
+
let liMatch;
|
|
335
|
+
while ((liMatch = liRegex.exec(listMatch[1])) !== null) {
|
|
336
|
+
items.push(liMatch[1].replace(/<[^>]+>/g, '').trim());
|
|
337
|
+
}
|
|
338
|
+
if (items.length > 0) {
|
|
339
|
+
lists.push(items);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return lists;
|
|
343
|
+
}
|
|
344
|
+
extractLinks(html) {
|
|
345
|
+
const links = [];
|
|
346
|
+
const linkRegex = /<a\s+[^>]*href\s*=\s*["']([^"']*)["'][^>]*>([\s\S]*?)<\/a>/gi;
|
|
347
|
+
let match;
|
|
348
|
+
while ((match = linkRegex.exec(html)) !== null) {
|
|
349
|
+
const href = match[1].trim();
|
|
350
|
+
const text = match[2].replace(/<[^>]+>/g, '').trim();
|
|
351
|
+
if (href && text && !href.startsWith('#') && !href.startsWith('javascript:')) {
|
|
352
|
+
links.push({ text, href });
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return links.slice(0, 100); // Limit to 100 links
|
|
356
|
+
}
|
|
357
|
+
// ── Private: PDF Processing ──
|
|
358
|
+
extractTextFromPdfBuffer(buffer) {
|
|
359
|
+
// Basic PDF text extraction without external dependencies.
|
|
360
|
+
// Handles common text stream encodings (uncompressed streams).
|
|
361
|
+
const pdfStr = buffer.toString('latin1');
|
|
362
|
+
const textParts = [];
|
|
363
|
+
// Extract text from uncompressed streams
|
|
364
|
+
const streamRegex = /stream\r?\n([\s\S]*?)\r?\nendstream/g;
|
|
365
|
+
let match;
|
|
366
|
+
while ((match = streamRegex.exec(pdfStr)) !== null) {
|
|
367
|
+
const streamContent = match[1];
|
|
368
|
+
// Look for text operations: Tj (show string), TJ (show strings), ' and " operators
|
|
369
|
+
const textOps = streamContent.match(/\(([^)]*)\)\s*Tj/g) ?? [];
|
|
370
|
+
for (const op of textOps) {
|
|
371
|
+
const textMatch = op.match(/\(([^)]*)\)/);
|
|
372
|
+
if (textMatch) {
|
|
373
|
+
textParts.push(textMatch[1]);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
// Handle TJ arrays
|
|
377
|
+
const tjArrays = streamContent.match(/\[([\s\S]*?)\]\s*TJ/g) ?? [];
|
|
378
|
+
for (const arr of tjArrays) {
|
|
379
|
+
const strings = arr.match(/\(([^)]*)\)/g) ?? [];
|
|
380
|
+
const line = strings.map((s) => s.slice(1, -1)).join('');
|
|
381
|
+
if (line.trim()) {
|
|
382
|
+
textParts.push(line);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
if (textParts.length === 0) {
|
|
387
|
+
return '(PDF text extraction requires uncompressed text streams. For compressed PDFs, consider using a dedicated PDF library.)';
|
|
388
|
+
}
|
|
389
|
+
return textParts.join('\n').trim();
|
|
390
|
+
}
|
|
391
|
+
// ── Private: YouTube Helpers ──
|
|
392
|
+
parseYouTubeId(input) {
|
|
393
|
+
// Accept full URL or plain video ID
|
|
394
|
+
const urlMatch = input.match(/(?:v=|\/embed\/|youtu\.be\/|\/v\/)([a-zA-Z0-9_-]{11})/);
|
|
395
|
+
if (urlMatch)
|
|
396
|
+
return urlMatch[1];
|
|
397
|
+
// If it looks like just an ID
|
|
398
|
+
if (/^[a-zA-Z0-9_-]{11}$/.test(input))
|
|
399
|
+
return input;
|
|
400
|
+
return input;
|
|
401
|
+
}
|
|
402
|
+
requireRunning() {
|
|
403
|
+
if (!this.running)
|
|
404
|
+
throw new Error('ContentExtractionService not initialized');
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
exports.ContentExtractionService = ContentExtractionService;
|
|
408
|
+
//# sourceMappingURL=ContentExtractionService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentExtractionService.js","sourceRoot":"","sources":["../src/ContentExtractionService.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;;GAMG;;;;;;AAEH,kDAA6C;AAmE7C,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,MAAa,wBAAwB;IAInC;QAFQ,YAAO,GAAG,KAAK,CAAC;QAGtB,IAAI,CAAC,UAAU,GAAG,eAAK,CAAC,MAAM,CAAC;YAC7B,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,EAAE,YAAY,EAAE,iCAAiC,EAAE;SAC7D,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,UAAU;QACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,uBAAuB;IAEvB,KAAK,CAAC,UAAU,CAAC,GAAW,EAAE,SAAiB,MAAM;QACnD,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE;YAC9C,OA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CAAC;IAED,iCAAiC;IAEzB,cAAc,CAAC,KAAa;QAClC,oCAAoC;QACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAC;QACtF,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;QACjC,8BAA8B;QAC9B,IAAI,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACpD,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,cAAc;QACpB,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACjF,CAAC;CACF;AA9cD,4DA8cC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Content Extraction Extension for AgentOS.
|
|
3
|
+
*
|
|
4
|
+
* Provides 5 tools for extracting content from URLs, YouTube videos,
|
|
5
|
+
* Wikipedia articles, PDF documents, and structured web data.
|
|
6
|
+
*
|
|
7
|
+
* @module @framers/agentos-ext-content-extraction
|
|
8
|
+
*/
|
|
9
|
+
export interface ContentExtractionOptions {
|
|
10
|
+
secrets?: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
export interface ExtensionContext {
|
|
13
|
+
options?: Record<string, unknown>;
|
|
14
|
+
secrets?: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
export interface ExtensionPack {
|
|
17
|
+
name: string;
|
|
18
|
+
version: string;
|
|
19
|
+
descriptors: Array<{
|
|
20
|
+
id: string;
|
|
21
|
+
kind: string;
|
|
22
|
+
priority?: number;
|
|
23
|
+
payload: unknown;
|
|
24
|
+
}>;
|
|
25
|
+
onActivate?: () => Promise<void>;
|
|
26
|
+
onDeactivate?: () => Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export declare function createExtensionPack(context: ExtensionContext): ExtensionPack;
|
|
29
|
+
export { ContentExtractionService } from './ContentExtractionService.js';
|
|
30
|
+
export type { UrlExtractionResult, YouTubeExtractionResult, WikipediaExtractionResult, PdfExtractionResult, StructuredExtractionResult, } from './ContentExtractionService.js';
|
|
31
|
+
export { ExtractUrlTool } from './tools/url.js';
|
|
32
|
+
export { ExtractYouTubeTool } from './tools/youtube.js';
|
|
33
|
+
export { ExtractWikipediaTool } from './tools/wikipedia.js';
|
|
34
|
+
export { ExtractPdfTool } from './tools/pdf.js';
|
|
35
|
+
export { ExtractStructuredTool } from './tools/structured.js';
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAaH,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAMD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACtF,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAMD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CA0B5E;AAMD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Content Extraction Extension for AgentOS.
|
|
5
|
+
*
|
|
6
|
+
* Provides 5 tools for extracting content from URLs, YouTube videos,
|
|
7
|
+
* Wikipedia articles, PDF documents, and structured web data.
|
|
8
|
+
*
|
|
9
|
+
* @module @framers/agentos-ext-content-extraction
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ExtractStructuredTool = exports.ExtractPdfTool = exports.ExtractWikipediaTool = exports.ExtractYouTubeTool = exports.ExtractUrlTool = exports.ContentExtractionService = void 0;
|
|
13
|
+
exports.createExtensionPack = createExtensionPack;
|
|
14
|
+
const ContentExtractionService_js_1 = require("./ContentExtractionService.js");
|
|
15
|
+
const url_js_1 = require("./tools/url.js");
|
|
16
|
+
const youtube_js_1 = require("./tools/youtube.js");
|
|
17
|
+
const wikipedia_js_1 = require("./tools/wikipedia.js");
|
|
18
|
+
const pdf_js_1 = require("./tools/pdf.js");
|
|
19
|
+
const structured_js_1 = require("./tools/structured.js");
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Factory
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
function createExtensionPack(context) {
|
|
24
|
+
const service = new ContentExtractionService_js_1.ContentExtractionService();
|
|
25
|
+
const urlTool = new url_js_1.ExtractUrlTool(service);
|
|
26
|
+
const youtubeTool = new youtube_js_1.ExtractYouTubeTool(service);
|
|
27
|
+
const wikipediaTool = new wikipedia_js_1.ExtractWikipediaTool(service);
|
|
28
|
+
const pdfTool = new pdf_js_1.ExtractPdfTool(service);
|
|
29
|
+
const structuredTool = new structured_js_1.ExtractStructuredTool(service);
|
|
30
|
+
return {
|
|
31
|
+
name: '@framers/agentos-ext-content-extraction',
|
|
32
|
+
version: '0.1.0',
|
|
33
|
+
descriptors: [
|
|
34
|
+
{ id: 'extractUrl', kind: 'tool', priority: 50, payload: urlTool },
|
|
35
|
+
{ id: 'extractYoutube', kind: 'tool', priority: 50, payload: youtubeTool },
|
|
36
|
+
{ id: 'extractWikipedia', kind: 'tool', priority: 50, payload: wikipediaTool },
|
|
37
|
+
{ id: 'extractPdf', kind: 'tool', priority: 50, payload: pdfTool },
|
|
38
|
+
{ id: 'extractStructured', kind: 'tool', priority: 50, payload: structuredTool },
|
|
39
|
+
],
|
|
40
|
+
onActivate: async () => {
|
|
41
|
+
await service.initialize();
|
|
42
|
+
},
|
|
43
|
+
onDeactivate: async () => {
|
|
44
|
+
await service.shutdown();
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// Public exports
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
var ContentExtractionService_js_2 = require("./ContentExtractionService.js");
|
|
52
|
+
Object.defineProperty(exports, "ContentExtractionService", { enumerable: true, get: function () { return ContentExtractionService_js_2.ContentExtractionService; } });
|
|
53
|
+
var url_js_2 = require("./tools/url.js");
|
|
54
|
+
Object.defineProperty(exports, "ExtractUrlTool", { enumerable: true, get: function () { return url_js_2.ExtractUrlTool; } });
|
|
55
|
+
var youtube_js_2 = require("./tools/youtube.js");
|
|
56
|
+
Object.defineProperty(exports, "ExtractYouTubeTool", { enumerable: true, get: function () { return youtube_js_2.ExtractYouTubeTool; } });
|
|
57
|
+
var wikipedia_js_2 = require("./tools/wikipedia.js");
|
|
58
|
+
Object.defineProperty(exports, "ExtractWikipediaTool", { enumerable: true, get: function () { return wikipedia_js_2.ExtractWikipediaTool; } });
|
|
59
|
+
var pdf_js_2 = require("./tools/pdf.js");
|
|
60
|
+
Object.defineProperty(exports, "ExtractPdfTool", { enumerable: true, get: function () { return pdf_js_2.ExtractPdfTool; } });
|
|
61
|
+
var structured_js_2 = require("./tools/structured.js");
|
|
62
|
+
Object.defineProperty(exports, "ExtractStructuredTool", { enumerable: true, get: function () { return structured_js_2.ExtractStructuredTool; } });
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;;;GAOG;;;AAsCH,kDA0BC;AA9DD,+EAAyE;AACzE,2CAAgD;AAChD,mDAAwD;AACxD,uDAA4D;AAC5D,2CAAgD;AAChD,yDAA8D;AA2B9D,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,SAAgB,mBAAmB,CAAC,OAAyB;IAC3D,MAAM,OAAO,GAAG,IAAI,sDAAwB,EAAE,CAAC;IAE/C,MAAM,OAAO,GAAG,IAAI,uBAAc,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,IAAI,+BAAkB,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,aAAa,GAAG,IAAI,mCAAoB,CAAC,OAAO,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,IAAI,uBAAc,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,cAAc,GAAG,IAAI,qCAAqB,CAAC,OAAO,CAAC,CAAC;IAE1D,OAAO;QACL,IAAI,EAAE,yCAAyC;QAC/C,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE;YACX,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;YAClE,EAAE,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;YAC1E,EAAE,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;YAC9E,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;YAClE,EAAE,EAAE,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;SACjF;QACD,UAAU,EAAE,KAAK,IAAI,EAAE;YACrB,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;QAC7B,CAAC;QACD,YAAY,EAAE,KAAK,IAAI,EAAE;YACvB,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AAQjC,yCAAgD;AAAvC,wGAAA,cAAc,OAAA;AACvB,iDAAwD;AAA/C,gHAAA,kBAAkB,OAAA;AAC3B,qDAA4D;AAAnD,oHAAA,oBAAoB,OAAA;AAC7B,yCAAgD;AAAvC,wGAAA,cAAc,OAAA;AACvB,uDAA8D;AAArD,sHAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ContentExtractionService } from '../ContentExtractionService.js';
|
|
2
|
+
export declare class ExtractPdfTool {
|
|
3
|
+
private service;
|
|
4
|
+
readonly id = "extractPdf";
|
|
5
|
+
readonly name = "extractPdf";
|
|
6
|
+
readonly displayName = "Extract PDF Content";
|
|
7
|
+
readonly description = "Extract text content from a PDF document at a given URL.";
|
|
8
|
+
readonly category = "research";
|
|
9
|
+
readonly version = "0.1.0";
|
|
10
|
+
readonly hasSideEffects = false;
|
|
11
|
+
readonly inputSchema: {
|
|
12
|
+
type: "object";
|
|
13
|
+
properties: {
|
|
14
|
+
url: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
required: string[];
|
|
20
|
+
};
|
|
21
|
+
constructor(service: ContentExtractionService);
|
|
22
|
+
execute(args: {
|
|
23
|
+
url: string;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
success: boolean;
|
|
26
|
+
data?: any;
|
|
27
|
+
error?: string;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=pdf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf.d.ts","sourceRoot":"","sources":["../../src/tools/pdf.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE/E,qBAAa,cAAc;IAiBb,OAAO,CAAC,OAAO;IAhB3B,QAAQ,CAAC,EAAE,gBAAgB;IAC3B,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,QAAQ,CAAC,WAAW,yBAAyB;IAC7C,QAAQ,CAAC,WAAW,8DAA8D;IAClF,QAAQ,CAAC,QAAQ,cAAc;IAC/B,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,cAAc,SAAS;IAEhC,QAAQ,CAAC,WAAW;;;;;;;;;MAMlB;gBAEkB,OAAO,EAAE,wBAAwB;IAE/C,OAAO,CAAC,IAAI,EAAE;QAClB,GAAG,EAAE,MAAM,CAAC;KACb,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAQ9D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtractPdfTool = void 0;
|
|
4
|
+
class ExtractPdfTool {
|
|
5
|
+
constructor(service) {
|
|
6
|
+
this.service = service;
|
|
7
|
+
this.id = 'extractPdf';
|
|
8
|
+
this.name = 'extractPdf';
|
|
9
|
+
this.displayName = 'Extract PDF Content';
|
|
10
|
+
this.description = 'Extract text content from a PDF document at a given URL.';
|
|
11
|
+
this.category = 'research';
|
|
12
|
+
this.version = '0.1.0';
|
|
13
|
+
this.hasSideEffects = false;
|
|
14
|
+
this.inputSchema = {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
url: { type: 'string', description: 'URL of the PDF document to extract text from' },
|
|
18
|
+
},
|
|
19
|
+
required: ['url'],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async execute(args) {
|
|
23
|
+
try {
|
|
24
|
+
const result = await this.service.extractPdf(args.url);
|
|
25
|
+
return { success: true, data: result };
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
return { success: false, error: err.message };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.ExtractPdfTool = ExtractPdfTool;
|
|
33
|
+
//# sourceMappingURL=pdf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf.js","sourceRoot":"","sources":["../../src/tools/pdf.ts"],"names":[],"mappings":";;;AAGA,MAAa,cAAc;IAiBzB,YAAoB,OAAiC;QAAjC,YAAO,GAAP,OAAO,CAA0B;QAhB5C,OAAE,GAAG,YAAY,CAAC;QAClB,SAAI,GAAG,YAAY,CAAC;QACpB,gBAAW,GAAG,qBAAqB,CAAC;QACpC,gBAAW,GAAG,0DAA0D,CAAC;QACzE,aAAQ,GAAG,UAAU,CAAC;QACtB,YAAO,GAAG,OAAO,CAAC;QAClB,mBAAc,GAAG,KAAK,CAAC;QAEvB,gBAAW,GAAG;YACrB,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8CAA8C,EAAE;aACrF;YACD,QAAQ,EAAE,CAAC,KAAK,CAAC;SAClB,CAAC;IAEsD,CAAC;IAEzD,KAAK,CAAC,OAAO,CAAC,IAEb;QACC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACvD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACzC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AA7BD,wCA6BC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ContentExtractionService } from '../ContentExtractionService.js';
|
|
2
|
+
export declare class ExtractStructuredTool {
|
|
3
|
+
private service;
|
|
4
|
+
readonly id = "extractStructured";
|
|
5
|
+
readonly name = "extractStructured";
|
|
6
|
+
readonly displayName = "Extract Structured Data";
|
|
7
|
+
readonly description = "Extract structured data (tables, lists, links, metadata) from a web page.";
|
|
8
|
+
readonly category = "research";
|
|
9
|
+
readonly version = "0.1.0";
|
|
10
|
+
readonly hasSideEffects = false;
|
|
11
|
+
readonly inputSchema: {
|
|
12
|
+
type: "object";
|
|
13
|
+
properties: {
|
|
14
|
+
url: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
selectors: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
properties: {
|
|
22
|
+
tables: {
|
|
23
|
+
type: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
lists: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
links: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
required: string[];
|
|
38
|
+
};
|
|
39
|
+
constructor(service: ContentExtractionService);
|
|
40
|
+
execute(args: {
|
|
41
|
+
url: string;
|
|
42
|
+
selectors?: Record<string, string>;
|
|
43
|
+
}): Promise<{
|
|
44
|
+
success: boolean;
|
|
45
|
+
data?: any;
|
|
46
|
+
error?: string;
|
|
47
|
+
}>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=structured.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structured.d.ts","sourceRoot":"","sources":["../../src/tools/structured.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE/E,qBAAa,qBAAqB;IA0BpB,OAAO,CAAC,OAAO;IAzB3B,QAAQ,CAAC,EAAE,uBAAuB;IAClC,QAAQ,CAAC,IAAI,uBAAuB;IACpC,QAAQ,CAAC,WAAW,6BAA6B;IACjD,QAAQ,CAAC,WAAW,+EAA+E;IACnG,QAAQ,CAAC,QAAQ,cAAc;IAC/B,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,cAAc,SAAS;IAEhC,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;MAelB;gBAEkB,OAAO,EAAE,wBAAwB;IAE/C,OAAO,CAAC,IAAI,EAAE;QAClB,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAQ9D"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtractStructuredTool = void 0;
|
|
4
|
+
class ExtractStructuredTool {
|
|
5
|
+
constructor(service) {
|
|
6
|
+
this.service = service;
|
|
7
|
+
this.id = 'extractStructured';
|
|
8
|
+
this.name = 'extractStructured';
|
|
9
|
+
this.displayName = 'Extract Structured Data';
|
|
10
|
+
this.description = 'Extract structured data (tables, lists, links, metadata) from a web page.';
|
|
11
|
+
this.category = 'research';
|
|
12
|
+
this.version = '0.1.0';
|
|
13
|
+
this.hasSideEffects = false;
|
|
14
|
+
this.inputSchema = {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
url: { type: 'string', description: 'URL to extract structured data from' },
|
|
18
|
+
selectors: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
description: 'Optional CSS-style selectors to target specific elements',
|
|
21
|
+
properties: {
|
|
22
|
+
tables: { type: 'string', description: 'Selector for tables' },
|
|
23
|
+
lists: { type: 'string', description: 'Selector for lists' },
|
|
24
|
+
links: { type: 'string', description: 'Selector for links' },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
required: ['url'],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
async execute(args) {
|
|
32
|
+
try {
|
|
33
|
+
const result = await this.service.extractStructured(args.url, args.selectors);
|
|
34
|
+
return { success: true, data: result };
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
return { success: false, error: err.message };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ExtractStructuredTool = ExtractStructuredTool;
|
|
42
|
+
//# sourceMappingURL=structured.js.map
|
|
@@ -0,0 +1 @@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AO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AAvCD,sDAuCC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ContentExtractionService } from '../ContentExtractionService.js';
|
|
2
|
+
export declare class ExtractUrlTool {
|
|
3
|
+
private service;
|
|
4
|
+
readonly id = "extractUrl";
|
|
5
|
+
readonly name = "extractUrl";
|
|
6
|
+
readonly displayName = "Extract URL Content";
|
|
7
|
+
readonly description = "Extract clean text, markdown, or HTML content from any URL using readability-style parsing.";
|
|
8
|
+
readonly category = "research";
|
|
9
|
+
readonly version = "0.1.0";
|
|
10
|
+
readonly hasSideEffects = false;
|
|
11
|
+
readonly inputSchema: {
|
|
12
|
+
type: "object";
|
|
13
|
+
properties: {
|
|
14
|
+
url: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
format: {
|
|
19
|
+
type: string;
|
|
20
|
+
enum: string[];
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
required: string[];
|
|
25
|
+
};
|
|
26
|
+
constructor(service: ContentExtractionService);
|
|
27
|
+
execute(args: {
|
|
28
|
+
url: string;
|
|
29
|
+
format?: 'text' | 'markdown' | 'html';
|
|
30
|
+
}): Promise<{
|
|
31
|
+
success: boolean;
|
|
32
|
+
data?: any;
|
|
33
|
+
error?: string;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/tools/url.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE/E,qBAAa,cAAc;IAsBb,OAAO,CAAC,OAAO;IArB3B,QAAQ,CAAC,EAAE,gBAAgB;IAC3B,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,QAAQ,CAAC,WAAW,yBAAyB;IAC7C,QAAQ,CAAC,WAAW,iGAAiG;IACrH,QAAQ,CAAC,QAAQ,cAAc;IAC/B,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,cAAc,SAAS;IAEhC,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;MAWlB;gBAEkB,OAAO,EAAE,wBAAwB;IAE/C,OAAO,CAAC,IAAI,EAAE;QAClB,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;KACvC,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAQ9D"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtractUrlTool = void 0;
|
|
4
|
+
class ExtractUrlTool {
|
|
5
|
+
constructor(service) {
|
|
6
|
+
this.service = service;
|
|
7
|
+
this.id = 'extractUrl';
|
|
8
|
+
this.name = 'extractUrl';
|
|
9
|
+
this.displayName = 'Extract URL Content';
|
|
10
|
+
this.description = 'Extract clean text, markdown, or HTML content from any URL using readability-style parsing.';
|
|
11
|
+
this.category = 'research';
|
|
12
|
+
this.version = '0.1.0';
|
|
13
|
+
this.hasSideEffects = false;
|
|
14
|
+
this.inputSchema = {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
url: { type: 'string', description: 'URL to extract content from' },
|
|
18
|
+
format: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
enum: ['text', 'markdown', 'html'],
|
|
21
|
+
description: 'Output format (default: text)',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
required: ['url'],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
async execute(args) {
|
|
28
|
+
try {
|
|
29
|
+
const result = await this.service.extractUrl(args.url, args.format ?? 'text');
|
|
30
|
+
return { success: true, data: result };
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
return { success: false, error: err.message };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.ExtractUrlTool = ExtractUrlTool;
|
|
38
|
+
//# sourceMappingURL=url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/tools/url.ts"],"names":[],"mappings":";;;AAGA,MAAa,cAAc;IAsBzB,YAAoB,OAAiC;QAAjC,YAAO,GAAP,OAAO,CAA0B;QArB5C,OAAE,GAAG,YAAY,CAAC;QAClB,SAAI,GAAG,YAAY,CAAC;QACpB,gBAAW,GAAG,qBAAqB,CAAC;QACpC,gBAAW,GAAG,6FAA6F,CAAC;QAC5G,aAAQ,GAAG,UAAU,CAAC;QACtB,YAAO,GAAG,OAAO,CAAC;QAClB,mBAAc,GAAG,KAAK,CAAC;QAEvB,gBAAW,GAAG;YACrB,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;gBACnE,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC;oBAClC,WAAW,EAAE,+BAA+B;iBAC7C;aACF;YACD,QAAQ,EAAE,CAAC,KAAK,CAAC;SAClB,CAAC;IAEsD,CAAC;IAEzD,KAAK,CAAC,OAAO,CAAC,IAGb;QACC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC;YAC9E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACzC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AAnCD,wCAmCC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ContentExtractionService } from '../ContentExtractionService.js';
|
|
2
|
+
export declare class ExtractWikipediaTool {
|
|
3
|
+
private service;
|
|
4
|
+
readonly id = "extractWikipedia";
|
|
5
|
+
readonly name = "extractWikipedia";
|
|
6
|
+
readonly displayName = "Extract Wikipedia Article";
|
|
7
|
+
readonly description = "Extract Wikipedia article content, summary, and metadata by title. Supports multiple languages.";
|
|
8
|
+
readonly category = "research";
|
|
9
|
+
readonly version = "0.1.0";
|
|
10
|
+
readonly hasSideEffects = false;
|
|
11
|
+
readonly inputSchema: {
|
|
12
|
+
type: "object";
|
|
13
|
+
properties: {
|
|
14
|
+
title: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
language: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
required: string[];
|
|
24
|
+
};
|
|
25
|
+
constructor(service: ContentExtractionService);
|
|
26
|
+
execute(args: {
|
|
27
|
+
title: string;
|
|
28
|
+
language?: string;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
success: boolean;
|
|
31
|
+
data?: any;
|
|
32
|
+
error?: string;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=wikipedia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wikipedia.d.ts","sourceRoot":"","sources":["../../src/tools/wikipedia.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE/E,qBAAa,oBAAoB;IAkBnB,OAAO,CAAC,OAAO;IAjB3B,QAAQ,CAAC,EAAE,sBAAsB;IACjC,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,WAAW,+BAA+B;IACnD,QAAQ,CAAC,WAAW,qGAAqG;IACzH,QAAQ,CAAC,QAAQ,cAAc;IAC/B,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,cAAc,SAAS;IAEhC,QAAQ,CAAC,WAAW;;;;;;;;;;;;;MAOlB;gBAEkB,OAAO,EAAE,wBAAwB;IAE/C,OAAO,CAAC,IAAI,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAQ9D"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtractWikipediaTool = void 0;
|
|
4
|
+
class ExtractWikipediaTool {
|
|
5
|
+
constructor(service) {
|
|
6
|
+
this.service = service;
|
|
7
|
+
this.id = 'extractWikipedia';
|
|
8
|
+
this.name = 'extractWikipedia';
|
|
9
|
+
this.displayName = 'Extract Wikipedia Article';
|
|
10
|
+
this.description = 'Extract Wikipedia article content, summary, and metadata by title. Supports multiple languages.';
|
|
11
|
+
this.category = 'research';
|
|
12
|
+
this.version = '0.1.0';
|
|
13
|
+
this.hasSideEffects = false;
|
|
14
|
+
this.inputSchema = {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
title: { type: 'string', description: 'Wikipedia article title (e.g., "Artificial intelligence")' },
|
|
18
|
+
language: { type: 'string', description: 'Wikipedia language code (default: "en")' },
|
|
19
|
+
},
|
|
20
|
+
required: ['title'],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async execute(args) {
|
|
24
|
+
try {
|
|
25
|
+
const result = await this.service.extractWikipedia(args.title, args.language ?? 'en');
|
|
26
|
+
return { success: true, data: result };
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
return { success: false, error: err.message };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.ExtractWikipediaTool = ExtractWikipediaTool;
|
|
34
|
+
//# sourceMappingURL=wikipedia.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wikipedia.js","sourceRoot":"","sources":["../../src/tools/wikipedia.ts"],"names":[],"mappings":";;;AAGA,MAAa,oBAAoB;IAkB/B,YAAoB,OAAiC;QAAjC,YAAO,GAAP,OAAO,CAA0B;QAjB5C,OAAE,GAAG,kBAAkB,CAAC;QACxB,SAAI,GAAG,kBAAkB,CAAC;QAC1B,gBAAW,GAAG,2BAA2B,CAAC;QAC1C,gBAAW,GAAG,iGAAiG,CAAC;QAChH,aAAQ,GAAG,UAAU,CAAC;QACtB,YAAO,GAAG,OAAO,CAAC;QAClB,mBAAc,GAAG,KAAK,CAAC;QAEvB,gBAAW,GAAG;YACrB,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2DAA2D,EAAE;gBACnG,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yCAAyC,EAAE;aACrF;YACD,QAAQ,EAAE,CAAC,OAAO,CAAC;SACpB,CAAC;IAEsD,CAAC;IAEzD,KAAK,CAAC,OAAO,CAAC,IAGb;QACC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC;YACtF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACzC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AA/BD,oDA+BC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ContentExtractionService } from '../ContentExtractionService.js';
|
|
2
|
+
export declare class ExtractYouTubeTool {
|
|
3
|
+
private service;
|
|
4
|
+
readonly id = "extractYoutube";
|
|
5
|
+
readonly name = "extractYoutube";
|
|
6
|
+
readonly displayName = "Extract YouTube Transcript";
|
|
7
|
+
readonly description = "Get YouTube video transcript and metadata from a video ID or URL.";
|
|
8
|
+
readonly category = "research";
|
|
9
|
+
readonly version = "0.1.0";
|
|
10
|
+
readonly hasSideEffects = false;
|
|
11
|
+
readonly inputSchema: {
|
|
12
|
+
type: "object";
|
|
13
|
+
properties: {
|
|
14
|
+
videoId: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
required: string[];
|
|
20
|
+
};
|
|
21
|
+
constructor(service: ContentExtractionService);
|
|
22
|
+
execute(args: {
|
|
23
|
+
videoId: string;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
success: boolean;
|
|
26
|
+
data?: any;
|
|
27
|
+
error?: string;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=youtube.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"youtube.d.ts","sourceRoot":"","sources":["../../src/tools/youtube.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE/E,qBAAa,kBAAkB;IAiBjB,OAAO,CAAC,OAAO;IAhB3B,QAAQ,CAAC,EAAE,oBAAoB;IAC/B,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CAAC,WAAW,gCAAgC;IACpD,QAAQ,CAAC,WAAW,uEAAuE;IAC3F,QAAQ,CAAC,QAAQ,cAAc;IAC/B,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,cAAc,SAAS;IAEhC,QAAQ,CAAC,WAAW;;;;;;;;;MAMlB;gBAEkB,OAAO,EAAE,wBAAwB;IAE/C,OAAO,CAAC,IAAI,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAQ9D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtractYouTubeTool = void 0;
|
|
4
|
+
class ExtractYouTubeTool {
|
|
5
|
+
constructor(service) {
|
|
6
|
+
this.service = service;
|
|
7
|
+
this.id = 'extractYoutube';
|
|
8
|
+
this.name = 'extractYoutube';
|
|
9
|
+
this.displayName = 'Extract YouTube Transcript';
|
|
10
|
+
this.description = 'Get YouTube video transcript and metadata from a video ID or URL.';
|
|
11
|
+
this.category = 'research';
|
|
12
|
+
this.version = '0.1.0';
|
|
13
|
+
this.hasSideEffects = false;
|
|
14
|
+
this.inputSchema = {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
videoId: { type: 'string', description: 'YouTube video ID or full URL (e.g., "dQw4w9WgXcQ" or "https://www.youtube.com/watch?v=dQw4w9WgXcQ")' },
|
|
18
|
+
},
|
|
19
|
+
required: ['videoId'],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async execute(args) {
|
|
23
|
+
try {
|
|
24
|
+
const result = await this.service.extractYouTube(args.videoId);
|
|
25
|
+
return { success: true, data: result };
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
return { success: false, error: err.message };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.ExtractYouTubeTool = ExtractYouTubeTool;
|
|
33
|
+
//# sourceMappingURL=youtube.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"youtube.js","sourceRoot":"","sources":["../../src/tools/youtube.ts"],"names":[],"mappings":";;;AAGA,MAAa,kBAAkB;IAiB7B,YAAoB,OAAiC;QAAjC,YAAO,GAAP,OAAO,CAA0B;QAhB5C,OAAE,GAAG,gBAAgB,CAAC;QACtB,SAAI,GAAG,gBAAgB,CAAC;QACxB,gBAAW,GAAG,4BAA4B,CAAC;QAC3C,gBAAW,GAAG,mEAAmE,CAAC;QAClF,aAAQ,GAAG,UAAU,CAAC;QACtB,YAAO,GAAG,OAAO,CAAC;QAClB,mBAAc,GAAG,KAAK,CAAC;QAEvB,gBAAW,GAAG;YACrB,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qGAAqG,EAAE;aAChJ;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB,CAAC;IAEsD,CAAC;IAEzD,KAAK,CAAC,OAAO,CAAC,IAEb;QACC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACzC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AA7BD,gDA6BC"}
|
package/manifest.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
|
|
3
|
+
"id": "com.framers.research.content-extraction",
|
|
4
|
+
"name": "Content Extraction Extension",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"description": "Extract clean text, markdown, and structured data from URLs, YouTube videos, Wikipedia articles, and PDF documents.",
|
|
7
|
+
"categories": ["research", "data"],
|
|
8
|
+
"sdk": "axios",
|
|
9
|
+
"extensions": [
|
|
10
|
+
{ "kind": "tool", "id": "extractUrl", "displayName": "Extract URL Content" },
|
|
11
|
+
{ "kind": "tool", "id": "extractYoutube", "displayName": "Extract YouTube Transcript" },
|
|
12
|
+
{ "kind": "tool", "id": "extractWikipedia", "displayName": "Extract Wikipedia Article" },
|
|
13
|
+
{ "kind": "tool", "id": "extractPdf", "displayName": "Extract PDF Content" },
|
|
14
|
+
{ "kind": "tool", "id": "extractStructured", "displayName": "Extract Structured Data" }
|
|
15
|
+
],
|
|
16
|
+
"requiredSecrets": [],
|
|
17
|
+
"features": [
|
|
18
|
+
"Extract clean text or markdown from any URL using readability algorithm",
|
|
19
|
+
"Get YouTube video transcripts and metadata",
|
|
20
|
+
"Extract Wikipedia article content in multiple languages",
|
|
21
|
+
"Extract text from remote PDF documents",
|
|
22
|
+
"Extract structured data (tables, lists, metadata) with CSS selectors"
|
|
23
|
+
]
|
|
24
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@framers/agentos-ext-content-extraction",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Content extraction extension for AgentOS — extract clean text from URLs, YouTube transcripts, Wikipedia articles, PDFs, and structured data.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"manifest.json"
|
|
10
|
+
],
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"@framers/agentos": "^0.5.2"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"axios": "^1.7.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@framers/agentos": "^0.6.6",
|
|
19
|
+
"@types/node": "^20.0.0",
|
|
20
|
+
"typescript": "^5.0.0",
|
|
21
|
+
"vitest": "^1.0.0"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/framersai/agentos-extensions",
|
|
26
|
+
"directory": "registry/curated/research/content-extraction"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc",
|
|
30
|
+
"dev": "tsc --watch",
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"test:watch": "vitest watch",
|
|
33
|
+
"clean": "rm -rf dist"
|
|
34
|
+
}
|
|
35
|
+
}
|