d0029d8d60
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.
20 lines
882 B
TypeScript
20 lines
882 B
TypeScript
/**
|
|
* Derive the workspace root an `lsp` call resolves against: the calling agent's per-session
|
|
* workspace (`exec.agent.session.header.cwd`), mirroring how the filesystem tools resolve paths.
|
|
* Unlike those tools, LSP has NO provider fallback — a missing cwd fails the call as
|
|
* `LSP_WORKSPACE_REQUIRED`, because the local provider must canonicalize a real workspace before it
|
|
* can start a server.
|
|
* @module @deepseek-ai/dsh-tool-lsp/session-cwd
|
|
*/
|
|
|
|
import type { ToolExecution } from '@deepseek-ai/dsh-tools'
|
|
|
|
/**
|
|
* The session workspace cwd for this call, or `undefined` when none applies.
|
|
* @param exec - the tool-execution context; only its optional `agent` is read.
|
|
* @returns the calling agent's session cwd, or undefined for a non-agent caller.
|
|
*/
|
|
export function sessionCwd(exec: ToolExecution): string | undefined {
|
|
return exec.agent?.session.header.cwd
|
|
}
|