@wenathlan/saddle 1.8.7 → 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 +18 -18
- 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} +3 -7
- 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 +5 -4
- package/docs/gapmatrix.md +2 -2
- package/docs/libraryapi.md +4 -4
- package/docs/release.md +5 -5
- package/docs/releaseassets.md +1 -1
- package/docs/reorganization-1.8.8.md +31 -0
- 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 -91
- 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 -37
- package/core/events.js +0 -21
- package/core/hash.js +0 -73
- package/core/ids.js +0 -15
- package/crawl/crawler.js +0 -29
- package/crawl/frontier.js +0 -34
- package/crawl/normalize.js +0 -14
- package/crawl/persistent.js +0 -13
- 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/errors/taxonomy.js +0 -18
- 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/retry/circuit.js +0 -15
- package/retry/policy.js +0 -12
- 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/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/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/retry.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import pRetry, { AbortError } from "p-retry";
|
|
2
|
-
import type { RetryConfig } from "./types.js";
|
|
3
|
-
|
|
4
|
-
export const DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {
|
|
5
|
-
retries: 3,
|
|
6
|
-
delay: 1000,
|
|
7
|
-
backoff: "exponential",
|
|
8
|
-
maxDelay: 30000,
|
|
9
|
-
statusCodes: [408, 429, 500, 502, 503, 504],
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const RETRYABLE_NETWORK_CODES = ["ECONNREFUSED", "ECONNRESET", "ETIMEDOUT", "EPIPE", "ENOTFOUND"];
|
|
13
|
-
|
|
14
|
-
export function isRetryableError(error: Error): boolean {
|
|
15
|
-
const code = (error as any).code;
|
|
16
|
-
if (code && RETRYABLE_NETWORK_CODES.includes(code)) return true;
|
|
17
|
-
const status = (error as any).statusCode || (error as any).status;
|
|
18
|
-
if (status && [408, 429, 500, 502, 503, 504].includes(status)) return true;
|
|
19
|
-
if (error.name === "AbortError") return false;
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function calculateDelay(attempt: number, config: Required<RetryConfig>): number {
|
|
24
|
-
switch (config.backoff) {
|
|
25
|
-
case "exponential":
|
|
26
|
-
return Math.min(config.delay * 2 ** attempt, config.maxDelay);
|
|
27
|
-
case "linear":
|
|
28
|
-
return Math.min(config.delay * (attempt + 1), config.maxDelay);
|
|
29
|
-
case "constant":
|
|
30
|
-
return config.delay;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export async function withRetry<T>(
|
|
35
|
-
fn: (attemptNumber: number) => Promise<T>,
|
|
36
|
-
config: Partial<RetryConfig> = {},
|
|
37
|
-
onRetry?: (error: Error, attempt: number) => void,
|
|
38
|
-
): Promise<T> {
|
|
39
|
-
const cfg = { ...DEFAULT_RETRY_CONFIG, ...config };
|
|
40
|
-
|
|
41
|
-
return pRetry(
|
|
42
|
-
async (attemptNumber) => {
|
|
43
|
-
try {
|
|
44
|
-
return await fn(attemptNumber);
|
|
45
|
-
} catch (error) {
|
|
46
|
-
if (!isRetryableError(error as Error)) {
|
|
47
|
-
throw new AbortError((error as Error).message);
|
|
48
|
-
}
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
retries: cfg.retries,
|
|
54
|
-
minTimeout: calculateDelay(0, cfg),
|
|
55
|
-
maxTimeout: cfg.maxDelay,
|
|
56
|
-
randomize: cfg.backoff === "exponential",
|
|
57
|
-
onFailedAttempt: (context) => {
|
|
58
|
-
onRetry?.(context.error, context.attemptNumber);
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export { AbortError };
|
package/scrape/robots.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* robots rules are parsed locally and enforced before a fetch is attempted.
|
|
3
|
-
*/
|
|
4
|
-
export function robotsrules(text = "") {
|
|
5
|
-
const groups = [];
|
|
6
|
-
let current = null;
|
|
7
|
-
for (const raw of text.split(/\r?\n/)) {
|
|
8
|
-
const line = raw.split("#", 1)[0].trim();
|
|
9
|
-
if (!line) continue;
|
|
10
|
-
const separator = line.indexOf(":");
|
|
11
|
-
if (separator < 0) continue;
|
|
12
|
-
const key = line.slice(0, separator).trim().toLowerCase();
|
|
13
|
-
const value = line.slice(separator + 1).trim();
|
|
14
|
-
if (key === "user-agent") { current = { agents: [value.toLowerCase()], disallow: [], allow: [], delay: undefined, sitemaps: [] }; groups.push(current); }
|
|
15
|
-
else if (current && key === "disallow" && value) current.disallow.push(value);
|
|
16
|
-
else if (current && key === "allow" && value) current.allow.push(value);
|
|
17
|
-
else if (current && key === "crawl-delay" && Number.isFinite(Number(value))) current.delay = Number(value);
|
|
18
|
-
else if (key === "sitemap") (current ?? { sitemaps: [] }).sitemaps.push(value);
|
|
19
|
-
}
|
|
20
|
-
return { groups };
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function robotsallowed(rules, target, agent = "*") {
|
|
24
|
-
const pathname = new URL(target).pathname || "/";
|
|
25
|
-
const candidates = rules.groups.filter((group) => group.agents.includes(agent.toLowerCase()) || group.agents.includes("*"));
|
|
26
|
-
if (!candidates.length) return true;
|
|
27
|
-
const disallowed = candidates.flatMap((group) => group.disallow).filter((path) => pathname.startsWith(path));
|
|
28
|
-
const allowed = candidates.flatMap((group) => group.allow).filter((path) => pathname.startsWith(path));
|
|
29
|
-
return allowed.some((path) => path.length >= Math.max(...disallowed.map((item) => item.length), 0)) || disallowed.length === 0;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function robotsdelay(rules, agent = "*") { return rules.groups.find((group) => group.agents.includes(agent.toLowerCase()) || group.agents.includes("*"))?.delay ?? 0; }
|
package/scrape/robots.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
export interface RobotsDirective {
|
|
2
|
-
userAgent: string;
|
|
3
|
-
allow: string[];
|
|
4
|
-
disallow: string[];
|
|
5
|
-
crawlDelay?: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface RobotsTxt {
|
|
9
|
-
directives: RobotsDirective[];
|
|
10
|
-
sitemaps: string[];
|
|
11
|
-
crawlDelay?: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const cache = new Map<string, { robots: RobotsTxt; fetchedAt: number }>();
|
|
15
|
-
const CACHE_TTL = 24 * 60 * 60 * 1000;
|
|
16
|
-
|
|
17
|
-
function parseRobotsTxt(content: string): RobotsTxt {
|
|
18
|
-
const lines = content.split('\n').map(l => l.trim());
|
|
19
|
-
const directives: RobotsDirective[] = [];
|
|
20
|
-
const sitemaps: string[] = [];
|
|
21
|
-
let current: RobotsDirective | null = null;
|
|
22
|
-
let globalCrawlDelay: number | undefined;
|
|
23
|
-
|
|
24
|
-
for (const line of lines) {
|
|
25
|
-
if (!line || line.startsWith('#')) continue;
|
|
26
|
-
|
|
27
|
-
const colonIndex = line.indexOf(':');
|
|
28
|
-
if (colonIndex === -1) continue;
|
|
29
|
-
|
|
30
|
-
const key = line.slice(0, colonIndex).trim().toLowerCase();
|
|
31
|
-
const value = line.slice(colonIndex + 1).trim();
|
|
32
|
-
|
|
33
|
-
if (key === 'user-agent') {
|
|
34
|
-
current = { userAgent: value, allow: [], disallow: [] };
|
|
35
|
-
directives.push(current);
|
|
36
|
-
} else if (key === 'allow' && current) {
|
|
37
|
-
current.allow.push(value);
|
|
38
|
-
} else if (key === 'disallow' && current) {
|
|
39
|
-
if (value) current.disallow.push(value);
|
|
40
|
-
} else if (key === 'crawl-delay' && current) {
|
|
41
|
-
const delay = parseInt(value);
|
|
42
|
-
if (!isNaN(delay)) {
|
|
43
|
-
current.crawlDelay = delay;
|
|
44
|
-
globalCrawlDelay = delay;
|
|
45
|
-
}
|
|
46
|
-
} else if (key === 'sitemap') {
|
|
47
|
-
sitemaps.push(value);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return { directives, sitemaps, crawlDelay: globalCrawlDelay };
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function matchUserAgent(pattern: string, userAgent: string): boolean {
|
|
55
|
-
const lowerPattern = pattern.toLowerCase();
|
|
56
|
-
const lowerUA = userAgent.toLowerCase();
|
|
57
|
-
if (lowerPattern === '*') return true;
|
|
58
|
-
return lowerUA.includes(lowerPattern.replace(/\*/g, ''));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function isPathAllowed(path: string, directive: RobotsDirective): boolean {
|
|
62
|
-
// Check disallow rules first
|
|
63
|
-
for (const pattern of directive.disallow) {
|
|
64
|
-
if (pattern === '/') return false;
|
|
65
|
-
if (pattern && path.startsWith(pattern)) return false;
|
|
66
|
-
}
|
|
67
|
-
// Then check allow rules
|
|
68
|
-
for (const pattern of directive.allow) {
|
|
69
|
-
if (pattern === '/') return true;
|
|
70
|
-
if (pattern && path.startsWith(pattern)) return true;
|
|
71
|
-
}
|
|
72
|
-
// Default: allowed
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export async function fetchRobotsTxt(siteUrl: string, options: { timeout?: number; userAgent?: string } = {}): Promise<RobotsTxt> {
|
|
77
|
-
const base = siteUrl.replace(/\/$/, '');
|
|
78
|
-
const robotsUrl = `${base}/robots.txt`;
|
|
79
|
-
const userAgent = options.userAgent || 'DevThink-WebScrape/2.0';
|
|
80
|
-
|
|
81
|
-
const cached = cache.get(robotsUrl);
|
|
82
|
-
if (cached && (Date.now() - cached.fetchedAt) < CACHE_TTL) {
|
|
83
|
-
return cached.robots;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
try {
|
|
87
|
-
const response = await fetch(robotsUrl, {
|
|
88
|
-
headers: { 'User-Agent': userAgent },
|
|
89
|
-
signal: AbortSignal.timeout(options.timeout || 5000),
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
if (!response.ok) {
|
|
93
|
-
const robots: RobotsTxt = { directives: [], sitemaps: [], crawlDelay: undefined };
|
|
94
|
-
cache.set(robotsUrl, { robots, fetchedAt: Date.now() });
|
|
95
|
-
return robots;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const text = await response.text();
|
|
99
|
-
const robots = parseRobotsTxt(text);
|
|
100
|
-
cache.set(robotsUrl, { robots, fetchedAt: Date.now() });
|
|
101
|
-
return robots;
|
|
102
|
-
} catch {
|
|
103
|
-
const robots: RobotsTxt = { directives: [], sitemaps: [], crawlDelay: undefined };
|
|
104
|
-
cache.set(robotsUrl, { robots, fetchedAt: Date.now() });
|
|
105
|
-
return robots;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export function isAllowed(url: string, robots: RobotsTxt, userAgent: string = '*'): boolean {
|
|
110
|
-
try {
|
|
111
|
-
const parsed = new URL(url);
|
|
112
|
-
const path = parsed.pathname;
|
|
113
|
-
|
|
114
|
-
for (const directive of robots.directives) {
|
|
115
|
-
if (matchUserAgent(directive.userAgent, userAgent)) {
|
|
116
|
-
return isPathAllowed(path, directive);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return true;
|
|
121
|
-
} catch {
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export function getCrawlDelay(robots: RobotsTxt, userAgent: string = '*'): number | undefined {
|
|
127
|
-
for (const directive of robots.directives) {
|
|
128
|
-
if (matchUserAgent(directive.userAgent, userAgent)) {
|
|
129
|
-
return directive.crawlDelay;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return robots.crawlDelay;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export function getSitemaps(robots: RobotsTxt): string[] {
|
|
136
|
-
return robots.sitemaps;
|
|
137
|
-
}
|
package/scrape/schema.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* schema extraction accepts safe field descriptors and never evaluates source strings.
|
|
3
|
-
*/
|
|
4
|
-
export function extractwithschema(html, schema = {}, url) {
|
|
5
|
-
const result = {};
|
|
6
|
-
for (const [name, descriptor] of Object.entries(schema)) result[name] = extractfield(html, descriptor, url);
|
|
7
|
-
return result;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function extractfield(html, descriptor, url) {
|
|
11
|
-
if (typeof descriptor === "function") return descriptor({ html, url });
|
|
12
|
-
if (typeof descriptor === "string") return textfromselector(html, descriptor);
|
|
13
|
-
if (!descriptor || typeof descriptor.selector !== "string") throw new TypeError("schema field requires selector or function");
|
|
14
|
-
if (descriptor.selector === "title") return html.match(/<title[^>]*>([\s\S]*?)<\/title>/i)?.[1]?.trim() ?? null;
|
|
15
|
-
const escaped = descriptor.selector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
16
|
-
const attribute = descriptor.attribute;
|
|
17
|
-
const pattern = attribute ? new RegExp(`<[^>]+${escaped}[^>]*${attribute}=["']([^"']+)["'][^>]*>`, "i") : new RegExp(`<${escaped}[^>]*>([\\s\\S]*?)<\\/${escaped}>`, "i");
|
|
18
|
-
return pattern.exec(html)?.[1]?.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim() ?? null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function textfromselector(html, selector) { return extractfield(html, { selector }); }
|
package/scrape/scrape.ts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { AgentBrowser } from './browser.js';
|
|
2
|
-
import { extractContent } from './extract.js';
|
|
3
|
-
import { fetchHtml, detectRenderingMode } from './fetch.js';
|
|
4
|
-
import type { ScrapeOptions, ScrapeResult } from './types.js';
|
|
5
|
-
import { WebScrapeError, ErrorCode } from './errors.js';
|
|
6
|
-
|
|
7
|
-
export async function scrapeUrl(url: string, options: ScrapeOptions = {}): Promise<ScrapeResult> {
|
|
8
|
-
if (!url || !url.startsWith('http')) {
|
|
9
|
-
throw new WebScrapeError(`Invalid URL: ${url}`, ErrorCode.VALIDATION_FAILED, 400, false);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const startTime = Date.now();
|
|
13
|
-
const mode = options.mode || 'auto';
|
|
14
|
-
|
|
15
|
-
if (mode === 'fetch' || mode === 'auto') {
|
|
16
|
-
try {
|
|
17
|
-
const fetchResult = await fetchHtml(url, {
|
|
18
|
-
timeout: options.timeout,
|
|
19
|
-
headers: options.headers,
|
|
20
|
-
userAgent: options.userAgent,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
if (mode === 'auto') {
|
|
24
|
-
const renderMode = detectRenderingMode(fetchResult.html);
|
|
25
|
-
if (renderMode === 'static') {
|
|
26
|
-
return buildResult(fetchResult.html, fetchResult.url, options, startTime);
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
return buildResult(fetchResult.html, fetchResult.url, options, startTime);
|
|
30
|
-
}
|
|
31
|
-
} catch (error) {
|
|
32
|
-
if (mode === 'fetch') throw error;
|
|
33
|
-
if (!(error instanceof WebScrapeError) || error.isRetryable) {
|
|
34
|
-
// Fall through to browser mode
|
|
35
|
-
} else {
|
|
36
|
-
throw error;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const browser = new AgentBrowser({
|
|
42
|
-
headless: true,
|
|
43
|
-
timeout: options.timeout ?? 30000,
|
|
44
|
-
proxy: options.proxy ?? '',
|
|
45
|
-
userAgent: options.userAgent,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
await browser.launch();
|
|
50
|
-
await browser.navigate(url, (options.waitUntil as 'load' | 'domcontentloaded' | 'networkidle') ?? 'networkidle');
|
|
51
|
-
|
|
52
|
-
if (options.scroll) {
|
|
53
|
-
await browser.scrollToBottom(800, options.scrollDelay ?? 300, options.maxScrolls ?? 50);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const html = await browser.html();
|
|
57
|
-
const pageTitle = await browser.title();
|
|
58
|
-
const pageUrl = await browser.url();
|
|
59
|
-
|
|
60
|
-
return buildResult(html, pageUrl, options, startTime, pageTitle);
|
|
61
|
-
} finally {
|
|
62
|
-
await browser.close();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export async function scrapeHtml(html: string, options: ScrapeOptions = {}): Promise<ScrapeResult> {
|
|
67
|
-
const startTime = Date.now();
|
|
68
|
-
return buildResult(html, 'about:blank', options, startTime);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export async function scrapeWithBrowser(
|
|
72
|
-
browser: AgentBrowser,
|
|
73
|
-
url: string,
|
|
74
|
-
options: ScrapeOptions = {}
|
|
75
|
-
): Promise<ScrapeResult> {
|
|
76
|
-
const startTime = Date.now();
|
|
77
|
-
|
|
78
|
-
await browser.navigate(url, (options.waitUntil as 'load' | 'domcontentloaded' | 'networkidle') ?? 'networkidle');
|
|
79
|
-
|
|
80
|
-
if (options.scroll) {
|
|
81
|
-
await browser.scrollToBottom(800, options.scrollDelay ?? 300, options.maxScrolls ?? 50);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const html = await browser.html();
|
|
85
|
-
const pageTitle = await browser.title();
|
|
86
|
-
const pageUrl = await browser.url();
|
|
87
|
-
|
|
88
|
-
return buildResult(html, pageUrl, options, startTime, pageTitle);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async function buildResult(
|
|
92
|
-
html: string,
|
|
93
|
-
url: string,
|
|
94
|
-
options: ScrapeOptions,
|
|
95
|
-
startTime: number,
|
|
96
|
-
title?: string,
|
|
97
|
-
): Promise<ScrapeResult> {
|
|
98
|
-
const extracted = await extractContent(html, {
|
|
99
|
-
readable: true,
|
|
100
|
-
preserveLinks: options.extractLinks ?? true,
|
|
101
|
-
preserveImages: options.extractImages ?? true,
|
|
102
|
-
preserveTables: options.extractTables ?? true,
|
|
103
|
-
maxLength: options.maxContentLength,
|
|
104
|
-
removeSelectors: options.removeSelectors,
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
const duration = Date.now() - startTime;
|
|
108
|
-
|
|
109
|
-
return {
|
|
110
|
-
url,
|
|
111
|
-
title: title || extracted.metadata.title || '',
|
|
112
|
-
content: extracted.content,
|
|
113
|
-
format: options.format ?? 'markdown',
|
|
114
|
-
text: extracted.text,
|
|
115
|
-
links: extracted.links,
|
|
116
|
-
images: extracted.images,
|
|
117
|
-
tables: extracted.tables,
|
|
118
|
-
metadata: extracted.metadata,
|
|
119
|
-
extractedAt: new Date().toISOString(),
|
|
120
|
-
duration,
|
|
121
|
-
size: extracted.content.length + extracted.text.length,
|
|
122
|
-
};
|
|
123
|
-
}
|
package/scrape/scraper.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* scraper composes robots policy cache transport and extraction without browser assumptions.
|
|
3
|
-
*/
|
|
4
|
-
import { transport } from "../adapters/transport.js";
|
|
5
|
-
import { extracthtml } from "./extract.js";
|
|
6
|
-
import { robotsallowed, robotsdelay, robotsrules } from "./robots.js";
|
|
7
|
-
import { ttlcache } from "./cache.js";
|
|
8
|
-
|
|
9
|
-
export function scraper(options = {}) {
|
|
10
|
-
const client = options.transport ?? transport({ fetcher: options.fetcher, timeout: options.timeout, attempts: options.attempts });
|
|
11
|
-
const cache = options.cache ?? ttlcache(options.cacheoptions);
|
|
12
|
-
const agent = options.agent ?? "*";
|
|
13
|
-
const policies = new Map();
|
|
14
|
-
return {
|
|
15
|
-
async robots(origin) {
|
|
16
|
-
if (policies.has(origin)) return policies.get(origin);
|
|
17
|
-
const url = new URL("/robots.txt", origin).href;
|
|
18
|
-
const response = await client.request(url);
|
|
19
|
-
const rules = robotsrules(response.ok ? await response.text() : "");
|
|
20
|
-
policies.set(origin, rules);
|
|
21
|
-
return rules;
|
|
22
|
-
},
|
|
23
|
-
async scrape(url) {
|
|
24
|
-
const target = new URL(url);
|
|
25
|
-
if (!["http:", "https:"].includes(target.protocol)) throw new TypeError("scraper accepts http and https only");
|
|
26
|
-
const rules = await this.robots(target.origin);
|
|
27
|
-
if (!robotsallowed(rules, target.href, agent)) throw new Error("robots policy disallows target");
|
|
28
|
-
const cached = cache.get(target.href);
|
|
29
|
-
if (cached) return cached;
|
|
30
|
-
const wait = robotsdelay(rules, agent);
|
|
31
|
-
if (wait) await new Promise((resolve) => setTimeout(resolve, wait * 1000));
|
|
32
|
-
const response = await client.request(target.href, { headers: options.headers });
|
|
33
|
-
if (!response.ok) throw new Error(`scrape request failed with ${response.status}`);
|
|
34
|
-
const result = extracthtml(await response.text(), target.href);
|
|
35
|
-
cache.set(target.href, result, { ttl: options.ttl });
|
|
36
|
-
return result;
|
|
37
|
-
},
|
|
38
|
-
cache
|
|
39
|
-
};
|
|
40
|
-
}
|
package/scrape/semantic.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* semantic extraction exposes bounded headings, landmarks, controls and links without evaluating page code.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/** Extracts semantic page facts from HTML using safe built-in parsing heuristics. */
|
|
6
|
-
export function extractsemantic(html, url) {
|
|
7
|
-
const source = String(html ?? "");
|
|
8
|
-
const headings = [...source.matchAll(/<h([1-6])\b[^>]*>([\s\S]*?)<\/h\1>/gi)].slice(0, 100).map((match) => ({ level: Number(match[1]), text: clean(match[2]) })).filter((item) => item.text);
|
|
9
|
-
const landmarks = [...source.matchAll(/<(main|nav|header|footer|aside|section|article)\b([^>]*)>/gi)].slice(0, 100).map((match) => ({ role: match[1].toLowerCase(), label: attribute(match[2], "aria-label") ?? attribute(match[2], "id") ?? "" }));
|
|
10
|
-
const controls = [...source.matchAll(/<(button|input|textarea|select|a)\b([^>]*)>([\s\S]*?)<\/\1>|<(input)\b([^>]*)\/?\s*>/gi)].slice(0, 200).map((match, index) => {
|
|
11
|
-
const tag = (match[1] ?? match[4]).toLowerCase();
|
|
12
|
-
const attrs = match[2] ?? match[5] ?? "";
|
|
13
|
-
return { ref: `e${index + 1}`, role: attribute(attrs, "role") ?? tag, name: attribute(attrs, "aria-label") ?? attribute(attrs, "placeholder") ?? clean(match[3] ?? ""), type: attribute(attrs, "type") };
|
|
14
|
-
});
|
|
15
|
-
const links = [...source.matchAll(/<a\b([^>]*)href=["']([^"']+)["'][^>]*>([\s\S]*?)<\/a>/gi)].slice(0, 500).map((match) => ({ url: resolve(match[2], url), text: clean(match[3]), rel: attribute(match[1], "rel") })).filter((link) => link.url);
|
|
16
|
-
return { url, title: clean(source.match(/<title[^>]*>([\s\S]*?)<\/title>/i)?.[1] ?? ""), headings, landmarks, controls, links: dedupe(links, (item) => item.url), semantictext: clean(source.replace(/<script[\s\S]*?<\/script>/gi, " ").replace(/<style[\s\S]*?<\/style>/gi, " ").replace(/<[^>]+>/g, " ")).slice(0, 100000) };
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function clean(value) { return String(value ?? "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").trim(); }
|
|
20
|
-
function attribute(value, name) { return value.match(new RegExp(`${name}=["']([^"']*)["']`, "i"))?.[1] ?? null; }
|
|
21
|
-
function resolve(value, base) { try { return new URL(value, base).href; } catch { return null; } }
|
|
22
|
-
function dedupe(values, key) { const seen = new Set(); return values.filter((value) => { const item = key(value); if (seen.has(item)) return false; seen.add(item); return true; }); }
|