oblien 1.3.0 → 2.0.0
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/client.d.ts +31 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +33 -0
- package/dist/client.js.map +1 -0
- package/dist/error.d.ts +29 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +52 -0
- package/dist/error.js.map +1 -0
- package/dist/http.d.ts +20 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +108 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/api-access.d.ts +21 -0
- package/dist/resources/api-access.d.ts.map +1 -0
- package/dist/resources/api-access.js +32 -0
- package/dist/resources/api-access.js.map +1 -0
- package/dist/resources/base.d.ts +17 -0
- package/dist/resources/base.d.ts.map +1 -0
- package/dist/resources/base.js +21 -0
- package/dist/resources/base.js.map +1 -0
- package/dist/resources/images.d.ts +11 -0
- package/dist/resources/images.d.ts.map +1 -0
- package/dist/resources/images.js +16 -0
- package/dist/resources/images.js.map +1 -0
- package/dist/resources/lifecycle.d.ts +23 -0
- package/dist/resources/lifecycle.d.ts.map +1 -0
- package/dist/resources/lifecycle.js +32 -0
- package/dist/resources/lifecycle.js.map +1 -0
- package/dist/resources/logs.d.ts +25 -0
- package/dist/resources/logs.d.ts.map +1 -0
- package/dist/resources/logs.js +51 -0
- package/dist/resources/logs.js.map +1 -0
- package/dist/resources/metadata.d.ts +15 -0
- package/dist/resources/metadata.d.ts.map +1 -0
- package/dist/resources/metadata.js +20 -0
- package/dist/resources/metadata.js.map +1 -0
- package/dist/resources/metrics.d.ts +17 -0
- package/dist/resources/metrics.d.ts.map +1 -0
- package/dist/resources/metrics.js +27 -0
- package/dist/resources/metrics.js.map +1 -0
- package/dist/resources/network.d.ts +17 -0
- package/dist/resources/network.d.ts.map +1 -0
- package/dist/resources/network.js +20 -0
- package/dist/resources/network.js.map +1 -0
- package/dist/resources/public-access.d.ts +15 -0
- package/dist/resources/public-access.d.ts.map +1 -0
- package/dist/resources/public-access.js +21 -0
- package/dist/resources/public-access.js.map +1 -0
- package/dist/resources/resources.d.ts +15 -0
- package/dist/resources/resources.d.ts.map +1 -0
- package/dist/resources/resources.js +20 -0
- package/dist/resources/resources.js.map +1 -0
- package/dist/resources/snapshots.d.ts +27 -0
- package/dist/resources/snapshots.d.ts.map +1 -0
- package/dist/resources/snapshots.js +45 -0
- package/dist/resources/snapshots.js.map +1 -0
- package/dist/resources/ssh.d.ts +19 -0
- package/dist/resources/ssh.d.ts.map +1 -0
- package/dist/resources/ssh.js +28 -0
- package/dist/resources/ssh.js.map +1 -0
- package/dist/resources/usage.d.ts +25 -0
- package/dist/resources/usage.d.ts.map +1 -0
- package/dist/resources/usage.js +44 -0
- package/dist/resources/usage.js.map +1 -0
- package/dist/resources/workloads.d.ts +39 -0
- package/dist/resources/workloads.d.ts.map +1 -0
- package/dist/resources/workloads.js +83 -0
- package/dist/resources/workloads.js.map +1 -0
- package/dist/runtime/exec.d.ts +71 -0
- package/dist/runtime/exec.d.ts.map +1 -0
- package/dist/runtime/exec.js +163 -0
- package/dist/runtime/exec.js.map +1 -0
- package/dist/runtime/files.d.ts +39 -0
- package/dist/runtime/files.d.ts.map +1 -0
- package/dist/runtime/files.js +143 -0
- package/dist/runtime/files.js.map +1 -0
- package/dist/runtime/search.d.ts +23 -0
- package/dist/runtime/search.d.ts.map +1 -0
- package/dist/runtime/search.js +65 -0
- package/dist/runtime/search.js.map +1 -0
- package/dist/runtime/terminal.d.ts +29 -0
- package/dist/runtime/terminal.d.ts.map +1 -0
- package/dist/runtime/terminal.js +58 -0
- package/dist/runtime/terminal.js.map +1 -0
- package/dist/runtime/watcher.d.ts +27 -0
- package/dist/runtime/watcher.d.ts.map +1 -0
- package/dist/runtime/watcher.js +53 -0
- package/dist/runtime/watcher.js.map +1 -0
- package/dist/runtime/ws.d.ts +92 -0
- package/dist/runtime/ws.d.ts.map +1 -0
- package/dist/runtime/ws.js +228 -0
- package/dist/runtime/ws.js.map +1 -0
- package/dist/runtime-http.d.ts +35 -0
- package/dist/runtime-http.d.ts.map +1 -0
- package/dist/runtime-http.js +99 -0
- package/dist/runtime-http.js.map +1 -0
- package/dist/runtime.d.ts +77 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +97 -0
- package/dist/runtime.js.map +1 -0
- package/dist/types/client.d.ts +7 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/client.js +3 -0
- package/dist/types/client.js.map +1 -0
- package/dist/types/common.d.ts +13 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +3 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/network.d.ts +15 -0
- package/dist/types/network.d.ts.map +1 -0
- package/dist/types/network.js +3 -0
- package/dist/types/network.js.map +1 -0
- package/dist/types/resources.d.ts +10 -0
- package/dist/types/resources.d.ts.map +1 -0
- package/dist/types/resources.js +3 -0
- package/dist/types/resources.js.map +1 -0
- package/dist/types/runtime.d.ts +302 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/runtime.js +3 -0
- package/dist/types/runtime.js.map +1 -0
- package/dist/types/workspace-resources.d.ts +186 -0
- package/dist/types/workspace-resources.d.ts.map +1 -0
- package/dist/types/workspace-resources.js +3 -0
- package/dist/types/workspace-resources.js.map +1 -0
- package/dist/types/workspace.d.ts +41 -0
- package/dist/types/workspace.d.ts.map +1 -0
- package/dist/types/workspace.js +3 -0
- package/dist/types/workspace.js.map +1 -0
- package/dist/workspace.d.ts +135 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +194 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +30 -69
- package/LICENSE +0 -21
- package/README.md +0 -574
- package/agents.js +0 -14
- package/browser.js +0 -6
- package/cdn.js +0 -6
- package/chat.js +0 -21
- package/credits.js +0 -11
- package/icons.js +0 -11
- package/index.d.ts +0 -986
- package/index.js +0 -63
- package/namespaces.js +0 -12
- package/sandbox.js +0 -12
- package/search.js +0 -11
- package/src/agents/agent.js +0 -229
- package/src/agents/index.js +0 -227
- package/src/agents/settings.js +0 -100
- package/src/agents/tools.js +0 -155
- package/src/browser/index.js +0 -474
- package/src/cdn/index.js +0 -769
- package/src/chat/index.js +0 -724
- package/src/chat/session.js +0 -93
- package/src/client.js +0 -175
- package/src/credits/index.js +0 -492
- package/src/icons/index.js +0 -185
- package/src/namespaces/index.js +0 -236
- package/src/namespaces/namespace.js +0 -274
- package/src/sandbox/core/api/base.js +0 -89
- package/src/sandbox/core/api/database.js +0 -340
- package/src/sandbox/core/api/files.js +0 -141
- package/src/sandbox/core/api/git.js +0 -174
- package/src/sandbox/core/api/search.js +0 -29
- package/src/sandbox/core/api/snapshots.js +0 -132
- package/src/sandbox/core/api/terminal.js +0 -20
- package/src/sandbox/core/auth.js +0 -256
- package/src/sandbox/core/client.js +0 -197
- package/src/sandbox/core/index.js +0 -22
- package/src/sandbox/core/managers/terminal.js +0 -453
- package/src/sandbox/core/managers/watcher.js +0 -197
- package/src/sandbox/core/types.js +0 -92
- package/src/sandbox/core/utils/http.js +0 -89
- package/src/sandbox/core/websocket/connection.js +0 -479
- package/src/sandbox/index.d.ts +0 -542
- package/src/sandbox/index.js +0 -234
- package/src/sandbox/sandbox.js +0 -313
- package/src/search/index.js +0 -206
- package/src/utils/guest-manager.js +0 -454
package/src/chat/session.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Chat Session Manager (Server-Side Only)
|
|
3
|
-
* Creates and manages chat sessions - returns tokens for client-side chat
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export class ChatSession {
|
|
7
|
-
/**
|
|
8
|
-
* @param {Object} options - Session options
|
|
9
|
-
* @param {import('../client.js').OblienClient} options.client - Oblien client instance
|
|
10
|
-
* @param {string} [options.sessionId] - Existing session ID
|
|
11
|
-
*/
|
|
12
|
-
constructor({ client, sessionId = null }) {
|
|
13
|
-
if (!client) {
|
|
14
|
-
throw new Error('Oblien client is required');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
this.client = client;
|
|
18
|
-
this.sessionId = sessionId;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Create session and get token for client
|
|
23
|
-
* @param {Object} options - Session creation options
|
|
24
|
-
* @param {string} options.agentId - Agent ID to chat with
|
|
25
|
-
* @param {string} [options.workflowId] - Workflow ID (if using workflow)
|
|
26
|
-
* @param {boolean} [options.isGuest] - Is this a guest session
|
|
27
|
-
* @param {string} [options.namespace] - Guest namespace for rate limiting
|
|
28
|
-
* @param {Object} [options.workspace] - Workspace configuration
|
|
29
|
-
* @param {string} [options.ipAddress] - IP address of the user
|
|
30
|
-
* @param {string} [options.userAgent] - User agent of the user
|
|
31
|
-
* @param {string} [options.fingerprint] - Fingerprint of the user
|
|
32
|
-
* @param {string} [options.endUserId] - End user ID (for client's end users)
|
|
33
|
-
* @returns {Promise<Object>} Session data with token for browser
|
|
34
|
-
*/
|
|
35
|
-
async create(options) {
|
|
36
|
-
if (!options.agentId && !options.workflowId) {
|
|
37
|
-
throw new Error('Either agentId or workflowId is required');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const data = await this.client.post('ai/session/create', options);
|
|
41
|
-
return data
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Get existing session info
|
|
46
|
-
* @param {string} [sessionId] - Session ID (uses instance sessionId if not provided)
|
|
47
|
-
* @returns {Promise<Object>} Session details
|
|
48
|
-
*/
|
|
49
|
-
async get(sessionId) {
|
|
50
|
-
const id = sessionId || this.sessionId;
|
|
51
|
-
if (!id) {
|
|
52
|
-
throw new Error('Session ID required');
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return await this.client.get(`ai/session/${id}`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Delete session
|
|
60
|
-
* @param {string} [sessionId] - Session ID (uses instance sessionId if not provided)
|
|
61
|
-
* @returns {Promise<Object>} Deletion result
|
|
62
|
-
*/
|
|
63
|
-
async delete(sessionId) {
|
|
64
|
-
const id = sessionId || this.sessionId;
|
|
65
|
-
if (!id) {
|
|
66
|
-
throw new Error('Session ID required');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return await this.client.delete(`ai/session/${id}`);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* List all sessions
|
|
74
|
-
* @param {Object} [options] - Query options
|
|
75
|
-
* @param {string} [options.namespace] - Filter by namespace
|
|
76
|
-
* @param {string} [options.agentId] - Filter by agent ID
|
|
77
|
-
* @param {string} [options.endUserId] - Filter by end user ID
|
|
78
|
-
* @param {number} [options.limit] - Number of results (max 100)
|
|
79
|
-
* @param {number} [options.offset] - Offset for pagination
|
|
80
|
-
* @param {string} [options.search] - Search in title and user ID
|
|
81
|
-
* @param {string} [options.sortBy] - Sort by 'time' or 'tokens'
|
|
82
|
-
* @param {string} [options.sortOrder] - 'asc' or 'desc'
|
|
83
|
-
* @param {boolean} [options.includeGuests] - Include guest information
|
|
84
|
-
* @param {boolean} [options.includeStats] - Include message count and tokens
|
|
85
|
-
* @returns {Promise<Array>} Array of sessions
|
|
86
|
-
*/
|
|
87
|
-
async list(options = {}) {
|
|
88
|
-
const data = await this.client.get('ai/session/list', options);
|
|
89
|
-
return data;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export default ChatSession;
|
package/src/client.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Oblien Core Client
|
|
3
|
-
* Main client for authenticating and accessing Oblien API
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export class OblienClient {
|
|
7
|
-
/**
|
|
8
|
-
* @param {Object} config - Configuration options
|
|
9
|
-
* @param {string} config.clientId - Your Oblien Client ID (x-client-id)
|
|
10
|
-
* @param {string} config.clientSecret - Your Oblien Client Secret (x-client-secret)
|
|
11
|
-
*/
|
|
12
|
-
constructor(config) {
|
|
13
|
-
if (!config || !config.clientId) {
|
|
14
|
-
throw new Error('Oblien client ID is required');
|
|
15
|
-
}
|
|
16
|
-
if (!config.clientSecret) {
|
|
17
|
-
throw new Error('Oblien client secret is required');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
this.clientId = config.clientId;
|
|
21
|
-
this.clientSecret = config.clientSecret;
|
|
22
|
-
this.baseURL = config.baseURL || 'https://api.oblien.com';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Build full API URL
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
|
-
_buildURL(path) {
|
|
30
|
-
const cleanPath = path.startsWith('/') ? path.slice(1) : path;
|
|
31
|
-
// Backend doesn't use version prefix, routes are directly mounted
|
|
32
|
-
return `${this.baseURL}/${cleanPath}`;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Get authentication headers
|
|
37
|
-
* @returns {Object} Headers object with x-client-id and x-client-secret
|
|
38
|
-
*/
|
|
39
|
-
getAuthHeaders() {
|
|
40
|
-
return {
|
|
41
|
-
'x-client-id': this.clientId,
|
|
42
|
-
'x-client-secret': this.clientSecret,
|
|
43
|
-
'Content-Type': 'application/json',
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Make GET request
|
|
49
|
-
* @param {string} path - API path
|
|
50
|
-
* @param {Object} [params] - Query parameters
|
|
51
|
-
* @returns {Promise<any>} Response data
|
|
52
|
-
*/
|
|
53
|
-
async get(path, params = {}) {
|
|
54
|
-
const headers = this.getAuthHeaders();
|
|
55
|
-
const url = new URL(this._buildURL(path));
|
|
56
|
-
|
|
57
|
-
// Add query parameters
|
|
58
|
-
Object.keys(params).forEach(key => {
|
|
59
|
-
if (params[key] !== undefined && params[key] !== null) {
|
|
60
|
-
url.searchParams.append(key, params[key]);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const response = await fetch(url.toString(), {
|
|
65
|
-
method: 'GET',
|
|
66
|
-
headers,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return this._handleResponse(response);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Make POST request
|
|
74
|
-
* @param {string} path - API path
|
|
75
|
-
* @param {Object} [body] - Request body
|
|
76
|
-
* @returns {Promise<any>} Response data
|
|
77
|
-
*/
|
|
78
|
-
async post(path, body = {}) {
|
|
79
|
-
const headers = this.getAuthHeaders();
|
|
80
|
-
|
|
81
|
-
const response = await fetch(this._buildURL(path), {
|
|
82
|
-
method: 'POST',
|
|
83
|
-
headers,
|
|
84
|
-
body: JSON.stringify(body),
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
return this._handleResponse(response);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Make PUT request
|
|
92
|
-
* @param {string} path - API path
|
|
93
|
-
* @param {Object} [body] - Request body
|
|
94
|
-
* @returns {Promise<any>} Response data
|
|
95
|
-
*/
|
|
96
|
-
async put(path, body = {}) {
|
|
97
|
-
const headers = this.getAuthHeaders();
|
|
98
|
-
|
|
99
|
-
const response = await fetch(this._buildURL(path), {
|
|
100
|
-
method: 'PUT',
|
|
101
|
-
headers,
|
|
102
|
-
body: JSON.stringify(body),
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
return this._handleResponse(response);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Make PATCH request
|
|
110
|
-
* @param {string} path - API path
|
|
111
|
-
* @param {Object} [body] - Request body
|
|
112
|
-
* @returns {Promise<any>} Response data
|
|
113
|
-
*/
|
|
114
|
-
async patch(path, body = {}) {
|
|
115
|
-
const headers = this.getAuthHeaders();
|
|
116
|
-
|
|
117
|
-
const response = await fetch(this._buildURL(path), {
|
|
118
|
-
method: 'PATCH',
|
|
119
|
-
headers,
|
|
120
|
-
body: JSON.stringify(body),
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
return this._handleResponse(response);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Make DELETE request
|
|
128
|
-
* @param {string} path - API path
|
|
129
|
-
* @param {Object} [body] - Request body
|
|
130
|
-
* @returns {Promise<any>} Response data
|
|
131
|
-
*/
|
|
132
|
-
async delete(path, body = null) {
|
|
133
|
-
const headers = this.getAuthHeaders();
|
|
134
|
-
|
|
135
|
-
const options = {
|
|
136
|
-
method: 'DELETE',
|
|
137
|
-
headers,
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
if (body) {
|
|
141
|
-
options.body = JSON.stringify(body);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const response = await fetch(this._buildURL(path), options);
|
|
145
|
-
|
|
146
|
-
return this._handleResponse(response);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Handle API response
|
|
151
|
-
* @private
|
|
152
|
-
*/
|
|
153
|
-
async _handleResponse(response) {
|
|
154
|
-
const contentType = response.headers.get('content-type');
|
|
155
|
-
|
|
156
|
-
// Handle non-JSON responses
|
|
157
|
-
if (!contentType || !contentType.includes('application/json')) {
|
|
158
|
-
if (!response.ok) {
|
|
159
|
-
throw new Error(`API error: ${response.status} ${response.statusText}`);
|
|
160
|
-
}
|
|
161
|
-
return response.text();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const data = await response.json();
|
|
165
|
-
|
|
166
|
-
if (!response.ok) {
|
|
167
|
-
throw new Error(data.message || data.error || `API error: ${response.status}`);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return data;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export default OblienClient;
|