oblien 1.1.0 → 1.1.1

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/agents.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Agents Module Entry Point
3
+ * Import this for AI agents management only
4
+ */
5
+
6
+ export { OblienAgents, Agent, AgentSettings, Tools } from './src/agents/index.js';
7
+
8
+ export default {
9
+ OblienAgents,
10
+ Agent,
11
+ AgentSettings,
12
+ Tools
13
+ };
14
+
package/icons.js ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Icons Module Entry Point
3
+ * Import this for icons functionality only
4
+ */
5
+
6
+ export { OblienIcons } from './src/icons/index.js';
7
+
8
+ export default {
9
+ OblienIcons
10
+ };
11
+
package/index.js CHANGED
@@ -5,6 +5,10 @@
5
5
 
6
6
  import { OblienClient } from './src/client.js';
7
7
  import { OblienChat, ChatSession } from './src/chat/index.js';
8
+ import { OblienAgents, Agent, Tools, AgentSettings } from './src/agents/index.js';
9
+ import { OblienSandboxes, Sandbox } from './src/sandbox/index.js';
10
+ import { OblienSearch } from './src/search/index.js';
11
+ import { OblienIcons } from './src/icons/index.js';
8
12
  import { OblienNamespaces, Namespace } from './src/namespaces/index.js';
9
13
  import { OblienCredits } from './src/credits/index.js';
