T3 가 ProviderHolder 를 InferenceProvider 로 추상화. 단 IPC handler 가 holder.get().abort() 호출 예정 — interface 에 method 가 없으면 typecheck 실패. abort 는 in-flight generate 중단용이라 모든 provider 가 지원할 필요는 없음 → optional method 로 추가. caller 는 holder.get().abort?.() 패턴 사용. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
20 lines
710 B
TypeScript
20 lines
710 B
TypeScript
import type { AiResponse } from './schema.js';
|
|
import type { ParseResult } from '../services/dueDateParser.js';
|
|
|
|
export interface GenerateInput {
|
|
text: string;
|
|
todayKst: string; // ISO YYYY-MM-DD in KST
|
|
dueDateCandidates: ParseResult[];
|
|
vocab?: string[]; // v0.2.3 #3 — top-N kebab-case 태그. 미전달 시 빈 배열로 처리.
|
|
}
|
|
|
|
export interface HealthResult { ok: boolean; model?: string; reason?: string; }
|
|
|
|
export interface InferenceProvider {
|
|
readonly name: string;
|
|
generate(input: GenerateInput): Promise<AiResponse>;
|
|
healthCheck(): Promise<HealthResult>;
|
|
/** v0.2.3.1 — 외부에서 in-flight generate 강제 중단. ProviderHolder.replace 시 사용. */
|
|
abort?: () => void;
|
|
}
|