Merge branch 'codex/simp-prune-web-seam-fields' into codex/simp-hide-web-provider-helpers
# Conflicts: # docs/config-catalog.md
This commit is contained in:
@@ -1059,7 +1059,7 @@ export interface Config {
|
|||||||
maxResponseBytes?: number
|
maxResponseBytes?: number
|
||||||
/** Maximum decoded body length in characters. */
|
/** Maximum decoded body length in characters. */
|
||||||
maxBodyChars?: number
|
maxBodyChars?: number
|
||||||
/** Default fetch timeout in milliseconds. */
|
/** Default fetch timeout in milliseconds, within Node's timer range. */
|
||||||
timeoutMs?: number
|
timeoutMs?: number
|
||||||
/** Maximum number of same-origin redirect hops to follow. */
|
/** Maximum number of same-origin redirect hops to follow. */
|
||||||
maxRedirects?: number
|
maxRedirects?: number
|
||||||
@@ -1068,7 +1068,7 @@ export interface Config {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Source: [`packages/web/web-fetch-local/src/index.ts:32`](../packages/web/web-fetch-local/src/index.ts)
|
Source: [`packages/web/web-fetch-local/src/index.ts:34`](../packages/web/web-fetch-local/src/index.ts)
|
||||||
|
|
||||||
## `@deepseek-ai/dsh-web-search-deepseek`
|
## `@deepseek-ai/dsh-web-search-deepseek`
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ The provider's configured `timeoutMs` is a **resource backstop** for direct `ctx
|
|||||||
| `maxUrlLength` | `2048` | Maximum accepted request URL length. |
|
| `maxUrlLength` | `2048` | Maximum accepted request URL length. |
|
||||||
| `maxResponseBytes` | `5_000_000` | Maximum response body size in bytes. |
|
| `maxResponseBytes` | `5_000_000` | Maximum response body size in bytes. |
|
||||||
| `maxBodyChars` | `100_000` | Maximum decoded body length in characters. |
|
| `maxBodyChars` | `100_000` | Maximum decoded body length in characters. |
|
||||||
| `timeoutMs` | `30_000` | Fetch timeout — a resource backstop for direct `ctx.web.fetch()` callers, not the model-facing tool-call budget (that is `dsh-timeout-policy`). |
|
| `timeoutMs` | `30_000` | Fetch timeout within Node's timer range — a resource backstop for direct `ctx.web.fetch()` callers, not the model-facing tool-call budget (that is `dsh-timeout-policy`). |
|
||||||
| `maxRedirects` | `5` | Maximum same-origin redirect hops (`0` follows none). |
|
| `maxRedirects` | `5` | Maximum same-origin redirect hops (`0` follows none). |
|
||||||
| `userAgent` | `deepseek-harness/…` | `User-Agent` header. |
|
| `userAgent` | `deepseek-harness/…` | `User-Agent` header. |
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import type {} from '@deepseek-ai/dsh-web'
|
|||||||
import { LocalFetchProvider } from './provider.ts'
|
import { LocalFetchProvider } from './provider.ts'
|
||||||
import type { LocalFetchLimits } from './provider.ts'
|
import type { LocalFetchLimits } from './provider.ts'
|
||||||
|
|
||||||
|
const MAX_NODE_TIMER_DELAY_MS = 2_147_483_647
|
||||||
|
|
||||||
export {
|
export {
|
||||||
LOCAL_FETCH_PROVIDER_ID,
|
LOCAL_FETCH_PROVIDER_ID,
|
||||||
LocalFetchProvider,
|
LocalFetchProvider,
|
||||||
@@ -36,7 +38,7 @@ export interface Config {
|
|||||||
maxResponseBytes?: number
|
maxResponseBytes?: number
|
||||||
/** Maximum decoded body length in characters. */
|
/** Maximum decoded body length in characters. */
|
||||||
maxBodyChars?: number
|
maxBodyChars?: number
|
||||||
/** Default fetch timeout in milliseconds. */
|
/** Default fetch timeout in milliseconds, within Node's timer range. */
|
||||||
timeoutMs?: number
|
timeoutMs?: number
|
||||||
/** Maximum number of same-origin redirect hops to follow. */
|
/** Maximum number of same-origin redirect hops to follow. */
|
||||||
maxRedirects?: number
|
maxRedirects?: number
|
||||||
@@ -63,6 +65,14 @@ function assertPositiveFinite(name: string, value: number): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Node coerces larger timer delays to 1 ms, so reject them at configuration time. */
|
||||||
|
function assertTimeoutMs(value: number): void {
|
||||||
|
assertPositiveFinite('timeoutMs', value)
|
||||||
|
if (value > MAX_NODE_TIMER_DELAY_MS) {
|
||||||
|
throw new Error(`web-fetch-local: timeoutMs must be no greater than ${MAX_NODE_TIMER_DELAY_MS}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** The redirect hop cap must be a non-negative integer (0 follows no redirects). */
|
/** The redirect hop cap must be a non-negative integer (0 follows no redirects). */
|
||||||
function assertNonNegativeInteger(name: string, value: number): void {
|
function assertNonNegativeInteger(name: string, value: number): void {
|
||||||
if (!Number.isInteger(value) || value < 0) {
|
if (!Number.isInteger(value) || value < 0) {
|
||||||
@@ -77,7 +87,7 @@ export function apply(ctx: Context, config: Config): void {
|
|||||||
assertPositiveFinite('maxUrlLength', resolved.maxUrlLength)
|
assertPositiveFinite('maxUrlLength', resolved.maxUrlLength)
|
||||||
assertPositiveFinite('maxResponseBytes', resolved.maxResponseBytes)
|
assertPositiveFinite('maxResponseBytes', resolved.maxResponseBytes)
|
||||||
assertPositiveFinite('maxBodyChars', resolved.maxBodyChars)
|
assertPositiveFinite('maxBodyChars', resolved.maxBodyChars)
|
||||||
assertPositiveFinite('timeoutMs', resolved.timeoutMs)
|
assertTimeoutMs(resolved.timeoutMs)
|
||||||
assertNonNegativeInteger('maxRedirects', resolved.maxRedirects)
|
assertNonNegativeInteger('maxRedirects', resolved.maxRedirects)
|
||||||
const limits: LocalFetchLimits = {
|
const limits: LocalFetchLimits = {
|
||||||
maxUrlLength: resolved.maxUrlLength,
|
maxUrlLength: resolved.maxUrlLength,
|
||||||
|
|||||||
@@ -397,6 +397,13 @@ describe('web-fetch-local plugin registration', () => {
|
|||||||
.rejects.toThrow(/timeoutMs must be a positive finite number/)
|
.rejects.toThrow(/timeoutMs must be a positive finite number/)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('rejects a timeout beyond Node timer range at construction', async () => {
|
||||||
|
const ctx = new Context()
|
||||||
|
await ctx.plugin(WebService, { fetchProvider: LOCAL_FETCH_PROVIDER_ID })
|
||||||
|
await expect(ctx.plugin(fetchPlugin, { timeoutMs: 2_147_483_648 }))
|
||||||
|
.rejects.toThrow(/timeoutMs must be no greater than 2147483647/)
|
||||||
|
})
|
||||||
|
|
||||||
it('rejects a fractional redirect cap at construction', async () => {
|
it('rejects a fractional redirect cap at construction', async () => {
|
||||||
const ctx = new Context()
|
const ctx = new Context()
|
||||||
await ctx.plugin(WebService, { fetchProvider: LOCAL_FETCH_PROVIDER_ID })
|
await ctx.plugin(WebService, { fetchProvider: LOCAL_FETCH_PROVIDER_ID })
|
||||||
|
|||||||
Reference in New Issue
Block a user