feat: add searxng web-search provider, openrouter cost balance UI, offline scripts; update source-launch and docs
Some checks failed
CI / node 22.19 (push) Has been skipped
CI / node 26 (push) Has been skipped
CI / python 3.10 / keyless SDK (push) Has been skipped
CI / python runtime / release-shaped Linux x64 (push) Has been skipped
CI / windows node 24 / wine blocking (push) Has been skipped
CI / wine apt cache (push) Successful in 58s
CI / serial / linux (push) Has been skipped
Deploy documentation / build (push) Failing after 2m46s
Deploy documentation / deploy (push) Has been skipped
E2E (real DeepSeek API) / e2e (push) Failing after 1m18s
Sandbox / sandbox e2e (bwrap, ubuntu-latest) (push) Failing after 1m18s
Landlock Run / Matrix (push) Successful in 13s
Release (vendor) / Pack npm tarballs (push) Failing after 3m43s
Release (dsh) / Pack npm tarballs (push) Failing after 1m53s
Sandbox / sandbox e2e (landlock, ubuntu-24.04) (push) Failing after 1m51s
Release (vendor) / Publish to npm (push) Has been skipped
Release (dsh) / Publish to npm (push) Has been skipped
CI / node 24 / static (push) Has been cancelled
CI / node 24 / coverage (push) Has been cancelled
CI / node 24 / snapshots and artifacts (push) Has been cancelled
CI / windows node 24 / native complete (push) Has been cancelled
CI / serial / linux (self-hosted standby) (push) Has been cancelled
CI / serial / macos (push) Has been cancelled
CI / serial / windows (self-hosted standby) (push) Has been cancelled
CI / larger-runner-benchmark (16, linux, dsh-ubuntu-24-04-16core, typecheck) (push) Has been cancelled
CI / larger-runner-benchmark (16, windows, dsh-windows-2025-16core, production-site) (push) Has been cancelled
CI / larger-runner-benchmark (32, linux, dsh-ubuntu-24-04-32core, typecheck) (push) Has been cancelled
CI / larger-runner-benchmark (32, windows, dsh-windows-2025-32core, production-site) (push) Has been cancelled
CI / larger-runner-benchmark (4, linux, dsh-ubuntu-24-04-4core, typecheck) (push) Has been cancelled
CI / larger-runner-benchmark (4, windows, dsh-windows-2025-4core, production-site) (push) Has been cancelled
CI / larger-runner-benchmark (64, linux, dsh-ubuntu-24-04-64core, typecheck) (push) Has been cancelled
CI / larger-runner-benchmark (64, windows, dsh-windows-2025-64core, production-site) (push) Has been cancelled
CI / larger-runner-benchmark (8, linux, dsh-ubuntu-24-04-8core, typecheck) (push) Has been cancelled
CI / larger-runner-benchmark (8, windows, dsh-windows-2025-8core, production-site) (push) Has been cancelled
CI / larger-runner-benchmark (96, linux, dsh-ubuntu-24-04-96core, typecheck) (push) Has been cancelled
CI / larger-runner-benchmark (96, windows, dsh-windows-2025-96core, production-site) (push) Has been cancelled
CI / consolidated-runner-benchmark (16, linux, dsh-ubuntu-24-04-16core, 16) (push) Has been cancelled
CI / consolidated-runner-benchmark (16, windows, dsh-windows-2025-16core, 2) (push) Has been cancelled
CI / consolidated-runner-benchmark (32, linux, dsh-ubuntu-24-04-32core, 32) (push) Has been cancelled
CI / consolidated-runner-benchmark (32, windows, dsh-windows-2025-32core, 2) (push) Has been cancelled
CI / consolidated-runner-benchmark (4, linux, dsh-ubuntu-24-04-4core, 4) (push) Has been cancelled
CI / consolidated-runner-benchmark (4, windows, dsh-windows-2025-4core, 2) (push) Has been cancelled
CI / consolidated-runner-benchmark (64, linux, dsh-ubuntu-24-04-64core, 32) (push) Has been cancelled
CI / consolidated-runner-benchmark (64, windows, dsh-windows-2025-64core, 2) (push) Has been cancelled
CI / consolidated-runner-benchmark (8, linux, dsh-ubuntu-24-04-8core, 8) (push) Has been cancelled
CI / consolidated-runner-benchmark (8, windows, dsh-windows-2025-8core, 2) (push) Has been cancelled
CI / consolidated-runner-benchmark (96, linux, dsh-ubuntu-24-04-96core, 32) (push) Has been cancelled
CI / consolidated-runner-benchmark (96, windows, dsh-windows-2025-96core, 2) (push) Has been cancelled
CI / all checks passed (push) Has been cancelled
Sandbox / sandbox e2e (seatbelt, macos-latest) (push) Has been cancelled
Sandbox / sandbox e2e (landlock, ubuntu-24.04-arm) (push) Has been cancelled
Landlock Run / ${{ matrix.platform }} (push) Has been cancelled
Landlock Run / darwin (no platform package — degradation proof) (push) Has been cancelled

