Add plugin doc discovery/fetch commands#130
Conversation
| * | ||
| * When `ok` is `false`, `message` describes the read failure. | ||
| * When `ok` is `true`, `content` may still be truncated depending on `maxChars`. | ||
| */ | ||
| interface IPluginDocFetchResult { | ||
| ok: boolean; | ||
| path: string | null; | ||
| title: string | null; | ||
| source: string | null; | ||
| content: string | null; | ||
| contentLength: number; | ||
| truncated: boolean; | ||
| message?: string; | ||
| } |
There was a problem hiding this comment.
This is a bit of a code smell, a discriminated union would be likely better (I did not read the rest of the PR yet so the details in this suggestion might be suboptimal), like:
| * | |
| * When `ok` is `false`, `message` describes the read failure. | |
| * When `ok` is `true`, `content` may still be truncated depending on `maxChars`. | |
| */ | |
| interface IPluginDocFetchResult { | |
| ok: boolean; | |
| path: string | null; | |
| title: string | null; | |
| source: string | null; | |
| content: string | null; | |
| contentLength: number; | |
| truncated: boolean; | |
| message?: string; | |
| } | |
| */ | |
| interface IPluginDocFetchBase { | |
| contentLength: number; | |
| truncated: boolean; | |
| } | |
| interface IPluginDocFetchData extends IPluginDocFetchBase { | |
| ok: true; | |
| path: string; | |
| title: string; | |
| source: string; | |
| content: string; | |
| } | |
| interface IPluginDocFetchError extends IPluginDocFetchBase { | |
| ok: false; | |
| message: string; | |
| } | |
| type PluginDocFetchResult = IPluginDocFetchData | IPluginDocFetchError; |
| private async _discoverPluginDocs(): Promise< | ||
| ReadonlyArray<IPluginDocRecord> | ||
| > { |
There was a problem hiding this comment.
Does it get docs for the packages as linked in the sidebar?
There was a problem hiding this comment.
It does not include package docs URLs in the sidebar. Right now, we have local docs discovery. Was this not the intent? I might have assumed wrong here, my apologies, so we want to have this and also URL discovery, or just URL discovery?
There was a problem hiding this comment.
I initially thought we want to have both
There was a problem hiding this comment.
Right now, we have local docs discovery. Was this not the intent? I might have assumed wrong here, my apologies, so we want to have this and also URL discovery, or just URL discovery?
I would think that having only the external docs would be appropriate since:
- skills file is already handled separately
- extension examples have separate discovery mechanism
- the main top-level readme should not be of interest to the agent - it should be focused on human users
Now, the code you have for local fetch might be still useful. One way to get the docs to agent is to fetch them with HTTP requests on runtime but that requires internet connection. Maybe it would be best to embed the docs of dependencies on the lite file system, similar to what we do with extensions.
@Carreau was experimenting with a local-first docs in https://github.com/jupyter/papyri but that was mostly for Python, not TypeScript ecosystem
| await addIfAvailable({ | ||
| title: 'Plugin Playground README', | ||
| path: ROOT_README_PATH, | ||
| source: 'project-readme', | ||
| description: 'Overview and usage guide for Plugin Playground.' | ||
| }); | ||
|
|
||
| await addIfAvailable({ | ||
| title: 'Plugin Playground Docs Index', | ||
| path: DOCS_INDEX_PATH, | ||
| source: 'project-docs', | ||
| description: 'Published documentation landing page for this project.' | ||
| }); | ||
|
|
||
| await addIfAvailable({ | ||
| title: 'Plugin Authoring Skill', | ||
| path: PLUGIN_AUTHORING_SKILL_PATH, | ||
| source: 'agent-skill', | ||
| description: 'AI agent workflow reference for authoring plugins.' | ||
| }); | ||
|
|
||
| const examples = await this._discoverExtensionExamples(); | ||
| for (const example of examples) { | ||
| await addIfAvailable({ | ||
| title: `${example.name} README`, | ||
| path: example.readmePath, | ||
| source: 'extension-example', | ||
| description: example.description || this._fallbackExampleDescription | ||
| }); | ||
| } |
There was a problem hiding this comment.
It feels like docs and these READMEs are different concepts. Can the agent already find examples without this PR?
There was a problem hiding this comment.
Yes, the agent could already find examples via plugin-playground:list-extension-examples, here we added the ability to discover/fetch text docs (mainly READMEs/local docs), but it does not yet expose the sidebar package-doc links.
There was a problem hiding this comment.
Yes, the agent could already find examples via
plugin-playground:list-extension-examples, here we added the ability to discover/fetch text docs (mainly READMEs
In that case I would try to avoid duplicating functionality. In my experience having multiple way to do the same thing can confuse agent.
closes #121