/** * File-reference discovery seam shared by host-backed user interfaces. * * @module @deepseek-ai/dsh-file-reference */ import type { Context } from '@deepseek-ai/cordis' import type { Agent } from '@deepseek-ai/dsh-agent' import { Remote, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol' import type { FileReferenceCandidate } from './types.ts' export { activeAtToken, formatFileMention } from './grammar.ts' export type { ActiveAtToken } from './grammar.ts' export type { FileReferenceCandidate } from './types.ts' /** Model guidance for path-only references selected by a user interface. */ export const FILE_REFERENCE_PROMPT = 'Paths prefixed with @ are files explicitly referenced by the user. Use the read tool when their contents are needed; do not claim to have inspected a file before reading it.' declare module '@deepseek-ai/cordis' { interface Context { fileReferences: FileReferenceService } } /** Host capability for cancellable file-reference discovery. */ export abstract class FileReferenceService extends TypertRemoteService { constructor(ctx: Context) { super(ctx, 'fileReferences') } /** * List file and directory candidates for one agent's working directory. * @param agent - target agent whose session cwd bounds discovery. * @param query - path text following `@` or `@"`. * @param signal - caller cancellation. * @returns deterministic path-only candidates. */ abstract list( agent: Agent, query: string, signal: AbortSignal, ): Promise /** * Remote face of {@link list}; the decorator cannot mark the abstract * member, so this concrete adapter carries the identical contract. * @param agent - target agent whose session cwd bounds discovery. * @param query - path text following `@` or `@"`. * @param signal - caller cancellation. * @returns deterministic path-only candidates. */ @Remote('list') remoteExportList( agent: Agent, query: string, signal: AbortSignal, ): Promise { return this.list(agent, query, signal) } } export default FileReferenceService