dsh-lsp-actions 0.2.0 → 0.3.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.es.md +11 -0
  3. package/README.hi.md +11 -0
  4. package/README.md +108 -6
  5. package/README.pt.md +11 -0
  6. package/README.zh-CN.md +110 -6
  7. package/cordis.patch.yml +6 -0
  8. package/docs/editor-protocol.md +159 -0
  9. package/docs/editor-protocol.zh-CN.md +159 -0
  10. package/docs/seam-extension-notes.md +76 -0
  11. package/examples/vscode/README.md +72 -0
  12. package/examples/vscode/README.zh-CN.md +72 -0
  13. package/examples/vscode/backend/bin.mjs +44 -0
  14. package/examples/vscode/backend/cordis.yml +53 -0
  15. package/examples/vscode/backend/package.json +22 -0
  16. package/examples/vscode/extension/package.json +96 -0
  17. package/examples/vscode/extension/src/client.js +100 -0
  18. package/examples/vscode/extension/src/extension.js +187 -0
  19. package/examples/vscode/extension/src/views.js +127 -0
  20. package/lib/editor/actions.d.ts +44 -0
  21. package/lib/editor/actions.d.ts.map +1 -0
  22. package/lib/editor/actions.js +370 -0
  23. package/lib/editor/actions.js.map +1 -0
  24. package/lib/editor/cache.d.ts +51 -0
  25. package/lib/editor/cache.d.ts.map +1 -0
  26. package/lib/editor/cache.js +75 -0
  27. package/lib/editor/cache.js.map +1 -0
  28. package/lib/editor/server.d.ts +61 -0
  29. package/lib/editor/server.d.ts.map +1 -0
  30. package/lib/editor/server.js +97 -0
  31. package/lib/editor/server.js.map +1 -0
  32. package/lib/editor/service.d.ts +63 -0
  33. package/lib/editor/service.d.ts.map +1 -0
  34. package/lib/editor/service.js +181 -0
  35. package/lib/editor/service.js.map +1 -0
  36. package/lib/editor/transport.d.ts +53 -0
  37. package/lib/editor/transport.d.ts.map +1 -0
  38. package/lib/editor/transport.js +143 -0
  39. package/lib/editor/transport.js.map +1 -0
  40. package/lib/editor/types.d.ts +185 -0
  41. package/lib/editor/types.d.ts.map +1 -0
  42. package/lib/editor/types.js +13 -0
  43. package/lib/editor/types.js.map +1 -0
  44. package/lib/index.d.ts +6 -0
  45. package/lib/index.d.ts.map +1 -1
  46. package/lib/index.js +26 -1
  47. package/lib/index.js.map +1 -1
  48. package/lib/servers.d.ts +20 -1
  49. package/lib/servers.d.ts.map +1 -1
  50. package/lib/servers.js +6 -0
  51. package/lib/servers.js.map +1 -1
  52. package/lib/tools.d.ts +13 -0
  53. package/lib/tools.d.ts.map +1 -1
  54. package/lib/tools.js +2 -2
  55. package/lib/tools.js.map +1 -1
  56. package/lib/vocabulary.d.ts +3 -1
  57. package/lib/vocabulary.d.ts.map +1 -1
  58. package/lib/vocabulary.js.map +1 -1
  59. package/package.json +51 -3
