feat: add DSH IDE open-file references
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# Open-file snapshot protocol v1
|
||||
|
||||
IDE companions publish one JSON file per running IDE instance in:
|
||||
|
||||
```text
|
||||
%LOCALAPPDATA%\Prophet\dsh-plugin-coop-with-vs\v1\instances
|
||||
```
|
||||
|
||||
The schema is [`open-files-v1.schema.json`](open-files-v1.schema.json).
|
||||
|
||||
## Publishing rules
|
||||
|
||||
- File name: `vscode-<instanceId>.json` or `visualstudio-<instanceId>.json`.
|
||||
- Write a temporary file in the same directory, then atomically replace/rename it.
|
||||
- Refresh `updatedAt` at least every 15 seconds, even when tabs do not change.
|
||||
- Delete the instance file on clean shutdown. Consumers expire snapshots older than 60 seconds because shutdown cleanup is best effort.
|
||||
- Publish only absolute paths for local, disk-backed files. Do not publish source text, credentials, virtual documents, or untitled buffers.
|
||||
- Deduplicate paths case-insensitively on Windows.
|
||||
- `dirty: true` means the IDE buffer may differ from the on-disk file. DSH still reads the on-disk version unless a future protocol explicitly adds buffer transfer.
|
||||
|
||||
## Compatibility
|
||||
|
||||
Consumers reject unknown versions and malformed entries without rejecting healthy snapshots from other instances. Adding fields requires a new protocol version because v1 intentionally rejects additional properties.
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": 1,
|
||||
"instanceId": "sample-visualstudio-instance",
|
||||
"ide": "visualstudio",
|
||||
"processId": 5678,
|
||||
"workspace": "F:\\project\\App.sln",
|
||||
"updatedAt": "2026-01-01T00:00:00.000Z",
|
||||
"documents": [
|
||||
{ "path": "F:\\project\\Program.cs", "label": "Program.cs", "dirty": true }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": 1,
|
||||
"instanceId": "sample-vscode-instance",
|
||||
"ide": "vscode",
|
||||
"processId": 1234,
|
||||
"workspace": "F:\\project",
|
||||
"updatedAt": "2026-01-01T00:00:00.000Z",
|
||||
"documents": [
|
||||
{ "path": "F:\\project\\src\\main.ts", "label": "main.ts", "dirty": false }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://www.prophetk.icu/Prophet/dsh-plugin-coop-with-vs/-/raw/main/protocol/open-files-v1.schema.json",
|
||||
"title": "DSH IDE open-file snapshot",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["version", "instanceId", "ide", "processId", "updatedAt", "documents"],
|
||||
"properties": {
|
||||
"version": { "const": 1 },
|
||||
"instanceId": { "type": "string", "minLength": 1, "maxLength": 128 },
|
||||
"ide": { "enum": ["vscode", "visualstudio"] },
|
||||
"processId": { "type": "integer", "minimum": 1 },
|
||||
"workspace": { "type": "string", "maxLength": 32768 },
|
||||
"updatedAt": { "type": "string", "format": "date-time" },
|
||||
"documents": {
|
||||
"type": "array",
|
||||
"maxItems": 10000,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["path", "label", "dirty"],
|
||||
"properties": {
|
||||
"path": { "type": "string", "minLength": 1, "maxLength": 32768 },
|
||||
"label": { "type": "string", "minLength": 1, "maxLength": 1024 },
|
||||
"dirty": { "type": "boolean" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user