@otto-code/protocol 0.8.10 → 0.8.12
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/dist/agent-queue.d.ts +87 -0
- package/dist/agent-queue.js +106 -0
- package/dist/brain.d.ts +2321 -0
- package/dist/brain.js +1082 -0
- package/dist/client-capabilities.d.ts +2 -0
- package/dist/client-capabilities.js +10 -0
- package/dist/code-intelligence.d.ts +917 -0
- package/dist/code-intelligence.js +699 -0
- package/dist/communications.d.ts +1106 -0
- package/dist/communications.js +384 -0
- package/dist/context.d.ts +787 -0
- package/dist/context.js +295 -0
- package/dist/daemon-config.d.ts +377 -0
- package/dist/daemon-config.js +395 -0
- package/dist/file-operations.d.ts +380 -0
- package/dist/file-operations.js +282 -0
- package/dist/generated/validation/ws-outbound.aot.js +54927 -48878
- package/dist/git-hosting.d.ts +117 -0
- package/dist/git-hosting.js +109 -0
- package/dist/git-operations.d.ts +255 -0
- package/dist/git-operations.js +221 -0
- package/dist/integration-authorization.d.ts +195 -0
- package/dist/integration-authorization.js +125 -0
- package/dist/kanban.d.ts +341 -0
- package/dist/kanban.js +273 -0
- package/dist/loop/rpc-schemas.d.ts +6 -6
- package/dist/meetings.d.ts +95 -0
- package/dist/meetings.js +57 -0
- package/dist/messages.d.ts +21054 -24042
- package/dist/messages.js +4355 -8731
- package/dist/orchestration.d.ts +726 -0
- package/dist/orchestration.js +232 -0
- package/dist/personality-schemas.d.ts +221 -0
- package/dist/personality-schemas.js +340 -0
- package/dist/preview.d.ts +140 -0
- package/dist/preview.js +98 -0
- package/dist/project-knowledge.d.ts +740 -0
- package/dist/project-knowledge.js +229 -0
- package/dist/project-links.d.ts +102 -0
- package/dist/project-links.js +62 -0
- package/dist/provider-config.d.ts +87 -2
- package/dist/provider-config.js +110 -0
- package/dist/refine.d.ts +93 -0
- package/dist/refine.js +78 -0
- package/dist/schedule/rpc-schemas.d.ts +47 -47
- package/dist/schedule/types.d.ts +13 -13
- package/dist/speech.d.ts +180 -0
- package/dist/speech.js +177 -0
- package/dist/storage.d.ts +79 -0
- package/dist/storage.js +107 -0
- package/dist/suggested-tasks.d.ts +106 -0
- package/dist/suggested-tasks.js +81 -0
- package/dist/terminal-compatibility.d.ts +55 -0
- package/dist/terminal-compatibility.js +35 -0
- package/dist/usage-stats.d.ts +255 -0
- package/dist/usage-stats.js +162 -0
- package/dist/validation/ws-outbound-schema-metadata.d.ts +1404 -274
- package/dist/worktree-ops.d.ts +81 -0
- package/dist/worktree-ops.js +88 -0
- package/package.json +1 -1
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Otto code-intelligence wire schemas: the code.* symbol, definition, hover,
|
|
4
|
+
* references, rename and solution RPCs, plus the lsp.* server-state RPCs and
|
|
5
|
+
* pushes (see docs/code-intelligence.md).
|
|
6
|
+
*
|
|
7
|
+
* Declaration order matters here: the Solution schemas first because the Code
|
|
8
|
+
* responses embed them, then Code, then Lsp, which embeds CodeDiagnosticSchema. These are top-level consts, so a
|
|
9
|
+
* schema referenced before its declaration is a ReferenceError at module
|
|
10
|
+
* evaluation (and in the zod-aot build), not a type error.
|
|
11
|
+
*
|
|
12
|
+
* Code intelligence is a fork-only capability, so its schemas live in their own
|
|
13
|
+
* protocol module rather than inside messages.ts. messages.ts re-exports them.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Solution view responses (projects/solution-view).
|
|
17
|
+
*
|
|
18
|
+
* COMPAT(solutionView): added in v0.6.8, drop the gate when daemon floor >= v0.6.8.
|
|
19
|
+
*/
|
|
20
|
+
export const SolutionFormatSchema = z.enum(["sln", "slnx"]);
|
|
21
|
+
/** One solution a workspace contains. Enough to populate the switcher's picker, nothing more. */
|
|
22
|
+
export const SolutionRefSchema = z.object({
|
|
23
|
+
/** Workspace-relative, forward slashes - the identity used by every later request. */
|
|
24
|
+
path: z.string(),
|
|
25
|
+
/** File name without the extension, which is what a .NET developer calls the solution. */
|
|
26
|
+
name: z.string(),
|
|
27
|
+
format: SolutionFormatSchema,
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Solution structure is flat on the wire with parent links, not nested.
|
|
31
|
+
*
|
|
32
|
+
* A recursive payload would have to be walked to be used, and every consumer would write that
|
|
33
|
+
* walk again; the file explorer already turns a flat listing plus an expanded-path set into rows,
|
|
34
|
+
* so this hands it the same shape it already consumes.
|
|
35
|
+
*/
|
|
36
|
+
export const SolutionTreeFolderSchema = z.object({
|
|
37
|
+
/** Solution-internal, e.g. `/Src/`. Folders are virtual: they have no filesystem location. */
|
|
38
|
+
path: z.string(),
|
|
39
|
+
name: z.string(),
|
|
40
|
+
parentPath: z.string().nullable(),
|
|
41
|
+
});
|
|
42
|
+
export const SolutionTreeProjectSchema = z.object({
|
|
43
|
+
id: z.string(),
|
|
44
|
+
name: z.string(),
|
|
45
|
+
/**
|
|
46
|
+
* Workspace-relative when the project sits inside the workspace, absolute (forward-slashed)
|
|
47
|
+
* when it does not. `outsideWorkspace` says which, so nothing has to guess by inspecting the
|
|
48
|
+
* string.
|
|
49
|
+
*/
|
|
50
|
+
path: z.string(),
|
|
51
|
+
/**
|
|
52
|
+
* A project the solution names outside the workspace root. Shown and opened like any other -
|
|
53
|
+
* the solution file is the authority naming it, so this is not free browsing - but editing one
|
|
54
|
+
* warns, and it is absent from every git surface. See docs/solution-view.md.
|
|
55
|
+
*/
|
|
56
|
+
outsideWorkspace: z.boolean(),
|
|
57
|
+
/** The solution folder containing it, or null for a project at the solution root. */
|
|
58
|
+
folderPath: z.string().nullable(),
|
|
59
|
+
/** Project type GUID, lowercased. Absent on old daemons. */
|
|
60
|
+
typeId: z.string().optional(),
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Three-valued for the same reason the code-intelligence family is: "the host cannot supply
|
|
64
|
+
* this", "MSBuild refused this project", and "here are its files" are different things to tell a
|
|
65
|
+
* user, and reporting the first two as an empty file list is how a working feature reads as
|
|
66
|
+
* broken. One project that fails must not blank the tree, so this status is per project.
|
|
67
|
+
*/
|
|
68
|
+
export const SolutionProjectStatusSchema = z.enum(["ok", "failed", "unavailable"]);
|
|
69
|
+
/**
|
|
70
|
+
* One entry in a project's evaluated membership, flat with parent links like the folders above.
|
|
71
|
+
*
|
|
72
|
+
* `isImplicit` is what a filesystem tree structurally cannot show and what Phase 2 turns on: an
|
|
73
|
+
* item contributed by the SDK's default globs is one that creating the file already adds, while
|
|
74
|
+
* an item the project file itself declares needs a real `.csproj` edit.
|
|
75
|
+
*/
|
|
76
|
+
export const SolutionProjectNodeSchema = z.discriminatedUnion("kind", [
|
|
77
|
+
z.object({
|
|
78
|
+
kind: z.literal("directory"),
|
|
79
|
+
id: z.string(),
|
|
80
|
+
parentId: z.string().nullable(),
|
|
81
|
+
name: z.string(),
|
|
82
|
+
path: z.string(),
|
|
83
|
+
outsideWorkspace: z.boolean(),
|
|
84
|
+
}),
|
|
85
|
+
z.object({
|
|
86
|
+
kind: z.literal("file"),
|
|
87
|
+
id: z.string(),
|
|
88
|
+
parentId: z.string().nullable(),
|
|
89
|
+
name: z.string(),
|
|
90
|
+
path: z.string(),
|
|
91
|
+
outsideWorkspace: z.boolean(),
|
|
92
|
+
/** `Compile`, `Content`, `EmbeddedResource`, … - MSBuild's own item type. */
|
|
93
|
+
itemType: z.string(),
|
|
94
|
+
isImplicit: z.boolean(),
|
|
95
|
+
}),
|
|
96
|
+
]);
|
|
97
|
+
export const SolutionPackageReferenceSchema = z.object({
|
|
98
|
+
name: z.string(),
|
|
99
|
+
version: z.string().nullable(),
|
|
100
|
+
});
|
|
101
|
+
// ctags-style navigation (no LSP). All three are daemon RPCs so the client
|
|
102
|
+
// never touches the filesystem; the symbol index is name-based and honest.
|
|
103
|
+
export const CodeListFilesRequestSchema = z.object({
|
|
104
|
+
type: z.literal("code.list_files.request"),
|
|
105
|
+
cwd: z.string(),
|
|
106
|
+
requestId: z.string(),
|
|
107
|
+
});
|
|
108
|
+
export const CodeSymbolsRequestSchema = z.object({
|
|
109
|
+
type: z.literal("code.symbols.request"),
|
|
110
|
+
cwd: z.string(),
|
|
111
|
+
name: z.string(),
|
|
112
|
+
requestId: z.string(),
|
|
113
|
+
});
|
|
114
|
+
export const CodeOutlineRequestSchema = z.object({
|
|
115
|
+
type: z.literal("code.outline.request"),
|
|
116
|
+
cwd: z.string(),
|
|
117
|
+
path: z.string(),
|
|
118
|
+
requestId: z.string(),
|
|
119
|
+
});
|
|
120
|
+
/**
|
|
121
|
+
* LSP-backed code intelligence (projects/lsp-code-intelligence). Distinct from the
|
|
122
|
+
* ctags `code.symbols` RPC above in the only way that matters: it carries a
|
|
123
|
+
* **position**, so the daemon can resolve the reference under the cursor instead of
|
|
124
|
+
* matching a name.
|
|
125
|
+
*
|
|
126
|
+
* Line and column are **1-based** here, matching `CodeSymbolLocation` and the rest of
|
|
127
|
+
* Otto. LSP itself is 0-based; that conversion is the daemon's business and does not
|
|
128
|
+
* reach the wire.
|
|
129
|
+
*/
|
|
130
|
+
export const CodeDefinitionRequestSchema = z.object({
|
|
131
|
+
type: z.literal("code.definition.request"),
|
|
132
|
+
cwd: z.string(),
|
|
133
|
+
path: z.string(),
|
|
134
|
+
line: z.number().int().positive(),
|
|
135
|
+
column: z.number().int().positive(),
|
|
136
|
+
requestId: z.string(),
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* The editor's current buffer text, so definitions resolve against unsaved edits
|
|
140
|
+
* rather than stale disk content. Sent debounced, not per keystroke.
|
|
141
|
+
*/
|
|
142
|
+
export const CodeDocumentSyncRequestSchema = z.object({
|
|
143
|
+
type: z.literal("code.document.sync.request"),
|
|
144
|
+
cwd: z.string(),
|
|
145
|
+
path: z.string(),
|
|
146
|
+
text: z.string(),
|
|
147
|
+
requestId: z.string(),
|
|
148
|
+
});
|
|
149
|
+
export const CodeDocumentCloseRequestSchema = z.object({
|
|
150
|
+
type: z.literal("code.document.close.request"),
|
|
151
|
+
cwd: z.string(),
|
|
152
|
+
path: z.string(),
|
|
153
|
+
requestId: z.string(),
|
|
154
|
+
});
|
|
155
|
+
/**
|
|
156
|
+
* The rest of the position-based code-intelligence family. All three carry a 1-based
|
|
157
|
+
* position like `code.definition`, and all three are answered against the mirrored
|
|
158
|
+
* buffer rather than the file on disk.
|
|
159
|
+
*/
|
|
160
|
+
export const CodeHoverRequestSchema = z.object({
|
|
161
|
+
type: z.literal("code.hover.request"),
|
|
162
|
+
cwd: z.string(),
|
|
163
|
+
path: z.string(),
|
|
164
|
+
line: z.number().int().positive(),
|
|
165
|
+
column: z.number().int().positive(),
|
|
166
|
+
requestId: z.string(),
|
|
167
|
+
});
|
|
168
|
+
export const CodeReferencesRequestSchema = z.object({
|
|
169
|
+
type: z.literal("code.references.request"),
|
|
170
|
+
cwd: z.string(),
|
|
171
|
+
path: z.string(),
|
|
172
|
+
line: z.number().int().positive(),
|
|
173
|
+
column: z.number().int().positive(),
|
|
174
|
+
requestId: z.string(),
|
|
175
|
+
});
|
|
176
|
+
/**
|
|
177
|
+
* A rename **dry run**. Deliberately not "do the rename": the daemon computes every edit
|
|
178
|
+
* and returns them for the user to audit, because a rename's blast radius is the whole
|
|
179
|
+
* project. Nothing is written by this request.
|
|
180
|
+
*/
|
|
181
|
+
export const CodeRenamePreviewRequestSchema = z.object({
|
|
182
|
+
type: z.literal("code.rename.preview.request"),
|
|
183
|
+
cwd: z.string(),
|
|
184
|
+
path: z.string(),
|
|
185
|
+
line: z.number().int().positive(),
|
|
186
|
+
column: z.number().int().positive(),
|
|
187
|
+
newName: z.string().min(1),
|
|
188
|
+
requestId: z.string(),
|
|
189
|
+
});
|
|
190
|
+
/**
|
|
191
|
+
* Execute a rename the user has audited. **The edits are deliberately NOT on this request.**
|
|
192
|
+
*
|
|
193
|
+
* The client sends back only the `planId` it was shown; the daemon recomputes the plan and
|
|
194
|
+
* refuses unless the identity matches. A request that carried its own edit list would be a
|
|
195
|
+
* remote arbitrary-write primitive wearing a rename's name - any client could post any text
|
|
196
|
+
* at any path. This shape makes the daemon's own language server the sole author of what
|
|
197
|
+
* gets written, and the plan id the proof that the user saw it.
|
|
198
|
+
*/
|
|
199
|
+
export const CodeRenameApplyRequestSchema = z.object({
|
|
200
|
+
type: z.literal("code.rename.apply.request"),
|
|
201
|
+
cwd: z.string(),
|
|
202
|
+
path: z.string(),
|
|
203
|
+
line: z.number().int().positive(),
|
|
204
|
+
column: z.number().int().positive(),
|
|
205
|
+
newName: z.string().min(1),
|
|
206
|
+
/** From the preview response. Identity of the exact plan the user approved. */
|
|
207
|
+
planId: z.string().min(1),
|
|
208
|
+
requestId: z.string(),
|
|
209
|
+
});
|
|
210
|
+
/**
|
|
211
|
+
* Undo a run. Carries only the run's id - the daemon holds the before-images.
|
|
212
|
+
*
|
|
213
|
+
* Declared here, with the other inbound rename schemas, rather than beside its response
|
|
214
|
+
* further down: `SessionInboundMessageSchema` is a top-level const, so a schema it names
|
|
215
|
+
* must already be initialized when that line runs. Below the union it is a
|
|
216
|
+
* ReferenceError at import time, not a type error.
|
|
217
|
+
*/
|
|
218
|
+
export const CodeRenameUndoRequestSchema = z.object({
|
|
219
|
+
type: z.literal("code.rename.undo.request"),
|
|
220
|
+
cwd: z.string(),
|
|
221
|
+
runId: z.string().min(1),
|
|
222
|
+
requestId: z.string(),
|
|
223
|
+
});
|
|
224
|
+
/**
|
|
225
|
+
* The Solution view (projects/solution-view). A second lens on the Files module showing the tree
|
|
226
|
+
* as the build system sees it rather than as the filesystem lays it out.
|
|
227
|
+
*
|
|
228
|
+
* **Independent of the LSP family above, despite sharing the `code.` domain.** There is no
|
|
229
|
+
* project-structure request in the Language Server Protocol - not one Otto has yet to wire, one
|
|
230
|
+
* that does not exist - so this subsystem builds its own model through Microsoft's solution
|
|
231
|
+
* libraries. Turning C# code intelligence off does not turn this off, and vice versa.
|
|
232
|
+
*
|
|
233
|
+
* Discovery is separate from loading on purpose: `list` decides whether the switcher appears at
|
|
234
|
+
* all, so it runs for every workspace and must stay cheap (a directory walk, no process). Only
|
|
235
|
+
* `get_tree` reaches the .NET sidecar.
|
|
236
|
+
*
|
|
237
|
+
* COMPAT(solutionView): added in v0.6.8; gate lives in features.solutionView.
|
|
238
|
+
*/
|
|
239
|
+
export const CodeSolutionListRequestSchema = z.object({
|
|
240
|
+
type: z.literal("code.solution.list.request"),
|
|
241
|
+
cwd: z.string(),
|
|
242
|
+
requestId: z.string(),
|
|
243
|
+
});
|
|
244
|
+
/**
|
|
245
|
+
* One solution's organisation: folders, the projects inside them, and the configurations. No file
|
|
246
|
+
* membership - that is `load_project`, paid per project on expand, because evaluating fifty
|
|
247
|
+
* projects to render a collapsed tree is the cost this design exists to avoid.
|
|
248
|
+
*/
|
|
249
|
+
export const CodeSolutionGetTreeRequestSchema = z.object({
|
|
250
|
+
type: z.literal("code.solution.get_tree.request"),
|
|
251
|
+
cwd: z.string(),
|
|
252
|
+
/** Workspace-relative, as reported by `list`. */
|
|
253
|
+
solutionPath: z.string(),
|
|
254
|
+
requestId: z.string(),
|
|
255
|
+
});
|
|
256
|
+
/**
|
|
257
|
+
* One project's evaluated file membership. `solutionPath` scopes the sidecar instance so two
|
|
258
|
+
* solutions in one repo never share a warm `ProjectCollection` - and so Phase 4 has the selection
|
|
259
|
+
* it needs for `--solution`.
|
|
260
|
+
*/
|
|
261
|
+
export const CodeSolutionLoadProjectRequestSchema = z.object({
|
|
262
|
+
type: z.literal("code.solution.load_project.request"),
|
|
263
|
+
cwd: z.string(),
|
|
264
|
+
solutionPath: z.string(),
|
|
265
|
+
/** Workspace-relative, or absolute when the solution names a project outside the workspace. */
|
|
266
|
+
projectPath: z.string(),
|
|
267
|
+
requestId: z.string(),
|
|
268
|
+
});
|
|
269
|
+
/**
|
|
270
|
+
* Compiler severity, named rather than numbered. LSP uses 1–4; a magic number on the
|
|
271
|
+
* wire would have every consumer re-deriving which one is a warning.
|
|
272
|
+
*/
|
|
273
|
+
export const CodeDiagnosticSeveritySchema = z.enum(["error", "warning", "info", "hint"]);
|
|
274
|
+
/** One problem the language server reported, 1-based like every other position. */
|
|
275
|
+
export const CodeDiagnosticSchema = z.object({
|
|
276
|
+
line: z.number().int().positive(),
|
|
277
|
+
column: z.number().int().positive(),
|
|
278
|
+
endLine: z.number().int().positive(),
|
|
279
|
+
endColumn: z.number().int().positive(),
|
|
280
|
+
severity: CodeDiagnosticSeveritySchema,
|
|
281
|
+
message: z.string(),
|
|
282
|
+
/** Who says so - `ts`, `pyright`, a linter behind the server. */
|
|
283
|
+
source: z.string().optional(),
|
|
284
|
+
/** The server's own code for the rule or error, e.g. TypeScript's `2345`. */
|
|
285
|
+
code: z.string().optional(),
|
|
286
|
+
/** Documentation for that rule, when the server offers one - oxlint does. */
|
|
287
|
+
codeHref: z.string().optional(),
|
|
288
|
+
/** Which registry row published it, so two servers on one file stay attributable. */
|
|
289
|
+
serverId: z.string().optional(),
|
|
290
|
+
});
|
|
291
|
+
export const CodeListFilesResponseSchema = z.object({
|
|
292
|
+
type: z.literal("code.list_files.response"),
|
|
293
|
+
payload: z.object({
|
|
294
|
+
cwd: z.string(),
|
|
295
|
+
files: z.array(z.string()),
|
|
296
|
+
truncated: z.boolean(),
|
|
297
|
+
error: z.string().nullable(),
|
|
298
|
+
requestId: z.string(),
|
|
299
|
+
}),
|
|
300
|
+
});
|
|
301
|
+
export const CodeSymbolKindSchema = z.enum(["function", "class", "type", "variable", "property"]);
|
|
302
|
+
export const CodeSymbolLocationSchema = z.object({
|
|
303
|
+
path: z.string(),
|
|
304
|
+
name: z.string(),
|
|
305
|
+
kind: CodeSymbolKindSchema,
|
|
306
|
+
line: z.number().int().positive(),
|
|
307
|
+
column: z.number().int().positive(),
|
|
308
|
+
});
|
|
309
|
+
export const CodeSymbolsResponseSchema = z.object({
|
|
310
|
+
type: z.literal("code.symbols.response"),
|
|
311
|
+
payload: z.object({
|
|
312
|
+
cwd: z.string(),
|
|
313
|
+
name: z.string(),
|
|
314
|
+
locations: z.array(CodeSymbolLocationSchema),
|
|
315
|
+
error: z.string().nullable(),
|
|
316
|
+
requestId: z.string(),
|
|
317
|
+
}),
|
|
318
|
+
});
|
|
319
|
+
/** 1-based, like `CodeSymbolLocation`. The end pair is present when the server gave a range. */
|
|
320
|
+
export const CodeDefinitionLocationSchema = z.object({
|
|
321
|
+
path: z.string(),
|
|
322
|
+
line: z.number().int().positive(),
|
|
323
|
+
column: z.number().int().positive(),
|
|
324
|
+
endLine: z.number().int().positive().optional(),
|
|
325
|
+
endColumn: z.number().int().positive().optional(),
|
|
326
|
+
/**
|
|
327
|
+
* Which registry row answered (`typescript`, `csharp`, …). The multi-hit picker
|
|
328
|
+
* shows it, so a user looking at two candidates can tell whether a language server
|
|
329
|
+
* resolved them or the name index guessed - which changes how much to trust the
|
|
330
|
+
* list. Absent from old daemons.
|
|
331
|
+
*/
|
|
332
|
+
serverId: z.string().optional(),
|
|
333
|
+
});
|
|
334
|
+
/**
|
|
335
|
+
* Three-valued on purpose. `unavailable` (no server for this language on the host) and
|
|
336
|
+
* `indexing` (the server is up but still building its project model) are different
|
|
337
|
+
* answers to the user, and neither is "not found" - reporting either as an empty
|
|
338
|
+
* result is how a working feature reads as broken.
|
|
339
|
+
*/
|
|
340
|
+
export const CodeDefinitionStatusSchema = z.enum(["ok", "indexing", "unavailable"]);
|
|
341
|
+
export const CodeDefinitionResponseSchema = z.object({
|
|
342
|
+
type: z.literal("code.definition.response"),
|
|
343
|
+
payload: z.object({
|
|
344
|
+
cwd: z.string(),
|
|
345
|
+
path: z.string(),
|
|
346
|
+
status: CodeDefinitionStatusSchema,
|
|
347
|
+
locations: z.array(CodeDefinitionLocationSchema),
|
|
348
|
+
error: z.string().nullable(),
|
|
349
|
+
requestId: z.string(),
|
|
350
|
+
}),
|
|
351
|
+
});
|
|
352
|
+
export const CodeDocumentSyncResponseSchema = z.object({
|
|
353
|
+
type: z.literal("code.document.sync.response"),
|
|
354
|
+
payload: z.object({
|
|
355
|
+
cwd: z.string(),
|
|
356
|
+
path: z.string(),
|
|
357
|
+
ok: z.boolean(),
|
|
358
|
+
error: z.string().nullable(),
|
|
359
|
+
requestId: z.string(),
|
|
360
|
+
}),
|
|
361
|
+
});
|
|
362
|
+
export const CodeDocumentCloseResponseSchema = z.object({
|
|
363
|
+
type: z.literal("code.document.close.response"),
|
|
364
|
+
payload: z.object({
|
|
365
|
+
cwd: z.string(),
|
|
366
|
+
path: z.string(),
|
|
367
|
+
ok: z.boolean(),
|
|
368
|
+
error: z.string().nullable(),
|
|
369
|
+
requestId: z.string(),
|
|
370
|
+
}),
|
|
371
|
+
});
|
|
372
|
+
/** 1-based, like every other position on the wire. */
|
|
373
|
+
export const CodeHoverRangeSchema = z.object({
|
|
374
|
+
line: z.number().int().positive(),
|
|
375
|
+
column: z.number().int().positive(),
|
|
376
|
+
endLine: z.number().int().positive(),
|
|
377
|
+
endColumn: z.number().int().positive(),
|
|
378
|
+
});
|
|
379
|
+
export const CodeHoverResponseSchema = z.object({
|
|
380
|
+
type: z.literal("code.hover.response"),
|
|
381
|
+
payload: z.object({
|
|
382
|
+
cwd: z.string(),
|
|
383
|
+
path: z.string(),
|
|
384
|
+
status: CodeDefinitionStatusSchema,
|
|
385
|
+
/** Markdown, or null when the server had nothing to say about this position. */
|
|
386
|
+
markdown: z.string().nullable(),
|
|
387
|
+
range: CodeHoverRangeSchema.nullable(),
|
|
388
|
+
serverId: z.string().nullable(),
|
|
389
|
+
error: z.string().nullable(),
|
|
390
|
+
requestId: z.string(),
|
|
391
|
+
}),
|
|
392
|
+
});
|
|
393
|
+
export const CodeReferencesResponseSchema = z.object({
|
|
394
|
+
type: z.literal("code.references.response"),
|
|
395
|
+
payload: z.object({
|
|
396
|
+
cwd: z.string(),
|
|
397
|
+
path: z.string(),
|
|
398
|
+
status: CodeDefinitionStatusSchema,
|
|
399
|
+
locations: z.array(CodeDefinitionLocationSchema),
|
|
400
|
+
error: z.string().nullable(),
|
|
401
|
+
requestId: z.string(),
|
|
402
|
+
}),
|
|
403
|
+
});
|
|
404
|
+
export const CodeRenameEditSchema = z.object({
|
|
405
|
+
line: z.number().int().positive(),
|
|
406
|
+
column: z.number().int().positive(),
|
|
407
|
+
endLine: z.number().int().positive(),
|
|
408
|
+
endColumn: z.number().int().positive(),
|
|
409
|
+
newText: z.string(),
|
|
410
|
+
/**
|
|
411
|
+
* The text this edit expects to replace. Carried so the dry run can show what is being
|
|
412
|
+
* changed rather than only what it becomes - and, on the daemon side, so the run can tell
|
|
413
|
+
* that a file moved under the plan. For a rename this is always one identifier.
|
|
414
|
+
*/
|
|
415
|
+
oldText: z.string().default(""),
|
|
416
|
+
});
|
|
417
|
+
export const CodeRenameFilePlanSchema = z.object({
|
|
418
|
+
path: z.string(),
|
|
419
|
+
edits: z.array(CodeRenameEditSchema),
|
|
420
|
+
});
|
|
421
|
+
export const CodeRenamePreviewResponseSchema = z.object({
|
|
422
|
+
type: z.literal("code.rename.preview.response"),
|
|
423
|
+
payload: z.object({
|
|
424
|
+
cwd: z.string(),
|
|
425
|
+
path: z.string(),
|
|
426
|
+
newName: z.string(),
|
|
427
|
+
status: CodeDefinitionStatusSchema,
|
|
428
|
+
/** Sorted by path, and by position within each file, so an audit reads in order. */
|
|
429
|
+
files: z.array(CodeRenameFilePlanSchema),
|
|
430
|
+
/** Blast radius, so the dry-run tab can lead with it. */
|
|
431
|
+
fileCount: z.number().int().nonnegative(),
|
|
432
|
+
editCount: z.number().int().nonnegative(),
|
|
433
|
+
/**
|
|
434
|
+
* Identity of this exact plan, echoed back on apply. Computed by the daemon so there is
|
|
435
|
+
* one definition of "the same plan" rather than two that can drift apart.
|
|
436
|
+
*/
|
|
437
|
+
planId: z.string().default(""),
|
|
438
|
+
error: z.string().nullable(),
|
|
439
|
+
requestId: z.string(),
|
|
440
|
+
}),
|
|
441
|
+
});
|
|
442
|
+
/**
|
|
443
|
+
* Five-valued, because the ways a rename can fail to happen are things a user needs told
|
|
444
|
+
* apart: still loading, no server, the plan moved, or the server pointed outside the
|
|
445
|
+
* workspace. Collapsing them into one failure is how "nothing happened" becomes unexplainable.
|
|
446
|
+
*/
|
|
447
|
+
/**
|
|
448
|
+
* Whether the run HAPPENED - deliberately not whether everything applied.
|
|
449
|
+
*
|
|
450
|
+
* A run where two of fourteen edits no longer fit is still a run that took place, and the
|
|
451
|
+
* twelve that landed are real. Collapsing that into a failure would hide them, and hiding a
|
|
452
|
+
* write is the one thing an auditable edit surface must never do. Per-edit fate lives in the
|
|
453
|
+
* file outcomes; `complete` is the single-glance answer.
|
|
454
|
+
*/
|
|
455
|
+
export const CodeRenameApplyStatusSchema = z.enum(["ok", "expired", "escaped"]);
|
|
456
|
+
export const CodeRenameFileOutcomeKindSchema = z.enum(["applied", "partial", "failed"]);
|
|
457
|
+
/** What happened to one file in a run. */
|
|
458
|
+
export const CodeRenameFileOutcomeSchema = z.object({
|
|
459
|
+
path: z.string(),
|
|
460
|
+
kind: CodeRenameFileOutcomeKindSchema,
|
|
461
|
+
appliedEdits: z.number().int().nonnegative(),
|
|
462
|
+
skippedEdits: z.number().int().nonnegative(),
|
|
463
|
+
/** Why, whenever anything was skipped or the file failed outright. */
|
|
464
|
+
reason: z.string().nullable(),
|
|
465
|
+
});
|
|
466
|
+
export const CodeRenameUndoStatusSchema = z.enum(["ok", "expired"]);
|
|
467
|
+
export const CodeRenameUndoFileKindSchema = z.enum(["restored", "changedSince", "failed"]);
|
|
468
|
+
/**
|
|
469
|
+
* What happened to one file during an undo. `changedSince` is the important one: the file was
|
|
470
|
+
* edited after the run, so restoring would have destroyed that work and it was left alone.
|
|
471
|
+
*/
|
|
472
|
+
export const CodeRenameUndoFileSchema = z.object({
|
|
473
|
+
path: z.string(),
|
|
474
|
+
kind: CodeRenameUndoFileKindSchema,
|
|
475
|
+
reason: z.string().nullable(),
|
|
476
|
+
});
|
|
477
|
+
export const CodeRenameUndoResponseSchema = z.object({
|
|
478
|
+
type: z.literal("code.rename.undo.response"),
|
|
479
|
+
payload: z.object({
|
|
480
|
+
cwd: z.string(),
|
|
481
|
+
runId: z.string(),
|
|
482
|
+
status: CodeRenameUndoStatusSchema,
|
|
483
|
+
files: z.array(CodeRenameUndoFileSchema),
|
|
484
|
+
restoredFiles: z.number().int().nonnegative(),
|
|
485
|
+
/** True only when every file the run wrote was put back. */
|
|
486
|
+
complete: z.boolean(),
|
|
487
|
+
error: z.string().nullable(),
|
|
488
|
+
requestId: z.string(),
|
|
489
|
+
}),
|
|
490
|
+
});
|
|
491
|
+
export const CodeRenameApplyResponseSchema = z.object({
|
|
492
|
+
type: z.literal("code.rename.apply.response"),
|
|
493
|
+
payload: z.object({
|
|
494
|
+
cwd: z.string(),
|
|
495
|
+
path: z.string(),
|
|
496
|
+
newName: z.string(),
|
|
497
|
+
status: CodeRenameApplyStatusSchema,
|
|
498
|
+
/** Identity of this run, for undo. Null when nothing ran. */
|
|
499
|
+
runId: z.string().nullable(),
|
|
500
|
+
files: z.array(CodeRenameFileOutcomeSchema),
|
|
501
|
+
appliedFiles: z.number().int().nonnegative(),
|
|
502
|
+
appliedEdits: z.number().int().nonnegative(),
|
|
503
|
+
skippedEdits: z.number().int().nonnegative(),
|
|
504
|
+
/** True only when every planned edit landed. */
|
|
505
|
+
complete: z.boolean(),
|
|
506
|
+
error: z.string().nullable(),
|
|
507
|
+
requestId: z.string(),
|
|
508
|
+
}),
|
|
509
|
+
});
|
|
510
|
+
export const CodeSolutionListResponseSchema = z.object({
|
|
511
|
+
type: z.literal("code.solution.list.response"),
|
|
512
|
+
payload: z.object({
|
|
513
|
+
cwd: z.string(),
|
|
514
|
+
/**
|
|
515
|
+
* Empty means the switcher never appears and the Files tab behaves exactly as it does today.
|
|
516
|
+
* That is also what a disabled feature, a host with no .NET SDK, and a workspace with no
|
|
517
|
+
* solution all return - the client has one silent case to handle, not four.
|
|
518
|
+
*/
|
|
519
|
+
solutions: z.array(SolutionRefSchema),
|
|
520
|
+
error: z.string().nullable(),
|
|
521
|
+
requestId: z.string(),
|
|
522
|
+
}),
|
|
523
|
+
});
|
|
524
|
+
export const CodeSolutionGetTreeResponseSchema = z.object({
|
|
525
|
+
type: z.literal("code.solution.get_tree.response"),
|
|
526
|
+
payload: z.object({
|
|
527
|
+
cwd: z.string(),
|
|
528
|
+
solutionPath: z.string(),
|
|
529
|
+
name: z.string().default(""),
|
|
530
|
+
format: SolutionFormatSchema.default("sln"),
|
|
531
|
+
folders: z.array(SolutionTreeFolderSchema),
|
|
532
|
+
projects: z.array(SolutionTreeProjectSchema),
|
|
533
|
+
/** Solution configurations and platforms - first-class .NET concepts no CLI surfaces. */
|
|
534
|
+
buildTypes: z.array(z.string()),
|
|
535
|
+
platforms: z.array(z.string()),
|
|
536
|
+
error: z.string().nullable(),
|
|
537
|
+
requestId: z.string(),
|
|
538
|
+
}),
|
|
539
|
+
});
|
|
540
|
+
export const CodeSolutionLoadProjectResponseSchema = z.object({
|
|
541
|
+
type: z.literal("code.solution.load_project.response"),
|
|
542
|
+
payload: z.object({
|
|
543
|
+
cwd: z.string(),
|
|
544
|
+
solutionPath: z.string(),
|
|
545
|
+
projectPath: z.string(),
|
|
546
|
+
status: SolutionProjectStatusSchema,
|
|
547
|
+
nodes: z.array(SolutionProjectNodeSchema),
|
|
548
|
+
projectReferences: z.array(z.string()),
|
|
549
|
+
packageReferences: z.array(SolutionPackageReferenceSchema),
|
|
550
|
+
targetFrameworks: z.array(z.string()),
|
|
551
|
+
outputType: z.string().nullable(),
|
|
552
|
+
isSdkStyle: z.boolean(),
|
|
553
|
+
/** MSBuild's own message when `status` is `failed`, verbatim. */
|
|
554
|
+
error: z.string().nullable(),
|
|
555
|
+
requestId: z.string(),
|
|
556
|
+
}),
|
|
557
|
+
});
|
|
558
|
+
export const CodeOutlineResponseSchema = z.object({
|
|
559
|
+
type: z.literal("code.outline.response"),
|
|
560
|
+
payload: z.object({
|
|
561
|
+
cwd: z.string(),
|
|
562
|
+
path: z.string(),
|
|
563
|
+
symbols: z.array(CodeSymbolLocationSchema),
|
|
564
|
+
error: z.string().nullable(),
|
|
565
|
+
requestId: z.string(),
|
|
566
|
+
}),
|
|
567
|
+
});
|
|
568
|
+
/**
|
|
569
|
+
* Live language-server state for the Daemon → Code screen. Separate from the daemon
|
|
570
|
+
* config RPCs because none of it is configuration: which servers this machine can
|
|
571
|
+
* actually supply, and which are running right now.
|
|
572
|
+
*
|
|
573
|
+
* Omit `cwd` for the host-wide answer, which is what the settings screen asks for: every
|
|
574
|
+
* row this daemon knows, resolved against the rungs a host has (bundled, PATH). Passing a
|
|
575
|
+
* `cwd` additionally probes that workspace's `node_modules/.bin`, since a server can be
|
|
576
|
+
* present in one project and absent from another. Optional rather than removed because
|
|
577
|
+
* older clients still send it.
|
|
578
|
+
*
|
|
579
|
+
* COMPAT(lspHostServers): `cwd` became optional in v0.7.3; gate lives in
|
|
580
|
+
* features.lspHostServers.
|
|
581
|
+
*/
|
|
582
|
+
export const LspServersListRequestSchema = z.object({
|
|
583
|
+
type: z.literal("lsp.servers.list.request"),
|
|
584
|
+
cwd: z.string().optional(),
|
|
585
|
+
requestId: z.string(),
|
|
586
|
+
});
|
|
587
|
+
/** Stop one running server, so a user who suspects it of hogging memory can kill it. */
|
|
588
|
+
export const LspServerStopRequestSchema = z.object({
|
|
589
|
+
type: z.literal("lsp.server.stop.request"),
|
|
590
|
+
rootPath: z.string(),
|
|
591
|
+
serverId: z.string(),
|
|
592
|
+
requestId: z.string(),
|
|
593
|
+
});
|
|
594
|
+
/**
|
|
595
|
+
* Which workspaces currently have a language server starting up or indexing. Sent as
|
|
596
|
+
* the whole busy set rather than per-workspace transitions: the only consumer is a
|
|
597
|
+
* spinner, so an idempotent snapshot cannot drift out of sync the way a missed
|
|
598
|
+
* transition would.
|
|
599
|
+
*
|
|
600
|
+
* Separate from the workspace status bucket on purpose - indexing is not the workspace
|
|
601
|
+
* "working", and folding it in would mislabel a quiet workspace as busy with agent work.
|
|
602
|
+
*/
|
|
603
|
+
export const LspActivityChangedStatusPayloadSchema = z
|
|
604
|
+
.object({
|
|
605
|
+
status: z.literal("lsp_activity_changed"),
|
|
606
|
+
/** Absolute workspace roots with language-server work in flight. */
|
|
607
|
+
busyRoots: z.array(z.string()),
|
|
608
|
+
})
|
|
609
|
+
.passthrough();
|
|
610
|
+
/**
|
|
611
|
+
* Diagnostics for one open document, pushed unsolicited.
|
|
612
|
+
*
|
|
613
|
+
* This is the one part of code intelligence that is not request/response:
|
|
614
|
+
* `textDocument/publishDiagnostics` arrives whenever the server has recomputed, which is
|
|
615
|
+
* whenever it feels like it. So it is a status broadcast, and the payload is the document's
|
|
616
|
+
* **whole** current set - never a delta. A missed delta would leave a stale squiggle on a
|
|
617
|
+
* line the user already fixed, and an idempotent snapshot cannot drift.
|
|
618
|
+
*
|
|
619
|
+
* Only documents a client has synced produce these. A server may know about every file in
|
|
620
|
+
* the project; pushing all of it would be unbounded, and nothing can render a marker in a
|
|
621
|
+
* file that is not open.
|
|
622
|
+
*/
|
|
623
|
+
export const LspDiagnosticsChangedStatusPayloadSchema = z
|
|
624
|
+
.object({
|
|
625
|
+
status: z.literal("lsp_diagnostics_changed"),
|
|
626
|
+
/** Workspace root the document belongs to. */
|
|
627
|
+
cwd: z.string(),
|
|
628
|
+
/** Absolute path of the document these describe. */
|
|
629
|
+
path: z.string(),
|
|
630
|
+
diagnostics: z.array(CodeDiagnosticSchema),
|
|
631
|
+
})
|
|
632
|
+
.passthrough();
|
|
633
|
+
export const LspLanguageStateSchema = z.object({
|
|
634
|
+
id: z.string(),
|
|
635
|
+
enabled: z.boolean(),
|
|
636
|
+
/** Whether the host can actually supply this server right now. */
|
|
637
|
+
installed: z.boolean(),
|
|
638
|
+
running: z.boolean(),
|
|
639
|
+
/** Which discovery rung supplied it (`workspaceBin` / `bundled` / `path`), or null. */
|
|
640
|
+
rung: z.string().nullable(),
|
|
641
|
+
bin: z.string(),
|
|
642
|
+
/**
|
|
643
|
+
* Every rung this row can ever be supplied from, in resolution order. A row whose only
|
|
644
|
+
* rung is `workspaceBin` is supplied by the project it runs in and by nothing else, so
|
|
645
|
+
* `installed: false` from a host-wide check means "the project brings it", not "missing".
|
|
646
|
+
*/
|
|
647
|
+
discovery: z.array(z.string()).optional(),
|
|
648
|
+
/** Absolute path to the resolved executable, so the toolchain behind a row is nameable. */
|
|
649
|
+
path: z.string().nullable().optional(),
|
|
650
|
+
extensions: z.array(z.string()),
|
|
651
|
+
/** Plain-words index cost, so the toggle states its own price. */
|
|
652
|
+
indexCost: z.string(),
|
|
653
|
+
/**
|
|
654
|
+
* How to install a missing server on the host, resolved by the daemon. Optional: an older
|
|
655
|
+
* daemon sends nothing, and the client renders nothing extra when it is absent. A row with
|
|
656
|
+
* no install route (project-supplied) is `null`, not an empty object.
|
|
657
|
+
*/
|
|
658
|
+
install: z
|
|
659
|
+
.object({
|
|
660
|
+
/** Ordered argv steps; each `display` is the exact text the user reads and confirms. */
|
|
661
|
+
steps: z.array(z.object({
|
|
662
|
+
command: z.string(),
|
|
663
|
+
args: z.array(z.string()),
|
|
664
|
+
display: z.string(),
|
|
665
|
+
note: z.string().nullable(),
|
|
666
|
+
})),
|
|
667
|
+
/** Manual route: an official installer link instead of a command. */
|
|
668
|
+
url: z.string().nullable(),
|
|
669
|
+
})
|
|
670
|
+
.nullable()
|
|
671
|
+
.optional(),
|
|
672
|
+
});
|
|
673
|
+
export const LspRunningServerSchema = z.object({
|
|
674
|
+
rootPath: z.string(),
|
|
675
|
+
serverId: z.string(),
|
|
676
|
+
uptimeMs: z.number(),
|
|
677
|
+
lastUsedAt: z.number(),
|
|
678
|
+
});
|
|
679
|
+
export const LspServersListResponseSchema = z.object({
|
|
680
|
+
type: z.literal("lsp.servers.list.response"),
|
|
681
|
+
payload: z.object({
|
|
682
|
+
cwd: z.string(),
|
|
683
|
+
languages: z.array(LspLanguageStateSchema),
|
|
684
|
+
running: z.array(LspRunningServerSchema),
|
|
685
|
+
error: z.string().nullable(),
|
|
686
|
+
requestId: z.string(),
|
|
687
|
+
}),
|
|
688
|
+
});
|
|
689
|
+
export const LspServerStopResponseSchema = z.object({
|
|
690
|
+
type: z.literal("lsp.server.stop.response"),
|
|
691
|
+
payload: z.object({
|
|
692
|
+
rootPath: z.string(),
|
|
693
|
+
serverId: z.string(),
|
|
694
|
+
ok: z.boolean(),
|
|
695
|
+
error: z.string().nullable(),
|
|
696
|
+
requestId: z.string(),
|
|
697
|
+
}),
|
|
698
|
+
});
|
|
699
|
+
//# sourceMappingURL=code-intelligence.js.map
|