Add opt-in state retention for plugin WebUI pages - #294
Open
BernardXiong wants to merge 4 commits into
Open
Conversation
为 manifest.webui 增加可选 keep_alive 字段并在脚手架、Schema、校验和测试中统一默认值。\n补充插件资源令牌、宿主上下文和 WebSocket 传输约定的中英文文档。
为每个插件分配独立的资源令牌,限制静态资源和 backend 路由的插件边界。\n补全 WebSocket 协商头转发、CSP 通道声明及服务端回归测试。
按插件维护 iframe 生命周期,keep_alive 插件切换页面时保留表单和临时状态,默认插件仍按原逻辑重新加载。\n移除顶部栏并将退出 WebUI 放入侧边栏底部,补充导航与状态保持 E2E 测试并更新静态资源。
There was a problem hiding this comment.
🟡 Changes recommended
Asynchronous plugin checks can overwrite newer lifecycle state, and cleanup behavior lacks direct coverage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds opt-in iframe state retention and plugin-scoped backend transport support while simplifying WebUI navigation.
Changes:
- Adds
webui.keep_aliveacross manifests, scaffolding, documentation, and tests. - Retains opted-in plugin iframes and exposes scoped HTTP/WebSocket contexts.
- Moves WebUI exit controls into the sidebar.
File summaries
| File | Description |
|---|---|
plugins/webui/static/index.html |
References rebuilt frontend assets. |
plugins/webui/server.py |
Adds scoped asset tokens and backend contexts. |
plugins/webui/frontend/src/utils/plugins.ts |
Builds browser backend endpoints. |
plugins/webui/frontend/src/utils/plugins.test.ts |
Tests endpoint conversion. |
plugins/webui/frontend/src/types/api.ts |
Extends plugin and session contracts. |
plugins/webui/frontend/src/styles.css |
Updates layout and iframe stacking. |
plugins/webui/frontend/src/App.vue |
Implements retained iframe lifecycle and sidebar exit. |
plugins/webui/frontend/e2e/webui.spec.ts |
Tests navigation retention and UI changes. |
plugins/tests/test_webui_server.py |
Tests scoped assets, CSP, and WebSockets. |
plugins/tests/test_manifest_package.py |
Validates keep_alive. |
plugins/tests/test_epack_cli.py |
Verifies scaffold defaults. |
plugins/spec/README.md |
Documents retention and backend transport. |
plugins/spec/manifest-v1.schema.json |
Adds the schema field. |
plugins/README.zh-CN.md |
Updates Chinese plugin documentation. |
plugins/README.md |
Updates plugin documentation. |
plugins/manifest.py |
Validates the optional field. |
plugins/examples/build-insight-1.0.0/README.md |
Documents example host context. |
plugins/epack/project.py |
Adds the scaffold default. |
Review details
- Files reviewed: 18/21 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+490
to
+493
| function startPluginCheck(view: string) { | ||
| clearIframeTimer(view) | ||
| setIframeState(view, 'checking') | ||
| api.doctor(view).then((result) => { |
Comment on lines
+277
to
+281
| if (!next || !next.enabled || !next.webui || ( | ||
| previous && ( | ||
| previous.version !== next.version | ||
| || Boolean(previous.webui?.keep_alive) !== Boolean(next.webui?.keep_alive) | ||
| || previous.webui?.entry !== next.webui?.entry |
为每个插件的 doctor 请求增加代次校验,清理或重新检查后忽略过期的成功、失败和超时回调。\n补充 keep-alive 插件禁用后 iframe 被销毁、重新启用后创建新 iframe 的 E2E 覆盖。
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.
Summary
manifest.webui.keep_alive, defaulting tofalse.keep_alive.Implementation
Validation
npm run typechecknpm test -- --runnpm run test:e2epytest -q plugins/tests/test_manifest_package.py plugins/tests/test_epack_cli.py plugins/tests/test_webui_package.py plugins/tests/ test_webui_server.pyAll targeted tests pass.
Compatibility
Existing plugin manifests remain valid. If
keep_aliveis omitted, the value is treated asfalse, so existing plugins retain the originalreload behavior.