@ai-ecoverse/pi-audio 1.7.0 → 1.9.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.
@@ -0,0 +1,51 @@
1
+ import { registerVoiceModel } from "../models.js";
2
+ import {
3
+ connectVendorSession,
4
+ pcmFormat
5
+ } from "../openai-realtime/session.js";
6
+ import { registerRealtimeApiProvider } from "../registry.js";
7
+ const voices = [
8
+ { id: "eve", name: "Eve" },
9
+ { id: "ara", name: "Ara" },
10
+ { id: "rex", name: "Rex" },
11
+ { id: "sal", name: "Sal" },
12
+ { id: "leo", name: "Leo" }
13
+ ];
14
+ const grokVoiceLatest = {
15
+ id: "grok-voice-latest",
16
+ name: "Grok Voice",
17
+ api: "xai-realtime",
18
+ provider: "xai",
19
+ baseUrl: "wss://api.x.ai/v1/realtime",
20
+ type: "realtime",
21
+ transports: ["websocket", "webrtc"],
22
+ toolCalls: "blocking",
23
+ inputFormat: pcmFormat(24e3),
24
+ outputFormat: pcmFormat(24e3),
25
+ maxSessionMs: 72e5,
26
+ resumable: true,
27
+ ephemeralAuth: true,
28
+ voices,
29
+ provisioning: "none",
30
+ delivery: { interrupt: "native", when_idle: "approximate", silent: "native" },
31
+ truncation: "client",
32
+ liveToolUpdate: true,
33
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
34
+ audioCost: { perInputMinute: 0.08, perOutputMinute: 0.08, perTextMessage: 4e-3 }
35
+ };
36
+ function registerXaiRealtime(options = {}) {
37
+ const unregisterModel = registerVoiceModel(grokVoiceLatest);
38
+ const unregisterApi = registerRealtimeApiProvider({
39
+ api: "xai-realtime",
40
+ connect: (model, context, connectOptions) => connectVendorSession(model, context, connectOptions, { ...options, dialect: "xai" })
41
+ });
42
+ return () => {
43
+ unregisterModel();
44
+ unregisterApi();
45
+ };
46
+ }
47
+ export {
48
+ grokVoiceLatest,
49
+ registerXaiRealtime
50
+ };
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/xai/index.ts"],
4
+ "sourcesContent": ["import type { RealtimeModel } from '../models.ts';\nimport { registerVoiceModel } from '../models.ts';\nimport {\n type AdapterOptions,\n connectVendorSession,\n pcmFormat,\n} from '../openai-realtime/session.ts';\nimport { registerRealtimeApiProvider } from '../registry.ts';\n\nconst voices = [\n { id: 'eve', name: 'Eve' },\n { id: 'ara', name: 'Ara' },\n { id: 'rex', name: 'Rex' },\n { id: 'sal', name: 'Sal' },\n { id: 'leo', name: 'Leo' },\n];\n\nexport const grokVoiceLatest: RealtimeModel<'xai-realtime'> = {\n id: 'grok-voice-latest',\n name: 'Grok Voice',\n api: 'xai-realtime',\n provider: 'xai',\n baseUrl: 'wss://api.x.ai/v1/realtime',\n type: 'realtime',\n transports: ['websocket', 'webrtc'],\n toolCalls: 'blocking',\n inputFormat: pcmFormat(24000),\n outputFormat: pcmFormat(24000),\n maxSessionMs: 7_200_000,\n resumable: true,\n ephemeralAuth: true,\n voices,\n provisioning: 'none',\n delivery: { interrupt: 'native', when_idle: 'approximate', silent: 'native' },\n truncation: 'client',\n liveToolUpdate: true,\n cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n audioCost: { perInputMinute: 0.08, perOutputMinute: 0.08, perTextMessage: 0.004 },\n};\n\nexport function registerXaiRealtime(options: AdapterOptions = {}): () => void {\n const unregisterModel = registerVoiceModel(grokVoiceLatest);\n const unregisterApi = registerRealtimeApiProvider({\n api: 'xai-realtime',\n connect: (model, context, connectOptions) =>\n connectVendorSession(model, context, connectOptions, { ...options, dialect: 'xai' }),\n });\n return () => {\n unregisterModel();\n unregisterApi();\n };\n}\n"],
5
+ "mappings": "AACA,SAAS,0BAA0B;AACnC;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AACP,SAAS,mCAAmC;AAE5C,MAAM,SAAS;AAAA,EACb,EAAE,IAAI,OAAO,MAAM,MAAM;AAAA,EACzB,EAAE,IAAI,OAAO,MAAM,MAAM;AAAA,EACzB,EAAE,IAAI,OAAO,MAAM,MAAM;AAAA,EACzB,EAAE,IAAI,OAAO,MAAM,MAAM;AAAA,EACzB,EAAE,IAAI,OAAO,MAAM,MAAM;AAC3B;AAEO,MAAM,kBAAiD;AAAA,EAC5D,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,KAAK;AAAA,EACL,UAAU;AAAA,EACV,SAAS;AAAA,EACT,MAAM;AAAA,EACN,YAAY,CAAC,aAAa,QAAQ;AAAA,EAClC,WAAW;AAAA,EACX,aAAa,UAAU,IAAK;AAAA,EAC5B,cAAc,UAAU,IAAK;AAAA,EAC7B,cAAc;AAAA,EACd,WAAW;AAAA,EACX,eAAe;AAAA,EACf;AAAA,EACA,cAAc;AAAA,EACd,UAAU,EAAE,WAAW,UAAU,WAAW,eAAe,QAAQ,SAAS;AAAA,EAC5E,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,EAAE;AAAA,EACzD,WAAW,EAAE,gBAAgB,MAAM,iBAAiB,MAAM,gBAAgB,KAAM;AAClF;AAEO,SAAS,oBAAoB,UAA0B,CAAC,GAAe;AAC5E,QAAM,kBAAkB,mBAAmB,eAAe;AAC1D,QAAM,gBAAgB,4BAA4B;AAAA,IAChD,KAAK;AAAA,IACL,SAAS,CAAC,OAAO,SAAS,mBACxB,qBAAqB,OAAO,SAAS,gBAAgB,EAAE,GAAG,SAAS,SAAS,MAAM,CAAC;AAAA,EACvF,CAAC;AACD,SAAO,MAAM;AACX,oBAAgB;AAChB,kBAAc;AAAA,EAChB;AACF;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/pi-audio",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "Voice bindings for pi: speech-to-text, text-to-speech and realtime speech for pi-coding-agent plugins and slicc-agent",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -30,6 +30,10 @@
30
30
  "types": "./dist/types/faux/index.d.ts",
31
31
  "default": "./dist/faux/index.js"
32
32
  },
33
+ "./openai-realtime": {
34
+ "types": "./dist/types/openai-realtime/index.d.ts",
35
+ "default": "./dist/openai-realtime/index.js"
36
+ },
33
37
  "./worklet": {
34
38
  "types": "./dist/types/worklet/convert.d.ts",
35
39
  "default": "./dist/worklet/convert.js"
@@ -37,6 +41,10 @@
37
41
  "./openai": {
38
42
  "types": "./dist/types/openai/index.d.ts",
39
43
  "default": "./dist/openai/index.js"
44
+ },
45
+ "./xai": {
46
+ "types": "./dist/types/xai/index.d.ts",
47
+ "default": "./dist/xai/index.js"
40
48
  }
41
49
  },
42
50
  "files": [
@@ -57,7 +65,7 @@
57
65
  "release": "semantic-release"
58
66
  },
59
67
  "devDependencies": {
60
- "@ai-ecoverse/slicc-shared-web": "1.21.0",
68
+ "@ai-ecoverse/slicc-shared-web": "1.21.1",
61
69
  "@biomejs/biome": "2.5.15",
62
70
  "@earendil-works/pi-ai": "1.1.0",
63
71
  "@types/node": "24.19.1",