Skip to content

: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.

610 B
Raw Blame
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>