This commit is contained in:
2026-08-20 13:01:40 +07:00
parent 99f6f02fec
commit ed152416d5
111 changed files with 5038 additions and 43 deletions

View File

@@ -0,0 +1,98 @@
import { describe, expect, it } from 'vitest'
import {
applySourceDshHttpProxy,
isSocksProxyUrl,
parseSourceDshHttpProxyFile,
shouldReexecSourceDshForFetchProxy,
SOURCE_DSH_PROXY_REEXEC_MARKER,
sourceDshHttpProxyOverlayPresent,
} from './apply-source-dsh-http-proxy.ts'
describe('applySourceDshHttpProxy', () => {
it('leaves the inherited environment unchanged when no overlay is set', () => {
const env: NodeJS.ProcessEnv = { HTTPS_PROXY: 'socks5h://127.0.0.1:1080' }
applySourceDshHttpProxy({ env, fileText: null })
expect(env.HTTPS_PROXY).toBe('socks5h://127.0.0.1:1080')
expect(env.NODE_USE_ENV_PROXY).toBeUndefined()
})
it('overwrites inherited SOCKS with DSH_HTTP_PROXY for this process only', () => {
const env: NodeJS.ProcessEnv = {
HTTPS_PROXY: 'socks5h://127.0.0.1:1080',
ALL_PROXY: 'socks5h://127.0.0.1:1080',
}
applySourceDshHttpProxy({ env, fileText: null, overlayUrl: 'http://127.0.0.1:3067' })
expect(env.HTTPS_PROXY).toBe('http://127.0.0.1:3067')
expect(env.HTTP_PROXY).toBe('http://127.0.0.1:3067')
expect(env.ALL_PROXY).toBe('http://127.0.0.1:3067')
expect(env.https_proxy).toBe('http://127.0.0.1:3067')
expect(env.NODE_USE_ENV_PROXY).toBe('1')
expect(env.NO_PROXY).toBe('localhost,127.0.0.1,::1')
})
it('applies a checkout overlay file and outranks it with DSH_HTTP_PROXY', () => {
const env: NodeJS.ProcessEnv = {}
const fileText = [
'HTTPS_PROXY=http://127.0.0.1:3067',
'NODE_USE_ENV_PROXY=1',
'# comment',
'',
].join('\n')
applySourceDshHttpProxy({ env, fileText })
expect(env.HTTPS_PROXY).toBe('http://127.0.0.1:3067')
expect(env.NODE_USE_ENV_PROXY).toBe('1')
applySourceDshHttpProxy({ env, fileText, overlayUrl: 'http://127.0.0.1:8080' })
expect(env.HTTPS_PROXY).toBe('http://127.0.0.1:8080')
})
it('replaces inherited SOCKS on names the overlay file omitted', () => {
const env: NodeJS.ProcessEnv = {
HTTPS_PROXY: 'socks5h://proxy.home:4067',
ALL_PROXY: 'socks5h://proxy.home:4067',
}
applySourceDshHttpProxy({
env,
fileText: 'HTTPS_PROXY=http://127.0.0.1:3067\nNODE_USE_ENV_PROXY=1\n',
})
expect(env.HTTPS_PROXY).toBe('http://127.0.0.1:3067')
expect(env.ALL_PROXY).toBe('http://127.0.0.1:3067')
expect(env.HTTP_PROXY).toBe('http://127.0.0.1:3067')
expect(env.NODE_USE_ENV_PROXY).toBe('1')
})
it('rejects a SOCKS overlay before the CLI boots', () => {
expect(() => applySourceDshHttpProxy({
env: {},
fileText: null,
overlayUrl: 'socks5h://127.0.0.1:1080',
})).toThrow(/cannot fetch through SOCKS/)
expect(() => applySourceDshHttpProxy({
env: {},
fileText: 'ALL_PROXY=socks5://127.0.0.1:1080\n',
})).toThrow(/cannot fetch through SOCKS/)
})
})
describe('parseSourceDshHttpProxyFile', () => {
it('parses quoted values and export lines', () => {
expect(parseSourceDshHttpProxyFile('export HTTPS_PROXY="http://127.0.0.1:3067"\n')).toEqual({
HTTPS_PROXY: 'http://127.0.0.1:3067',
})
})
it('detects SOCKS schemes', () => {
expect(isSocksProxyUrl('socks5h://127.0.0.1:1080')).toBe(true)
expect(isSocksProxyUrl('http://127.0.0.1:3067')).toBe(false)
})
})
describe('shouldReexecSourceDshForFetchProxy', () => {
it('respawns once when an overlay is present so fetch binds HTTP_PROXY at start', () => {
expect(sourceDshHttpProxyOverlayPresent(undefined, null)).toBe(false)
expect(shouldReexecSourceDshForFetchProxy({}, false)).toBe(false)
expect(shouldReexecSourceDshForFetchProxy({}, true)).toBe(true)
expect(shouldReexecSourceDshForFetchProxy({ [SOURCE_DSH_PROXY_REEXEC_MARKER]: '1' }, true)).toBe(false)
})
})