Implements the LSP capability seam RFC as three packages: dsh-lsp (the ctx.lsp interface — provider registry by branded id + exclusive extension mapping, per-query order-independent selection, closed request/result vocabulary, LspError taxonomy), dsh-lsp-local (a generic stdio language-server provider — Content-Length JSON-RPC framing, per-(provider, workspace) process single-flight, transient didOpen/query/didClose, an abortable per-instance queue, UTF-16 negotiation, host-namespace source reads outside ctx.fs, and bounded shutdown/kill teardown), and dsh-tool-lsp (the model-facing lsp tool — four operations, one-based UTF-16 cursor conversion, workspace-grouped location rendering, hover capping, a required session workspace, and a timeout budget). Why: an agent had text search and file reads but no way to identify a program symbol — follow an alias, connect an interface to implementations, or read an inferred type — before changing code. Splitting model contract, seam, and local subprocess behavior keeps the four semantic queries stable across future remote or sandbox-native providers without leaking a JSON-RPC escape hatch.
25 lines
1.1 KiB
TypeScript
25 lines
1.1 KiB
TypeScript
/**
|
|
* Real-load-path guard for @deepseek-ai/dsh-tool-lsp. It is a NAMESPACE plugin with `inject`, so a
|
|
* stray `export default apply` would make the Loader's `unwrapExports` collapse the module to the
|
|
* bare `apply`, dropping `inject` (postmortem 0001). This unwraps through the REAL
|
|
* `Loader.prototype.unwrapExports` and verifies the namespace shape survives.
|
|
*/
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
import Loader from '@cordisjs/plugin-loader'
|
|
import * as toolLsp from '@deepseek-ai/dsh-tool-lsp'
|
|
|
|
describe('dsh-tool-lsp real-load-path guard', () => {
|
|
it('has no default export and keeps name/inject/Config through unwrapExports', () => {
|
|
expect('default' in toolLsp).toBe(false)
|
|
|
|
const loader = Object.create(Loader.prototype) as Loader
|
|
const unwrapped = loader.unwrapExports(toolLsp) as Record<string, unknown>
|
|
expect(unwrapped).toBe(toolLsp)
|
|
expect(unwrapped.name).toBe('tool-lsp')
|
|
expect(unwrapped.inject).toEqual(['tools', 'lsp', 'systemPrompt'])
|
|
expect(typeof unwrapped.apply).toBe('function')
|
|
expect(unwrapped.Config).toBeDefined()
|
|
})
|
|
})
|