@@ -0,0 +1,370 @@
1
+ /**
2
+ * The four editor-protocol actions (`diagnostics.get`, `completion.get`, `quickfix.apply`,
3
+ * `format`) over the same seam-first action runner the model tools use. Read-only actions are
4
+ * reference-only; the two write actions apply server-verified edits through the official
5
+ * `fs/write-intent` waterfall and the per-session sandbox policy — the same official permission
6
+ * presets and approval choreography as `lsp_format`/`lsp_rename`, with the editor's escalation
7
+ * pair (`sandbox_permissions` + `justification`) resolved through `approveEscalation`.
8
+ *
9
+ * Positions and ranges here are zero-based (LSP convention); the model tools keep one-based.
10
+ * @module dsh-lsp-actions/editor/actions
11
+ */
12
+ import { CallId } from '@deepseek-ai/dsh-llm';
13
+ import { approveEscalation, sandboxDenialMarker, escalationHintMarker, validateEscalationArgs } from '@deepseek-ai/dsh-sandbox';
14
+ import { applyEdits } from "../edits.js";
15
+ import { readHostSource, canonicalizeWorkspace, workspaceRelativePath } from "../host.js";
16
+ import { linesChangedByEdits, mapWriteFailure } from "../tools.js";
17
+ import { LspActionError } from "../vocabulary.js";
18
+ /** The static v1 action catalog, in the order `lsp.actions.list` advertises it. */
19
+ export const EDITOR_ACTIONS = [
20
+ {
21
+ action: 'diagnostics.get',
22
+ writes: false,
23
+ description: 'Fetch compiler/analyzer diagnostics for one file from its language server (read-only).',
24
+ },
25
+ {
26
+ action: 'completion.get',
27
+ writes: false,
28
+ description: 'Request completion suggestions at a zero-based cursor position (read-only).',
29
+ },
30
+ {
31
+ action: 'quickfix.apply',
32
+ writes: true,
33
+ description: 'Select one server-verified code action (quickfix) and apply its edits through the official write policy.',
34
+ },
35
+ {
36
+ action: 'format',
37
+ writes: true,
38
+ description: 'Format a file (or a zero-based selection) through its language server and apply the result.',
39
+ },
40
+ ];
41
+ /** Dispatch one action id to its handler. */
42
+ export function runEditorAction(deps, action, params, run) {
43
+ switch (action) {
44
+ case 'diagnostics.get':
45
+ return runDiagnosticsGet(deps, params, run);
46
+ case 'completion.get':
47
+ return runCompletionGet(deps, params, run);
48
+ case 'quickfix.apply':
49
+ return runQuickfixApply(deps, params, run);
50
+ case 'format':
51
+ return runFormat(deps, params, run);
52
+ default:
53
+ throw new LspActionError(`unknown editor action "${action}" — call lsp.actions.list for the v1 catalog`, 'LSP_ACTION_UNKNOWN');
54
+ }
55
+ }
56
+ /**
57
+ * `diagnostics.get`: read-only diagnostics for one file, count-capped, cached (LRU, freshness-
58
+ * stamped), and announced to every connected editor as a `diagnostics.updated` event.
59
+ */
60
+ async function runDiagnosticsGet(deps, params, run) {
61
+ const { filePath, workspaceRoot } = requireWorkspaceParams(params, 'diagnostics.get');
62
+ const request = await prepareEditorRequest(deps, filePath, workspaceRoot, run.signal);
63
+ const result = await deps.runner.diagnostics(request, run.signal);
64
+ const capped = result.diagnostics.slice(0, deps.config.maxDiagnostics);
65
+ const diagnostics = capped.map(projectDiagnostic);
66
+ const source = request.source;
67
+ const snapshot = {
68
+ filePath: source.target.displayPath,
69
+ ...source.version === undefined ? {} : { version: String(source.version) },
70
+ diagnostics,
71
+ truncated: result.diagnostics.length > capped.length,
72
+ total: result.diagnostics.length,
73
+ updatedAt: Date.now(),
74
+ };
75
+ deps.cache.set(snapshot);
76
+ const payload = {
77
+ kind: 'diagnostics',
78
+ filePath,
79
+ diagnostics,
80
+ truncated: snapshot.truncated,
81
+ total: snapshot.total,
82
+ ...params.includeSource === true ? { source: source.text } : {},
83
+ };
84
+ deps.onEvent({
85
+ kind: 'diagnostics.updated',
86
+ filePath,
87
+ diagnostics,
88
+ truncated: snapshot.truncated,
89
+ total: snapshot.total,
90
+ ...firstSource(diagnostics) === undefined ? {} : { source: firstSource(diagnostics) },
91
+ });
92
+ return payload;
93
+ }
94
+ /**
95
+ * `completion.get`: reference-only completion items at a zero-based cursor position. Nothing is
96
+ * applied — the editor owns insertion.
97
+ */
98
+ async function runCompletionGet(deps, params, run) {
99
+ const { filePath, workspaceRoot } = requireWorkspaceParams(params, 'completion.get');
100
+ const position = parseEditorPosition(params.position, 'completion.get');
101
+ const request = await prepareEditorRequest(deps, filePath, workspaceRoot, run.signal);
102
+ const result = await deps.runner.completion({ ...request, position }, run.signal);
103
+ const capped = result.items.slice(0, deps.config.maxCompletionItems);
104
+ return {
105
+ kind: 'completion',
106
+ filePath,
107
+ position,
108
+ items: capped.map(projectCompletionItem),
109
+ truncated: result.items.length > capped.length,
110
+ total: result.items.length,
111
+ };
112
+ }
113
+ /**
114
+ * `quickfix.apply`: select one server-verified code action by exact `title` or zero-based `index`
115
+ * (defaulting to the range of the first cached error diagnostic for the file) and apply its
116
+ * grouped edits through the official write path. Command-only actions are never executed.
117
+ */
118
+ async function runQuickfixApply(deps, params, run) {
119
+ const { filePath, workspaceRoot } = requireWorkspaceParams(params, 'quickfix.apply');
120
+ const policy = await resolveEditorPolicy(deps, 'lsp.actions quickfix.apply', params, run);
121
+ const request = await prepareEditorRequest(deps, filePath, workspaceRoot, run.signal);
122
+ const wireRange = params.range === undefined
123
+ ? firstCachedErrorRange(deps.cache, request.source)
124
+ : parseEditorRange(params.range, 'quickfix.apply');
125
+ const result = await deps.runner.codeActions({
126
+ ...request,
127
+ ...wireRange === undefined ? {} : { range: wireRange },
128
+ ...params.only === undefined || params.only.length === 0 ? {} : { onlyKinds: params.only },
129
+ }, run.signal);
130
+ const selected = selectCodeAction(result.items, params.title, params.index);
131
+ if (selected === undefined) {
132
+ const titles = result.items.map(item => `"${item.title}"`).join(', ');
133
+ throw new LspActionError(`no code action matched (titles: ${titles === '' ? 'none' : titles}) — pass an exact title or a zero-based index`, 'LSP_ACTION_UNKNOWN');
134
+ }
135
+ if (Object.keys(selected.edits).length === 0) {
136
+ throw new LspActionError(`the code action "${selected.title}" carries no edits (command-only actions are never executed)`, 'LSP_ACTION_UNKNOWN');
137
+ }
138
+ const applied = await applyEditorEdits(deps, request.workspace, selected.edits, policy, run.signal);
139
+ if (applied.filesChanged === 0) {
140
+ return { kind: 'unchanged', filePath };
141
+ }
142
+ return {
143
+ kind: 'quickfixApplied',
144
+ filePath,
145
+ title: selected.title,
146
+ filesChanged: applied.filesChanged,
147
+ appliedEdits: applied.appliedEdits,
148
+ diffs: applied.diffs,
149
+ };
150
+ }
151
+ /**
152
+ * `format`: whole-file or range formatting through the language server, applied through the
153
+ * official write path exactly like the `lsp_format` tool. A read-only session fails loud before
154
+ * any server round-trip; a stale file fails as a structured conflict.
155
+ */
156
+ async function runFormat(deps, params, run) {
157
+ const { filePath, workspaceRoot } = requireWorkspaceParams(params, 'format');
158
+ const policy = await resolveEditorPolicy(deps, 'lsp.actions format', params, run);
159
+ const request = await prepareEditorRequest(deps, filePath, workspaceRoot, run.signal);
160
+ if (request.source.version !== undefined) {
161
+ deps.ctx.emit('fs/observed', request.source.target, { kind: 'present', version: request.source.version }, undefined);
162
+ }
163
+ const range = params.range === undefined ? undefined : parseEditorRange(params.range, 'format');
164
+ const result = await deps.runner.formatDocument({ ...request, range }, run.signal);
165
+ if (result.edits.length === 0) {
166
+ return { kind: 'unchanged', filePath };
167
+ }
168
+ const newText = applyEdits(request.source.text, result.edits);
169
+ const intent = await deps.ctx.waterfall('fs/write-intent', request.source.target, undefined, () => undefined);
170
+ let outcome;
171
+ try {
172
+ outcome = await deps.ctx.fs.writeText(request.source.target, newText, intent, run.signal, policy);
173
+ }
174
+ catch (error) {
175
+ throw mapWriteFailure(deps.sandbox.mapError(error, policy), 'lsp.actions format');
176
+ }
177
+ deps.ctx.emit('fs/observed', request.source.target, { kind: 'present', version: outcome.version }, undefined);
178
+ deps.cache.delete(request.source.target.displayPath);
179
+ deps.onEvent({ kind: 'file.changed', filePath });
180
+ return {
181
+ kind: 'formatted',
182
+ filePath,
183
+ appliedEdits: result.edits.length,
184
+ linesChanged: linesChangedByEdits(result.edits),
185
+ before: outcome.before ?? request.source.text,
186
+ after: outcome.after,
187
+ };
188
+ }
189
+ /** The validated workspace pair every action needs: the editor always names the workspace root. */
190
+ function requireWorkspaceParams(params, action) {
191
+ if (typeof params?.filePath !== 'string' || params.filePath.trim() === '') {
192
+ throw new LspActionError(`${action} requires a non-empty string filePath`, 'LSP_ACTION_INVALID_ARGS');
193
+ }
194
+ if (typeof params.workspaceRoot !== 'string' || params.workspaceRoot.trim() === '') {
195
+ throw new LspActionError(`${action} requires a non-empty string workspaceRoot`, 'LSP_ACTION_INVALID_ARGS');
196
+ }
197
+ return { filePath: params.filePath, workspaceRoot: params.workspaceRoot };
198
+ }
199
+ /** Canonicalize the workspace and read the byte-bounded source, like the model tools prepare. */
200
+ async function prepareEditorRequest(deps, filePath, workspaceRoot, signal) {
201
+ const workspace = await canonicalizeWorkspace(deps.ctx.fs, workspaceRoot, signal);
202
+ const source = await readHostSource(deps.ctx.fs, filePath, workspace, deps.config.maxDocumentBytes, signal);
203
+ return { filePath, workspaceRoot, source, workspace };
204
+ }
205
+ /** Validate one zero-based cursor position (LSP convention). */
206
+ function parseEditorPosition(position, action) {
207
+ if (position === null || typeof position !== 'object') {
208
+ throw new LspActionError(`${action} requires a position { line, character } (zero-based)`, 'LSP_ACTION_INVALID_ARGS');
209
+ }
210
+ const { line, character } = position;
211
+ if (!Number.isInteger(line) || line < 0 || !Number.isInteger(character) || character < 0) {
212
+ throw new LspActionError(`${action} position must be zero-based non-negative integers`, 'LSP_ACTION_INVALID_ARGS');
213
+ }
214
+ return { line: line, character: character };
215
+ }
216
+ /** Validate one zero-based half-open range (LSP convention). */
217
+ function parseEditorRange(range, action) {
218
+ if (range === null || typeof range !== 'object') {
219
+ throw new LspActionError(`${action} requires a range { start, end } (zero-based)`, 'LSP_ACTION_INVALID_ARGS');
220
+ }
221
+ const { start, end } = range;
222
+ const parsedStart = parseEditorPosition(start, action);
223
+ const parsedEnd = parseEditorPosition(end, action);
224
+ if (parsedEnd.line < parsedStart.line || (parsedEnd.line === parsedStart.line && parsedEnd.character < parsedStart.character)) {
225
+ throw new LspActionError(`${action} range end must not precede range start`, 'LSP_ACTION_INVALID_ARGS');
226
+ }
227
+ return { start: parsedStart, end: parsedEnd };
228
+ }
229
+ /**
230
+ * Resolve the per-run sandbox policy through the official per-session resolver, mirroring
231
+ * `FormatSandboxController.resolvePolicy` for the editor execution shape: the standing preset
232
+ * (permission preset gate — a read-only session refuses writes before any server round-trip), and
233
+ * the official one-shot escalation ask through `approveEscalation` when the editor carries the
234
+ * `sandbox_permissions` + `justification` pair. Every escalation-approval failure (no approval
235
+ * service, no live agent, no open turn, rejection, cancellation) surfaces as the stable
236
+ * `LSP_ACTION_APPROVAL_UNAVAILABLE` code with the official text — fail closed, never widened.
237
+ */
238
+ async function resolveEditorPolicy(deps, toolName, args, run) {
239
+ validateEscalationArgs(args.sandbox_permissions, args.justification);
240
+ const policyService = deps.ctx.get('sandboxPolicy');
241
+ // The runtime object is the addressed session's real session; the structural editor agent type
242
+ // just avoids an agent-package dependency here.
243
+ const request = (run.agent === undefined ? {} : { session: run.agent.session });
244
+ const standingPolicy = policyService?.resolve(request);
245
+ if (standingPolicy !== undefined && standingPolicy.mode === 'read-only') {
246
+ throw new LspActionError(`${sandboxDenialMarker(standingPolicy.mode)}\n${escalationHintMarker('operation')}`, 'LSP_ACTION_READ_ONLY');
247
+ }
248
+ if (args.sandbox_permissions === undefined || args.justification === undefined) {
249
+ return standingPolicy;
250
+ }
251
+ if (deps.sandbox.escalationModes.length === 0) {
252
+ throw new LspActionError('sandbox_permissions is not available in this composition (no sandboxing filesystem to escalate)', 'LSP_ACTION_APPROVAL_UNAVAILABLE');
253
+ }
254
+ const policy = standingPolicy;
255
+ try {
256
+ const approvedMode = await approveEscalation({ requestedMode: args.sandbox_permissions, justification: args.justification, effectiveMode: policy.mode, subject: 'operation' }, {
257
+ approver: deps.ctx.get('approval'),
258
+ agent: run.agent,
259
+ callId: CallId(`lsp-editor:${run.requestId}`),
260
+ toolName,
261
+ signal: run.signal,
262
+ });
263
+ return { ...policy, mode: approvedMode };
264
+ }
265
+ catch (error) {
266
+ throw new LspActionError(`the official approval path did not grant the wider sandbox mode: ${messageOf(error)}`, 'LSP_ACTION_APPROVAL_UNAVAILABLE', { cause: error });
267
+ }
268
+ }
269
+ /**
270
+ * Apply one grouped edit record (document URI → text edits) through the official write path,
271
+ * pre-flighting every target before the first write — the same fail-before-any-byte contract as
272
+ * `lsp_rename`. No-op files are dropped; out-of-workspace targets fail as conflicts.
273
+ */
274
+ async function applyEditorEdits(deps, workspace, edits, policy, signal) {
275
+ const planned = [];
276
+ for (const [uri, fileEdits] of Object.entries(edits)) {
277
+ const relative = workspaceRelativePath(workspace, uri);
278
+ if (relative === undefined) {
279
+ throw new LspActionError(`the language server's edits touch a file outside the workspace (${uri}); refusing to apply them`, 'LSP_ACTION_CONFLICT');
280
+ }
281
+ const source = await readHostSource(deps.ctx.fs, relative, workspace, deps.config.maxDocumentBytes, signal);
282
+ if (source.version !== undefined) {
283
+ deps.ctx.emit('fs/observed', source.target, { kind: 'present', version: source.version }, undefined);
284
+ }
285
+ const after = applyEdits(source.text, fileEdits);
286
+ if (after !== source.text) {
287
+ planned.push({ filePath: relative, target: source.target, before: source.text, after, edits: fileEdits.length });
288
+ }
289
+ }
290
+ let appliedEdits = 0;
291
+ let written = 0;
292
+ const diffs = [];
293
+ for (const file of planned) {
294
+ const intent = await deps.ctx.waterfall('fs/write-intent', file.target, undefined, () => undefined);
295
+ try {
296
+ const outcome = await deps.ctx.fs.writeText(file.target, file.after, intent, signal, policy);
297
+ deps.ctx.emit('fs/observed', file.target, { kind: 'present', version: outcome.version }, undefined);
298
+ deps.cache.delete(file.target.displayPath);
299
+ deps.onEvent({ kind: 'file.changed', filePath: file.filePath });
300
+ appliedEdits += file.edits;
301
+ written += 1;
302
+ diffs.push({ filePath: file.filePath, before: outcome.before ?? file.before, after: outcome.after });
303
+ }
304
+ catch (error) {
305
+ const mapped = mapWriteFailure(deps.sandbox.mapError(error, policy), 'lsp.actions quickfix.apply');
306
+ if (mapped instanceof LspActionError && mapped.code === 'LSP_ACTION_CONFLICT' && written > 0) {
307
+ throw new LspActionError(`${mapped.message} (${written} of ${planned.length} file${planned.length === 1 ? '' : 's'} were already updated)`, 'LSP_ACTION_CONFLICT', { cause: error });
308
+ }
309
+ throw mapped;
310
+ }
311
+ }
312
+ return { filesChanged: written, appliedEdits, diffs };
313
+ }
314
+ /** Select the code action the editor asked for: exact title wins, then zero-based index. */
315
+ function selectCodeAction(items, title, index) {
316
+ if (title !== undefined && title.trim() !== '') {
317
+ return items.find(item => item.title === title);
318
+ }
319
+ const position = index === undefined ? 0 : index;
320
+ if (!Number.isInteger(position) || position < 0)
321
+ return undefined;
322
+ return items[position];
323
+ }
324
+ /**
325
+ * The range of the first error-severity cached diagnostic for the source, when the cache holds a
326
+ * snapshot of the exact same source version — otherwise undefined (the server's own
327
+ * first-diagnostic behavior applies). Prevents quickfixes from landing on a moved line.
328
+ */
329
+ function firstCachedErrorRange(cache, source) {
330
+ const snapshot = cache.get(source.target.displayPath);
331
+ if (snapshot === undefined)
332
+ return undefined;
333
+ if (source.version !== undefined && snapshot.version !== undefined && snapshot.version !== String(source.version))
334
+ return undefined;
335
+ return snapshot.diagnostics.find(diagnostic => diagnostic.severity === 1)?.range;
336
+ }
337
+ /** Project one normalized diagnostic into the editor wire shape (plain JSON values only). */
338
+ function projectDiagnostic(diagnostic) {
339
+ return {
340
+ severity: diagnostic.severity,
341
+ range: diagnostic.range,
342
+ message: diagnostic.message,
343
+ ...diagnostic.source === undefined ? {} : { source: diagnostic.source },
344
+ ...diagnostic.code === undefined ? {} : { code: diagnostic.code },
345
+ };
346
+ }
347
+ /** Project one normalized completion item into the editor wire shape. */
348
+ function projectCompletionItem(item) {
349
+ return {
350
+ label: item.label,
351
+ ...item.kind === undefined ? {} : { kind: item.kind },
352
+ ...item.detail === undefined ? {} : { detail: item.detail },
353
+ ...item.insertText === undefined ? {} : { insertText: item.insertText },
354
+ ...item.sortText === undefined ? {} : { sortText: item.sortText },
355
+ ...item.textEdit === undefined ? {} : {
356
+ textEdit: {
357
+ range: { start: item.textEdit.range.start, end: item.textEdit.range.end },
358
+ newText: item.textEdit.newText,
359
+ },
360
+ },
361
+ };
362
+ }
363
+ /** The first named diagnostic source, for the `diagnostics.updated` event's source field. */
364
+ function firstSource(diagnostics) {
365
+ return diagnostics.find(diagnostic => diagnostic.source !== undefined)?.source;
366
+ }
367
+ function messageOf(error) {
368
+ return error instanceof Error ? error.message : String(error);
369
+ }
370
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/editor/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAG7C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAE/H,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAKzF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAmCjD,mFAAmF;AACnF,MAAM,CAAC,MAAM,cAAc,GAAsC;IAC/D;QACE,MAAM,EAAE,i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,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;QACjE,GAAG,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACpC,QAAQ,EAAE;gBACR,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE;gBACzE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO;aAC/B;SACF;KACF,CAAA;AACH,CAAC;AAED,6FAA6F;AAC7F,SAAS,WAAW,CAAC,WAA2C;IAC9D,OAAO,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,KAAK,SAAS,CAAC,EAAE,MAAM,CAAA;AAChF,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC/D,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The bounded diagnostics cache for the editor protocol: a Map-backed LRU keyed by absolute file
3
+ * path, capped by `maxFiles`. Entries carry the freshness token of the source they were computed
4
+ * against, so a `quickfix.apply` without an explicit range can refuse stale first-diagnostic
5
+ * targeting instead of applying a fix to a line that moved. Every access refreshes recency; the
6
+ * bound evicts least-recently-used entries, so memory is bounded by config, not by history.
7
+ * @module dsh-lsp-actions/editor/cache
8
+ */
9
+ import type { EditorDiagnostic } from './types.ts';
10
+ /** One cached diagnostics snapshot for a file. */
11
+ export interface CachedDiagnostics {
12
+ /** The absolute file path the snapshot covers. */
13
+ readonly filePath: string;
14
+ /** The source freshness token the diagnostics were computed against (absent when unknown). */
15
+ readonly version?: string;
16
+ /** The snapshot's diagnostics, already count-capped by the action. */
17
+ readonly diagnostics: readonly EditorDiagnostic[];
18
+ /** Whether the snapshot is truncated at the configured cap. */
19
+ readonly truncated: boolean;
20
+ /** The server-reported total before capping. */
21
+ readonly total: number;
22
+ /** Wall-clock time of the snapshot (ms epoch), for diagnostics and tests. */
23
+ readonly updatedAt: number;
24
+ }
25
+ /**
26
+ * A bounded LRU cache of diagnostics snapshots. `maxFiles` is validated at construction and may be
27
+ * reduced later; entries are evicted least-recently-used first until the bound holds.
28
+ */
29
+ export declare class LruDiagnosticsCache {
30
+ private maxFiles;
31
+ private readonly entries;
32
+ constructor(maxFiles: number);
33
+ /** The current bound. */
34
+ get capacity(): number;
35
+ /** The number of cached files. */
36
+ get size(): number;
37
+ /** The absolute file paths currently cached, most-recently-accessed last. */
38
+ get keys(): readonly string[];
39
+ /** Read one snapshot, refreshing its recency. */
40
+ get(filePath: string): CachedDiagnostics | undefined;
41
+ /** Store one snapshot, evicting least-recently-used entries beyond the bound. */
42
+ set(entry: CachedDiagnostics): void;
43
+ /** Drop one file's snapshot (no-op when absent). */
44
+ delete(filePath: string): boolean;
45
+ /** Drop every snapshot. */
46
+ clear(): void;
47
+ /** Change the bound, evicting immediately when it shrinks. */
48
+ setCapacity(maxFiles: number): void;
49
+ private evict;
50
+ }
51
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/editor/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,kDAAkD;AAClD,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,8FAA8F;IAC9F,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,CAAA;IACjD,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B;AAED;;;GAGG;AACH,qBAAa,mBAAmB;IAGlB,OAAO,CAAC,QAAQ;IAF5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuC;gBAE3C,QAAQ,EAAE,MAAM;IAMpC,yBAAyB;IACzB,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,kCAAkC;IAClC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,6EAA6E;IAC7E,IAAI,IAAI,IAAI,SAAS,MAAM,EAAE,CAE5B;IAED,iDAAiD;IACjD,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IASpD,iFAAiF;IACjF,GAAG,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAMnC,oDAAoD;IACpD,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIjC,2BAA2B;IAC3B,KAAK,IAAI,IAAI;IAIb,8DAA8D;IAC9D,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQnC,OAAO,CAAC,KAAK;CAOd"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * The bounded diagnostics cache for the editor protocol: a Map-backed LRU keyed by absolute file
3
+ * path, capped by `maxFiles`. Entries carry the freshness token of the source they were computed
4
+ * against, so a `quickfix.apply` without an explicit range can refuse stale first-diagnostic
5
+ * targeting instead of applying a fix to a line that moved. Every access refreshes recency; the
6
+ * bound evicts least-recently-used entries, so memory is bounded by config, not by history.
7
+ * @module dsh-lsp-actions/editor/cache
8
+ */
9
+ /**
10
+ * A bounded LRU cache of diagnostics snapshots. `maxFiles` is validated at construction and may be
11
+ * reduced later; entries are evicted least-recently-used first until the bound holds.
12
+ */
13
+ export class LruDiagnosticsCache {
14
+ maxFiles;
15
+ entries = new Map();
16
+ constructor(maxFiles) {
17
+ this.maxFiles = maxFiles;
18
+ if (!Number.isInteger(maxFiles) || maxFiles <= 0) {
19
+ throw new TypeError('editor.diagnosticsCacheMaxFiles must be a positive integer');
20
+ }
21
+ }
22
+ /** The current bound. */
23
+ get capacity() {
24
+ return this.maxFiles;
25
+ }
26
+ /** The number of cached files. */
27
+ get size() {
28
+ return this.entries.size;
29
+ }
30
+ /** The absolute file paths currently cached, most-recently-accessed last. */
31
+ get keys() {
32
+ return [...this.entries.keys()];
33
+ }
34
+ /** Read one snapshot, refreshing its recency. */
35
+ get(filePath) {
36
+ const entry = this.entries.get(filePath);
37
+ if (entry === undefined)
38
+ return undefined;
39
+ // Refresh recency: re-insertion moves the entry to the tail of the map.
40
+ this.entries.delete(filePath);
41
+ this.entries.set(filePath, entry);
42
+ return entry;
43
+ }
44
+ /** Store one snapshot, evicting least-recently-used entries beyond the bound. */
45
+ set(entry) {
46
+ this.entries.delete(entry.filePath);
47
+ this.entries.set(entry.filePath, entry);
48
+ this.evict();
49
+ }
50
+ /** Drop one file's snapshot (no-op when absent). */
51
+ delete(filePath) {
52
+ return this.entries.delete(filePath);
53
+ }
54
+ /** Drop every snapshot. */
55
+ clear() {
56
+ this.entries.clear();
57
+ }
58
+ /** Change the bound, evicting immediately when it shrinks. */
59
+ setCapacity(maxFiles) {
60
+ if (!Number.isInteger(maxFiles) || maxFiles <= 0) {
61
+ throw new TypeError('editor.diagnosticsCacheMaxFiles must be a positive integer');
62
+ }
63
+ this.maxFiles = maxFiles;
64
+ this.evict();
65
+ }
66
+ evict() {
67
+ while (this.entries.size > this.maxFiles) {
68
+ const oldest = this.entries.keys().next().value;
69
+ if (oldest === undefined)
70
+ break;
71
+ this.entries.delete(oldest);
72
+ }
73
+ }
74
+ }
75
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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vC,IAAI,CAAC,KAAK,EAAE,CAAA;IACd,CAAC;IAED,oDAAoD;IACpD,MAAM,CAAC,QAAgB;QACrB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACtC,CAAC;IAED,2BAA2B;IAC3B,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;IACtB,CAAC;IAED,8DAA8D;IAC9D,WAAW,CAAC,QAAgB;QAC1B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;YACjD,MAAM,IAAI,SAAS,CAAC,4DAA4D,CAAC,CAAA;QACnF,CAAC;QACD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,KAAK,EAAE,CAAA;IACd,CAAC;IAEO,KAAK;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACzC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAA;YAC/C,IAAI,MAAM,KAAK,SAAS;gBAAE,MAAK;YAC/B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAC7B,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * The editor-protocol JSON-RPC server: serves `lsp.actions.list` / `lsp.actions.run` and the
3
+ * client-controlled `lsp.events` subscription over a newline-delimited JSON-RPC stdio channel.
4
+ * This is a thin transport consumer of {@link EditorActionService} — all protocol and permission
5
+ * logic lives there, so any other transport (HTTP, WS, an upstream extension point) can serve the
6
+ * same surface unchanged.
7
+ *
8
+ * Stdout is reserved for protocol frames: enable this only in a dedicated headless composition
9
+ * whose stdout nothing else claims (the plugin refuses nothing at load — the deployment owns that
10
+ * contract, exactly like the official SDK JSON-RPC server).
11
+ * @module dsh-lsp-actions/editor/server
12
+ */
13
+ import type { Readable, Writable } from 'node:stream';
14
+ import type { Context } from '@deepseek-ai/cordis';
15
+ import type { ActionRunner } from '../runner.ts';
16
+ import type { FormatSandboxController } from '../sandbox.ts';
17
+ import type { ResolvedConfig } from '../servers.ts';
18
+ import { EditorActionService } from './service.ts';
19
+ /** The three protocol methods, by wire name. */
20
+ export declare const EDITOR_METHOD_LIST = "lsp.actions.list";
21
+ export declare const EDITOR_METHOD_RUN = "lsp.actions.run";
22
+ export declare const EDITOR_METHOD_EVENTS = "lsp.events";
23
+ /** Runtime-only transport hooks for tests; production uses process stdio. */
24
+ export interface EditorServerOptions {
25
+ readonly input?: Readable;
26
+ readonly output?: Writable;
27
+ }
28
+ /** The running editor-protocol runtime: service, transport (when enabled), and disposal. */
29
+ export interface EditorProtocolRuntime {
30
+ readonly service: EditorActionService;
31
+ readonly server: EditorJsonRpcServer;
32
+ dispose(): Promise<void>;
33
+ }
34
+ /**
35
+ * Start the editor protocol for one plugin instance: the bounded diagnostics cache, the
36
+ * transport-agnostic service (listeners attached), and the JSON-RPC stdio server. Every side
37
+ * effect is owned by the returned {@link EditorProtocolRuntime.dispose}, so the plugin's effect
38
+ * scope can reverse the whole surface.
39
+ * @param ctx - the plugin context.
40
+ * @param runner - the seam-first action runner shared with the model tools.
41
+ * @param sandbox - the escalation controller shared with the mutation tools.
42
+ * @param config - the resolved plugin configuration (editor bounds validated by the caller).
43
+ * @returns the runtime to dispose with the plugin.
44
+ */
45
+ export declare function startEditorProtocol(ctx: Context, runner: ActionRunner, sandbox: FormatSandboxController, config: ResolvedConfig): EditorProtocolRuntime;
46
+ /**
47
+ * Serve the editor protocol over one transport. Construction subscribes to the service's event
48
+ * stream only while a client has subscribed via the `lsp.events` notification, so idle
49
+ * connections never accumulate listeners.
50
+ */
51
+ export declare class EditorJsonRpcServer {
52
+ private readonly service;
53
+ private readonly transport;
54
+ private eventsDisposer;
55
+ constructor(service: EditorActionService, options?: EditorServerOptions);
56
+ /** Attach the transport to its streams. */
57
+ start(): void;
58
+ /** Detach the transport and drop the event subscription. */
59
+ close(): void;
60
+ }
61
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/editor/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAGlD,gDAAgD;AAChD,eAAO,MAAM,kBAAkB,qBAAqB,CAAA;AACpD,eAAO,MAAM,iBAAiB,oBAAoB,CAAA;AAClD,eAAO,MAAM,oBAAoB,eAAe,CAAA;AAEhD,6EAA6E;AAC7E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAA;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAA;CAC3B;AAED,4FAA4F;AAC5F,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAA;IACrC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAA;IACpC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,uBAAuB,EAChC,MAAM,EAAE,cAAc,GACrB,qBAAqB,CAiBvB;AAED;;;;GAIG;AACH,qBAAa,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