Repository navigation
Conversation
…ble runtime Give the first-party knowledge-base plugin one source root. React sources, lockfile and build tooling move to plugins/knowledge-base/frontend/, while the installable plugin.py, Python package and built Dashboard assets move to plugins/knowledge-base/runtime/. The frontend build writes runtime/ui/, so installing frontend dependencies or editing unbuilt sources leaves the installable directory untouched. Staging copies the contents of runtime/ into <plugins-dir>/knowledge-base; tests assert the installed directory has no runtime/, frontend/ or node_modules. Update npm caching, build and drift checks, type-check paths, licence path, CI change detection, evaluation imports and e2e staging. Document the convention and transition in the English and Chinese plugin development guides and the knowledge-base install guide.
Zxf-xufeng
left a comment
There was a problem hiding this comment.
Please address the four review comments before merge. I reproduced the two evaluation regressions on this commit with CPython 3.12.14 and the locked dependencies. Both checks pass on the PR base. Please request another review once the fixes and documentation updates are ready.
Refresh scorer_sha256 in the evaluator manifest after the evaluator import path changed; the Python 3.12 dry run passes all 11 fixtures again. Resolve the legacy export's plugin directory from the supplied checkout's layout, accepting both the historical plugin root and the new runtime/ root, so the e6e36a4 checkout still imports pc_knowledge_base. Name plugins/<plugin-name>/ explicitly in both plugin-development guides and add plugins/README.md as the first-party plugin index.
|
Addressed the four review comments in f061101:
|
Zxf-xufeng
left a comment
There was a problem hiding this comment.
I verified the four previous requests at f0611013b. The evaluation dry run passes all 11 fixtures on the pinned toolchain, the six historical samples match the recorded baseline byte for byte, both guides specify the repository path, and GitHub now lists plugins/ separately. One correction remains in the new directory index: please specify the named installation subdirectory in the line below.
|
The affected modules are Knowledge base. @Zxf-xufeng, please coordinate follow-up. Knowledge base: @Zxf-xufeng @Alanxtl. Please coordinate the review of the affected changes. |
|
Fixed in f5ab2c6: |
|
Also aligned the remaining #2966 acceptance details in 42cc8b8:
|
Zxf-xufeng
left a comment
There was a problem hiding this comment.
All five previous review threads are addressed, including the install destination in the top-level index. With the plugin directory set, I verified the documented staging layout against a real Server. One issue remains in the newly added shell example when the variable is unset.
Non-blocking path cleanup: the current merge result still lists frontend/knowledge-base/ in MAINTAINERS.md and .github/CODEOWNERS, and the CI selector test uses plugins/knowledge-base/pc_knowledge_base/content.py. The existing plugins/knowledge-base/ ownership rule and CI glob cover the moved code. Removing the obsolete references and using real runtime/frontend paths in the test would keep those examples accurate.
| Copying the `runtime` directory itself would give the plugin the wrong identity: | ||
|
|
||
| ```bash | ||
| mkdir -p "$POWERCONTEXT_SERVER_PLUGINS_DIR/knowledge-base" |
There was a problem hiding this comment.
[P2] Make the installation destination explicit before creating it. A Server configured through its service environment can have a plugin directory even when the shell running these commands has no POWERCONTEXT_SERVER_PLUGINS_DIR. In that shell the example expands to mkdir -p /knowledge-base and copies the runtime there. It fails for a typical unprivileged user or installs outside the configured directory if the account can write to /. Please show how to set the variable to the actual Server plugin directory, or guard the snippet before either filesystem operation with : "${POWERCONTEXT_SERVER_PLUGINS_DIR:?Set this to the Server plugin directory}". The named knowledge-base/ destination itself is correct.
Zxf-xufeng
left a comment
There was a problem hiding this comment.
Reviewed at 42cc8b8728d03dec5924680e230cf9bf0552dc8d. One note on keeping plugins/README.md scoped as a directory index rather than encoding plugin-specific layout and installation steps.
| Each subdirectory is the source root of one first-party PowerContext Server plugin. A plugin with a separately built | ||
| Dashboard keeps its frontend sources under `frontend/` and the installable files under `runtime/`; only the contents of | ||
| `runtime/` are copied into `<configured-plugins-dir>/<plugin-name>/`, so `plugin.py` is directly inside the named | ||
| directory. For example, the knowledge-base runtime is installed at `<configured-plugins-dir>/knowledge-base/`. | ||
|
|
||
| - [Knowledge-base plugin](knowledge-base/README.md) | ||
| - [Write a plugin](../docs/en/docs/develop/plugins.md) · [编写插件](../docs/zh/docs/develop/plugins.md) |
There was a problem hiding this comment.
Keep plugins/README.md scoped as a directory index instead of describing frontend//runtime/ layout details or plugin-specific installation paths here. Different first-party plugins can have different subdirectory layouts (for example, Python-only plugins without frontend/ or runtime/) and different installation steps; those details belong in each plugin's own README and the plugin development guides.
| Each subdirectory is the source root of one first-party PowerContext Server plugin. A plugin with a separately built | |
| Dashboard keeps its frontend sources under `frontend/` and the installable files under `runtime/`; only the contents of | |
| `runtime/` are copied into `<configured-plugins-dir>/<plugin-name>/`, so `plugin.py` is directly inside the named | |
| directory. For example, the knowledge-base runtime is installed at `<configured-plugins-dir>/knowledge-base/`. | |
| - [Knowledge-base plugin](knowledge-base/README.md) | |
| - [Write a plugin](../docs/en/docs/develop/plugins.md) · [编写插件](../docs/zh/docs/develop/plugins.md) | |
| Each subdirectory holds the source of one first-party PowerContext Server plugin. Follow each plugin's README for its | |
| layout, build, and installation steps, and see the plugin development guide for general conventions. | |
| ## Plugins | |
| - [Knowledge-base](knowledge-base/README.md) | |
| ## Guides | |
| - [Write a plugin](../docs/en/docs/develop/plugins.md) · [编写插件](../docs/zh/docs/develop/plugins.md) |
| cp -R plugins/knowledge-base/runtime/. "$POWERCONTEXT_SERVER_PLUGINS_DIR/knowledge-base/" | ||
| ``` | ||
|
|
||
| The Dashboard is built from `frontend/` and the result is checked in under `runtime/ui/`: |
There was a problem hiding this comment.
Please put the optional Dashboard build before the install step and state that both examples run from the repository root. Someone installing a checkout can use the assets already committed under runtime/ui/. Someone who edited the frontend needs to rebuild before copying runtime/. Following the examples in their current order installs the old assets and leaves the rebuilt files in the checkout.
|
Before this merges, I've raised a question about the layout convention in #2966: a framework-side 合并之前,我在 #2966 提了一个关于布局约定的问题:框架侧 |
|
@Lumea-art Thanks again for all the careful work on this PR and getting the CI checks green. Before we merge, @jasper-yl raised an alternative in #2966—handling this in the framework via Could you share your view in #2966? In the meantime, please hold off on addressing the earlier @Lumea-art 非常感谢你在这个 PR 上细致的改动,也看到核心 CI 都已经通过了。 合并之前,@jasper-yl 在 #2966 里提了一个替代方案:通过框架侧的 方便的话欢迎在 #2966 里聊聊你的意见。在方向定下来之前,先不用针对刚才那几条 |
Closes #2966.
Change
The knowledge-base plugin now has one source root:
frontend/build.mjswrites checked-in assets toruntime/ui/, so editing unbuilt sources or installingnode_modulesnever changes the installable tree.runtime/into<plugins-dir>/knowledge-base. Copyingruntimeitself would change the plugin identity; the plugin-development and knowledge-base guides now state this transition explicitly.plugin.pybut noruntime/,frontend/ornode_modules/, then start a real Server and exercise the Dashboard entry/assets and plugin API.Repository updates
npm ci/npm run buildprefixes, generated-asset drift check andtypath in the knowledge-base CI job.pyproject.tomltype-check paths,.licenserc.yaml,.github/ci-paths.toml.runtime/.Validation
pytest tests/knowledge_base tests/test_ci_changes.py→ 227 passed, 14 skipped.python -m evaluation.knowledge_base dry-run(Python 3.12.14, knowledge-base extras) → 11 fixtures verified.npm ci+npm run buildfromplugins/knowledge-base/frontendproduced no drift inruntime/ui.tycheck only reports missing optionalopendal/rapidocr/fastembedpackages locally; CI installs the knowledge-base extras. The staged real-Server e2e runs in the knowledge-base CI job.AI assistance
Authored with AI assistance and reviewed by the contributor before submission.