Skip to content

Commit b16a843

Browse files
author
Splash Agent
committed
fix: externalize heavy deps, lazy-load web-scraper, publish 2.0.2
1 parent 824e3ed commit b16a843

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "splash-agent",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "Splash — Autonomous Agent Platform: CLI + multi-provider agent loop + TUI dashboard + platform bots",
55
"author": "Splash Contributors",
66
"license": "MIT",

packages/skills/src/built-in/web-scraper.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import type { Result, SkillManifest, SkillResult } from "@alpclaw/utils";
22
import { ok, err, createError } from "@alpclaw/utils";
33
import type { Skill, SkillContext } from "../skill.js";
4-
import { Readability } from "@mozilla/readability";
5-
import { JSDOM } from "jsdom";
6-
import TurndownService from "turndown";
4+
75

86
/**
97
* Web scraper — fetches a URL and extracts clean Markdown content
@@ -44,6 +42,21 @@ export class WebScraperSkill implements Skill {
4442

4543
const html = await res.text();
4644

45+
let Readability: any;
46+
let JSDOM: any;
47+
let TurndownService: any;
48+
49+
try {
50+
const readabilityModule = await import("@mozilla/readability");
51+
const jsdomModule = await import("jsdom");
52+
const turndownModule = await import("turndown");
53+
Readability = readabilityModule.Readability;
54+
JSDOM = jsdomModule.JSDOM;
55+
TurndownService = turndownModule.default || turndownModule;
56+
} catch (err) {
57+
return { ok: false, error: createError("skill", "Web scraper dependencies not available. Run: pnpm install") };
58+
}
59+
4760
const doc = new JSDOM(html, { url });
4861
const reader = new Readability(doc.window.document);
4962
const article = reader.parse();

0 commit comments

Comments
 (0)