Repository navigation
Description
Motivation
The knowledge-base Server plugin has two development roots. Its Python implementation and installable Dashboard assets live in plugins/knowledge-base/, while the React application, lockfile and build scripts live in frontend/knowledge-base/. A contributor has to find both trees to change one feature. Simply moving the npm project into the directory that Server loads would also make development files and potentially node_modules part of the plugin fingerprint and runtime snapshot.
Proposed repository convention
Keep the implementation of each first-party Server plugin under one repository root. For plugins with a separately built Dashboard, use this layout, starting with knowledge-base:
plugins/knowledge-base/
README.md
frontend/ # React/TypeScript sources, lockfile and build tooling
runtime/ # contents to install under the plugin name
plugin.py
pc_knowledge_base/
ui/ # built HTML, JavaScript and CSS served by Server
Apply the same source/runtime separation to future first-party Server plugins with development-only build tooling. A small Python-only plugin can keep plugin.py directly in its named directory when that directory is already suitable for installation. Host integrations and the core Dashboard have their own packaging conventions.
The installed layout stays <configured-plugins-dir>/knowledge-base/plugin.py. Copy the contents of runtime/ into the named destination. Installing a directory named runtime would give it the wrong identity. Users currently pointing Server directly at the checkout's plugins/ need a documented staging step. Keep plugin discovery and fingerprinting in the framework as they are.
Acceptance criteria
- Move the knowledge-base frontend and Python runtime under the proposed root. The frontend build writes the checked-in assets to
runtime/ui/. Installing frontend dependencies or editing unbuilt frontend sources leaves the installable directory untouched. - Document the convention and its scope in the English and Chinese plugin development guides. Update the knowledge-base guides and README with working build and installation examples, including the transition for source-checkout users.
- Update repository path references, test fixtures, packaging/tooling configuration, CI change detection, npm caching and the generated-asset drift check. Changes to either half of the plugin should select its existing checks.
- Stage the plugin into a clean configured plugin directory and start a real Server. Verify that it discovers
knowledge-base, serves the Dashboard entry and assets, and handles an existing plugin API request with the current plugin identity. The staged installation must run without Node.js or frontend development dependencies.
Related: knowledge-base implementation #2658 and the Server plugin development guide.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn progress
Activity
Lumea-art commentedon Dec 2, 2026
I'd like to take this. Plan:
frontend/knowledge-base/toplugins/knowledge-base/frontend/and the installable Python/UI tree toplugins/knowledge-base/runtime/; the frontend build writesruntime/ui/.runtime/into<plugins-dir>/knowledge-baseso the plugin identity and fingerprint stay unchanged.hireview001 commentedon Dec 2, 2026
This issue belongs to the Knowledge base module. @Zxf-xufeng, please lead follow-up, with support from @Alanxtl. Please provide a substantive response within 72 hours of issue creation, outlining the proposed disposition, any additional information needed, or the next investigation steps. After sufficient discussion and agreement on the scope and acceptance criteria, a contributor who volunteers to take it on can undertake implementation.
jasper-yl commentedon Dec 3, 2026
@Zxf-xufeng @frf12
I agree with the goal: one root per first-party plugin. Before the
runtime/layout becomes a convention in the plugin guide, I'd like to offer to solve this in the framework instead, and ask which way you prefer.Proposal: a
.pluginignorefile in the plugin directoryThe loader counts every file under the plugin directory except
__pycache__(version_filesinbuiltin/plugins/manifest.py), which is why development files cannot live there today. I would let a plugin list top-level entries that discovery, fingerprinting and the version snapshot skip:Rules, kept deliberately narrow:
.pluginignoreitself counts toward the fingerprint, so changing it produces a new version.plugin.pycannot be ignored.What this changes compared with the
runtime/layoutcp -R plugins/knowledge-base <plugins-dir>/knowledge-base. The "copy the contents ofruntime/into a named directory" step has needed three review rounds in refactor(knowledge-base): separate frontend sources from the installable runtime #2967 to get right (missing plugin name, an unset variable resolving to/knowledge-base, build order).POWERCONTEXT_SERVER_PLUGINS_DIRat the checkout'splugins/keeps working for local development. At42cc8b872a real Server reportsfailed: the plugin directory has no plugin.pyfor that setup.Tests and evaluation belong in the same root
I'd also like the root to hold
tests/knowledge_base/andevaluation/knowledge_base/, under either layout:pc_knowledge_basethroughsys.pathand use no shared fixtures fromtests/.evaluation/measure core behavior.The e2e tests can stay in
tests/e2e/, since they use the shared Server helper there.Cost and timing
This changes the loading contract. I will open the framework PR within 24 hours of a go-ahead, including the plugin interfaces RFC, the plugin guides in both locales, and loader tests. The knowledge-base move can then be a rebase of #2967 by @Lumea-art or a follow-up from me, whichever you prefer.
If you would rather merge #2967 first, two requests:
runtime/. "Runtime" already has a meaning in this project (POWERCONTEXT_SERVER_RUNTIME, collect Runtimes), soplugins/knowledge-base/runtime/reads as the plugin's Runtime implementation.plugin/would say what the directory is.<plugins-dir>/knowledge-base -> plugins/knowledge-base/runtimerestores it: at42cc8b872a real Server loads the plugin through the link and picks up an edit in the checkout at the next scan without a restart.In that case I'd also keep the layout description in the plugin's own README rather than in the plugin-writing guide, which addresses all plugin authors.
Which do you prefer?
我同意目标:每个一方插件一个根目录。在
runtime/布局写进插件指南成为约定之前,我想提出改由框架侧解决,并征求你们的意见。提议:在插件目录里放一个
.pluginignore,列出的顶层条目不参与发现、指纹和版本快照。规则保持很窄:只支持顶层条目名、不支持通配;.pluginignore自身计入指纹;plugin.py不可忽略。与
runtime/布局相比:安装命令不变,仍是整目录拷贝("拷runtime/的内容到命名目录"这一步在 #2967 里已经改了三轮);本地开发仍可把插件目录直接指向 checkout 的plugins/(在42cc8b872上这样做,真实 Server 报failed: the plugin directory has no plugin.py);不需要给子目录起名;第三方插件作者也能用同一机制。测试和评测也应在同一个根目录下:无论采用哪种布局,我都希望把
tests/knowledge_base/和evaluation/knowledge_base/收进来。单元测试只通过sys.path导入pc_knowledge_base,不依赖tests/的公共夹具;评测衡量的是这个插件的解析器并依赖插件自己的 extra,而evaluation/下其他套件衡量的是核心行为。e2e 测试依赖公共的 Server 辅助模块,可以留在tests/e2e/。代价与时间:这会改动加载契约。得到同意后我会在 24 小时内提框架 PR,包含插件接口 RFC、中英文指南和加载器测试。之后知识库的搬迁可以由 @Lumea-art 在 #2967 上 rebase,也可以由我跟进,看你们方便。
如果更希望先合 #2967,有两点请求:一是给
runtime/换个名字,Runtime 在本项目里已有含义,建议plugin/;二是在文档里写明开发方式,用符号链接指向该子目录即可(在42cc8b872上已用真实 Server 验证:通过链接可加载,checkout 里的修改在下一次扫描生效,无需重启)。另外建议把布局说明放在插件自己的 README,而不是面向所有插件作者的编写指南。你们倾向哪种?
Zxf-xufeng commentedon Dec 3, 2026
@jasper-yl @frf12 @Lumea-art
I'm leaning toward Option A (framework-side
.pluginignore).Solving this in the loader keeps direct checkout development and whole-directory installation working, avoids inventing a one-size-fits-all subdirectory convention, and gives third-party plugin repositories the same mechanism. The narrow rule set (top-level names only, no globs,
.pluginignoreincluded in the fingerprint,plugin.pynon-ignorable) looks clean and easy to audit.Three details to align on:
node_modules: even when.pluginignoreexcludesfrontend/from discovery, fingerprinting and snapshots, a plaincp -Rfrom a dev checkout that has runnpm ciwill still copynode_modulesto disk. Please document copying from a clean checkout or excludingnode_modulesin the installation instructions..pluginignoreshould be an optional capability rather than a mandatory source layout. The plugin-writing guide should document the installed contract and.pluginignorebehavior, whileplugins/README.mdstays a simple directory index and each plugin's own README documents its layout and build/install steps.tests/andevaluation/move separately: I agree that plugin-only unit tests (tests/knowledge_base/) and evaluation (evaluation/knowledge_base/) belong underplugins/knowledge-base/(with shared-Server e2e tests staying intests/e2e/). Let's handle that move in a separate follow-up PR after.pluginignoreand thefrontend/relocation land, so each PR stays focused.@frf12 @Lumea-art What do you think? If we're aligned on this direction, @jasper-yl can go ahead with the
.pluginignoreframework PR, and we can coordinate with @Lumea-art on how best to carry #2967 forward.我比较倾向 方案 A(框架侧
.pluginignore)。在加载器侧解决可以保留 checkout 直接开发和整目录安装,不需要强行约定单一子目录结构,也能让第三方插件仓库复用同一机制。收窄后的规则(仅顶层条目名、无 glob、
.pluginignore计入指纹、plugin.py不可忽略)边界清晰,易于维护。补充三点希望一起对齐的细节:
node_modules拷贝提示:即使.pluginignore让 Server 跳过frontend/,在执行过npm ci的开发目录直接cp -R仍会把node_modules拷到磁盘上,安装文档里需要提醒从干净检出拷贝或排除node_modules。.pluginignore作为可选能力而非强制目录规范;插件开发指南重点说明安装态契约和.pluginignore规则,plugins/README.md保持简洁目录索引,具体子目录与构建/安装步骤放在各插件自己的 README。tests/与evaluation/拆成后续独立 PR:同意将插件独有的单元测试(tests/knowledge_base/)和评测(evaluation/knowledge_base/)迁入plugins/knowledge-base/(依赖公共 Server 夹具的 e2e 留在tests/e2e/),但在.pluginignore和frontend/迁移合入后另开 PR 推进,控制单次改动范围。@frf12 @Lumea-art 你们怎么看?如果大家对这个方向达成一致,再请 @jasper-yl 提
.pluginignore的框架 PR,之后和 @Lumea-art 一起商量 #2967 怎么衔接。