@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
28 lines • 1.82 kB
TypeScript
import { type Agent, type AgentTool, type AgentToolCall, type AgentToolResult, type BeforeToolCallResult } from "@earendil-works/pi-agent-core";
type CursorBridgeAgent = Pick<Agent, "emitExternalEvent" | "signal" | "batchStoreFactory" | "executionScope" | "getExecutionScope" | "onExecutionPipeline">;
export interface CursorExecBridgeSession {
getRegisteredTool(name: string): AgentTool | undefined;
/** `execBridge` marks the call as issued by the model through the exec channel until it is released. */
preflightToolCall(toolCall: AgentToolCall, args: unknown, options?: {
execBridge?: boolean;
}): Promise<BeforeToolCallResult | undefined>;
/** The exec-frame call ended on any path; its preflight marked it model-issued with `execBridge`. */
releaseExecBridgeToolCall(toolCallId: string): void;
emitExecBridgeToolResult(toolName: string, toolCallId: string, args: unknown, result: AgentToolResult<unknown>, isError: boolean): Promise<void>;
}
/**
* Build the exec handlers for ONE Cursor run.
*
* `runSignal` is the signal of the run that owns this stream, captured when
* the loop opens it. Resolving ownership from the agent's live signal instead
* would let a straggler frame from a stream whose run already ended (a
* provider error or rate-limit fallback restarts the run while its h2 stream
* still holds buffered exec frames) adopt the replacement run's signal, clear
* the ownership guard in `Agent.emitExternalEvent`, and execute a dead run's
* tool inside the new run.
*/
export declare function createSessionCursorExecBridge(sessionRef: {
current?: CursorExecBridgeSession;
}, getAgent: () => CursorBridgeAgent, runSignal?: AbortSignal): import("@earendil-works/pi-ai").CursorExecHandlers;
export {};
//# sourceMappingURL=cursor-exec-bridge-session.d.ts.map