Roo-Code/src/hooks/intentPreflightHook.ts
Yakob Dereje 3db3b0112a feat: implement deterministic hook system and intent-traceability ledger
- Added SelectActiveIntentTool for handshake protocol
- Implemented middleware gatekeeper in tool execution pipeline
- Integrated RecordAgentTraceTool for SHA-256 content hashing
- Created .orchestration/ artifacts for machine-readable audit trails
2026-02-21 23:00:24 +03:00

30 lines
724 B
TypeScript

import { INVALID_ACTIVE_INTENT_ERROR, loadIntentContext } from "../core/intent/IntentContextLoader"
import type { IntentHookContext, HookResult } from "./types"
export async function runIntentPreflightHook(context: IntentHookContext): Promise<HookResult> {
const activeIntentId = String(context.activeIntentId ?? "").trim()
if (!activeIntentId) {
return {
ok: false,
error: INVALID_ACTIVE_INTENT_ERROR,
}
}
try {
const intentContext = await loadIntentContext(context.workspaceRoot, activeIntentId)
if (!intentContext) {
return {
ok: false,
error: INVALID_ACTIVE_INTENT_ERROR,
}
}
return { ok: true }
} catch {
return {
ok: false,
error: INVALID_ACTIVE_INTENT_ERROR,
}
}
}