feat(plugins): add managed runtime SDK and release 2.4.5
This commit is contained in:
1 parent
506e3bf1c5
commit
2a3bbaa3fb
45 files changed
+3348
-98
No files matched your search
@@ -1,46 +1,6 @@
|
||||
"""Validate a plugin package; --live checks MCP declarations without executing actions."""
|
||||
"""Shared plugin development and market-materials checker; no tool actions."""
|
||||
|
||||
import argparse
|
||||
import asyncio
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from artemis.plugins.evidence import validate_tools
|
||||
from artemis.plugins.models import PluginManifest, PluginProfile
|
||||
from artemis.plugins.session import PluginSession, resolve_server
|
||||
from artemis.plugins.store import contained_path
|
||||
|
||||
|
||||
async def check(directory: Path, live: bool, values: dict[str, str]) -> None:
|
||||
manifest = PluginManifest.model_validate_json((directory / "plugin.json").read_text("utf-8"))
|
||||
manifest.check_compatible()
|
||||
if manifest.skill:
|
||||
skill = contained_path(directory, manifest.skill)
|
||||
if not skill.is_file() or not skill.read_text("utf-8").strip():
|
||||
raise ValueError("缺少有效的 Skill")
|
||||
if manifest.schema_version not in {2, 3}:
|
||||
raise ValueError("新市场插件必须适配 schema_version=2 或 3")
|
||||
if live and manifest.server:
|
||||
server = resolve_server(manifest, PluginProfile(values=values), directory)
|
||||
session = await PluginSession(server, directory).start()
|
||||
try:
|
||||
validate_tools(manifest, session.tools)
|
||||
finally:
|
||||
await session.aclose()
|
||||
print(
|
||||
f"PASS {manifest.id} {manifest.version}: 清单/兼容性/Skill"
|
||||
+ ("/MCP 工具声明" if live and manifest.server else "")
|
||||
)
|
||||
print("此检查不代替实际执行、超时取消、证据导出和视觉能力验收。")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("directory", type=Path)
|
||||
parser.add_argument("--live", action="store_true")
|
||||
parser.add_argument("--values", default="{}", help="普通配置 JSON;不得包含密钥")
|
||||
args = parser.parse_args()
|
||||
asyncio.run(check(args.directory.resolve(), args.live, json.loads(args.values)))
|
||||
from artemis.plugins.validation import check as check, main
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user