Conversation
…ugins Adds engine version compatibility check in pkgLoads function before loading the main entry file. This ensures that plugins with incompatible karin versions are not loaded, even when called through hot-reload or install APIs. The check validates pkg.karin.engines.karin or pkg.engines.karin against the current KARIN_VERSION and returns early if the version doesn't match, preventing the main file execution and plugin registration. Fixes issue where pkgHotReload bypassed version checks during plugin installation. Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix plugin engine behavior for version mismatch
Fix: Prevent loading plugins with incompatible engine versions
Oct 20, 2025
Member
|
@copilot 给私有字段karin加个能忽略engines的选项,强制加载插件,但是继续输出警告日志。 |
…match Added karin.ignoreEngines boolean field in package.json that allows plugins to be force loaded even when engine version doesn't match. When enabled: - Plugin continues to load despite version incompatibility - Outputs warning log (instead of error) with details about version mismatch - Only applies to karin.engines field, not package.engines This allows plugin developers to explicitly opt-in to loading on incompatible versions while still being warned about the incompatibility. Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
Contributor
Author
已添加 Changes in commit: 4c0a7c8 |
Copilot
AI
changed the title
Fix: Prevent loading plugins with incompatible engine versions
Fix: Prevent loading plugins with incompatible engine versions and add ignoreEngines option
Oct 20, 2025
Member
|
@copilot karin.ingoreEngines true才强行加载 入口文件现在会被莫名其妙加载 |
Fixed issue where plugins with version mismatch were not being loaded even when ignoreEngines was set to true. Now when ignoreEngines=true is explicitly set, isCompatible is set to true to allow the main entry file to load. Logic flow: - No version requirement or version matches: loads normally - Version mismatch + no ignoreEngines: blocked completely - Version mismatch + ignoreEngines=true: force loads with warning Co-authored-by: sj817 <74231782+sj817@users.noreply.github.com>
Contributor
Author
已修复。现在只有当 逻辑流程:
Changes in commit: e2f8e5b |
- 移除对 peerDependencies/dependencies/devDependencies 中 'node-karin' 的查找,仅使用 karin/engines 字段 - 简化版本范围处理(去掉 workspace:/link: 替换,改为 trim) - 不再在发现不兼容但设置 ignoreEngines 时强制把 isCompatible 设为 true;改为引入 shouldLoad 标志: - 若不兼容且未设置 ignoreEngines,则终止加载(提前返回) - 若不兼容但设置 ignoreEngines,则保持 isCompatible = false,但仍允许加载插件并执行入口 - 调整入口文件执行条件:非 app 类型插件始终尝试执行入口(支持 ignoreEngines 强制加载场景)
Contributor
|
你可以通过以下命令安装该版本: |
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
Fixed the bug where plugins with incompatible engine versions would still execute their main entry file when installed via the web UI or API. Added option to force load plugins with version warnings.
Recent Fix (Latest Commit)
Fixed issue where
ignoreEngines=truewas not working correctly - plugins with version mismatches were not being loaded even whenignoreEngineswas explicitly set totrue.Changes
pkgLoadsbefore loading main filekarin.ignoreEnginesfield to allow force loading with warningsignoreEnginesflagignoreEngines=trueImplementation Details
Version Check Logic
When a version mismatch is detected:
ignoreEnginesisundefinedorfalse: Plugin is completely blocked (returns early)ignoreEnginesistrue: SetsisCompatible = trueto force load the plugin with warningThis ensures only explicitly opted-in plugins (
ignoreEngines: true) can bypass version checks.Example Usage
{ "name": "karin-plugin-example", "version": "1.0.0", "karin": { "engines": { "karin": "^2.0.0" }, "ignoreEngines": true } }Behavior
Scenario 1: Compatible version
^1.0.0, Current:1.5.0Scenario 2: Incompatible WITHOUT ignoreEngines
^2.0.0, Current:1.5.0,ignoreEngines: undefinedScenario 3: Incompatible WITH ignoreEngines=true
^2.0.0, Current:1.5.0,ignoreEngines: trueImpact
ignoreEngines=trueOriginal prompt
Fixes #570
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.