mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
Machine-produced by `pnpm run rescope-vendor --apply` plus the regeneration it prints: `pnpm install` for the lockfile, `pnpm run gen-third-party-notices`, `verify-translation-pairing --write` for the touched bilingual pairs, `gen-doc-graphs`, and one typert snapshot whose ids embed character offsets. `pnpm run rescope-vendor --check` verifies the result. Renames nine vendored packages (cordis, cosmokit, schemastery and the six @cordisjs plugins) and every reference that resolves them: manifest names and dependency keys, module specifiers including declare-module merges, cordis.yml plugin names, tsconfig paths, every Markdown fence, and `docs/` prose. Directory names, upstream versions, and dependency ranges are unchanged, so vendor/README.md still reads as an upstream snapshot; its manifest table gains an upstream-name column so THIRD_PARTY_NOTICES keeps MIT attribution pointed at each fork's origin. The tutorial tier follows the rename end to end: its yaml fences named plugins the Loader can no longer resolve, its `ts ignore-check` fences disagreed with the compiled fences beside them, and its prose quoted both. The contracts that told readers to keep upstream names — the root convention and the vendoring cookbook's tree comment and manifest invariant — now say to rescope instead. Two rules read `@deepseek-ai/` as "another workspace plugin": the client bundle purity gate now names the vendored libraries a browser bundle inlines, and the files where a bare `cordis` is an agent-preset id keep that product data.
71 lines
2.7 KiB
TypeScript
71 lines
2.7 KiB
TypeScript
/**
|
|
* `@deepseek-ai/dsh-web-search-exa`: registers an Exa-backed `WebSearchProvider`
|
|
* with `ctx.web`. A function/namespace plugin (NOT a default-export service):
|
|
* a search provider does not own the `ctx.web` key — it registers INTO the
|
|
* seam's provider registry, exactly as `@deepseek-ai/dsh-llm-deepseek`
|
|
* registers an adapter into `ctx.llm`. The key is owned by `@deepseek-ai/dsh-web`.
|
|
*
|
|
* @module @deepseek-ai/dsh-web-search-exa
|
|
*/
|
|
|
|
import type { Context } from '@deepseek-ai/cordis'
|
|
import { environmentOf } from '@deepseek-ai/dsh-environment'
|
|
import z from '@deepseek-ai/schemastery'
|
|
import type {} from '@deepseek-ai/dsh-web'
|
|
import {
|
|
ExaSearchProvider,
|
|
EXA_DEFAULT_BASE_URL,
|
|
EXA_DEFAULT_HIGHLIGHTS_PER_RESULT,
|
|
EXA_DEFAULT_SEARCH_TYPE,
|
|
} from './provider.ts'
|
|
|
|
export {
|
|
EXA_DEFAULT_BASE_URL,
|
|
EXA_DEFAULT_HIGHLIGHTS_PER_RESULT,
|
|
EXA_DEFAULT_SEARCH_TYPE,
|
|
EXA_PROVIDER_ID,
|
|
ExaSearchProvider,
|
|
} from './provider.ts'
|
|
export type { ExaSearchProviderOptions } from './provider.ts'
|
|
|
|
/** Cordis plugin name used by loader diagnostics. */
|
|
export const name = 'web-search-exa'
|
|
|
|
/** The web seam this provider registers into. */
|
|
export const inject = ['web']
|
|
|
|
/** Plugin config (all optional — `apply` fills env-var and constant defaults). */
|
|
export interface Config {
|
|
/** Exa API key. Falls back to `$EXA_API_KEY`. Empty → provider unavailable. */
|
|
apiKey?: string
|
|
/** Endpoint base; `/search` is appended. Defaults to the public API. */
|
|
baseURL?: string
|
|
/** Retrieval mode sent as Exa's `type`. Defaults to `auto`. */
|
|
searchType?: 'auto' | 'keyword' | 'neural'
|
|
/** Default result count when a request carries no `maxResults`. Omitted = none. */
|
|
numResults?: number
|
|
/** Highlight sentences requested per result. Defaults to 1. */
|
|
highlightsPerResult?: number
|
|
}
|
|
|
|
export const Config: z<Config> = z.object({
|
|
apiKey: z.string(),
|
|
baseURL: z.string(),
|
|
searchType: z.union(['auto', 'keyword', 'neural'] as const),
|
|
numResults: z.number().step(1).min(1),
|
|
highlightsPerResult: z.number().step(1).min(1),
|
|
})
|
|
|
|
/** Register the Exa search provider with `ctx.web`. */
|
|
export function apply(ctx: Context, config: Config): void {
|
|
ctx.web.registerSearchProvider(new ExaSearchProvider({
|
|
// Every environment layer may name this key: the product trusts the
|
|
// project it is launched in, and the managed store is not involved here.
|
|
apiKey: config.apiKey ?? environmentOf(ctx).get('EXA_API_KEY')?.value ?? '',
|
|
baseURL: config.baseURL ?? EXA_DEFAULT_BASE_URL,
|
|
searchType: config.searchType ?? EXA_DEFAULT_SEARCH_TYPE,
|
|
highlightsPerResult: config.highlightsPerResult ?? EXA_DEFAULT_HIGHLIGHTS_PER_RESULT,
|
|
...config.numResults !== undefined ? { numResults: config.numResults } : {},
|
|
}))
|
|
}
|