mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-08-29 04:26:38 +00:00
Replace the legacy reference.* API Proxy domain with @Remote methods on the owning services, following the typert gateway design master adopted on 2026-08-02 (message-feedback and plugin-inventory precedents): - FileReferenceService and SessionReferenceResolver extend TypertRemoteService; fileReferences/list and sessionReferenceResolver/candidates are unary Remote methods cancelled through the reserved trailing signal, and the candidates face attaches each candidate's canonical mention under the configured limit - move the wire types to type-only ./types subpaths (FileReferenceCandidate, SessionReferenceMentionCandidate) and export ./typert plus ./remote artifacts - mount both contributions in the api-remotes client assembly; ui-reference consumes ctx.remote instead of connection.api.references and registers zh/en locale dictionaries for its sections and labels - delete the reference.* routes, schemas, map rows, client stubs, and fixtures; the connection fixture serves the Remote endpoints instead - release deliverPrompt admission listeners when the agent is disposed with the prepared prompt still pending, and cover the reference-* RpcError codes in the schema spec - add the missing tsconfig paths for the /grammar and /types subpaths (clean- tree vitest could not resolve @deepseek-ai/dsh-file-reference/grammar) - regenerate the cordis catalog, capability seams, and event matrix; update the owning bilingual READMEs, Agent Notes, and the reference-composer golden
64 lines
2.1 KiB
TypeScript
64 lines
2.1 KiB
TypeScript
/**
|
|
* 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<FileReferenceCandidate[]>
|
|
|
|
/**
|
|
* 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<FileReferenceCandidate[]> {
|
|
return this.list(agent, query, signal)
|
|
}
|
|
}
|
|
|
|
export default FileReferenceService
|