Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: d981de1229ef899957bbe968bc8dcda02a21f477
55 lines
1.9 KiB
TypeScript
55 lines
1.9 KiB
TypeScript
import { type Context, defineService } from "@earendil-works/chord";
|
|
|
|
export interface AgentPromptImage {
|
|
type: "image";
|
|
data: string;
|
|
mimeType: string;
|
|
}
|
|
|
|
export interface AgentPromptRequest {
|
|
message: string;
|
|
images: AgentPromptImage[] | null;
|
|
}
|
|
|
|
export interface AgentOperationError {
|
|
code: string;
|
|
message: string;
|
|
}
|
|
|
|
export type AgentOperationResponse =
|
|
| { accepted: true; operationId: string; error: AgentOperationError | null }
|
|
| { accepted: false; operationId: string | null; error: AgentOperationError };
|
|
|
|
export type AgentQueueResponse =
|
|
| { accepted: true; entryId: string; error: null }
|
|
| { accepted: false; entryId: null; error: AgentOperationError };
|
|
|
|
export interface AgentCompactionRequest {
|
|
customInstructions: string | null;
|
|
}
|
|
|
|
export interface AgentNavigationRequest {
|
|
targetId: string | null;
|
|
summarize: boolean;
|
|
label: string | null;
|
|
customInstructions: string | null;
|
|
}
|
|
|
|
/** Presentation-safe command facade over the worker-owned main AgentLane. */
|
|
export interface AgentController {
|
|
prompt(request: AgentPromptRequest, context: Context): Promise<AgentOperationResponse>;
|
|
requestAbort(operationId: string, context: Context): Promise<void>;
|
|
steer(request: AgentPromptRequest, context: Context): Promise<AgentQueueResponse>;
|
|
followUp(request: AgentPromptRequest, context: Context): Promise<AgentQueueResponse>;
|
|
nextRun(request: AgentPromptRequest, context: Context): Promise<AgentQueueResponse>;
|
|
cancelQueued(
|
|
entryId: string,
|
|
context: Context,
|
|
): Promise<{ outcome: "cancelled" | "already_consumed" | "not_found" }>;
|
|
resume(context: Context): Promise<AgentOperationResponse>;
|
|
compact(request: AgentCompactionRequest, context: Context): Promise<AgentOperationResponse>;
|
|
navigate(request: AgentNavigationRequest, context: Context): Promise<AgentOperationResponse>;
|
|
}
|
|
|
|
export const AgentController = defineService<AgentController>("pi.agent-controller");
|