@elizaos/plugin-pdf 1.0.0-alpha.62 → 1.0.0-alpha.64

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 CHANGED
@@ -62,7 +62,7 @@ AWS_S3_FORCE_PATH_STYLE=boolean(true|false)
62
62
  ## Usage
63
63
 
64
64
  ```typescript
65
- import { createNodePlugin } from "@elizaos/plugin-node";
65
+ import { createNodePlugin } from '@elizaos/plugin-node';
66
66
 
67
67
  // Initialize the plugin
68
68
  const nodePlugin = createNodePlugin();
@@ -157,8 +157,8 @@ Analyzes and generates descriptions for images.
157
157
 
158
158
  ```typescript
159
159
  // Example usage
160
- const result = await runtime.executeAction("DESCRIBE_IMAGE", {
161
- imageUrl: "path/to/image.jpg",
160
+ const result = await runtime.executeAction('DESCRIBE_IMAGE', {
161
+ imageUrl: 'path/to/image.jpg',
162
162
  });
163
163
  ```
164
164
 
@@ -234,7 +234,7 @@ Error: AWS credentials not configured
234
234
  Enable debug logging for detailed troubleshooting:
235
235
 
236
236
  ```typescript
237
- process.env.DEBUG = "eliza:plugin-node:*";
237
+ process.env.DEBUG = 'eliza:plugin-node:*';
238
238
  ```
239
239
 
240
240
  ### System Requirements
@@ -248,20 +248,20 @@ process.env.DEBUG = "eliza:plugin-node:*";
248
248
 
249
249
  1. **Cache Management**
250
250
 
251
- - Regular cleanup of `content_cache` directory
252
- - Implement cache size limits
253
- - Monitor disk usage
251
+ - Regular cleanup of `content_cache` directory
252
+ - Implement cache size limits
253
+ - Monitor disk usage
254
254
 
255
255
  2. **Memory Usage**
256
256
 
257
- - Configure max buffer sizes
258
- - Implement streaming for large files
259
- - Monitor memory consumption
257
+ - Configure max buffer sizes
258
+ - Implement streaming for large files
259
+ - Monitor memory consumption
260
260
 
261
261
  3. **Concurrent Operations**
262
- - Adjust queue size limits
263
- - Configure worker threads
264
- - Monitor process pool
262
+ - Adjust queue size limits
263
+ - Configure worker threads
264
+ - Monitor process pool
265
265
 
266
266
  ## Support
267
267
 
@@ -270,82 +270,82 @@ For issues and feature requests, please:
270
270
  1. Check the troubleshooting guide above
271
271
  2. Review existing GitHub issues
272
272
  3. Submit a new issue with:
273
- - System information
274
- - Error logs
275
- - Steps to reproduce
273
+ - System information
274
+ - Error logs
275
+ - Steps to reproduce
276
276
 
277
277
  ## Future Enhancements
278
278
 
279
279
  1. **File Operations**
280
280
 
281
- - Enhanced streaming capabilities
282
- - Advanced compression options
283
- - Batch file processing
284
- - File type detection
285
- - Metadata management
286
- - Version control integration
281
+ - Enhanced streaming capabilities
282
+ - Advanced compression options
283
+ - Batch file processing
284
+ - File type detection
285
+ - Metadata management
286
+ - Version control integration
287
287
 
288
288
  2. **Media Processing**
289
289
 
290
- - Additional video formats
291
- - Advanced image processing
292
- - Audio enhancement tools
293
- - Real-time processing
294
- - Quality optimization
295
- - Format conversion
290
+ - Additional video formats
291
+ - Advanced image processing
292
+ - Audio enhancement tools
293
+ - Real-time processing
294
+ - Quality optimization
295
+ - Format conversion
296
296
 
297
297
  3. **Cloud Integration**
298
298
 
299
- - Multi-cloud support
300
- - Advanced caching
301
- - CDN optimization
302
- - Auto-scaling features
303
- - Cost optimization
304
- - Backup automation
299
+ - Multi-cloud support
300
+ - Advanced caching
301
+ - CDN optimization
302
+ - Auto-scaling features
303
+ - Cost optimization
304
+ - Backup automation
305
305
 
306
306
  4. **Speech Services**
307
307
 
308
- - Additional voice models
309
- - Language expansion
310
- - Emotion detection
311
- - Voice cloning
312
- - Real-time synthesis
313
- - Custom voice training
308
+ - Additional voice models
309
+ - Language expansion
310
+ - Emotion detection
311
+ - Voice cloning
312
+ - Real-time synthesis
313
+ - Custom voice training
314
314
 
315
315
  5. **Browser Automation**
316
316
 
317
- - Headless optimization
318
- - Parallel processing
319
- - Session management
320
- - Cookie handling
321
- - Proxy support
322
- - Resource optimization
317
+ - Headless optimization
318
+ - Parallel processing
319
+ - Session management
320
+ - Cookie handling
321
+ - Proxy support
322
+ - Resource optimization
323
323
 
324
324
  6. **Security Features**
325
325
 
326
- - Enhanced encryption
327
- - Access control
328
- - Audit logging
329
- - Threat detection
330
- - Rate limiting
331
- - Compliance tools
326
+ - Enhanced encryption
327
+ - Access control
328
+ - Audit logging
329
+ - Threat detection
330
+ - Rate limiting
331
+ - Compliance tools
332
332
 
333
333
  7. **Performance Optimization**
334
334
 
335
- - Memory management
336
- - CPU utilization
337
- - Concurrent operations
338
- - Resource pooling
339
- - Cache strategies
340
- - Load balancing
335
+ - Memory management
336
+ - CPU utilization
337
+ - Concurrent operations
338
+ - Resource pooling
339
+ - Cache strategies
340
+ - Load balancing
341
341
 
342
342
  8. **Developer Tools**
343
- - Enhanced debugging
344
- - Testing framework
345
- - Documentation generator
346
- - CLI improvements
347
- - Monitoring tools
348
- - Integration templates
343
+ - Enhanced debugging
344
+ - Testing framework
345
+ - Documentation generator
346
+ - CLI improvements
347
+ - Monitoring tools
348
+ - Integration templates
349
349
 
350
350
  We welcome community feedback and contributions to help prioritize these enhancements.
351
351
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/services/pdf.ts","../src/index.ts"],"sourcesContent":["import {\n\ttype IAgentRuntime,\n\ttype IPdfService,\n\tService,\n\ttype ServiceTypeName,\n\tServiceType,\n} from \"@elizaos/core\";\nimport { type PDFDocumentProxy, getDocument } from \"pdfjs-dist\";\nimport type {\n\tTextItem,\n\tTextMarkedContent,\n} from \"pdfjs-dist/types/src/display/api\";\n\n/**\n * Class representing a PDF service that can convert PDF files to text.\n * * @extends Service\n * @implements IPdfService\n */\nexport class PdfService extends Service implements IPdfService {\n\tstatic serviceType: ServiceTypeName = ServiceType.PDF;\n\tcapabilityDescription = \"The agent is able to convert PDF files to text\";\n\n\t/**\n\t * Constructor for creating a new instance of the class.\n\t *\n\t * @param {IAgentRuntime} runtime - The runtime object passed to the constructor.\n\t */\n\tconstructor(runtime: IAgentRuntime) {\n\t\tsuper();\n\t\tthis.runtime = runtime;\n\t}\n\n\t/**\n\t * Starts the PdfService asynchronously.\n\t * @param {IAgentRuntime} runtime - The runtime object for the agent.\n\t * @returns {Promise<PdfService>} A promise that resolves with the PdfService instance.\n\t */\n\tstatic async start(runtime: IAgentRuntime): Promise<PdfService> {\n\t\tconst service = new PdfService(runtime);\n\t\treturn service;\n\t}\n\n\t/**\n\t * Stop the PDF service in the given runtime.\n\t *\n\t * @param {IAgentRuntime} runtime - The runtime to stop the PDF service in.\n\t * @returns {Promise<void>} - A promise that resolves once the PDF service is stopped.\n\t */\n\tstatic async stop(runtime: IAgentRuntime) {\n\t\tconst service = runtime.getService(ServiceType.PDF);\n\t\tif (service) {\n\t\t\tawait service.stop();\n\t\t}\n\t}\n\n\t/**\n\t * Asynchronously stops the process.\n\t * Does nothing.\n\t */\n\tasync stop() {\n\t\t// do nothing\n\t}\n\n\t/**\n\t * Converts a PDF Buffer to text.\n\t *\n\t * @param {Buffer} pdfBuffer - The PDF Buffer to convert to text.\n\t * @returns {Promise<string>} A Promise that resolves with the text content of the PDF.\n\t */\n\tasync convertPdfToText(pdfBuffer: Buffer): Promise<string> {\n\t\t// Convert Buffer to Uint8Array\n\t\tconst uint8Array = new Uint8Array(pdfBuffer);\n\n\t\tconst pdf: PDFDocumentProxy = await getDocument({ data: uint8Array })\n\t\t\t.promise;\n\t\tconst numPages = pdf.numPages;\n\t\tconst textPages: string[] = [];\n\n\t\tfor (let pageNum = 1; pageNum <= numPages; pageNum++) {\n\t\t\tconst page = await pdf.getPage(pageNum);\n\t\t\tconst textContent = await page.getTextContent();\n\t\t\tconst pageText = textContent.items\n\t\t\t\t.filter(isTextItem)\n\t\t\t\t.map((item) => item.str)\n\t\t\t\t.join(\" \");\n\t\t\ttextPages.push(pageText);\n\t\t}\n\n\t\treturn textPages.join(\"\\n\");\n\t}\n}\n\n// Type guard function\n/**\n * Check if the input is a TextItem.\n *\n * @param item - The input item to check.\n * @returns A boolean indicating if the input is a TextItem.\n */\nfunction isTextItem(item: TextItem | TextMarkedContent): item is TextItem {\n\treturn \"str\" in item;\n}\n","import type { Plugin } from \"@elizaos/core\";\n\nimport { PdfService } from \"./services/pdf\";\n\nexport const pdfPlugin: Plugin = {\n\tname: \"pdf\",\n\tdescription: \"Plugin for PDF reading and processing\",\n\tservices: [PdfService],\n\tactions: [],\n};\n\nexport default pdfPlugin;"],"mappings":";AAAA;AAAA,EAGC;AAAA,EAEA;AAAA,OACM;AACP,SAAgC,mBAAmB;AAW5C,IAAM,aAAN,MAAM,oBAAmB,QAA+B;AAAA,EAC9D,OAAO,cAA+B,YAAY;AAAA,EAClD,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOxB,YAAY,SAAwB;AACnC,UAAM;AACN,SAAK,UAAU;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,MAAM,SAA6C;AAC/D,UAAM,UAAU,IAAI,YAAW,OAAO;AACtC,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,aAAa,KAAK,SAAwB;AACzC,UAAM,UAAU,QAAQ,WAAW,YAAY,GAAG;AAClD,QAAI,SAAS;AACZ,YAAM,QAAQ,KAAK;AAAA,IACpB;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,OAAO;AAAA,EAEb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,iBAAiB,WAAoC;AAE1D,UAAM,aAAa,IAAI,WAAW,SAAS;AAE3C,UAAM,MAAwB,MAAM,YAAY,EAAE,MAAM,WAAW,CAAC,EAClE;AACF,UAAM,WAAW,IAAI;AACrB,UAAM,YAAsB,CAAC;AAE7B,aAAS,UAAU,GAAG,WAAW,UAAU,WAAW;AACrD,YAAM,OAAO,MAAM,IAAI,QAAQ,OAAO;AACtC,YAAM,cAAc,MAAM,KAAK,eAAe;AAC9C,YAAM,WAAW,YAAY,MAC3B,OAAO,UAAU,EACjB,IAAI,CAAC,SAAS,KAAK,GAAG,EACtB,KAAK,GAAG;AACV,gBAAU,KAAK,QAAQ;AAAA,IACxB;AAEA,WAAO,UAAU,KAAK,IAAI;AAAA,EAC3B;AACD;AASA,SAAS,WAAW,MAAsD;AACzE,SAAO,SAAS;AACjB;;;ACjGO,IAAM,YAAoB;AAAA,EAChC,MAAM;AAAA,EACN,aAAa;AAAA,EACb,UAAU,CAAC,UAAU;AAAA,EACrB,SAAS,CAAC;AACX;AAEA,IAAO,gBAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/services/pdf.ts","../src/index.ts"],"sourcesContent":["import {\n type IAgentRuntime,\n type IPdfService,\n Service,\n type ServiceTypeName,\n ServiceType,\n} from '@elizaos/core';\nimport { type PDFDocumentProxy, getDocument } from 'pdfjs-dist';\nimport type { TextItem, TextMarkedContent } from 'pdfjs-dist/types/src/display/api';\n\n/**\n * Class representing a PDF service that can convert PDF files to text.\n * * @extends Service\n * @implements IPdfService\n */\nexport class PdfService extends Service implements IPdfService {\n static serviceType: ServiceTypeName = ServiceType.PDF;\n capabilityDescription = 'The agent is able to convert PDF files to text';\n\n /**\n * Constructor for creating a new instance of the class.\n *\n * @param {IAgentRuntime} runtime - The runtime object passed to the constructor.\n */\n constructor(runtime: IAgentRuntime) {\n super();\n this.runtime = runtime;\n }\n\n /**\n * Starts the PdfService asynchronously.\n * @param {IAgentRuntime} runtime - The runtime object for the agent.\n * @returns {Promise<PdfService>} A promise that resolves with the PdfService instance.\n */\n static async start(runtime: IAgentRuntime): Promise<PdfService> {\n const service = new PdfService(runtime);\n return service;\n }\n\n /**\n * Stop the PDF service in the given runtime.\n *\n * @param {IAgentRuntime} runtime - The runtime to stop the PDF service in.\n * @returns {Promise<void>} - A promise that resolves once the PDF service is stopped.\n */\n static async stop(runtime: IAgentRuntime) {\n const service = runtime.getService(ServiceType.PDF);\n if (service) {\n await service.stop();\n }\n }\n\n /**\n * Asynchronously stops the process.\n * Does nothing.\n */\n async stop() {\n // do nothing\n }\n\n /**\n * Converts a PDF Buffer to text.\n *\n * @param {Buffer} pdfBuffer - The PDF Buffer to convert to text.\n * @returns {Promise<string>} A Promise that resolves with the text content of the PDF.\n */\n async convertPdfToText(pdfBuffer: Buffer): Promise<string> {\n // Convert Buffer to Uint8Array\n const uint8Array = new Uint8Array(pdfBuffer);\n\n const pdf: PDFDocumentProxy = await getDocument({ data: uint8Array }).promise;\n const numPages = pdf.numPages;\n const textPages: string[] = [];\n\n for (let pageNum = 1; pageNum <= numPages; pageNum++) {\n const page = await pdf.getPage(pageNum);\n const textContent = await page.getTextContent();\n const pageText = textContent.items\n .filter(isTextItem)\n .map((item) => item.str)\n .join(' ');\n textPages.push(pageText);\n }\n\n return textPages.join('\\n');\n }\n}\n\n// Type guard function\n/**\n * Check if the input is a TextItem.\n *\n * @param item - The input item to check.\n * @returns A boolean indicating if the input is a TextItem.\n */\nfunction isTextItem(item: TextItem | TextMarkedContent): item is TextItem {\n return 'str' in item;\n}\n","import type { Plugin } from '@elizaos/core';\n\nimport { PdfService } from './services/pdf';\n\nexport const pdfPlugin: Plugin = {\n name: 'pdf',\n description: 'Plugin for PDF reading and processing',\n services: [PdfService],\n actions: [],\n};\n\nexport default pdfPlugin;\n"],"mappings":";AAAA;AAAA,EAGE;AAAA,EAEA;AAAA,OACK;AACP,SAAgC,mBAAmB;AAQ5C,IAAM,aAAN,MAAM,oBAAmB,QAA+B;AAAA,EAC7D,OAAO,cAA+B,YAAY;AAAA,EAClD,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOxB,YAAY,SAAwB;AAClC,UAAM;AACN,SAAK,UAAU;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAa,MAAM,SAA6C;AAC9D,UAAM,UAAU,IAAI,YAAW,OAAO;AACtC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,aAAa,KAAK,SAAwB;AACxC,UAAM,UAAU,QAAQ,WAAW,YAAY,GAAG;AAClD,QAAI,SAAS;AACX,YAAM,QAAQ,KAAK;AAAA,IACrB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,OAAO;AAAA,EAEb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,iBAAiB,WAAoC;AAEzD,UAAM,aAAa,IAAI,WAAW,SAAS;AAE3C,UAAM,MAAwB,MAAM,YAAY,EAAE,MAAM,WAAW,CAAC,EAAE;AACtE,UAAM,WAAW,IAAI;AACrB,UAAM,YAAsB,CAAC;AAE7B,aAAS,UAAU,GAAG,WAAW,UAAU,WAAW;AACpD,YAAM,OAAO,MAAM,IAAI,QAAQ,OAAO;AACtC,YAAM,cAAc,MAAM,KAAK,eAAe;AAC9C,YAAM,WAAW,YAAY,MAC1B,OAAO,UAAU,EACjB,IAAI,CAAC,SAAS,KAAK,GAAG,EACtB,KAAK,GAAG;AACX,gBAAU,KAAK,QAAQ;AAAA,IACzB;AAEA,WAAO,UAAU,KAAK,IAAI;AAAA,EAC5B;AACF;AASA,SAAS,WAAW,MAAsD;AACxE,SAAO,SAAS;AAClB;;;AC7FO,IAAM,YAAoB;AAAA,EAC/B,MAAM;AAAA,EACN,aAAa;AAAA,EACb,UAAU,CAAC,UAAU;AAAA,EACrB,SAAS,CAAC;AACZ;AAEA,IAAO,gBAAQ;","names":[]}
package/package.json CHANGED
@@ -1,62 +1,65 @@
1
1
  {
2
- "name": "@elizaos/plugin-pdf",
3
- "version": "1.0.0-alpha.62",
4
- "type": "module",
5
- "main": "dist/index.js",
6
- "module": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/elizaos-plugins/plugin-pdf"
11
- },
12
- "exports": {
13
- "./package.json": "./package.json",
14
- ".": {
15
- "import": {
16
- "types": "./dist/index.d.ts",
17
- "default": "./dist/index.js"
18
- }
19
- }
20
- },
21
- "files": [
22
- "dist",
23
- "scripts",
24
- "package.json",
25
- "LICENSE",
26
- "tsup.config.ts"
27
- ],
28
- "dependencies": {
29
- "@aws-sdk/client-s3": "^3.705.0",
30
- "@aws-sdk/s3-request-presigner": "^3.705.0",
31
- "@elizaos/core": "^1.0.0-alpha.62",
32
- "@types/uuid": "10.0.0",
33
- "capsolver-npm": "2.0.2",
34
- "fluent-ffmpeg": "2.1.3",
35
- "glob": "11.0.0",
36
- "patchright": "1.50.1",
37
- "pdfjs-dist": "4.7.76",
38
- "uuid": "11.0.3",
39
- "youtube-dl-exec": "3.0.15"
40
- },
41
- "trustedDependencies": [
42
- "youtube-dl-exec"
43
- ],
44
- "devDependencies": {
45
- "@types/node": "22.8.4",
46
- "tsup": "8.4.0"
47
- },
48
- "scripts": {
49
- "build": "tsup",
50
- "dev": "tsup --watch",
51
- "postinstall": "node scripts/postinstall.js",
52
- "lint": "biome check ./src --config-path=./ --apply-unsafe && biome format ./ --config-path=./ --write",
53
- "clean": "rm -rf dist .turbo node_modules .turbo-tsconfig.json tsconfig.tsbuildinfo"
54
- },
55
- "peerDependencies": {
56
- "whatwg-url": "7.1.0"
57
- },
58
- "publishConfig": {
59
- "access": "public"
60
- },
61
- "gitHead": "b970ed2cccde82f13612a9f14a1bbe91d419aea4"
2
+ "name": "@elizaos/plugin-pdf",
3
+ "version": "1.0.0-alpha.64",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/elizaos-plugins/plugin-pdf"
11
+ },
12
+ "exports": {
13
+ "./package.json": "./package.json",
14
+ ".": {
15
+ "import": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "scripts",
24
+ "package.json",
25
+ "LICENSE",
26
+ "tsup.config.ts"
27
+ ],
28
+ "dependencies": {
29
+ "@aws-sdk/client-s3": "^3.705.0",
30
+ "@aws-sdk/s3-request-presigner": "^3.705.0",
31
+ "@elizaos/core": "^1.0.0-alpha.64",
32
+ "@types/uuid": "10.0.0",
33
+ "capsolver-npm": "2.0.2",
34
+ "fluent-ffmpeg": "2.1.3",
35
+ "glob": "11.0.0",
36
+ "patchright": "1.50.1",
37
+ "pdfjs-dist": "4.7.76",
38
+ "uuid": "11.0.3",
39
+ "youtube-dl-exec": "3.0.15"
40
+ },
41
+ "trustedDependencies": [
42
+ "youtube-dl-exec"
43
+ ],
44
+ "devDependencies": {
45
+ "@types/node": "22.8.4",
46
+ "prettier": "3.5.3",
47
+ "tsup": "8.4.0"
48
+ },
49
+ "scripts": {
50
+ "build": "tsup",
51
+ "dev": "tsup --watch",
52
+ "postinstall": "node scripts/postinstall.js",
53
+ "lint": "prettier --write ./src",
54
+ "clean": "rm -rf dist .turbo node_modules .turbo-tsconfig.json tsconfig.tsbuildinfo",
55
+ "format": "prettier --write ./src",
56
+ "format:check": "prettier --check ./src"
57
+ },
58
+ "peerDependencies": {
59
+ "whatwg-url": "7.1.0"
60
+ },
61
+ "publishConfig": {
62
+ "access": "public"
63
+ },
64
+ "gitHead": "be3a1856c64c6d1ae2ec73e9f35b83ef827b0c55"
62
65
  }
@@ -1,70 +1,67 @@
1
- import { execSync } from "node:child_process";
2
- import fs from "node:fs";
3
- import os from "node:os";
1
+ import { execSync } from 'node:child_process';
2
+ import fs from 'node:fs';
3
+ import os from 'node:os';
4
4
 
5
5
  const platform = os.platform();
6
6
  const rel = os.release();
7
7
 
8
- if (platform !== "linux") {
9
- console.log(
10
- "Skipping [patchright] installation: non-Linux platform detected:",
11
- platform,
12
- );
13
- process.exit(0);
8
+ if (platform !== 'linux') {
9
+ console.log('Skipping [patchright] installation: non-Linux platform detected:', platform);
10
+ process.exit(0);
14
11
  }
15
12
 
16
13
  function getDistroName() {
17
- try {
18
- const osReleaseContent = fs.readFileSync("/etc/os-release", "utf8");
19
- const lines = osReleaseContent.split("\n");
20
- const info = {};
21
- for (const line of lines) {
22
- const [key, value] = line.split("=");
23
- if (key && value) {
24
- info[key.toLowerCase()] = value.replace(/"/g, "").toLowerCase().trim();
25
- }
26
- }
27
- return info.id || info.id_like || null;
28
- } catch (err) {
29
- console.error("Error reading /etc/os-release:", err.message);
30
- }
31
- return null;
14
+ try {
15
+ const osReleaseContent = fs.readFileSync('/etc/os-release', 'utf8');
16
+ const lines = osReleaseContent.split('\n');
17
+ const info = {};
18
+ for (const line of lines) {
19
+ const [key, value] = line.split('=');
20
+ if (key && value) {
21
+ info[key.toLowerCase()] = value.replace(/"/g, '').toLowerCase().trim();
22
+ }
23
+ }
24
+ return info.id || info.id_like || null;
25
+ } catch (err) {
26
+ console.error('Error reading /etc/os-release:', err.message);
27
+ }
28
+ return null;
32
29
  }
33
30
 
34
31
  const distro = getDistroName();
35
- console.log("Detected Linux distribution:", distro || "unknown");
32
+ console.log('Detected Linux distribution:', distro || 'unknown');
36
33
 
37
34
  const supportedDistros = [
38
- "ubuntu",
39
- "debian",
40
- "pve",
41
- "raspbian",
42
- "pop",
43
- "zorin",
44
- "linuxmint",
45
- "elementary",
46
- "pureos",
47
- "kali",
35
+ 'ubuntu',
36
+ 'debian',
37
+ 'pve',
38
+ 'raspbian',
39
+ 'pop',
40
+ 'zorin',
41
+ 'linuxmint',
42
+ 'elementary',
43
+ 'pureos',
44
+ 'kali',
48
45
  ];
49
46
 
50
47
  if (!distro || !supportedDistros.some((name) => distro.includes(name))) {
51
- console.log(
52
- "Skipping [patchright] installation on unsupported platform:",
53
- platform,
54
- rel,
55
- distro || "unknown distro",
56
- );
57
- process.exit(0);
48
+ console.log(
49
+ 'Skipping [patchright] installation on unsupported platform:',
50
+ platform,
51
+ rel,
52
+ distro || 'unknown distro'
53
+ );
54
+ process.exit(0);
58
55
  }
59
56
 
60
57
  try {
61
- execSync("npx patchright install", {
62
- stdio: "inherit",
63
- });
58
+ execSync('npx patchright install', {
59
+ stdio: 'inherit',
60
+ });
64
61
  } catch (err) {
65
- console.error(
66
- "Failed to install [patchright] you may need to install [patchright] deps with 'sudo npx patchright install-deps'. Error: ",
67
- err.message,
68
- );
69
- process.exit(1);
62
+ console.error(
63
+ "Failed to install [patchright] you may need to install [patchright] deps with 'sudo npx patchright install-deps'. Error: ",
64
+ err.message
65
+ );
66
+ process.exit(1);
70
67
  }
package/tsup.config.ts CHANGED
@@ -1,22 +1,22 @@
1
- import { defineConfig } from "tsup";
1
+ import { defineConfig } from 'tsup';
2
2
 
3
3
  export default defineConfig({
4
- entry: ["src/index.ts"],
5
- outDir: "dist",
6
- tsconfig: "./tsconfig.build.json", // Use build-specific tsconfig
7
- sourcemap: true,
8
- clean: true,
9
- format: ["esm"], // Ensure you're targeting CommonJS
10
- dts: false, // Skip DTS generation to avoid external import issues // Ensure you're targeting CommonJS
11
- external: [
12
- "dotenv", // Externalize dotenv to prevent bundling
13
- "fs", // Externalize fs to use Node.js built-in module
14
- "path", // Externalize other built-ins if necessary
15
- "@reflink/reflink",
16
- "https",
17
- "http",
18
- "agentkeepalive",
19
- "zod",
20
- "@elizaos/core",
21
- ],
4
+ entry: ['src/index.ts'],
5
+ outDir: 'dist',
6
+ tsconfig: './tsconfig.build.json', // Use build-specific tsconfig
7
+ sourcemap: true,
8
+ clean: true,
9
+ format: ['esm'], // Ensure you're targeting CommonJS
10
+ dts: false, // Skip DTS generation to avoid external import issues // Ensure you're targeting CommonJS
11
+ external: [
12
+ 'dotenv', // Externalize dotenv to prevent bundling
13
+ 'fs', // Externalize fs to use Node.js built-in module
14
+ 'path', // Externalize other built-ins if necessary
15
+ '@reflink/reflink',
16
+ 'https',
17
+ 'http',
18
+ 'agentkeepalive',
19
+ 'zod',
20
+ '@elizaos/core',
21
+ ],
22
22
  });