Repository navigation
feat(files): a skill's virtual file opens in the file tab (opencode#66201) - #1226
Merged
Merged
Conversation
…6201) skill://<id>/<file> is read through GET /api/experimental/skill/<id>/file/<path>; a /builtin/ path, and a skill:// one on a server without that endpoint, from the skills list's inline body. Such a file is a link to the viewer, is in no tree, is not watched and opens in no app.
normalize_path collapsed skill://<id>/<file> to skill:/<id>/<file>, the name the file tab's id and Workspace:OpenDocument carry, so the tab would have read a file of the folder by that name. The Files header's Open in is not offered for such a file. A fixture's file_contents may hold one: it has a body and is in no tree.
It normalized the tab's path with the review's own normalize_path (crates/opencode-code-view/src/data/review.rs), not the one the tab's id is made with, so skill://<id>/<file> became skill:/<id>/<file> again: the tab opened and said the file was not found, and the tree gained a skill: row. Found by the run of the no-server cases.
Hona
marked this pull request as ready for review
November 25, 2026 20:14
Hona
added a commit
that referenced
this pull request
Nov 25, 2026
…-path With #1226 (a skill's virtual file): the document's path keeps both a leading / and skill://; the tree, the fixture loader and the Files header's Open in take a file outside the folder and a skill's virtual file alike (data::is_outside).
Hona
added a commit
that referenced
this pull request
Nov 25, 2026
…90d (#1267) Two new official commits since 2b296cabc8, neither the desktop's: 35c35d3d80 (the data app's tests) and 57551d990d (ai: freeform tools sent as JSON); both skipped. UP-218 (a skill's virtual file opens in the file tab) is ported by #1226: the row has what ran (the fallback read with a test server from before the new route, and a fixture file) and what is by reading only (the new route answering 200, an MCP server's skill).
Hona
added a commit
that referenced
this pull request
Nov 25, 2026
This was referenced Nov 25, 2026
Member
Author
|
Follow-up verification against a server at
|
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.
Port of the app part of official anomalyco/opencode#66201 (
df79010bc6, "load skills from MCP servers"), with the two older official changes it stands on, which ours never had: #60464 (78f8dffd48) and #60921 (69269e4ebe). A skill's virtual file,skill://<id>/<file>, opens in the file tab. The fallback read is proved by a run; the new route is by reading only (the server the cases run on is from before it). Official paths are underpackages/.flowchart LR A["a skill's row in Details<br/>a link in a reply or a file"] --> C["links::classify<br/>Link::Skill"] C --> V["file tab"] V --> R{"path"} R -- "skill://id/file" --> E["GET /api/experimental/skill/id/file/path"] E -- "404: no such route or file" --> L R -- "/builtin/file" --> L["GET /api/skill: the inline body"]What it does
skill://<id>/<file>is read withGET /api/experimental/skill/<id>/file/<path>?location=...and shown as any fileapp/src/workspaces/files/model.tsx:257-264,client/src/promise/generated/client.ts(experimental.skill.file)features/files/src/data.rsfetch_skill_file/builtin/path shows the inlinecontentof/api/skillmodel.tsx:266-268/builtin, which is not there:12and:12-20gui-plugins/src/file/resolve-link.ts:27-29,:109-120;gui-plugins/src/file/renderer.tsx:705-706;app/src/workspaces/files/path.ts:128features/files/src/links.rs:43ondev), so no tab: the address is copied, or offered as an app link (apps/desktop/src/surfaces/browser/links.rs:229-256)links.rsLink::Skill,classifygui-plugins/src/file/open-in-app.tsx:101-107features/files/src/viewer/toolbar.rsx://is not a path)session-ui/src/components/markdown-inline-code-kind.tscode_paths.rsreads_as_path)skill://path on a server that has no such route (older than 24 Nov) falls back to the skills list's inline body, which is where official itself read it until #66201 (model.tsxat69269e4ebe). On a server with the route the result is official's: a skill or file the server does not have reads as not found.ops.rs,watch.rs), has no "Show in folder", and its "Copy path" copies theskill://path.normalize_path(crates/opencode-search/src/file_rank.rs) madeskill://<id>/<file>intoskill:/<id>/<file>, which the tab's id andWorkspace:OpenDocumentcarry, so the tab would have read a file of the folder by that name and said it was not found. Found by reading after the first push, corrected in the third commit; the first two commits had this fault. The correction missed one place, which the first run found:Workspace:OpenDocumentnormalized the path with another function of the same name (crates/opencode-code-view/src/data/review.rs), so the tab still opened as not found, and the tree gained askill:row. Corrected in043c15009(apps/desktop/src/plugin_host/native/files.rs).ui.openInButton,apps/desktop/src/workspace/system/open_in.rs) is not offered for such a file either.file_contentsmay hold askill://key: it has a body and is in no tree (data.rsload_fixture_workspace,ops.rs).pathas a link (plugins/details/lists.luau:602).Cases to run (headless, on this PR's Windows x64 build; before = a build without the change)
A. With no server: a fixture file
The file: the app's own
apps/desktop/assets/fixture.jsonwith two changes. (1) The last reply of the session it opens ends with one more paragraph:See [the skill](skill://opencode/SKILL.md:3), [its notes](skill://opencode/docs/notes.md) and [one that is not there](skill://opencode/nope.md).(2)file_contentsgainsskill://opencode/SKILL.md=# OpenCode\n\nQuestions about OpenCode itself.\n\nSee [the notes](docs/notes.md).\nandskill://opencode/docs/notes.md=# Notes\n\nA second file of the same skill. Back to [the skill](../SKILL.md).\n. Start with--fixture <that file>; the before build takes the same file.These run everything but the read: the file's body comes from the fixture, not from a server.
SKILL.md(not "not found"), in the source view at line 3 ("Questions about OpenCode itself."); the Files tree has noskill:row; the Files header shows no Open in button; the tab's menu has "Copy path" and neither "Open in" nor "Show in folder". Before: no file tab.notes.md, rendered. In it press "the skill": theSKILL.mdtab of A1 is shown, not a second one. Then inSKILL.md's rendered view press "the notes": thenotes.mdtab.skill://opencode/nope.md, no tab.B. With a server (waits for memory)
A server from before
df79010bc6(24 Nov) has no skill-file route: there the port takes its fallback (the route's 404, then the skills list's inline body). Cases B1 to B3 run on either; say which requests the server got.skill://<id>/SKILL.md(askGET /api/skill). Open Details, Skills, press that skill. See: a file tab titledSKILL.mdwith the skill's text. Before: no tab opens.[the skill](skill://<id>/SKILL.md:3). Press it. See: the same tab, at line 3 in the source view. Before: no tab.skill://<id>/nope.md. See: a toast naming the path, no tab.df79010bc6): B1 again; the server getsGET /api/experimental/skill/<id>/file/SKILL.mdand answers 200; no/api/skillread follows for it.mcp_skillsflag, and an MCP server that serves a skill): its row in Details opens itsSKILL.md, whose body the list does not carry.What has run
Headless, on this PR's Windows x64 CI build, the fixture file of section A, no server. The before build is the Rune pin bump's own PR build (#1192, run
45629508899, headcc991c6505):devat the new pin.043c15009SKILL.mdin the source view with its text, line 3 marked; its id//skill://opencode/SKILL.md; noskill:row in the tree; no Open in on the Files header. Ond23a6bb6dit did not hold (the tab said "File not found: SKILL.md" and the tree had askill:row): the fault above043c15009notes.md, rendered, noskill:row; the link inside it opensSKILL.mdunder the same tab id as A1's, rendered. Not run:SKILL.md's own link to the notes (the same step the other way)043c15009, andd23a6bb6dbefore itskill://opencode/nope.md, no tabcc991c6505043c15009, with the test server (from beforedf79010bc6)SKILL.mdwith the skill's text, rendered; the card closes. The server was asked the file route once (404), then/api/skill(200): the fallback. Before: no tab; "Copied"043c15009, the same serverskill://opencode/SKILL.md:3opens the same tab in the source view, line 3's number in the accent colour. The same two requests. Before: no tab; "Copied"043c15009, the same serverskill://opencode/nope.md, no tab. The route once (404), then the list (200)df79010bc6Seen at the server, beside the cases: in its first second for a folder,
/api/skillanswered 200 with an empty list; two seconds later it listed the skills. On the fallback path ours reads that list once: a skill opened in that first second would read as not found, and opens on the next press. By reading; what official's read did in that second before #66201 is not read.Not run (by reading)
df79010bc6): there B1 to B3 prove the fallback. The route is one GET at official's URL (client/src/promise/generated/client.ts,experimental.skill.file), and its answer goes through the same bytes-to-viewer function as every other file (data.rspayload)./builtin/path: no current server lists one (official kept the branch for older ones). Its tab's id drops the leading slash, as any absolute path's with one does (file_rank.rsfile_tab_id): by reading such a tab reads a file of the folder instead. Not changed here.links.rsclassify). Official, by reading, joins the two intoskill:/<id>/...with one slash (gui-plugins/src/file/artifact.ts:123-143fromrenderer.tsx:708), which its ownisVirtualSkilldoes not match: a fault there, not copied.