[SCR-383] Auto-Mode (mode=auto) support#24
Open
kostas-jakeliunas-sb wants to merge 1 commit into
Open
Conversation
Adds discoverability + docs for the server-side Auto-Mode feature (mode=auto): server picks the cheapest scraping config that succeeds, charges only the winning config. The SDK is pass-through, so the params already work on the wire; this surfaces them for autocomplete and docs. - src/index.ts: add `mode?: 'auto'` and `max_cost?: number` to the HtmlApiParams type (index signature already permitted them; this is pure additive for autocomplete/discoverability). - README.md: new "Auto-Mode" subsection in the HTML API section with a GET example and a note on reading the `spb-auto-cost` response header (axios lowercases header keys), plus GET-only / max_cost / param incompatibility caveats. - CHANGELOG.md: 1.8.3 entry. - package.json: 1.8.2 -> 1.8.3 (prebuild synced src/version.ts). - dist/: rebuilt committed output (npm run build) for the new type + version. Tests: 67 passing (mocha, mocked). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
marius-nemeiksis-sbee
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tl;dr
Adds Auto-Mode (
mode=auto) discoverability + docs to the Node SDK. The SDK is pass-through so the params already work on the wire today — this surfaces them for TypeScript autocomplete and documents the feature (including the under-documentedspb-auto-costresponse header). Version bumped 1.8.2 → 1.8.3,dist/rebuilt and committed. 67 tests green.Summary
src/index.ts— addedmode?: 'auto'andmax_cost?: numberto theHtmlApiParamstype. Pure additive: the type's index signature ({ [key: string]: any }) already permitted these params, so no runtime change — this is for autocomplete/discoverability, consistent with how all other known params are enumerated.README.md— new "Auto-Mode" subsection in the HTML API section (after the GET example) with ahtmlApi()GET example, a line showing how to read the credits charged viaresponse.headers['spb-auto-cost'](axios lowercases header keys — under-documented today), and caveats: GET only,max_costoptional (omit = uncapped), don't combinemode:'auto'withrender_js/premium_proxy/stealth_proxy.CHANGELOG.md— added a 1.8.3 entry.package.json— version 1.8.2 → 1.8.3 (prebuildre-syncedsrc/version.ts).dist/— rebuilt committed output vianpm run build(dist/index.d.tshas the new type fields;dist/version.{js,d.ts}reflect 1.8.3).dist/is committed in this repo, so it's included in the PR.Note: incidental
package-lock.jsonchurn fromnpm install(npm adding"peer": trueannotations) was reverted to keep the diff focused — no dependency changes in this PR.Client contract (server already shipped, beta, flag-gated)
mode=auto: server tries cheap→expensive configs, stops at first success, charges only the winning config (0 credits if all fail).max_cost(int ≥ 1, optional, requiresmode=auto): caps the credits a request may cost; omit = uncapped.Spb-auto-cost= credits charged for the winning config.Test plan
npm installnpm run build—prebuildsyncssrc/version.tsto 1.8.3,tsccompiles;dist/updated and stagednpm test— 67 passing (mocha + axios-mock-adapter, mocked; no network)dist/index.d.tscontainsmode?: 'auto'andmax_cost?: numberpackage.json+src/version.ts+dist/version.{js,d.ts}all at 1.8.3🤖 Generated with Claude Code