mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
New doc-sync gate verify-export-jsdoc walks every module-level exported name under packages/*/*/src and requires description prose everywhere, plus @param per parameter and @returns on non-void annotated returns for function-like exports, public class methods, properties, and accessors. The parsing + check helpers move out of gen-cordis-catalog.ts into a shared scripts/jsdoc.ts so 'documented' means one thing on both gated surfaces. Deliberate exemptions (documented in the RFC): heritage-declared class members (the seam declaration is the doc's one home — the one checker query in an otherwise pure-AST walk), cordis plugin-protocol slots (name/inject/reusable/Config/apply, top-level and static), constructors, overload implementations, declare-module augmentation bodies, and re-export statements (checked at the defining module). The 203 under-documented exports the gate found at adoption are filled in this change, so the gate lands green; generated catalogs/graphs are regenerated for the shifted line pointers. RFC: docs/rfc/implemented/process/2026-07-06-export-surface-jsdoc-gate.md
64 lines
2.4 KiB
TypeScript
64 lines
2.4 KiB
TypeScript
/**
|
|
* `@deepseek-ai/dsh-web-search-perplexity`: registers a Perplexity-backed
|
|
* `WebSearchProvider` with `ctx.web`. A function/namespace plugin (NOT a
|
|
* default-export service): it registers INTO the seam's provider registry, like
|
|
* `@deepseek-ai/dsh-llm-deepseek` registers an adapter into `ctx.llm`.
|
|
*
|
|
* @module @deepseek-ai/dsh-web-search-perplexity
|
|
*/
|
|
|
|
import type { Context } from 'cordis'
|
|
import z from 'schemastery'
|
|
import type {} from '@deepseek-ai/dsh-web'
|
|
import { PerplexitySearchProvider, PERPLEXITY_DEFAULT_BASE_URL, PERPLEXITY_DEFAULT_MAX_TOKENS, PERPLEXITY_DEFAULT_MODEL } from './provider.ts'
|
|
|
|
export {
|
|
PERPLEXITY_DEFAULT_BASE_URL,
|
|
PERPLEXITY_DEFAULT_MAX_TOKENS,
|
|
PERPLEXITY_DEFAULT_MODEL,
|
|
PERPLEXITY_PROVIDER_ID,
|
|
PerplexitySearchProvider,
|
|
mapPerplexityResponse,
|
|
mapPerplexityResult,
|
|
} from './provider.ts'
|
|
export type { PerplexityRecency, PerplexitySearchProviderOptions } from './provider.ts'
|
|
|
|
/** Cordis plugin name used by loader diagnostics. */
|
|
export const name = 'web-search-perplexity'
|
|
|
|
/** 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 {
|
|
/** Perplexity API key. Falls back to `$PERPLEXITY_API_KEY`. Empty → unavailable. */
|
|
apiKey?: string
|
|
/** Endpoint base; `/chat/completions` is appended. Defaults to the public API. */
|
|
baseURL?: string
|
|
/** Search model name. Defaults to `sonar`. */
|
|
model?: string
|
|
/** Upper bound on generated answer tokens. Defaults to 1024. */
|
|
maxTokens?: number
|
|
/** Recency window sent as `search_recency_filter`. Omitted = no filter. */
|
|
searchRecency?: 'day' | 'week' | 'month' | 'year'
|
|
}
|
|
|
|
export const Config: z<Config> = z.object({
|
|
apiKey: z.string(),
|
|
baseURL: z.string(),
|
|
model: z.string(),
|
|
maxTokens: z.number().step(1).min(1),
|
|
searchRecency: z.union(['day', 'week', 'month', 'year'] as const),
|
|
})
|
|
|
|
/** Register the Perplexity search provider with `ctx.web`. */
|
|
export function apply(ctx: Context, config: Config): void {
|
|
ctx.web.registerSearchProvider(new PerplexitySearchProvider({
|
|
apiKey: config.apiKey ?? process.env.PERPLEXITY_API_KEY ?? '',
|
|
baseURL: config.baseURL ?? PERPLEXITY_DEFAULT_BASE_URL,
|
|
model: config.model ?? PERPLEXITY_DEFAULT_MODEL,
|
|
maxTokens: config.maxTokens ?? PERPLEXITY_DEFAULT_MAX_TOKENS,
|
|
...config.searchRecency !== undefined ? { searchRecency: config.searchRecency } : {},
|
|
}))
|
|
}
|