dsh-lsp-actions 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/LICENSE +201 -0
- package/README.es.md +177 -0
- package/README.hi.md +177 -0
- package/README.md +183 -0
- package/README.pt.md +177 -0
- package/README.zh-CN.md +181 -0
- package/cordis.patch.yml +17 -0
- package/lib/abort.d.ts +13 -0
- package/lib/abort.d.ts.map +1 -0
- package/lib/abort.js +31 -0
- package/lib/abort.js.map +1 -0
- package/lib/client.d.ts +173 -0
- package/lib/client.d.ts.map +1 -0
- package/lib/client.js +926 -0
- package/lib/client.js.map +1 -0
- package/lib/connection.d.ts +103 -0
- package/lib/connection.d.ts.map +1 -0
- package/lib/connection.js +241 -0
- package/lib/connection.js.map +1 -0
- package/lib/edits.d.ts +17 -0
- package/lib/edits.d.ts.map +1 -0
- package/lib/edits.js +76 -0
- package/lib/edits.js.map +1 -0
- package/lib/extension.d.ts +9 -0
- package/lib/extension.d.ts.map +1 -0
- package/lib/extension.js +17 -0
- package/lib/extension.js.map +1 -0
- package/lib/extra-tools.d.ts +45 -0
- package/lib/extra-tools.d.ts.map +1 -0
- package/lib/extra-tools.js +406 -0
- package/lib/extra-tools.js.map +1 -0
- package/lib/framing.d.ts +33 -0
- package/lib/framing.d.ts.map +1 -0
- package/lib/framing.js +80 -0
- package/lib/framing.js.map +1 -0
- package/lib/host.d.ts +64 -0
- package/lib/host.d.ts.map +1 -0
- package/lib/host.js +152 -0
- package/lib/host.js.map +1 -0
- package/lib/index.d.ts +42 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +78 -0
- package/lib/index.js.map +1 -0
- package/lib/render.d.ts +364 -0
- package/lib/render.d.ts.map +1 -0
- package/lib/render.js +485 -0
- package/lib/render.js.map +1 -0
- package/lib/runner.d.ts +55 -0
- package/lib/runner.d.ts.map +1 -0
- package/lib/runner.js +149 -0
- package/lib/runner.js.map +1 -0
- package/lib/sandbox.d.ts +69 -0
- package/lib/sandbox.d.ts.map +1 -0
- package/lib/sandbox.js +98 -0
- package/lib/sandbox.js.map +1 -0
- package/lib/seam.d.ts +67 -0
- package/lib/seam.d.ts.map +1 -0
- package/lib/seam.js +62 -0
- package/lib/seam.js.map +1 -0
- package/lib/servers.d.ts +120 -0
- package/lib/servers.d.ts.map +1 -0
- package/lib/servers.js +216 -0
- package/lib/servers.js.map +1 -0
- package/lib/session-cwd.d.ts +15 -0
- package/lib/session-cwd.d.ts.map +1 -0
- package/lib/session-cwd.js +16 -0
- package/lib/session-cwd.js.map +1 -0
- package/lib/tools.d.ts +150 -0
- package/lib/tools.d.ts.map +1 -0
- package/lib/tools.js +543 -0
- package/lib/tools.js.map +1 -0
- package/lib/translate.d.ts +181 -0
- package/lib/translate.d.ts.map +1 -0
- package/lib/translate.js +715 -0
- package/lib/translate.js.map +1 -0
- package/lib/vocabulary.d.ts +167 -0
- package/lib/vocabulary.d.ts.map +1 -0
- package/lib/vocabulary.js +20 -0
- package/lib/vocabulary.js.map +1 -0
- package/package.json +95 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to dsh-lsp-actions are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
|
+
|
|
6
|
+
## 0.2.0 — 2026-08-15
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- **`lsp_rename` tool**: a server-verified symbol rename (`textDocument/prepareRename` +
|
|
11
|
+
`textDocument/rename`) applied workspace-wide through the filesystem write-intent waterfall and
|
|
12
|
+
the per-call sandbox policy, exactly like `lsp_format`. Edits are pre-flighted before the first
|
|
13
|
+
write (workspace containment, overlap check, byte-capped read), no-op files are dropped, and the
|
|
14
|
+
result renders per-file diff cards. Cross-document positions from `utf-8`/`utf-32` servers are
|
|
15
|
+
decoded per document by reading each edited file; unreadable targets fail as a structured
|
|
16
|
+
conflict instead of mis-decoding positions. File resource operations in a rename answer are
|
|
17
|
+
refused as unsupported. New `LSP_ACTION_NO_SYMBOL` error code for a bare cursor.
|
|
18
|
+
- **Four new read-only tools**: `lsp_code_action` (server-verified quickfixes, reported never
|
|
19
|
+
applied), `lsp_symbols` (workspace-wide name search and per-file symbol outline),
|
|
20
|
+
`lsp_signature` (signature help at a cursor), and `lsp_inlay_hints` (type/parameter hints).
|
|
21
|
+
- **Operation-specific seam extras**: the seam query forwards `query` (workspace symbol search),
|
|
22
|
+
`onlyKinds` (code-action filters), and `newName` (rename), so a future seam vintage can serve
|
|
23
|
+
the extended operations directly.
|
|
24
|
+
- **Structured JSON-RPC errors**: `LspRpcError` carries the server's wire error code, so advisory
|
|
25
|
+
round-trips (prepareRename) can distinguish error responses from transport failures.
|
|
26
|
+
- **Position encoding negotiation** for `utf-8` and `utf-32` servers: request positions are
|
|
27
|
+
encoded and server results are decoded through a per-document codec, so non-utf-16 servers no
|
|
28
|
+
longer fail the handshake.
|
|
29
|
+
- **`workspace/symbol` with an open routing file**: when `lsp_symbols` receives `file_path` with a
|
|
30
|
+
query, the file stays transiently open for the request, so project-based servers (tsls) that
|
|
31
|
+
refuse document-free symbol search work.
|
|
32
|
+
- **One fresh-spawn retry** when a server dies during its handshake, matching the official stdio
|
|
33
|
+
host's single bad-transport retry; mid-action failures never retry.
|
|
34
|
+
- **Idle server eviction** (`idleTimeoutMs` per server entry, default 0 = keep alive).
|
|
35
|
+
- **Push-diagnostic debounce** (`diagnosticsDebounceMs` per server entry, default 250 ms): the
|
|
36
|
+
latest pushed batch wins inside the settle window instead of the first.
|
|
37
|
+
- **Per-section `workspace/configuration` answers**: a plain-object `configuration` answers each
|
|
38
|
+
requested section, falling back to the whole value.
|
|
39
|
+
- **CI** (GitHub Actions: Node 22/24 × ubuntu/windows/macos lint+build+test matrix with a separate
|
|
40
|
+
coverage-gate job) and **coverage gates** (lines/statements/functions ≥ 90%, branches ≥ 85%),
|
|
41
|
+
plus a tag-triggered **publish workflow** for npm releases.
|
|
42
|
+
- **Real-server e2e for rename and workspace symbols** through typescript-language-server (the
|
|
43
|
+
suite is self-contained via the `typescript-language-server` devDependency).
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- **The action surface is eight tools**: the write-path safety contract (`write-intent`, sandbox
|
|
48
|
+
policy, conflict handling) now covers `lsp_rename` alongside `lsp_format`; the shared sandbox
|
|
49
|
+
escalation schema names the action (`formatting` / `rename`) in its advertised descriptions.
|
|
50
|
+
- **Tools are always registered.** With an empty `servers` table and no `ctx.lsp` seam, calls fail
|
|
51
|
+
loudly with `LSP_ACTION_UNAVAILABLE` instead of the plugin contributing nothing.
|
|
52
|
+
- **Seam detection is lazy per call**: a `ctx.lsp` seam mounted after this plugin (or re-added
|
|
53
|
+
mid-session) is served without a reload.
|
|
54
|
+
- **Completion results now render the insertion text** (`textEdit.newText` / `insertText`) on an
|
|
55
|
+
indented arrow line, because the model only sees rendered content.
|
|
56
|
+
- **Glob routes prefer the file's own extension mapping** for the language id, falling back to the
|
|
57
|
+
entry's first mapping only when the extension is not mapped.
|
|
58
|
+
- **Diagnostics, format, and inlay results carry columns** (and the format summary names the line
|
|
59
|
+
span), improving UI precision and model readback.
|
|
60
|
+
- **The harness packages are peer dependencies** (`>=0.1.0-rc.6`), so a host harness shares one
|
|
61
|
+
copy and cross-version `instanceof` mismatches cannot silently break error mapping.
|
|
62
|
+
|
|
63
|
+
### Fixed
|
|
64
|
+
|
|
65
|
+
- **Server re-spelled file URIs no longer corrupt rename targets.** Servers re-spell the root URI
|
|
66
|
+
sent at initialize (lowercase drive letter and percent-encoded colon on Windows), and the
|
|
67
|
+
workspace-relative mapping sliced the raw URI at the raw root's length — mis-cutting every such
|
|
68
|
+
URI into a garbage path. Containment is now judged on decoded, case-insensitive forms while the
|
|
69
|
+
relative path is sliced from the decoded URI.
|
|
70
|
+
- Diagnostics on servers whose `textDocumentSync` excludes transient open now fail with
|
|
71
|
+
`LSP_ACTION_UNSUPPORTED` (previously unchecked for diagnostics).
|
|
72
|
+
- A caller abort racing a seam failure now surfaces the signal's reason instead of the seam's
|
|
73
|
+
unrelated error.
|
|
74
|
+
- The e2e suite no longer depends on a sibling harness checkout's node_modules.
|
|
75
|
+
|
|
76
|
+
## 0.1.0 — 2026-08-14
|
|
77
|
+
|
|
78
|
+
- Initial release: `lsp_diagnostics`, `lsp_format`, and `lsp_completion` tools over the extended
|
|
79
|
+
`ctx.lsp` seam proposal and the built-in stdio client.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.es.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 🛰️ dsh-lsp-actions
|
|
4
|
+
|
|
5
|
+
**La superficie de acción LSP para DeepSeek Harness — servidores de lenguaje reales, retroalimentación real.**
|
|
6
|
+
|
|
7
|
+
Diagnósticos, formateo, completado de código, correcciones rápidas, símbolos, ayuda de firmas y sugerencias insertadas para el bucle del editor de tu agente, impulsados por los mismos servidores de lenguaje que usa tu IDE.
|
|
8
|
+
|
|
9
|
+
[](https://github.com/topics/dsh)
|
|
10
|
+
[](https://github.com/topics/dsh-plugin)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](package.json)
|
|
13
|
+
|
|
14
|
+
[English](README.md) · [简体中文](README.zh-CN.md) · [Español](README.es.md) · [हिन्दी](README.hi.md) · [Português](README.pt.md)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Qué aporta este plugin a tu agente
|
|
21
|
+
|
|
22
|
+
El seam oficial `ctx.lsp` de DeepSeek Harness cubre la **navegación** (ir a definición, referencias, implementación, hover). `dsh-lsp-actions` completa la **superficie de acción**: el bucle de retroalimentación que un agente necesita mientras escribe y corrige código:
|
|
23
|
+
|
|
24
|
+
| Herramienta | Qué hace | ¿Escribe? |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
| `lsp_diagnostics <file>` | Errores, advertencias y sugerencias del compilador/analizador con severidad, rango, mensaje y servidor de origen | ❌ solo lectura |
|
|
27
|
+
| `lsp_format <file> [range?]` | Formatea un archivo o selección mediante el servidor de lenguaje y aplica el resultado, devolviendo el diff | ✅ vía `fs/write-intent` + política sandbox |
|
|
28
|
+
| `lsp_completion <file> <line> <character>` | Sugerencias de completado en una posición del cursor, incluido el texto de inserción real | ❌ solo lectura |
|
|
29
|
+
| `lsp_code_action <file> [range?] [only?]` | Correcciones/refactorizaciones verificadas por el servidor (con sus ediciones) para un rango o el primer diagnóstico | ❌ solo referencia |
|
|
30
|
+
| `lsp_symbols <query?> <file_path?>` | Búsqueda de símbolos por nombre en todo el workspace, o el esquema de símbolos de un archivo | ❌ solo lectura |
|
|
31
|
+
| `lsp_signature <file> <line> <character>` | Ayuda de firmas (parámetros y documentación) dentro de una llamada | ❌ solo lectura |
|
|
32
|
+
| `lsp_inlay_hints <file> [range?]` | Anotaciones de tipo y sugerencias de nombres de parámetros del servidor | ❌ solo lectura |
|
|
33
|
+
| `lsp_rename <file> <line> <character> <new_name>` | Renombrado de símbolo verificado por el servidor, aplicado en todo el workspace con diffs por archivo | ✅ vía `fs/write-intent` + política sandbox |
|
|
34
|
+
|
|
35
|
+
> ✨ Una ejecución real de `typescript-language-server` forma parte de la suite de tests: diagnósticos, formateo, completado, búsqueda de símbolos y renombrado se verifican de extremo a extremo contra un servidor vivo, no solo con mocks. La suite es autocontenida (tsls es una devDependency) y corre en CI con Node 22/24 en Linux, Windows y macOS.
|
|
36
|
+
|
|
37
|
+
## Inicio rápido
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
dsh plugin --profile <name> add <ruta-o-tarball-de-dsh-lsp-actions>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Configura una entrada por servidor de lenguaje (la forma replica la configuración oficial de `lsp-stdio`):
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
# en el cordis.patch.yml de tu perfil (o en la fila del bundle)
|
|
47
|
+
- insert:
|
|
48
|
+
- id: lsp-actions
|
|
49
|
+
name: dsh-lsp-actions
|
|
50
|
+
inject: [tools, fs, subprocess]
|
|
51
|
+
config:
|
|
52
|
+
servers:
|
|
53
|
+
ts:
|
|
54
|
+
command: typescript-language-server
|
|
55
|
+
args: [--stdio]
|
|
56
|
+
extensionToLanguage:
|
|
57
|
+
".ts": typescript
|
|
58
|
+
formattingOptions: { tabSize: 2, insertSpaces: true }
|
|
59
|
+
py:
|
|
60
|
+
command: pyright-langserver
|
|
61
|
+
args: [--stdio]
|
|
62
|
+
extensionToLanguage:
|
|
63
|
+
".py": python
|
|
64
|
+
maxDiagnostics: 200
|
|
65
|
+
maxCompletionItems: 20
|
|
66
|
+
maxCodeActions: 50
|
|
67
|
+
maxSymbols: 100
|
|
68
|
+
maxSignatures: 10
|
|
69
|
+
maxInlayHints: 200
|
|
70
|
+
maxResultChars: 16000
|
|
71
|
+
timeoutMs: 60000
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Las ocho herramientas se registran siempre. Con una **tabla `servers` vacía y ningún seam `ctx.lsp` montado, las llamadas fallan en voz alta** con `LSP_ACTION_UNAVAILABLE` indicando qué configurar — el plugin nunca arranca servidores que no configuraste. Un seam `ctx.lsp` montado **después** de este plugin se detecta en la siguiente llamada (la detección del seam es por llamada, así que el orden de carga no importa).
|
|
75
|
+
|
|
76
|
+
## Por qué es seguro por construcción
|
|
77
|
+
|
|
78
|
+
- **El formateo y el renombrado son mutaciones reales, tratadas como `write`/`edit`.** Cada byte pasa por el waterfall `fs/write-intent` (observación → escritura protegida → observación) y por la política sandbox de cada llamada. `lsp_rename` pre-vuela cada archivo editado (contención en el workspace, comprobación de solapamientos, lectura con tope de bytes) *antes* de la primera escritura, de modo que una respuesta mala del servidor no puede dejar un renombrado a medio aplicar.
|
|
79
|
+
- **Todo lo demás es de solo lectura por diseño.** Las acciones de código, completados, símbolos, firmas y sugerencias se reportan como material de referencia; aplicarlas es decisión propia del modelo con write/edit. Las formas de comando se reportan y **nunca se ejecutan**.
|
|
80
|
+
- **Las sesiones de solo lectura fallan en voz alta, rápido y estructurado** — `LSP_ACTION_READ_ONLY` con el marcador compartido `[sandbox: …]`, lanzado *antes* de cualquier ida y vuelta con el servidor.
|
|
81
|
+
- **La escalada coincide con las herramientas oficiales.** Bajo un sistema de archivos restrictivo, `lsp_format` y `lsp_rename` anuncian el mismo reintento único `sandbox_permissions` / `justification` que `write`/`edit`, resuelto mediante `ctx.approval`.
|
|
82
|
+
- **Los conflictos nunca pisan nada.** Si el archivo cambió en disco después de leerse, la escritura protegida falla con `LSP_ACTION_CONFLICT` y se le dice al modelo que elija: releer y repetir, o aplicar el diff manualmente.
|
|
83
|
+
- **Los timeouts son de la plataforma.** Cada herramienta declara `timeoutMs`; la política oficial `dsh-tool-call-timeout-policy` lo hace cumplir, y cada await respeta `exec.signal`.
|
|
84
|
+
- **No se cachea nada.** Los resultados viven solo en el log de sesión; no hay persistencia entre sesiones.
|
|
85
|
+
- **Los servidores rotos fallan en voz alta.** Un ejecutable inexistente falla al cargar; un servidor que muere al arrancar falla la llamada con `LSP_ACTION_SERVER_FAILED` más la cola de su stderr (tras un reintento con proceso nuevo).
|
|
86
|
+
|
|
87
|
+
## Arquitectura
|
|
88
|
+
|
|
89
|
+
Las acciones van **primero por el seam oficial** y caen al cliente stdio mínimo propio del plugin:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
lsp_diagnostics / lsp_format / lsp_completion / lsp_code_action /
|
|
93
|
+
lsp_symbols / lsp_signature / lsp_inlay_hints / lsp_rename
|
|
94
|
+
│
|
|
95
|
+
▼
|
|
96
|
+
ctx.lsp seam (extendido: diagnostics / formatDocument / completion)
|
|
97
|
+
│ ausente · legado · sin provider para este archivo
|
|
98
|
+
▼
|
|
99
|
+
cliente stdio integrado ← tabla servers (ctx.subprocess.spawn + JSON-RPC)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
La extensión del seam está propuesta upstream (`upstream/lsp-action-seam.patch`, descripción del PR en `upstream/PR-description.md`). Cuando aterrice, el plugin sigue funcionando sin cambios — el cliente integrado simplemente deja de usarse. El cliente integrado se conserva como respaldo independiente para la tabla `servers`. Notas completas de investigación y diseño: [`docs/seam-extension-notes.md`](docs/seam-extension-notes.md), [`upstream/README.md`](upstream/README.md).
|
|
103
|
+
|
|
104
|
+
## Referencia de configuración
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
interface Config {
|
|
108
|
+
/** Servidores de lenguaje nombrados; vacío = el cliente propio no sirve nada. */
|
|
109
|
+
servers?: Record<string, LspServerEntry>
|
|
110
|
+
maxDiagnostics?: number // por defecto 200
|
|
111
|
+
maxCompletionItems?: number // por defecto 20
|
|
112
|
+
maxCodeActions?: number // por defecto 50
|
|
113
|
+
maxSymbols?: number // por defecto 100
|
|
114
|
+
maxSignatures?: number // por defecto 10
|
|
115
|
+
maxInlayHints?: number // por defecto 200
|
|
116
|
+
maxResultChars?: number // por defecto 16000 (tope del resultado renderizado completo)
|
|
117
|
+
maxDocumentBytes?: number // por defecto 4000000
|
|
118
|
+
timeoutMs?: number // por defecto 60000 (aplicado por la política oficial de timeout)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
interface LspServerEntry {
|
|
122
|
+
command: string // ejecutable, resuelto en PATH al cargar
|
|
123
|
+
extensionToLanguage: Record<string, string> // ".ts" → "typescript"
|
|
124
|
+
fileGlobs?: string[] // opcional; los globs ganan al mapa de extensiones
|
|
125
|
+
args?: string[] // sin shell
|
|
126
|
+
env?: Record<string, string>
|
|
127
|
+
initializationOptions?: unknown
|
|
128
|
+
configuration?: unknown // forma de objeto responde workspace/configuration por sección
|
|
129
|
+
formattingOptions?: unknown // p. ej. { tabSize: 2, insertSpaces: true }
|
|
130
|
+
maxMessageBytes?: number // por defecto 16000000
|
|
131
|
+
maxStderrBytes?: number // por defecto 1000000
|
|
132
|
+
killGraceMs?: number // por defecto 2000
|
|
133
|
+
shutdownTimeoutMs?: number // por defecto 5000
|
|
134
|
+
diagnosticsSettleMs?: number // por defecto 2000 (ventana de diagnósticos solo push)
|
|
135
|
+
diagnosticsDebounceMs?: number // por defecto 250 (período de calma tras el último lote empujado)
|
|
136
|
+
idleTimeoutMs?: number // por defecto 0 (0 = mantener vivo el proceso del servidor)
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Códigos de error
|
|
141
|
+
|
|
142
|
+
Cada fallo lleva un `code` estable en el resultado de error; los modelos y llamadores enrutan por el código, nunca por el texto del mensaje.
|
|
143
|
+
|
|
144
|
+
| Code | Significado |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `LSP_ACTION_UNAVAILABLE` | Ninguna entrada de servidor ni provider del seam maneja este archivo. |
|
|
147
|
+
| `LSP_ACTION_UNSUPPORTED` | El servidor (o el provider del seam) no anuncia la operación. |
|
|
148
|
+
| `LSP_ACTION_SERVER_FAILED` | El servidor falló (con la cola de su stderr); los fallos de arranque reintentan una vez. |
|
|
149
|
+
| `LSP_ACTION_MALFORMED_RESPONSE` | El servidor envió una carga estructuralmente inválida. |
|
|
150
|
+
| `LSP_ACTION_CONFLICT` | El archivo cambió desde que se leyó, o las ediciones del servidor se solapan / salen de límites / salen del workspace. |
|
|
151
|
+
| `LSP_ACTION_READ_ONLY` | El modo sandbox de la sesión prohíbe la escritura del formateo/renombrado. |
|
|
152
|
+
| `LSP_ACTION_WORKSPACE_REQUIRED` | La sesión que llama no tiene un cwd de workspace donde enraizar el servidor. |
|
|
153
|
+
| `LSP_ACTION_NO_SYMBOL` | El servidor no encontró un símbolo renombrable en la posición del cursor. |
|
|
154
|
+
|
|
155
|
+
### Versión de host soportada
|
|
156
|
+
|
|
157
|
+
El plugin declara los paquetes de DeepSeek Harness como **peer dependencies** (`@deepseek-ai/dsh-fs`, `dsh-llm`, `dsh-sandbox`, `dsh-subprocess`, `dsh-tools` ≥ `0.1.0-rc.6`), de modo que una sola copia sirve al host y al plugin. Probado contra `0.1.0-rc.6`.
|
|
158
|
+
|
|
159
|
+
### Limitaciones conocidas
|
|
160
|
+
|
|
161
|
+
- **Documentos transitorios.** Cada acción abre el archivo, ejecuta una petición y lo cierra de nuevo (igual que el host stdio oficial). Los servidores basados en proyecto que exigen un archivo abierto residente para peticiones sin documento (tsls rechaza `workspace/symbol` sin uno) se sirven pasando `file_path` a `lsp_symbols`, que mantiene el archivo de enrutamiento abierto durante esa petición. tsls también responde `textDocument/signatureHelp` con `null` bajo este ciclo de vida; otros servidores (gopls, pyright, rust-analyzer) lo sirven con normalidad.
|
|
162
|
+
- **El formateo de rango exige el provider de rango del servidor.** Los servidores que solo anuncian formateo de documento completo fallan las peticiones de rango con `LSP_ACTION_UNSUPPORTED`.
|
|
163
|
+
- **El renombrado solo aplica ediciones de texto.** Las operaciones de recursos (crear/borrar/renombrar archivos) en la respuesta de renombrado del servidor se rechazan con `LSP_ACTION_UNSUPPORTED`, y las ediciones fuera del workspace fallan con `LSP_ACTION_CONFLICT` antes de escribir nada. En servidores `utf-8`/`utf-32`, las posiciones de renombrado entre archivos se decodifican leyendo cada archivo editado; un archivo editado ilegible falla la llamada como conflicto en lugar de decodificar mal las posiciones.
|
|
164
|
+
|
|
165
|
+
## Desarrollo
|
|
166
|
+
|
|
167
|
+
```sh
|
|
168
|
+
pnpm install
|
|
169
|
+
pnpm run lint # oxlint sobre src/ y tests/
|
|
170
|
+
pnpm test # más de 240 tests: unidad + integración con servidor fixture + e2e real con tsls
|
|
171
|
+
pnpm run test:coverage # puertas: líneas/sentencias/funciones ≥ 90%, ramas ≥ 85%
|
|
172
|
+
pnpm build # emite lib/
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
[Apache License 2.0](LICENSE)
|