feat(#1135): migrate planning hooks to capabilities (#1141)

* feat(#1135): migrate planning hooks to capabilities

* chore(#1135): add phase 6 planning capabilities changeset

* fix(#1135): satisfy lint for agent hook rendering
This commit is contained in:
Tom Boucher
2026-06-12 19:51:54 -04:00
committed by GitHub
parent fd01e7a12e
commit 4ab5c7b3f2
20 changed files with 1025 additions and 176 deletions

View File

@@ -223,6 +223,7 @@ function _resolveActivationValue(
interface HookRef {
skill?: string;
agent?: string;
[key: string]: unknown;
}
@@ -347,11 +348,13 @@ function resolveLoopHooks(input: ResolveLoopHooksInput): ResolveLoopHooksResult
? (hook['ref'] as HookRef)
: undefined;
const when = typeof hook['when'] === 'string' ? hook['when'] : undefined;
const fragment = toFragment(hook['fragment']);
const produces = toStringArray(hook['produces']);
const consumes = toStringArray(hook['consumes']);
const onError = typeof hook['onError'] === 'string' ? hook['onError'] : undefined;
const active: ActiveHook = { capId, kind: 'step' };
if (ref !== undefined) active.ref = ref;
if (fragment !== undefined) active.fragment = fragment;
if (when !== undefined) active.when = when;
if (produces.length > 0) active.produces = produces;
if (consumes.length > 0) active.consumes = consumes;
@@ -429,7 +432,9 @@ function renderLoopHooks(resolved: ResolveLoopHooksResult): string {
stepOrdinal += 1;
const refStr = hook.ref?.skill
? `skill:${hook.ref.skill}`
: JSON.stringify(hook.ref ?? {});
: hook.ref?.agent
? `agent:${hook.ref.agent}`
: JSON.stringify(hook.ref ?? {});
lines.push(`### Step ${stepOrdinal}: ${refStr} (${hook.capId})`);
if (hook.produces && hook.produces.length > 0) {
lines.push(`- produces: ${hook.produces.join(', ')}`);
@@ -443,6 +448,13 @@ function renderLoopHooks(resolved: ResolveLoopHooksResult): string {
if (hook.onError) {
lines.push(`- onError: ${hook.onError}`);
}
if (hook.fragment?.inline) {
lines.push('');
lines.push(hook.fragment.inline);
} else if (hook.fragment?.path) {
lines.push('');
lines.push(`_Step fragment path is declared but not rendered by loop-resolver: ${hook.fragment.path}_`);
}
lines.push('');
} else if (hook.kind === 'contribution') {
lines.push(`<contribution from="${hook.capId}" into="${hook.into ?? '(unset)'}">`);