UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

59 lines • 2.64 kB
import { type MediaPersister, type PersistedMedia } from "./media-placeholders.ts"; /** * Where a session keeps the images its tools produced. * * A `media_placeholders` client never receives the bytes on the socket. The host writes them * here, once, BEFORE the placeholder that names the file is emitted, so a client can render the * picture from the path whenever it likes: after a disconnect, an idle shutdown or a generation * handover, because the files outlive every connection. The directory sits next to the session * files, never under the user's project, and is removed with the durable session. */ export interface ToolMediaScope { readonly sessionDir: string; readonly durableSessionId: string; } export declare const MAX_TOOL_IMAGE_BYTES: number; export declare const MAX_SESSION_MEDIA_BYTES: number; export interface ToolMediaLimits { readonly perImage: number; readonly perSession: number; } export interface LiveSessionSource { readonly runtime?: { readonly session: { readonly sessionManager: { getSessionFile(): string | undefined; getSessionId(): string; }; }; }; readonly worker?: { readonly snapshot?: { readonly state: { readonly sessionFile?: string; readonly sessionId: string; }; }; }; } export declare function liveToolMediaScope(entry: LiveSessionSource): ToolMediaScope | undefined; export declare function toolMediaRoot(scope: ToolMediaScope): string; /** * Persist one tool-result image and report where it lives, or why it does not. * * Layout: `<sessionDir>/media/<durableSessionId>/<sha256(toolCallId)>/<contentIndex>-<sha256(bytes)>.<ext>`. * The content hash makes a file immutable and a repeat a no-op; the per-image and per-session * limits reject new storage and never evict a file a transcript may still reference. */ export declare function persistToolImage(scope: ToolMediaScope, ref: { readonly toolCallId: string; readonly contentIndex: number; }, block: { readonly data: string; readonly mimeType?: string; }, limits?: ToolMediaLimits): PersistedMedia; export declare function toolMediaPersister(scope: () => ToolMediaScope | undefined): MediaPersister; export declare function removeToolMedia(scope: ToolMediaScope): void; /** The media scope of the session stored in `sessionFile`; a file with no readable header has none. */ export declare function toolMediaScopeOfSessionFile(sessionFile: string): Promise<ToolMediaScope | undefined>; //# sourceMappingURL=tool-media-store.d.ts.map