@ragwalla/agents-sdk 1.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/LICENSE +21 -0
- package/README.md +332 -0
- package/dist/client/http-client.d.ts +22 -0
- package/dist/client/http-client.d.ts.map +1 -0
- package/dist/client/http-client.js +150 -0
- package/dist/client/http-client.js.map +1 -0
- package/dist/client/websocket-client.d.ts +51 -0
- package/dist/client/websocket-client.d.ts.map +1 -0
- package/dist/client/websocket-client.js +160 -0
- package/dist/client/websocket-client.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/agents.d.ts +75 -0
- package/dist/resources/agents.d.ts.map +1 -0
- package/dist/resources/agents.js +80 -0
- package/dist/resources/agents.js.map +1 -0
- package/dist/resources/quota.d.ts +32 -0
- package/dist/resources/quota.d.ts.map +1 -0
- package/dist/resources/quota.js +34 -0
- package/dist/resources/quota.js.map +1 -0
- package/dist/resources/vector-stores.d.ts +19 -0
- package/dist/resources/vector-stores.d.ts.map +1 -0
- package/dist/resources/vector-stores.js +22 -0
- package/dist/resources/vector-stores.js.map +1 -0
- package/dist/types/index.d.ts +113 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RagwallaWebSocket = void 0;
|
|
7
|
+
const ws_1 = __importDefault(require("ws"));
|
|
8
|
+
class RagwallaWebSocket {
|
|
9
|
+
constructor(config = {}) {
|
|
10
|
+
this.ws = null;
|
|
11
|
+
this.currentAttempts = 0;
|
|
12
|
+
this.isManuallyDisconnected = false;
|
|
13
|
+
this.listeners = new Map();
|
|
14
|
+
this.baseURL = config.baseURL || 'wss://api.ragwalla.com';
|
|
15
|
+
this.reconnectAttempts = config.reconnectAttempts || 3;
|
|
16
|
+
this.reconnectDelay = config.reconnectDelay || 1000;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Connect to an agent's WebSocket endpoint
|
|
20
|
+
*/
|
|
21
|
+
async connect(agentId, connectionId, token) {
|
|
22
|
+
const url = `${this.baseURL}/v1/agents/${agentId}/${connectionId}?token=${token}`;
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
this.ws = new ws_1.default(url);
|
|
25
|
+
this.ws.on('open', () => {
|
|
26
|
+
this.currentAttempts = 0;
|
|
27
|
+
this.isManuallyDisconnected = false;
|
|
28
|
+
this.emit('connected', {});
|
|
29
|
+
resolve();
|
|
30
|
+
});
|
|
31
|
+
this.ws.on('message', (data) => {
|
|
32
|
+
try {
|
|
33
|
+
const message = JSON.parse(data.toString());
|
|
34
|
+
this.handleMessage(message);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
this.emit('error', { error: 'Failed to parse message', data: data.toString() });
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
this.ws.on('close', (code, reason) => {
|
|
41
|
+
this.emit('disconnected', { code, reason });
|
|
42
|
+
if (!this.isManuallyDisconnected && this.currentAttempts < this.reconnectAttempts) {
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
this.currentAttempts++;
|
|
45
|
+
this.connect(agentId, connectionId, token).catch(() => {
|
|
46
|
+
if (this.currentAttempts >= this.reconnectAttempts) {
|
|
47
|
+
this.emit('reconnectFailed', { attempts: this.currentAttempts });
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}, this.reconnectDelay * this.currentAttempts);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
this.ws.on('error', (error) => {
|
|
54
|
+
this.emit('error', { error: error.message });
|
|
55
|
+
reject(error);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Disconnect from the WebSocket
|
|
61
|
+
*/
|
|
62
|
+
disconnect() {
|
|
63
|
+
this.isManuallyDisconnected = true;
|
|
64
|
+
if (this.ws) {
|
|
65
|
+
this.ws.close();
|
|
66
|
+
this.ws = null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Send a chat message to the agent
|
|
71
|
+
*/
|
|
72
|
+
sendMessage(message) {
|
|
73
|
+
if (!this.ws || this.ws.readyState !== ws_1.default.OPEN) {
|
|
74
|
+
throw new Error('WebSocket is not connected');
|
|
75
|
+
}
|
|
76
|
+
const payload = {
|
|
77
|
+
type: 'message',
|
|
78
|
+
data: message,
|
|
79
|
+
timestamp: new Date().toISOString()
|
|
80
|
+
};
|
|
81
|
+
this.ws.send(JSON.stringify(payload));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Send raw data to the WebSocket
|
|
85
|
+
*/
|
|
86
|
+
send(data) {
|
|
87
|
+
if (!this.ws || this.ws.readyState !== ws_1.default.OPEN) {
|
|
88
|
+
throw new Error('WebSocket is not connected');
|
|
89
|
+
}
|
|
90
|
+
this.ws.send(JSON.stringify(data));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Check if WebSocket is connected
|
|
94
|
+
*/
|
|
95
|
+
isConnected() {
|
|
96
|
+
return this.ws?.readyState === ws_1.default.OPEN;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Add event listener
|
|
100
|
+
*/
|
|
101
|
+
on(event, listener) {
|
|
102
|
+
if (!this.listeners.has(event)) {
|
|
103
|
+
this.listeners.set(event, new Set());
|
|
104
|
+
}
|
|
105
|
+
this.listeners.get(event).add(listener);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Remove event listener
|
|
109
|
+
*/
|
|
110
|
+
off(event, listener) {
|
|
111
|
+
const eventListeners = this.listeners.get(event);
|
|
112
|
+
if (eventListeners) {
|
|
113
|
+
eventListeners.delete(listener);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Remove all listeners for an event
|
|
118
|
+
*/
|
|
119
|
+
removeAllListeners(event) {
|
|
120
|
+
if (event) {
|
|
121
|
+
this.listeners.delete(event);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
this.listeners.clear();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
emit(event, data) {
|
|
128
|
+
const eventListeners = this.listeners.get(event);
|
|
129
|
+
if (eventListeners) {
|
|
130
|
+
eventListeners.forEach(listener => {
|
|
131
|
+
try {
|
|
132
|
+
listener(data);
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
console.error('Error in event listener:', error);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
handleMessage(message) {
|
|
141
|
+
switch (message.type) {
|
|
142
|
+
case 'message':
|
|
143
|
+
this.emit('message', message.data);
|
|
144
|
+
break;
|
|
145
|
+
case 'token_usage':
|
|
146
|
+
this.emit('tokenUsage', message.data);
|
|
147
|
+
break;
|
|
148
|
+
case 'error':
|
|
149
|
+
this.emit('error', message.data);
|
|
150
|
+
break;
|
|
151
|
+
case 'connection_status':
|
|
152
|
+
this.emit('connectionStatus', message.data);
|
|
153
|
+
break;
|
|
154
|
+
default:
|
|
155
|
+
this.emit('rawMessage', message);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.RagwallaWebSocket = RagwallaWebSocket;
|
|
160
|
+
//# sourceMappingURL=websocket-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"websocket-client.js","sourceRoot":"","sources":["../../src/client/websocket-client.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA2B;AAS3B,MAAa,iBAAiB;I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CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBACtC,MAAM;YACR,KAAK,OAAO;gBACV,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBACjC,MAAM;YACR,KAAK,mBAAmB;gBACtB,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC5C,MAAM;YACR;gBACE,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;CACF;AA1KD,8CA0KC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RagwallaWebSocket } from './client/websocket-client';
|
|
2
|
+
import { AgentsResource } from './resources/agents';
|
|
3
|
+
import { VectorStoresResource } from './resources/vector-stores';
|
|
4
|
+
import { QuotaResource } from './resources/quota';
|
|
5
|
+
import { RagwallaConfig } from './types';
|
|
6
|
+
export declare class Ragwalla {
|
|
7
|
+
readonly agents: AgentsResource;
|
|
8
|
+
readonly vectorStores: VectorStoresResource;
|
|
9
|
+
readonly quota: QuotaResource;
|
|
10
|
+
private httpClient;
|
|
11
|
+
constructor(config: RagwallaConfig);
|
|
12
|
+
/**
|
|
13
|
+
* Create a WebSocket connection for real-time communication
|
|
14
|
+
*/
|
|
15
|
+
createWebSocket(config?: {
|
|
16
|
+
baseURL?: string;
|
|
17
|
+
reconnectAttempts?: number;
|
|
18
|
+
reconnectDelay?: number;
|
|
19
|
+
}): RagwallaWebSocket;
|
|
20
|
+
/**
|
|
21
|
+
* Static method to create a Ragwalla client
|
|
22
|
+
*/
|
|
23
|
+
static create(config: RagwallaConfig): Ragwalla;
|
|
24
|
+
}
|
|
25
|
+
export * from './types';
|
|
26
|
+
export * from './client/http-client';
|
|
27
|
+
export * from './client/websocket-client';
|
|
28
|
+
export * from './resources/agents';
|
|
29
|
+
export * from './resources/vector-stores';
|
|
30
|
+
export * from './resources/quota';
|
|
31
|
+
export default Ragwalla;
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,qBAAa,QAAQ;IACnB,SAAgB,MAAM,EAAE,cAAc,CAAC;IACvC,SAAgB,YAAY,EAAE,oBAAoB,CAAC;IACnD,SAAgB,KAAK,EAAE,aAAa,CAAC;IAErC,OAAO,CAAC,UAAU,CAAa;gBAEnB,MAAM,EAAE,cAAc;IAWlC;;OAEG;IACH,eAAe,CAAC,MAAM,CAAC,EAAE;QACvB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GAAG,iBAAiB;IAIrB;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,QAAQ;CAGhD;AAGD,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAGlC,eAAe,QAAQ,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Ragwalla = void 0;
|
|
18
|
+
const http_client_1 = require("./client/http-client");
|
|
19
|
+
const websocket_client_1 = require("./client/websocket-client");
|
|
20
|
+
const agents_1 = require("./resources/agents");
|
|
21
|
+
const vector_stores_1 = require("./resources/vector-stores");
|
|
22
|
+
const quota_1 = require("./resources/quota");
|
|
23
|
+
class Ragwalla {
|
|
24
|
+
constructor(config) {
|
|
25
|
+
if (!config.apiKey) {
|
|
26
|
+
throw new Error('Ragwalla API key is required');
|
|
27
|
+
}
|
|
28
|
+
this.httpClient = new http_client_1.HTTPClient(config);
|
|
29
|
+
this.agents = new agents_1.AgentsResource(this.httpClient);
|
|
30
|
+
this.vectorStores = new vector_stores_1.VectorStoresResource(this.httpClient);
|
|
31
|
+
this.quota = new quota_1.QuotaResource(this.httpClient);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a WebSocket connection for real-time communication
|
|
35
|
+
*/
|
|
36
|
+
createWebSocket(config) {
|
|
37
|
+
return new websocket_client_1.RagwallaWebSocket(config);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Static method to create a Ragwalla client
|
|
41
|
+
*/
|
|
42
|
+
static create(config) {
|
|
43
|
+
return new Ragwalla(config);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.Ragwalla = Ragwalla;
|
|
47
|
+
// Export all types and classes
|
|
48
|
+
__exportStar(require("./types"), exports);
|
|
49
|
+
__exportStar(require("./client/http-client"), exports);
|
|
50
|
+
__exportStar(require("./client/websocket-client"), exports);
|
|
51
|
+
__exportStar(require("./resources/agents"), exports);
|
|
52
|
+
__exportStar(require("./resources/vector-stores"), exports);
|
|
53
|
+
__exportStar(require("./resources/quota"), exports);
|
|
54
|
+
// Default export
|
|
55
|
+
exports.default = Ragwalla;
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,sDAAkD;AAClD,gEAA8D;AAC9D,+CAAoD;AACpD,6DAAiE;AACjE,6CAAkD;AAGlD,MAAa,QAAQ;IAOnB,YAAY,MAAsB;QAChC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;QAED,IAAI,CAAC,UAAU,GAAG,IAAI,wBAAU,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,IAAI,uBAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClD,IAAI,CAAC,YAAY,GAAG,IAAI,oCAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9D,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,MAIf;QACC,OAAO,IAAI,oCAAiB,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,MAAsB;QAClC,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;CACF;AAnCD,4BAmCC;AAED,+BAA+B;AAC/B,0CAAwB;AACxB,uDAAqC;AACrC,4DAA0C;AAC1C,qDAAmC;AACnC,4DAA0C;AAC1C,oDAAkC;AAElC,iBAAiB;AACjB,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { HTTPClient } from '../client/http-client';
|
|
2
|
+
import { Agent, CreateAgentRequest, ChatCompletionRequest, ChatCompletionResponse, ConnectionToken, Tool } from '../types';
|
|
3
|
+
export declare class AgentsResource {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HTTPClient);
|
|
6
|
+
/**
|
|
7
|
+
* Create a new agent
|
|
8
|
+
*/
|
|
9
|
+
create(request: CreateAgentRequest): Promise<Agent>;
|
|
10
|
+
/**
|
|
11
|
+
* Retrieve an agent by ID
|
|
12
|
+
*/
|
|
13
|
+
retrieve(agentId: string): Promise<Agent>;
|
|
14
|
+
/**
|
|
15
|
+
* List all agents
|
|
16
|
+
*/
|
|
17
|
+
list(params?: {
|
|
18
|
+
limit?: number;
|
|
19
|
+
order?: 'asc' | 'desc';
|
|
20
|
+
after?: string;
|
|
21
|
+
before?: string;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
object: 'list';
|
|
24
|
+
data: Agent[];
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Update an agent
|
|
28
|
+
*/
|
|
29
|
+
update(agentId: string, request: Partial<CreateAgentRequest>): Promise<Agent>;
|
|
30
|
+
/**
|
|
31
|
+
* Delete an agent
|
|
32
|
+
*/
|
|
33
|
+
delete(agentId: string): Promise<{
|
|
34
|
+
id: string;
|
|
35
|
+
object: 'agent';
|
|
36
|
+
deleted: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Get connection token for WebSocket access
|
|
40
|
+
*/
|
|
41
|
+
getToken(params?: {
|
|
42
|
+
agent_id?: string;
|
|
43
|
+
expires_in?: number;
|
|
44
|
+
}): Promise<ConnectionToken>;
|
|
45
|
+
/**
|
|
46
|
+
* Send a message to an agent (non-streaming)
|
|
47
|
+
*/
|
|
48
|
+
createChatCompletion(agentId: string, request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Send a message to an agent (streaming)
|
|
51
|
+
*/
|
|
52
|
+
createChatCompletionStream(agentId: string, request: ChatCompletionRequest): Promise<ReadableStream<ChatCompletionResponse>>;
|
|
53
|
+
/**
|
|
54
|
+
* List tools attached to an agent
|
|
55
|
+
*/
|
|
56
|
+
listTools(agentId: string, params?: {
|
|
57
|
+
type?: 'function' | 'assistant' | 'vector_store';
|
|
58
|
+
}): Promise<{
|
|
59
|
+
object: 'list';
|
|
60
|
+
data: Tool[];
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Attach a tool to an agent
|
|
64
|
+
*/
|
|
65
|
+
attachTool(agentId: string, tool: Partial<Tool>): Promise<Tool>;
|
|
66
|
+
/**
|
|
67
|
+
* Remove a tool from an agent
|
|
68
|
+
*/
|
|
69
|
+
detachTool(agentId: string, toolId: string): Promise<{
|
|
70
|
+
id: string;
|
|
71
|
+
object: 'tool';
|
|
72
|
+
deleted: boolean;
|
|
73
|
+
}>;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/resources/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,KAAK,EACL,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,IAAI,EACL,MAAM,UAAU,CAAC;AAElB,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,kBAAkB,GAAG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AA;KAAE,GAC5D,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,IAAI,EAAE,CAAA;KAAE,CAAC;IAI5C;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAG7G"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentsResource = void 0;
|
|
4
|
+
class AgentsResource {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Create a new agent
|
|
10
|
+
*/
|
|
11
|
+
async create(request) {
|
|
12
|
+
return this.client.post('/v1/agents', request);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Retrieve an agent by ID
|
|
16
|
+
*/
|
|
17
|
+
async retrieve(agentId) {
|
|
18
|
+
return this.client.get(`/v1/agents/${agentId}`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* List all agents
|
|
22
|
+
*/
|
|
23
|
+
async list(params) {
|
|
24
|
+
return this.client.get('/v1/agents', params);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Update an agent
|
|
28
|
+
*/
|
|
29
|
+
async update(agentId, request) {
|
|
30
|
+
return this.client.put(`/v1/agents/${agentId}`, request);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Delete an agent
|
|
34
|
+
*/
|
|
35
|
+
async delete(agentId) {
|
|
36
|
+
return this.client.delete(`/v1/agents/${agentId}`);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get connection token for WebSocket access
|
|
40
|
+
*/
|
|
41
|
+
async getToken(params) {
|
|
42
|
+
return this.client.post('/v1/agents/token', params);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Send a message to an agent (non-streaming)
|
|
46
|
+
*/
|
|
47
|
+
async createChatCompletion(agentId, request) {
|
|
48
|
+
if (request.stream) {
|
|
49
|
+
throw new Error('Use createChatCompletionStream for streaming requests');
|
|
50
|
+
}
|
|
51
|
+
return this.client.post(`/v1/agents/${agentId}/chat/completions`, request);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Send a message to an agent (streaming)
|
|
55
|
+
*/
|
|
56
|
+
async createChatCompletionStream(agentId, request) {
|
|
57
|
+
const streamRequest = { ...request, stream: true };
|
|
58
|
+
return this.client.postEventStream(`/v1/agents/${agentId}/chat/completions`, streamRequest);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* List tools attached to an agent
|
|
62
|
+
*/
|
|
63
|
+
async listTools(agentId, params) {
|
|
64
|
+
return this.client.get(`/v1/agents/${agentId}/tools`, params);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Attach a tool to an agent
|
|
68
|
+
*/
|
|
69
|
+
async attachTool(agentId, tool) {
|
|
70
|
+
return this.client.post(`/v1/agents/${agentId}/tools`, tool);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Remove a tool from an agent
|
|
74
|
+
*/
|
|
75
|
+
async detachTool(agentId, toolId) {
|
|
76
|
+
return this.client.delete(`/v1/agents/${agentId}/tools/${toolId}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.AgentsResource = AgentsResource;
|
|
80
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/resources/agents.ts"],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C;IAED;;OAEG;IACH,KAAK,CAAC,0BAA0B,CAC9B,OAAe,EACf,OAA8B;QAE9B,MAAM,aAAa,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACnD,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAyB,cAAc,OAAO,mBAAmB,EAAE,aAAa,CAAC,CAAC;IACtH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CACb,OAAe,EACf,MAA6D;QAE7D,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAmC,cAAc,OAAO,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClG,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,IAAmB;QACnD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAO,cAAc,OAAO,QAAQ,EAAE,IAAI,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,MAAc;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAmD,cAAc,OAAO,UAAU,MAAM,EAAE,CAAC,CAAC;IACvH,CAAC;CACF;AApGD,wCAoGC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HTTPClient } from '../client/http-client';
|
|
2
|
+
import { QuotaEvent, QuotaStatus } from '../types';
|
|
3
|
+
export declare class QuotaResource {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HTTPClient);
|
|
6
|
+
/**
|
|
7
|
+
* Check quota status for a worker/user
|
|
8
|
+
*/
|
|
9
|
+
check(params: {
|
|
10
|
+
userId: string;
|
|
11
|
+
action: string;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
allowed: boolean;
|
|
14
|
+
quota?: QuotaStatus;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Send quota event
|
|
18
|
+
*/
|
|
19
|
+
sendEvent(workerId: string, event: QuotaEvent): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Get quota status for a worker
|
|
22
|
+
*/
|
|
23
|
+
getStatus(workerId: string): Promise<QuotaStatus>;
|
|
24
|
+
/**
|
|
25
|
+
* Set quota for a worker
|
|
26
|
+
*/
|
|
27
|
+
setQuota(workerId: string, quota: {
|
|
28
|
+
limit: number;
|
|
29
|
+
reset_period?: 'hour' | 'day' | 'month';
|
|
30
|
+
}): Promise<QuotaStatus>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=quota.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota.d.ts","sourceRoot":"","sources":["../../src/resources/quota.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEnD,qBAAa,aAAa;IACZ,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;OAEG;IACG,KAAK,CAAC,MAAM,EAAE;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,WAAW,CAAA;KAAE,CAAC;IAItD;;OAEG;IACG,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAInE;;OAEG;IACG,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIvD;;OAEG;IACG,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE;QACtC,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC;KACzC,GAAG,OAAO,CAAC,WAAW,CAAC;CAGzB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuotaResource = void 0;
|
|
4
|
+
class QuotaResource {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Check quota status for a worker/user
|
|
10
|
+
*/
|
|
11
|
+
async check(params) {
|
|
12
|
+
return this.client.post('/v1/quotacheck', params);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Send quota event
|
|
16
|
+
*/
|
|
17
|
+
async sendEvent(workerId, event) {
|
|
18
|
+
return this.client.post(`/v1/quotaevents/${workerId}`, event);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get quota status for a worker
|
|
22
|
+
*/
|
|
23
|
+
async getStatus(workerId) {
|
|
24
|
+
return this.client.get(`/v1/quota/${workerId}`);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Set quota for a worker
|
|
28
|
+
*/
|
|
29
|
+
async setQuota(workerId, quota) {
|
|
30
|
+
return this.client.post(`/v1/quota/${workerId}`, quota);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.QuotaResource = QuotaResource;
|
|
34
|
+
//# sourceMappingURL=quota.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota.js","sourceRoot":"","sources":["../../src/resources/quota.ts"],"names":[],"mappings":";;;AAGA,MAAa,aAAa;IACxB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,MAGX;QACC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAA4C,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAC/F,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,QAAgB,EAAE,KAAiB;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAO,mBAAmB,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,QAAgB;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAc,aAAa,QAAQ,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,KAGhC;QACC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAc,aAAa,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;CACF;AApCD,sCAoCC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HTTPClient } from '../client/http-client';
|
|
2
|
+
import { VectorSearchRequest, VectorSearchResponse } from '../types';
|
|
3
|
+
export declare class VectorStoresResource {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HTTPClient);
|
|
6
|
+
/**
|
|
7
|
+
* Search a vector store
|
|
8
|
+
*/
|
|
9
|
+
search(vectorStoreId: string, request: VectorSearchRequest): Promise<VectorSearchResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* Search with extended query (for code search, etc.)
|
|
12
|
+
*/
|
|
13
|
+
searchExtended(vectorStoreId: string, request: VectorSearchRequest & {
|
|
14
|
+
extended_query?: string;
|
|
15
|
+
search_type?: 'similarity' | 'mmr' | 'similarity_score_threshold';
|
|
16
|
+
search_kwargs?: Record<string, any>;
|
|
17
|
+
}): Promise<VectorSearchResponse>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=vector-stores.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-stores.d.ts","sourceRoot":"","sources":["../../src/resources/vector-stores.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAElB,qBAAa,oBAAoB;IACnB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;OAEG;IACG,MAAM,CACV,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IAIhC;;OAEG;IACG,cAAc,CAClB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,mBAAmB,GAAG;QAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,WAAW,CAAC,EAAE,YAAY,GAAG,KAAK,GAAG,4BAA4B,CAAC;QAClE,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACrC,GACA,OAAO,CAAC,oBAAoB,CAAC;CAGjC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VectorStoresResource = void 0;
|
|
4
|
+
class VectorStoresResource {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Search a vector store
|
|
10
|
+
*/
|
|
11
|
+
async search(vectorStoreId, request) {
|
|
12
|
+
return this.client.post(`/v1/vector_stores/${vectorStoreId}/search`, request);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Search with extended query (for code search, etc.)
|
|
16
|
+
*/
|
|
17
|
+
async searchExtended(vectorStoreId, request) {
|
|
18
|
+
return this.client.post(`/v1/vector_stores/${vectorStoreId}/search`, request);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.VectorStoresResource = VectorStoresResource;
|
|
22
|
+
//# sourceMappingURL=vector-stores.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-stores.js","sourceRoot":"","sources":["../../src/resources/vector-stores.ts"],"names":[],"mappings":";;;AAMA,MAAa,oBAAoB;IAC/B,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,aAAqB,EACrB,OAA4B;QAE5B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAuB,qBAAqB,aAAa,SAAS,EAAE,OAAO,CAAC,CAAC;IACtG,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAClB,aAAqB,EACrB,OAIC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAuB,qBAAqB,aAAa,SAAS,EAAE,OAAO,CAAC,CAAC;IACtG,CAAC;CACF;AA1BD,oDA0BC"}
|