- Fix #1991 crash: optional chaining for task-history sessionID access - Fix #1992 think-mode: add antigravity entries to HIGH_VARIANT_MAP - Fix #1949 Copilot premium misattribution: use createInternalAgentTextPart - Fix #1982 load_skills: pass directory to discoverSkills for project-level skills - Fix command priority: sort scopePriority before .find(), project-first return - Fix Google provider transform: apply in userFallbackModels path - Fix ralph-loop TUI: optional chaining for event handler - Fix runtime-fallback: unify dual fallback engines, remove HTTP 400 from retry, fix pendingFallbackModel stuck state, add priority gate to skip model-fallback when runtime-fallback is active - Fix Prometheus task system: exempt from todowrite/todoread deny - Fix background_output: default full_session to true - Remove orphan hooks: hashline-edit-diff-enhancer (redundant with hashline_edit built-in diff), task-reminder (dead code) - Remove orphan config entries: 3 stale hook names from Zod schema - Fix disabled_hooks schema: accept arbitrary strings for forward compatibility - Register json-error-recovery hook in tool-guard pipeline - Add disabled_hooks gating for question-label-truncator, task-resume-info, claude-code-hooks - Update test expectations to match new behavior
50 lines
2.2 KiB
TypeScript
50 lines
2.2 KiB
TypeScript
import { consumeToolMetadata } from "../features/tool-metadata-store"
|
|
import type { CreatedHooks } from "../create-hooks"
|
|
|
|
export function createToolExecuteAfterHandler(args: {
|
|
hooks: CreatedHooks
|
|
}): (
|
|
input: { tool: string; sessionID: string; callID: string },
|
|
output:
|
|
| { title: string; output: string; metadata: Record<string, unknown> }
|
|
| undefined,
|
|
) => Promise<void> {
|
|
const { hooks } = args
|
|
|
|
return async (
|
|
input: { tool: string; sessionID: string; callID: string },
|
|
output: { title: string; output: string; metadata: Record<string, unknown> } | undefined,
|
|
): Promise<void> => {
|
|
if (!output) return
|
|
|
|
const stored = consumeToolMetadata(input.sessionID, input.callID)
|
|
if (stored) {
|
|
if (stored.title) {
|
|
output.title = stored.title
|
|
}
|
|
if (stored.metadata) {
|
|
output.metadata = { ...output.metadata, ...stored.metadata }
|
|
}
|
|
}
|
|
|
|
await hooks.claudeCodeHooks?.["tool.execute.after"]?.(input, output)
|
|
await hooks.toolOutputTruncator?.["tool.execute.after"]?.(input, output)
|
|
await hooks.preemptiveCompaction?.["tool.execute.after"]?.(input, output)
|
|
await hooks.contextWindowMonitor?.["tool.execute.after"]?.(input, output)
|
|
await hooks.commentChecker?.["tool.execute.after"]?.(input, output)
|
|
await hooks.directoryAgentsInjector?.["tool.execute.after"]?.(input, output)
|
|
await hooks.directoryReadmeInjector?.["tool.execute.after"]?.(input, output)
|
|
await hooks.rulesInjector?.["tool.execute.after"]?.(input, output)
|
|
await hooks.emptyTaskResponseDetector?.["tool.execute.after"]?.(input, output)
|
|
await hooks.agentUsageReminder?.["tool.execute.after"]?.(input, output)
|
|
await hooks.categorySkillReminder?.["tool.execute.after"]?.(input, output)
|
|
await hooks.interactiveBashSession?.["tool.execute.after"]?.(input, output)
|
|
await hooks.editErrorRecovery?.["tool.execute.after"]?.(input, output)
|
|
await hooks.delegateTaskRetry?.["tool.execute.after"]?.(input, output)
|
|
await hooks.atlasHook?.["tool.execute.after"]?.(input, output)
|
|
await hooks.taskResumeInfo?.["tool.execute.after"]?.(input, output)
|
|
await hooks.hashlineReadEnhancer?.["tool.execute.after"]?.(input, output)
|
|
await hooks.jsonErrorRecovery?.["tool.execute.after"]?.(input, output)
|
|
}
|
|
}
|