@coeiro-operator/core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +11 -0
  2. package/dist/common/config-paths.d.ts +12 -0
  3. package/dist/common/config-paths.js +43 -0
  4. package/dist/dictionary/default-dictionaries.d.ts +20 -0
  5. package/dist/dictionary/default-dictionaries.js +48 -0
  6. package/dist/dictionary/dictionary-client.d.ts +73 -0
  7. package/dist/dictionary/dictionary-client.js +115 -0
  8. package/dist/dictionary/dictionary-persistence.d.ts +48 -0
  9. package/dist/dictionary/dictionary-persistence.js +82 -0
  10. package/dist/dictionary/dictionary-service.d.ts +32 -0
  11. package/dist/dictionary/dictionary-service.js +102 -0
  12. package/dist/environment/speaker-provider.d.ts +72 -0
  13. package/dist/environment/speaker-provider.js +174 -0
  14. package/dist/index.d.ts +19 -0
  15. package/dist/index.js +27 -0
  16. package/dist/operator/character-defaults.d.ts +20 -0
  17. package/dist/operator/character-defaults.js +128 -0
  18. package/dist/operator/character-info-service.d.ts +73 -0
  19. package/dist/operator/character-info-service.js +152 -0
  20. package/dist/operator/config-manager.d.ts +145 -0
  21. package/dist/operator/config-manager.js +232 -0
  22. package/dist/operator/file-operation-manager.d.ts +82 -0
  23. package/dist/operator/file-operation-manager.js +230 -0
  24. package/dist/operator/index.d.ts +128 -0
  25. package/dist/operator/index.js +353 -0
  26. package/dist/terminal/terminal-background.d.ts +37 -0
  27. package/dist/terminal/terminal-background.js +207 -0
  28. package/dist/test-utils/test-env.d.ts +10 -0
  29. package/dist/test-utils/test-env.js +13 -0
  30. package/dist/types.d.ts +58 -0
  31. package/dist/types.js +5 -0
  32. package/package.json +54 -0
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # @coeiro-operator/core
2
+
3
+ COEIRO Operatorコア機能
4
+
5
+ 内部パッケージです。直接のインストールは推奨されません。
6
+
7
+ 設定管理、オペレータ管理、セッション管理などの中核機能を提供します。
8
+
9
+ ## ライセンス
10
+
11
+ MIT
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 共通設定パス管理
3
+ */
4
+ /**
5
+ * 設定ディレクトリを決定(ホームディレクトリベース)
6
+ */
7
+ export declare function getConfigDir(): Promise<string>;
8
+ /**
9
+ * 設定ファイルのパスを取得
10
+ */
11
+ export declare function getConfigPath(filename: string): Promise<string>;
12
+ //# sourceMappingURL=config-paths.d.ts.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * 共通設定パス管理
3
+ */
4
+ import { mkdir } from 'fs/promises';
5
+ import { join } from 'path';
6
+ /**
7
+ * 設定ディレクトリを決定(ホームディレクトリベース)
8
+ */
9
+ export async function getConfigDir() {
10
+ // ホームディレクトリの ~/.coeiro-operator/ を優先
11
+ const homeDir = join(process.env.HOME || process.env.USERPROFILE || '~', '.coeiro-operator');
12
+ try {
13
+ await mkdir(homeDir, { recursive: true });
14
+ return homeDir;
15
+ }
16
+ catch {
17
+ // フォールバック: 作業ディレクトリの .coeiroink/
18
+ const workDir = join(process.cwd(), '.coeiroink');
19
+ try {
20
+ await mkdir(workDir, { recursive: true });
21
+ return workDir;
22
+ }
23
+ catch {
24
+ // 最終フォールバック: /tmp/coeiroink-mcp-shared/
25
+ const tmpDir = '/tmp/coeiroink-mcp-shared';
26
+ try {
27
+ await mkdir(tmpDir, { recursive: true });
28
+ }
29
+ catch {
30
+ // ディレクトリ作成エラーは無視
31
+ }
32
+ return tmpDir;
33
+ }
34
+ }
35
+ }
36
+ /**
37
+ * 設定ファイルのパスを取得
38
+ */
39
+ export async function getConfigPath(filename) {
40
+ const configDir = await getConfigDir();
41
+ return join(configDir, filename);
42
+ }
43
+ //# sourceMappingURL=config-paths.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * デフォルト辞書データ
3
+ *
4
+ * COEIROINKに登録する標準的な単語の定義
5
+ */
6
+ import { DictionaryWord } from './dictionary-client.js';
7
+ /**
8
+ * デフォルトの技術用語辞書
9
+ */
10
+ export declare const DEFAULT_TECHNICAL_WORDS: DictionaryWord[];
11
+ /**
12
+ * キャラクター名辞書
13
+ */
14
+ export declare const CHARACTER_NAME_WORDS: DictionaryWord[];
15
+ /**
16
+ * 全デフォルト辞書
17
+ * 技術用語とキャラクター名を統合
18
+ */
19
+ export declare const ALL_DEFAULT_WORDS: DictionaryWord[];
20
+ //# sourceMappingURL=default-dictionaries.d.ts.map
@@ -0,0 +1,48 @@
1
+ /**
2
+ * デフォルト辞書データ
3
+ *
4
+ * COEIROINKに登録する標準的な単語の定義
5
+ */
6
+ /**
7
+ * デフォルトの技術用語辞書
8
+ */
9
+ export const DEFAULT_TECHNICAL_WORDS = [
10
+ // 音声合成関連
11
+ { word: 'COEIRO', yomi: 'コエイロ', accent: 2, numMoras: 4 },
12
+ { word: 'COEIROINK', yomi: 'コエイロインク', accent: 5, numMoras: 7 },
13
+ // AI関連
14
+ { word: 'Claude', yomi: 'クロード', accent: 2, numMoras: 4 },
15
+ { word: 'Anthropic', yomi: 'アンソロピック', accent: 4, numMoras: 7 },
16
+ { word: 'ChatGPT', yomi: 'チャットジーピーティー', accent: 0, numMoras: 10 },
17
+ // 開発ツール
18
+ { word: 'GitHub', yomi: 'ギットハブ', accent: 3, numMoras: 5 },
19
+ { word: 'TypeScript', yomi: 'タイプスクリプト', accent: 5, numMoras: 8 },
20
+ { word: 'Node.js', yomi: 'ノードジェイエス', accent: 0, numMoras: 8 },
21
+ { word: 'npm', yomi: 'エヌピーエム', accent: 0, numMoras: 6 },
22
+ // プロトコル・形式
23
+ { word: 'MCP', yomi: 'エムシーピー', accent: 0, numMoras: 6 },
24
+ { word: 'API', yomi: 'エーピーアイ', accent: 0, numMoras: 6 },
25
+ { word: 'JSON', yomi: 'ジェイソン', accent: 1, numMoras: 4 },
26
+ { word: 'CLI', yomi: 'シーエルアイ', accent: 0, numMoras: 6 },
27
+ { word: 'GUI', yomi: 'ジーユーアイ', accent: 0, numMoras: 6 },
28
+ ];
29
+ /**
30
+ * キャラクター名辞書
31
+ */
32
+ export const CHARACTER_NAME_WORDS = [
33
+ { word: 'つくよみちゃん', yomi: 'ツクヨミチャン', accent: 3, numMoras: 6 },
34
+ { word: 'アンジー', yomi: 'アンジー', accent: 1, numMoras: 4 },
35
+ { word: 'アルマ', yomi: 'アルマ', accent: 1, numMoras: 3 },
36
+ { word: 'ディア', yomi: 'ディア', accent: 1, numMoras: 2 },
37
+ { word: 'リリン', yomi: 'リリン', accent: 1, numMoras: 3 },
38
+ { word: 'クロワ', yomi: 'クロワ', accent: 1, numMoras: 3 },
39
+ ];
40
+ /**
41
+ * 全デフォルト辞書
42
+ * 技術用語とキャラクター名を統合
43
+ */
44
+ export const ALL_DEFAULT_WORDS = [
45
+ ...DEFAULT_TECHNICAL_WORDS,
46
+ ...CHARACTER_NAME_WORDS,
47
+ ];
48
+ //# sourceMappingURL=default-dictionaries.js.map
@@ -0,0 +1,73 @@
1
+ /**
2
+ * COEIROINK ユーザー辞書API クライアント
3
+ *
4
+ * COEIROINKのユーザー辞書機能にアクセスするための独立したモジュール
5
+ * CLI、MCP、その他のコンポーネントから再利用可能
6
+ */
7
+ /**
8
+ * 辞書単語の定義
9
+ */
10
+ export interface DictionaryWord {
11
+ /** 登録する単語(全角英数字推奨) */
12
+ word: string;
13
+ /** 読み方(全角カタカナ) */
14
+ yomi: string;
15
+ /** アクセント位置(0:平板型、1以上:該当モーラが高い) */
16
+ accent: number;
17
+ /** モーラ数(音節数) */
18
+ numMoras: number;
19
+ }
20
+ /**
21
+ * 辞書登録レスポンス
22
+ */
23
+ export interface DictionaryResponse {
24
+ /** 登録成功フラグ */
25
+ success: boolean;
26
+ /** エラーメッセージ(エラー時のみ) */
27
+ error?: string;
28
+ /** 登録された単語数 */
29
+ registeredCount?: number;
30
+ }
31
+ /**
32
+ * COEIROINKサーバー設定
33
+ */
34
+ export interface CoeiroinkServerConfig {
35
+ /** ホスト名(デフォルト: localhost) */
36
+ host?: string;
37
+ /** ポート番号(デフォルト: 50032) */
38
+ port?: string | number;
39
+ }
40
+ /**
41
+ * ユーザー辞書クライアント
42
+ */
43
+ export declare class DictionaryClient {
44
+ private baseUrl;
45
+ constructor(config?: CoeiroinkServerConfig);
46
+ /**
47
+ * 辞書に単語を登録
48
+ *
49
+ * 注意事項:
50
+ * - 半角英数字は登録できません(全角に変換して登録)
51
+ * - 登録した辞書はCOEIROINK再起動時にリセットされます
52
+ * - 全角で登録すれば半角入力にも適用されます
53
+ *
54
+ * @param words 登録する単語の配列
55
+ * @returns 登録結果
56
+ */
57
+ registerWords(words: DictionaryWord[]): Promise<DictionaryResponse>;
58
+ /**
59
+ * 半角英数字・記号を全角に変換
60
+ * COEIROINKのAPI制限により、半角英数字では辞書登録が効かないため
61
+ *
62
+ * @param str 変換する文字列
63
+ * @returns 全角変換後の文字列
64
+ */
65
+ private toFullWidth;
66
+ /**
67
+ * サーバーの接続確認
68
+ *
69
+ * @returns 接続可能かどうか
70
+ */
71
+ checkConnection(): Promise<boolean>;
72
+ }
73
+ //# sourceMappingURL=dictionary-client.d.ts.map
@@ -0,0 +1,115 @@
1
+ /**
2
+ * COEIROINK ユーザー辞書API クライアント
3
+ *
4
+ * COEIROINKのユーザー辞書機能にアクセスするための独立したモジュール
5
+ * CLI、MCP、その他のコンポーネントから再利用可能
6
+ */
7
+ /**
8
+ * ユーザー辞書クライアント
9
+ */
10
+ export class DictionaryClient {
11
+ baseUrl;
12
+ constructor(config = {}) {
13
+ const host = config.host || 'localhost';
14
+ const port = config.port || '50032';
15
+ this.baseUrl = `http://${host}:${port}`;
16
+ }
17
+ /**
18
+ * 辞書に単語を登録
19
+ *
20
+ * 注意事項:
21
+ * - 半角英数字は登録できません(全角に変換して登録)
22
+ * - 登録した辞書はCOEIROINK再起動時にリセットされます
23
+ * - 全角で登録すれば半角入力にも適用されます
24
+ *
25
+ * @param words 登録する単語の配列
26
+ * @returns 登録結果
27
+ */
28
+ async registerWords(words) {
29
+ try {
30
+ // 半角英数字を全角に変換(API制限対策)
31
+ const convertedWords = words.map(word => ({
32
+ ...word,
33
+ word: this.toFullWidth(word.word),
34
+ }));
35
+ const response = await fetch(`${this.baseUrl}/v1/set_dictionary`, {
36
+ method: 'POST',
37
+ headers: {
38
+ 'Content-Type': 'application/json',
39
+ },
40
+ body: JSON.stringify({
41
+ dictionaryWords: convertedWords,
42
+ }),
43
+ });
44
+ if (!response.ok) {
45
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
46
+ }
47
+ // COEIROINKは常にnullを返すが、成功とみなす
48
+ return {
49
+ success: true,
50
+ registeredCount: words.length,
51
+ };
52
+ }
53
+ catch (error) {
54
+ const message = error instanceof Error ? error.message : 'Unknown error';
55
+ // 接続エラーの詳細メッセージ
56
+ if (message.includes('ECONNREFUSED')) {
57
+ return {
58
+ success: false,
59
+ error: `COEIROINKサーバーに接続できません。サーバーが起動していることを確認してください (${this.baseUrl})`,
60
+ };
61
+ }
62
+ return {
63
+ success: false,
64
+ error: message,
65
+ };
66
+ }
67
+ }
68
+ /**
69
+ * 半角英数字・記号を全角に変換
70
+ * COEIROINKのAPI制限により、半角英数字では辞書登録が効かないため
71
+ *
72
+ * @param str 変換する文字列
73
+ * @returns 全角変換後の文字列
74
+ */
75
+ toFullWidth(str) {
76
+ return str.replace(/[A-Za-z0-9!-/:-@[-`{-~]/g, char => {
77
+ const code = char.charCodeAt(0);
78
+ // ASCII文字(0x21-0x7E)は基本的に0xFEE0を加算で全角に変換可能
79
+ // ただし、一部の文字は個別対応が必要
80
+ // スペース(0x20)は対象外なのでここでは処理しない
81
+ // 特殊な変換が必要な文字
82
+ switch (char) {
83
+ case ' ': return ' '; // 半角スペース → 全角スペース (U+3000)
84
+ case '"': return '"'; // ダブルクォート
85
+ case '\'': return `’`; // シングルクォート
86
+ case '\\': return '\'; // バックスラッシュ
87
+ case '~': return '~'; // チルダ
88
+ default:
89
+ // その他のASCII印字可能文字(! から ~ まで)
90
+ if (code >= 0x21 && code <= 0x7E) {
91
+ return String.fromCharCode(code + 0xFEE0);
92
+ }
93
+ return char;
94
+ }
95
+ });
96
+ }
97
+ /**
98
+ * サーバーの接続確認
99
+ *
100
+ * @returns 接続可能かどうか
101
+ */
102
+ async checkConnection() {
103
+ try {
104
+ const response = await fetch(`${this.baseUrl}/`, {
105
+ method: 'GET',
106
+ signal: AbortSignal.timeout(3000), // 3秒タイムアウト
107
+ });
108
+ return response.ok;
109
+ }
110
+ catch {
111
+ return false;
112
+ }
113
+ }
114
+ }
115
+ //# sourceMappingURL=dictionary-client.js.map
@@ -0,0 +1,48 @@
1
+ /**
2
+ * COEIROINK ユーザー辞書永続化機能
3
+ *
4
+ * 登録した辞書データを永続化し、次回起動時に自動的に復元する
5
+ */
6
+ import { DictionaryWord } from './dictionary-client.js';
7
+ /**
8
+ * 永続化辞書データ
9
+ */
10
+ export interface PersistentDictionary {
11
+ /** 辞書のバージョン */
12
+ version: string;
13
+ /** 最終更新日時 */
14
+ lastUpdated: string;
15
+ /** カスタム単語リスト */
16
+ customWords: DictionaryWord[];
17
+ /** デフォルト辞書を含めるか */
18
+ includeDefaults: boolean;
19
+ }
20
+ /**
21
+ * 辞書永続化マネージャー
22
+ */
23
+ export declare class DictionaryPersistenceManager {
24
+ private readonly configDir;
25
+ private readonly dictionaryFile;
26
+ constructor();
27
+ /**
28
+ * 辞書データを保存
29
+ */
30
+ save(words: DictionaryWord[], includeDefaults?: boolean): Promise<void>;
31
+ /**
32
+ * 辞書データを読み込み
33
+ */
34
+ load(): Promise<PersistentDictionary | null>;
35
+ /**
36
+ * 辞書データを削除
37
+ */
38
+ clear(): Promise<void>;
39
+ /**
40
+ * 辞書データが存在するか確認
41
+ */
42
+ exists(): boolean;
43
+ /**
44
+ * 辞書データのパスを取得
45
+ */
46
+ getFilePath(): string;
47
+ }
48
+ //# sourceMappingURL=dictionary-persistence.d.ts.map
@@ -0,0 +1,82 @@
1
+ /**
2
+ * COEIROINK ユーザー辞書永続化機能
3
+ *
4
+ * 登録した辞書データを永続化し、次回起動時に自動的に復元する
5
+ */
6
+ import fs from 'fs';
7
+ import path from 'path';
8
+ import os from 'os';
9
+ /**
10
+ * 辞書永続化マネージャー
11
+ */
12
+ export class DictionaryPersistenceManager {
13
+ configDir;
14
+ dictionaryFile;
15
+ constructor() {
16
+ // ~/.coeiro-operator ディレクトリを使用
17
+ this.configDir = path.join(os.homedir(), '.coeiro-operator');
18
+ this.dictionaryFile = path.join(this.configDir, 'user-dictionary.json');
19
+ // ディレクトリが存在しない場合は作成
20
+ if (!fs.existsSync(this.configDir)) {
21
+ fs.mkdirSync(this.configDir, { recursive: true });
22
+ }
23
+ }
24
+ /**
25
+ * 辞書データを保存
26
+ */
27
+ async save(words, includeDefaults = true) {
28
+ const data = {
29
+ version: '1.0.0',
30
+ lastUpdated: new Date().toISOString(),
31
+ customWords: words,
32
+ includeDefaults,
33
+ };
34
+ try {
35
+ await fs.promises.writeFile(this.dictionaryFile, JSON.stringify(data, null, 2), 'utf8');
36
+ }
37
+ catch (error) {
38
+ throw new Error(`辞書データの保存に失敗しました: ${error.message}`);
39
+ }
40
+ }
41
+ /**
42
+ * 辞書データを読み込み
43
+ */
44
+ async load() {
45
+ if (!fs.existsSync(this.dictionaryFile)) {
46
+ return null;
47
+ }
48
+ try {
49
+ const content = await fs.promises.readFile(this.dictionaryFile, 'utf8');
50
+ const data = JSON.parse(content);
51
+ // バージョンチェック(将来の拡張用)
52
+ if (!data.version) {
53
+ throw new Error('辞書データのバージョンが不明です');
54
+ }
55
+ return data;
56
+ }
57
+ catch (error) {
58
+ throw new Error(`辞書データの読み込みに失敗しました: ${error.message}`);
59
+ }
60
+ }
61
+ /**
62
+ * 辞書データを削除
63
+ */
64
+ async clear() {
65
+ if (fs.existsSync(this.dictionaryFile)) {
66
+ await fs.promises.unlink(this.dictionaryFile);
67
+ }
68
+ }
69
+ /**
70
+ * 辞書データが存在するか確認
71
+ */
72
+ exists() {
73
+ return fs.existsSync(this.dictionaryFile);
74
+ }
75
+ /**
76
+ * 辞書データのパスを取得
77
+ */
78
+ getFilePath() {
79
+ return this.dictionaryFile;
80
+ }
81
+ }
82
+ //# sourceMappingURL=dictionary-persistence.js.map
@@ -0,0 +1,32 @@
1
+ /**
2
+ * 辞書管理サービス
3
+ *
4
+ * 辞書の登録・永続化を統一的に管理
5
+ */
6
+ import { DictionaryWord } from './dictionary-client.js';
7
+ import { ConnectionConfig } from '../environment/speaker-provider.js';
8
+ /**
9
+ * 辞書管理サービス
10
+ */
11
+ export declare class DictionaryService {
12
+ private client;
13
+ private persistenceManager;
14
+ constructor(connectionConfig?: ConnectionConfig);
15
+ /**
16
+ * 辞書を初期化(起動時の自動登録)
17
+ */
18
+ initialize(): Promise<void>;
19
+ /**
20
+ * 単語を追加登録
21
+ */
22
+ addWord(word: DictionaryWord): Promise<boolean>;
23
+ /**
24
+ * すべての辞書(デフォルト+カスタム)を登録
25
+ */
26
+ private registerAllWords;
27
+ /**
28
+ * 接続確認
29
+ */
30
+ checkConnection(): Promise<boolean>;
31
+ }
32
+ //# sourceMappingURL=dictionary-service.d.ts.map
@@ -0,0 +1,102 @@
1
+ /**
2
+ * 辞書管理サービス
3
+ *
4
+ * 辞書の登録・永続化を統一的に管理
5
+ */
6
+ import { DictionaryClient } from './dictionary-client.js';
7
+ import { DictionaryPersistenceManager } from './dictionary-persistence.js';
8
+ import { DEFAULT_TECHNICAL_WORDS, CHARACTER_NAME_WORDS } from './default-dictionaries.js';
9
+ import { logger } from '@coeiro-operator/common';
10
+ /**
11
+ * 辞書管理サービス
12
+ */
13
+ export class DictionaryService {
14
+ client;
15
+ persistenceManager;
16
+ constructor(connectionConfig) {
17
+ this.client = new DictionaryClient(connectionConfig);
18
+ this.persistenceManager = new DictionaryPersistenceManager();
19
+ }
20
+ /**
21
+ * 辞書を初期化(起動時の自動登録)
22
+ */
23
+ async initialize() {
24
+ try {
25
+ const isConnected = await this.client.checkConnection();
26
+ if (!isConnected) {
27
+ logger.warn('COEIROINKサーバーに接続できないため、辞書の初期化をスキップしました');
28
+ return;
29
+ }
30
+ // 保存された辞書を読み込み
31
+ const savedDictionary = await this.persistenceManager.load();
32
+ let customWords = [];
33
+ if (savedDictionary) {
34
+ customWords = savedDictionary.customWords || [];
35
+ logger.info(`保存された辞書を読み込みました: カスタム単語${customWords.length}個`);
36
+ }
37
+ else {
38
+ // 初回起動時は空の辞書で永続化ファイルを作成
39
+ await this.persistenceManager.save([], true);
40
+ logger.info('辞書設定ファイルを初期化しました');
41
+ }
42
+ // すべての辞書を登録
43
+ await this.registerAllWords(customWords);
44
+ }
45
+ catch (error) {
46
+ logger.warn(`辞書の初期化中にエラーが発生しました: ${error.message}`);
47
+ }
48
+ }
49
+ /**
50
+ * 単語を追加登録
51
+ */
52
+ async addWord(word) {
53
+ try {
54
+ // 既存のカスタム辞書を読み込み
55
+ let existingWords = [];
56
+ const savedDictionary = await this.persistenceManager.load();
57
+ if (savedDictionary) {
58
+ existingWords = savedDictionary.customWords || [];
59
+ }
60
+ // 重複チェック(同じ単語があれば上書き)
61
+ const updatedWords = existingWords.filter(w => w.word !== word.word);
62
+ updatedWords.push(word);
63
+ // すべての辞書を登録
64
+ const success = await this.registerAllWords(updatedWords);
65
+ if (success) {
66
+ // 永続化
67
+ await this.persistenceManager.save(updatedWords, true);
68
+ logger.info(`辞書に単語を追加: ${word.word} → ${word.yomi}`);
69
+ }
70
+ return success;
71
+ }
72
+ catch (error) {
73
+ logger.error(`単語の追加に失敗しました: ${error.message}`);
74
+ return false;
75
+ }
76
+ }
77
+ /**
78
+ * すべての辞書(デフォルト+カスタム)を登録
79
+ */
80
+ async registerAllWords(customWords) {
81
+ const allWords = [...DEFAULT_TECHNICAL_WORDS, ...CHARACTER_NAME_WORDS, ...customWords];
82
+ if (allWords.length === 0) {
83
+ return true;
84
+ }
85
+ const result = await this.client.registerWords(allWords);
86
+ if (result.success) {
87
+ logger.info(`辞書を登録しました: 合計${result.registeredCount}個の単語`);
88
+ return true;
89
+ }
90
+ else {
91
+ logger.warn(`辞書登録に失敗: ${result.error}`);
92
+ return false;
93
+ }
94
+ }
95
+ /**
96
+ * 接続確認
97
+ */
98
+ async checkConnection() {
99
+ return await this.client.checkConnection();
100
+ }
101
+ }
102
+ //# sourceMappingURL=dictionary-service.js.map
@@ -0,0 +1,72 @@
1
+ /**
2
+ * src/core/environment/speaker-provider.ts: Speaker情報プロバイダ
3
+ * COEIROINKサーバーからの動的Speaker情報取得を一元管理
4
+ */
5
+ export interface VoiceStyle {
6
+ styleId: number;
7
+ styleName: string;
8
+ }
9
+ export interface Speaker {
10
+ speakerName: string;
11
+ speakerUuid: string;
12
+ styles: VoiceStyle[];
13
+ base64Portrait?: string;
14
+ }
15
+ export interface ConnectionConfig {
16
+ host: string;
17
+ port: string;
18
+ }
19
+ /**
20
+ * Speaker情報プロバイダクラス
21
+ * COEIROINKサーバーからのSpeaker情報取得を一元管理
22
+ */
23
+ export declare class SpeakerProvider {
24
+ private connectionConfig;
25
+ constructor(connectionConfig?: Partial<ConnectionConfig>);
26
+ /**
27
+ * 接続設定を更新
28
+ */
29
+ updateConnection(config: Partial<ConnectionConfig>): void;
30
+ /**
31
+ * サーバー接続確認
32
+ */
33
+ checkConnection(): Promise<boolean>;
34
+ /**
35
+ * 利用可能な音声一覧を取得
36
+ */
37
+ getSpeakers(): Promise<Speaker[]>;
38
+ /**
39
+ * 特定のSpeakerの立ち絵画像を取得
40
+ */
41
+ getSpeakerPortrait(speakerId: string): Promise<string | null>;
42
+ /**
43
+ * 特定の音声のスタイル情報を取得
44
+ */
45
+ getVoiceStyles(voiceId: string): Promise<VoiceStyle[]>;
46
+ /**
47
+ * 特定の音声の最初のスタイルIDを取得(フォールバック用)
48
+ */
49
+ getFirstStyleId(voiceId: string): Promise<number>;
50
+ /**
51
+ * 全Speakerを取得(エイリアス)
52
+ */
53
+ getAllSpeakers(): Promise<Speaker[]>;
54
+ /**
55
+ * デバッグ用:音声一覧をコンソール出力
56
+ */
57
+ logAvailableVoices(): Promise<void>;
58
+ /**
59
+ * 音声名からIDを生成(英語名への変換)
60
+ */
61
+ private speakerNameToId;
62
+ }
63
+ /**
64
+ * グローバルSpeakerプロバイダを取得
65
+ * 設定ファイルから接続情報を読み込んで初期化
66
+ */
67
+ export declare function getSpeakerProvider(connectionConfig?: Partial<ConnectionConfig>): SpeakerProvider;
68
+ /**
69
+ * Speakerプロバイダをリセット(テスト用)
70
+ */
71
+ export declare function resetSpeakerProvider(): void;
72
+ //# sourceMappingURL=speaker-provider.d.ts.map