リファレンス
JavaScript SDKリファレンス
プレビュー版:機能とAPIは変更される場合があります。
PDFはブラウザーの印刷ダイアログで作成します。ホスト型のエクスポートサービスではありません。
パッケージ:@onesay/sdk、ライセンス:Apache-2.0。
環境#
環境ごとに専用のControl APIとRealtime WebSocketのエンドポイントがあります。
| 環境 | Control API | Realtime WebSocket |
|---|---|---|
| 本番環境 | https://api.onesay.com/v1 | wss://realtime.onesay.com/v1 |
| Staging | https://api.staging.onesay.com/v1 | wss://realtime.staging.onesay.com/v1 |
ルームのイベント#
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のケイパビリティと互換性も参照してください。
元のMarkdownを表示
# JavaScript SDK パッケージ:`@onesay/sdk`、ライセンス:`Apache-2.0`。 ## 環境 環境ごとに専用のControl APIとRealtime WebSocketのエンドポイントがあります。 | 環境 | Control API | Realtime WebSocket | |---|---|---| | 本番環境 | `https://api.onesay.com/v1` | `wss://realtime.onesay.com/v1` | | Staging | `https://api.staging.onesay.com/v1` | `wss://realtime.staging.onesay.com/v1` | ## ルームのイベント SDKのイベント名と、それが通知するOneSayのイベントです。 - `Connected` -> `room.connected` - `Disconnected` -> `room.disconnected` - `Reconnecting` -> `room.reconnecting` - `Reconnected` -> `room.reconnected` - `ParticipantJoined` -> `participant.joined` - `ParticipantLeft` -> `participant.left` - `SignalOpened` -> `signal.opened` - `SignalEnded` -> `signal.ended` - `Error` -> `error` ## タスクのイベント SDKのイベント名と、それが通知するOneSayのイベントです。 - `Created` -> `task.created` - `Started` -> `task.started` - `TranscriptPartial` -> `artifact.delta` - `TranscriptFinal` -> `artifact.finalized` - `Completed` -> `task.completed` - `Failed` -> `task.failed` - `Cancelled` -> `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セッションの状態 - `connected` - `reconnecting` - `closed` セッションの状態は、このクライアントが観測した状態です。認可はすべてサーバーが判断し、失効はサーバーが有効になったと報告した時点で完了します。 ## ケイパビリティ | ケイパビリティ | 対応状況 | 詳細 | |---|---|---| | タスク音声(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のケイパビリティと互換性](sdk-compatibility.md)も参照してください。