@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.
Files changed (745) hide show
  1. package/README.md +15 -15
  2. package/dist/adapters/forge.d.ts +17 -0
  3. package/dist/adapters/forge.d.ts.map +1 -0
  4. package/dist/adapters/forge.js +19 -0
  5. package/dist/adapters/forge.js.map +1 -0
  6. package/dist/adapters/forgejo.d.ts +49 -0
  7. package/dist/adapters/forgejo.d.ts.map +1 -0
  8. package/{adapters → dist/adapters}/forgejo.js +1 -1
  9. package/dist/adapters/forgejo.js.map +1 -0
  10. package/dist/adapters/github.d.ts +12 -0
  11. package/dist/adapters/github.d.ts.map +1 -0
  12. package/dist/adapters/github.js +20 -0
  13. package/dist/adapters/github.js.map +1 -0
  14. package/dist/adapters/gitlab.d.ts +17 -0
  15. package/dist/adapters/gitlab.d.ts.map +1 -0
  16. package/dist/adapters/gitlab.js +10 -0
  17. package/dist/adapters/gitlab.js.map +1 -0
  18. package/dist/adapters/huggingface.d.ts +17 -0
  19. package/dist/adapters/huggingface.d.ts.map +1 -0
  20. package/{adapters → dist/adapters}/huggingface.js +1 -1
  21. package/dist/adapters/huggingface.js.map +1 -0
  22. package/dist/adapters/socket.d.ts +11 -0
  23. package/dist/adapters/socket.d.ts.map +1 -0
  24. package/dist/adapters/socket.js +17 -0
  25. package/dist/adapters/socket.js.map +1 -0
  26. package/dist/adapters/transport.d.ts +7 -0
  27. package/dist/adapters/transport.d.ts.map +1 -0
  28. package/dist/adapters/transport.js +36 -0
  29. package/dist/adapters/transport.js.map +1 -0
  30. package/dist/ai/chunk.d.ts +2 -0
  31. package/dist/ai/chunk.d.ts.map +1 -0
  32. package/dist/ai/chunk.js +36 -0
  33. package/dist/ai/chunk.js.map +1 -0
  34. package/dist/ai/llmstxt.d.ts +6 -0
  35. package/dist/ai/llmstxt.d.ts.map +1 -0
  36. package/dist/ai/llmstxt.js +12 -0
  37. package/dist/ai/llmstxt.js.map +1 -0
  38. package/dist/ai/provenance.d.ts +22 -0
  39. package/dist/ai/provenance.d.ts.map +1 -0
  40. package/dist/ai/provenance.js +25 -0
  41. package/dist/ai/provenance.js.map +1 -0
  42. package/dist/ai/rag.d.ts +26 -0
  43. package/dist/ai/rag.d.ts.map +1 -0
  44. package/dist/ai/rag.js +22 -0
  45. package/dist/ai/rag.js.map +1 -0
  46. package/dist/ai/tokens.d.ts +15 -0
  47. package/dist/ai/tokens.d.ts.map +1 -0
  48. package/{ai → dist/ai}/tokens.js +1 -1
  49. package/dist/ai/tokens.js.map +1 -0
  50. package/dist/api/auth.d.ts +16 -0
  51. package/dist/api/auth.d.ts.map +1 -0
  52. package/dist/api/auth.js +19 -0
  53. package/dist/api/auth.js.map +1 -0
  54. package/dist/api/contracts.d.ts +28 -0
  55. package/dist/api/contracts.d.ts.map +1 -0
  56. package/{api → dist/api}/contracts.js +3 -6
  57. package/dist/api/contracts.js.map +1 -0
  58. package/dist/api/control.d.ts +10 -0
  59. package/dist/api/control.d.ts.map +1 -0
  60. package/dist/api/control.js +35 -0
  61. package/dist/api/control.js.map +1 -0
  62. package/dist/api/http.d.ts +7 -0
  63. package/dist/api/http.d.ts.map +1 -0
  64. package/{api → dist/api}/http.js +5 -5
  65. package/dist/api/http.js.map +1 -0
  66. package/dist/api/rate.d.ts +28 -0
  67. package/dist/api/rate.d.ts.map +1 -0
  68. package/dist/api/rate.js +36 -0
  69. package/dist/api/rate.js.map +1 -0
  70. package/dist/api/security.d.ts +12 -0
  71. package/dist/api/security.d.ts.map +1 -0
  72. package/dist/api/security.js +56 -0
  73. package/dist/api/security.js.map +1 -0
  74. package/dist/api/service.d.ts +5 -0
  75. package/dist/api/service.d.ts.map +1 -0
  76. package/dist/api/service.js +70 -0
  77. package/dist/api/service.js.map +1 -0
  78. package/dist/apps/registry.d.ts +33 -0
  79. package/dist/apps/registry.d.ts.map +1 -0
  80. package/dist/apps/registry.js +24 -0
  81. package/dist/apps/registry.js.map +1 -0
  82. package/dist/binary/build.d.ts +29 -0
  83. package/dist/binary/build.d.ts.map +1 -0
  84. package/dist/binary/build.js +17 -0
  85. package/dist/binary/build.js.map +1 -0
  86. package/dist/bot/adapter.d.ts +5 -0
  87. package/dist/bot/adapter.d.ts.map +1 -0
  88. package/dist/bot/adapter.js +11 -0
  89. package/dist/bot/adapter.js.map +1 -0
  90. package/dist/bot/bot.d.ts +28 -0
  91. package/dist/bot/bot.d.ts.map +1 -0
  92. package/dist/bot/bot.js +52 -0
  93. package/dist/bot/bot.js.map +1 -0
  94. package/dist/bot/commands.d.ts +8 -0
  95. package/dist/bot/commands.d.ts.map +1 -0
  96. package/dist/bot/commands.js +19 -0
  97. package/dist/bot/commands.js.map +1 -0
  98. package/dist/bot/permissions.d.ts +13 -0
  99. package/dist/bot/permissions.d.ts.map +1 -0
  100. package/dist/bot/permissions.js +16 -0
  101. package/dist/bot/permissions.js.map +1 -0
  102. package/dist/browser/actions.d.ts +33 -0
  103. package/dist/browser/actions.d.ts.map +1 -0
  104. package/dist/browser/actions.js +44 -0
  105. package/dist/browser/actions.js.map +1 -0
  106. package/dist/browser/agent.d.ts +21 -0
  107. package/dist/browser/agent.d.ts.map +1 -0
  108. package/dist/browser/agent.js +13 -0
  109. package/dist/browser/agent.js.map +1 -0
  110. package/dist/browser/context.d.ts +43 -0
  111. package/dist/browser/context.d.ts.map +1 -0
  112. package/dist/browser/context.js +54 -0
  113. package/dist/browser/context.js.map +1 -0
  114. package/dist/browser/fingerprint.d.ts +4 -0
  115. package/dist/browser/fingerprint.d.ts.map +1 -0
  116. package/{browser → dist/browser}/fingerprint.js +4 -4
  117. package/dist/browser/fingerprint.js.map +1 -0
  118. package/dist/browser/index.d.ts +11 -0
  119. package/dist/browser/index.d.ts.map +1 -0
  120. package/{browser → dist/browser}/index.js +1 -0
  121. package/dist/browser/index.js.map +1 -0
  122. package/dist/browser/playwright.d.ts +11 -0
  123. package/dist/browser/playwright.d.ts.map +1 -0
  124. package/dist/browser/playwright.js +24 -0
  125. package/dist/browser/playwright.js.map +1 -0
  126. package/dist/browser/recorder.d.ts +27 -0
  127. package/dist/browser/recorder.d.ts.map +1 -0
  128. package/dist/browser/recorder.js +22 -0
  129. package/dist/browser/recorder.js.map +1 -0
  130. package/dist/browser/session.d.ts +14 -0
  131. package/dist/browser/session.d.ts.map +1 -0
  132. package/dist/browser/session.js +21 -0
  133. package/dist/browser/session.js.map +1 -0
  134. package/dist/browser/snapshot.d.ts +57 -0
  135. package/dist/browser/snapshot.d.ts.map +1 -0
  136. package/dist/browser/snapshot.js +57 -0
  137. package/dist/browser/snapshot.js.map +1 -0
  138. package/dist/captcha/contract.d.ts +35 -0
  139. package/dist/captcha/contract.d.ts.map +1 -0
  140. package/dist/captcha/contract.js +17 -0
  141. package/dist/captcha/contract.js.map +1 -0
  142. package/dist/captcha/evidence.d.ts +10 -0
  143. package/dist/captcha/evidence.d.ts.map +1 -0
  144. package/dist/captcha/evidence.js +9 -0
  145. package/dist/captcha/evidence.js.map +1 -0
  146. package/dist/captcha/guard.d.ts +23 -0
  147. package/dist/captcha/guard.d.ts.map +1 -0
  148. package/dist/captcha/guard.js +12 -0
  149. package/dist/captcha/guard.js.map +1 -0
  150. package/dist/cli/main.d.ts +4 -0
  151. package/dist/cli/main.d.ts.map +1 -0
  152. package/dist/cli/main.js +46 -0
  153. package/dist/cli/main.js.map +1 -0
  154. package/dist/core/errors.d.ts +84 -0
  155. package/dist/core/errors.d.ts.map +1 -0
  156. package/dist/core/errors.js +54 -0
  157. package/dist/core/errors.js.map +1 -0
  158. package/dist/core/events.d.ts +9 -0
  159. package/dist/core/events.d.ts.map +1 -0
  160. package/dist/core/events.js +21 -0
  161. package/dist/core/events.js.map +1 -0
  162. package/dist/core/hash.d.ts +10 -0
  163. package/dist/core/hash.d.ts.map +1 -0
  164. package/dist/core/hash.js +82 -0
  165. package/dist/core/hash.js.map +1 -0
  166. package/dist/core/ids.d.ts +10 -0
  167. package/dist/core/ids.d.ts.map +1 -0
  168. package/dist/core/ids.js +15 -0
  169. package/dist/core/ids.js.map +1 -0
  170. package/dist/deploy/index.d.ts +6 -0
  171. package/dist/deploy/index.d.ts.map +1 -0
  172. package/dist/deploy/index.js +6 -0
  173. package/dist/deploy/index.js.map +1 -0
  174. package/dist/dispatch/resumable.d.ts +85 -0
  175. package/dist/dispatch/resumable.d.ts.map +1 -0
  176. package/dist/dispatch/resumable.js +39 -0
  177. package/dist/dispatch/resumable.js.map +1 -0
  178. package/dist/dispatch/workflow.d.ts +6 -0
  179. package/dist/dispatch/workflow.d.ts.map +1 -0
  180. package/dist/dispatch/workflow.js +37 -0
  181. package/dist/dispatch/workflow.js.map +1 -0
  182. package/dist/domain/artifacts.d.ts +12 -0
  183. package/dist/domain/artifacts.d.ts.map +1 -0
  184. package/dist/domain/artifacts.js +14 -0
  185. package/dist/domain/artifacts.js.map +1 -0
  186. package/dist/domain/jobs.d.ts +12 -0
  187. package/dist/domain/jobs.d.ts.map +1 -0
  188. package/dist/domain/jobs.js +20 -0
  189. package/dist/domain/jobs.js.map +1 -0
  190. package/dist/domain/providers.d.ts +10 -0
  191. package/dist/domain/providers.d.ts.map +1 -0
  192. package/{domain → dist/domain}/providers.js +2 -2
  193. package/dist/domain/providers.js.map +1 -0
  194. package/dist/domain/runtime.d.ts +14 -0
  195. package/dist/domain/runtime.d.ts.map +1 -0
  196. package/{domain → dist/domain}/runtime.js +3 -3
  197. package/dist/domain/runtime.js.map +1 -0
  198. package/dist/domain/sessions.d.ts +12 -0
  199. package/dist/domain/sessions.d.ts.map +1 -0
  200. package/dist/domain/sessions.js +57 -0
  201. package/dist/domain/sessions.js.map +1 -0
  202. package/dist/examples/localjob.d.ts +2 -0
  203. package/dist/examples/localjob.d.ts.map +1 -0
  204. package/{examples → dist/examples}/localjob.js +1 -1
  205. package/dist/examples/localjob.js.map +1 -0
  206. package/dist/examples/publicapi.d.ts +2 -0
  207. package/dist/examples/publicapi.d.ts.map +1 -0
  208. package/{examples → dist/examples}/publicapi.js +1 -1
  209. package/dist/examples/publicapi.js.map +1 -0
  210. package/dist/extension/build.d.ts +9 -0
  211. package/dist/extension/build.d.ts.map +1 -0
  212. package/dist/extension/build.js +61 -0
  213. package/dist/extension/build.js.map +1 -0
  214. package/dist/extension/content.d.ts +6 -0
  215. package/dist/extension/content.d.ts.map +1 -0
  216. package/dist/extension/content.js +135 -0
  217. package/dist/extension/content.js.map +1 -0
  218. package/dist/extension/index.d.ts +7 -0
  219. package/dist/extension/index.d.ts.map +1 -0
  220. package/{extension → dist/extension}/index.js +1 -0
  221. package/dist/extension/index.js.map +1 -0
  222. package/dist/extension/pagebridge.d.ts +6 -0
  223. package/dist/extension/pagebridge.d.ts.map +1 -0
  224. package/dist/extension/pagebridge.js +42 -0
  225. package/dist/extension/pagebridge.js.map +1 -0
  226. package/dist/extension/permissions.d.ts +26 -0
  227. package/dist/extension/permissions.d.ts.map +1 -0
  228. package/dist/extension/permissions.js +28 -0
  229. package/dist/extension/permissions.js.map +1 -0
  230. package/dist/extension/popup.d.ts +5 -0
  231. package/dist/extension/popup.d.ts.map +1 -0
  232. package/dist/extension/popup.js +26 -0
  233. package/dist/extension/popup.js.map +1 -0
  234. package/dist/extension/protocol.d.ts +58 -0
  235. package/dist/extension/protocol.d.ts.map +1 -0
  236. package/dist/extension/protocol.js +101 -0
  237. package/dist/extension/protocol.js.map +1 -0
  238. package/dist/extension/serviceworker.d.ts +25 -0
  239. package/dist/extension/serviceworker.d.ts.map +1 -0
  240. package/dist/extension/serviceworker.js +102 -0
  241. package/dist/extension/serviceworker.js.map +1 -0
  242. package/dist/extension/worker.d.ts +28 -0
  243. package/dist/extension/worker.d.ts.map +1 -0
  244. package/dist/extension/worker.js +22 -0
  245. package/dist/extension/worker.js.map +1 -0
  246. package/dist/format/check.d.ts +8 -0
  247. package/dist/format/check.d.ts.map +1 -0
  248. package/dist/format/check.js +38 -0
  249. package/dist/format/check.js.map +1 -0
  250. package/dist/index.d.ts +117 -0
  251. package/dist/index.d.ts.map +1 -0
  252. package/{index.js → dist/index.js} +1 -0
  253. package/dist/index.js.map +1 -0
  254. package/dist/library/public.d.ts +53 -0
  255. package/dist/library/public.d.ts.map +1 -0
  256. package/dist/library/public.js +83 -0
  257. package/dist/library/public.js.map +1 -0
  258. package/dist/mcp/browser.d.ts +9 -0
  259. package/dist/mcp/browser.d.ts.map +1 -0
  260. package/dist/mcp/browser.js +13 -0
  261. package/dist/mcp/browser.js.map +1 -0
  262. package/dist/mcp/server.d.ts +35 -0
  263. package/dist/mcp/server.d.ts.map +1 -0
  264. package/dist/mcp/server.js +40 -0
  265. package/dist/mcp/server.js.map +1 -0
  266. package/dist/mcp/transport.d.ts +7 -0
  267. package/dist/mcp/transport.d.ts.map +1 -0
  268. package/dist/mcp/transport.js +17 -0
  269. package/dist/mcp/transport.js.map +1 -0
  270. package/dist/memory/bridge.d.ts +14 -0
  271. package/dist/memory/bridge.d.ts.map +1 -0
  272. package/dist/memory/bridge.js +16 -0
  273. package/dist/memory/bridge.js.map +1 -0
  274. package/dist/memory/engine.d.ts +28 -0
  275. package/dist/memory/engine.d.ts.map +1 -0
  276. package/dist/memory/engine.js +59 -0
  277. package/dist/memory/engine.js.map +1 -0
  278. package/dist/memory/modes.d.ts +43 -0
  279. package/dist/memory/modes.d.ts.map +1 -0
  280. package/dist/memory/modes.js +66 -0
  281. package/dist/memory/modes.js.map +1 -0
  282. package/dist/memory/objects.d.ts +21 -0
  283. package/dist/memory/objects.d.ts.map +1 -0
  284. package/dist/memory/objects.js +20 -0
  285. package/dist/memory/objects.js.map +1 -0
  286. package/dist/memory/targets.d.ts +78 -0
  287. package/dist/memory/targets.d.ts.map +1 -0
  288. package/dist/memory/targets.js +29 -0
  289. package/dist/memory/targets.js.map +1 -0
  290. package/dist/memory/transforms.d.ts +19 -0
  291. package/dist/memory/transforms.d.ts.map +1 -0
  292. package/dist/memory/transforms.js +14 -0
  293. package/dist/memory/transforms.js.map +1 -0
  294. package/dist/modes/matrix.d.ts +23 -0
  295. package/dist/modes/matrix.d.ts.map +1 -0
  296. package/{modes → dist/modes}/matrix.js +8 -10
  297. package/dist/modes/matrix.js.map +1 -0
  298. package/dist/modes/modes.d.ts +33 -0
  299. package/dist/modes/modes.d.ts.map +1 -0
  300. package/{modes → dist/modes}/modes.js +3 -4
  301. package/dist/modes/modes.js.map +1 -0
  302. package/dist/modes/resolve.d.ts +41 -0
  303. package/dist/modes/resolve.d.ts.map +1 -0
  304. package/dist/modes/resolve.js +39 -0
  305. package/dist/modes/resolve.js.map +1 -0
  306. package/dist/observability/metrics.d.ts +14 -0
  307. package/dist/observability/metrics.d.ts.map +1 -0
  308. package/dist/observability/metrics.js +18 -0
  309. package/dist/observability/metrics.js.map +1 -0
  310. package/dist/packager/manifest.d.ts +49 -0
  311. package/dist/packager/manifest.d.ts.map +1 -0
  312. package/dist/packager/manifest.js +49 -0
  313. package/dist/packager/manifest.js.map +1 -0
  314. package/dist/packager/publish.d.ts +51 -0
  315. package/dist/packager/publish.d.ts.map +1 -0
  316. package/dist/packager/publish.js +18 -0
  317. package/dist/packager/publish.js.map +1 -0
  318. package/dist/packager/targetcli.d.ts +7 -0
  319. package/dist/packager/targetcli.d.ts.map +1 -0
  320. package/dist/packager/targetcli.js +22 -0
  321. package/dist/packager/targetcli.js.map +1 -0
  322. package/dist/persistence/adapter.d.ts +5 -0
  323. package/dist/persistence/adapter.d.ts.map +1 -0
  324. package/dist/persistence/adapter.js +11 -0
  325. package/dist/persistence/adapter.js.map +1 -0
  326. package/dist/persistence/drizzle.d.ts +2 -0
  327. package/dist/persistence/drizzle.d.ts.map +1 -0
  328. package/dist/persistence/drizzle.js +12 -0
  329. package/dist/persistence/drizzle.js.map +1 -0
  330. package/dist/persistence/memory.d.ts +2 -0
  331. package/dist/persistence/memory.d.ts.map +1 -0
  332. package/dist/persistence/memory.js +27 -0
  333. package/dist/persistence/memory.js.map +1 -0
  334. package/dist/persistence/migrations.d.ts +19 -0
  335. package/dist/persistence/migrations.d.ts.map +1 -0
  336. package/{persistence → dist/persistence}/migrations.js +4 -5
  337. package/dist/persistence/migrations.js.map +1 -0
  338. package/dist/persistence/prisma.d.ts +2 -0
  339. package/dist/persistence/prisma.d.ts.map +1 -0
  340. package/dist/persistence/prisma.js +25 -0
  341. package/dist/persistence/prisma.js.map +1 -0
  342. package/dist/persistence/schema.d.ts +63 -0
  343. package/dist/persistence/schema.d.ts.map +1 -0
  344. package/dist/persistence/schema.js +28 -0
  345. package/dist/persistence/schema.js.map +1 -0
  346. package/dist/persistence/sql.d.ts +3 -0
  347. package/dist/persistence/sql.d.ts.map +1 -0
  348. package/dist/persistence/sql.js +37 -0
  349. package/dist/persistence/sql.js.map +1 -0
  350. package/dist/protocol/blocks.d.ts +10 -0
  351. package/dist/protocol/blocks.d.ts.map +1 -0
  352. package/dist/protocol/blocks.js +26 -0
  353. package/dist/protocol/blocks.js.map +1 -0
  354. package/dist/protocol/json.d.ts +6 -0
  355. package/dist/protocol/json.d.ts.map +1 -0
  356. package/{protocol → dist/protocol}/json.js +1 -0
  357. package/dist/protocol/json.js.map +1 -0
  358. package/dist/protocol/ndjson.d.ts +3 -0
  359. package/dist/protocol/ndjson.d.ts.map +1 -0
  360. package/dist/protocol/ndjson.js +20 -0
  361. package/dist/protocol/ndjson.js.map +1 -0
  362. package/dist/protocol/sse.d.ts +7 -0
  363. package/dist/protocol/sse.d.ts.map +1 -0
  364. package/dist/protocol/sse.js +25 -0
  365. package/dist/protocol/sse.js.map +1 -0
  366. package/dist/proxy/pool.d.ts +9 -0
  367. package/dist/proxy/pool.d.ts.map +1 -0
  368. package/dist/proxy/pool.js +27 -0
  369. package/dist/proxy/pool.js.map +1 -0
  370. package/dist/queue/idempotency.d.ts +10 -0
  371. package/dist/queue/idempotency.d.ts.map +1 -0
  372. package/dist/queue/idempotency.js +13 -0
  373. package/dist/queue/idempotency.js.map +1 -0
  374. package/dist/queue/persistent.d.ts +13 -0
  375. package/dist/queue/persistent.d.ts.map +1 -0
  376. package/dist/queue/persistent.js +49 -0
  377. package/dist/queue/persistent.js.map +1 -0
  378. package/dist/queue/queue.d.ts +7 -0
  379. package/dist/queue/queue.d.ts.map +1 -0
  380. package/dist/queue/queue.js +55 -0
  381. package/dist/queue/queue.js.map +1 -0
  382. package/dist/queue/saga.d.ts +5 -0
  383. package/dist/queue/saga.d.ts.map +1 -0
  384. package/dist/queue/saga.js +20 -0
  385. package/dist/queue/saga.js.map +1 -0
  386. package/dist/release/assets.d.ts +118 -0
  387. package/dist/release/assets.d.ts.map +1 -0
  388. package/dist/release/assets.js +69 -0
  389. package/dist/release/assets.js.map +1 -0
  390. package/dist/runners/health.d.ts +36 -0
  391. package/dist/runners/health.d.ts.map +1 -0
  392. package/dist/runners/health.js +26 -0
  393. package/dist/runners/health.js.map +1 -0
  394. package/dist/runners/heartbeat.d.ts +23 -0
  395. package/dist/runners/heartbeat.d.ts.map +1 -0
  396. package/dist/runners/heartbeat.js +29 -0
  397. package/dist/runners/heartbeat.js.map +1 -0
  398. package/dist/runners/inprocess.d.ts +17 -0
  399. package/dist/runners/inprocess.d.ts.map +1 -0
  400. package/dist/runners/inprocess.js +20 -0
  401. package/dist/runners/inprocess.js.map +1 -0
  402. package/dist/runners/scheduler.d.ts +5 -0
  403. package/dist/runners/scheduler.d.ts.map +1 -0
  404. package/dist/runners/scheduler.js +19 -0
  405. package/dist/runners/scheduler.js.map +1 -0
  406. package/dist/runtime/abort.d.ts +8 -0
  407. package/dist/runtime/abort.d.ts.map +1 -0
  408. package/dist/runtime/abort.js +13 -0
  409. package/dist/runtime/abort.js.map +1 -0
  410. package/dist/runtime/compatibility.d.ts +37 -0
  411. package/dist/runtime/compatibility.d.ts.map +1 -0
  412. package/{runtime → dist/runtime}/compatibility.js +1 -4
  413. package/dist/runtime/compatibility.js.map +1 -0
  414. package/dist/runtime/detect.d.ts +13 -0
  415. package/dist/runtime/detect.d.ts.map +1 -0
  416. package/dist/runtime/detect.js +18 -0
  417. package/dist/runtime/detect.js.map +1 -0
  418. package/dist/runtime/engine.d.ts +20 -0
  419. package/dist/runtime/engine.d.ts.map +1 -0
  420. package/dist/runtime/engine.js +61 -0
  421. package/dist/runtime/engine.js.map +1 -0
  422. package/dist/runtime/retry.d.ts +19 -0
  423. package/dist/runtime/retry.d.ts.map +1 -0
  424. package/dist/runtime/retry.js +54 -0
  425. package/dist/runtime/retry.js.map +1 -0
  426. package/dist/runtime/worker.d.ts +10 -0
  427. package/dist/runtime/worker.d.ts.map +1 -0
  428. package/dist/runtime/worker.js +25 -0
  429. package/dist/runtime/worker.js.map +1 -0
  430. package/dist/scrape/cache.d.ts +45 -0
  431. package/dist/scrape/cache.d.ts.map +1 -0
  432. package/dist/scrape/cache.js +45 -0
  433. package/dist/scrape/cache.js.map +1 -0
  434. package/dist/scrape/crawl.d.ts +47 -0
  435. package/dist/scrape/crawl.d.ts.map +1 -0
  436. package/dist/scrape/crawl.js +114 -0
  437. package/dist/scrape/crawl.js.map +1 -0
  438. package/dist/scrape/extract.d.ts +63 -0
  439. package/dist/scrape/extract.d.ts.map +1 -0
  440. package/dist/scrape/extract.js +47 -0
  441. package/dist/scrape/extract.js.map +1 -0
  442. package/dist/scrape/normalize.d.ts +52 -0
  443. package/dist/scrape/normalize.d.ts.map +1 -0
  444. package/dist/scrape/normalize.js +102 -0
  445. package/dist/scrape/normalize.js.map +1 -0
  446. package/dist/scrape/robots.d.ts +37 -0
  447. package/dist/scrape/robots.d.ts.map +1 -0
  448. package/dist/scrape/robots.js +71 -0
  449. package/dist/scrape/robots.js.map +1 -0
  450. package/dist/scrape/schema.d.ts +5 -0
  451. package/dist/scrape/schema.d.ts.map +1 -0
  452. package/dist/scrape/schema.js +25 -0
  453. package/dist/scrape/schema.js.map +1 -0
  454. package/dist/scrape/scraper.d.ts +6 -0
  455. package/dist/scrape/scraper.d.ts.map +1 -0
  456. package/dist/scrape/scraper.js +46 -0
  457. package/dist/scrape/scraper.js.map +1 -0
  458. package/dist/scrape/semantic.d.ts +25 -0
  459. package/dist/scrape/semantic.d.ts.map +1 -0
  460. package/dist/scrape/semantic.js +27 -0
  461. package/dist/scrape/semantic.js.map +1 -0
  462. package/dist/server/node.d.ts +7 -0
  463. package/dist/server/node.d.ts.map +1 -0
  464. package/dist/server/node.js +38 -0
  465. package/dist/server/node.js.map +1 -0
  466. package/dist/sessions/file.d.ts +25 -0
  467. package/dist/sessions/file.d.ts.map +1 -0
  468. package/dist/sessions/file.js +13 -0
  469. package/dist/sessions/file.js.map +1 -0
  470. package/dist/sessions/replay.d.ts +9 -0
  471. package/dist/sessions/replay.d.ts.map +1 -0
  472. package/dist/sessions/replay.js +70 -0
  473. package/dist/sessions/replay.js.map +1 -0
  474. package/dist/sessions/store.d.ts +25 -0
  475. package/dist/sessions/store.d.ts.map +1 -0
  476. package/dist/sessions/store.js +13 -0
  477. package/dist/sessions/store.js.map +1 -0
  478. package/dist/storage/adapter.d.ts +5 -0
  479. package/dist/storage/adapter.d.ts.map +1 -0
  480. package/dist/storage/adapter.js +11 -0
  481. package/dist/storage/adapter.js.map +1 -0
  482. package/dist/storage/cache.d.ts +23 -0
  483. package/dist/storage/cache.d.ts.map +1 -0
  484. package/dist/storage/cache.js +79 -0
  485. package/dist/storage/cache.js.map +1 -0
  486. package/dist/storage/checksum.d.ts +3 -0
  487. package/dist/storage/checksum.d.ts.map +1 -0
  488. package/dist/storage/checksum.js +19 -0
  489. package/dist/storage/checksum.js.map +1 -0
  490. package/dist/storage/chunked.d.ts +21 -0
  491. package/dist/storage/chunked.d.ts.map +1 -0
  492. package/dist/storage/chunked.js +67 -0
  493. package/dist/storage/chunked.js.map +1 -0
  494. package/dist/storage/content.d.ts +24 -0
  495. package/dist/storage/content.d.ts.map +1 -0
  496. package/dist/storage/content.js +44 -0
  497. package/dist/storage/content.js.map +1 -0
  498. package/dist/storage/filehosting.d.ts +2 -0
  499. package/dist/storage/filehosting.d.ts.map +1 -0
  500. package/dist/storage/filehosting.js +24 -0
  501. package/dist/storage/filehosting.js.map +1 -0
  502. package/dist/storage/githubcontents.d.ts +2 -0
  503. package/dist/storage/githubcontents.d.ts.map +1 -0
  504. package/dist/storage/githubcontents.js +29 -0
  505. package/dist/storage/githubcontents.js.map +1 -0
  506. package/dist/storage/index.d.ts +11 -0
  507. package/dist/storage/index.d.ts.map +1 -0
  508. package/{storage → dist/storage}/index.js +1 -0
  509. package/dist/storage/index.js.map +1 -0
  510. package/dist/storage/local.d.ts +2 -0
  511. package/dist/storage/local.d.ts.map +1 -0
  512. package/dist/storage/local.js +72 -0
  513. package/dist/storage/local.js.map +1 -0
  514. package/dist/storage/memory.d.ts +6 -0
  515. package/dist/storage/memory.d.ts.map +1 -0
  516. package/dist/storage/memory.js +36 -0
  517. package/dist/storage/memory.js.map +1 -0
  518. package/dist/storage/s3compatible.d.ts +2 -0
  519. package/dist/storage/s3compatible.d.ts.map +1 -0
  520. package/dist/storage/s3compatible.js +31 -0
  521. package/dist/storage/s3compatible.js.map +1 -0
  522. package/dist/storage/sync.d.ts +47 -0
  523. package/dist/storage/sync.d.ts.map +1 -0
  524. package/dist/storage/sync.js +75 -0
  525. package/dist/storage/sync.js.map +1 -0
  526. package/dist/surfaces/adapters.d.ts +97 -0
  527. package/dist/surfaces/adapters.d.ts.map +1 -0
  528. package/dist/surfaces/adapters.js +50 -0
  529. package/dist/surfaces/adapters.js.map +1 -0
  530. package/dist/surfaces/controls.d.ts +18 -0
  531. package/dist/surfaces/controls.d.ts.map +1 -0
  532. package/dist/surfaces/controls.js +45 -0
  533. package/dist/surfaces/controls.js.map +1 -0
  534. package/dist/surfaces/manifest.d.ts +68 -0
  535. package/dist/surfaces/manifest.d.ts.map +1 -0
  536. package/dist/surfaces/manifest.js +42 -0
  537. package/dist/surfaces/manifest.js.map +1 -0
  538. package/dist/surfaces/n8n.d.ts +25 -0
  539. package/dist/surfaces/n8n.d.ts.map +1 -0
  540. package/dist/surfaces/n8n.js +31 -0
  541. package/dist/surfaces/n8n.js.map +1 -0
  542. package/dist/surfaces/operations.d.ts +32 -0
  543. package/dist/surfaces/operations.d.ts.map +1 -0
  544. package/dist/surfaces/operations.js +53 -0
  545. package/dist/surfaces/operations.js.map +1 -0
  546. package/dist/surfaces/targets.d.ts +196 -0
  547. package/dist/surfaces/targets.d.ts.map +1 -0
  548. package/dist/surfaces/targets.js +27 -0
  549. package/dist/surfaces/targets.js.map +1 -0
  550. package/dist/webhook/delivery.d.ts +18 -0
  551. package/dist/webhook/delivery.d.ts.map +1 -0
  552. package/dist/webhook/delivery.js +36 -0
  553. package/dist/webhook/delivery.js.map +1 -0
  554. package/dist/webhook/receiver.d.ts +26 -0
  555. package/dist/webhook/receiver.d.ts.map +1 -0
  556. package/dist/webhook/receiver.js +24 -0
  557. package/dist/webhook/receiver.js.map +1 -0
  558. package/dist/webhook/signature.d.ts +3 -0
  559. package/dist/webhook/signature.d.ts.map +1 -0
  560. package/{webhook → dist/webhook}/signature.js +1 -1
  561. package/dist/webhook/signature.js.map +1 -0
  562. package/dist/workflow/manifest.d.ts +21 -0
  563. package/dist/workflow/manifest.d.ts.map +1 -0
  564. package/dist/workflow/manifest.js +20 -0
  565. package/dist/workflow/manifest.js.map +1 -0
  566. package/dist/workflow/registry.d.ts +7 -0
  567. package/dist/workflow/registry.d.ts.map +1 -0
  568. package/dist/workflow/registry.js +18 -0
  569. package/dist/workflow/registry.js.map +1 -0
  570. package/dist/workflow/templates.d.ts +6 -0
  571. package/dist/workflow/templates.d.ts.map +1 -0
  572. package/dist/workflow/templates.js +18 -0
  573. package/dist/workflow/templates.js.map +1 -0
  574. package/dist/workflow/triggers.d.ts +36 -0
  575. package/dist/workflow/triggers.d.ts.map +1 -0
  576. package/dist/workflow/triggers.js +33 -0
  577. package/dist/workflow/triggers.js.map +1 -0
  578. package/docs/enginearchitecture.md +2 -2
  579. package/docs/gapmatrix.md +2 -2
  580. package/docs/libraryapi.md +1 -1
  581. package/docs/release.md +5 -5
  582. package/docs/releaseassets.md +1 -1
  583. package/docs/reorganization-1.8.9.md +28 -0
  584. package/docs/toolchainresearch-1.8.9.md +18 -0
  585. package/extension/manifest.json +1 -1
  586. package/package.json +61 -88
  587. package/adapters/forge.js +0 -16
  588. package/adapters/github.js +0 -19
  589. package/adapters/gitlab.js +0 -10
  590. package/adapters/socket.js +0 -14
  591. package/adapters/transport.js +0 -30
  592. package/ai/chunk.js +0 -22
  593. package/ai/llmstxt.js +0 -12
  594. package/ai/provenance.js +0 -18
  595. package/ai/rag.js +0 -14
  596. package/api/auth.js +0 -13
  597. package/api/control.js +0 -33
  598. package/api/rate.js +0 -31
  599. package/api/security.js +0 -42
  600. package/api/service.js +0 -36
  601. package/binary/build.js +0 -17
  602. package/bot/adapter.js +0 -8
  603. package/bot/bot.js +0 -39
  604. package/bot/commands.js +0 -18
  605. package/bot/permissions.js +0 -16
  606. package/browser/actions.js +0 -33
  607. package/browser/agent.js +0 -9
  608. package/browser/context.js +0 -52
  609. package/browser/playwright.js +0 -22
  610. package/browser/recorder.js +0 -21
  611. package/browser/session.js +0 -19
  612. package/browser/snapshot.js +0 -57
  613. package/captcha/contract.js +0 -15
  614. package/captcha/evidence.js +0 -9
  615. package/captcha/guard.js +0 -10
  616. package/cli/main.js +0 -36
  617. package/core/errors.js +0 -57
  618. package/core/events.js +0 -21
  619. package/core/hash.js +0 -73
  620. package/core/ids.js +0 -15
  621. package/dispatch/resumable.js +0 -31
  622. package/dispatch/workflow.js +0 -33
  623. package/domain/artifacts.js +0 -13
  624. package/domain/jobs.js +0 -20
  625. package/domain/sessions.js +0 -46
  626. package/extension/build.js +0 -46
  627. package/extension/content.js +0 -127
  628. package/extension/pagebridge.js +0 -41
  629. package/extension/permissions.js +0 -22
  630. package/extension/popup.css +0 -13
  631. package/extension/popup.html +0 -24
  632. package/extension/popup.js +0 -25
  633. package/extension/protocol.js +0 -95
  634. package/extension/serviceworker.js +0 -109
  635. package/extension/worker.js +0 -22
  636. package/format/check.js +0 -21
  637. package/library/public.js +0 -85
  638. package/mcp/browser.js +0 -12
  639. package/mcp/server.js +0 -28
  640. package/mcp/transport.js +0 -14
  641. package/memory/bridge.js +0 -16
  642. package/memory/engine.js +0 -45
  643. package/memory/modes.js +0 -55
  644. package/memory/objects.js +0 -18
  645. package/memory/targets.js +0 -21
  646. package/memory/transforms.js +0 -15
  647. package/modes/resolve.js +0 -39
  648. package/packager/manifest.js +0 -28
  649. package/packager/publish.js +0 -15
  650. package/persistence/adapter.js +0 -8
  651. package/persistence/drizzle.js +0 -10
  652. package/persistence/memory.js +0 -26
  653. package/persistence/prisma.js +0 -23
  654. package/persistence/schema.js +0 -29
  655. package/persistence/sql.js +0 -30
  656. package/protocol/blocks.js +0 -18
  657. package/protocol/ndjson.js +0 -17
  658. package/protocol/sse.js +0 -22
  659. package/proxy/pool.js +0 -12
  660. package/queue/idempotency.js +0 -12
  661. package/queue/persistent.js +0 -44
  662. package/queue/queue.js +0 -50
  663. package/queue/saga.js +0 -13
  664. package/release/assets.js +0 -70
  665. package/runners/health.js +0 -23
  666. package/runners/heartbeat.js +0 -26
  667. package/runners/inprocess.js +0 -19
  668. package/runners/scheduler.js +0 -16
  669. package/runtime/abort.js +0 -10
  670. package/runtime/detect.js +0 -14
  671. package/runtime/engine.js +0 -56
  672. package/runtime/retry.js +0 -27
  673. package/runtime/worker.js +0 -18
  674. package/scrape/agent.ts +0 -122
  675. package/scrape/batch.ts +0 -79
  676. package/scrape/biome.json +0 -76
  677. package/scrape/browser.ts +0 -222
  678. package/scrape/cache.js +0 -14
  679. package/scrape/cache.ts +0 -84
  680. package/scrape/chunking.ts +0 -193
  681. package/scrape/cli.ts +0 -105
  682. package/scrape/crawl.js +0 -104
  683. package/scrape/crawler.ts +0 -115
  684. package/scrape/dev-server.ts +0 -94
  685. package/scrape/errors.ts +0 -132
  686. package/scrape/events.ts +0 -26
  687. package/scrape/extract.js +0 -14
  688. package/scrape/extract.ts +0 -165
  689. package/scrape/fetch.ts +0 -105
  690. package/scrape/formats.ts +0 -85
  691. package/scrape/headers.ts +0 -71
  692. package/scrape/index.ts +0 -92
  693. package/scrape/jsdom.d.ts +0 -6
  694. package/scrape/llms-txt.ts +0 -84
  695. package/scrape/middleware.ts +0 -90
  696. package/scrape/normalize.js +0 -86
  697. package/scrape/pool.ts +0 -95
  698. package/scrape/port.ts +0 -18
  699. package/scrape/proxy.ts +0 -103
  700. package/scrape/rate-limiter.ts +0 -95
  701. package/scrape/renderer.ts +0 -194
  702. package/scrape/retry.ts +0 -64
  703. package/scrape/robots.js +0 -32
  704. package/scrape/robots.ts +0 -137
  705. package/scrape/schema.js +0 -21
  706. package/scrape/scrape.ts +0 -123
  707. package/scrape/scraper.js +0 -40
  708. package/scrape/semantic.js +0 -22
  709. package/scrape/serialize.ts +0 -310
  710. package/scrape/server.ts +0 -137
  711. package/scrape/session.ts +0 -109
  712. package/scrape/sitemap.ts +0 -131
  713. package/scrape/tokens.ts +0 -45
  714. package/scrape/tsconfig.json +0 -28
  715. package/scrape/types.ts +0 -214
  716. package/scrape/utils.ts +0 -77
  717. package/scrape/vite.config.ts +0 -55
  718. package/scrape/vitest.config.ts +0 -17
  719. package/server/node.js +0 -34
  720. package/sessions/file.js +0 -13
  721. package/sessions/replay.js +0 -61
  722. package/sessions/store.js +0 -13
  723. package/storage/adapter.js +0 -8
  724. package/storage/cache.js +0 -54
  725. package/storage/checksum.js +0 -17
  726. package/storage/chunked.js +0 -58
  727. package/storage/content.js +0 -42
  728. package/storage/filehosting.js +0 -17
  729. package/storage/githubcontents.js +0 -18
  730. package/storage/local.js +0 -35
  731. package/storage/memory.js +0 -28
  732. package/storage/s3compatible.js +0 -23
  733. package/storage/sync.js +0 -55
  734. package/surfaces/adapters.js +0 -48
  735. package/surfaces/controls.js +0 -37
  736. package/surfaces/manifest.js +0 -25
  737. package/surfaces/n8n.js +0 -24
  738. package/surfaces/operations.js +0 -43
  739. package/surfaces/targets.js +0 -16
  740. package/webhook/delivery.js +0 -26
  741. package/webhook/receiver.js +0 -20
  742. package/workflow/manifest.js +0 -20
  743. package/workflow/registry.js +0 -16
  744. package/workflow/templates.js +0 -18
  745. package/workflow/triggers.js +0 -31
