Repository navigation
feat(read): HTTP file reads can run repository read plugins - #34
Merged
Merged
Conversation
POST /v1/repo/read accepts two optional fields:
- PluginMode: "off" (default) or "auto" (plugins whose Wasm declares
default_enabled for read, as MCP read without plugins).
- Plugins: [{"Name","Args"}] runs exactly these plugins and wins over
PluginMode; [] runs none. Names and limits follow MCP; invalid choices
return 400 INVALID_PLUGINS.
When plugins ran and produced something, the file object gains
Attachments ([{"Plugin","Text"}], whole-invocation supplements carry
"Batch":true; MCP order) and PluginDiagnostics ([{"Code","Message"}]).
A plugin failure keeps the body and the HTTP status. The read runs the
same Service.ReadWithPlugins as MCP read; without the new fields the
handler calls Read exactly as before and the response is byte-identical.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Repository read plugins (for example a knowledge workspace's evidence plugin) ran only for MCP
read/read_many. HTTP clients reading files throughPOST /v1/repo/readcould not get the plugin attachments.Changes
POST /v1/repo/readaccepts two optional fields:PluginMode:off(default) orauto.autoselects the plugins whose Wasm declaresdefault_enabled, the same as an MCP read withoutplugins.Plugins:[{"Name","Args"}]runs exactly these plugins and wins overPluginMode.[]runs none.PluginModereturn 400INVALID_PLUGINS. Validation is the same as MCP.Attachments:[{"Plugin","Text"}], with"Batch":trueon whole-invocation supplements, in the MCP order.PluginDiagnostics:[{"Code","Message"}].Contentor the HTTP status.Service.ReadWithPluginsas MCP. Without the new fields it callsReadas before.docs/ref/repository-plugins.mdandweb/plugins/llms.txtgain an "HTTP 读取" section.Compatibility
Without the new fields, requests, responses and performance are unchanged. A test checks that the response is byte-identical.
Tests
go test -p 1 ./...with MongoDB: all packages pass exceptsitesettingsTestMongoStoreLoadsAllSections. That test is pre-existing, fails the same way onmainand is not touched here.autoand explicit selection;INVALID_PLUGINSat the service and route level;bun run build:webandbun run check:webpass.🤖 Generated with Claude Code