Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x 23x | /**
* ブランド型を生成するためのヘルパー型。
* T_BASE はベースとなる型(例: string)。
* T_BRAND はブランド名(ユニークな文字列リテラル)。
*/
export type Brand<T_BASE, T_BRAND> = T_BASE & { readonly __brand: T_BRAND };
/**
* 指し手を表すブランド型。
* 各ゲームアダプターで `Move<"GameMove">` のように拡張可能です。
* デフォルトでは全てのブランド化された指し手と互換性があります。
*/
export type Move<T extends string = string> = Brand<string, T>;
/**
* 局面表記を表すブランド型(FEN またはアダプター定義の独自形式)。
*/
export type PositionString<T extends string = string> = Brand<string, T>;
/**
* 正規化された評価値を表すブランド型。
* -1.0 (負け確) 〜 1.0 (勝ち確) の範囲。
*/
export type NormalizedScore = Brand<number, "NormalizedScore">;
/**
* 局面を一意に識別するためのブランド型。
* レースコンディション(古い解析結果の表示)を防ぐために使用される。
*/
export type PositionId = Brand<string, "PositionId">;
// 2026 Best Practice: Brand type factories are consolidated in ProtocolValidator.ts for security.
/**
* ライセンス情報。
*/
export interface ILicenseInfo {
name: string;
url?: string | undefined;
text?: string | undefined;
}
/**
* エンジンの状態。
*/
export type EngineStatus =
| "uninitialized"
| "awaiting-consent"
| "loading"
| "ready"
| "busy"
| "error"
| "disposed"
| "terminated";
/**
* 探索オプション。
*/
export interface IBaseSearchOptions {
/** 局面の ID (レースコンディション防止用) */
positionId?: PositionId | undefined;
fen?: PositionString | undefined;
signal?: AbortSignal | undefined;
[key: string]: unknown;
}
/**
* 構造化されたスコア情報。
* 各種ゲームエンジンが返却する評価値を、プロトコルの詳細(マジックナンバー等)から隔離して保持する。
*/
export interface IScoreInfo {
/** 評価値(センチポーン。主にチェス・将棋で使用) */
cp?: number | undefined;
/** 詰みまでの手数(主にチェス・将棋で使用) */
mate?: number | undefined;
/** 得点差(囲碁のコミ後点数、オセロの石数差など) */
points?: number | undefined;
/** 勝率 (0.0 - 1.0)。確率論的な評価を行うエンジンで使用。 */
winrate?: number | undefined;
/**
* 2026 Zenith Standard: 正規化された評価値 (-1.0 to 1.0)。
* UI での一貫した表示(評価バー等)に使用される。
*/
normalized?: NormalizedScore | undefined;
/** 元の評価値の単位 */
unit?: "cp" | "mate" | "points" | "winrate" | string | undefined;
}
/**
* 探索状況情報。
*/
export interface IBaseSearchInfo {
/**
* この情報の対象となる局面の ID。
* 古い局面に対する解析結果を無視するために使用。
*/
positionId?: PositionId | undefined;
/** 探索深度 (プライまたは手数) */
depth?: number | undefined;
/** 選択的探索深度 (Selective Depth) */
seldepth?: number | undefined;
/** 探索したノード数 */
nodes?: number | undefined;
/** 探索速度 (Nodes Per Second) */
nps?: number | undefined;
/** 探索時間 (ミリ秒) */
time?: number | undefined;
/** 読み筋 (Principal Variation)。Branded Move の配列。 */
pv?: Move[] | undefined;
/** MultiPV の順位 (1, 2, ...) */
multipv?: number | undefined;
/** 思考の複雑さ・規模を示す追加指標(囲碁の visits など) */
visits?: number | undefined;
/** ハッシュテーブルの使用率 (0 - 1000) */
hashfull?: number | undefined;
/** 構造化スコア。cp, mate, points, winrate を統合して保持する。 */
score?: IScoreInfo | undefined;
/** ハードウェアアクセラレーションの使用状況 */
acceleration?: "none" | "simd" | "webgpu" | "webnn" | undefined;
/** デバイスメモリ使用量 (bytes) */
memoryUsage?: number | undefined;
[key: string]: unknown;
}
/**
* 探索結果。
*/
export interface IBaseSearchResult {
bestMove: Move | null;
ponder?: Move | null | undefined;
[key: string]: unknown;
}
/**
* ロード進捗状況。
* UI および CLI での進捗表示、中断制御に使用される。
*/
export interface ILoadProgress {
/**
* 現在のフェーズ。
* 'connecting' (接続中), 'downloading' (ダウンロード中),
* 'verifying' (SRI検証中), 'completed' (完了), 'aborted' (中断)
*/
status:
| "connecting"
| "downloading"
| "verifying"
| "completed"
| "aborted"
| string;
/** フェーズの説明 (i18n キー) */
i18nKey?: I18nKey | undefined;
/** 既にロードされたバイト数 */
loadedBytes: number;
/** 合計バイト数 (不明な場合は undefined) */
totalBytes?: number | undefined;
/** 進捗パーセンテージ (0 - 100) */
percentage?: number | undefined;
/** リソースの識別子 (URL 等) */
resource?: string | undefined;
}
/**
* 進捗状況の通知を受け取るためのコールバック。
*/
export type ProgressCallback = (progress: ILoadProgress) => void;
/**
* 能力検出。
*/
export interface ICapabilities {
wasmThreads: boolean;
wasmSimd: boolean;
webNN?: boolean | undefined;
webGPU?: boolean | undefined;
webTransport?: boolean | undefined;
threads?: boolean | undefined;
simd?: boolean | undefined;
opfs?: boolean | undefined;
/** ハードウェアアクセラレーションの使用状況 */
acceleration?: "none" | "simd" | "webgpu" | "webnn" | undefined;
}
/**
* セキュリティ状態。
*/
export interface ISecurityStatus {
sriEnabled: boolean;
coopCoepEnabled: boolean;
sriSupported: boolean;
canUseThreads: boolean;
isCrossOriginIsolated: boolean;
missingHeaders?: string[] | undefined;
}
/**
* エラー関連。
*/
export enum EngineErrorCode {
TIMEOUT = "TIMEOUT",
NETWORK_ERROR = "NETWORK_ERROR",
VALIDATION_ERROR = "VALIDATION_ERROR",
INTERNAL_ERROR = "INTERNAL_ERROR",
CANCELLED = "CANCELLED",
SECURITY_ERROR = "SECURITY_ERROR",
SRI_MISMATCH = "SRI_MISMATCH",
PROTOCOL_ERROR = "PROTOCOL_ERROR",
NOT_READY = "NOT_READY",
SEARCH_ABORTED = "SEARCH_ABORTED",
SEARCH_TIMEOUT = "SEARCH_TIMEOUT",
LIFECYCLE_ERROR = "LIFECYCLE_ERROR",
UNKNOWN_ERROR = "UNKNOWN_ERROR",
}
export interface IEngineError {
message: string;
code: EngineErrorCode;
remediation?: string | undefined;
engineId?: string | undefined;
/** 国際化対応のためのメッセージキー(Branded Type) */
i18nKey?: I18nKey | undefined;
/** メッセージの埋め込みパラメータ */
i18nParams?: Record<string, string | number> | undefined;
/** 元のエラー(原因となった例外) */
originalError?: unknown | undefined;
}
/**
* 国際化対応のための翻訳キーを表すブランド型。
* 実装(\@multi-game-engines/i18n)によって具体的な文字列リテラルの型が提供される。
*/
export type I18nKey = Brand<string, "I18nKey">;
/**
* テレメトリ関連。
*/
export interface ITelemetryEvent {
type: string;
timestamp: number;
duration?: number;
metadata: Record<string, unknown>;
}
export type EngineTelemetry = ITelemetryEvent;
/**
* ミドルウェア関連。
*/
export interface MiddlewareContext<T_OPTIONS = IBaseSearchOptions> {
engineId: string;
telemetryId?: string;
options?: T_OPTIONS;
emitTelemetry?: (telemetry: EngineTelemetry) => void;
}
export type IMiddlewareContext<T_OPTIONS = IBaseSearchOptions> =
MiddlewareContext<T_OPTIONS>;
export enum MiddlewarePriority {
LOW = -100,
NORMAL = 0,
HIGH = 100,
CRITICAL = 1000,
}
export type MiddlewareCommand =
| string
| string[]
| Record<string, unknown>
| Uint8Array;
export interface IMiddleware<
T_OPTIONS = IBaseSearchOptions,
T_INFO = unknown,
T_RESULT = IBaseSearchResult,
> {
id?: string;
priority?: number;
supportedEngines?: string[];
/**
* 探索開始時に呼び出されます。
* @param options - 探索オプション
* @param context - コンテキスト情報
* @returns 変更されたオプション、または undefined (変更なし)
*/
onSearch?(
options: T_OPTIONS,
context: MiddlewareContext<T_OPTIONS>,
): Promise<T_OPTIONS | undefined | void> | T_OPTIONS | undefined | void;
/**
* エンジンへのコマンド送信前に呼び出されます。
* @param command - 送信されるコマンド
* @param context - コンテキスト情報
* @returns 変更されたコマンド、または undefined (変更なし)
*/
onCommand?(
command: MiddlewareCommand,
context: MiddlewareContext<T_OPTIONS>,
):
| Promise<MiddlewareCommand | undefined | void>
| MiddlewareCommand
| undefined
| void;
/**
* エンジンからの情報受信時に呼び出されます。
* @param info - 受信した情報
* @param context - コンテキスト情報
* @returns 変更された情報、または undefined (変更なし)
*/
onInfo?(
info: T_INFO,
context: MiddlewareContext<T_OPTIONS>,
): Promise<T_INFO | undefined | void> | T_INFO | undefined | void;
/**
* 探索結果の受信時に呼び出されます。
* @param result - 受信した結果
* @param context - コンテキスト情報
* @returns 変更された結果、または undefined (変更なし)
*/
onResult?(
result: T_RESULT,
context: MiddlewareContext<T_OPTIONS>,
): Promise<T_RESULT | undefined | void> | T_RESULT | undefined | void;
/**
* エンジンのステータス変更時に呼び出されます。
*/
onStatusChange?(
status: EngineStatus,
context: MiddlewareContext<T_OPTIONS>,
): Promise<void> | void;
/**
* テレメトリイベントの発生時に呼び出されます。
*/
onTelemetry?(
telemetry: EngineTelemetry,
context: MiddlewareContext<T_OPTIONS>,
): void;
}
/**
* 探索タスク。
* 非同期イテレータによる途中経過の取得と、Promise による最終結果の取得を両立します。
*/
export interface ISearchTask<T_INFO, T_RESULT> {
/** 途中経過をストリームとして取得するための非同期イテレータ */
info: AsyncIterable<T_INFO>;
/** 最終結果が確定した時点で解決される Promise */
result: Promise<T_RESULT>;
/** 探索を強制的に中断します */
stop(): void;
}
/**
* プロトコルパーサー。
*/
export interface IProtocolParser<
T_OPTIONS extends IBaseSearchOptions = IBaseSearchOptions,
T_INFO = unknown,
T_RESULT extends IBaseSearchResult = IBaseSearchResult,
> {
createSearchCommand(options: T_OPTIONS): MiddlewareCommand;
createStopCommand(): MiddlewareCommand;
createOptionCommand(name: string, value: unknown): MiddlewareCommand;
/**
* info 行を解析します。
* @param line - エンジンからの出力
* @param positionId - 現在の局面 ID (オプション)
*/
parseInfo(
line: string | Record<string, unknown>,
positionId?: PositionId,
): T_INFO | null;
parseResult(line: string | Record<string, unknown>): T_RESULT | null;
/**
* エンジンが出力する独自のエラーメッセージを i18n キーに変換します。
* @param message - エンジンからのエラー文字列
*/
translateError?(message: string): I18nKey | null;
}
/**
* エンジン・アダプター。
*/
export interface IEngineAdapter<
T_OPTIONS extends IBaseSearchOptions = IBaseSearchOptions,
T_INFO = unknown,
T_RESULT extends IBaseSearchResult = IBaseSearchResult,
> {
readonly id: string;
readonly name: string;
readonly version: string;
readonly status: EngineStatus;
readonly engineLicense: ILicenseInfo;
readonly adapterLicense: ILicenseInfo;
readonly parser: IProtocolParser<T_OPTIONS, T_INFO, T_RESULT>;
readonly requiredCapabilities?: Partial<ICapabilities>;
load(loader?: IEngineLoader): Promise<void>;
updateStatus(status: EngineStatus): void;
search(options: T_OPTIONS): Promise<T_RESULT>;
searchRaw(command: MiddlewareCommand): ISearchTask<T_INFO, T_RESULT>;
stop(): void | Promise<void>;
dispose(): Promise<void>;
/** 定跡書を設定します。 */
setBook(
asset: IBookAsset,
options?: { signal?: AbortSignal; onProgress?: ProgressCallback },
): Promise<void>;
/** エンジンオプションを設定します。 */
setOption(name: string, value: string | number | boolean): Promise<void>;
onInfo?(callback: (info: T_INFO) => void): () => void;
onSearchResult(callback: (result: T_RESULT) => void): () => void;
onStatusChange(callback: (status: EngineStatus) => void): () => void;
onProgress(callback: (progress: ILoadProgress) => void): () => void;
onTelemetry(callback: (telemetry: EngineTelemetry) => void): () => void;
emitTelemetry(telemetry: EngineTelemetry): void;
}
/**
* 利用者向け engine インターフェース。
*/
export interface IEngine<
T_OPTIONS extends IBaseSearchOptions = IBaseSearchOptions,
T_INFO = unknown,
T_RESULT extends IBaseSearchResult = IBaseSearchResult,
> {
readonly id: string;
readonly name: string;
readonly version: string;
readonly status: EngineStatus;
readonly lastError: IEngineError | null;
readonly config?: IEngineConfig | undefined;
loadingStrategy?: EngineLoadingStrategy;
use(middleware: IMiddleware<T_OPTIONS, T_INFO, T_RESULT>): this;
unuse(middleware: IMiddleware<T_OPTIONS, T_INFO, T_RESULT> | string): this;
load(): Promise<void>;
/** ユーザーのライセンス同意を通知し、ロードを続行します。 */
consent(): void;
/** 定跡書を設定します。 */
setBook(
asset: IBookAsset,
options?: { signal?: AbortSignal; onProgress?: ProgressCallback },
): Promise<void>;
search(options: T_OPTIONS): Promise<T_RESULT>;
stop(): void;
dispose(): Promise<void>;
onInfo(callback: (info: T_INFO) => void): () => void;
onSearchResult(callback: (result: T_RESULT) => void): () => void;
onStatusChange(callback: (status: EngineStatus) => void): () => void;
onTelemetry(callback: (telemetry: EngineTelemetry) => void): () => void;
emitTelemetry(telemetry: EngineTelemetry): void;
}
/**
* ロード戦略。
*/
export type EngineLoadingStrategy = "manual" | "on-demand" | "eager";
/**
* ストレージ関連。
* Web (OPFS/IDB) および Node.js (fs) の抽象化。
*/
export interface IFileStorage {
/** データの取得 */
get(key: string): Promise<ArrayBuffer | null>;
/** データの保存 */
set(key: string, data: ArrayBuffer): Promise<void>;
/** データの削除 */
delete(key: string): Promise<void>;
/** キーの存在確認 */
has?(key: string): Promise<boolean>;
/** 全データの消去 */
clear(): Promise<void>;
/**
* 現在の使用量と空き容量 (bytes) を取得します。
* ブラウザの StorageManager API や Node.js の statvfs を使用。
*/
getQuota?(): Promise<{ usage: number; quota: number }>;
/**
* 物理ファイルとしての絶対パスを取得します。
* 主に CLI/Native 環境で使用されます(WASM への注入等)。
*/
getPhysicalPath?(key: string): Promise<string | null>;
}
/**
* エンジン・ソースのタイプ。
*/
export type IEngineSourceType =
| "wasm"
| "worker-js"
| "eval-data"
| "native"
| "webgpu-compute"
| "json"
| "text"
| "asset";
/**
* 分割された SRI ハッシュ。
* 巨大なファイルのインクリメンタル検証に使用される。
*/
export interface ISegmentedSRI {
/** 各セグメント(チャンク)のサイズ (bytes) */
segmentSize: number;
/** 各セグメントの SRI ハッシュ配列 */
hashes: string[];
}
/**
* エンジン・ソース設定。
*/
export type IEngineSourceConfig = {
url: string;
type: IEngineSourceType | string;
size?: number;
/**
* 仮想的なマウントパス(例: "/nnue/default.nnue")。
* Blob URL 環境下での相対パス解決に使用される。
*/
mountPath?: string;
/** 分割された SRI ハッシュ (100MB 超の巨大ファイル用) */
segmentedSri?: ISegmentedSRI | undefined;
} & (
| { sri: string; __unsafeNoSRI?: never }
| { sri?: never; __unsafeNoSRI: true }
);
/**
* 2026 Zenith Tier: 動的エンジン構成定義。
* 特定のアダプター実装と、その実行に必要なリソースをパッケージ化します。
*/
export interface IEngineConfig {
/** インスタンスの一意識別子 */
id?: string;
/** 使用するプロトコル/アダプター型(例: 'uci', 'usi', 'gtp') */
adapter?: string;
/** 表示名 */
name?: string;
/** バージョン情報 */
version?: string;
/** 実行リソースの定義 */
sources?:
| {
/** メインのJSローダー/エントリーポイント */
main: IEngineSourceConfig;
/** WASM バイナリ(オプション) */
wasm?: IEngineSourceConfig | undefined;
/** ニューラルネットワークの重みファイル等(オプション) */
eval?: IEngineSourceConfig | undefined;
/** 特定の環境向けバリアント定義 (simd, threads 等) */
variants?:
| Record<string, Partial<IEngineConfig["sources"]>>
| undefined;
/** 追加の任意リソース */
[key: string]:
| IEngineSourceConfig
| Record<string, unknown>
| undefined;
}
| undefined;
/** ライセンス情報 URL */
licenseUrl?: string | undefined;
/** ユーザーへの免責事項・同意テキスト */
disclaimer?: string | undefined;
/** エンジン起動時のデフォルトオプション */
options?: Record<string, unknown> | undefined;
/** 必須とされる環境能力 */
requiredCapabilities?: Partial<ICapabilities> | undefined;
}
/**
* リソースマップ。
* 仮想マウントパス(キー)と Blob URL(値)の対応を保持します。
*/
export type ResourceMap = Record<string, string>;
/**
* エンジンローダー。
*/
export interface IEngineLoader {
/**
* 単一のリソースをロードします。
* AbortSignal による中断と ProgressCallback による進捗監視をサポート。
*/
loadResource(
engineId: string,
config: IEngineSourceConfig,
options?: { signal?: AbortSignal; onProgress?: ProgressCallback },
): Promise<string>;
/** 複数リソースを一括ロードします(アトミック性保証)。 */
loadResources(
engineId: string,
configs: Record<string, IEngineSourceConfig>,
options?: { signal?: AbortSignal; onProgress?: ProgressCallback },
): Promise<Record<string, string>>;
revoke(url: string): void;
revokeAll(): void;
revokeByEngineId(engineId: string): void;
}
/**
* エンジンメタデータレジストリ。
*/
export interface IEngineRegistry {
/**
* 指定されたエンジンIDとバージョンのリソース設定を解決します。
* 見つからない場合は null を返します。
*/
resolve(id: string, version?: string): IEngineConfig["sources"] | null;
/**
* このレジストリがサポートしているエンジン ID の一覧を取得します。
*/
getSupportedEngines(): string[];
}
/**
* 定跡書・データベースアセットの情報。
*/
export type IBookAsset = {
id: string;
url: string;
size?: number | undefined;
type: "bin" | "db" | "json";
} & (
| { sri: string; __unsafeNoSRI?: never }
| { sri?: never; __unsafeNoSRI: true }
);
/**
* 定跡書プロバイダー。
* 巨大な定跡ファイルを管理・共有するためのインターフェース。
*/
export interface IBookProvider {
/** 指定された定跡をロードし、物理パスまたは Blob URL を返します。 */
loadBook(
asset: IBookAsset,
options?: { signal?: AbortSignal; onProgress?: ProgressCallback },
): Promise<string>;
/** キャッシュされた定跡の一覧を取得します。 */
listCachedBooks(): Promise<string[]>;
/** キャッシュを削除します。 */
deleteBook(id: string): Promise<void>;
}
/**
* エンジン・ブリッジの設定オプション。
*/
export interface IEngineBridgeOptions {
/**
* カスタムストレージ。
* 指定された場合、環境自動検知をスキップしてこのインスタンスを使用します。
*/
storage?: IFileStorage | undefined;
/**
* カスタム定跡プロバイダー。
*/
bookProvider?: IBookProvider | undefined;
/**
* 強制的に設定する能力(デバッグまたは特殊環境用)。
*/
capabilities?: Partial<ICapabilities> | undefined;
}
/**
* エンジン・ブリッジ。
*/
export interface IEngineBridge {
/**
* 登録済みの ID または動的な設定オブジェクトからエンジンを取得します。
*/
getEngine<K extends keyof EngineRegistry>(
id: K,
strategy?: EngineLoadingStrategy,
): Promise<EngineRegistry[K]>;
getEngine<
O extends IBaseSearchOptions = IBaseSearchOptions,
I extends IBaseSearchInfo = IBaseSearchInfo,
R extends IBaseSearchResult = IBaseSearchResult,
>(
config: IEngineConfig,
strategy?: EngineLoadingStrategy,
): Promise<IEngine<O, I, R>>;
getEngine<
O extends IBaseSearchOptions = IBaseSearchOptions,
I extends IBaseSearchInfo = IBaseSearchInfo,
R extends IBaseSearchResult = IBaseSearchResult,
>(
idOrConfig: string | IEngineConfig,
strategy?: EngineLoadingStrategy,
): Promise<IEngine<O, I, R>>;
/**
* アダプターインスタンスを明示的に登録します。
*/
registerAdapter(
adapter: IEngineAdapter<
IBaseSearchOptions,
IBaseSearchInfo,
IBaseSearchResult
>,
): Promise<void>;
registerAdapterFactory(
type: string,
factory: (
config: IEngineConfig,
) =>
| IEngineAdapter<IBaseSearchOptions, IBaseSearchInfo, IBaseSearchResult>
| Promise<
IEngineAdapter<IBaseSearchOptions, IBaseSearchInfo, IBaseSearchResult>
>,
): void;
/**
* メタデータ解決のためのレジストリを追加します。
* 後から追加されたレジストリが優先的に検索されます。
*/
addRegistry(registry: IEngineRegistry): void;
unregisterAdapter(id: string): Promise<void>;
onGlobalStatusChange(
callback: (id: string, status: EngineStatus) => void,
): () => void;
onGlobalProgress(
callback: (id: string, progress: ILoadProgress) => void,
): () => void;
onGlobalTelemetry(
callback: (id: string, event: ITelemetryEvent) => void,
): () => void;
dispose(): Promise<void>;
}
/**
* 宣言併合用レジストリ。
*/
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface EngineRegistry {}
|