@aituber-onair/chat 0.30.0 → 0.31.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.
- package/README.ja.md +190 -2
- package/README.md +200 -2
- package/dist/cjs/agent.d.ts +3 -0
- package/dist/cjs/agent.d.ts.map +1 -0
- package/dist/cjs/agent.js +21 -0
- package/dist/cjs/agent.js.map +1 -0
- package/dist/cjs/services/providers/agent/CodexSDKChatService.d.ts +29 -0
- package/dist/cjs/services/providers/agent/CodexSDKChatService.d.ts.map +1 -0
- package/dist/cjs/services/providers/agent/CodexSDKChatService.js +65 -0
- package/dist/cjs/services/providers/agent/CodexSDKChatService.js.map +1 -0
- package/dist/cjs/services/providers/agent/CodexSDKChatServiceProvider.d.ts +14 -0
- package/dist/cjs/services/providers/agent/CodexSDKChatServiceProvider.d.ts.map +1 -0
- package/dist/cjs/services/providers/agent/CodexSDKChatServiceProvider.js +31 -0
- package/dist/cjs/services/providers/agent/CodexSDKChatServiceProvider.js.map +1 -0
- package/dist/cjs/services/providers/agent/CopilotSDKChatService.d.ts +48 -0
- package/dist/cjs/services/providers/agent/CopilotSDKChatService.d.ts.map +1 -0
- package/dist/cjs/services/providers/agent/CopilotSDKChatService.js +79 -0
- package/dist/cjs/services/providers/agent/CopilotSDKChatService.js.map +1 -0
- package/dist/cjs/services/providers/agent/CopilotSDKChatServiceProvider.d.ts +14 -0
- package/dist/cjs/services/providers/agent/CopilotSDKChatServiceProvider.d.ts.map +1 -0
- package/dist/cjs/services/providers/agent/CopilotSDKChatServiceProvider.js +31 -0
- package/dist/cjs/services/providers/agent/CopilotSDKChatServiceProvider.js.map +1 -0
- package/dist/cjs/services/providers/agent/index.d.ts +19 -0
- package/dist/cjs/services/providers/agent/index.d.ts.map +1 -0
- package/dist/cjs/services/providers/agent/index.js +26 -0
- package/dist/cjs/services/providers/agent/index.js.map +1 -0
- package/dist/cjs/services/providers/agent/shared.d.ts +36 -0
- package/dist/cjs/services/providers/agent/shared.d.ts.map +1 -0
- package/dist/cjs/services/providers/agent/shared.js +122 -0
- package/dist/cjs/services/providers/agent/shared.js.map +1 -0
- package/dist/esm/agent.d.ts +3 -0
- package/dist/esm/agent.d.ts.map +1 -0
- package/dist/esm/agent.js +5 -0
- package/dist/esm/agent.js.map +1 -0
- package/dist/esm/services/providers/agent/CodexSDKChatService.d.ts +29 -0
- package/dist/esm/services/providers/agent/CodexSDKChatService.d.ts.map +1 -0
- package/dist/esm/services/providers/agent/CodexSDKChatService.js +61 -0
- package/dist/esm/services/providers/agent/CodexSDKChatService.js.map +1 -0
- package/dist/esm/services/providers/agent/CodexSDKChatServiceProvider.d.ts +14 -0
- package/dist/esm/services/providers/agent/CodexSDKChatServiceProvider.d.ts.map +1 -0
- package/dist/esm/services/providers/agent/CodexSDKChatServiceProvider.js +27 -0
- package/dist/esm/services/providers/agent/CodexSDKChatServiceProvider.js.map +1 -0
- package/dist/esm/services/providers/agent/CopilotSDKChatService.d.ts +48 -0
- package/dist/esm/services/providers/agent/CopilotSDKChatService.d.ts.map +1 -0
- package/dist/esm/services/providers/agent/CopilotSDKChatService.js +75 -0
- package/dist/esm/services/providers/agent/CopilotSDKChatService.js.map +1 -0
- package/dist/esm/services/providers/agent/CopilotSDKChatServiceProvider.d.ts +14 -0
- package/dist/esm/services/providers/agent/CopilotSDKChatServiceProvider.d.ts.map +1 -0
- package/dist/esm/services/providers/agent/CopilotSDKChatServiceProvider.js +27 -0
- package/dist/esm/services/providers/agent/CopilotSDKChatServiceProvider.js.map +1 -0
- package/dist/esm/services/providers/agent/index.d.ts +19 -0
- package/dist/esm/services/providers/agent/index.d.ts.map +1 -0
- package/dist/esm/services/providers/agent/index.js +15 -0
- package/dist/esm/services/providers/agent/index.js.map +1 -0
- package/dist/esm/services/providers/agent/shared.d.ts +36 -0
- package/dist/esm/services/providers/agent/shared.d.ts.map +1 -0
- package/dist/esm/services/providers/agent/shared.js +116 -0
- package/dist/esm/services/providers/agent/shared.js.map +1 -0
- package/package.json +6 -1
package/README.ja.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
AITuber OnAirのチャット・LLM API統合ライブラリです。このパッケージは、OpenAI、ローカルLLM含むOpenAI互換プロバイダー、Claude、Gemini、Gemini Nano(Chromeブラウザ内蔵AI)、OpenRouter、Z.ai、xAI、Kimi
|
|
5
|
+
AITuber OnAirのチャット・LLM API統合ライブラリです。このパッケージは、OpenAI、ローカルLLM含むOpenAI互換プロバイダー、Claude、Gemini、Gemini Nano(Chromeブラウザ内蔵AI)、OpenRouter、Z.ai、xAI、Kimi、Agent SDKプロバイダー等の様々なAIチャットプロバイダーとやり取りするための統一されたインターフェースを提供します。
|
|
6
6
|
|
|
7
7
|
## 機能
|
|
8
8
|
|
|
9
|
-
- 🤖 **複数のAIプロバイダー対応**: OpenAI、ローカルLLM含むOpenAI互換プロバイダー、Claude (Anthropic)、Google Gemini、Gemini Nano(Chromeブラウザ内蔵AI)、OpenRouter、Z.ai、xAI、Kimi
|
|
9
|
+
- 🤖 **複数のAIプロバイダー対応**: OpenAI、ローカルLLM含むOpenAI互換プロバイダー、Claude (Anthropic)、Google Gemini、Gemini Nano(Chromeブラウザ内蔵AI)、OpenRouter、Z.ai、xAI、Kimi、Agent SDKプロバイダー
|
|
10
10
|
- 🔄 **統一されたインターフェース**: 異なるプロバイダー間での一貫したAPI
|
|
11
11
|
- 🛠️ **ツール・関数呼び出し**: AI関数呼び出しの自動反復処理をサポート
|
|
12
12
|
- 💬 **ストリーミングレスポンス**: リアルタイムストリーミングチャット応答
|
|
@@ -14,6 +14,7 @@ AITuber OnAirのチャット・LLM API統合ライブラリです。このパッ
|
|
|
14
14
|
- 📝 **感情検出**: AI応答からの感情抽出
|
|
15
15
|
- 🎯 **応答長制御**: プリセットまたはカスタムトークン制限での応答長設定
|
|
16
16
|
- 🔌 **Model Context Protocol (MCP)**: MCP サーバーサポート
|
|
17
|
+
- 🧩 **Agent SDKプロバイダー**: エージェントSDKパッケージを標準インストールに含めず、任意で `@aituber-onair/chat/agent` から利用可能
|
|
17
18
|
|
|
18
19
|
## インストール
|
|
19
20
|
|
|
@@ -88,6 +89,97 @@ async function testChat() {
|
|
|
88
89
|
- スクリプトプロパティに `OPENAI_API_KEY` を設定。
|
|
89
90
|
- 実例は `packages/chat/examples/gas-basic` を参照。`appsscript.json` は任意(近年のGASは既定でV8ランタイム)。タイムゾーン等をカスタムしたい場合のみ追加してください。
|
|
90
91
|
|
|
92
|
+
## Agent SDKプロバイダー
|
|
93
|
+
|
|
94
|
+
Codex SDK や Copilot SDK のようなエージェントSDKを使う場合は、
|
|
95
|
+
専用の `@aituber-onair/chat/agent` エントリを使用します。
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { createAgentChatService } from '@aituber-onair/chat/agent';
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
このエントリはブラウザ/GAS向けUMDビルドには含まれません。エージェントSDKパッケージは
|
|
102
|
+
動的に読み込むため、利用する SDK だけを JavaScript ランタイムアプリ側に追加してください。
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npm install @aituber-onair/chat @openai/codex-sdk
|
|
106
|
+
# または
|
|
107
|
+
npm install @aituber-onair/chat @github/copilot-sdk
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Codex SDK を使う最短例:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import { createAgentChatService } from '@aituber-onair/chat/agent';
|
|
114
|
+
|
|
115
|
+
const chatService = createAgentChatService('codex-sdk', {
|
|
116
|
+
workingDirectory: process.cwd(),
|
|
117
|
+
skipGitRepoCheck: true,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const messages = [
|
|
121
|
+
{
|
|
122
|
+
role: 'system',
|
|
123
|
+
content:
|
|
124
|
+
'あなたはライブ配信中のAIアバターです。親しみやすく短めに返答してください。',
|
|
125
|
+
},
|
|
126
|
+
{ role: 'user', content: '今日はTypeScriptのライブラリを作っています。' },
|
|
127
|
+
{
|
|
128
|
+
role: 'assistant',
|
|
129
|
+
content: 'いいですね。作業の合間に、会話で少し気分転換しましょう。',
|
|
130
|
+
},
|
|
131
|
+
{ role: 'user', content: '夜の作業に合う飲み物をおすすめして。' },
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
const response = await chatService.chatOnce(messages, false);
|
|
135
|
+
|
|
136
|
+
console.log(response);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Copilot SDK を使う場合:
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
import { createAgentChatService } from '@aituber-onair/chat/agent';
|
|
143
|
+
|
|
144
|
+
const chatService = createAgentChatService('copilot-sdk', {
|
|
145
|
+
model: 'gpt-4.1',
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const messages = [
|
|
149
|
+
{
|
|
150
|
+
role: 'system',
|
|
151
|
+
content:
|
|
152
|
+
'あなたはライブ配信中のAIアバターです。親しみやすく短めに返答してください。',
|
|
153
|
+
},
|
|
154
|
+
{ role: 'user', content: '今日はTypeScriptのライブラリを作っています。' },
|
|
155
|
+
{
|
|
156
|
+
role: 'assistant',
|
|
157
|
+
content: 'いいですね。作業の合間に、会話で少し気分転換しましょう。',
|
|
158
|
+
},
|
|
159
|
+
{ role: 'user', content: '夜の作業に合う飲み物をおすすめして。' },
|
|
160
|
+
];
|
|
161
|
+
|
|
162
|
+
const response = await chatService.chatOnce(messages, false);
|
|
163
|
+
|
|
164
|
+
console.log(response);
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Copilot SDK はセッション作成時に権限リクエスト用ハンドラが必須です。
|
|
168
|
+
このパッケージでは安全側に倒すため、未指定時は SDK が管理するツール実行を
|
|
169
|
+
拒否します。ツール実行を許可したい場合は、利用側で `onPermissionRequest` を
|
|
170
|
+
明示してください。
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
const chatService = createAgentChatService('copilot-sdk', {
|
|
174
|
+
model: 'gpt-4.1',
|
|
175
|
+
onPermissionRequest: () => ({ kind: 'approve-once' }),
|
|
176
|
+
});
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
利用前に、各 SDK のローカル認証を済ませておく必要があります。SDK パッケージが
|
|
180
|
+
未インストール、または認証が未完了の場合は、実行時に元の SDK エラー詳細を含む
|
|
181
|
+
エラーを投げます。
|
|
182
|
+
|
|
91
183
|
## 使用方法
|
|
92
184
|
|
|
93
185
|
### 基本的なチャット
|
|
@@ -162,6 +254,102 @@ const localCompatibleService = ChatServiceFactory.createChatService(
|
|
|
162
254
|
- 接続先サーバーは OpenAI互換API 契約を満たす必要があります。
|
|
163
255
|
- 本パッケージは特定のローカルLLM製品に依存しません。
|
|
164
256
|
|
|
257
|
+
#### Agent SDKプロバイダー
|
|
258
|
+
|
|
259
|
+
`@aituber-onair/chat/agent` は、Codex SDK や Copilot SDK のような
|
|
260
|
+
エージェントSDK向けの実験的なプロバイダーを公開します。ブラウザ/GAS向けUMDエントリには
|
|
261
|
+
含まれず、APIキーも使用しません。
|
|
262
|
+
|
|
263
|
+
利用するエージェントSDKパッケージだけを、利用側の JavaScript ランタイムアプリに追加してください。
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
npm install @aituber-onair/chat @openai/codex-sdk
|
|
267
|
+
# または
|
|
268
|
+
npm install @aituber-onair/chat @github/copilot-sdk
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
`@openai/codex-sdk` と `@github/copilot-sdk` は `@aituber-onair/chat` の
|
|
272
|
+
依存関係には含めていません。SDK は動的に読み込むため、通常の API
|
|
273
|
+
プロバイダーだけを使うユーザーはこれらのエージェントSDKパッケージをインストールする
|
|
274
|
+
必要がありません。
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
import { createAgentChatService } from '@aituber-onair/chat/agent';
|
|
278
|
+
|
|
279
|
+
const codexService = createAgentChatService('codex-sdk', {
|
|
280
|
+
workingDirectory: process.cwd(),
|
|
281
|
+
skipGitRepoCheck: true,
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
const messages = [
|
|
285
|
+
{
|
|
286
|
+
role: 'system',
|
|
287
|
+
content:
|
|
288
|
+
'あなたはライブ配信中のAIアバターです。視聴者との自然な会話を続けてください。',
|
|
289
|
+
},
|
|
290
|
+
{ role: 'user', content: '最近、個人開発の進め方で悩んでいます。' },
|
|
291
|
+
{
|
|
292
|
+
role: 'assistant',
|
|
293
|
+
content: '無理なく続けられる形を一緒に考えましょう。',
|
|
294
|
+
},
|
|
295
|
+
{ role: 'user', content: '今日は何から手をつけるのが良さそう?' },
|
|
296
|
+
];
|
|
297
|
+
|
|
298
|
+
const result = await codexService.chatOnce(messages, false, (text) =>
|
|
299
|
+
process.stdout.write(text),
|
|
300
|
+
);
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Copilot SDK を使う場合は `copilot-sdk` を指定します。
|
|
304
|
+
|
|
305
|
+
```typescript
|
|
306
|
+
import { createAgentChatService } from '@aituber-onair/chat/agent';
|
|
307
|
+
|
|
308
|
+
const copilotService = createAgentChatService('copilot-sdk', {
|
|
309
|
+
model: 'gpt-4.1',
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
const messages = [
|
|
313
|
+
{
|
|
314
|
+
role: 'system',
|
|
315
|
+
content:
|
|
316
|
+
'あなたはライブ配信中のAIアバターです。視聴者との自然な会話を続けてください。',
|
|
317
|
+
},
|
|
318
|
+
{ role: 'user', content: '最近、個人開発の進め方で悩んでいます。' },
|
|
319
|
+
{
|
|
320
|
+
role: 'assistant',
|
|
321
|
+
content: '無理なく続けられる形を一緒に考えましょう。',
|
|
322
|
+
},
|
|
323
|
+
{ role: 'user', content: '今日は何から手をつけるのが良さそう?' },
|
|
324
|
+
];
|
|
325
|
+
|
|
326
|
+
const result = await copilotService.chatOnce(messages, false, (text) =>
|
|
327
|
+
process.stdout.write(text),
|
|
328
|
+
);
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Copilot SDK はセッション作成時に権限リクエスト用ハンドラが必須です。
|
|
332
|
+
このパッケージでは安全側に倒すため、未指定時は SDK が管理するツール実行を
|
|
333
|
+
拒否します。ツール実行を許可する場合は、利用側で `onPermissionRequest` を
|
|
334
|
+
渡してください。たとえば、すべて許可する場合は次のように指定できます。
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
const copilotService = createAgentChatService('copilot-sdk', {
|
|
338
|
+
model: 'gpt-4.1',
|
|
339
|
+
onPermissionRequest: () => ({ kind: 'approve-once' }),
|
|
340
|
+
});
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
利用可能なプロバイダー:
|
|
344
|
+
- `codex-sdk`: `@openai/codex-sdk` と Codex 認証が必要です。
|
|
345
|
+
- `copilot-sdk`: `@github/copilot-sdk` と GitHub Copilot 認証が必要です。
|
|
346
|
+
|
|
347
|
+
現時点の制限:
|
|
348
|
+
- テキストチャットのみ対応します。
|
|
349
|
+
- Vision chat、tools、MCP servers は意図的に未対応です。
|
|
350
|
+
- エージェントSDKパッケージが未インストール、またはローカル認証が未完了の場合は、
|
|
351
|
+
実行時に元のSDKエラー詳細を含むエラーを投げます。
|
|
352
|
+
|
|
165
353
|
#### OpenAI互換(ローカル/セルフホスト)
|
|
166
354
|
|
|
167
355
|
公式OpenAI利用と互換エンドポイント利用を明確に分離したい場合は、
|
package/README.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
Chat and LLM API integration library for AITuber OnAir. This package provides a unified interface for interacting with various AI chat providers including OpenAI, OpenAI-compatible, Claude, Gemini, Gemini Nano (Chrome built-in AI), OpenRouter, Z.ai, xAI, and
|
|
5
|
+
Chat and LLM API integration library for AITuber OnAir. This package provides a unified interface for interacting with various AI chat providers including OpenAI, OpenAI-compatible, Claude, Gemini, Gemini Nano (Chrome built-in AI), OpenRouter, Z.ai, xAI, Kimi, and Agent SDK providers.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- 🤖 **Multiple AI Provider Support**: OpenAI, OpenAI-compatible, Claude (Anthropic), Google Gemini, Gemini Nano (Chrome built-in AI), OpenRouter, Z.ai, xAI, and
|
|
9
|
+
- 🤖 **Multiple AI Provider Support**: OpenAI, OpenAI-compatible, Claude (Anthropic), Google Gemini, Gemini Nano (Chrome built-in AI), OpenRouter, Z.ai, xAI, Kimi, and Agent SDK providers
|
|
10
10
|
- 🔄 **Unified Interface**: Consistent API across different providers
|
|
11
11
|
- 🛠️ **Tool/Function Calling**: Support for AI function calling with automatic iteration
|
|
12
12
|
- 💬 **Streaming Responses**: Real-time streaming chat responses
|
|
@@ -14,6 +14,7 @@ Chat and LLM API integration library for AITuber OnAir. This package provides a
|
|
|
14
14
|
- 📝 **Emotion Detection**: Extract emotions from AI responses
|
|
15
15
|
- 🎯 **Response Length Control**: Configure response lengths with presets or custom token limits
|
|
16
16
|
- 🔌 **Model Context Protocol (MCP)**: Support for MCP servers
|
|
17
|
+
- 🧩 **Agent SDK Providers**: Optional `@aituber-onair/chat/agent` entry for agent SDK providers without adding agent SDK packages to the default install
|
|
17
18
|
|
|
18
19
|
## Installation
|
|
19
20
|
|
|
@@ -88,6 +89,102 @@ Notes:
|
|
|
88
89
|
- Set your API key in Script Properties: `OPENAI_API_KEY`.
|
|
89
90
|
- See `packages/chat/examples/gas-basic` for a working example. The Apps Script manifest (`appsscript.json`) is optional; modern projects default to V8. Add one only if you need custom settings (e.g., time zone).
|
|
90
91
|
|
|
92
|
+
## Agent SDK Providers
|
|
93
|
+
|
|
94
|
+
For agent SDKs such as Codex SDK and Copilot SDK, use the separate
|
|
95
|
+
`@aituber-onair/chat/agent` entry point:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { createAgentChatService } from '@aituber-onair/chat/agent';
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
This entry is not part of the browser/GAS UMD build. It loads agent SDK packages
|
|
102
|
+
dynamically, so install only the agent SDK package used by your JavaScript runtime application:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npm install @aituber-onair/chat @openai/codex-sdk
|
|
106
|
+
# or
|
|
107
|
+
npm install @aituber-onair/chat @github/copilot-sdk
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Minimal Codex SDK example:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import { createAgentChatService } from '@aituber-onair/chat/agent';
|
|
114
|
+
|
|
115
|
+
const chatService = createAgentChatService('codex-sdk', {
|
|
116
|
+
workingDirectory: process.cwd(),
|
|
117
|
+
skipGitRepoCheck: true,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const messages = [
|
|
121
|
+
{
|
|
122
|
+
role: 'system',
|
|
123
|
+
content:
|
|
124
|
+
'You are a friendly AI avatar for a live chat. Reply warmly and concisely.',
|
|
125
|
+
},
|
|
126
|
+
{ role: 'user', content: 'I am working on a TypeScript library tonight.' },
|
|
127
|
+
{
|
|
128
|
+
role: 'assistant',
|
|
129
|
+
content: 'Nice. I can keep the conversation light while you work.',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
role: 'user',
|
|
133
|
+
content: 'What drink would you recommend for a late-night coding session?',
|
|
134
|
+
},
|
|
135
|
+
];
|
|
136
|
+
|
|
137
|
+
const response = await chatService.chatOnce(messages, false);
|
|
138
|
+
|
|
139
|
+
console.log(response);
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
For Copilot SDK:
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
import { createAgentChatService } from '@aituber-onair/chat/agent';
|
|
146
|
+
|
|
147
|
+
const chatService = createAgentChatService('copilot-sdk', {
|
|
148
|
+
model: 'gpt-4.1',
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const messages = [
|
|
152
|
+
{
|
|
153
|
+
role: 'system',
|
|
154
|
+
content:
|
|
155
|
+
'You are a friendly AI avatar for a live chat. Reply warmly and concisely.',
|
|
156
|
+
},
|
|
157
|
+
{ role: 'user', content: 'I am working on a TypeScript library tonight.' },
|
|
158
|
+
{
|
|
159
|
+
role: 'assistant',
|
|
160
|
+
content: 'Nice. I can keep the conversation light while you work.',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
role: 'user',
|
|
164
|
+
content: 'What drink would you recommend for a late-night coding session?',
|
|
165
|
+
},
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
const response = await chatService.chatOnce(messages, false);
|
|
169
|
+
|
|
170
|
+
console.log(response);
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Copilot SDK requires a permission request handler when creating a session. This
|
|
174
|
+
package defaults to denying SDK-managed tool execution for safety. If your
|
|
175
|
+
application wants to allow it, pass `onPermissionRequest` explicitly.
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
const chatService = createAgentChatService('copilot-sdk', {
|
|
179
|
+
model: 'gpt-4.1',
|
|
180
|
+
onPermissionRequest: () => ({ kind: 'approve-once' }),
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Authenticate the corresponding SDK locally before using these providers. If the
|
|
185
|
+
SDK package is missing or authentication is not ready, the provider throws an
|
|
186
|
+
error at runtime with the original SDK error details.
|
|
187
|
+
|
|
91
188
|
## Usage
|
|
92
189
|
|
|
93
190
|
### Basic Chat
|
|
@@ -162,6 +259,107 @@ Notes:
|
|
|
162
259
|
- The target server must satisfy the OpenAI-compatible API contract.
|
|
163
260
|
- This package does not depend on any specific local LLM product.
|
|
164
261
|
|
|
262
|
+
#### Agent SDK Providers
|
|
263
|
+
|
|
264
|
+
`@aituber-onair/chat/agent` exposes experimental providers for agent SDKs such
|
|
265
|
+
as Codex SDK and Copilot SDK. These providers are not included in the
|
|
266
|
+
browser/GAS UMD entry point and do not use API keys.
|
|
267
|
+
|
|
268
|
+
Install only the agent SDK package you actually use in your JavaScript runtime application:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
npm install @aituber-onair/chat @openai/codex-sdk
|
|
272
|
+
# or
|
|
273
|
+
npm install @aituber-onair/chat @github/copilot-sdk
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
`@openai/codex-sdk` and `@github/copilot-sdk` are not dependencies of
|
|
277
|
+
`@aituber-onair/chat`. They are loaded dynamically, so users who only use the
|
|
278
|
+
normal API providers do not install these agent SDK packages.
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
import { createAgentChatService } from '@aituber-onair/chat/agent';
|
|
282
|
+
|
|
283
|
+
const codexService = createAgentChatService('codex-sdk', {
|
|
284
|
+
workingDirectory: process.cwd(),
|
|
285
|
+
skipGitRepoCheck: true,
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
const messages = [
|
|
289
|
+
{
|
|
290
|
+
role: 'system',
|
|
291
|
+
content:
|
|
292
|
+
'You are a friendly AI avatar for a live chat. Keep a natural conversation going.',
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
role: 'user',
|
|
296
|
+
content: 'I am thinking about how to keep a side project moving.',
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
role: 'assistant',
|
|
300
|
+
content: 'Let us make it feel manageable and easy to restart.',
|
|
301
|
+
},
|
|
302
|
+
{ role: 'user', content: 'What should I work on first today?' },
|
|
303
|
+
];
|
|
304
|
+
|
|
305
|
+
const result = await codexService.chatOnce(messages, false, (text) =>
|
|
306
|
+
process.stdout.write(text),
|
|
307
|
+
);
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
For Copilot SDK, use `copilot-sdk`.
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
import { createAgentChatService } from '@aituber-onair/chat/agent';
|
|
314
|
+
|
|
315
|
+
const copilotService = createAgentChatService('copilot-sdk', {
|
|
316
|
+
model: 'gpt-4.1',
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
const messages = [
|
|
320
|
+
{
|
|
321
|
+
role: 'system',
|
|
322
|
+
content:
|
|
323
|
+
'You are a friendly AI avatar for a live chat. Keep a natural conversation going.',
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
role: 'user',
|
|
327
|
+
content: 'I am thinking about how to keep a side project moving.',
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
role: 'assistant',
|
|
331
|
+
content: 'Let us make it feel manageable and easy to restart.',
|
|
332
|
+
},
|
|
333
|
+
{ role: 'user', content: 'What should I work on first today?' },
|
|
334
|
+
];
|
|
335
|
+
|
|
336
|
+
const result = await copilotService.chatOnce(messages, false, (text) =>
|
|
337
|
+
process.stdout.write(text),
|
|
338
|
+
);
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Copilot SDK requires a permission request handler when creating a session. This
|
|
342
|
+
package defaults to denying SDK-managed tool execution for safety. If you want
|
|
343
|
+
to allow it, pass `onPermissionRequest` from your application. For example, to
|
|
344
|
+
allow all requests:
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
const copilotService = createAgentChatService('copilot-sdk', {
|
|
348
|
+
model: 'gpt-4.1',
|
|
349
|
+
onPermissionRequest: () => ({ kind: 'approve-once' }),
|
|
350
|
+
});
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
Available providers:
|
|
354
|
+
- `codex-sdk`: requires `@openai/codex-sdk` and Codex authentication.
|
|
355
|
+
- `copilot-sdk`: requires `@github/copilot-sdk` and GitHub Copilot authentication.
|
|
356
|
+
|
|
357
|
+
Current limitations:
|
|
358
|
+
- Text chat only.
|
|
359
|
+
- Vision chat, tools, and MCP servers are intentionally unsupported for now.
|
|
360
|
+
- If an agent SDK package is missing or local authentication is not ready, the
|
|
361
|
+
provider throws an error at runtime with the original SDK error details.
|
|
362
|
+
|
|
165
363
|
#### OpenAI-Compatible (Local/Self-Hosted)
|
|
166
364
|
|
|
167
365
|
Use `openai-compatible` when you want to clearly separate official OpenAI
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/agent.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./index"), exports);
|
|
18
|
+
__exportStar(require("./services/providers/agent"), exports);
|
|
19
|
+
const agent_1 = require("./services/providers/agent");
|
|
20
|
+
(0, agent_1.registerAgentChatProviders)();
|
|
21
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,6DAA2C;AAE3C,sDAAwE;AAExE,IAAA,kCAA0B,GAAE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChatResponseLength } from '../../../constants';
|
|
2
|
+
import { AgentTextChatService } from './shared';
|
|
3
|
+
export declare const DEFAULT_CODEX_SDK_MODEL = "codex-default";
|
|
4
|
+
type CodexSDKModule = {
|
|
5
|
+
Codex: new (options?: Record<string, unknown>) => CodexClient;
|
|
6
|
+
};
|
|
7
|
+
type CodexClient = {
|
|
8
|
+
startThread(options?: Record<string, unknown>): Promise<CodexThread>;
|
|
9
|
+
};
|
|
10
|
+
type CodexThread = {
|
|
11
|
+
run(prompt: string): Promise<CodexTurn>;
|
|
12
|
+
};
|
|
13
|
+
type CodexTurn = {
|
|
14
|
+
finalResponse?: unknown;
|
|
15
|
+
};
|
|
16
|
+
export type CodexSDKLoader = () => Promise<CodexSDKModule>;
|
|
17
|
+
export type CodexSDKChatServiceOptions = {
|
|
18
|
+
apiKey?: never;
|
|
19
|
+
model?: string;
|
|
20
|
+
responseLength?: ChatResponseLength;
|
|
21
|
+
workingDirectory?: string;
|
|
22
|
+
skipGitRepoCheck?: boolean;
|
|
23
|
+
config?: Record<string, unknown>;
|
|
24
|
+
};
|
|
25
|
+
export declare class CodexSDKChatService extends AgentTextChatService {
|
|
26
|
+
constructor(options?: CodexSDKChatServiceOptions, loadSDK?: CodexSDKLoader);
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=CodexSDKChatService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodexSDKChatService.d.ts","sourceRoot":"","sources":["../../../../../src/services/providers/agent/CodexSDKChatService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAA0B,MAAM,UAAU,CAAC;AAExE,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AAEvD,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,KAAK,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,WAAW,CAAC;CAC/D,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACtE,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CACzC,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;AAE3D,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF,qBAAa,mBAAoB,SAAQ,oBAAoB;gBAEzD,OAAO,GAAE,0BAA+B,EACxC,OAAO,GAAE,cAA6B;CAsBzC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodexSDKChatService = exports.DEFAULT_CODEX_SDK_MODEL = void 0;
|
|
4
|
+
const shared_1 = require("./shared");
|
|
5
|
+
exports.DEFAULT_CODEX_SDK_MODEL = 'codex-default';
|
|
6
|
+
class CodexSDKChatService extends shared_1.AgentTextChatService {
|
|
7
|
+
constructor(options = {}, loadSDK = loadCodexSDK) {
|
|
8
|
+
const model = options.model ?? exports.DEFAULT_CODEX_SDK_MODEL;
|
|
9
|
+
super({
|
|
10
|
+
provider: 'codex-sdk',
|
|
11
|
+
model,
|
|
12
|
+
defaultModel: exports.DEFAULT_CODEX_SDK_MODEL,
|
|
13
|
+
responseLength: options.responseLength,
|
|
14
|
+
getResponse: async (prompt, stream, onPartialResponse) => {
|
|
15
|
+
try {
|
|
16
|
+
const text = await runCodexPrompt(loadSDK, model, options, prompt);
|
|
17
|
+
if (stream) {
|
|
18
|
+
onPartialResponse(text);
|
|
19
|
+
}
|
|
20
|
+
return text;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw (0, shared_1.wrapAgentProviderError)('codex-sdk', error);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.CodexSDKChatService = CodexSDKChatService;
|
|
30
|
+
async function runCodexPrompt(loadSDK, model, options, prompt) {
|
|
31
|
+
const { Codex } = await loadSDK();
|
|
32
|
+
const codex = new Codex({
|
|
33
|
+
config: {
|
|
34
|
+
...options.config,
|
|
35
|
+
...(options.model ? { model } : {}),
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
const thread = await codex.startThread({
|
|
39
|
+
...(options.workingDirectory
|
|
40
|
+
? { workingDirectory: options.workingDirectory }
|
|
41
|
+
: {}),
|
|
42
|
+
...(options.skipGitRepoCheck !== undefined
|
|
43
|
+
? { skipGitRepoCheck: options.skipGitRepoCheck }
|
|
44
|
+
: {}),
|
|
45
|
+
});
|
|
46
|
+
const turn = await thread.run(prompt);
|
|
47
|
+
if (typeof turn.finalResponse !== 'string') {
|
|
48
|
+
throw new Error('codex-sdk provider received an empty response.');
|
|
49
|
+
}
|
|
50
|
+
return turn.finalResponse;
|
|
51
|
+
}
|
|
52
|
+
async function loadCodexSDK() {
|
|
53
|
+
try {
|
|
54
|
+
return (await dynamicImport('@openai/codex-sdk'));
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
const message = 'codex-sdk provider requires @openai/codex-sdk. ' +
|
|
58
|
+
'Install it in your Node.js project and authenticate with Codex.';
|
|
59
|
+
const wrappedError = new Error(message);
|
|
60
|
+
wrappedError.cause = error;
|
|
61
|
+
throw wrappedError;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const dynamicImport = new Function('specifier', 'return import(specifier)');
|
|
65
|
+
//# sourceMappingURL=CodexSDKChatService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodexSDKChatService.js","sourceRoot":"","sources":["../../../../../src/services/providers/agent/CodexSDKChatService.ts"],"names":[],"mappings":";;;AACA,qCAAwE;AAE3D,QAAA,uBAAuB,GAAG,eAAe,CAAC;AA6BvD,MAAa,mBAAoB,SAAQ,6BAAoB;IAC3D,YACE,UAAsC,EAAE,EACxC,UAA0B,YAAY;QAEtC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,+BAAuB,CAAC;QAEvD,KAAK,CAAC;YACJ,QAAQ,EAAE,WAAW;YACrB,KAAK;YACL,YAAY,EAAE,+BAAuB;YACrC,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE;gBACvD,IAAI,CAAC;oBACH,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;oBACnE,IAAI,MAAM,EAAE,CAAC;wBACX,iBAAiB,CAAC,IAAI,CAAC,CAAC;oBAC1B,CAAC;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,IAAA,+BAAsB,EAAC,WAAW,EAAE,KAAK,CAAC,CAAC;gBACnD,CAAC;YACH,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAzBD,kDAyBC;AAED,KAAK,UAAU,cAAc,CAC3B,OAAuB,EACvB,KAAa,EACb,OAAmC,EACnC,MAAc;IAEd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,OAAO,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC;QACtB,MAAM,EAAE;YACN,GAAG,OAAO,CAAC,MAAM;YACjB,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpC;KACF,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC;QACrC,GAAG,CAAC,OAAO,CAAC,gBAAgB;YAC1B,CAAC,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE;YAChD,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,OAAO,CAAC,gBAAgB,KAAK,SAAS;YACxC,CAAC,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE;YAChD,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAEtC,IAAI,OAAO,IAAI,CAAC,aAAa,KAAK,QAAQ,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,IAAI,CAAC,aAAa,CAAC;AAC5B,CAAC;AAED,KAAK,UAAU,YAAY;IACzB,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,aAAa,CAAC,mBAAmB,CAAC,CAAmB,CAAC;IACtE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GACX,iDAAiD;YACjD,iEAAiE,CAAC;QACpE,MAAM,YAAY,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QACvC,YAAoC,CAAC,KAAK,GAAG,KAAK,CAAC;QACpD,MAAM,YAAY,CAAC;IACrB,CAAC;AACH,CAAC;AAED,MAAM,aAAa,GAAG,IAAI,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAErD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ChatService } from '../../ChatService';
|
|
2
|
+
import { ChatServiceProvider, VisionSupportLevel } from '../ChatServiceProvider';
|
|
3
|
+
import { CodexSDKChatServiceOptions, CodexSDKLoader } from './CodexSDKChatService';
|
|
4
|
+
export declare class CodexSDKChatServiceProvider implements ChatServiceProvider<CodexSDKChatServiceOptions> {
|
|
5
|
+
private loadSDK?;
|
|
6
|
+
constructor(loadSDK?: CodexSDKLoader | undefined);
|
|
7
|
+
createChatService(options: CodexSDKChatServiceOptions): ChatService;
|
|
8
|
+
getProviderName(): string;
|
|
9
|
+
getSupportedModels(): string[];
|
|
10
|
+
getDefaultModel(): string;
|
|
11
|
+
supportsVision(): boolean;
|
|
12
|
+
getVisionSupportLevel(): VisionSupportLevel;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=CodexSDKChatServiceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodexSDKChatServiceProvider.d.ts","sourceRoot":"","sources":["../../../../../src/services/providers/agent/CodexSDKChatServiceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,0BAA0B,EAC1B,cAAc,EAEf,MAAM,uBAAuB,CAAC;AAG/B,qBAAa,2BACX,YAAW,mBAAmB,CAAC,0BAA0B,CAAC;IAE9C,OAAO,CAAC,OAAO,CAAC;gBAAR,OAAO,CAAC,EAAE,cAAc,YAAA;IAE5C,iBAAiB,CAAC,OAAO,EAAE,0BAA0B,GAAG,WAAW;IAKnE,eAAe,IAAI,MAAM;IAIzB,kBAAkB,IAAI,MAAM,EAAE;IAI9B,eAAe,IAAI,MAAM;IAIzB,cAAc,IAAI,OAAO;IAIzB,qBAAqB,IAAI,kBAAkB;CAG5C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodexSDKChatServiceProvider = void 0;
|
|
4
|
+
const CodexSDKChatService_1 = require("./CodexSDKChatService");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
class CodexSDKChatServiceProvider {
|
|
7
|
+
constructor(loadSDK) {
|
|
8
|
+
this.loadSDK = loadSDK;
|
|
9
|
+
}
|
|
10
|
+
createChatService(options) {
|
|
11
|
+
(0, shared_1.rejectUnsupportedAgentOptions)(this.getProviderName(), options);
|
|
12
|
+
return new CodexSDKChatService_1.CodexSDKChatService(options, this.loadSDK);
|
|
13
|
+
}
|
|
14
|
+
getProviderName() {
|
|
15
|
+
return 'codex-sdk';
|
|
16
|
+
}
|
|
17
|
+
getSupportedModels() {
|
|
18
|
+
return [CodexSDKChatService_1.DEFAULT_CODEX_SDK_MODEL];
|
|
19
|
+
}
|
|
20
|
+
getDefaultModel() {
|
|
21
|
+
return CodexSDKChatService_1.DEFAULT_CODEX_SDK_MODEL;
|
|
22
|
+
}
|
|
23
|
+
supportsVision() {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
getVisionSupportLevel() {
|
|
27
|
+
return 'unsupported';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.CodexSDKChatServiceProvider = CodexSDKChatServiceProvider;
|
|
31
|
+
//# sourceMappingURL=CodexSDKChatServiceProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodexSDKChatServiceProvider.js","sourceRoot":"","sources":["../../../../../src/services/providers/agent/CodexSDKChatServiceProvider.ts"],"names":[],"mappings":";;;AAKA,+DAK+B;AAC/B,qCAAyD;AAEzD,MAAa,2BAA2B;IAGtC,YAAoB,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;IAAG,CAAC;IAEhD,iBAAiB,CAAC,OAAmC;QACnD,IAAA,sCAA6B,EAAC,IAAI,CAAC,eAAe,EAAE,EAAE,OAAO,CAAC,CAAC;QAC/D,OAAO,IAAI,yCAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,eAAe;QACb,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,kBAAkB;QAChB,OAAO,CAAC,6CAAuB,CAAC,CAAC;IACnC,CAAC;IAED,eAAe;QACb,OAAO,6CAAuB,CAAC;IACjC,CAAC;IAED,cAAc;QACZ,OAAO,KAAK,CAAC;IACf,CAAC;IAED,qBAAqB;QACnB,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AA7BD,kEA6BC"}
|