oblien 1.3.0 → 2.0.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.
Files changed (187) hide show
  1. package/README.md +482 -422
  2. package/dist/client.d.ts +31 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +33 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/error.d.ts +29 -0
  7. package/dist/error.d.ts.map +1 -0
  8. package/dist/error.js +52 -0
  9. package/dist/error.js.map +1 -0
  10. package/dist/http.d.ts +20 -0
  11. package/dist/http.d.ts.map +1 -0
  12. package/dist/http.js +108 -0
  13. package/dist/http.js.map +1 -0
  14. package/dist/index.d.ts +8 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +10 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/resources/api-access.d.ts +21 -0
  19. package/dist/resources/api-access.d.ts.map +1 -0
  20. package/dist/resources/api-access.js +32 -0
  21. package/dist/resources/api-access.js.map +1 -0
  22. package/dist/resources/base.d.ts +17 -0
  23. package/dist/resources/base.d.ts.map +1 -0
  24. package/dist/resources/base.js +21 -0
  25. package/dist/resources/base.js.map +1 -0
  26. package/dist/resources/images.d.ts +11 -0
  27. package/dist/resources/images.d.ts.map +1 -0
  28. package/dist/resources/images.js +16 -0
  29. package/dist/resources/images.js.map +1 -0
  30. package/dist/resources/lifecycle.d.ts +23 -0
  31. package/dist/resources/lifecycle.d.ts.map +1 -0
  32. package/dist/resources/lifecycle.js +32 -0
  33. package/dist/resources/lifecycle.js.map +1 -0
  34. package/dist/resources/logs.d.ts +25 -0
  35. package/dist/resources/logs.d.ts.map +1 -0
  36. package/dist/resources/logs.js +51 -0
  37. package/dist/resources/logs.js.map +1 -0
  38. package/dist/resources/metadata.d.ts +15 -0
  39. package/dist/resources/metadata.d.ts.map +1 -0
  40. package/dist/resources/metadata.js +20 -0
  41. package/dist/resources/metadata.js.map +1 -0
  42. package/dist/resources/metrics.d.ts +17 -0
  43. package/dist/resources/metrics.d.ts.map +1 -0
  44. package/dist/resources/metrics.js +27 -0
  45. package/dist/resources/metrics.js.map +1 -0
  46. package/dist/resources/network.d.ts +17 -0
  47. package/dist/resources/network.d.ts.map +1 -0
  48. package/dist/resources/network.js +20 -0
  49. package/dist/resources/network.js.map +1 -0
  50. package/dist/resources/public-access.d.ts +15 -0
  51. package/dist/resources/public-access.d.ts.map +1 -0
  52. package/dist/resources/public-access.js +21 -0
  53. package/dist/resources/public-access.js.map +1 -0
  54. package/dist/resources/resources.d.ts +15 -0
  55. package/dist/resources/resources.d.ts.map +1 -0
  56. package/dist/resources/resources.js +20 -0
  57. package/dist/resources/resources.js.map +1 -0
  58. package/dist/resources/snapshots.d.ts +27 -0
  59. package/dist/resources/snapshots.d.ts.map +1 -0
  60. package/dist/resources/snapshots.js +45 -0
  61. package/dist/resources/snapshots.js.map +1 -0
  62. package/dist/resources/ssh.d.ts +19 -0
  63. package/dist/resources/ssh.d.ts.map +1 -0
  64. package/dist/resources/ssh.js +28 -0
  65. package/dist/resources/ssh.js.map +1 -0
  66. package/dist/resources/usage.d.ts +25 -0
  67. package/dist/resources/usage.d.ts.map +1 -0
  68. package/dist/resources/usage.js +44 -0
  69. package/dist/resources/usage.js.map +1 -0
  70. package/dist/resources/workloads.d.ts +39 -0
  71. package/dist/resources/workloads.d.ts.map +1 -0
  72. package/dist/resources/workloads.js +83 -0
  73. package/dist/resources/workloads.js.map +1 -0
  74. package/dist/runtime/exec.d.ts +71 -0
  75. package/dist/runtime/exec.d.ts.map +1 -0
  76. package/dist/runtime/exec.js +163 -0
  77. package/dist/runtime/exec.js.map +1 -0
  78. package/dist/runtime/files.d.ts +39 -0
  79. package/dist/runtime/files.d.ts.map +1 -0
  80. package/dist/runtime/files.js +143 -0
  81. package/dist/runtime/files.js.map +1 -0
  82. package/dist/runtime/search.d.ts +23 -0
  83. package/dist/runtime/search.d.ts.map +1 -0
  84. package/dist/runtime/search.js +65 -0
  85. package/dist/runtime/search.js.map +1 -0
  86. package/dist/runtime/terminal.d.ts +29 -0
  87. package/dist/runtime/terminal.d.ts.map +1 -0
  88. package/dist/runtime/terminal.js +58 -0
  89. package/dist/runtime/terminal.js.map +1 -0
  90. package/dist/runtime/watcher.d.ts +27 -0
  91. package/dist/runtime/watcher.d.ts.map +1 -0
  92. package/dist/runtime/watcher.js +53 -0
  93. package/dist/runtime/watcher.js.map +1 -0
  94. package/dist/runtime/ws.d.ts +92 -0
  95. package/dist/runtime/ws.d.ts.map +1 -0
  96. package/dist/runtime/ws.js +228 -0
  97. package/dist/runtime/ws.js.map +1 -0
  98. package/dist/runtime-http.d.ts +35 -0
  99. package/dist/runtime-http.d.ts.map +1 -0
  100. package/dist/runtime-http.js +99 -0
  101. package/dist/runtime-http.js.map +1 -0
  102. package/dist/runtime.d.ts +77 -0
  103. package/dist/runtime.d.ts.map +1 -0
  104. package/dist/runtime.js +97 -0
  105. package/dist/runtime.js.map +1 -0
  106. package/dist/types/client.d.ts +7 -0
  107. package/dist/types/client.d.ts.map +1 -0
  108. package/dist/types/client.js +3 -0
  109. package/dist/types/client.js.map +1 -0
  110. package/dist/types/common.d.ts +13 -0
  111. package/dist/types/common.d.ts.map +1 -0
  112. package/dist/types/common.js +3 -0
  113. package/dist/types/common.js.map +1 -0
  114. package/dist/types/index.d.ts +8 -0
  115. package/dist/types/index.d.ts.map +1 -0
  116. package/dist/types/index.js +2 -0
  117. package/dist/types/index.js.map +1 -0
  118. package/dist/types/network.d.ts +15 -0
  119. package/dist/types/network.d.ts.map +1 -0
  120. package/dist/types/network.js +3 -0
  121. package/dist/types/network.js.map +1 -0
  122. package/dist/types/resources.d.ts +10 -0
  123. package/dist/types/resources.d.ts.map +1 -0
  124. package/dist/types/resources.js +3 -0
  125. package/dist/types/resources.js.map +1 -0
  126. package/dist/types/runtime.d.ts +302 -0
  127. package/dist/types/runtime.d.ts.map +1 -0
  128. package/dist/types/runtime.js +3 -0
  129. package/dist/types/runtime.js.map +1 -0
  130. package/dist/types/workspace-resources.d.ts +186 -0
  131. package/dist/types/workspace-resources.d.ts.map +1 -0
  132. package/dist/types/workspace-resources.js +3 -0
  133. package/dist/types/workspace-resources.js.map +1 -0
  134. package/dist/types/workspace.d.ts +41 -0
  135. package/dist/types/workspace.d.ts.map +1 -0
  136. package/dist/types/workspace.js +3 -0
  137. package/dist/types/workspace.js.map +1 -0
  138. package/dist/workspace.d.ts +135 -0
  139. package/dist/workspace.d.ts.map +1 -0
  140. package/dist/workspace.js +194 -0
  141. package/dist/workspace.js.map +1 -0
  142. package/package.json +30 -69
  143. package/LICENSE +0 -21
  144. package/agents.js +0 -14
  145. package/browser.js +0 -6
  146. package/cdn.js +0 -6
  147. package/chat.js +0 -21
  148. package/credits.js +0 -11
  149. package/icons.js +0 -11
  150. package/index.d.ts +0 -986
  151. package/index.js +0 -63
  152. package/namespaces.js +0 -12
  153. package/sandbox.js +0 -12
  154. package/search.js +0 -11
  155. package/src/agents/agent.js +0 -229
  156. package/src/agents/index.js +0 -227
  157. package/src/agents/settings.js +0 -100
  158. package/src/agents/tools.js +0 -155
  159. package/src/browser/index.js +0 -474
  160. package/src/cdn/index.js +0 -769
  161. package/src/chat/index.js +0 -724
  162. package/src/chat/session.js +0 -93
  163. package/src/client.js +0 -175
  164. package/src/credits/index.js +0 -492
  165. package/src/icons/index.js +0 -185
  166. package/src/namespaces/index.js +0 -236
  167. package/src/namespaces/namespace.js +0 -274
  168. package/src/sandbox/core/api/base.js +0 -89
  169. package/src/sandbox/core/api/database.js +0 -340
  170. package/src/sandbox/core/api/files.js +0 -141
  171. package/src/sandbox/core/api/git.js +0 -174
  172. package/src/sandbox/core/api/search.js +0 -29
  173. package/src/sandbox/core/api/snapshots.js +0 -132
  174. package/src/sandbox/core/api/terminal.js +0 -20
  175. package/src/sandbox/core/auth.js +0 -256
  176. package/src/sandbox/core/client.js +0 -197
  177. package/src/sandbox/core/index.js +0 -22
  178. package/src/sandbox/core/managers/terminal.js +0 -453
  179. package/src/sandbox/core/managers/watcher.js +0 -197
  180. package/src/sandbox/core/types.js +0 -92
  181. package/src/sandbox/core/utils/http.js +0 -89
  182. package/src/sandbox/core/websocket/connection.js +0 -479
  183. package/src/sandbox/index.d.ts +0 -542
  184. package/src/sandbox/index.js +0 -234
  185. package/src/sandbox/sandbox.js +0 -313
  186. package/src/search/index.js +0 -206
  187. package/src/utils/guest-manager.js +0 -454
