fix(coding): preserve runtime model and failure contracts

This commit is contained in:
2026-08-23 21:21:02 +08:00
parent 52b2467d5d
commit 195979d30f
11 changed files with 427 additions and 112 deletions

View File

@@ -2,8 +2,6 @@ import type {
CodingConversationRuntime,
CodingRuntimeCommand,
CodingRuntimeDiagnostics,
CodingRuntimeErrorCode,
CodingRuntimePublicError,
ConversationModelState,
ConversationInteraction,
ConversationInteractionResponse,
@@ -22,22 +20,14 @@ import type {
SetConversationModelInput,
SetThinkingLevelInput,
} from './contracts';
import { CodingRuntimeContractError } from './runtime-errors';
export { CodingRuntimeContractError } from './runtime-errors';
import {
createConversationReducerState,
reduceConversationPatch,
type ConversationReducerState,
} from './conversation-reducer';
export class CodingRuntimeContractError extends Error {
readonly publicError: CodingRuntimePublicError;
constructor(code: CodingRuntimeErrorCode, message: string, recoverable: boolean) {
super(message);
this.name = 'CodingRuntimeContractError';
this.publicError = { code, message, recoverable };
}
}
export interface InMemoryConversationRuntimeOptions {
snapshots?: ConversationSnapshot[];
commands?: CodingRuntimeCommand[];