@erdoai/server 0.1.9 → 0.1.10
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/dist/index.d.ts +30 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,36 @@ declare class ErdoClient {
|
|
|
22
22
|
* The returned token can be passed to a client-side ErdoClient for
|
|
23
23
|
* scoped access to specific bots.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
25
|
+
* ## External User IDs
|
|
26
|
+
*
|
|
27
|
+
* Use `externalUserId` to associate threads with your users. This enables:
|
|
28
|
+
* - `listThreads()` returns only that user's threads
|
|
29
|
+
* - Thread access is automatically scoped to the user
|
|
30
|
+
*
|
|
31
|
+
* **Important**: Store the external user ID in your database so you can
|
|
32
|
+
* create tokens with the same ID when the user returns:
|
|
33
|
+
*
|
|
34
|
+
* ```typescript
|
|
35
|
+
* // In your database (e.g., users table):
|
|
36
|
+
* // { id: 'user-abc', email: '...', erdo_external_user_id: 'ext-123' }
|
|
37
|
+
*
|
|
38
|
+
* // When creating tokens, use the stored ID:
|
|
39
|
+
* const user = await db.users.find(userId);
|
|
40
|
+
* const { token } = await serverClient.createToken({
|
|
41
|
+
* botKeys: ['my-org.data-analyst'],
|
|
42
|
+
* externalUserId: user.erdo_external_user_id, // Persisted ID
|
|
43
|
+
* expiresInSeconds: 3600,
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* // User can now list their threads from previous sessions
|
|
47
|
+
* const { threads } = await clientClient.listThreads();
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* The external user ID can be your own user ID or a separate UUID you generate
|
|
51
|
+
* once per user and store. It's embedded in the token and never exposed to
|
|
52
|
+
* the client - users cannot access other users' threads.
|
|
53
|
+
*
|
|
54
|
+
* @example Basic token creation
|
|
26
55
|
* ```typescript
|
|
27
56
|
* // Server-side: Create a token for the frontend
|
|
28
57
|
* const serverClient = new ErdoClient({ authToken: process.env.ERDO_AUTH_TOKEN });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erdoai/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Erdo server SDK for invoking agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"directory": "packages/server"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@erdoai/types": "^0.1.
|
|
43
|
+
"@erdoai/types": "^0.1.9"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^24.10.1",
|