Files
deepseek-harness/packages/context/file-reference/tests/service.spec.ts
T
creatixchu 6bb79911ba refactor(reference): serve discovery through typert Remote faces
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
2026-08-17 18:35:30 +08:00

22 lines
1.0 KiB
TypeScript

/** The Remote face delegates to the provider's discovery contract unchanged. */
import { Context } from '@deepseek-ai/cordis'
import { describe, expect, it, vi } from 'vitest'
import type { Agent } from '@deepseek-ai/dsh-agent'
import { FileReferenceService } from '../src/index.ts'
import type { FileReferenceCandidate } from '../src/types.ts'
describe('FileReferenceService', () => {
it('serves the Remote face through the abstract discovery member', async () => {
const candidates: FileReferenceCandidate[] = [{ path: 'src', kind: 'directory' }]
const list = vi.fn((_agent: Agent, _query: string, _signal: AbortSignal) => Promise.resolve(candidates))
class StubProvider extends FileReferenceService {
list = list
}
const provider = new StubProvider(new Context())
const agent = { id: 'target' } as unknown as Agent
const signal = new AbortController().signal
await expect(provider.remoteExportList(agent, 'sr', signal)).resolves.toBe(candidates)
expect(list).toHaveBeenCalledWith(agent, 'sr', signal)
})
})