trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
56 lines • 2.22 kB
TypeScript
import type { EngineContext } from './engine-context.js';
import type { VcsOp } from './types.js';
/**
* Harness chat transcripts as first-class ops (vcs:chatMessage).
*
* Gated by `transcripts.enabled` in `.trellis/config.json` (default **false**):
* recording is opt-in. Transcript ops are **local-only by default** — they are
* excluded from peer sync (see LOCAL_ONLY_OP_KINDS in sync-policy.ts) unless a
* team explicitly opts into syncing. Privacy is the default; sync is the
* decision.
*/
export interface ChatMessageInput {
/** Stable message id (harness message id). */
messageId?: string;
/** Session this message belongs to (harness session id). */
sessionId: string;
/** Lane the session is bound to, if any. */
laneId?: string;
role: 'user' | 'assistant' | 'tool' | 'system';
text: string;
/** Tool name for `tool`-role messages. */
toolName?: string;
/** Token usage (input+output) for cost rollups. */
tokens?: number;
}
export interface TranscriptConfig {
/** Master switch. Default false. */
enabled: boolean;
/**
* Opt-in to peer sync of transcript ops. Default false — transcripts stay
* local to the desk unless a team explicitly enables sync.
*/
sync: boolean;
}
/** Read transcript config from `.trellis/config.json`. */
export declare function readTranscriptConfig(rootPath: string): TranscriptConfig;
/**
* Record one chat message as a vcs:chatMessage op.
*
* Returns null when transcripts are disabled (config-gated). The op is
* journaled like any other op; peer sync excludes it unless `transcripts.sync`
* is enabled (see sync-policy.ts LOCAL_ONLY_OP_KINDS).
*/
export declare function recordChatMessage(ctx: EngineContext, rootPath: string, input: ChatMessageInput): Promise<VcsOp | null>;
/** Query transcripts from the op log (all sessions, most recent first). */
export declare function listChatMessages(ops: readonly VcsOp[], opts?: {
sessionId?: string;
laneId?: string;
limit?: number;
}): Array<{
op: VcsOp;
sessionId: string;
laneId?: string;
}>;
export declare const transcriptsEnabled: (rootPath: string) => boolean;
//# sourceMappingURL=transcript.d.ts.map