@wenathlan/saddle 1.8.8 → 1.8.9
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 +15 -15
- package/dist/adapters/forge.d.ts +17 -0
- package/dist/adapters/forge.d.ts.map +1 -0
- package/dist/adapters/forge.js +19 -0
- package/dist/adapters/forge.js.map +1 -0
- package/dist/adapters/forgejo.d.ts +49 -0
- package/dist/adapters/forgejo.d.ts.map +1 -0
- package/{adapters → dist/adapters}/forgejo.js +1 -1
- package/dist/adapters/forgejo.js.map +1 -0
- package/dist/adapters/github.d.ts +12 -0
- package/dist/adapters/github.d.ts.map +1 -0
- package/dist/adapters/github.js +20 -0
- package/dist/adapters/github.js.map +1 -0
- package/dist/adapters/gitlab.d.ts +17 -0
- package/dist/adapters/gitlab.d.ts.map +1 -0
- package/dist/adapters/gitlab.js +10 -0
- package/dist/adapters/gitlab.js.map +1 -0
- package/dist/adapters/huggingface.d.ts +17 -0
- package/dist/adapters/huggingface.d.ts.map +1 -0
- package/{adapters → dist/adapters}/huggingface.js +1 -1
- package/dist/adapters/huggingface.js.map +1 -0
- package/dist/adapters/socket.d.ts +11 -0
- package/dist/adapters/socket.d.ts.map +1 -0
- package/dist/adapters/socket.js +17 -0
- package/dist/adapters/socket.js.map +1 -0
- package/dist/adapters/transport.d.ts +7 -0
- package/dist/adapters/transport.d.ts.map +1 -0
- package/dist/adapters/transport.js +36 -0
- package/dist/adapters/transport.js.map +1 -0
- package/dist/ai/chunk.d.ts +2 -0
- package/dist/ai/chunk.d.ts.map +1 -0
- package/dist/ai/chunk.js +36 -0
- package/dist/ai/chunk.js.map +1 -0
- package/dist/ai/llmstxt.d.ts +6 -0
- package/dist/ai/llmstxt.d.ts.map +1 -0
- package/dist/ai/llmstxt.js +12 -0
- package/dist/ai/llmstxt.js.map +1 -0
- package/dist/ai/provenance.d.ts +22 -0
- package/dist/ai/provenance.d.ts.map +1 -0
- package/dist/ai/provenance.js +25 -0
- package/dist/ai/provenance.js.map +1 -0
- package/dist/ai/rag.d.ts +26 -0
- package/dist/ai/rag.d.ts.map +1 -0
- package/dist/ai/rag.js +22 -0
- package/dist/ai/rag.js.map +1 -0
- package/dist/ai/tokens.d.ts +15 -0
- package/dist/ai/tokens.d.ts.map +1 -0
- package/{ai → dist/ai}/tokens.js +1 -1
- package/dist/ai/tokens.js.map +1 -0
- package/dist/api/auth.d.ts +16 -0
- package/dist/api/auth.d.ts.map +1 -0
- package/dist/api/auth.js +19 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/api/contracts.d.ts +28 -0
- package/dist/api/contracts.d.ts.map +1 -0
- package/{api → dist/api}/contracts.js +3 -6
- package/dist/api/contracts.js.map +1 -0
- package/dist/api/control.d.ts +10 -0
- package/dist/api/control.d.ts.map +1 -0
- package/dist/api/control.js +35 -0
- package/dist/api/control.js.map +1 -0
- package/dist/api/http.d.ts +7 -0
- package/dist/api/http.d.ts.map +1 -0
- package/{api → dist/api}/http.js +5 -5
- package/dist/api/http.js.map +1 -0
- package/dist/api/rate.d.ts +28 -0
- package/dist/api/rate.d.ts.map +1 -0
- package/dist/api/rate.js +36 -0
- package/dist/api/rate.js.map +1 -0
- package/dist/api/security.d.ts +12 -0
- package/dist/api/security.d.ts.map +1 -0
- package/dist/api/security.js +56 -0
- package/dist/api/security.js.map +1 -0
- package/dist/api/service.d.ts +5 -0
- package/dist/api/service.d.ts.map +1 -0
- package/dist/api/service.js +70 -0
- package/dist/api/service.js.map +1 -0
- package/dist/apps/registry.d.ts +33 -0
- package/dist/apps/registry.d.ts.map +1 -0
- package/dist/apps/registry.js +24 -0
- package/dist/apps/registry.js.map +1 -0
- package/dist/binary/build.d.ts +29 -0
- package/dist/binary/build.d.ts.map +1 -0
- package/dist/binary/build.js +17 -0
- package/dist/binary/build.js.map +1 -0
- package/dist/bot/adapter.d.ts +5 -0
- package/dist/bot/adapter.d.ts.map +1 -0
- package/dist/bot/adapter.js +11 -0
- package/dist/bot/adapter.js.map +1 -0
- package/dist/bot/bot.d.ts +28 -0
- package/dist/bot/bot.d.ts.map +1 -0
- package/dist/bot/bot.js +52 -0
- package/dist/bot/bot.js.map +1 -0
- package/dist/bot/commands.d.ts +8 -0
- package/dist/bot/commands.d.ts.map +1 -0
- package/dist/bot/commands.js +19 -0
- package/dist/bot/commands.js.map +1 -0
- package/dist/bot/permissions.d.ts +13 -0
- package/dist/bot/permissions.d.ts.map +1 -0
- package/dist/bot/permissions.js +16 -0
- package/dist/bot/permissions.js.map +1 -0
- package/dist/browser/actions.d.ts +33 -0
- package/dist/browser/actions.d.ts.map +1 -0
- package/dist/browser/actions.js +44 -0
- package/dist/browser/actions.js.map +1 -0
- package/dist/browser/agent.d.ts +21 -0
- package/dist/browser/agent.d.ts.map +1 -0
- package/dist/browser/agent.js +13 -0
- package/dist/browser/agent.js.map +1 -0
- package/dist/browser/context.d.ts +43 -0
- package/dist/browser/context.d.ts.map +1 -0
- package/dist/browser/context.js +54 -0
- package/dist/browser/context.js.map +1 -0
- package/dist/browser/fingerprint.d.ts +4 -0
- package/dist/browser/fingerprint.d.ts.map +1 -0
- package/{browser → dist/browser}/fingerprint.js +4 -4
- package/dist/browser/fingerprint.js.map +1 -0
- package/dist/browser/index.d.ts +11 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/{browser → dist/browser}/index.js +1 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/playwright.d.ts +11 -0
- package/dist/browser/playwright.d.ts.map +1 -0
- package/dist/browser/playwright.js +24 -0
- package/dist/browser/playwright.js.map +1 -0
- package/dist/browser/recorder.d.ts +27 -0
- package/dist/browser/recorder.d.ts.map +1 -0
- package/dist/browser/recorder.js +22 -0
- package/dist/browser/recorder.js.map +1 -0
- package/dist/browser/session.d.ts +14 -0
- package/dist/browser/session.d.ts.map +1 -0
- package/dist/browser/session.js +21 -0
- package/dist/browser/session.js.map +1 -0
- package/dist/browser/snapshot.d.ts +57 -0
- package/dist/browser/snapshot.d.ts.map +1 -0
- package/dist/browser/snapshot.js +57 -0
- package/dist/browser/snapshot.js.map +1 -0
- package/dist/captcha/contract.d.ts +35 -0
- package/dist/captcha/contract.d.ts.map +1 -0
- package/dist/captcha/contract.js +17 -0
- package/dist/captcha/contract.js.map +1 -0
- package/dist/captcha/evidence.d.ts +10 -0
- package/dist/captcha/evidence.d.ts.map +1 -0
- package/dist/captcha/evidence.js +9 -0
- package/dist/captcha/evidence.js.map +1 -0
- package/dist/captcha/guard.d.ts +23 -0
- package/dist/captcha/guard.d.ts.map +1 -0
- package/dist/captcha/guard.js +12 -0
- package/dist/captcha/guard.js.map +1 -0
- package/dist/cli/main.d.ts +4 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +46 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/core/errors.d.ts +84 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +54 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/events.d.ts +9 -0
- package/dist/core/events.d.ts.map +1 -0
- package/dist/core/events.js +21 -0
- package/dist/core/events.js.map +1 -0
- package/dist/core/hash.d.ts +10 -0
- package/dist/core/hash.d.ts.map +1 -0
- package/dist/core/hash.js +82 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/ids.d.ts +10 -0
- package/dist/core/ids.d.ts.map +1 -0
- package/dist/core/ids.js +15 -0
- package/dist/core/ids.js.map +1 -0
- package/dist/deploy/index.d.ts +6 -0
- package/dist/deploy/index.d.ts.map +1 -0
- package/dist/deploy/index.js +6 -0
- package/dist/deploy/index.js.map +1 -0
- package/dist/dispatch/resumable.d.ts +85 -0
- package/dist/dispatch/resumable.d.ts.map +1 -0
- package/dist/dispatch/resumable.js +39 -0
- package/dist/dispatch/resumable.js.map +1 -0
- package/dist/dispatch/workflow.d.ts +6 -0
- package/dist/dispatch/workflow.d.ts.map +1 -0
- package/dist/dispatch/workflow.js +37 -0
- package/dist/dispatch/workflow.js.map +1 -0
- package/dist/domain/artifacts.d.ts +12 -0
- package/dist/domain/artifacts.d.ts.map +1 -0
- package/dist/domain/artifacts.js +14 -0
- package/dist/domain/artifacts.js.map +1 -0
- package/dist/domain/jobs.d.ts +12 -0
- package/dist/domain/jobs.d.ts.map +1 -0
- package/dist/domain/jobs.js +20 -0
- package/dist/domain/jobs.js.map +1 -0
- package/dist/domain/providers.d.ts +10 -0
- package/dist/domain/providers.d.ts.map +1 -0
- package/{domain → dist/domain}/providers.js +2 -2
- package/dist/domain/providers.js.map +1 -0
- package/dist/domain/runtime.d.ts +14 -0
- package/dist/domain/runtime.d.ts.map +1 -0
- package/{domain → dist/domain}/runtime.js +3 -3
- package/dist/domain/runtime.js.map +1 -0
- package/dist/domain/sessions.d.ts +12 -0
- package/dist/domain/sessions.d.ts.map +1 -0
- package/dist/domain/sessions.js +57 -0
- package/dist/domain/sessions.js.map +1 -0
- package/dist/examples/localjob.d.ts +2 -0
- package/dist/examples/localjob.d.ts.map +1 -0
- package/{examples → dist/examples}/localjob.js +1 -1
- package/dist/examples/localjob.js.map +1 -0
- package/dist/examples/publicapi.d.ts +2 -0
- package/dist/examples/publicapi.d.ts.map +1 -0
- package/{examples → dist/examples}/publicapi.js +1 -1
- package/dist/examples/publicapi.js.map +1 -0
- package/dist/extension/build.d.ts +9 -0
- package/dist/extension/build.d.ts.map +1 -0
- package/dist/extension/build.js +61 -0
- package/dist/extension/build.js.map +1 -0
- package/dist/extension/content.d.ts +6 -0
- package/dist/extension/content.d.ts.map +1 -0
- package/dist/extension/content.js +135 -0
- package/dist/extension/content.js.map +1 -0
- package/dist/extension/index.d.ts +7 -0
- package/dist/extension/index.d.ts.map +1 -0
- package/{extension → dist/extension}/index.js +1 -0
- package/dist/extension/index.js.map +1 -0
- package/dist/extension/pagebridge.d.ts +6 -0
- package/dist/extension/pagebridge.d.ts.map +1 -0
- package/dist/extension/pagebridge.js +42 -0
- package/dist/extension/pagebridge.js.map +1 -0
- package/dist/extension/permissions.d.ts +26 -0
- package/dist/extension/permissions.d.ts.map +1 -0
- package/dist/extension/permissions.js +28 -0
- package/dist/extension/permissions.js.map +1 -0
- package/dist/extension/popup.d.ts +5 -0
- package/dist/extension/popup.d.ts.map +1 -0
- package/dist/extension/popup.js +26 -0
- package/dist/extension/popup.js.map +1 -0
- package/dist/extension/protocol.d.ts +58 -0
- package/dist/extension/protocol.d.ts.map +1 -0
- package/dist/extension/protocol.js +101 -0
- package/dist/extension/protocol.js.map +1 -0
- package/dist/extension/serviceworker.d.ts +25 -0
- package/dist/extension/serviceworker.d.ts.map +1 -0
- package/dist/extension/serviceworker.js +102 -0
- package/dist/extension/serviceworker.js.map +1 -0
- package/dist/extension/worker.d.ts +28 -0
- package/dist/extension/worker.d.ts.map +1 -0
- package/dist/extension/worker.js +22 -0
- package/dist/extension/worker.js.map +1 -0
- package/dist/format/check.d.ts +8 -0
- package/dist/format/check.d.ts.map +1 -0
- package/dist/format/check.js +38 -0
- package/dist/format/check.js.map +1 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.d.ts.map +1 -0
- package/{index.js → dist/index.js} +1 -0
- package/dist/index.js.map +1 -0
- package/dist/library/public.d.ts +53 -0
- package/dist/library/public.d.ts.map +1 -0
- package/dist/library/public.js +83 -0
- package/dist/library/public.js.map +1 -0
- package/dist/mcp/browser.d.ts +9 -0
- package/dist/mcp/browser.d.ts.map +1 -0
- package/dist/mcp/browser.js +13 -0
- package/dist/mcp/browser.js.map +1 -0
- package/dist/mcp/server.d.ts +35 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +40 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/transport.d.ts +7 -0
- package/dist/mcp/transport.d.ts.map +1 -0
- package/dist/mcp/transport.js +17 -0
- package/dist/mcp/transport.js.map +1 -0
- package/dist/memory/bridge.d.ts +14 -0
- package/dist/memory/bridge.d.ts.map +1 -0
- package/dist/memory/bridge.js +16 -0
- package/dist/memory/bridge.js.map +1 -0
- package/dist/memory/engine.d.ts +28 -0
- package/dist/memory/engine.d.ts.map +1 -0
- package/dist/memory/engine.js +59 -0
- package/dist/memory/engine.js.map +1 -0
- package/dist/memory/modes.d.ts +43 -0
- package/dist/memory/modes.d.ts.map +1 -0
- package/dist/memory/modes.js +66 -0
- package/dist/memory/modes.js.map +1 -0
- package/dist/memory/objects.d.ts +21 -0
- package/dist/memory/objects.d.ts.map +1 -0
- package/dist/memory/objects.js +20 -0
- package/dist/memory/objects.js.map +1 -0
- package/dist/memory/targets.d.ts +78 -0
- package/dist/memory/targets.d.ts.map +1 -0
- package/dist/memory/targets.js +29 -0
- package/dist/memory/targets.js.map +1 -0
- package/dist/memory/transforms.d.ts +19 -0
- package/dist/memory/transforms.d.ts.map +1 -0
- package/dist/memory/transforms.js +14 -0
- package/dist/memory/transforms.js.map +1 -0
- package/dist/modes/matrix.d.ts +23 -0
- package/dist/modes/matrix.d.ts.map +1 -0
- package/{modes → dist/modes}/matrix.js +8 -10
- package/dist/modes/matrix.js.map +1 -0
- package/dist/modes/modes.d.ts +33 -0
- package/dist/modes/modes.d.ts.map +1 -0
- package/{modes → dist/modes}/modes.js +3 -4
- package/dist/modes/modes.js.map +1 -0
- package/dist/modes/resolve.d.ts +41 -0
- package/dist/modes/resolve.d.ts.map +1 -0
- package/dist/modes/resolve.js +39 -0
- package/dist/modes/resolve.js.map +1 -0
- package/dist/observability/metrics.d.ts +14 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +18 -0
- package/dist/observability/metrics.js.map +1 -0
- package/dist/packager/manifest.d.ts +49 -0
- package/dist/packager/manifest.d.ts.map +1 -0
- package/dist/packager/manifest.js +49 -0
- package/dist/packager/manifest.js.map +1 -0
- package/dist/packager/publish.d.ts +51 -0
- package/dist/packager/publish.d.ts.map +1 -0
- package/dist/packager/publish.js +18 -0
- package/dist/packager/publish.js.map +1 -0
- package/dist/packager/targetcli.d.ts +7 -0
- package/dist/packager/targetcli.d.ts.map +1 -0
- package/dist/packager/targetcli.js +22 -0
- package/dist/packager/targetcli.js.map +1 -0
- package/dist/persistence/adapter.d.ts +5 -0
- package/dist/persistence/adapter.d.ts.map +1 -0
- package/dist/persistence/adapter.js +11 -0
- package/dist/persistence/adapter.js.map +1 -0
- package/dist/persistence/drizzle.d.ts +2 -0
- package/dist/persistence/drizzle.d.ts.map +1 -0
- package/dist/persistence/drizzle.js +12 -0
- package/dist/persistence/drizzle.js.map +1 -0
- package/dist/persistence/memory.d.ts +2 -0
- package/dist/persistence/memory.d.ts.map +1 -0
- package/dist/persistence/memory.js +27 -0
- package/dist/persistence/memory.js.map +1 -0
- package/dist/persistence/migrations.d.ts +19 -0
- package/dist/persistence/migrations.d.ts.map +1 -0
- package/{persistence → dist/persistence}/migrations.js +4 -5
- package/dist/persistence/migrations.js.map +1 -0
- package/dist/persistence/prisma.d.ts +2 -0
- package/dist/persistence/prisma.d.ts.map +1 -0
- package/dist/persistence/prisma.js +25 -0
- package/dist/persistence/prisma.js.map +1 -0
- package/dist/persistence/schema.d.ts +63 -0
- package/dist/persistence/schema.d.ts.map +1 -0
- package/dist/persistence/schema.js +28 -0
- package/dist/persistence/schema.js.map +1 -0
- package/dist/persistence/sql.d.ts +3 -0
- package/dist/persistence/sql.d.ts.map +1 -0
- package/dist/persistence/sql.js +37 -0
- package/dist/persistence/sql.js.map +1 -0
- package/dist/protocol/blocks.d.ts +10 -0
- package/dist/protocol/blocks.d.ts.map +1 -0
- package/dist/protocol/blocks.js +26 -0
- package/dist/protocol/blocks.js.map +1 -0
- package/dist/protocol/json.d.ts +6 -0
- package/dist/protocol/json.d.ts.map +1 -0
- package/{protocol → dist/protocol}/json.js +1 -0
- package/dist/protocol/json.js.map +1 -0
- package/dist/protocol/ndjson.d.ts +3 -0
- package/dist/protocol/ndjson.d.ts.map +1 -0
- package/dist/protocol/ndjson.js +20 -0
- package/dist/protocol/ndjson.js.map +1 -0
- package/dist/protocol/sse.d.ts +7 -0
- package/dist/protocol/sse.d.ts.map +1 -0
- package/dist/protocol/sse.js +25 -0
- package/dist/protocol/sse.js.map +1 -0
- package/dist/proxy/pool.d.ts +9 -0
- package/dist/proxy/pool.d.ts.map +1 -0
- package/dist/proxy/pool.js +27 -0
- package/dist/proxy/pool.js.map +1 -0
- package/dist/queue/idempotency.d.ts +10 -0
- package/dist/queue/idempotency.d.ts.map +1 -0
- package/dist/queue/idempotency.js +13 -0
- package/dist/queue/idempotency.js.map +1 -0
- package/dist/queue/persistent.d.ts +13 -0
- package/dist/queue/persistent.d.ts.map +1 -0
- package/dist/queue/persistent.js +49 -0
- package/dist/queue/persistent.js.map +1 -0
- package/dist/queue/queue.d.ts +7 -0
- package/dist/queue/queue.d.ts.map +1 -0
- package/dist/queue/queue.js +55 -0
- package/dist/queue/queue.js.map +1 -0
- package/dist/queue/saga.d.ts +5 -0
- package/dist/queue/saga.d.ts.map +1 -0
- package/dist/queue/saga.js +20 -0
- package/dist/queue/saga.js.map +1 -0
- package/dist/release/assets.d.ts +118 -0
- package/dist/release/assets.d.ts.map +1 -0
- package/dist/release/assets.js +69 -0
- package/dist/release/assets.js.map +1 -0
- package/dist/runners/health.d.ts +36 -0
- package/dist/runners/health.d.ts.map +1 -0
- package/dist/runners/health.js +26 -0
- package/dist/runners/health.js.map +1 -0
- package/dist/runners/heartbeat.d.ts +23 -0
- package/dist/runners/heartbeat.d.ts.map +1 -0
- package/dist/runners/heartbeat.js +29 -0
- package/dist/runners/heartbeat.js.map +1 -0
- package/dist/runners/inprocess.d.ts +17 -0
- package/dist/runners/inprocess.d.ts.map +1 -0
- package/dist/runners/inprocess.js +20 -0
- package/dist/runners/inprocess.js.map +1 -0
- package/dist/runners/scheduler.d.ts +5 -0
- package/dist/runners/scheduler.d.ts.map +1 -0
- package/dist/runners/scheduler.js +19 -0
- package/dist/runners/scheduler.js.map +1 -0
- package/dist/runtime/abort.d.ts +8 -0
- package/dist/runtime/abort.d.ts.map +1 -0
- package/dist/runtime/abort.js +13 -0
- package/dist/runtime/abort.js.map +1 -0
- package/dist/runtime/compatibility.d.ts +37 -0
- package/dist/runtime/compatibility.d.ts.map +1 -0
- package/{runtime → dist/runtime}/compatibility.js +1 -4
- package/dist/runtime/compatibility.js.map +1 -0
- package/dist/runtime/detect.d.ts +13 -0
- package/dist/runtime/detect.d.ts.map +1 -0
- package/dist/runtime/detect.js +18 -0
- package/dist/runtime/detect.js.map +1 -0
- package/dist/runtime/engine.d.ts +20 -0
- package/dist/runtime/engine.d.ts.map +1 -0
- package/dist/runtime/engine.js +61 -0
- package/dist/runtime/engine.js.map +1 -0
- package/dist/runtime/retry.d.ts +19 -0
- package/dist/runtime/retry.d.ts.map +1 -0
- package/dist/runtime/retry.js +54 -0
- package/dist/runtime/retry.js.map +1 -0
- package/dist/runtime/worker.d.ts +10 -0
- package/dist/runtime/worker.d.ts.map +1 -0
- package/dist/runtime/worker.js +25 -0
- package/dist/runtime/worker.js.map +1 -0
- package/dist/scrape/cache.d.ts +45 -0
- package/dist/scrape/cache.d.ts.map +1 -0
- package/dist/scrape/cache.js +45 -0
- package/dist/scrape/cache.js.map +1 -0
- package/dist/scrape/crawl.d.ts +47 -0
- package/dist/scrape/crawl.d.ts.map +1 -0
- package/dist/scrape/crawl.js +114 -0
- package/dist/scrape/crawl.js.map +1 -0
- package/dist/scrape/extract.d.ts +63 -0
- package/dist/scrape/extract.d.ts.map +1 -0
- package/dist/scrape/extract.js +47 -0
- package/dist/scrape/extract.js.map +1 -0
- package/dist/scrape/normalize.d.ts +52 -0
- package/dist/scrape/normalize.d.ts.map +1 -0
- package/dist/scrape/normalize.js +102 -0
- package/dist/scrape/normalize.js.map +1 -0
- package/dist/scrape/robots.d.ts +37 -0
- package/dist/scrape/robots.d.ts.map +1 -0
- package/dist/scrape/robots.js +71 -0
- package/dist/scrape/robots.js.map +1 -0
- package/dist/scrape/schema.d.ts +5 -0
- package/dist/scrape/schema.d.ts.map +1 -0
- package/dist/scrape/schema.js +25 -0
- package/dist/scrape/schema.js.map +1 -0
- package/dist/scrape/scraper.d.ts +6 -0
- package/dist/scrape/scraper.d.ts.map +1 -0
- package/dist/scrape/scraper.js +46 -0
- package/dist/scrape/scraper.js.map +1 -0
- package/dist/scrape/semantic.d.ts +25 -0
- package/dist/scrape/semantic.d.ts.map +1 -0
- package/dist/scrape/semantic.js +27 -0
- package/dist/scrape/semantic.js.map +1 -0
- package/dist/server/node.d.ts +7 -0
- package/dist/server/node.d.ts.map +1 -0
- package/dist/server/node.js +38 -0
- package/dist/server/node.js.map +1 -0
- package/dist/sessions/file.d.ts +25 -0
- package/dist/sessions/file.d.ts.map +1 -0
- package/dist/sessions/file.js +13 -0
- package/dist/sessions/file.js.map +1 -0
- package/dist/sessions/replay.d.ts +9 -0
- package/dist/sessions/replay.d.ts.map +1 -0
- package/dist/sessions/replay.js +70 -0
- package/dist/sessions/replay.js.map +1 -0
- package/dist/sessions/store.d.ts +25 -0
- package/dist/sessions/store.d.ts.map +1 -0
- package/dist/sessions/store.js +13 -0
- package/dist/sessions/store.js.map +1 -0
- package/dist/storage/adapter.d.ts +5 -0
- package/dist/storage/adapter.d.ts.map +1 -0
- package/dist/storage/adapter.js +11 -0
- package/dist/storage/adapter.js.map +1 -0
- package/dist/storage/cache.d.ts +23 -0
- package/dist/storage/cache.d.ts.map +1 -0
- package/dist/storage/cache.js +79 -0
- package/dist/storage/cache.js.map +1 -0
- package/dist/storage/checksum.d.ts +3 -0
- package/dist/storage/checksum.d.ts.map +1 -0
- package/dist/storage/checksum.js +19 -0
- package/dist/storage/checksum.js.map +1 -0
- package/dist/storage/chunked.d.ts +21 -0
- package/dist/storage/chunked.d.ts.map +1 -0
- package/dist/storage/chunked.js +67 -0
- package/dist/storage/chunked.js.map +1 -0
- package/dist/storage/content.d.ts +24 -0
- package/dist/storage/content.d.ts.map +1 -0
- package/dist/storage/content.js +44 -0
- package/dist/storage/content.js.map +1 -0
- package/dist/storage/filehosting.d.ts +2 -0
- package/dist/storage/filehosting.d.ts.map +1 -0
- package/dist/storage/filehosting.js +24 -0
- package/dist/storage/filehosting.js.map +1 -0
- package/dist/storage/githubcontents.d.ts +2 -0
- package/dist/storage/githubcontents.d.ts.map +1 -0
- package/dist/storage/githubcontents.js +29 -0
- package/dist/storage/githubcontents.js.map +1 -0
- package/dist/storage/index.d.ts +11 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/{storage → dist/storage}/index.js +1 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/local.d.ts +2 -0
- package/dist/storage/local.d.ts.map +1 -0
- package/dist/storage/local.js +72 -0
- package/dist/storage/local.js.map +1 -0
- package/dist/storage/memory.d.ts +6 -0
- package/dist/storage/memory.d.ts.map +1 -0
- package/dist/storage/memory.js +36 -0
- package/dist/storage/memory.js.map +1 -0
- package/dist/storage/s3compatible.d.ts +2 -0
- package/dist/storage/s3compatible.d.ts.map +1 -0
- package/dist/storage/s3compatible.js +31 -0
- package/dist/storage/s3compatible.js.map +1 -0
- package/dist/storage/sync.d.ts +47 -0
- package/dist/storage/sync.d.ts.map +1 -0
- package/dist/storage/sync.js +75 -0
- package/dist/storage/sync.js.map +1 -0
- package/dist/surfaces/adapters.d.ts +97 -0
- package/dist/surfaces/adapters.d.ts.map +1 -0
- package/dist/surfaces/adapters.js +50 -0
- package/dist/surfaces/adapters.js.map +1 -0
- package/dist/surfaces/controls.d.ts +18 -0
- package/dist/surfaces/controls.d.ts.map +1 -0
- package/dist/surfaces/controls.js +45 -0
- package/dist/surfaces/controls.js.map +1 -0
- package/dist/surfaces/manifest.d.ts +68 -0
- package/dist/surfaces/manifest.d.ts.map +1 -0
- package/dist/surfaces/manifest.js +42 -0
- package/dist/surfaces/manifest.js.map +1 -0
- package/dist/surfaces/n8n.d.ts +25 -0
- package/dist/surfaces/n8n.d.ts.map +1 -0
- package/dist/surfaces/n8n.js +31 -0
- package/dist/surfaces/n8n.js.map +1 -0
- package/dist/surfaces/operations.d.ts +32 -0
- package/dist/surfaces/operations.d.ts.map +1 -0
- package/dist/surfaces/operations.js +53 -0
- package/dist/surfaces/operations.js.map +1 -0
- package/dist/surfaces/targets.d.ts +196 -0
- package/dist/surfaces/targets.d.ts.map +1 -0
- package/dist/surfaces/targets.js +27 -0
- package/dist/surfaces/targets.js.map +1 -0
- package/dist/webhook/delivery.d.ts +18 -0
- package/dist/webhook/delivery.d.ts.map +1 -0
- package/dist/webhook/delivery.js +36 -0
- package/dist/webhook/delivery.js.map +1 -0
- package/dist/webhook/receiver.d.ts +26 -0
- package/dist/webhook/receiver.d.ts.map +1 -0
- package/dist/webhook/receiver.js +24 -0
- package/dist/webhook/receiver.js.map +1 -0
- package/dist/webhook/signature.d.ts +3 -0
- package/dist/webhook/signature.d.ts.map +1 -0
- package/{webhook → dist/webhook}/signature.js +1 -1
- package/dist/webhook/signature.js.map +1 -0
- package/dist/workflow/manifest.d.ts +21 -0
- package/dist/workflow/manifest.d.ts.map +1 -0
- package/dist/workflow/manifest.js +20 -0
- package/dist/workflow/manifest.js.map +1 -0
- package/dist/workflow/registry.d.ts +7 -0
- package/dist/workflow/registry.d.ts.map +1 -0
- package/dist/workflow/registry.js +18 -0
- package/dist/workflow/registry.js.map +1 -0
- package/dist/workflow/templates.d.ts +6 -0
- package/dist/workflow/templates.d.ts.map +1 -0
- package/dist/workflow/templates.js +18 -0
- package/dist/workflow/templates.js.map +1 -0
- package/dist/workflow/triggers.d.ts +36 -0
- package/dist/workflow/triggers.d.ts.map +1 -0
- package/dist/workflow/triggers.js +33 -0
- package/dist/workflow/triggers.js.map +1 -0
- package/docs/enginearchitecture.md +2 -2
- package/docs/gapmatrix.md +2 -2
- package/docs/libraryapi.md +1 -1
- package/docs/release.md +5 -5
- package/docs/releaseassets.md +1 -1
- package/docs/reorganization-1.8.9.md +28 -0
- package/docs/toolchainresearch-1.8.9.md +18 -0
- package/extension/manifest.json +1 -1
- package/package.json +61 -88
- package/adapters/forge.js +0 -16
- package/adapters/github.js +0 -19
- package/adapters/gitlab.js +0 -10
- package/adapters/socket.js +0 -14
- package/adapters/transport.js +0 -30
- package/ai/chunk.js +0 -22
- package/ai/llmstxt.js +0 -12
- package/ai/provenance.js +0 -18
- package/ai/rag.js +0 -14
- package/api/auth.js +0 -13
- package/api/control.js +0 -33
- package/api/rate.js +0 -31
- package/api/security.js +0 -42
- package/api/service.js +0 -36
- package/binary/build.js +0 -17
- package/bot/adapter.js +0 -8
- package/bot/bot.js +0 -39
- package/bot/commands.js +0 -18
- package/bot/permissions.js +0 -16
- package/browser/actions.js +0 -33
- package/browser/agent.js +0 -9
- package/browser/context.js +0 -52
- package/browser/playwright.js +0 -22
- package/browser/recorder.js +0 -21
- package/browser/session.js +0 -19
- package/browser/snapshot.js +0 -57
- package/captcha/contract.js +0 -15
- package/captcha/evidence.js +0 -9
- package/captcha/guard.js +0 -10
- package/cli/main.js +0 -36
- package/core/errors.js +0 -57
- package/core/events.js +0 -21
- package/core/hash.js +0 -73
- package/core/ids.js +0 -15
- package/dispatch/resumable.js +0 -31
- package/dispatch/workflow.js +0 -33
- package/domain/artifacts.js +0 -13
- package/domain/jobs.js +0 -20
- package/domain/sessions.js +0 -46
- package/extension/build.js +0 -46
- package/extension/content.js +0 -127
- package/extension/pagebridge.js +0 -41
- package/extension/permissions.js +0 -22
- package/extension/popup.css +0 -13
- package/extension/popup.html +0 -24
- package/extension/popup.js +0 -25
- package/extension/protocol.js +0 -95
- package/extension/serviceworker.js +0 -109
- package/extension/worker.js +0 -22
- package/format/check.js +0 -21
- package/library/public.js +0 -85
- package/mcp/browser.js +0 -12
- package/mcp/server.js +0 -28
- package/mcp/transport.js +0 -14
- package/memory/bridge.js +0 -16
- package/memory/engine.js +0 -45
- package/memory/modes.js +0 -55
- package/memory/objects.js +0 -18
- package/memory/targets.js +0 -21
- package/memory/transforms.js +0 -15
- package/modes/resolve.js +0 -39
- package/packager/manifest.js +0 -28
- package/packager/publish.js +0 -15
- package/persistence/adapter.js +0 -8
- package/persistence/drizzle.js +0 -10
- package/persistence/memory.js +0 -26
- package/persistence/prisma.js +0 -23
- package/persistence/schema.js +0 -29
- package/persistence/sql.js +0 -30
- package/protocol/blocks.js +0 -18
- package/protocol/ndjson.js +0 -17
- package/protocol/sse.js +0 -22
- package/proxy/pool.js +0 -12
- package/queue/idempotency.js +0 -12
- package/queue/persistent.js +0 -44
- package/queue/queue.js +0 -50
- package/queue/saga.js +0 -13
- package/release/assets.js +0 -70
- package/runners/health.js +0 -23
- package/runners/heartbeat.js +0 -26
- package/runners/inprocess.js +0 -19
- package/runners/scheduler.js +0 -16
- package/runtime/abort.js +0 -10
- package/runtime/detect.js +0 -14
- package/runtime/engine.js +0 -56
- package/runtime/retry.js +0 -27
- package/runtime/worker.js +0 -18
- package/scrape/agent.ts +0 -122
- package/scrape/batch.ts +0 -79
- package/scrape/biome.json +0 -76
- package/scrape/browser.ts +0 -222
- package/scrape/cache.js +0 -14
- package/scrape/cache.ts +0 -84
- package/scrape/chunking.ts +0 -193
- package/scrape/cli.ts +0 -105
- package/scrape/crawl.js +0 -104
- package/scrape/crawler.ts +0 -115
- package/scrape/dev-server.ts +0 -94
- package/scrape/errors.ts +0 -132
- package/scrape/events.ts +0 -26
- package/scrape/extract.js +0 -14
- package/scrape/extract.ts +0 -165
- package/scrape/fetch.ts +0 -105
- package/scrape/formats.ts +0 -85
- package/scrape/headers.ts +0 -71
- package/scrape/index.ts +0 -92
- package/scrape/jsdom.d.ts +0 -6
- package/scrape/llms-txt.ts +0 -84
- package/scrape/middleware.ts +0 -90
- package/scrape/normalize.js +0 -86
- package/scrape/pool.ts +0 -95
- package/scrape/port.ts +0 -18
- package/scrape/proxy.ts +0 -103
- package/scrape/rate-limiter.ts +0 -95
- package/scrape/renderer.ts +0 -194
- package/scrape/retry.ts +0 -64
- package/scrape/robots.js +0 -32
- package/scrape/robots.ts +0 -137
- package/scrape/schema.js +0 -21
- package/scrape/scrape.ts +0 -123
- package/scrape/scraper.js +0 -40
- package/scrape/semantic.js +0 -22
- package/scrape/serialize.ts +0 -310
- package/scrape/server.ts +0 -137
- package/scrape/session.ts +0 -109
- package/scrape/sitemap.ts +0 -131
- package/scrape/tokens.ts +0 -45
- package/scrape/tsconfig.json +0 -28
- package/scrape/types.ts +0 -214
- package/scrape/utils.ts +0 -77
- package/scrape/vite.config.ts +0 -55
- package/scrape/vitest.config.ts +0 -17
- package/server/node.js +0 -34
- package/sessions/file.js +0 -13
- package/sessions/replay.js +0 -61
- package/sessions/store.js +0 -13
- package/storage/adapter.js +0 -8
- package/storage/cache.js +0 -54
- package/storage/checksum.js +0 -17
- package/storage/chunked.js +0 -58
- package/storage/content.js +0 -42
- package/storage/filehosting.js +0 -17
- package/storage/githubcontents.js +0 -18
- package/storage/local.js +0 -35
- package/storage/memory.js +0 -28
- package/storage/s3compatible.js +0 -23
- package/storage/sync.js +0 -55
- package/surfaces/adapters.js +0 -48
- package/surfaces/controls.js +0 -37
- package/surfaces/manifest.js +0 -25
- package/surfaces/n8n.js +0 -24
- package/surfaces/operations.js +0 -43
- package/surfaces/targets.js +0 -16
- package/webhook/delivery.js +0 -26
- package/webhook/receiver.js +0 -20
- package/workflow/manifest.js +0 -20
- package/workflow/registry.js +0 -16
- package/workflow/templates.js +0 -18
- package/workflow/triggers.js +0 -31
package/scrape/errors.ts
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
export const ErrorCode = {
|
|
2
|
-
VALIDATION_FAILED: 'VALIDATION_FAILED',
|
|
3
|
-
INVALID_URL: 'INVALID_URL',
|
|
4
|
-
TIMEOUT: 'TIMEOUT',
|
|
5
|
-
BLOCKED: 'BLOCKED',
|
|
6
|
-
RATE_LIMITED: 'RATE_LIMITED',
|
|
7
|
-
PROXY_ERROR: 'PROXY_ERROR',
|
|
8
|
-
PARSE_ERROR: 'PARSE_ERROR',
|
|
9
|
-
AUTH_REQUIRED: 'AUTH_REQUIRED',
|
|
10
|
-
NETWORK_ERROR: 'NETWORK_ERROR',
|
|
11
|
-
BROWSER_NOT_AVAILABLE: 'BROWSER_NOT_AVAILABLE',
|
|
12
|
-
CRAWL_DEPTH_EXCEEDED: 'CRAWL_DEPTH_EXCEEDED',
|
|
13
|
-
MAX_RETRIES_EXCEEDED: 'MAX_RETRIES_EXCEEDED',
|
|
14
|
-
} as const;
|
|
15
|
-
|
|
16
|
-
export type ErrorCode = typeof ErrorCode[keyof typeof ErrorCode];
|
|
17
|
-
|
|
18
|
-
export class WebScrapeError extends Error {
|
|
19
|
-
public readonly code: ErrorCode;
|
|
20
|
-
public readonly statusCode: number;
|
|
21
|
-
public readonly isRetryable: boolean;
|
|
22
|
-
public readonly timestamp: string;
|
|
23
|
-
public readonly details?: Record<string, unknown>;
|
|
24
|
-
public readonly cause?: Error;
|
|
25
|
-
|
|
26
|
-
constructor(
|
|
27
|
-
message: string,
|
|
28
|
-
code: ErrorCode,
|
|
29
|
-
statusCode: number,
|
|
30
|
-
isRetryable: boolean,
|
|
31
|
-
details?: Record<string, unknown>,
|
|
32
|
-
cause?: Error
|
|
33
|
-
) {
|
|
34
|
-
super(message);
|
|
35
|
-
this.name = 'WebScrapeError';
|
|
36
|
-
this.code = code;
|
|
37
|
-
this.statusCode = statusCode;
|
|
38
|
-
this.isRetryable = isRetryable;
|
|
39
|
-
this.timestamp = new Date().toISOString();
|
|
40
|
-
this.details = details;
|
|
41
|
-
this.cause = cause;
|
|
42
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
43
|
-
Error.captureStackTrace?.(this, this.constructor);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
toJSON() {
|
|
47
|
-
return {
|
|
48
|
-
error: {
|
|
49
|
-
name: this.name,
|
|
50
|
-
code: this.code,
|
|
51
|
-
message: this.message,
|
|
52
|
-
statusCode: this.statusCode,
|
|
53
|
-
isRetryable: this.isRetryable,
|
|
54
|
-
timestamp: this.timestamp,
|
|
55
|
-
details: this.details,
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export class ValidationError extends WebScrapeError {
|
|
62
|
-
constructor(message: string, details?: Record<string, unknown>, cause?: Error) {
|
|
63
|
-
super(message, ErrorCode.VALIDATION_FAILED, 400, false, details, cause);
|
|
64
|
-
this.name = 'ValidationError';
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export class TimeoutError extends WebScrapeError {
|
|
69
|
-
constructor(message: string, details?: Record<string, unknown>, cause?: Error) {
|
|
70
|
-
super(message, ErrorCode.TIMEOUT, 504, true, details, cause);
|
|
71
|
-
this.name = 'TimeoutError';
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export class BlockedError extends WebScrapeError {
|
|
76
|
-
constructor(message: string, details?: Record<string, unknown>, cause?: Error) {
|
|
77
|
-
super(message, ErrorCode.BLOCKED, 403, false, details, cause);
|
|
78
|
-
this.name = 'BlockedError';
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export class RateLimitError extends WebScrapeError {
|
|
83
|
-
public readonly retryAfterMs?: number;
|
|
84
|
-
constructor(
|
|
85
|
-
message: string,
|
|
86
|
-
retryAfterMs?: number,
|
|
87
|
-
details?: Record<string, unknown>,
|
|
88
|
-
cause?: Error
|
|
89
|
-
) {
|
|
90
|
-
super(message, ErrorCode.RATE_LIMITED, 429, true, { ...details, retryAfterMs }, cause);
|
|
91
|
-
this.name = 'RateLimitError';
|
|
92
|
-
this.retryAfterMs = retryAfterMs;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export class ProxyError extends WebScrapeError {
|
|
97
|
-
constructor(message: string, details?: Record<string, unknown>, cause?: Error) {
|
|
98
|
-
super(message, ErrorCode.PROXY_ERROR, 502, true, details, cause);
|
|
99
|
-
this.name = 'ProxyError';
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export class ParseError extends WebScrapeError {
|
|
104
|
-
constructor(message: string, details?: Record<string, unknown>, cause?: Error) {
|
|
105
|
-
super(message, ErrorCode.PARSE_ERROR, 422, false, details, cause);
|
|
106
|
-
this.name = 'ParseError';
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export class AuthError extends WebScrapeError {
|
|
111
|
-
constructor(message: string, details?: Record<string, unknown>, cause?: Error) {
|
|
112
|
-
super(message, ErrorCode.AUTH_REQUIRED, 401, false, details, cause);
|
|
113
|
-
this.name = 'AuthError';
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export class NetworkError extends WebScrapeError {
|
|
118
|
-
constructor(message: string, details?: Record<string, unknown>, cause?: Error) {
|
|
119
|
-
super(message, ErrorCode.NETWORK_ERROR, 503, true, details, cause);
|
|
120
|
-
this.name = 'NetworkError';
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export class BrowserNotAvailableError extends WebScrapeError {
|
|
125
|
-
constructor(
|
|
126
|
-
message: string = 'Playwright is not installed. Install it with: npm install playwright',
|
|
127
|
-
details?: Record<string, unknown>
|
|
128
|
-
) {
|
|
129
|
-
super(message, ErrorCode.BROWSER_NOT_AVAILABLE, 500, false, details);
|
|
130
|
-
this.name = 'BrowserNotAvailableError';
|
|
131
|
-
}
|
|
132
|
-
}
|
package/scrape/events.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import Emittery from 'emittery';
|
|
2
|
-
import type { ScrapeOptions } from './types.js';
|
|
3
|
-
|
|
4
|
-
export interface WebScrapeEvents {
|
|
5
|
-
'request:start': { url: string; options: ScrapeOptions; timestamp: number };
|
|
6
|
-
'request:response': { url: string; status: number; attempt: number; duration: number };
|
|
7
|
-
'request:error': { url: string; error: Error; attempt: number };
|
|
8
|
-
'request:retry': { url: string; attempt: number; maxRetries: number; delayMs: number };
|
|
9
|
-
'request:complete': { url: string; duration: number; success: boolean };
|
|
10
|
-
'cache:hit': { key: string };
|
|
11
|
-
'cache:miss': { key: string };
|
|
12
|
-
'cache:set': { key: string; ttlMs?: number };
|
|
13
|
-
'proxy:rotate': { proxy: string; reason: string };
|
|
14
|
-
'proxy:error': { proxy: string; error: Error };
|
|
15
|
-
'proxy:disabled': { proxy: string; reason: string };
|
|
16
|
-
'crawl:discover': { url: string; depth: number; parentUrl?: string };
|
|
17
|
-
'crawl:complete': { totalUrls: number; successful: number; failed: number; duration: number };
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type EventEmitter = Emittery<WebScrapeEvents>;
|
|
21
|
-
|
|
22
|
-
export function createEventEmitter(): EventEmitter {
|
|
23
|
-
return new Emittery<WebScrapeEvents>();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const globalEmitter = createEventEmitter();
|
package/scrape/extract.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* structured first extraction uses small built in heuristics and returns serializable data.
|
|
3
|
-
*/
|
|
4
|
-
export function extracthtml(html, url) {
|
|
5
|
-
const title = match(html, /<title[^>]*>([\s\S]*?)<\/title>/i);
|
|
6
|
-
const description = match(html, /<meta[^>]+name=["']description["'][^>]+content=["']([^"']*)["']/i) ?? match(html, /<meta[^>]+content=["']([^"']*)["'][^>]+name=["']description["']/i);
|
|
7
|
-
const links = [...html.matchAll(/<a[^>]+href=["']([^"']+)["'][^>]*>/gi)].map((item) => resolveurl(item[1], url)).filter(Boolean);
|
|
8
|
-
const text = html.replace(/<script[\s\S]*?<\/script>/gi, " ").replace(/<style[\s\S]*?<\/style>/gi, " ").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
9
|
-
return { url, title: decode(title ?? ""), description: decode(description ?? ""), text, links: [...new Set(links)] };
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function match(value, expression) { return value.match(expression)?.[1]?.trim(); }
|
|
13
|
-
function decode(value) { return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll(""", '"'); }
|
|
14
|
-
function resolveurl(value, base) { try { return base ? new URL(value, base).href : new URL(value).href; } catch { return null; } }
|
package/scrape/extract.ts
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import * as cheerio from 'cheerio';
|
|
2
|
-
import type { ExtractOptions, LinkInfo, ImageInfo, TableInfo, PageMetadata } from './types.js';
|
|
3
|
-
import { normalizeUrl, isInternalUrl } from './utils.js';
|
|
4
|
-
|
|
5
|
-
export interface ExtractedContent {
|
|
6
|
-
content: string;
|
|
7
|
-
text: string;
|
|
8
|
-
links: LinkInfo[];
|
|
9
|
-
images: ImageInfo[];
|
|
10
|
-
tables: TableInfo[];
|
|
11
|
-
metadata: PageMetadata;
|
|
12
|
-
jsonLd: unknown[];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function extractReadableContent($: cheerio.CheerioAPI): string {
|
|
16
|
-
const articleSelectors = [
|
|
17
|
-
'article', '[role="main"]', 'main', '.post-content', '.article-content',
|
|
18
|
-
'.entry-content', '.content', '#content', '.prose', '.markdown-body',
|
|
19
|
-
];
|
|
20
|
-
for (const sel of articleSelectors) {
|
|
21
|
-
const el = $(sel).first();
|
|
22
|
-
if (el.length) return el.text().trim();
|
|
23
|
-
}
|
|
24
|
-
return $('body').text().trim();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function extractMetadata($: cheerio.CheerioAPI): PageMetadata {
|
|
28
|
-
const getMeta = (name: string): string | undefined => {
|
|
29
|
-
return $(`meta[name="${name}"], meta[property="${name}"]`).attr('content') || undefined;
|
|
30
|
-
};
|
|
31
|
-
return {
|
|
32
|
-
title: $('title').text() || getMeta('og:title') || '',
|
|
33
|
-
description: getMeta('description') || getMeta('og:description'),
|
|
34
|
-
favicon: $('link[rel="icon"]').attr('href') || $('link[rel="shortcut icon"]').attr('href'),
|
|
35
|
-
charset: $('meta[charset]').attr('charset') || $('meta[http-equiv="Content-Type"]').attr('content'),
|
|
36
|
-
language: $('html').attr('lang') || undefined,
|
|
37
|
-
author: getMeta('author'),
|
|
38
|
-
publishedDate: getMeta('article:published_time') || getMeta('date'),
|
|
39
|
-
ogImage: getMeta('og:image'),
|
|
40
|
-
ogType: getMeta('og:type'),
|
|
41
|
-
keywords: getMeta('keywords')?.split(',').map(k => k.trim()),
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function extractJsonLd($: cheerio.CheerioAPI): unknown[] {
|
|
46
|
-
const results: unknown[] = [];
|
|
47
|
-
$('script[type="application/ld+json"]').each((_, el) => {
|
|
48
|
-
try {
|
|
49
|
-
const data = JSON.parse($(el).html() || '');
|
|
50
|
-
if (data['@graph']) {
|
|
51
|
-
results.push(...(Array.isArray(data['@graph']) ? data['@graph'] : [data['@graph']]));
|
|
52
|
-
} else {
|
|
53
|
-
results.push(data);
|
|
54
|
-
}
|
|
55
|
-
} catch {}
|
|
56
|
-
});
|
|
57
|
-
return results;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function extractLinks($: cheerio.CheerioAPI, baseUrl: string): LinkInfo[] {
|
|
61
|
-
const links: LinkInfo[] = [];
|
|
62
|
-
$('a[href]').each((_, el) => {
|
|
63
|
-
const href = $(el).attr('href') || '';
|
|
64
|
-
const text = $(el).text().trim().slice(0, 200);
|
|
65
|
-
if (!href || href.startsWith('#') || href.startsWith('javascript:')) return;
|
|
66
|
-
const fullUrl = normalizeUrl(href, baseUrl);
|
|
67
|
-
links.push({
|
|
68
|
-
href: fullUrl,
|
|
69
|
-
text: text || fullUrl,
|
|
70
|
-
isInternal: isInternalUrl(fullUrl, baseUrl),
|
|
71
|
-
isExternal: !isInternalUrl(fullUrl, baseUrl),
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
return links;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function extractImages($: cheerio.CheerioAPI, baseUrl: string): ImageInfo[] {
|
|
78
|
-
const images: ImageInfo[] = [];
|
|
79
|
-
$('img[src]').each((_, el) => {
|
|
80
|
-
const src = normalizeUrl($(el).attr('src') || '', baseUrl);
|
|
81
|
-
const alt = $(el).attr('alt') || '';
|
|
82
|
-
const width = parseInt($(el).attr('width') || '') || undefined;
|
|
83
|
-
const height = parseInt($(el).attr('height') || '') || undefined;
|
|
84
|
-
if (src) images.push({ src, alt: alt.slice(0, 200), width, height });
|
|
85
|
-
});
|
|
86
|
-
return images;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function extractTables($: cheerio.CheerioAPI): TableInfo[] {
|
|
90
|
-
const tables: TableInfo[] = [];
|
|
91
|
-
$('table').each((_, table) => {
|
|
92
|
-
const headers: string[] = [];
|
|
93
|
-
const rows: string[][] = [];
|
|
94
|
-
$('thead tr th, thead tr td', table).each((_, th) => {
|
|
95
|
-
headers.push($(th).text().trim());
|
|
96
|
-
});
|
|
97
|
-
$('tbody tr, > tr', table).each((_, tr) => {
|
|
98
|
-
if ($(tr).parent().is('thead')) return;
|
|
99
|
-
const row: string[] = [];
|
|
100
|
-
$('td, th', tr).each((_, td) => {
|
|
101
|
-
row.push($(td).text().trim());
|
|
102
|
-
});
|
|
103
|
-
if (row.length) rows.push(row);
|
|
104
|
-
});
|
|
105
|
-
const caption = $('caption', table).text().trim() || undefined;
|
|
106
|
-
if (rows.length) tables.push({ headers, rows, caption });
|
|
107
|
-
});
|
|
108
|
-
return tables;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function htmlToText(html: string): string {
|
|
112
|
-
return html
|
|
113
|
-
.replace(/<br\s*\/?>/gi, '\n')
|
|
114
|
-
.replace(/<\/p>/gi, '\n\n')
|
|
115
|
-
.replace(/<\/div>/gi, '\n')
|
|
116
|
-
.replace(/<\/h[1-6]>/gi, '\n')
|
|
117
|
-
.replace(/<\/li>/gi, '\n')
|
|
118
|
-
.replace(/<[^>]+>/g, '')
|
|
119
|
-
.replace(/ /g, ' ')
|
|
120
|
-
.replace(/&/g, '&')
|
|
121
|
-
.replace(/</g, '<')
|
|
122
|
-
.replace(/>/g, '>')
|
|
123
|
-
.replace(/"/g, '"')
|
|
124
|
-
.replace(/'/g, "'")
|
|
125
|
-
.replace(/\n{3,}/g, '\n\n')
|
|
126
|
-
.trim();
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export async function extractContent(html: string, options: ExtractOptions = {}): Promise<ExtractedContent> {
|
|
130
|
-
const $ = cheerio.load(html);
|
|
131
|
-
const baseUrl = $('base').attr('href') || '';
|
|
132
|
-
|
|
133
|
-
if (options.removeSelectors?.length) {
|
|
134
|
-
for (const sel of options.removeSelectors) {
|
|
135
|
-
$(sel).remove();
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const metadata = extractMetadata($);
|
|
140
|
-
const jsonLd = extractJsonLd($);
|
|
141
|
-
const links = options.preserveLinks !== false ? extractLinks($, baseUrl) : [];
|
|
142
|
-
const images = options.preserveImages !== false ? extractImages($, baseUrl) : [];
|
|
143
|
-
const tables = options.preserveTables !== false ? extractTables($) : [];
|
|
144
|
-
|
|
145
|
-
const text = options.readable
|
|
146
|
-
? extractReadableContent($)
|
|
147
|
-
: $('body').text().trim();
|
|
148
|
-
|
|
149
|
-
const content = htmlToText(text);
|
|
150
|
-
|
|
151
|
-
return {
|
|
152
|
-
content: options.maxLength ? content.slice(0, options.maxLength) : content,
|
|
153
|
-
text,
|
|
154
|
-
links,
|
|
155
|
-
images,
|
|
156
|
-
tables,
|
|
157
|
-
metadata,
|
|
158
|
-
jsonLd,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export async function extractReadable(html: string): Promise<string> {
|
|
163
|
-
const result = await extractContent(html, { readable: true });
|
|
164
|
-
return result.content;
|
|
165
|
-
}
|
package/scrape/fetch.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import * as cheerio from 'cheerio';
|
|
2
|
-
import type { ScrapeOptions } from './types.js';
|
|
3
|
-
import { getHeaders, getRandomProfile } from './headers.js';
|
|
4
|
-
import { WebScrapeError, ErrorCode } from './errors.js';
|
|
5
|
-
|
|
6
|
-
export interface FetchResult {
|
|
7
|
-
html: string;
|
|
8
|
-
url: string;
|
|
9
|
-
status: number;
|
|
10
|
-
headers: Record<string, string>;
|
|
11
|
-
duration: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export async function fetchHtml(url: string, options: {
|
|
15
|
-
timeout?: number;
|
|
16
|
-
headers?: Record<string, string>;
|
|
17
|
-
userAgent?: string;
|
|
18
|
-
proxy?: string;
|
|
19
|
-
signal?: AbortSignal;
|
|
20
|
-
} = {}): Promise<FetchResult> {
|
|
21
|
-
const startTime = Date.now();
|
|
22
|
-
const profile = getRandomProfile();
|
|
23
|
-
const baseHeaders = getHeaders(profile);
|
|
24
|
-
const headers = { ...baseHeaders, ...options.headers };
|
|
25
|
-
if (options.userAgent) headers['User-Agent'] = options.userAgent;
|
|
26
|
-
|
|
27
|
-
const controller = new AbortController();
|
|
28
|
-
const timeoutId = setTimeout(() => controller.abort(), options.timeout || 30000);
|
|
29
|
-
const signal = options.signal ? AbortSignal.any([controller.signal, options.signal]) : controller.signal;
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
const response = await fetch(url, {
|
|
33
|
-
method: 'GET',
|
|
34
|
-
headers,
|
|
35
|
-
signal,
|
|
36
|
-
redirect: 'follow',
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
clearTimeout(timeoutId);
|
|
40
|
-
|
|
41
|
-
if (!response.ok) {
|
|
42
|
-
throw new WebScrapeError(
|
|
43
|
-
`HTTP ${response.status}: ${response.statusText}`,
|
|
44
|
-
response.status === 403 ? ErrorCode.BLOCKED :
|
|
45
|
-
response.status === 429 ? ErrorCode.RATE_LIMITED :
|
|
46
|
-
response.status >= 500 ? ErrorCode.NETWORK_ERROR :
|
|
47
|
-
ErrorCode.NETWORK_ERROR,
|
|
48
|
-
response.status,
|
|
49
|
-
[408, 429, 500, 502, 503, 504].includes(response.status),
|
|
50
|
-
{ url, status: response.status }
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const html = await response.text();
|
|
55
|
-
const responseHeaders: Record<string, string> = {};
|
|
56
|
-
response.headers.forEach((value, key) => { responseHeaders[key] = value; });
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
html,
|
|
60
|
-
url: response.url || url,
|
|
61
|
-
status: response.status,
|
|
62
|
-
headers: responseHeaders,
|
|
63
|
-
duration: Date.now() - startTime,
|
|
64
|
-
};
|
|
65
|
-
} catch (error) {
|
|
66
|
-
clearTimeout(timeoutId);
|
|
67
|
-
if (error instanceof WebScrapeError) throw error;
|
|
68
|
-
if ((error as Error).name === 'AbortError') {
|
|
69
|
-
throw new WebScrapeError(
|
|
70
|
-
`Request timeout after ${options.timeout || 30000}ms`,
|
|
71
|
-
ErrorCode.TIMEOUT,
|
|
72
|
-
504,
|
|
73
|
-
true,
|
|
74
|
-
{ url, timeout: options.timeout || 30000 }
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
throw new WebScrapeError(
|
|
78
|
-
`Network error: ${(error as Error).message}`,
|
|
79
|
-
ErrorCode.NETWORK_ERROR,
|
|
80
|
-
503,
|
|
81
|
-
true,
|
|
82
|
-
{ url },
|
|
83
|
-
error as Error
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export async function fetchAndParse(url: string, options: Partial<ScrapeOptions> = {}): Promise<FetchResult> {
|
|
89
|
-
return fetchHtml(url, {
|
|
90
|
-
timeout: options.timeout,
|
|
91
|
-
headers: options.headers,
|
|
92
|
-
userAgent: options.userAgent,
|
|
93
|
-
proxy: options.proxy,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function detectRenderingMode(html: string): 'static' | 'spa' | 'hydrated' {
|
|
98
|
-
if (/<div id=["'](?:root|app|__next|__nuxt)["']>\s*<\/div>/.test(html)) return 'spa';
|
|
99
|
-
if (html.includes('__NEXT_DATA__') || html.includes('__NUXT__') || html.includes('__VUE_SSR_DATA__')) return 'hydrated';
|
|
100
|
-
const $ = cheerio.load(html);
|
|
101
|
-
if ($('script[type="application/ld+json"]').length > 0) return 'static';
|
|
102
|
-
const textContent = $.text().replace(/\s+/g, ' ').trim();
|
|
103
|
-
if (textContent.length > 500) return 'static';
|
|
104
|
-
return 'spa';
|
|
105
|
-
}
|
package/scrape/formats.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import type { ScrapeFormat, SerializeTarget, SerializeOptions, ScrapeResult } from './types.js';
|
|
2
|
-
import { serializeResult as sr } from './serialize.js';
|
|
3
|
-
|
|
4
|
-
const FORMAT_ALIASES: Record<string, ScrapeFormat> = {
|
|
5
|
-
md: 'markdown',
|
|
6
|
-
txt: 'text',
|
|
7
|
-
plain: 'text',
|
|
8
|
-
xml: 'xml',
|
|
9
|
-
json: 'json',
|
|
10
|
-
redis: 'redis',
|
|
11
|
-
html: 'html',
|
|
12
|
-
h: 'html',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const FORMAT_EXTENSIONS: Record<string, ScrapeFormat> = {
|
|
16
|
-
'.md': 'markdown',
|
|
17
|
-
'.markdown': 'markdown',
|
|
18
|
-
'.html': 'html',
|
|
19
|
-
'.htm': 'html',
|
|
20
|
-
'.txt': 'text',
|
|
21
|
-
'.json': 'json',
|
|
22
|
-
'.xml': 'xml',
|
|
23
|
-
'.redis': 'redis',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export function resolveFormat(format: string): ScrapeFormat {
|
|
27
|
-
const lower = format.toLowerCase().trim();
|
|
28
|
-
return FORMAT_ALIASES[lower] || (lower as ScrapeFormat);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function formatFromExtension(ext: string): ScrapeFormat | null {
|
|
32
|
-
return FORMAT_EXTENSIONS[ext.toLowerCase()] ?? null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function extensionForFormat(format: ScrapeFormat): string {
|
|
36
|
-
const map: Record<ScrapeFormat, string> = {
|
|
37
|
-
markdown: '.md',
|
|
38
|
-
html: '.html',
|
|
39
|
-
text: '.txt',
|
|
40
|
-
json: '.json',
|
|
41
|
-
xml: '.xml',
|
|
42
|
-
redis: '.redis',
|
|
43
|
-
};
|
|
44
|
-
return map[format] || '.md';
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function detectContentType(html: string): 'article' | 'list' | 'page' | 'other' {
|
|
48
|
-
if (html.includes('<article') || html.includes('entry-content') || html.includes('class="post-content"') || html.includes('class="article-content"') || html.includes('role="main"')) {
|
|
49
|
-
return 'article';
|
|
50
|
-
}
|
|
51
|
-
const listCount = (html.match(/<li>/gi) || []).length;
|
|
52
|
-
if (listCount > 20) return 'list';
|
|
53
|
-
if (html.includes('<article') || html.includes('entry-content')) return 'article';
|
|
54
|
-
return 'page';
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function buildSerializeOptions(format: ScrapeFormat, pretty = true): SerializeOptions {
|
|
58
|
-
const targetMap: Record<ScrapeFormat, SerializeTarget> = {
|
|
59
|
-
markdown: 'markdown',
|
|
60
|
-
html: 'markdown',
|
|
61
|
-
text: 'text',
|
|
62
|
-
json: 'json',
|
|
63
|
-
xml: 'xml',
|
|
64
|
-
redis: 'redis',
|
|
65
|
-
};
|
|
66
|
-
return {
|
|
67
|
-
format: targetMap[format] || 'markdown',
|
|
68
|
-
pretty,
|
|
69
|
-
includeMetadata: true,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export async function convertResult(result: ScrapeResult, targetFormat: ScrapeFormat): Promise<ScrapeResult> {
|
|
74
|
-
if (result.format === targetFormat) return result;
|
|
75
|
-
|
|
76
|
-
const opts = buildSerializeOptions(targetFormat);
|
|
77
|
-
const serialized = sr(result, opts);
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
...result,
|
|
81
|
-
content: serialized.content,
|
|
82
|
-
format: targetFormat,
|
|
83
|
-
size: serialized.size,
|
|
84
|
-
};
|
|
85
|
-
}
|
package/scrape/headers.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
export interface HeaderProfile {
|
|
2
|
-
userAgent: string;
|
|
3
|
-
accept: string;
|
|
4
|
-
acceptLanguage: string;
|
|
5
|
-
secChUa: string;
|
|
6
|
-
secChUaPlatform: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const CHROME_PROFILES: HeaderProfile[] = [
|
|
10
|
-
{
|
|
11
|
-
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
|
|
12
|
-
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
|
|
13
|
-
acceptLanguage: 'en-US,en;q=0.9',
|
|
14
|
-
secChUa: '"Chromium";v="131", "Not_A Brand";v="24"',
|
|
15
|
-
secChUaPlatform: '"Windows"',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
|
|
19
|
-
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
|
|
20
|
-
acceptLanguage: 'en-US,en;q=0.9',
|
|
21
|
-
secChUa: '"Chromium";v="131", "Not_A Brand";v="24"',
|
|
22
|
-
secChUaPlatform: '"macOS"',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0',
|
|
26
|
-
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
|
|
27
|
-
acceptLanguage: 'en-US,en;q=0.5',
|
|
28
|
-
secChUa: '',
|
|
29
|
-
secChUaPlatform: '"Windows"',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Safari/605.1.15',
|
|
33
|
-
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
34
|
-
acceptLanguage: 'en-US,en;q=0.9',
|
|
35
|
-
secChUa: '',
|
|
36
|
-
secChUaPlatform: '"macOS"',
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
export function getRandomProfile(): HeaderProfile {
|
|
41
|
-
return CHROME_PROFILES[Math.floor(Math.random() * CHROME_PROFILES.length)];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function getHeaders(profile?: HeaderProfile): Record<string, string> {
|
|
45
|
-
const p = profile || getRandomProfile();
|
|
46
|
-
const headers: Record<string, string> = {
|
|
47
|
-
'User-Agent': p.userAgent,
|
|
48
|
-
'Accept': p.accept,
|
|
49
|
-
'Accept-Language': p.acceptLanguage,
|
|
50
|
-
'Accept-Encoding': 'gzip, deflate, br',
|
|
51
|
-
'Connection': 'keep-alive',
|
|
52
|
-
'Upgrade-Insecure-Requests': '1',
|
|
53
|
-
'Sec-Fetch-Dest': 'document',
|
|
54
|
-
'Sec-Fetch-Mode': 'navigate',
|
|
55
|
-
'Sec-Fetch-Site': 'none',
|
|
56
|
-
'Sec-Fetch-User': '?1',
|
|
57
|
-
};
|
|
58
|
-
if (p.secChUa) {
|
|
59
|
-
headers['sec-ch-ua'] = p.secChUa;
|
|
60
|
-
headers['sec-ch-ua-mobile'] = '?0';
|
|
61
|
-
headers['sec-ch-ua-platform'] = p.secChUaPlatform;
|
|
62
|
-
}
|
|
63
|
-
return headers;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function mergeHeaders(
|
|
67
|
-
base: Record<string, string>,
|
|
68
|
-
override: Record<string, string>
|
|
69
|
-
): Record<string, string> {
|
|
70
|
-
return { ...base, ...override };
|
|
71
|
-
}
|