* feat(#1689): per-plan agent_hint executor routing Option A per-plan specialist routing: a plan with an `agent_hint:` frontmatter field is dispatched to that subagent instead of gsd-executor when it resolves on the active runtime; absent/unresolved/disabled falls back to gsd-executor (byte-identical). Default-on via workflow.agent_hint_routing. - src/phase.cts: parse agent_hint into the plan-index JSON (plan_json.agent_hint) - agent-install-check.cts: resolveAgentHint() reuses getAgentsDir + runtime filename variants; probes project + global agent dirs; fails closed; rejects path-traversing names - gsd-tools.cjs: 'resolve-agent' query route (fail-closed to gsd-executor; --raw/--json) - execute-phase.md: lean per-plan reference + {EXECUTOR_TYPE} placeholder (host stays under the ADR-857 Phase 6 byte ceiling) - execute-phase/steps/per-plan-executor-routing.md: resolution logic (Agent()-based dispatch; advisory on orchestrator-worktree) - config: workflow.agent_hint_routing (validKey, default-on via SCHEMA_DEFAULTS, boolean validator) - docs (CONFIGURATION.md, plan-md.md), changeset, tests/agent-hint-routing-1689.test.cjs (17 tests) * chore(#1689): backfill changeset PR number (#3417) * chore(#1689): regenerate install-tree fixtures for new workflow fragment * chore(#1689): ack deliberate execute-phase.md growth (agent_hint routing) * test(#1689): SPAWN contract allows parameterized subagent_type placeholder agent-frontmatter's spawn-type checks scanned subagent_type="..." as a concrete agent name. execute-phase now uses subagent_type="{EXECUTOR_TYPE}" (a runtime placeholder resolved via resolve-agent, default gsd-executor). Skip {TOKEN} placeholders in both the known-type and <available_agent_types> checks; execute-phase still lists the built-in roster incl. gsd-executor. * fix(#1689): CI conformance for the routing fragment - per-plan-executor-routing.md: add the canonical runtime-launcher preamble to its gsd_run block (runtime-launcher-parity #373), matching sibling step fragments. - agent-install-check.cts: drop a literal ~/.claude/agents path from the resolveAgentHint JSDoc so it does not leak into the compiled engine .cjs (cline install leak guard). --------- Co-authored-by: sim <sim@local>
This commit is contained in:
@@ -106,6 +106,14 @@ describe('HOOK: hooks frontmatter pattern', () => {
|
||||
// ─── Spawn Type Consistency ──────────────────────────────────────────────────
|
||||
|
||||
describe('SPAWN: spawn type consistency', () => {
|
||||
// #1689: `subagent_type="{TOKEN}"` is a workflow-bound placeholder for
|
||||
// parameterized executor dispatch (resolved at runtime via `gsd-tools
|
||||
// resolve-agent`, defaulting to gsd-executor), not a concrete agent name.
|
||||
// The static spawn-type checks below skip these — the effective value is
|
||||
// validated at dispatch time, and execute-phase.md still documents the
|
||||
// built-in roster (incl. gsd-executor) in <available_agent_types>.
|
||||
const PARAMETERIZED_SPAWN_TYPE = /^\{[^}]+\}$/;
|
||||
|
||||
test('no "First, read agent .md" workaround pattern remains', () => {
|
||||
const dirs = [WORKFLOWS_DIR, COMMANDS_DIR];
|
||||
for (const dir of dirs) {
|
||||
@@ -137,6 +145,7 @@ describe('SPAWN: spawn type consistency', () => {
|
||||
const matches = content.matchAll(/subagent_type="([^"]+)"/g);
|
||||
for (const match of matches) {
|
||||
const agentType = match[1];
|
||||
if (PARAMETERIZED_SPAWN_TYPE.test(agentType)) continue;
|
||||
assert.ok(
|
||||
validAgentTypes.has(agentType),
|
||||
`${file} references unknown agent type: ${agentType}`
|
||||
@@ -168,11 +177,13 @@ describe('SPAWN: spawn type consistency', () => {
|
||||
const files = fs.readdirSync(dir).filter(f => f.endsWith('.md'));
|
||||
for (const file of files) {
|
||||
const content = fs.readFileSync(path.join(dir, file), 'utf-8');
|
||||
// Find all named subagent_type references (excluding general-purpose)
|
||||
// Find all named subagent_type references (excluding general-purpose
|
||||
// and #1689 runtime placeholders)
|
||||
const matches = [...content.matchAll(/subagent_type="([^"]+)"/g)];
|
||||
const namedAgents = matches
|
||||
.map(m => m[1])
|
||||
.filter(t => t !== 'general-purpose');
|
||||
.filter(t => t !== 'general-purpose')
|
||||
.filter(t => !PARAMETERIZED_SPAWN_TYPE.test(t));
|
||||
|
||||
if (namedAgents.length === 0) continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user