package/scrape/index.ts DELETED
@@ -1,92 +0,0 @@
1
- // ─── Core Scraping ───
2
- export { AgentBrowser, createBrowser } from './browser.js';
3
- export { scrapeUrl, scrapeHtml, scrapeWithBrowser } from './scrape.js';
4
- export { extractContent, extractReadable } from './extract.js';
5
- export type { ExtractedContent } from './extract.js';
6
- export { fetchHtml, fetchAndParse, detectRenderingMode } from './fetch.js';
7
- export type { FetchResult } from './fetch.js';
8
-
9
- // ─── Serialization ───
10
- export { serializeResult, serializeHtml } from './serialize.js';
11
- export { resolveFormat, formatFromExtension, extensionForFormat, buildSerializeOptions, convertResult } from './formats.js';
12
-
13
- // ─── Renderer ───
14
- export { PygameRenderer, createRenderer } from './renderer.js';
15
-
16
- // ─── AI/LLM ───
17
- export { formatForAgent, buildContext } from './agent.js';
18
- export { estimateTokens, countTokens, fitsInContext, truncateToTokens, tokenCost } from './tokens.js';
19
- export type { ModelType } from './tokens.js';
20
- export { chunkMarkdown, chunkText, formatChunksForRAG } from './chunking.js';
21
- export type { Chunk, ChunkOptions } from './chunking.js';
22
- export { generateLlmsTxt, generateLlmsFullTxt } from './llms-txt.js';
23
- export type { LlmsTxtOptions } from './llms-txt.js';
24
-
25
- // ─── Infrastructure ───
26
- export { WebScrapeError, ValidationError, TimeoutError, BlockedError, RateLimitError, ProxyError, ParseError, AuthError, NetworkError, BrowserNotAvailableError } from './errors.js';
27
- export type { ErrorCode } from './errors.js';
28
- export { createEventEmitter, globalEmitter } from './events.js';
29
- export type { WebScrapeEvents, EventEmitter } from './events.js';
30
- export { withRetry, isRetryableError, AbortError } from './retry.js';
31
- export { RateLimiter, createRateLimiter } from './rate-limiter.js';
32
- export type { RateLimiterConfig } from './rate-limiter.js';
33
- export { ProxyPool, createProxyPool } from './proxy.js';
34
- export type { ProxyPoolConfig, ProxyRotationStrategy } from './proxy.js';
35
- export { CookieJar, ScrapingSession, createSession } from './session.js';
36
- export type { Cookie } from './session.js';
37
- export { getRandomProfile, getHeaders, mergeHeaders } from './headers.js';
38
- export type { HeaderProfile } from './headers.js';
39
- export { WebScrapeCache, createCache } from './cache.js';
40
- export type { CacheConfig, CacheEntry } from './cache.js';
41
- export { MiddlewarePipeline, createPipeline, loggingMiddleware, timeoutMiddleware, retryMiddleware } from './middleware.js';
42
- export type { Middleware, MiddlewareContext, MiddlewareNext } from './middleware.js';
43
-
44
- // ─── Crawling ───
45
- export { crawl } from './crawler.js';
46
- export type { CrawlOptions } from './crawler.js';
47
- export { fetchSitemap, discoverSitemaps, parseSitemap } from './sitemap.js';
48
- export type { SitemapUrl, SitemapResult } from './sitemap.js';
49
- export { fetchRobotsTxt, isAllowed, getCrawlDelay, getSitemaps } from './robots.js';
50
- export type { RobotsTxt, RobotsDirective } from './robots.js';
51
-
52
- // ─── Batch & Pool ───
53
- export { batchScrape, batchScrapeSequential } from './batch.js';
54
- export type { BatchResult } from './batch.js';
55
- export { BrowserPool, createPool } from './pool.js';
56
- export type { PoolConfig } from './pool.js';
57
-
58
- // ─── Server ───
59
- export { createServer, app } from './server.js';
60
- export type { ServerConfig } from './server.js';
61
-
62
- // ─── Utilities ───
63
- export { ensureDir, writeOutput, slugify, truncate, chunkText as chunkTextUtil, delay, isValidUrl, normalizeUrl, isInternalUrl } from './utils.js';
64
- export { randomPort, resetPort } from './utils/port.js';
65
-
66
- // ─── Types ───
67
- export {
68
- ScrapeOptionsSchema,
69
- BrowserAgentConfigSchema,
70
- } from './types.js';
71
- export type {
72
- ScrapeFormat,
73
- SerializeTarget,
74
- ScrapeOptions,
75
- ScrapeResult,
76
- PageMetadata,
77
- LinkInfo,
78
- ImageInfo,
79
- TableInfo,
80
- BrowserAgentConfig,
81
- ExtractOptions,
82
- SerializeOptions,
83
- SerializedOutput,
84
- AgentOutput,
85
- RenderOptions,
86
- ChromeCommand,
87
- CliOptions,
88
- RetryConfig,
89
- ProxyConfig,
90
- CrawlStats,
91
- BatchOptions,
92
- } from './types.js';
package/scrape/jsdom.d.ts DELETED
@@ -1,6 +0,0 @@
1
- declare module 'jsdom' {
2
- export class JSDOM {
3
- constructor(html?: string, options?: Record<string, unknown>);
4
- window: Window;
5
- }
6
- }
@@ -1,84 +0,0 @@
1
- import type { ScrapeResult } from './types.js';
2
-
3
- export interface LlmsTxtOptions {
4
- siteName?: string;
5
- description?: string;
6
- includeOptional?: boolean;
7
- }
8
-
9
- export function generateLlmsTxt(
10
- results: ScrapeResult[],
11
- options: LlmsTxtOptions = {}
12
- ): string {
13
- const siteName = options.siteName || results[0]?.metadata?.title || 'Site';
14
- const description = options.description || results[0]?.metadata?.description || '';
15
-
16
- const lines: string[] = [];
17
- lines.push(`# ${siteName}`);
18
- lines.push('');
19
- if (description) {
20
- lines.push(`> ${description}`);
21
- lines.push('');
22
- }
23
-
24
- const pages: ScrapeResult[] = [];
25
- const docs: ScrapeResult[] = [];
26
-
27
- for (const result of results) {
28
- const url = result.url.toLowerCase();
29
- if (url.includes('doc') || url.includes('guide') || url.includes('api')) {
30
- docs.push(result);
31
- } else {
32
- pages.push(result);
33
- }
34
- }
35
-
36
- if (pages.length > 0) {
37
- lines.push('## Pages');
38
- lines.push('');
39
- for (const page of pages.slice(0, 20)) {
40
- const title = page.metadata.title || page.title;
41
- const desc = page.metadata.description || '';
42
- lines.push(`- ${title}: ${desc || page.url}`);
43
- }
44
- lines.push('');
45
- }
46
-
47
- if (docs.length > 0) {
48
- lines.push('## Documentation');
49
- lines.push('');
50
- for (const doc of docs.slice(0, 20)) {
51
- const title = doc.metadata.title || doc.title;
52
- const desc = doc.metadata.description || '';
53
- lines.push(`- ${title}: ${desc || doc.url}`);
54
- }
55
- lines.push('');
56
- }
57
-
58
- if (options.includeOptional && results.length > 5) {
59
- lines.push('## Optional');
60
- lines.push('');
61
- lines.push(`- Full content: ${results.length} pages scraped`);
62
- lines.push(`- Last updated: ${new Date().toISOString().split('T')[0]}`);
63
- lines.push('');
64
- }
65
-
66
- return lines.join('\n');
67
- }
68
-
69
- export function generateLlmsFullTxt(results: ScrapeResult[]): string {
70
- const parts: string[] = [];
71
-
72
- for (const result of results) {
73
- parts.push(`# ${result.title || result.metadata.title || 'Untitled'}`);
74
- parts.push('');
75
- parts.push(`Source: ${result.url}`);
76
- parts.push('');
77
- parts.push(result.content);
78
- parts.push('');
79
- parts.push('---');
80
- parts.push('');
81
- }
82
-
83
- return parts.join('\n');
84
- }
@@ -1,90 +0,0 @@
1
- export interface MiddlewareContext<T = Record<string, unknown>> {
2
- data: T;
3
- state: Record<string, unknown>;
4
- startTime: number;
5
- aborted: boolean;
6
- abort(): void;
7
- }
8
-
9
- export type MiddlewareNext = () => Promise<void>;
10
- export type Middleware<T = Record<string, unknown>> = (
11
- ctx: MiddlewareContext<T>,
12
- next: MiddlewareNext
13
- ) => Promise<void>;
14
-
15
- export class MiddlewarePipeline<T = Record<string, unknown>> {
16
- private middlewares: Middleware<T>[] = [];
17
-
18
- use(middleware: Middleware<T>): this {
19
- this.middlewares.push(middleware);
20
- return this;
21
- }
22
-
23
- async execute(initialData: T): Promise<MiddlewareContext<T>> {
24
- const ctx: MiddlewareContext<T> = {
25
- data: initialData,
26
- state: {},
27
- startTime: Date.now(),
28
- aborted: false,
29
- abort() { this.aborted = true; },
30
- };
31
-
32
- let index = 0;
33
-
34
- const next = async (): Promise<void> => {
35
- if (ctx.aborted) return;
36
- if (index < this.middlewares.length) {
37
- const middleware = this.middlewares[index++];
38
- await middleware(ctx, next);
39
- }
40
- };
41
-
42
- await next();
43
- return ctx;
44
- }
45
-
46
- clear(): void {
47
- this.middlewares = [];
48
- }
49
- }
50
-
51
- export function loggingMiddleware(logger?: { info: (msg: string) => void }): Middleware {
52
- return async (_ctx, next) => {
53
- const start = Date.now();
54
- await next();
55
- const duration = Date.now() - start;
56
- logger?.info(`Request completed in ${duration}ms`);
57
- };
58
- }
59
-
60
- export function timeoutMiddleware(timeoutMs: number): Middleware {
61
- return async (ctx, next) => {
62
- const timer = setTimeout(() => ctx.abort(), timeoutMs);
63
- try {
64
- await next();
65
- } finally {
66
- clearTimeout(timer);
67
- }
68
- };
69
- }
70
-
71
- export function retryMiddleware(maxRetries: number, delayMs: number): Middleware {
72
- return async (ctx, next) => {
73
- let attempt = 0;
74
- while (attempt <= maxRetries) {
75
- ctx.state.attempt = attempt;
76
- try {
77
- await next();
78
- return;
79
- } catch (error) {
80
- if (attempt === maxRetries) throw error;
81
- await new Promise(r => setTimeout(r, delayMs * Math.pow(2, attempt)));
82
- attempt++;
83
- }
84
- }
85
- };
86
- }
87
-
88
- export function createPipeline<T = Record<string, unknown>>(): MiddlewarePipeline<T> {
89
- return new MiddlewarePipeline<T>();
90
- }
@@ -1,86 +0,0 @@
1
- /**
2
- * content normalization classifies bounded response bytes without owning a parser, transport or storage backend.
3
- */
4
-
5
- const extensions = Object.freeze({
6
- ".json": "application/json",
7
- ".map": "application/json",
8
- ".xml": "application/xml",
9
- ".rss": "application/rss+xml",
10
- ".atom": "application/atom+xml",
11
- ".md": "text/markdown",
12
- ".markdown": "text/markdown",
13
- ".html": "text/html",
14
- ".htm": "text/html",
15
- ".txt": "text/plain",
16
- ".csv": "text/csv"
17
- });
18
-
19
- /** Detects a normalized media type from a header, URL suffix or caller fallback. */
20
- export function detectcontenttype(header, url, fallback = "application/octet-stream") {
21
- const value = String(header ?? "").split(";", 1)[0].trim().toLowerCase();
22
- if (value) return value;
23
- try {
24
- const pathname = new URL(url).pathname.toLowerCase();
25
- const suffix = Object.keys(extensions).find((extension) => pathname.endsWith(extension));
26
- if (suffix) return extensions[suffix];
27
- } catch { /* invalid or absent URLs remain caller-owned metadata */ }
28
- return String(fallback).toLowerCase();
29
- }
30
-
31
- /** Normalizes bounded input bytes into a serializable text, JSON or binary result. */
32
- export function normalizeresult(input, options = {}) {
33
- const contenttype = detectcontenttype(options.contenttype, options.url, options.defaultcontenttype ?? "application/octet-stream");
34
- const bytes = tobytes(input);
35
- const maxbytes = boundedlimit(options.maxbytes, 2_000_000);
36
- if (bytes.byteLength > maxbytes) throw normalizationerror("CONTENT_TOO_LARGE", `content exceeds ${maxbytes} bytes`);
37
- const kind = contentkind(contenttype);
38
- if (kind === "binary") return { contenttype, kind, size: bytes.byteLength, bytes };
39
- const text = new TextDecoder(options.charset ?? "utf-8", { fatal: false }).decode(bytes).replaceAll("\r\n", "\n");
40
- if (text.length > boundedlimit(options.maxtext, maxbytes)) throw normalizationerror("TEXT_TOO_LARGE", "decoded content exceeds the configured text limit");
41
- if (kind === "json") {
42
- try { return { contenttype, kind, size: bytes.byteLength, content: text, data: JSON.parse(text) }; } catch (error) { throw normalizationerror("INVALID_JSON", `invalid JSON content: ${error.message}`); }
43
- }
44
- return { contenttype, kind, size: bytes.byteLength, content: text };
45
- }
46
-
47
- /** Reads a caller-provided response body after checking declared and actual size limits. */
48
- export async function normalizeresponse(response, options = {}) {
49
- if (!response || typeof response !== "object") throw new TypeError("response is required");
50
- const headers = response.headers;
51
- const header = typeof headers?.get === "function" ? headers.get("content-type") : headers?.["content-type"];
52
- const declared = Number(typeof headers?.get === "function" ? headers.get("content-length") : headers?.["content-length"]);
53
- const maxbytes = boundedlimit(options.maxbytes, 2_000_000);
54
- if (Number.isFinite(declared) && declared > maxbytes) throw normalizationerror("CONTENT_TOO_LARGE", `content exceeds ${maxbytes} bytes`);
55
- const body = typeof response.arrayBuffer === "function" ? await response.arrayBuffer() : await response.text();
56
- return normalizeresult(body, { ...options, contenttype: header ?? options.contenttype, url: options.url ?? response.url });
57
- }
58
-
59
- function contentkind(contenttype) {
60
- if (contenttype === "application/json" || contenttype.endsWith("+json")) return "json";
61
- if (contenttype === "text/html" || contenttype === "application/xhtml+xml") return "html";
62
- if (contenttype === "application/xml" || contenttype === "text/xml" || contenttype.endsWith("+xml")) return "xml";
63
- if (contenttype === "text/markdown") return "markdown";
64
- if (contenttype.startsWith("text/")) return "text";
65
- return "binary";
66
- }
67
-
68
- function tobytes(input) {
69
- if (typeof input === "string") return new TextEncoder().encode(input);
70
- if (input instanceof Uint8Array) return input;
71
- if (input instanceof ArrayBuffer) return new Uint8Array(input);
72
- if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
73
- throw new TypeError("content must be a string, ArrayBuffer or typed array");
74
- }
75
-
76
- function boundedlimit(value, fallback) {
77
- const limit = Number(value ?? fallback);
78
- if (!Number.isSafeInteger(limit) || limit < 1) throw new TypeError("content limit must be a positive safe integer");
79
- return limit;
80
- }
81
-
82
- function normalizationerror(code, message) {
83
- const error = new Error(message);
84
- error.code = code;
85
- return error;
86
- }
package/scrape/pool.ts DELETED
@@ -1,95 +0,0 @@
1
- import { AgentBrowser } from './browser.js';
2
- import type { BrowserAgentConfig } from './types.js';
3
-
4
- export interface PoolConfig {
5
- maxSize?: number;
6
- acquireTimeoutMs?: number;
7
- }
8
-
9
- interface PoolEntry {
10
- browser: AgentBrowser;
11
- inUse: boolean;
12
- createdAt: number;
13
- }
14
-
15
- export class BrowserPool {
16
- private pool: PoolEntry[] = [];
17
- private waitQueue: Array<(browser: AgentBrowser) => void> = [];
18
- private config: Required<PoolConfig>;
19
- private browserConfig: BrowserAgentConfig;
20
-
21
- constructor(config: PoolConfig = {}, browserConfig: BrowserAgentConfig = {}) {
22
- this.config = {
23
- maxSize: config.maxSize || 3,
24
- acquireTimeoutMs: config.acquireTimeoutMs || 30000,
25
- };
26
- this.browserConfig = browserConfig;
27
- }
28
-
29
- async acquire(): Promise<AgentBrowser> {
30
- const idle = this.pool.find(e => !e.inUse && e.browser.isConnected());
31
- if (idle) {
32
- idle.inUse = true;
33
- return idle.browser;
34
- }
35
-
36
- if (this.pool.length < this.config.maxSize) {
37
- const browser = new AgentBrowser(this.browserConfig);
38
- await browser.launch();
39
- const entry: PoolEntry = { browser, inUse: true, createdAt: Date.now() };
40
- this.pool.push(entry);
41
- return browser;
42
- }
43
-
44
- return new Promise<AgentBrowser>((resolve, reject) => {
45
- const timeout = setTimeout(() => {
46
- const idx = this.waitQueue.indexOf(waiter);
47
- if (idx !== -1) this.waitQueue.splice(idx, 1);
48
- reject(new Error('Timeout waiting for browser'));
49
- }, this.config.acquireTimeoutMs);
50
-
51
- const waiter = (browser: AgentBrowser) => {
52
- clearTimeout(timeout);
53
- resolve(browser);
54
- };
55
- this.waitQueue.push(waiter);
56
- });
57
- }
58
-
59
- release(browser: AgentBrowser): void {
60
- const entry = this.pool.find(e => e.browser === browser);
61
- if (entry) {
62
- entry.inUse = false;
63
-
64
- if (this.waitQueue.length > 0) {
65
- const waiter = this.waitQueue.shift()!;
66
- entry.inUse = true;
67
- waiter(browser);
68
- }
69
- }
70
- }
71
-
72
- async destroy(): Promise<void> {
73
- for (const entry of this.pool) {
74
- await entry.browser.close().catch(() => {});
75
- }
76
- this.pool = [];
77
- for (const waiter of this.waitQueue) {
78
- waiter(new AgentBrowser());
79
- }
80
- this.waitQueue = [];
81
- }
82
-
83
- getStatus(): { total: number; idle: number; inUse: number; waiting: number } {
84
- return {
85
- total: this.pool.length,
86
- idle: this.pool.filter(e => !e.inUse).length,
87
- inUse: this.pool.filter(e => e.inUse).length,
88
- waiting: this.waitQueue.length,
89
- };
90
- }
91
- }
92
-
93
- export function createPool(config?: PoolConfig, browserConfig?: BrowserAgentConfig): BrowserPool {
94
- return new BrowserPool(config, browserConfig);
95
- }
package/scrape/port.ts DELETED
@@ -1,18 +0,0 @@
1
- /**
2
- * Generate a random port number in the ephemeral port range (1024-65535).
3
- * The port is calculated once and then fixed for the lifetime of the process.
4
- */
5
- let _cachedPort: number | null = null;
6
-
7
- export function randomPort(): number {
8
- if (_cachedPort !== null) return _cachedPort;
9
- _cachedPort = Math.floor(Math.random() * 64511) + 1024;
10
- return _cachedPort;
11
- }
12
-
13
- /**
14
- * Reset the cached port (for testing).
15
- */
16
- export function resetPort(): void {
17
- _cachedPort = null;
18
- }
package/scrape/proxy.ts DELETED
@@ -1,103 +0,0 @@
1
- import type { ProxyConfig } from './types.js';
2
-
3
- interface ProxyStats {
4
- failures: number;
5
- successes: number;
6
- consecutiveFailures: number;
7
- lastFailure?: number;
8
- lastSuccess?: number;
9
- disabled: boolean;
10
- disabledAt?: number;
11
- }
12
-
13
- export type ProxyRotationStrategy = 'round-robin' | 'random';
14
-
15
- export interface ProxyPoolConfig {
16
- maxFailures?: number;
17
- reviveAfterMs?: number;
18
- strategy?: ProxyRotationStrategy;
19
- }
20
-
21
- const DEFAULT_POOL_CONFIG: Required<ProxyPoolConfig> = {
22
- maxFailures: 3,
23
- reviveAfterMs: 30 * 60 * 1000,
24
- strategy: 'round-robin',
25
- };
26
-
27
- export class ProxyPool {
28
- private proxies: ProxyConfig[];
29
- private stats = new Map<string, ProxyStats>();
30
- private currentIndex = 0;
31
- private config: Required<ProxyPoolConfig>;
32
-
33
- constructor(proxies: ProxyConfig[], config: Partial<ProxyPoolConfig> = {}) {
34
- this.proxies = proxies;
35
- this.config = { ...DEFAULT_POOL_CONFIG, ...config };
36
- for (const p of proxies) {
37
- this.stats.set(p.url, { failures: 0, successes: 0, consecutiveFailures: 0, disabled: false });
38
- }
39
- }
40
-
41
- private getActiveProxies(): ProxyConfig[] {
42
- const now = Date.now();
43
- return this.proxies.filter(p => {
44
- const s = this.stats.get(p.url);
45
- if (!s) return true;
46
- if (s.disabled && s.disabledAt && (now - s.disabledAt) >= this.config.reviveAfterMs) {
47
- s.disabled = false;
48
- s.failures = 0;
49
- s.consecutiveFailures = 0;
50
- return true;
51
- }
52
- return !s.disabled;
53
- });
54
- }
55
-
56
- next(): ProxyConfig | null {
57
- const active = this.getActiveProxies();
58
- if (active.length === 0) return null;
59
-
60
- if (this.config.strategy === 'random') {
61
- return active[Math.floor(Math.random() * active.length)];
62
- }
63
-
64
- const proxy = active[this.currentIndex % active.length];
65
- this.currentIndex = (this.currentIndex + 1) % active.length;
66
- return proxy;
67
- }
68
-
69
- reportSuccess(proxy: ProxyConfig): void {
70
- const s = this.stats.get(proxy.url);
71
- if (s) {
72
- s.successes++;
73
- s.consecutiveFailures = 0;
74
- s.lastSuccess = Date.now();
75
- }
76
- }
77
-
78
- reportFailure(proxy: ProxyConfig): void {
79
- const s = this.stats.get(proxy.url);
80
- if (s) {
81
- s.failures++;
82
- s.consecutiveFailures++;
83
- s.lastFailure = Date.now();
84
- if (s.consecutiveFailures >= this.config.maxFailures) {
85
- s.disabled = true;
86
- s.disabledAt = Date.now();
87
- }
88
- }
89
- }
90
-
91
- getStatus(): { total: number; active: number; disabled: number } {
92
- const active = this.getActiveProxies();
93
- return {
94
- total: this.proxies.length,
95
- active: active.length,
96
- disabled: this.proxies.length - active.length,
97
- };
98
- }
99
- }
100
-
101
- export function createProxyPool(proxies: ProxyConfig[], config?: Partial<ProxyPoolConfig>): ProxyPool {
102
- return new ProxyPool(proxies, config);
103
- }
@@ -1,95 +0,0 @@
1
- interface TokenBucket {
2
- tokens: number;
3
- lastRefill: number;
4
- maxTokens: number;
5
- refillRate: number;
6
- }
7
-
8
- export interface RateLimiterConfig {
9
- maxTokensPerInterval: number;
10
- intervalMs: number;
11
- maxConcurrent?: number;
12
- }
13
-
14
- const DEFAULT_CONFIG: Required<RateLimiterConfig> = {
15
- maxTokensPerInterval: 10,
16
- intervalMs: 1000,
17
- maxConcurrent: 5,
18
- };
19
-
20
- export class RateLimiter {
21
- private buckets = new Map<string, TokenBucket>();
22
- private active = new Map<string, number>();
23
- private config: Required<RateLimiterConfig>;
24
-
25
- constructor(config: Partial<RateLimiterConfig> = {}) {
26
- this.config = { ...DEFAULT_CONFIG, ...config };
27
- }
28
-
29
- private getBucket(key: string): TokenBucket {
30
- if (!this.buckets.has(key)) {
31
- this.buckets.set(key, {
32
- tokens: this.config.maxTokensPerInterval,
33
- lastRefill: Date.now(),
34
- maxTokens: this.config.maxTokensPerInterval,
35
- refillRate: this.config.maxTokensPerInterval / (this.config.intervalMs / 1000),
36
- });
37
- }
38
- return this.buckets.get(key)!;
39
- }
40
-
41
- private refill(bucket: TokenBucket): void {
42
- const now = Date.now();
43
- const elapsed = (now - bucket.lastRefill) / 1000;
44
- bucket.tokens = Math.min(bucket.maxTokens, bucket.tokens + elapsed * bucket.refillRate);
45
- bucket.lastRefill = now;
46
- }
47
-
48
- async acquire(key: string): Promise<void> {
49
- const bucket = this.getBucket(key);
50
- const currentActive = this.active.get(key) || 0;
51
-
52
- if (currentActive >= this.config.maxConcurrent) {
53
- await new Promise((resolve) => setTimeout(resolve, 100));
54
- return this.acquire(key);
55
- }
56
-
57
- this.refill(bucket);
58
-
59
- if (bucket.tokens < 1) {
60
- const waitMs = ((1 - bucket.tokens) / bucket.refillRate) * 1000;
61
- await new Promise((resolve) => setTimeout(resolve, Math.ceil(waitMs)));
62
- this.refill(bucket);
63
- }
64
-
65
- bucket.tokens -= 1;
66
- this.active.set(key, currentActive + 1);
67
- }
68
-
69
- release(key: string): void {
70
- const current = this.active.get(key) || 0;
71
- if (current <= 1) {
72
- this.active.delete(key);
73
- } else {
74
- this.active.set(key, current - 1);
75
- }
76
- }
77
-
78
- getStats(key: string): { tokens: number; active: number } {
79
- const bucket = this.buckets.get(key);
80
- if (bucket) this.refill(bucket);
81
- return {
82
- tokens: bucket?.tokens ?? this.config.maxTokensPerInterval,
83
- active: this.active.get(key) || 0,
84
- };
85
- }
86
-
87
- clear(): void {
88
- this.buckets.clear();
89
- this.active.clear();
90
- }
91
- }
92
-
93
- export function createRateLimiter(config?: Partial<RateLimiterConfig>): RateLimiter {
94
- return new RateLimiter(config);
95
- }