histoire
Version:
A fast story book powered by Vite
53 lines • 2.84 kB
TypeScript
import type { UiAiThread, UiAiThreadsSnapshot } from '@histoire/shared';
import type { ViteDevServer } from 'vite';
import type { PromptFile } from '../../acp/prompt-blocks.js';
import type { AcpPromptContext } from '../../acp/types.js';
import type { CommentAgentReply } from '../../comments/store.js';
import type { Context } from '../../context.js';
import type { UiChannelServer } from './types.js';
/** Narrow ACP bridge; the ACP manager satisfies it. */
export interface AiThreadsAgentBridge {
/** Start/reuse one configured agent session for one thread. */
prompt: (input: {
agentId: string;
threadId: string;
text: string;
context?: AcpPromptContext;
command?: boolean;
files?: PromptFile[];
options?: UiAiThread['options'];
}) => Promise<CommentAgentReply>;
/** Cancel this thread conversation during dev generation cleanup. */
cancel: (threadId: string) => void | Promise<void>;
/** Slash command names the agent announced; without it nothing counts as a command. */
commandNames?: (agentId: string) => string[];
}
/**
* Split snapshots without truncating threads or exceeding the shared 64 KB envelope.
* @param threads Persisted threads.
* @param enabled Feature availability.
* @param error Controlled failure notice.
* @param requestId Request owning the failure.
* @param pinsEnabled Canvas pins availability; follows `enabled` by default.
*/
export declare function aiThreadsSnapshotParts(threads: UiAiThread[], enabled: boolean, error?: string, requestId?: string, pinsEnabled?: boolean): UiAiThreadsSnapshot[];
/**
* Register development-only conversations persisted in `.histoire/threads.json`: free-form
* AI threads and pinned threads (canvas comments), with their file search and upload routes.
* @param ctx Dev context.
* @param channel UI channel.
* @param agents ACP bridge.
* @param isActive Generation ownership.
* @param server Vite dev server mounting the comments HTTP routes.
*/
export declare function registerAiThreadsChannel(ctx: Context, channel: UiChannelServer, agents?: AiThreadsAgentBridge, isActive?: () => boolean, server?: ViteDevServer): {
list: () => Promise<UiAiThread[]>;
recover(): Promise<void>;
upsert(value: import("../../ai-threads/validate.js").AiThreadDraftInput): Promise<void>;
remove(id: string): Promise<void>;
resolve(id: string, resolved: boolean): Promise<void>;
reply(id: string, body: string, attachments?: import("@histoire/shared").UiCommentAttachment[]): Promise<void>;
send(ids: readonly string[], agentId: string, runner: import("../../comments/store.js").CommentAgentRunner<UiAiThread>, sessionOptions?: import("@histoire/shared").UiCommentSessionOptions): Promise<void>;
close(): Promise<void>;
};
//# sourceMappingURL=ai-threads.d.ts.map