10
14
  import {
@@ -17,6 +21,10 @@ import {
17
21
  // Re-export as named exports
18
22
  export { OblienClient };
19
23
  export { OblienChat, ChatSession };
24
+ export { OblienAgents, Agent, Tools, AgentSettings };
25
+ export { OblienSandboxes, Sandbox };
26
+ export { OblienSearch };
27
+ export { OblienIcons };
20
28
  export { OblienNamespaces, Namespace };
21
29
  export { OblienCredits };
22
30
  export {
@@ -31,6 +39,14 @@ export default {
31
39
  OblienClient,
32
40
  OblienChat,
33
41
  ChatSession,
42
+ OblienAgents,
43
+ Agent,
44
+ Tools,
45
+ AgentSettings,
46
+ OblienSandboxes,
47
+ Sandbox,
48
+ OblienSearch,
49
+ OblienIcons,
34
50
  OblienNamespaces,
35
51
  Namespace,
36
52
  OblienCredits,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oblien",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
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",
@@ -9,7 +9,11 @@
9
9
  ".": "./index.js",
10
10
  "./chat": "./chat.js",
11
11
  "./namespaces": "./namespaces.js",
12
- "./credits": "./credits.js"
12
+ "./credits": "./credits.js",
13
+ "./agents": "./agents.js",
14
+ "./sandbox": "./sandbox.js",
15
+ "./search": "./search.js",
16
+ "./icons": "./icons.js"
13
17
  },
14
18
  "scripts": {
15
19
  "test": "node --test tests/**/*.test.js"
@@ -61,6 +65,9 @@
61
65
  "namespaces.js",
62
66
  "credits.js",
63
67
  "agents.js",
68
+ "sandbox.js",
69
+ "search.js",
70
+ "icons.js",
64
71
  "workflows.js",
65
72
  "README.md",
66
73
  "LICENSE"
package/sandbox.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Sandbox Module Entry Point
3
+ * Import this for sandbox management only
4
+ */
5
+
6
+ export { OblienSandboxes, Sandbox } from './src/sandbox/index.js';
7
+
8
+ export default {
9
+ OblienSandboxes,
10
+ Sandbox
11
+ };
12
+
package/search.js ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Search Module Entry Point
3
+ * Import this for search functionality only
4
+ */
5
+
6
+ export { OblienSearch } from './src/search/index.js';
7
+
8
+ export default {
9
+ OblienSearch
10
+ };
11
+
@@ -0,0 +1,229 @@
1
+ /**
2
+ * Agent Class
3
+ * Represents a single agent with methods for operations
4
+ */
5
+
6
+ import { AgentSettings } from './settings.js';
7
+
8
+ export class Agent {
9
+ /**
10
+ * @param {Object} options
11
+ * @param {import('../client.js').OblienClient} options.client - Oblien client instance
12
+ * @param {string} [options.agentId] - Agent ID
13
+ */
14
+ constructor({ client, agentId = null }) {
15
+ if (!client) {
16
+ throw new Error('Oblien client is required');
17
+ }
18
+
19
+ this.client = client;
20
+ this.agentId = agentId;
21
+ this._settings = null;
22
+ }
23
+
24
+ /**
25
+ * Get settings manager for this agent
26
+ * @returns {AgentSettings} Settings manager instance
27
+ */
28
+ get settings() {
29
+ if (!this.agentId) {
30
+ throw new Error('Agent ID is required for settings operations');
31
+ }
32
+
33
+ if (!this._settings) {
34
+ this._settings = new AgentSettings({
35
+ client: this.client,
36
+ agentId: this.agentId
37
+ });
38
+ }
39
+
40
+ return this._settings;
41
+ }
42
+
43
+ /**
44
+ * Create a new agent
45
+ * @param {Object} options - Agent options
46
+ * @param {string} options.name - Agent name (required)
47
+ * @param {Object} options.prompts - Agent prompts/configuration (required)
48
+ * @param {string} [options.description] - Agent description
49
+ * @param {string} [options.namespace] - Namespace for organization
50
+ * @param {Array<string>} [options.collectionIds] - Collection IDs
51
+ * @param {Object} [options.settings] - Agent settings
52
+ * @returns {Promise<Object>} Created agent data
53
+ */
54
+ async create(options) {
55
+ const { name, prompts, description, namespace, collectionIds, settings } = options;
56
+
57
+ if (!name) {
58
+ throw new Error('Agent name is required');
59
+ }
60
+ if (!prompts) {
61
+ throw new Error('Agent prompts are required');
62
+ }
63
+
64
+ const response = await this.client.post('ai/agents/create', {
65
+ name,
66
+ prompts,
67
+ description,
68
+ namespace,
69
+ collectionIds,
70
+ settings
71
+ });
72
+
73
+ if (response.agentId || response.id) {
74
+ this.agentId = response.agentId || response.id;
75
+ }
76
+
77
+ return response;
78
+ }
79
+
80
+ /**
81
+ * Get agent details
82
+ * @param {string} [section] - Optional section to retrieve
83
+ * @returns {Promise<Object>} Agent data
84
+ */
85
+ async get(section = null) {
86
+ if (!this.agentId) {
87
+ throw new Error('Agent ID is required');
88
+ }
89
+
90
+ const path = section
91
+ ? `ai/agents/${this.agentId}/${section}`
92
+ : `ai/agents/${this.agentId}`;
93
+
94
+ return await this.client.get(path);
95
+ }
96
+
97
+ /**
98
+ * Update agent
99
+ * @param {Object} updates - Fields to update
100
+ * @param {string} [updates.name] - Agent name
101
+ * @param {string} [updates.description] - Description
102
+ * @param {Object} [updates.prompts] - Prompts
103
+ * @param {Object} [updates.settings] - Settings
104
+ * @param {string} [updates.namespace] - Namespace (for validation)
105
+ * @returns {Promise<Object>} Update result
106
+ */
107
+ async update(updates) {
108
+ if (!this.agentId) {
109
+ throw new Error('Agent ID is required');
110
+ }
111
+
112
+ return await this.client.put(`ai/agents/${this.agentId}`, updates);
113
+ }
114
+
115
+ /**
116
+ * Delete agent
117
+ * @param {Object} [options] - Delete options
118
+ * @param {string} [options.namespace] - Namespace for validation
119
+ * @returns {Promise<Object>} Delete result
120
+ */
121
+ async delete(options = {}) {
122
+ if (!this.agentId) {
123
+ throw new Error('Agent ID is required');
124
+ }
125
+
126
+ // Use POST with body for DELETE with namespace validation
127
+ const response = await fetch(this.client._buildURL(`ai/agents/${this.agentId}`), {
128
+ method: 'DELETE',
129
+ headers: this.client.getAuthHeaders(),
130
+ body: JSON.stringify(options)
131
+ });
132
+
133
+ return this.client._handleResponse(response);
134
+ }
135
+
136
+ /**
137
+ * Get agent overview/analytics
138
+ * @param {Object} [options] - Query options
139
+ * @param {number} [options.days=7] - Number of days for activity data
140
+ * @returns {Promise<Object>} Analytics data
141
+ */
142
+ async getOverview(options = {}) {
143
+ if (!this.agentId) {
144
+ throw new Error('Agent ID is required');
145
+ }
146
+
147
+ return await this.client.get(`ai/agents/${this.agentId}/overview`, options);
148
+ }
149
+
150
+ /**
151
+ * Get agent sessions
152
+ * @param {Object} [options] - Query options
153
+ * @param {number} [options.limit] - Max results
154
+ * @param {number} [options.offset] - Offset for pagination
155
+ * @param {string} [options.search] - Search term
156
+ * @param {string} [options.sortBy] - Sort by field
157
+ * @param {string} [options.sortOrder] - Sort order (asc/desc)
158
+ * @returns {Promise<Object>} Sessions data
159
+ */
160
+ async getSessions(options = {}) {
161
+ if (!this.agentId) {
162
+ throw new Error('Agent ID is required');
163
+ }
164
+
165
+ return await this.client.get(`ai/agents/${this.agentId}/sessions`, options);
166
+ }
167
+
168
+ /**
169
+ * Get agent bans
170
+ * @param {Object} [options] - Query options
171
+ * @returns {Promise<Array>} Bans data
172
+ */
173
+ async getBans(options = {}) {
174
+ if (!this.agentId) {
175
+ throw new Error('Agent ID is required');
176
+ }
177
+
178
+ return await this.client.get(`ai/agents/${this.agentId}/bans`, options);
179
+ }
180
+
181
+
182
+ /**
183
+ * Get agent users
184
+ * @param {Object} [options] - Query options
185
+ * @returns {Promise<Array>} Agent users data
186
+ */
187
+ async getUsers(options = {}) {
188
+ if (!this.agentId) {
189
+ throw new Error('Agent ID is required');
190
+ }
191
+
192
+ return await this.client.get(`ai/agents/${this.agentId}/users`, options);
193
+ }
194
+
195
+ /**
196
+ * Get specific agent user
197
+ * @param {string} userId - User ID
198
+ * @returns {Promise<Object>} User data
199
+ */
200
+ async getUser(userId) {
201
+ if (!this.agentId) {
202
+ throw new Error('Agent ID is required');
203
+ }
204
+ if (!userId) {
205
+ throw new Error('User ID is required');
206
+ }
207
+
208
+ return await this.client.get(`ai/agents/${this.agentId}/users/${userId}`);
209
+ }
210
+
211
+ /**
212
+ * Reset user limits
213
+ * @param {string} userId - User ID
214
+ * @returns {Promise<Object>} Reset result
215
+ */
216
+ async resetUserLimits(userId) {
217
+ if (!this.agentId) {
218
+ throw new Error('Agent ID is required');
219
+ }
220
+ if (!userId) {
221
+ throw new Error('User ID is required');
222
+ }
223
+
224
+ return await this.client.post(`ai/agents/${this.agentId}/users/${userId}/reset-limits`);
225
+ }
226
+ }
227
+
228
+ export default Agent;
229
+
@@ -0,0 +1,212 @@
1
+ /**
2
+ * Agents Module
3
+ * Manages AI agents, their settings, and operations
4
+ */
5
+
6
+ import { Agent } from './agent.js';
7
+ import { Tools } from './tools.js';
8
+
9
+ export class OblienAgents {
10
+ /**
11
+ * @param {import('../client.js').OblienClient} client - Oblien client instance
12
+ */
13
+ constructor(client) {
14
+ if (!client) {
15
+ throw new Error('Oblien client is required');
16
+ }
17
+
18
+ this.client = client;
19
+ this._tools = null;
20
+ }
21
+
22
+ /**
23
+ * Get tools manager
24
+ * @returns {Tools} Tools manager instance
25
+ */
26
+ get tools() {
27
+ if (!this._tools) {
28
+ this._tools = new Tools(this.client);
29
+ }
30
+ return this._tools;
31
+ }
32
+
33
+ /**
34
+ * Create a new agent
35
+ * @param {Object} options - Agent options
36
+ * @param {string} options.name - Agent name (required)
37
+ * @param {Object} options.prompts - Agent prompts/configuration (required)
38
+ * @param {string} [options.description] - Agent description
39
+ * @param {string} [options.namespace] - Namespace for organization
40
+ * @param {Array<string>} [options.collectionIds] - Collection IDs
41
+ * @param {Object} [options.settings] - Agent settings
42
+ * @returns {Promise<Object>} Created agent data
43
+ */
44
+ async create(options) {
45
+ const agent = new Agent({ client: this.client });
46
+ return await agent.create(options);
47
+ }
48
+
49
+ /**
50
+ * Get agent by ID
51
+ * @param {string} agentId - Agent ID
52
+ * @param {string} [section] - Optional section to retrieve
53
+ * @returns {Promise<Object>} Agent data
54
+ */
55
+ async get(agentId, section = null) {
56
+ const agent = new Agent({ client: this.client, agentId });
57
+ return await agent.get(section);
58
+ }
59
+
60
+ /**
61
+ * List all agents with filtering and pagination
62
+ * @param {Object} [options] - Query options
63
+ * @param {number} [options.limit] - Max results (default: 50, max: 100)
64
+ * @param {number} [options.offset] - Offset for pagination
65
+ * @param {string} [options.namespace] - Filter by namespace
66
+ * @returns {Promise<Object>} Agents data with pagination info
67
+ */
68
+ async list(options = {}) {
69
+ const response = await this.client.get('ai/agents/list', options);
70
+ return response;
71
+ }
72
+
73
+ /**
74
+ * Search agents
75
+ * @param {string} query - Search query
76
+ * @param {Object} [options] - Query options
77
+ * @param {number} [options.limit] - Max results (default: 20)
78
+ * @param {string} [options.namespace] - Filter by namespace
79
+ * @returns {Promise<Object>} Search results
80
+ */
81
+ async search(query, options = {}) {
82
+ const response = await this.client.get('ai/agents/search', {
83
+ q: query,
84
+ ...options
85
+ });
86
+ return response;
87
+ }
88
+
89
+ /**
90
+ * Update agent
91
+ * @param {string} agentId - Agent ID
92
+ * @param {Object} updates - Fields to update
93
+ * @param {string} [updates.name] - Agent name
94
+ * @param {string} [updates.description] - Description
95
+ * @param {Object} [updates.prompts] - Prompts
96
+ * @param {Object} [updates.settings] - Settings
97
+ * @param {string} [updates.namespace] - Namespace (for validation)
98
+ * @returns {Promise<Object>} Update result
99
+ */
100
+ async update(agentId, updates) {
101
+ const agent = new Agent({ client: this.client, agentId });
102
+ return await agent.update(updates);
103
+ }
104
+
105
+ /**
106
+ * Delete agent
107
+ * @param {string} agentId - Agent ID
108
+ * @param {Object} [options] - Delete options
109
+ * @param {string} [options.namespace] - Namespace for validation
110
+ * @returns {Promise<Object>} Delete result
111
+ */
112
+ async delete(agentId, options = {}) {
113
+ const agent = new Agent({ client: this.client, agentId });
114
+ return await agent.delete(options);
115
+ }
116
+
117
+ /**
118
+ * Get agent overview/analytics
119
+ * @param {string} agentId - Agent ID
120
+ * @param {Object} [options] - Query options
121
+ * @param {number} [options.days=7] - Number of days for activity data
122
+ * @returns {Promise<Object>} Analytics data
123
+ */
124
+ async getOverview(agentId, options = {}) {
125
+ const agent = new Agent({ client: this.client, agentId });
126
+ return await agent.getOverview(options);
127
+ }
128
+
129
+ /**
130
+ * Get agent sessions
131
+ * @param {string} agentId - Agent ID
132
+ * @param {Object} [options] - Query options
133
+ * @param {number} [options.limit] - Max results
134
+ * @param {number} [options.offset] - Offset for pagination
135
+ * @param {string} [options.search] - Search term
136
+ * @param {string} [options.sortBy] - Sort by field
137
+ * @param {string} [options.sortOrder] - Sort order (asc/desc)
138
+ * @returns {Promise<Object>} Sessions data
139
+ */
140
+ async getSessions(agentId, options = {}) {
141
+ const agent = new Agent({ client: this.client, agentId });
142
+ return await agent.getSessions(options);
143
+ }
144
+
145
+ /**
146
+ * Get agent bans
147
+ * @param {string} agentId - Agent ID
148
+ * @param {Object} [options] - Query options
149
+ * @returns {Promise<Array>} Bans data
150
+ */
151
+ async getBans(agentId, options = {}) {
152
+ const agent = new Agent({ client: this.client, agentId });
153
+ return await agent.getBans(options);
154
+ }
155
+
156
+ /**
157
+ * Get platform stats
158
+ * @returns {Promise<Object>} Platform statistics
159
+ */
160
+ async getStats() {
161
+ return await this.client.get('ai/agents/stats');
162
+ }
163
+
164
+
165
+ /**
166
+ * Get agent users
167
+ * @param {string} agentId - Agent ID
168
+ * @param {Object} [options] - Query options
169
+ * @returns {Promise<Array>} Agent users data
170
+ */
171
+ async getUsers(agentId, options = {}) {
172
+ const agent = new Agent({ client: this.client, agentId });
173
+ return await agent.getUsers(options);
174
+ }
175
+
176
+ /**
177
+ * Get specific agent user
178
+ * @param {string} agentId - Agent ID
179
+ * @param {string} userId - User ID
180
+ * @returns {Promise<Object>} User data
181
+ */
182
+ async getUser(agentId, userId) {
183
+ const agent = new Agent({ client: this.client, agentId });
184
+ return await agent.getUser(userId);
185
+ }
186
+
187
+ /**
188
+ * Reset user limits
189
+ * @param {string} agentId - Agent ID
190
+ * @param {string} userId - User ID
191
+ * @returns {Promise<Object>} Reset result
192
+ */
193
+ async resetUserLimits(agentId, userId) {
194
+ const agent = new Agent({ client: this.client, agentId });
195
+ return await agent.resetUserLimits(userId);
196
+ }
197
+
198
+ /**
199
+ * Create an Agent instance for chaining operations
200
+ * @param {string} [agentId] - Agent ID
201
+ * @returns {Agent} Agent instance
202
+ */
203
+ agent(agentId) {
204
+ return new Agent({ client: this.client, agentId });
205
+ }
206
+ }
207
+
208
+ export { Agent };
209
+ export { Tools } from './tools.js';
210
+ export { AgentSettings } from './settings.js';
211
+ export default OblienAgents;
212
+
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Agent Settings Class
3
+ * Manages all agent settings with proper sections
4
+ */
5
+
6
+ export class AgentSettings {
7
+ /**
8
+ * @param {Object} options
9
+ * @param {import('../client.js').OblienClient} options.client - Oblien client instance
10
+ * @param {string} options.agentId - Agent ID
11
+ */
12
+ constructor({ client, agentId }) {
13
+ if (!client) {
14
+ throw new Error('Oblien client is required');
15
+ }
16
+ if (!agentId) {
17
+ throw new Error('Agent ID is required');
18
+ }
19
+
20
+ this.client = client;
21
+ this.agentId = agentId;
22
+ }
23
+
24
+ /**
25
+ * Update boolean switches
26
+ * @param {Object} switches - Switch values
27
+ * @param {boolean} [switches.enable_memory] - Enable conversation memory
28
+ * @param {boolean} [switches.allow_thinking] - Allow thinking process
29
+ * @param {boolean} [switches.allow_images] - Allow image uploads
30
+ * @param {boolean} [switches.allow_videos] - Allow video uploads
31
+ * @param {boolean} [switches.allow_audio] - Allow audio uploads
32
+ * @param {boolean} [switches.allow_documents] - Allow document uploads
33
+ * @param {boolean} [switches.allow_built_in] - Allow built-in tools
34
+ * @returns {Promise<Object>} Update result
35
+ */
36
+ async updateSwitches(switches) {
37
+ return await this.client.put(`ai/agents/${this.agentId}/switches`, switches);
38
+ }
39
+
40
+ /**
41
+ * Update model configuration
42
+ * @param {Object} config - Model configuration
43
+ * @param {string} [config.model] - Model name (e.g., 'oblien-master')
44
+ * @param {number} [config.temperature] - Temperature 0-2 (default: 1)
45
+ * @param {number} [config.max_tokens] - Max tokens 1-200000 (default: 2000)
46
+ * @param {number} [config.top_p] - Top P 0-1 (default: 1)
47
+ * @returns {Promise<Object>} Update result
48
+ */
49
+ async updateModelConfig(config) {
50
+ return await this.client.put(`ai/agents/${this.agentId}/model-config`, config);
51
+ }
52
+
53
+ /**
54
+ * Update tools array
55
+ * @param {Array<string>} tools - Array of tool slugs
56
+ * @returns {Promise<Object>} Update result
57
+ */
58
+ async updateTools(tools) {
59
+ return await this.client.put(`ai/agents/${this.agentId}/tools`, { tools });
60
+ }
61
+
62
+ /**
63
+ * Update guest limits
64
+ * @param {Object} limits - Guest limit configuration
65
+ * @param {boolean} [limits.enabled] - Enable guest limits
66
+ * @param {number} [limits.max_requests_per_minute] - Max requests per minute (1-1000)
67
+ * @param {number} [limits.max_messages_per_hour] - Max messages per hour (1-10000)
68
+ * @param {number} [limits.max_messages_per_day] - Max messages per day (1-50000)
69
+ * @param {number} [limits.max_total_tokens_per_day] - Max total tokens per day (1000-10000000)
70
+ * @param {number} [limits.max_input_tokens_per_day] - Max input tokens per day (1000-10000000)
71
+ * @param {number} [limits.max_output_tokens_per_day] - Max output tokens per day (1000-10000000)
72
+ * @returns {Promise<Object>} Update result
73
+ */
74
+ async updateGuestLimits(limits) {
75
+ return await this.client.put(`ai/agents/${this.agentId}/guest-limits`, limits);
76
+ }
77
+
78
+ /**
79
+ * Update context settings
80
+ * @param {Object} context - Context configuration
81
+ * @param {number} [context.max_history_messages] - Max history messages
82
+ * @param {number} [context.history_token_limit] - History token limit
83
+ * @returns {Promise<Object>} Update result
84
+ */
85
+ async updateContext(context) {
86
+ return await this.client.put(`ai/agents/${this.agentId}/context`, context);
87
+ }
88
+
89
+ /**
90
+ * Get all settings sections
91
+ * @returns {Promise<Object>} All settings
92
+ */
93
+ async getAll() {
94
+ const agent = await this.client.get(`ai/agents/${this.agentId}`);
95
+ return agent.agent?.settings || agent.settings || {};
96
+ }
97
+ }
98
+
99
+ export default AgentSettings;
100
+