package/index.js DELETED
@@ -1,63 +0,0 @@
1
- /**
2
- * Oblien Core SDK
3
- * Server-side SDK for Oblien AI Platform
4
- */
5
-
6
- import { OblienClient } from './src/client.js';
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';
12
- import { OblienCDN } from './src/cdn/index.js';
13
- import { OblienBrowser } from './src/browser/index.js';
14
- import { OblienNamespaces, Namespace } from './src/namespaces/index.js';
15
- import { OblienCredits } from './src/credits/index.js';
16
- import {
17
- GuestManager,
18
- NodeCacheStorage,
19
- InMemoryStorage,
20
- RedisStorage
21
- } from './src/utils/guest-manager.js';
22
-
23
- // Re-export as named exports
24
- export { OblienClient };
25
- export { OblienChat, ChatSession };
26
- export { OblienAgents, Agent, Tools, AgentSettings };
27
- export { OblienSandboxes, Sandbox };
28
- export { OblienSearch };
29
- export { OblienIcons };
30
- export { OblienCDN };
31
- export { OblienBrowser };
32
- export { OblienNamespaces, Namespace };
33
- export { OblienCredits };
34
- export {
35
- GuestManager,
36
- NodeCacheStorage,
37
- InMemoryStorage,
38
- RedisStorage
39
- };
40
-
41
- // Default export
42
- export default {
43
- OblienClient,
44
- OblienChat,
45
- ChatSession,
46
- OblienAgents,
47
- Agent,
48
- Tools,
49
- AgentSettings,
50
- OblienSandboxes,
51
- Sandbox,
52
- OblienSearch,
53
- OblienIcons,
54
- OblienCDN,
55
- OblienBrowser,
56
- OblienNamespaces,
57
- Namespace,
58
- OblienCredits,
59
- GuestManager,
60
- NodeCacheStorage,
61
- InMemoryStorage,
62
- RedisStorage,
63
- };
package/namespaces.js DELETED
@@ -1,12 +0,0 @@
1
- /**
2
- * Namespaces Module Entry Point
3
- * Import this for namespace management only
4
- */
5
-
6
- export { OblienNamespaces, Namespace } from './src/namespaces/index.js';
7
-
8
- export default {
9
- OblienNamespaces,
10
- Namespace
11
- };
12
-
package/sandbox.js DELETED
@@ -1,12 +0,0 @@
1
- /**
2
- * Sandbox Module Entry Point
3
- * Import this for sandbox management and interaction
4
- */
5
-
6
- export { OblienSandboxes, Sandbox, SandboxClient } from './src/sandbox/index.js';
7
-
8
- export default {
9
- OblienSandboxes,
10
- Sandbox,
11
- SandboxClient
12
- };
package/search.js DELETED
@@ -1,11 +0,0 @@
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
-
@@ -1,229 +0,0 @@
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
-
@@ -1,227 +0,0 @@
1
- /**
2
- * Agents Module
3
- * Manages AI agents, their settings, and operations
4
- */
5
-
6
- import { OblienClient } from '../client.js';
7
- import { Agent } from './agent.js';
8
- import { Tools } from './tools.js';
9
-
10
- export class OblienAgents {
11
- /**
12
- * @param {import('../client.js').OblienClient|Object} clientOrConfig - Oblien client instance or config
13
- * @param {string} [clientOrConfig.clientId] - Client ID (if not using client instance)
14
- * @param {string} [clientOrConfig.clientSecret] - Client Secret (if not using client instance)
15
- * @param {string} [clientOrConfig.baseURL] - Base URL (optional)
16
- */
17
- constructor(clientOrConfig) {
18
- if (!clientOrConfig) {
19
- throw new Error('Oblien client or credentials are required');
20
- }
21
-
22
- // If it's already a client instance
23
- if (clientOrConfig.clientId && clientOrConfig.clientSecret && typeof clientOrConfig.get === 'function') {
24
- this.client = clientOrConfig;
25
- }
26
- // If credentials provided, create client
27
- else if (clientOrConfig.clientId && clientOrConfig.clientSecret) {
28
- this.client = new OblienClient(clientOrConfig);
29
- }
30
- else {
31
- throw new Error('Either provide OblienClient instance or { clientId, clientSecret }');
32
- }
33
-
34
- this._tools = null;
35
- }
36
-
37
- /**
38
- * Get tools manager
39
- * @returns {Tools} Tools manager instance
40
- */
41
- get tools() {
42
- if (!this._tools) {
43
- this._tools = new Tools(this.client);
44
- }
45
- return this._tools;
46
- }
47
-
48
- /**
49
- * Create a new agent
50
- * @param {Object} options - Agent options
51
- * @param {string} options.name - Agent name (required)
52
- * @param {Object} options.prompts - Agent prompts/configuration (required)
53
- * @param {string} [options.description] - Agent description
54
- * @param {string} [options.namespace] - Namespace for organization
55
- * @param {Array<string>} [options.collectionIds] - Collection IDs
56
- * @param {Object} [options.settings] - Agent settings
57
- * @returns {Promise<Object>} Created agent data
58
- */
59
- async create(options) {
60
- const agent = new Agent({ client: this.client });
61
- return await agent.create(options);
62
- }
63
-
64
- /**
65
- * Get agent by ID
66
- * @param {string} agentId - Agent ID
67
- * @param {string} [section] - Optional section to retrieve
68
- * @returns {Promise<Object>} Agent data
69
- */
70
- async get(agentId, section = null) {
71
- const agent = new Agent({ client: this.client, agentId });
72
- return await agent.get(section);
73
- }
74
-
75
- /**
76
- * List all agents with filtering and pagination
77
- * @param {Object} [options] - Query options
78
- * @param {number} [options.limit] - Max results (default: 50, max: 100)
79
- * @param {number} [options.offset] - Offset for pagination
80
- * @param {string} [options.namespace] - Filter by namespace
81
- * @returns {Promise<Object>} Agents data with pagination info
82
- */
83
- async list(options = {}) {
84
- const response = await this.client.get('ai/agents/list', options);
85
- return response;
86
- }
87
-
88
- /**
89
- * Search agents
90
- * @param {string} query - Search query
91
- * @param {Object} [options] - Query options
92
- * @param {number} [options.limit] - Max results (default: 20)
93
- * @param {string} [options.namespace] - Filter by namespace
94
- * @returns {Promise<Object>} Search results
95
- */
96
- async search(query, options = {}) {
97
- const response = await this.client.get('ai/agents/search', {
98
- q: query,
99
- ...options
100
- });
101
- return response;
102
- }
103
-
104
- /**
105
- * Update agent
106
- * @param {string} agentId - Agent ID
107
- * @param {Object} updates - Fields to update
108
- * @param {string} [updates.name] - Agent name
109
- * @param {string} [updates.description] - Description
110
- * @param {Object} [updates.prompts] - Prompts
111
- * @param {Object} [updates.settings] - Settings
112
- * @param {string} [updates.namespace] - Namespace (for validation)
113
- * @returns {Promise<Object>} Update result
114
- */
115
- async update(agentId, updates) {
116
- const agent = new Agent({ client: this.client, agentId });
117
- return await agent.update(updates);
118
- }
119
-
120
- /**
121
- * Delete agent
122
- * @param {string} agentId - Agent ID
123
- * @param {Object} [options] - Delete options
124
- * @param {string} [options.namespace] - Namespace for validation
125
- * @returns {Promise<Object>} Delete result
126
- */
127
- async delete(agentId, options = {}) {
128
- const agent = new Agent({ client: this.client, agentId });
129
- return await agent.delete(options);
130
- }
131
-
132
- /**
133
- * Get agent overview/analytics
134
- * @param {string} agentId - Agent ID
135
- * @param {Object} [options] - Query options
136
- * @param {number} [options.days=7] - Number of days for activity data
137
- * @returns {Promise<Object>} Analytics data
138
- */
139
- async getOverview(agentId, options = {}) {
140
- const agent = new Agent({ client: this.client, agentId });
141
- return await agent.getOverview(options);
142
- }
143
-
144
- /**
145
- * Get agent sessions
146
- * @param {string} agentId - Agent ID
147
- * @param {Object} [options] - Query options
148
- * @param {number} [options.limit] - Max results
149
- * @param {number} [options.offset] - Offset for pagination
150
- * @param {string} [options.search] - Search term
151
- * @param {string} [options.sortBy] - Sort by field
152
- * @param {string} [options.sortOrder] - Sort order (asc/desc)
153
- * @returns {Promise<Object>} Sessions data
154
- */
155
- async getSessions(agentId, options = {}) {
156
- const agent = new Agent({ client: this.client, agentId });
157
- return await agent.getSessions(options);
158
- }
159
-
160
- /**
161
- * Get agent bans
162
- * @param {string} agentId - Agent ID
163
- * @param {Object} [options] - Query options
164
- * @returns {Promise<Array>} Bans data
165
- */
166
- async getBans(agentId, options = {}) {
167
- const agent = new Agent({ client: this.client, agentId });
168
- return await agent.getBans(options);
169
- }
170
-
171
- /**
172
- * Get platform stats
173
- * @returns {Promise<Object>} Platform statistics
174
- */
175
- async getStats() {
176
- return await this.client.get('ai/agents/stats');
177
- }
178
-
179
-
180
- /**
181
- * Get agent users
182
- * @param {string} agentId - Agent ID
183
- * @param {Object} [options] - Query options
184
- * @returns {Promise<Array>} Agent users data
185
- */
186
- async getUsers(agentId, options = {}) {
187
- const agent = new Agent({ client: this.client, agentId });
188
- return await agent.getUsers(options);
189
- }
190
-
191
- /**
192
- * Get specific agent user
193
- * @param {string} agentId - Agent ID
194
- * @param {string} userId - User ID
195
- * @returns {Promise<Object>} User data
196
- */
197
- async getUser(agentId, userId) {
198
- const agent = new Agent({ client: this.client, agentId });
199
- return await agent.getUser(userId);
200
- }
201
-
202
- /**
203
- * Reset user limits
204
- * @param {string} agentId - Agent ID
205
- * @param {string} userId - User ID
206
- * @returns {Promise<Object>} Reset result
207
- */
208
- async resetUserLimits(agentId, userId) {
209
- const agent = new Agent({ client: this.client, agentId });
210
- return await agent.resetUserLimits(userId);
211
- }
212
-
213
- /**
214
- * Create an Agent instance for chaining operations
215
- * @param {string} [agentId] - Agent ID
216
- * @returns {Agent} Agent instance
217
- */
218
- agent(agentId) {
219
- return new Agent({ client: this.client, agentId });
220
- }
221
- }
222
-
223
- export { Agent };
224
- export { Tools } from './tools.js';
225
- export { AgentSettings } from './settings.js';
226
- export default OblienAgents;
227
-
@@ -1,100 +0,0 @@
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
-