@x12i/sdk 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/dist/client.d.ts +53 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +110 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/registry.d.ts +8 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +17 -0
- package/dist/registry.js.map +1 -0
- package/package.json +50 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ParserRegistry, type ClassifyCandidate, type FetchResult, type ParsedResult, type Parser } from "@x12i/core";
|
|
2
|
+
import { type FetchOptions } from "@x12i/fetcher";
|
|
3
|
+
import { type IngestOptions, type IngestResult } from "@x12i/ingest";
|
|
4
|
+
export interface WebAgentClientOptions {
|
|
5
|
+
/** Provide your own registry (e.g. to only register a subset of parsers). Defaults to every first-party parser. */
|
|
6
|
+
registry?: ParserRegistry;
|
|
7
|
+
/** Default fetch options applied to every call, overridable per-call. */
|
|
8
|
+
fetchOptions?: FetchOptions;
|
|
9
|
+
/**
|
|
10
|
+
* Reuse a single browser instance across calls instead of launching one
|
|
11
|
+
* per fetch. Recommended for long-lived processes (the API/MCP server).
|
|
12
|
+
* Call `.close()` when done.
|
|
13
|
+
*/
|
|
14
|
+
reuseBrowser?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The single entry point every other package (CLI, REST API, MCP server)
|
|
18
|
+
* wraps: download a URL to Markdown, and/or classify+parse it into typed
|
|
19
|
+
* JSON using the registered parsers.
|
|
20
|
+
*/
|
|
21
|
+
export declare class WebAgentClient {
|
|
22
|
+
readonly registry: ParserRegistry;
|
|
23
|
+
private readonly defaultFetchOptions;
|
|
24
|
+
private readonly reuseBrowser;
|
|
25
|
+
private browserPromise;
|
|
26
|
+
constructor(options?: WebAgentClientOptions);
|
|
27
|
+
/** Register an additional parser on this client's registry. */
|
|
28
|
+
use<T>(parser: Parser<T>): this;
|
|
29
|
+
/** Download a URL and return { url, html, markdown, ... }. */
|
|
30
|
+
fetch(url: string, options?: FetchOptions): Promise<FetchResult>;
|
|
31
|
+
/** Fetch a URL, then rank every registered parser's fit without running parse(). */
|
|
32
|
+
classify(url: string, options?: FetchOptions): Promise<ClassifyCandidate[]>;
|
|
33
|
+
/** Fetch a URL, classify it, and parse it with the best-fit parser. */
|
|
34
|
+
parse<T = unknown>(url: string, options?: FetchOptions): Promise<ParsedResult<T>>;
|
|
35
|
+
/** Fetch a URL and force a specific parser by type id, skipping classification. */
|
|
36
|
+
parseAs<T = unknown>(type: string, url: string, options?: FetchOptions): Promise<ParsedResult<T>>;
|
|
37
|
+
/** List every registered parser's type id + description. */
|
|
38
|
+
listParsers(): {
|
|
39
|
+
type: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
version?: string;
|
|
42
|
+
}[];
|
|
43
|
+
/**
|
|
44
|
+
* Ingest a curated list / README URL: follow outbound GitHub skill links
|
|
45
|
+
* one level deep and extract targeted files (SKILL.md, .md, .sh, …).
|
|
46
|
+
* Uses GitHub raw/API — not Playwright.
|
|
47
|
+
*/
|
|
48
|
+
ingest(rootUrl: string, options?: IngestOptions): Promise<IngestResult>;
|
|
49
|
+
private getBrowser;
|
|
50
|
+
/** Close the reused browser, if one was launched. No-op otherwise. */
|
|
51
|
+
close(): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,MAAM,EACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAA2B,KAAK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OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;YAI7D,UAAU;IAKxB,sEAAsE;IAChE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAO7B"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { fetchUrl, launchBrowser } from "@x12i/fetcher";
|
|
2
|
+
import { ingestRepository } from "@x12i/ingest";
|
|
3
|
+
import { createDefaultRegistry } from "./registry.js";
|
|
4
|
+
/**
|
|
5
|
+
* Per-site fetch defaults so client-rendered pages actually populate before
|
|
6
|
+
* we snapshot HTML. Caller-supplied options still win (spread after this).
|
|
7
|
+
*/
|
|
8
|
+
function siteFetchDefaults(url) {
|
|
9
|
+
try {
|
|
10
|
+
const parsed = new URL(url);
|
|
11
|
+
const host = parsed.hostname;
|
|
12
|
+
const path = parsed.pathname;
|
|
13
|
+
if ((host === "openrouter.ai" || host.endsWith(".openrouter.ai")) &&
|
|
14
|
+
(path === "/rankings" || path.startsWith("/rankings/"))) {
|
|
15
|
+
return {
|
|
16
|
+
// Live leaderboard rows are CSS-grid divs, not <table>s.
|
|
17
|
+
waitForSelector: "div.grid.grid-cols-12.items-center",
|
|
18
|
+
settleMs: 500,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if ((host === "linkedin.com" || host === "www.linkedin.com" || host.endsWith(".linkedin.com")) &&
|
|
22
|
+
path.startsWith("/company/")) {
|
|
23
|
+
return { waitForSelector: "h1", settleMs: 1000 };
|
|
24
|
+
}
|
|
25
|
+
if (host === "medium.com" ||
|
|
26
|
+
host.endsWith(".medium.com") ||
|
|
27
|
+
host === "towardsdatascience.com") {
|
|
28
|
+
return { waitForSelector: "article h1, h1", settleMs: 800 };
|
|
29
|
+
}
|
|
30
|
+
if (host === "g2.com" || host === "www.g2.com" || host.endsWith(".g2.com")) {
|
|
31
|
+
// G2 often serves a bot-challenge with no product <h1>; don't hard-wait.
|
|
32
|
+
return { settleMs: 1500 };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// ignore unparseable URLs
|
|
37
|
+
}
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The single entry point every other package (CLI, REST API, MCP server)
|
|
42
|
+
* wraps: download a URL to Markdown, and/or classify+parse it into typed
|
|
43
|
+
* JSON using the registered parsers.
|
|
44
|
+
*/
|
|
45
|
+
export class WebAgentClient {
|
|
46
|
+
registry;
|
|
47
|
+
defaultFetchOptions;
|
|
48
|
+
reuseBrowser;
|
|
49
|
+
browserPromise;
|
|
50
|
+
constructor(options = {}) {
|
|
51
|
+
this.registry = options.registry ?? createDefaultRegistry();
|
|
52
|
+
this.defaultFetchOptions = options.fetchOptions ?? {};
|
|
53
|
+
this.reuseBrowser = options.reuseBrowser ?? false;
|
|
54
|
+
}
|
|
55
|
+
/** Register an additional parser on this client's registry. */
|
|
56
|
+
use(parser) {
|
|
57
|
+
this.registry.register(parser);
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
/** Download a URL and return { url, html, markdown, ... }. */
|
|
61
|
+
async fetch(url, options = {}) {
|
|
62
|
+
const browser = this.reuseBrowser ? await this.getBrowser() : undefined;
|
|
63
|
+
return fetchUrl(url, {
|
|
64
|
+
...this.defaultFetchOptions,
|
|
65
|
+
...siteFetchDefaults(url),
|
|
66
|
+
...options,
|
|
67
|
+
browser: browser ?? options.browser,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/** Fetch a URL, then rank every registered parser's fit without running parse(). */
|
|
71
|
+
async classify(url, options = {}) {
|
|
72
|
+
const fetched = await this.fetch(url, options);
|
|
73
|
+
return this.registry.classify(fetched);
|
|
74
|
+
}
|
|
75
|
+
/** Fetch a URL, classify it, and parse it with the best-fit parser. */
|
|
76
|
+
async parse(url, options = {}) {
|
|
77
|
+
const fetched = await this.fetch(url, options);
|
|
78
|
+
return this.registry.parse(fetched);
|
|
79
|
+
}
|
|
80
|
+
/** Fetch a URL and force a specific parser by type id, skipping classification. */
|
|
81
|
+
async parseAs(type, url, options = {}) {
|
|
82
|
+
const fetched = await this.fetch(url, options);
|
|
83
|
+
return this.registry.parseAs(type, fetched);
|
|
84
|
+
}
|
|
85
|
+
/** List every registered parser's type id + description. */
|
|
86
|
+
listParsers() {
|
|
87
|
+
return this.registry.list();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Ingest a curated list / README URL: follow outbound GitHub skill links
|
|
91
|
+
* one level deep and extract targeted files (SKILL.md, .md, .sh, …).
|
|
92
|
+
* Uses GitHub raw/API — not Playwright.
|
|
93
|
+
*/
|
|
94
|
+
ingest(rootUrl, options = {}) {
|
|
95
|
+
return ingestRepository(rootUrl, options);
|
|
96
|
+
}
|
|
97
|
+
async getBrowser() {
|
|
98
|
+
this.browserPromise ??= launchBrowser(this.defaultFetchOptions.executablePath);
|
|
99
|
+
return this.browserPromise;
|
|
100
|
+
}
|
|
101
|
+
/** Close the reused browser, if one was launched. No-op otherwise. */
|
|
102
|
+
async close() {
|
|
103
|
+
if (this.browserPromise) {
|
|
104
|
+
const browser = await this.browserPromise;
|
|
105
|
+
await browser.close();
|
|
106
|
+
this.browserPromise = undefined;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAqB,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAyC,MAAM,cAAc,CAAC;AAEvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD;;;GAGG;AACH,SAAS,iBAAiB,CAAC,GAAW;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAA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,CAAC,CAAC;IACzC,CAAC;IAED,mFAAmF;IACnF,KAAK,CAAC,OAAO,CAAc,IAAY,EAAE,GAAW,EAAE,UAAwB,EAAE;QAC9E,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAI,IAAI,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,4DAA4D;IAC5D,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAe,EAAE,UAAyB,EAAE;QACjD,OAAO,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAEO,KAAK,CAAC,UAAU;QACtB,IAAI,CAAC,cAAc,KAAK,aAAa,CAAC,IAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;QAC/E,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,sEAAsE;IACtE,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC;YAC1C,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;YACtB,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAClC,CAAC;IACH,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./client.js";
|
|
2
|
+
export * from "./registry.js";
|
|
3
|
+
export * from "@x12i/core";
|
|
4
|
+
export type { FetchOptions } from "@x12i/fetcher";
|
|
5
|
+
export type { IngestOptions, IngestResult, IngestedAsset, ExtractedFile, IngestProgressEvent, } from "@x12i/ingest";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,YAAY,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,mBAAmB,GACpB,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ParserRegistry } from "@x12i/core";
|
|
2
|
+
/**
|
|
3
|
+
* A ParserRegistry pre-loaded with every first-party parser this monorepo
|
|
4
|
+
* ships. Add new site parsers here as they're built — this is the one
|
|
5
|
+
* place the CLI/API/MCP all pull their default parser set from.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createDefaultRegistry(): ParserRegistry;
|
|
8
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQ5C;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,cAAc,CAOtD"}
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ParserRegistry } from "@x12i/core";
|
|
2
|
+
import { openRouterRankingsParser } from "@x12i/parser-openrouter";
|
|
3
|
+
import { g2ProductParser, linkedInCompanyParser, mediumArticleParser, } from "@x12i/parsers-web";
|
|
4
|
+
/**
|
|
5
|
+
* A ParserRegistry pre-loaded with every first-party parser this monorepo
|
|
6
|
+
* ships. Add new site parsers here as they're built — this is the one
|
|
7
|
+
* place the CLI/API/MCP all pull their default parser set from.
|
|
8
|
+
*/
|
|
9
|
+
export function createDefaultRegistry() {
|
|
10
|
+
return new ParserRegistry().registerAll([
|
|
11
|
+
openRouterRankingsParser,
|
|
12
|
+
g2ProductParser,
|
|
13
|
+
linkedInCompanyParser,
|
|
14
|
+
mediumArticleParser,
|
|
15
|
+
]);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,IAAI,cAAc,EAAE,CAAC,WAAW,CAAC;QACtC,wBAAwB;QACxB,eAAe;QACf,qBAAqB;QACrB,mBAAmB;KACpB,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@x12i/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Programmatic client: fetch(url) -> Markdown, parse(url) -> typed JSON via the parser registry. What the CLI, REST API, and MCP server are all thin wrappers around.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"playwright": "^1.49.1",
|
|
16
|
+
"@x12i/core": "0.1.0",
|
|
17
|
+
"@x12i/parser-openrouter": "0.1.0",
|
|
18
|
+
"@x12i/ingest": "0.1.0",
|
|
19
|
+
"@x12i/fetcher": "0.1.0",
|
|
20
|
+
"@x12i/parsers-web": "0.1.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"typescript": "^5.7.3",
|
|
24
|
+
"vitest": "^2.1.8"
|
|
25
|
+
},
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"registry": "https://registry.npmjs.org/"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/x12i/web-agentic-tools.git",
|
|
37
|
+
"directory": "packages/sdk"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/x12i/web-agentic-tools#readme",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/x12i/web-agentic-tools/issues"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -p tsconfig.json",
|
|
45
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
46
|
+
"test": "vitest run --passWithNoTests",
|
|
47
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
48
|
+
"clean": "rm -rf dist .turbo"
|
|
49
|
+
}
|
|
50
|
+
}
|