feat(pbs): resolve editorial chains and expose read-only external sources
Intrepid/Prometeu/Studio/pipeline/head Build started...
Test / Build skipped: 16, passed: 838
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good

This commit is contained in:
2026-10-07 09:00:31 +01:00
parent d0737df0ac
commit 967b9ec598
38 changed files with 1856 additions and 42 deletions
@@ -246,7 +246,7 @@ for one fixed port. The public LSP configuration default remains unchanged for
other hosts. A manifest language change requires reopening that project's server;
the adapter MUST NOT send queries to a server bound to another language/root.
Each query uses a short-lived client connection. For document requests, the
Each query uses a short-lived client connection. For physical document requests, the
adapter opens exactly the saved UTF-8 text and waits for that connection's
published diagnostics before issuing the semantic query. Other dependency files
are read from disk by the existing compiler bridge. A fresh connection prevents
@@ -266,14 +266,54 @@ Core bounds the request worker wait to 12 seconds. Documents are limited to 4 Mi
of UTF-8 and task-local hierarchy state to 1024 items. These are adapter resource
guards, unrelated to the runtime's deterministic frame/watchdog semantics.
Document URIs must resolve to known physical project/dependency source files.
Document URIs must resolve to known physical project/dependency source files or to an external identity owned by the current task and project.
Symlink targets are canonicalized before admission. External sources may be
queried, but edit-producing queries on read-only roots are rejected. Every URI in
returned workspace-edit proposals is checked against the same editable/read-only
scope; an unsafe proposal is rejected as a whole. File-operation edits and
executable commands are not offered; `workspace/applyEdit` is always refused.
No query writes a file. Virtual SDK declarations may not have physical definition
locations in the existing LSP; indexed SDK references remain available instead.
No query writes a file. `readExternalSource` reads the exact registered external
revision; hover and definition on its URI use the retained frontend semantic
context. Indexed SDK reference tools remain separate and available. MCP needs no
VS Code connection and MUST retain its consumer across short-lived query sockets.
Task return/cancellation releases that task's external uses; project shutdown
invalidates all identities. Cross-task/project replay is refused.
### External-source protocol (DEC-0062)
Initialize negotiates `capabilities.experimental.prometeuExternalSources: true`;
the server advertises the same flag only when supported. External definitions use
`prometeu-source:` URIs minted by the project host. A descriptor carries `uri`,
`revision` (content digest), `origin`, `name`, `languageId` and `readOnly: true`.
Locations carry ordinary LSP UTF-16 ranges over that exact source text.
The `prometeu/readExternalSource`, `prometeu/retainExternalSource`,
`prometeu/releaseExternalSource` and `prometeu/revalidateExternalSource` requests
carry `uri` and a server-issued `consumerId`. Initialize returns that identity in
`capabilities.experimental.prometeuExternalConsumerId`. Reconnecting clients pass
it as `initializationOptions.prometeuExternalConsumerId`; MCP also requests
`initializationOptions.prometeuExternalPersistentConsumer: true` on first use.
`releaseExternalSource` with `uri: null` releases the consumer and all its sources.
A read or explicit retain acknowledges a navigation result; unacknowledged results
are released when the socket closes. MCP acknowledges returned definitions before
closing its query connection and rolls back newly retained results on failure.
Read-only edit refusal uses LSP error `-32010`, mapped to MCP `READ_ONLY_SCOPE`.
Consumer identity is scoped to the
project session; the MCP adapter additionally binds it to its authorized task.
Read returns the descriptor plus `text`. Retain/release are idempotent per consumer.
Revalidation confirms the same admitted origin and revision before queries resume;
a changed revision reports unavailable and requires new navigation. Unknown,
expired, unauthorized and unreadable sources are explicit errors, never disk reads
chosen by client paths. Consumers are created by the server, not caller-selected.
VS Code uses a read-only text content provider, with the source language and no
save-back path. Disconnect may leave the immutable text visible, but blocks
semantic queries until revalidation. No content-change event may replace the old
revision under old positions. Closing the last consumer releases the snapshot;
one reader closing must not invalidate another reader. Edit operations and mixed
workspace edits are rejected in their entirety, including physical aliases.
Packaged Studio validation is excluded from this delivery; development tests must
exercise both VS Code and independent MCP navigation.
## 4. Result, Error and Operation Contracts