feat(tokenless): add qwencode adapter for Qwen Code extension#879
feat(tokenless): add qwencode adapter for Qwen Code extension#879shiloong wants to merge 2 commits into
Conversation
…law plugin OpenClaw 2026.6.5 (5181e4f) fails to load tokenless plugin at registration with ReferenceError: __dirname is not defined. The openclaw adapter package.json declares type:module (ESM) and tsconfig outputs Node16 module format, which produces ESM import syntax in dist/index.js. However loadToolCategories() used the CJS global __dirname to resolve tool_categories.json paths — this variable does not exist in ESM modules. Replace the two __dirname references with import.meta.dirname (Node 20.11+; OpenClaw 2026.6.5 runs on Node 22+). Other openclaw plugins (sec-core, ws-ckpt, agent-memory) were checked and have no bare __dirname usage — no similar bug exists elsewhere. Signed-off-by: Shile Zhang <shile.zhang@linux.alibaba.com>
- Add qwencode adapter with PreToolUse, PostToolUse, and BeforeModel hooks - Support RTK command rewriting, response/TOON/schema compression, and Tool Ready checks - Deduplicate run-hook.sh: move to common/hooks/, qwencode uses symlink - Expand Bash matcher to cover all shell tool variants (Bash, run_shell_command, etc.) - Add sequential:true on tool-ready for ordered execution with rewrite - Remove unused TOKENLESS_HOST env from all hook registrations - Adjust timeouts to match cosh baseline (rewrite 5s, others 10s) - Add detection, installation, and uninstallation scripts - Integrate with RPM build system and manifest configuration Signed-off-by: Shile Zhang <shile.zhang@linux.alibaba.com>
Code Review — PR #879结论: 整体设计优秀:run-hook.sh 提升到 common/ 消除重复、symlink 方案简洁、RPM 全链路覆盖完整、settings.json 去重防止双重注册。与现有适配器模式高度一致。 🔴 建议修复后合并H1. H2. 🟡 建议改进M1. install.sh 内嵌 ~25 行 Python 脚本可读性较低,建议抽取为 M2. detect.sh 中 M3. rewrite timeout 5s vs Claude Code 10s — 确认差异是有意的平台适配还是遗漏 M4. install.sh 中 ℹ️ 其他
|
Description
Related Issue
no-issue # add qwen code extension support
Type of Change
Scope
cosh(copilot-shell)sec-core(agent-sec-core)skill(os-skills)sight(agentsight)tokenless(tokenless)ckpt(ws-ckpt)memory(agent-memory)anolisa(anolisa-cli)Checklist
cosh: Lint passes, type check passes, and tests passsec-core(Rust):cargo clippy -- -D warningsandcargo fmt --checkpasssec-core(Python): Ruff format and pytest passskill: Skill directory structure is valid and shell scripts pass syntax checksight:cargo clippy -- -D warningsandcargo fmt --checkpasstokenless:cargo clippy -- -D warningsandcargo fmt --checkpassmemory(Linux only):cargo clippy --all-targets -- -D warnings,cargo fmt --check, andcargo testpassanolisa:cargo clippy --all-targets --locked -- -D warnings,cargo fmt --all --check, andcargo test --lockedpasspackage-lock.json/Cargo.lock)Testing
Additional Notes