feat(#2505): Phase 4 — runtime-aware subagent dispatch (Option A; resolve-dispatch-type query) (#2525)

* feat(#2508): Phase 4 Option A — runtime-aware subagent dispatch via resolve-dispatch-type query (#2505)

* fix(#2508): prose-variant preamble (avoid scanner-tripping literals) + namedDispatch===false-only mapping

* fix(#2508): remove leftover old-preamble lines (keep prose variant only)

* fix #2508: prose-only reference file

* test #2508: regen golden install parity after workflow preamble additions

* fix #2508: remove preamble from plan-phase.md (Phase 6 capstone ceiling); regen size+golden baselines

* docs(changeset): backfill PR #2525 for Phase 4 (#2508)
This commit is contained in:
Tom Boucher
2026-07-22 10:22:42 -04:00
committed by GitHub
parent 936a345381
commit f654c24a3e
72 changed files with 905 additions and 552 deletions

View File

@@ -1187,6 +1187,45 @@ function dispatchOverlayCapabilityCommand({ command, args, cwd, raw, error, load
}
}
function routeResolveDispatchType({ args, cwd, raw, error }) {
// #2508 Phase 4 Option A: resolve a requested GSD subagent name to the
// type an Agent() call should use on the current runtime. On
// named-dispatch runtimes (Claude, OpenCode, …) the name is returned
// unchanged; on built-in-only runtimes (kimi-code) it maps to the
// closest built-in (coder/explore/plan) by role-suffix heuristic.
// The persona rides ${AGENT_SKILLS_*} (Phase 3 / #2510) regardless.
//
// Output:
// --raw (default) → prints the resolved type (e.g. "gsd-planner" or "plan")
// --json → prints { runtime, requested, resolved, dispatch }
try {
const requestedIdx = args.indexOf('--requested');
const requested = requestedIdx !== -1 ? args[requestedIdx + 1] : '';
const { resolveRuntime } = require('./lib/runtime-slash.cjs');
const runtimeId = resolveRuntime(cwd);
const registry = require('./lib/capability-registry.cjs');
const runtimeEntry = registry.runtimes != null
? registry.runtimes[runtimeId]
: null;
const dispatch = runtimeEntry?.runtime?.hostIntegration?.dispatch ?? null;
const hostIntegration = require('./lib/host-integration.cjs');
const resolved = hostIntegration.resolveDispatchType(requested, dispatch);
const jsonIdx = args.indexOf('--json');
if (jsonIdx !== -1) {
output({ runtime: runtimeId, requested, resolved, dispatch }, raw);
} else {
process.stdout.write(String(resolved));
}
} catch {
// Fail-closed: on any error, echo the requested name unchanged
// (named-dispatch is the GSD default; degrading to it preserves
// behavior for every runtime already in the field).
const requestedIdx = args.indexOf('--requested');
const requested = requestedIdx !== -1 ? args[requestedIdx + 1] : '';
process.stdout.write(String(requested));
}
}
function routeAgentSkills({ args, cwd, raw, error }) {
// --json emits typed IR { agent_type, block, skills_count } for test assertions
// (#455). Default (no flag) outputs raw XML so workflow shell expansions work.
@@ -2080,6 +2119,7 @@ const HOST_COMMAND_ROUTERS = {
'quick-tasks-append': routeQuickTasksAppend,
'normalize-test-command': routeNormalizeTestCommand,
'dispatch-should-flatten': routeDispatchShouldFlatten,
'resolve-dispatch-type': routeResolveDispatchType,
'agent-skills': routeAgentSkills,
'skill-manifest': routeSkillManifest,
'history-digest': routeHistoryDigest,