:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import type { ToolHooks } from '@/tools/tool-hooks'
import { withPostHogUrl } from '@/tools/tool-utils'
import type { Context } from '@/tools/types'
// The editor link only exists once the draft is saved, so a building or failed result gets none.
async function afterResponse(context: Context, _params: unknown, result: unknown): Promise<unknown> {
const workflowId = (result as { workflow_id?: string | null } | null)?.workflow_id
return workflowId ? await withPostHogUrl(context, result, `/workflows/${workflowId}/workflow`) : result
}
export default { afterResponse } satisfies ToolHooks<unknown>