Skip to content

Add plugin doc discovery/fetch commands#130

Draft
MUFFANUJ wants to merge 1 commit intojupyterlab:mainfrom
MUFFANUJ:discoveryDocs
Draft

Add plugin doc discovery/fetch commands#130
MUFFANUJ wants to merge 1 commit intojupyterlab:mainfrom
MUFFANUJ:discoveryDocs

Conversation

@MUFFANUJ
Copy link
Copy Markdown
Member

closes #121

  • Added plugin-playground:discover-plugin-docs and plugin-playground:fetch-plugin-doc for AI doc discovery and retrieval.
  • Added docFetchMaxChars setting (default 20000, max 200000) and enforced cap behavior.
  • Added discovery controls: query, package, detailLevel, plus hasMore/remaining/hint metadata.
  • Restricted doc fetch to paths returned by discovery.
  • Updated docs/skill guidance and merged coverage into existing UI tests.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 29, 2026

Binder JupyterLite 👈 Launch a Binder on branch MUFFANUJ/plugin-playground/discoveryDocs

Comment on lines +168 to +181
*
* 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;
}
Copy link
Copy Markdown
Member

@krassowski krassowski Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Suggested change
*
* 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;

Comment on lines +1744 to +1746
private async _discoverPluginDocs(): Promise<
ReadonlyArray<IPluginDocRecord>
> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it get docs for the packages as linked in the sidebar?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially thought we want to have both

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +1769 to +1798
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
});
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like docs and these READMEs are different concepts. Can the agent already find examples without this PR?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@MUFFANUJ MUFFANUJ marked this pull request as draft March 30, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Add doc discovery/fetch for AI tooling

2 participants