ampcode-connector 0.1.10 → 0.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ampcode-connector",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Proxy AmpCode through local OAuth subscriptions (Claude Code, Codex, Gemini CLI, Antigravity)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -42,13 +42,15 @@
42
42
  "devDependencies": {
43
43
  "@biomejs/biome": "^2.4.2",
44
44
  "@google/genai": "^1.42.0",
45
- "@types/bun": "^1.3.9"
45
+ "@types/bun": "^1.3.9",
46
+ "@types/turndown": "^5.0.6"
46
47
  },
47
48
  "peerDependencies": {
48
49
  "typescript": "^5.9.3"
49
50
  },
50
51
  "dependencies": {
51
- "@kreuzberg/html-to-markdown": "^2.25.1",
52
- "exa-js": "^2.4.0"
52
+ "exa-js": "^2.4.0",
53
+ "turndown": "^7.2.2",
54
+ "turndown-plugin-gfm": "^1.0.2"
53
55
  }
54
56
  }
@@ -1,6 +1,7 @@
1
1
  /** Local handler for extractWebPageContent — fetches a URL, converts to Markdown, ranks by objective. */
2
2
 
3
- import { convert, JsPreprocessingPreset } from "@kreuzberg/html-to-markdown";
3
+ import TurndownService from "turndown";
4
+ import { gfm } from "turndown-plugin-gfm";
4
5
  import { logger } from "../utils/logger.ts";
5
6
 
6
7
  interface WebReadParams {
@@ -55,10 +56,9 @@ const CLIPPING = {
55
56
  EXCERPT_SEP_BYTES: 2, // "\n\n" separator
56
57
  } as const;
57
58
 
58
- const HTML_OPTIONS = {
59
- skipImages: true,
60
- preprocessing: { enabled: true, preset: JsPreprocessingPreset.Aggressive },
61
- };
59
+ const turndown = new TurndownService({ headingStyle: "atx", codeBlockStyle: "fenced" });
60
+ turndown.use(gfm);
61
+ turndown.remove(["script", "style", "img"]);
62
62
 
63
63
  // biome-ignore format: compact
64
64
  const STOP_WORDS = new Set(
@@ -141,7 +141,7 @@ function fetchError(message: string): FetchErr {
141
141
 
142
142
  function convertToMarkdown(raw: string, contentType: string): string {
143
143
  if (contentType.includes("text/html") || contentType.includes("application/xhtml")) {
144
- return convert(raw, HTML_OPTIONS);
144
+ return turndown.turndown(raw);
145
145
  }
146
146
 
147
147
  if (contentType.includes("application/json")) {
@@ -0,0 +1,8 @@
1
+ declare module "turndown-plugin-gfm" {
2
+ import type TurndownService from "turndown";
3
+ export function gfm(service: TurndownService): void;
4
+ export function tables(service: TurndownService): void;
5
+ export function strikethrough(service: TurndownService): void;
6
+ export function taskListItems(service: TurndownService): void;
7
+ export function highlightedCodeBlock(service: TurndownService): void;
8
+ }