@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
33 lines • 1.98 kB
TypeScript
import { type Api, type AssistantMessageEventStream, type Context, type CredentialStore, type Model, type SimpleStreamOptions } from "@earendil-works/pi-ai";
import { type CursorAgentExecutableDeps } from "./executable.ts";
import { type CursorCliOauthConfig } from "./oauth-login.ts";
import { type CursorCliSessionRouter } from "./session-router.ts";
import { type CursorCliOauthProviderSettings } from "./settings.ts";
export { CURSOR_CLI_OAUTH_PROVIDER_ID } from "./oauth-login.ts";
/** Injectable seams so tests stay hermetic; every default is re-resolved per turn. */
export type CursorCliStreamDeps = {
readonly cwd?: string;
readonly agentDir?: string;
readonly store?: CredentialStore;
readonly settings?: CursorCliOauthProviderSettings;
readonly router?: CursorCliSessionRouter;
readonly oauth?: Pick<CursorCliOauthConfig, "refreshToken">;
readonly now?: () => number;
/** Credential-home log line sink; receives byte lengths only, never token material. */
readonly log?: (line: string) => void;
readonly executableDeps?: CursorAgentExecutableDeps;
};
/**
* The prompt for this turn: every user-role message after the last non-user message, in order.
* A turn can carry more than the request - hidden extension messages such as the first-turn plan
* reminder reach providers as user messages after it - and the CLI takes a single prompt, so
* sending only the last one dropped the request itself (senpi#2139).
*/
export declare function turnPrompt(context: Context): string;
/**
* Streams one Cursor CLI print-mode turn onto senpi's assistant event stream.
* The CLI owns tool execution; senpi owns the context and reports only its own
* token estimates, so no CLI-side number ever feeds compaction accounting.
*/
export declare function streamCursorCliOauth(model: Model<Api>, context: Context, options?: SimpleStreamOptions, deps?: CursorCliStreamDeps): AssistantMessageEventStream;
//# sourceMappingURL=stream.d.ts.map