パッケージ:@onesay/sdk、ライセンス:Apache-2.0。
環境
環境ごとに専用の中枢APIとRealtime WebSocketのエンドポイントがあります。
| 環境 | 中枢API | Realtime WebSocket |
|---|---|---|
| 本番環境 | https://api.onesay.com/v1 | wss://realtime.onesay.com/v1 |
ほかのリージョンのノードに接続する場合は、設定から読み込んだアドレスでsetCustomEndpointsを呼び出し、environment: "custom"を使ってください。
ルームのイベント
SDKのイベント名と、それが通知するOneSayのイベントです。
Connected->room.connectedDisconnected->room.disconnectedReconnecting->room.reconnectingReconnected->room.reconnectedParticipantJoined->participant.joinedParticipantLeft->participant.leftSignalOpened->signal.openedSignalEnded->signal.endedError->error
タスクのイベント
SDKのイベント名と、それが通知するOneSayのイベントです。
Created->task.createdStarted->task.startedTranscriptPartial->artifact.deltaTranscriptFinal->artifact.finalizedCompleted->task.completedFailed->task.failedCancelled->task.cancelled
ブラウザーでは、SDKは指定されたトークンプロバイダーだけで認証し、シークレットキーは使いません。タスク音声は渡された音声(16000 Hz、モノラル、pcm_s16le)を送信します。SDKはそのためにマイクを開かず、音声を黙って破棄することもありません。サンプルバッファーを変換するヘルパーも用意しています。
タスク音声
- エントリポイント:
client.tasks.create,client.tasks.get,client.tasks.list,client.tasks.cancel,RealtimeClient - トランスポート:onesay.realtime.v1 WebSocket with canonical PCM frames, contiguous ACK, unacked-only replay and bounded resume
- 結果:Task and Artifact readback
リアルタイム音声(RTC)
- エントリポイント:
client.rtc.connect,client.rtc.get,client.rtc.revoke,client.rtc.endPublication,client.rtc.agents.create,client.rtc.agents.get,client.rtc.agents.stop - トランスポート:OneSay RTC session over the locked native SDK, loaded lazily on the first RTC operation
- 結果:publications, subscriptions, packets, streams, RPC, data tracks and explicit Agent executions
RTCセッションの状態
connectedreconnectingclosed
セッションの状態は、このクライアントが観測した状態です。認可はすべてサーバーが判断し、失効はサーバーが有効になったと報告した時点で完了します。
ケイパビリティ
| ケイパビリティ | 対応状況 | 詳細 |
|---|---|---|
| タスク音声(WSS、ACK、リプレイ、再開) | 対応 | Supported (browser, Node) |
| RTCオーディオ | 対応 | Publish, subscribe, mute, playback (browser) |
| パケット | 対応 | Send and receive |
| ストリーム | 対応 | Send and receive |
| RPC | 対応 | Call and handle |
| DataTrack | 対応 | Supported (livekit-client 2.22.3) |
| Agent | 対応 | Explicit Agent executions and read-only Agent state |
| 状態、デバイス、エラー、解放 | 対応 | Session state, quality, microphone selection, OneSay errors, close |
| 選択モードのメディア暗号化 | 条件付き | Conditional: where the browser can run the packaged worker |
公開しないもの:native room, track and participant objects、native token or connection material、native SDK types、an escape hatch to the native SDK。未対応のケイパビリティは明示的なエラーで失敗します。
SDKのケイパビリティと互換性も参照してください。