@estuary-ai/sdk 0.1.1 → 0.1.2

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 estuary.ai
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 estuary.ai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,152 +1,152 @@
1
- # @estuary-ai/sdk
2
-
3
- TypeScript SDK for the [Estuary](https://www.estuary-ai.com) real-time AI conversation platform. Build applications with persistent AI characters that remember, hear, and see.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @estuary-ai/sdk
9
- ```
10
-
11
- For LiveKit voice (optional, lower latency):
12
-
13
- ```bash
14
- npm install @estuary-ai/sdk livekit-client
15
- ```
16
-
17
- ## Quick Start
18
-
19
- ```typescript
20
- import { EstuaryClient } from '@estuary-ai/sdk';
21
-
22
- const client = new EstuaryClient({
23
- serverUrl: 'https://api.estuary-ai.com',
24
- apiKey: 'est_your_api_key',
25
- characterId: 'your-character-id',
26
- playerId: 'user-123',
27
- });
28
-
29
- client.on('botResponse', (response) => {
30
- process.stdout.write(response.text);
31
- if (response.isFinal) console.log();
32
- });
33
-
34
- await client.connect();
35
- client.sendText('Hello!');
36
- ```
37
-
38
- ## Features
39
-
40
- ### Text Chat
41
-
42
- ```typescript
43
- client.sendText('What do you remember about me?');
44
- client.sendText('Just respond in text', true); // textOnly mode
45
- ```
46
-
47
- ### Voice (WebSocket)
48
-
49
- ```typescript
50
- const client = new EstuaryClient({
51
- serverUrl: 'https://api.estuary-ai.com',
52
- apiKey: 'est_...',
53
- characterId: '...',
54
- playerId: '...',
55
- voiceTransport: 'websocket',
56
- });
57
-
58
- await client.connect();
59
- await client.startVoice(); // Requests mic permission
60
- // ... speak, receive audio responses
61
- client.stopVoice();
62
- ```
63
-
64
- ### Voice (LiveKit)
65
-
66
- ```typescript
67
- const client = new EstuaryClient({
68
- // ...
69
- voiceTransport: 'livekit', // or 'auto' to prefer LiveKit
70
- });
71
-
72
- await client.connect();
73
- await client.startVoice();
74
- client.toggleMute();
75
- ```
76
-
77
- ### Memory & Knowledge Graph
78
-
79
- ```typescript
80
- const memories = await client.memory.getMemories({ status: 'active', limit: 50 });
81
- const facts = await client.memory.getCoreFacts();
82
- const graph = await client.memory.getGraph({ includeEntities: true });
83
- const results = await client.memory.search('favorite food');
84
- ```
85
-
86
- ### Real-Time Memory Extraction
87
-
88
- Enable `realtimeMemory` to receive live notifications when the server extracts memories from conversation:
89
-
90
- ```typescript
91
- const client = new EstuaryClient({
92
- serverUrl: 'https://api.estuary-ai.com',
93
- apiKey: 'est_...',
94
- characterId: '...',
95
- playerId: '...',
96
- realtimeMemory: true,
97
- });
98
-
99
- client.on('memoryUpdated', (event) => {
100
- console.log(`Extracted ${event.memoriesExtracted} memories, ${event.factsExtracted} facts`);
101
- for (const mem of event.newMemories) {
102
- console.log(` [${mem.memoryType}] ${mem.content} (confidence: ${mem.confidence})`);
103
- }
104
- });
105
-
106
- await client.connect();
107
- ```
108
-
109
- ## Events
110
-
111
- ```typescript
112
- client.on('connected', (session) => { /* authenticated */ });
113
- client.on('disconnected', (reason) => { /* lost connection */ });
114
- client.on('botResponse', (response) => { /* streaming text */ });
115
- client.on('botVoice', (voice) => { /* audio chunk */ });
116
- client.on('sttResponse', (stt) => { /* speech-to-text */ });
117
- client.on('interrupt', (data) => { /* response interrupted */ });
118
- client.on('memoryUpdated', (event) => { /* real-time memory extraction */ });
119
- client.on('error', (error) => { /* EstuaryError */ });
120
- client.on('quotaExceeded', (data) => { /* rate limited */ });
121
- ```
122
-
123
- ## Configuration
124
-
125
- ```typescript
126
- interface EstuaryConfig {
127
- serverUrl: string; // Server URL
128
- apiKey: string; // API key (est_...)
129
- characterId: string; // Character ID
130
- playerId: string; // End user ID
131
- audioSampleRate?: number; // Default: 16000
132
- autoReconnect?: boolean; // Default: true
133
- maxReconnectAttempts?: number; // Default: 5
134
- reconnectDelayMs?: number; // Default: 2000
135
- debug?: boolean; // Default: false
136
- voiceTransport?: 'websocket' | 'livekit' | 'auto'; // Default: 'auto'
137
- realtimeMemory?: boolean; // Enable real-time memory extraction events. Default: false
138
- }
139
- ```
140
-
141
- ## Requirements
142
-
143
- - Node.js 18+ or modern browser
144
- - Estuary account with API key and Character ID
145
-
146
- ## Documentation
147
-
148
- Full documentation at [docs.estuary-ai.com](https://docs.estuary-ai.com/docs/typescript-sdk/getting-started).
149
-
150
- ## License
151
-
152
- MIT
1
+ # @estuary-ai/sdk
2
+
3
+ TypeScript SDK for the [Estuary](https://www.estuary-ai.com) real-time AI conversation platform. Build applications with persistent AI characters that remember, hear, and see.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @estuary-ai/sdk
9
+ ```
10
+
11
+ For LiveKit voice (optional, lower latency):
12
+
13
+ ```bash
14
+ npm install @estuary-ai/sdk livekit-client
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ```typescript
20
+ import { EstuaryClient } from '@estuary-ai/sdk';
21
+
22
+ const client = new EstuaryClient({
23
+ serverUrl: 'https://api.estuary-ai.com',
24
+ apiKey: 'est_your_api_key',
25
+ characterId: 'your-character-id',
26
+ playerId: 'user-123',
27
+ });
28
+
29
+ client.on('botResponse', (response) => {
30
+ process.stdout.write(response.text);
31
+ if (response.isFinal) console.log();
32
+ });
33
+
34
+ await client.connect();
35
+ client.sendText('Hello!');
36
+ ```
37
+
38
+ ## Features
39
+
40
+ ### Text Chat
41
+
42
+ ```typescript
43
+ client.sendText('What do you remember about me?');
44
+ client.sendText('Just respond in text', true); // textOnly mode
45
+ ```
46
+
47
+ ### Voice (WebSocket)
48
+
49
+ ```typescript
50
+ const client = new EstuaryClient({
51
+ serverUrl: 'https://api.estuary-ai.com',
52
+ apiKey: 'est_...',
53
+ characterId: '...',
54
+ playerId: '...',
55
+ voiceTransport: 'websocket',
56
+ });
57
+
58
+ await client.connect();
59
+ await client.startVoice(); // Requests mic permission
60
+ // ... speak, receive audio responses
61
+ client.stopVoice();
62
+ ```
63
+
64
+ ### Voice (LiveKit)
65
+
66
+ ```typescript
67
+ const client = new EstuaryClient({
68
+ // ...
69
+ voiceTransport: 'livekit', // or 'auto' to prefer LiveKit
70
+ });
71
+
72
+ await client.connect();
73
+ await client.startVoice();
74
+ client.toggleMute();
75
+ ```
76
+
77
+ ### Memory & Knowledge Graph
78
+
79
+ ```typescript
80
+ const memories = await client.memory.getMemories({ status: 'active', limit: 50 });
81
+ const facts = await client.memory.getCoreFacts();
82
+ const graph = await client.memory.getGraph({ includeEntities: true });
83
+ const results = await client.memory.search('favorite food');
84
+ ```
85
+
86
+ ### Real-Time Memory Extraction
87
+
88
+ Enable `realtimeMemory` to receive live notifications when the server extracts memories from conversation:
89
+
90
+ ```typescript
91
+ const client = new EstuaryClient({
92
+ serverUrl: 'https://api.estuary-ai.com',
93
+ apiKey: 'est_...',
94
+ characterId: '...',
95
+ playerId: '...',
96
+ realtimeMemory: true,
97
+ });
98
+
99
+ client.on('memoryUpdated', (event) => {
100
+ console.log(`Extracted ${event.memoriesExtracted} memories, ${event.factsExtracted} facts`);
101
+ for (const mem of event.newMemories) {
102
+ console.log(` [${mem.memoryType}] ${mem.content} (confidence: ${mem.confidence})`);
103
+ }
104
+ });
105
+
106
+ await client.connect();
107
+ ```
108
+
109
+ ## Events
110
+
111
+ ```typescript
112
+ client.on('connected', (session) => { /* authenticated */ });
113
+ client.on('disconnected', (reason) => { /* lost connection */ });
114
+ client.on('botResponse', (response) => { /* streaming text */ });
115
+ client.on('botVoice', (voice) => { /* audio chunk */ });
116
+ client.on('sttResponse', (stt) => { /* speech-to-text */ });
117
+ client.on('interrupt', (data) => { /* response interrupted */ });
118
+ client.on('memoryUpdated', (event) => { /* real-time memory extraction */ });
119
+ client.on('error', (error) => { /* EstuaryError */ });
120
+ client.on('quotaExceeded', (data) => { /* rate limited */ });
121
+ ```
122
+
123
+ ## Configuration
124
+
125
+ ```typescript
126
+ interface EstuaryConfig {
127
+ serverUrl: string; // Server URL
128
+ apiKey: string; // API key (est_...)
129
+ characterId: string; // Character ID
130
+ playerId: string; // End user ID
131
+ audioSampleRate?: number; // Default: 16000
132
+ autoReconnect?: boolean; // Default: true
133
+ maxReconnectAttempts?: number; // Default: 5
134
+ reconnectDelayMs?: number; // Default: 2000
135
+ debug?: boolean; // Default: false
136
+ voiceTransport?: 'websocket' | 'livekit' | 'auto'; // Default: 'auto'
137
+ realtimeMemory?: boolean; // Enable real-time memory extraction events. Default: false
138
+ }
139
+ ```
140
+
141
+ ## Requirements
142
+
143
+ - Node.js 18+ or modern browser
144
+ - Estuary account with API key and Character ID
145
+
146
+ ## Documentation
147
+
148
+ Full documentation at [docs.estuary-ai.com](https://docs.estuary-ai.com/docs/typescript-sdk/getting-started).
149
+
150
+ ## License
151
+
152
+ MIT
@@ -0,0 +1,36 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/errors.ts
8
+ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
9
+ ErrorCode2["CONNECTION_FAILED"] = "CONNECTION_FAILED";
10
+ ErrorCode2["AUTH_FAILED"] = "AUTH_FAILED";
11
+ ErrorCode2["CONNECTION_TIMEOUT"] = "CONNECTION_TIMEOUT";
12
+ ErrorCode2["QUOTA_EXCEEDED"] = "QUOTA_EXCEEDED";
13
+ ErrorCode2["VOICE_NOT_SUPPORTED"] = "VOICE_NOT_SUPPORTED";
14
+ ErrorCode2["VOICE_ALREADY_ACTIVE"] = "VOICE_ALREADY_ACTIVE";
15
+ ErrorCode2["VOICE_NOT_ACTIVE"] = "VOICE_NOT_ACTIVE";
16
+ ErrorCode2["LIVEKIT_UNAVAILABLE"] = "LIVEKIT_UNAVAILABLE";
17
+ ErrorCode2["MICROPHONE_DENIED"] = "MICROPHONE_DENIED";
18
+ ErrorCode2["NOT_CONNECTED"] = "NOT_CONNECTED";
19
+ ErrorCode2["REST_ERROR"] = "REST_ERROR";
20
+ ErrorCode2["UNKNOWN"] = "UNKNOWN";
21
+ return ErrorCode2;
22
+ })(ErrorCode || {});
23
+ var EstuaryError = class extends Error {
24
+ code;
25
+ details;
26
+ constructor(code, message, details) {
27
+ super(message);
28
+ this.name = "EstuaryError";
29
+ this.code = code;
30
+ this.details = details;
31
+ }
32
+ };
33
+
34
+ export { ErrorCode, EstuaryError, __export };
35
+ //# sourceMappingURL=chunk-64CWCRPS.mjs.map
36
+ //# sourceMappingURL=chunk-64CWCRPS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors.ts"],"names":["ErrorCode"],"mappings":";;;;;;;AAAO,IAAK,SAAA,qBAAAA,UAAAA,KAAL;AACL,EAAAA,WAAA,mBAAA,CAAA,GAAoB,mBAAA;AACpB,EAAAA,WAAA,aAAA,CAAA,GAAc,aAAA;AACd,EAAAA,WAAA,oBAAA,CAAA,GAAqB,oBAAA;AACrB,EAAAA,WAAA,gBAAA,CAAA,GAAiB,gBAAA;AACjB,EAAAA,WAAA,qBAAA,CAAA,GAAsB,qBAAA;AACtB,EAAAA,WAAA,sBAAA,CAAA,GAAuB,sBAAA;AACvB,EAAAA,WAAA,kBAAA,CAAA,GAAmB,kBAAA;AACnB,EAAAA,WAAA,qBAAA,CAAA,GAAsB,qBAAA;AACtB,EAAAA,WAAA,mBAAA,CAAA,GAAoB,mBAAA;AACpB,EAAAA,WAAA,eAAA,CAAA,GAAgB,eAAA;AAChB,EAAAA,WAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,WAAA,SAAA,CAAA,GAAU,SAAA;AAZA,EAAA,OAAAA,UAAAA;AAAA,CAAA,EAAA,SAAA,IAAA,EAAA;AAeL,IAAM,YAAA,GAAN,cAA2B,KAAA,CAAM;AAAA,EAC7B,IAAA;AAAA,EACA,OAAA;AAAA,EAET,WAAA,CAAY,IAAA,EAAiB,OAAA,EAAiB,OAAA,EAAmB;AAC/D,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AAAA,EACjB;AACF","file":"chunk-64CWCRPS.mjs","sourcesContent":["export enum ErrorCode {\n CONNECTION_FAILED = 'CONNECTION_FAILED',\n AUTH_FAILED = 'AUTH_FAILED',\n CONNECTION_TIMEOUT = 'CONNECTION_TIMEOUT',\n QUOTA_EXCEEDED = 'QUOTA_EXCEEDED',\n VOICE_NOT_SUPPORTED = 'VOICE_NOT_SUPPORTED',\n VOICE_ALREADY_ACTIVE = 'VOICE_ALREADY_ACTIVE',\n VOICE_NOT_ACTIVE = 'VOICE_NOT_ACTIVE',\n LIVEKIT_UNAVAILABLE = 'LIVEKIT_UNAVAILABLE',\n MICROPHONE_DENIED = 'MICROPHONE_DENIED',\n NOT_CONNECTED = 'NOT_CONNECTED',\n REST_ERROR = 'REST_ERROR',\n UNKNOWN = 'UNKNOWN',\n}\n\nexport class EstuaryError extends Error {\n readonly code: ErrorCode;\n readonly details?: unknown;\n\n constructor(code: ErrorCode, message: string, details?: unknown) {\n super(message);\n this.name = 'EstuaryError';\n this.code = code;\n this.details = details;\n }\n}\n"]}