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.

733 B
Raw Blame
import type {
  PiResumeInput,
  PiRunInput,
  PiRunner,
} from "@posthog/core/pi-runtime/piRunner";
import {
  HOST_TRPC_CLIENT,
  type HostTrpcClient,
} from "@posthog/host-router/client";
import { inject, injectable } from "inversify";

@injectable()
export class TrpcPiRunner implements PiRunner {
  constructor(
    @inject(HOST_TRPC_CLIENT) private readonly hostClient: HostTrpcClient,
  ) {}

  async create(input: PiRunInput): Promise<void> {
    await this.hostClient.piSession.start.mutate(input);
  }

  resume(input: PiResumeInput): Promise<void> {
    return this.hostClient.piSession.resume.mutate(input);
  }

  stop(taskId: string): Promise<void> {
    return this.hostClient.piSession.stop.mutate({ taskId });
  }
}