oblien 1.0.6 → 1.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oblien",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Server-side SDK for Oblien AI Platform - Build AI-powered applications with chat, agents, and workflows",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/chat/index.js CHANGED
@@ -78,6 +78,9 @@ export class OblienChat {
78
78
  workspace,
79
79
  isGuest: true,
80
80
  namespace: guest.namespace,
81
+ ipAddress: ip,
82
+ userAgent: metadata.userAgent,
83
+ fingerprint: fingerprint,
81
84
  });
82
85
 
83
86
  const sessionData = await session.create();
@@ -13,6 +13,9 @@ export class ChatSession {
13
13
  * @param {boolean} [options.isGuest] - Is this a guest session
14
14
  * @param {string} [options.namespace] - Guest namespace for rate limiting
15
15
  * @param {Object} [options.workspace] - Workspace configuration
16
+ * @param {string} [options.ipAddress] - IP address of the user
17
+ * @param {string} [options.userAgent] - User agent of the user
18
+ * @param {string} [options.fingerprint] - Fingerprint of the user
16
19
  */
17
20
  constructor(options) {
18
21
  if (!options.client) {
@@ -32,6 +35,9 @@ export class ChatSession {
32
35
  this.workspace = options.workspace;
33
36
  this.token = null;
34
37
  this.data = null;
38
+ this.ipAddress = options.ipAddress || null;
39
+ this.userAgent = options.userAgent || null;
40
+ this.fingerprint = options.fingerprint || null;
35
41
  }
36
42
 
37
43
  /**
@@ -45,6 +51,9 @@ export class ChatSession {
45
51
  is_guest: this.isGuest,
46
52
  namespace: this.namespace,
47
53
  workspace: this.workspace,
54
+ ip_address: this.ipAddress,
55
+ user_agent: this.userAgent,
56
+ fingerprint: this.fingerprint,
48
57
  };
49
58
 
50
59
  this.data = await this.client.post('ai/session/create', payload);
@@ -129,10 +129,10 @@ export class GuestManager {
129
129
  const guestIdByIp = await this.storage.get(`ip:${ip}`);
130
130
  if (guestIdByIp) {
131
131
  const guest = await this.getGuest(guestIdByIp);
132
- if (guest) {
133
- guest.lastSeen = new Date().toISOString();
132
+ if (guest) {
133
+ guest.lastSeen = new Date().toISOString();
134
134
  await this.storage.set(`guest:${guest.id}`, guest, this.ttl);
135
- return guest;
135
+ return guest;
136
136
  }
137
137
  }
138
138
  }