Files
paseo/plugins/hoplite-provider/server/run-phase.ts
T
Mohamed BoudraandOdin Glynn-Martin 16bb179e67 feat(providers): add opt-in Hoplite and searchable provider grid (#6953)
Preserve the bundled Hoplite ACP adapter and provisioning transformer, activate it only after Add, and provide a searchable provider grid. Restore the contributor's original icon without the copyright mark.

Co-authored-by: Odin Glynn-Martin <odin.glynn@icloud.com>
2026-10-15 21:25:23 +07:00

40 lines
1.2 KiB
TypeScript

import type { AcpTransformer } from "@getpaseo/plugin/server/acp";
import { z } from "zod";
// Hoplite provisions a cloud workspace before the first agent output of a run and reports each
// step as `_hoplite/run_phase`. A null phase ends provisioning for that run.
const runPhaseSchema = z.object({
runId: z.string().min(1),
phase: z.string().nullable(),
label: z.string().nullable(),
});
const RUN_PHASE_METHOD = "_hoplite/run_phase";
export const runPhaseTransformer: AcpTransformer = {
notification(notification) {
if (notification.method !== RUN_PHASE_METHOD) return null;
const params = runPhaseSchema.safeParse(notification.params);
if (!params.success) return null;
const { runId, phase, label } = params.data;
const id = `hoplite-run-phase:${runId}`;
const running = phase !== null;
return {
type: "timeline",
item: {
type: "tool_call",
id,
callId: id,
name: "Hoplite workspace",
detail: {
type: "plain_text",
label: running ? (label ?? phase) : "Workspace ready",
icon: "wrench",
},
status: running ? "running" : "completed",
error: null,
},
};
},
};