Repository navigation
Skills: browse the organization's library, and add skills on the agent - #802
Draft
alex-clickhouse wants to merge 2 commits into
Draft
alex-clickhouse wants to merge 2 commits into
alex-clickhouse wants to merge 2 commits into
Conversation
…er API
In external mode with an MCP gateway that offers a library, a person can add
an item that the organization offers on this agent, remove it again, and
search the whole library.
- The document request names the added items in the query parameter
`added` (valid `@nerve/<slug>` ids, byte order, no repeat, at most 100).
The ids are rows of the new table `library_added` (migration v077), so the
gateway process and a one-shot command such as `nerve sync` send the same
list. The parameter is not part of `library_url`, so the report URL stays
as it is.
- Nerve serves the availability values `available`, `default` and
`required`, and the installedBy values `required`, `default`, `console`
and `agent`. An item whose installedBy does not go with its availability
is left out. Each item has `withdrawn` (at most 20 versions below
`version`, highest first), which Nerve checks and keeps; `supersedes` is
not read. Tags must be in byte order with no repeat.
- `GatewayLibrary.refresh(force=True)` reads again after a read in progress,
because that read can have started before an add or a remove. The forced
read and the skill scan of one change of the added items run under one
lock (`AgentEngine.library_added_changed`), so the scan of the last change
runs last.
- Live clients build again only when the library skills of the scan change
(an item that comes or goes, or a new id, version, digest, name or
description). A change of tags, of `withdrawn`, of installedBy or of the
revision alone builds no client again.
- The report has the member `pinned` after `digest`, `false` for every item.
- `nerve/skills/library_browse.py` sends the search to
`GET <mcp_gateway_url>/library/browse`, checks the answer strictly within
bounds, and maps each failure to an error code of Nerve (`no_library`,
`invalid_request`, `rate_limited`, `library_unavailable`): no body of the
gateway reaches the browser. An answer that contradicts itself (counts
while `agentCounts` is false, more results than `total`, items on a page
above `pages`) is refused; a result with an unknown kind or availability
is left out, as in the document.
- The detail of an item that is not on the agent asks
`GET /library/browse?id=<item id>` at each request, which gives only that
item when the organization offers it now. Its files come from its
archive, fetched by digest with the checks of an item of the document,
into the same cache. The cache holds bytes, never an offer: an item that
the organization stops offering gets 404 also when its files are cached.
The detail of an item of the set has no use count.
- Routes under `/api/skills/library/`: `browse`, `items/{id}`, and `PUT` and
`DELETE` of `added/{id}`. A new add and a remove delete the on or off
choice of the item, so an added item starts on; a repeated add of an item
that is added changes nothing. An add and a remove are refused on a
locked instance and for an id that is not `@nerve/<slug>`; an add is also
refused above 100 items. The browse route refuses an empty `page` and a
parameter given twice with its own `400 invalid_request`. While Nerve has
no current or last good library document (the gateway answers 404, or no
read succeeded), every library route answers 404 `no_library` and reads
and changes nothing. `GET /api/skills` has a `library` member (offered,
managed_by, changes_allowed, added), and a row with `failed: true` for an
item whose archive Nerve could not get. `/api/skills/library` with no
further segment stays the detail of a workspace skill with the id
`library`.
The fixtures document.json, report.json and browse.json are the examples
of the wire contract of the control plane, byte for byte. Nerve reads a
browse answer of at most 4 MiB. docs/config.md, docs/api.md and
docs/architecture.md describe the protocol, the routes and the design.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When `GET /api/skills` says that the MCP gateway offers a library, the
Skills page has **Browse library**, which opens the page `/library`. The
page is not below `/skills/`, so a workspace skill with the id `library`
keeps its detail page.
- The browser has a search field (the search runs 300 ms after the last key
press), a tag filter with the count of results of each tag (at most 5
tags), result cards with the tags, the release and "Used by N agents"
(when the gateway has counts), and pages. A result says how it is on the
agent ("Required", "Installed by default", "Installed from the console",
"Added") or has **Add**, which is disabled on a locked instance with the
reason. The name of a result opens a dialog with the files of the item in
a read-only viewer, with **Add** or **Remove**, and the use count of the
result. The page shows the results of the current query only: while a
new search runs and after a failed one, no earlier result is shown.
- On the Skills page each library skill says how it got on the agent:
"Installed by default", "Installed from the console" with the console
link, or "Added on this agent". Every added item has **Remove**, also
when a console install or the organization's setting supplies it now,
and the text says that the install or the setting stays. An item whose
files Nerve could not get shows the badge **Failed**, with no switch and
no detail view; a required one still says who requires it. Added items
that the organization does not offer now are listed under **Added, not
offered now**, with **Remove**.
- Each error shows the `detail.message` of Nerve. A done add or remove
shows on the page also when the reload of the list after it fails.
The specs assert roles, names and states. docs/web-ui.md describes the page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI review gate — Draft pull request — AI review not started
What to do:
Re-run the gate with “Re-run jobs” after an approval or a finished review. A push re-runs it automatically. |
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.
In external mode with an MCP gateway that offers a library, a person can now browse every skill that the organization offers, open its files, and add or remove a skill on this agent. The Skills page says how each library skill got on the agent. Standalone Nerve is unchanged.
What changes
/library, reached from the Skills page: a search that runs after a short pause, a tag filter with the count of results for each tag, cards with tags, the release and "Used by N agents", pages, a read-only viewer of the files of an item, and Add or Remove./api/skills/library/:browse,items/{id}, andPUTandDELETEofadded/{id}.GET /api/skillshas alibrarymember.How
library_added(migration v077), so the gateway process and a one-shot command such asnerve syncsend the same list. Nerve sends them in the query parameteraddedof the document request: valid ids, in byte order, no repeat, at most 100.available,defaultandrequired, and the installedBy valuesrequired,default,consoleandagent. An item whose installedBy does not go with its availability is left out.withdrawnis checked and kept;supersedesis not read. The report has the memberpinned,falsefor every item.withdrawn, or of the revision alone builds no client again.GET <mcp_gateway_url>/library/browseand checks the answer strictly. An answer that contradicts itself is refused; a result with an unknown kind or availability is left out, as in the document.browse?id=). Its files come from its archive, fetched by digest, with the size, digest, entry type and path checks of an installed item. The cache holds bytes, never an offer.no_library, sends nothing and changes nothing.Trust boundaries
no_library,invalid_request,rate_limited,library_unavailable).Rollout
Active only in external mode with a gateway that offers
/library. A gateway that does not knowaddedor/library/browseanswers as "no library" or ignores the parameter; Nerve then shows no browser.Verification
npm run build;npm test: 3,246 passed. The migration number check.ruff --select F: no new finding.tests/fixtures/library/) are byte-for-byte copies of the examples of the gateway side.Screenshots
Taken at an earlier commit of this branch; the pages look the same now. The images are on the branch
asoff/skills-p2-browse-screenshots(images only, never merge).🤖 Generated with Claude Code