feat(#2092): migrate Qwen Code onto EoS imperative adapter + native subagents + SubagentStart (ADR-1239)

Fold all runtime==='qwen'/isQwen logic branches (skill-priority frontmatter,
branding/path rewrites, legacy commands/gsd cleanup, hyphen-namespace
normalization, RUNTIME_CONTENT_DISPATCH, hooks-surface label) into
descriptor-driven runtime.hostBehaviors on capabilities/qwen/capability.json,
read via _hostBehaviors(). Shared claude/qwen/hermes legacy-migration branches
in install-engine.cts folded to descriptor flags (claude+hermes descriptors
updated; FALLBACK_HOST_BEHAVIORS.claude floored). Byte-identical golden parity
for qwen/hermes/claude(global+local).

UPGRADE 1: native .qwen/agents/*.md subagent projection — new agents
artifact-layout kind + convertClaudeAgentToQwenAgent converter (name +
description + tools YAML block list; color/model dropped). qwen routed onto
the descriptor-driven agents path (_DESCRIPTOR_AGENTS_RUNTIMES).
UPGRADE 2: SubagentStart hook wired into extendedHookEvents + the
descriptor-gated hook-writer loop (activates only for qwen).

Tests: qwen-imperative-reference (adapter/axes/fail-closed/hostBehaviors +
no runtime==='qwen' source-grep across 4 files) + qwen-upgrades (agents file
validity + SubagentStart mirrors SubagentStop, descriptor-gated). Docs matrix
+ how-to updated; changeset added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-07-10 14:46:59 -04:00
parent 91a68ae8e6
commit c6ce110efa
24 changed files with 819 additions and 172 deletions

View File

@@ -183,6 +183,9 @@ const capabilities = {
"stateIO": "filesystem",
"transport": "mcp",
"runtime": "go"
},
"hostBehaviors": {
"reviewerCli": true
}
}
},
@@ -469,7 +472,11 @@ const capabilities = {
],
"ownsClaudePaths": true,
"nativeModelAliases": true,
"skillsGlobalOnboarding": true
"skillsGlobalOnboarding": true,
"legacyCommandsGsdInstallMigration": true,
"legacyCommandsGsdUninstall": "global",
"hyphenNameAgentBody": true,
"reviewerCli": true
}
}
},
@@ -873,7 +880,8 @@ const capabilities = {
"tomlConfigInstall": true,
"cleanupSkillSidecars": true,
"agentTomlFiles": true,
"frontmatterDialect": "codex"
"frontmatterDialect": "codex",
"reviewerCli": true
}
}
},
@@ -1083,7 +1091,8 @@ const capabilities = {
"stop",
"subagentStart",
"subagentStop"
]
],
"reviewerCli": true
}
}
},
@@ -1395,7 +1404,10 @@ const capabilities = {
"Claude Code": "Hermes Agent",
".claude/": ".hermes/"
},
"reapplyCommand": "gsd-update --reapply (mention the skill name)"
"reapplyCommand": "gsd-update --reapply (mention the skill name)",
"legacyCommandsGsdInstallMigration": true,
"legacyCommandsGsdUninstall": true,
"hyphenNameAgentBody": true
},
"hostIntegration": {
"embeddingMode": "imperative",
@@ -1968,7 +1980,8 @@ const capabilities = {
"skipHomePrefixSubstitution": true,
"skipSettingsUi": true,
"skipUpdateBannerCommand": true,
"skipCodexSkillsManifest": true
"skipCodexSkillsManifest": true,
"reviewerCli": true
}
}
},
@@ -2133,6 +2146,14 @@ const capabilities = {
"nesting": "nested",
"recursive": false,
"converter": "convertClaudeCommandToClaudeSkill"
},
{
"kind": "agents",
"destSubpath": "agents",
"prefix": "gsd-",
"nesting": "flat",
"recursive": false,
"converter": "convertClaudeAgentToQwenAgent"
}
],
"local": [
@@ -2143,6 +2164,14 @@ const capabilities = {
"nesting": "nested",
"recursive": false,
"converter": "convertClaudeCommandToClaudeSkill"
},
{
"kind": "agents",
"destSubpath": "agents",
"prefix": "gsd-",
"nesting": "flat",
"recursive": false,
"converter": "convertClaudeAgentToQwenAgent"
}
]
},
@@ -2157,7 +2186,8 @@ const capabilities = {
"extendedHookEvents": [
"SubagentStop",
"Stop",
"PreCompact"
"PreCompact",
"SubagentStart"
],
"hostIntegration": {
"embeddingMode": "imperative",
@@ -2175,6 +2205,19 @@ const capabilities = {
"stateIO": "filesystem",
"transport": "mcp",
"runtime": "node"
},
"hostBehaviors": {
"skillPriorityFrontmatter": true,
"brandingRewrites": {
"CLAUDE.md": "QWEN.md",
"Claude Code": "Qwen Code",
".claude/": ".qwen/"
},
"legacyCommandsGsdCleanup": true,
"legacyCommandsGsdInstallMigration": true,
"legacyCommandsGsdUninstall": true,
"hyphenNameAgentBody": true,
"reviewerCli": true
}
}
},
@@ -3787,6 +3830,9 @@ const runtimes = {
"stateIO": "filesystem",
"transport": "mcp",
"runtime": "go"
},
"hostBehaviors": {
"reviewerCli": true
}
}
},
@@ -3990,7 +4036,11 @@ const runtimes = {
],
"ownsClaudePaths": true,
"nativeModelAliases": true,
"skillsGlobalOnboarding": true
"skillsGlobalOnboarding": true,
"legacyCommandsGsdInstallMigration": true,
"legacyCommandsGsdUninstall": "global",
"hyphenNameAgentBody": true,
"reviewerCli": true
}
}
},
@@ -4246,7 +4296,8 @@ const runtimes = {
"tomlConfigInstall": true,
"cleanupSkillSidecars": true,
"agentTomlFiles": true,
"frontmatterDialect": "codex"
"frontmatterDialect": "codex",
"reviewerCli": true
}
}
},
@@ -4456,7 +4507,8 @@ const runtimes = {
"stop",
"subagentStart",
"subagentStop"
]
],
"reviewerCli": true
}
}
},
@@ -4525,7 +4577,10 @@ const runtimes = {
"Claude Code": "Hermes Agent",
".claude/": ".hermes/"
},
"reapplyCommand": "gsd-update --reapply (mention the skill name)"
"reapplyCommand": "gsd-update --reapply (mention the skill name)",
"legacyCommandsGsdInstallMigration": true,
"legacyCommandsGsdUninstall": true,
"hyphenNameAgentBody": true
},
"hostIntegration": {
"embeddingMode": "imperative",
@@ -4822,7 +4877,8 @@ const runtimes = {
"skipHomePrefixSubstitution": true,
"skipSettingsUi": true,
"skipUpdateBannerCommand": true,
"skipCodexSkillsManifest": true
"skipCodexSkillsManifest": true,
"reviewerCli": true
}
}
},
@@ -4856,6 +4912,14 @@ const runtimes = {
"nesting": "nested",
"recursive": false,
"converter": "convertClaudeCommandToClaudeSkill"
},
{
"kind": "agents",
"destSubpath": "agents",
"prefix": "gsd-",
"nesting": "flat",
"recursive": false,
"converter": "convertClaudeAgentToQwenAgent"
}
],
"local": [
@@ -4866,6 +4930,14 @@ const runtimes = {
"nesting": "nested",
"recursive": false,
"converter": "convertClaudeCommandToClaudeSkill"
},
{
"kind": "agents",
"destSubpath": "agents",
"prefix": "gsd-",
"nesting": "flat",
"recursive": false,
"converter": "convertClaudeAgentToQwenAgent"
}
]
},
@@ -4880,7 +4952,8 @@ const runtimes = {
"extendedHookEvents": [
"SubagentStop",
"Stop",
"PreCompact"
"PreCompact",
"SubagentStart"
],
"hostIntegration": {
"embeddingMode": "imperative",
@@ -4898,6 +4971,19 @@ const runtimes = {
"stateIO": "filesystem",
"transport": "mcp",
"runtime": "node"
},
"hostBehaviors": {
"skillPriorityFrontmatter": true,
"brandingRewrites": {
"CLAUDE.md": "QWEN.md",
"Claude Code": "Qwen Code",
".claude/": ".qwen/"
},
"legacyCommandsGsdCleanup": true,
"legacyCommandsGsdInstallMigration": true,
"legacyCommandsGsdUninstall": true,
"hyphenNameAgentBody": true,
"reviewerCli": true
}
}
},

View File

@@ -697,6 +697,8 @@ const VALID_CONVERTER_NAMES = new Set([
'convertClaudeAgentToCodebuddyAgent',
'convertClaudeAgentToClineAgent',
'convertClaudeAgentToCodexAgent',
// ADR-1239 / #2092 Phase B Upgrade 1 — native .qwen/agents/*.md subagent projection.
'convertClaudeAgentToQwenAgent',
]);
// C3: Validate role:runtime body
@@ -716,7 +718,9 @@ const VALID_ARTIFACT_NESTINGS = new Set(['flat', 'nested']);
const FEATURE_FIELDS_FORBIDDEN_ON_RUNTIME = ['skills', 'agents', 'steps', 'contributions', 'gates', 'hooks', 'activationKey'];
const VALID_INSTALL_SURFACES = new Set(['settings-json', 'codex-toml', 'copilot-instructions', 'cline-rules', 'cursor-hooks-json', 'profile-marker-only']);
const VALID_PERMISSION_WRITERS = new Set(['opencode', 'kilo']);
const VALID_EXTENDED_HOOK_EVENTS = new Set(['SubagentStop', 'Stop', 'PreCompact', 'FileChanged', 'BeforeAgent', 'AfterAgent', 'BeforeModel']);
// SubagentStart added #2092 Phase B Upgrade 2 (qwen-only today — see
// capabilities/qwen/capability.json's extendedHookEvents).
const VALID_EXTENDED_HOOK_EVENTS = new Set(['SubagentStop', 'Stop', 'PreCompact', 'FileChanged', 'BeforeAgent', 'AfterAgent', 'BeforeModel', 'SubagentStart']);
// ADR-1239 Phase A: hostIntegration axes (MUST stay parity-identical to HOST_INTEGRATION_AXES in src/host-integration.cts)
const VALID_EMBEDDING_MODES = new Set(['imperative', 'declarative']);
@@ -742,7 +746,9 @@ const INSTALL_SURFACE_TO_ALLOWED_HOOKS_SURFACES = new Map([
// GATE B: extended hook event families → required hookEvents value
// Gemini agent-events require hookEvents='gemini'; Claude-family events require hookEvents='claude'.
const GEMINI_AGENT_EVENTS = new Set(['BeforeAgent', 'AfterAgent', 'BeforeModel']);
const CLAUDE_FAMILY_EVENTS = new Set(['SubagentStop', 'Stop', 'PreCompact', 'FileChanged']);
// SubagentStart added #2092 Phase B Upgrade 2 — Claude hook-event dialect
// counterpart of SubagentStop (qwen-only today).
const CLAUDE_FAMILY_EVENTS = new Set(['SubagentStop', 'Stop', 'PreCompact', 'FileChanged', 'SubagentStart']);
/**
* Validate a runtime.configHome object per ADR-1016 Decision 1.