@qelos/sdk 3.11.11 → 4.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/README.md +31 -0
- package/dist/__tests__/blueprints.types.test-d.d.ts +28 -0
- package/dist/__tests__/blueprints.types.test-d.js +11 -0
- package/dist/__tests__/blueprints.types.test-d.js.map +1 -0
- package/dist/administrator/events.d.ts +5 -0
- package/dist/administrator/events.js +8 -0
- package/dist/administrator/events.js.map +1 -1
- package/dist/ai/agents.d.ts +56 -0
- package/dist/ai/agents.js +116 -0
- package/dist/ai/agents.js.map +1 -0
- package/dist/ai/index.d.ts +9 -3
- package/dist/ai/index.js +8 -1
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/types.d.ts +61 -0
- package/dist/authentication.d.ts +64 -1
- package/dist/authentication.js +137 -0
- package/dist/authentication.js.map +1 -1
- package/dist/base-sdk.d.ts +3 -0
- package/dist/base-sdk.js +16 -2
- package/dist/base-sdk.js.map +1 -1
- package/dist/blueprints-entities.d.ts +26 -0
- package/dist/blueprints-entities.js +91 -5
- package/dist/blueprints-entities.js.map +1 -1
- package/dist/blueprints.d.ts +3 -0
- package/dist/blueprints.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/workspaces.d.ts +16 -0
- package/dist/workspaces.js +40 -0
- package/dist/workspaces.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/blueprints.types.test-d.ts +49 -0
- package/src/administrator/events.ts +6 -1
- package/src/ai/agents.ts +171 -0
- package/src/ai/index.ts +22 -4
- package/src/ai/types.ts +66 -0
- package/src/authentication.ts +181 -1
- package/src/base-sdk.ts +16 -2
- package/src/blueprints-entities.ts +113 -5
- package/src/blueprints.ts +9 -2
- package/src/index.ts +26 -1
- package/src/workspaces.ts +63 -0
- package/test/authentication-social.test.ts +48 -0
- package/test/base-sdk.test.ts +26 -1
- package/test/index.test.ts +2 -1
- package/test/qelos-sdk-refresh.test.ts +2 -1
- package/test/workspaces.test.ts +170 -0
package/README.md
CHANGED
|
@@ -86,4 +86,35 @@ function MyPostsList() {
|
|
|
86
86
|
}
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
+
### Authentication
|
|
90
|
+
|
|
91
|
+
The `sdk.authentication` namespace exposes signin/signup, token refresh,
|
|
92
|
+
social-auth, and the current-user accessor.
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
// Username + password
|
|
96
|
+
const { payload, headers } = await sdk.authentication.signin({
|
|
97
|
+
username: 'jane',
|
|
98
|
+
password: 'secret',
|
|
99
|
+
});
|
|
100
|
+
// headers['set-cookie'] — auth cookie issued by Qelos
|
|
101
|
+
|
|
102
|
+
// Refresh an access + refresh token pair (oauth-style)
|
|
103
|
+
await sdk.authentication.refreshToken();
|
|
104
|
+
|
|
105
|
+
// Refresh a cookie-token session (used by integrator-hosted apps that keep
|
|
106
|
+
// the user signed in via an HttpOnly cookie). Returns the rotated cookie
|
|
107
|
+
// and the refreshed user — forward `set-cookie` to your downstream response.
|
|
108
|
+
const result = await sdk.authentication.refreshCookieToken();
|
|
109
|
+
// result.headers['set-cookie'] — new cookie value to forward
|
|
110
|
+
// result.payload.user — refreshed user
|
|
111
|
+
// result.payload.cookieToken — raw token (also embedded in set-cookie)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
When a server-side host (`integrator-express`, `-next`, `-nuxt`, `-fastify`,
|
|
115
|
+
`-nest`) wraps the SDK, `refreshCookieToken()` is called automatically on
|
|
116
|
+
expired cookie-only sessions and the rotated cookie is written back to the
|
|
117
|
+
outbound response. Call it directly only when you need to refresh
|
|
118
|
+
proactively — e.g. before handing the session off to another service.
|
|
119
|
+
|
|
89
120
|
Enjoy!
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { IBaseBlueprintEntity } from '../blueprints-entities';
|
|
2
|
+
import type QlBlueprintEntities from '../blueprints-entities';
|
|
3
|
+
interface TodoProperties {
|
|
4
|
+
title: string;
|
|
5
|
+
done: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface TodoEntity extends IBaseBlueprintEntity, TodoProperties {
|
|
8
|
+
}
|
|
9
|
+
declare module '../blueprints' {
|
|
10
|
+
interface BlueprintEntitiesRegistry {
|
|
11
|
+
todo: TodoEntity;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false;
|
|
15
|
+
type Expect<T extends true> = T;
|
|
16
|
+
declare const todos: QlBlueprintEntities<TodoEntity>;
|
|
17
|
+
type TodosCheck = Expect<Equal<typeof todos, QlBlueprintEntities<TodoEntity>>>;
|
|
18
|
+
declare const found: Awaited<ReturnType<typeof todos.find>>;
|
|
19
|
+
type FoundCheck = Expect<Equal<typeof found, (IBaseBlueprintEntity & TodoEntity)[]>>;
|
|
20
|
+
interface AdHoc {
|
|
21
|
+
name: string;
|
|
22
|
+
}
|
|
23
|
+
declare const adhoc: QlBlueprintEntities<AdHoc>;
|
|
24
|
+
type AdHocCheck = Expect<Equal<typeof adhoc, QlBlueprintEntities<AdHoc>>>;
|
|
25
|
+
declare const loose: QlBlueprintEntities<any>;
|
|
26
|
+
type LooseCheck = Expect<Equal<typeof loose, QlBlueprintEntities<any>>>;
|
|
27
|
+
export type _Checks = [TodosCheck, FoundCheck, AdHocCheck, LooseCheck];
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Compile-only type test for `BlueprintEntitiesRegistry` augmentation
|
|
2
|
+
// and the overloaded `entitiesOf` signatures. Runs as part of `tsc --noEmit`
|
|
3
|
+
// (type-check / build); not executed by `node --test`.
|
|
4
|
+
// 1. Registry-keyed lookup resolves to the augmented entity type.
|
|
5
|
+
const todos = blueprints.entitiesOf('todo');
|
|
6
|
+
const adhoc = blueprints.entitiesOf('not-in-registry');
|
|
7
|
+
// 3. Plain string key with no generic falls back to `any` (legacy behavior).
|
|
8
|
+
const dynamicKey = 'todo';
|
|
9
|
+
const loose = blueprints.entitiesOf(dynamicKey);
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=blueprints.types.test-d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blueprints.types.test-d.js","sourceRoot":"","sources":["../../src/__tests__/blueprints.types.test-d.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6EAA6E;AAC7E,uDAAuD;AAyBvD,kEAAkE;AAClE,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAW5C,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,CAAQ,iBAAiB,CAAC,CAAC;AAG9D,6EAA6E;AAC7E,MAAM,UAAU,GAAW,MAAM,CAAC;AAClC,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -3,6 +3,7 @@ import BaseSDK from '../base-sdk';
|
|
|
3
3
|
export interface IQelosEvent {
|
|
4
4
|
tenant: string;
|
|
5
5
|
user?: string;
|
|
6
|
+
workspace?: string;
|
|
6
7
|
source: string;
|
|
7
8
|
kind: string;
|
|
8
9
|
eventName: string;
|
|
@@ -15,12 +16,16 @@ export default class QlEvents extends BaseSDK {
|
|
|
15
16
|
constructor(options: QelosSDKOptions);
|
|
16
17
|
getList(params?: {
|
|
17
18
|
page?: number;
|
|
19
|
+
limit?: number;
|
|
18
20
|
kind?: string;
|
|
19
21
|
eventName?: string;
|
|
20
22
|
source?: string;
|
|
21
23
|
user?: string;
|
|
22
24
|
workspace?: string;
|
|
25
|
+
search?: string;
|
|
23
26
|
period?: string;
|
|
27
|
+
from?: string;
|
|
28
|
+
to?: string;
|
|
24
29
|
}): Promise<IQelosEvent[]>;
|
|
25
30
|
getEvent(eventId: string): Promise<IQelosEvent>;
|
|
26
31
|
dispatch(payload: Partial<IQelosEvent>): Promise<void>;
|
|
@@ -8,6 +8,8 @@ export default class QlEvents extends BaseSDK {
|
|
|
8
8
|
const queryParams = new URLSearchParams();
|
|
9
9
|
if (params?.page !== undefined)
|
|
10
10
|
queryParams.append('page', params.page.toString());
|
|
11
|
+
if (params?.limit !== undefined)
|
|
12
|
+
queryParams.append('limit', params.limit.toString());
|
|
11
13
|
if (params?.kind)
|
|
12
14
|
queryParams.append('kind', params.kind);
|
|
13
15
|
if (params?.eventName)
|
|
@@ -18,8 +20,14 @@ export default class QlEvents extends BaseSDK {
|
|
|
18
20
|
queryParams.append('user', params.user);
|
|
19
21
|
if (params?.workspace)
|
|
20
22
|
queryParams.append('workspace', params.workspace);
|
|
23
|
+
if (params?.search)
|
|
24
|
+
queryParams.append('search', params.search);
|
|
21
25
|
if (params?.period)
|
|
22
26
|
queryParams.append('period', params.period);
|
|
27
|
+
if (params?.from)
|
|
28
|
+
queryParams.append('from', params.from);
|
|
29
|
+
if (params?.to)
|
|
30
|
+
queryParams.append('to', params.to);
|
|
23
31
|
const queryString = queryParams.toString();
|
|
24
32
|
return this.callJsonApi(this.relativePath + (queryString ? '?' + queryString : ''));
|
|
25
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/administrator/events.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/administrator/events.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,aAAa,CAAC;AAclC,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,OAAO;IACnC,YAAY,GAAG,aAAa,CAAC;IAErC,YAAY,OAAwB;QAClC,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;IAED,OAAO,CAAC,MAA+L;QACrM,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAC1C,IAAI,MAAM,EAAE,IAAI,KAAK,SAAS;YAAE,WAAW,CAAC,MAAM,CAAC,MA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,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrG,CAAC;IAED,QAAQ,CAAC,OAAe;QACtB,OAAO,IAAI,CAAC,WAAW,CAAc,IAAI,CAAC,YAAY,GAAG,GAAG,GAAG,OAAO,CAAC,CAAA;IACzE,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAA6B;QAC1C,MAAM,IAAI,CAAC,OAAO,CAChB,IAAI,CAAC,YAAY,EACjB;YACE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,EAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SAC9B,CACF,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import BaseSDK from '../base-sdk';
|
|
2
|
+
import { QelosSDKOptions } from '../types';
|
|
3
|
+
import ChatSDK from './chat';
|
|
4
|
+
import { IAgent, IAgentChatOptions, IChatCompletionResponse, ICreateAgentRequest, ISSEStreamProcessor, IUpdateAgentRequest } from '.';
|
|
5
|
+
export default class AgentsSDK extends BaseSDK {
|
|
6
|
+
private chatSdk;
|
|
7
|
+
private relativePath;
|
|
8
|
+
constructor(options: QelosSDKOptions, chatSdk: ChatSDK);
|
|
9
|
+
/**
|
|
10
|
+
* List available AI agents for the current tenant
|
|
11
|
+
*/
|
|
12
|
+
list(query?: {
|
|
13
|
+
active?: boolean;
|
|
14
|
+
kind?: string;
|
|
15
|
+
limit?: number;
|
|
16
|
+
page?: number;
|
|
17
|
+
sort?: string;
|
|
18
|
+
[key: string]: string | number | boolean;
|
|
19
|
+
}): Promise<IAgent[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Get a specific agent by ID (model, tools, system prompt, etc.)
|
|
22
|
+
*/
|
|
23
|
+
get(agentId: string): Promise<IAgent>;
|
|
24
|
+
/**
|
|
25
|
+
* Create a new agent (chat-completion integration)
|
|
26
|
+
*/
|
|
27
|
+
create(data: ICreateAgentRequest): Promise<IAgent>;
|
|
28
|
+
/**
|
|
29
|
+
* Update agent configuration
|
|
30
|
+
*/
|
|
31
|
+
update(agentId: string, data: IUpdateAgentRequest): Promise<IAgent>;
|
|
32
|
+
/**
|
|
33
|
+
* Delete an agent
|
|
34
|
+
*/
|
|
35
|
+
remove(agentId: string): Promise<{
|
|
36
|
+
success: boolean;
|
|
37
|
+
message?: string;
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* Send messages to an agent (non-streaming). The service creates a thread unless `threadId` is passed.
|
|
41
|
+
*/
|
|
42
|
+
chat(agentId: string, message: string, options?: IAgentChatOptions): Promise<IChatCompletionResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* Stream a response via GET + SSE (`/api/ai/agents/:id/chat`).
|
|
45
|
+
*/
|
|
46
|
+
streamChat(agentId: string, message: string, options?: IAgentChatOptions): Promise<ISSEStreamProcessor>;
|
|
47
|
+
/**
|
|
48
|
+
* Continue in an existing thread (non-streaming)
|
|
49
|
+
*/
|
|
50
|
+
chatInThread(agentId: string, threadId: string, message: string, options?: IAgentChatOptions): Promise<IChatCompletionResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* Stream within an existing thread (GET + SSE)
|
|
53
|
+
*/
|
|
54
|
+
streamChatInThread(agentId: string, threadId: string, message: string, options?: IAgentChatOptions): Promise<ISSEStreamProcessor>;
|
|
55
|
+
private openAgentChatStream;
|
|
56
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import BaseSDK from '../base-sdk';
|
|
2
|
+
export default class AgentsSDK extends BaseSDK {
|
|
3
|
+
chatSdk;
|
|
4
|
+
relativePath = '/api/ai/agents';
|
|
5
|
+
constructor(options, chatSdk) {
|
|
6
|
+
super(options);
|
|
7
|
+
this.chatSdk = chatSdk;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* List available AI agents for the current tenant
|
|
11
|
+
*/
|
|
12
|
+
list(query) {
|
|
13
|
+
return this.callJsonApi(`${this.relativePath}${this.getQueryParams(query)}`);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get a specific agent by ID (model, tools, system prompt, etc.)
|
|
17
|
+
*/
|
|
18
|
+
get(agentId) {
|
|
19
|
+
return this.callJsonApi(`${this.relativePath}/${agentId}${this.getQueryParams({})}`);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create a new agent (chat-completion integration)
|
|
23
|
+
*/
|
|
24
|
+
create(data) {
|
|
25
|
+
return this.callJsonApi(`${this.relativePath}`, {
|
|
26
|
+
method: 'POST',
|
|
27
|
+
headers: { 'content-type': 'application/json' },
|
|
28
|
+
body: JSON.stringify(data),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Update agent configuration
|
|
33
|
+
*/
|
|
34
|
+
update(agentId, data) {
|
|
35
|
+
return this.callJsonApi(`${this.relativePath}/${agentId}`, {
|
|
36
|
+
method: 'PUT',
|
|
37
|
+
headers: { 'content-type': 'application/json' },
|
|
38
|
+
body: JSON.stringify(data),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Delete an agent
|
|
43
|
+
*/
|
|
44
|
+
remove(agentId) {
|
|
45
|
+
return this.callJsonApi(`${this.relativePath}/${agentId}`, {
|
|
46
|
+
method: 'DELETE',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Send messages to an agent (non-streaming). The service creates a thread unless `threadId` is passed.
|
|
51
|
+
*/
|
|
52
|
+
chat(agentId, message, options = {}) {
|
|
53
|
+
const { history, threadId, ...rest } = options;
|
|
54
|
+
const messages = [...(history || []), { role: 'user', content: message }];
|
|
55
|
+
return this.callJsonApi(`${this.relativePath}/${agentId}/chat`, {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
headers: { 'content-type': 'application/json' },
|
|
58
|
+
body: JSON.stringify({
|
|
59
|
+
...rest,
|
|
60
|
+
messages,
|
|
61
|
+
...(threadId ? { threadId } : {}),
|
|
62
|
+
}),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Stream a response via GET + SSE (`/api/ai/agents/:id/chat`).
|
|
67
|
+
*/
|
|
68
|
+
async streamChat(agentId, message, options = {}) {
|
|
69
|
+
const stream = await this.openAgentChatStream(agentId, message, options);
|
|
70
|
+
return this.chatSdk.parseSSEStream(stream);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Continue in an existing thread (non-streaming)
|
|
74
|
+
*/
|
|
75
|
+
chatInThread(agentId, threadId, message, options = {}) {
|
|
76
|
+
return this.chat(agentId, message, { ...options, threadId });
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Stream within an existing thread (GET + SSE)
|
|
80
|
+
*/
|
|
81
|
+
async streamChatInThread(agentId, threadId, message, options = {}) {
|
|
82
|
+
const stream = await this.openAgentChatStream(agentId, message, { ...options, threadId });
|
|
83
|
+
return this.chatSdk.parseSSEStream(stream);
|
|
84
|
+
}
|
|
85
|
+
async openAgentChatStream(agentId, message, options) {
|
|
86
|
+
const { history, threadId, queryParams } = options;
|
|
87
|
+
const messages = [...(history || []), { role: 'user', content: message }];
|
|
88
|
+
const params = new URLSearchParams();
|
|
89
|
+
params.set('messages', JSON.stringify(messages));
|
|
90
|
+
if (threadId) {
|
|
91
|
+
params.set('threadId', threadId);
|
|
92
|
+
}
|
|
93
|
+
if (queryParams) {
|
|
94
|
+
for (const [key, value] of Object.entries(queryParams)) {
|
|
95
|
+
if (value !== undefined && value !== null) {
|
|
96
|
+
params.set(key, String(value));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const q = params.toString();
|
|
101
|
+
const response = await this.callApi(`${this.relativePath}/${agentId}/chat?${q}`, {
|
|
102
|
+
method: 'GET',
|
|
103
|
+
headers: {
|
|
104
|
+
accept: 'text/event-stream',
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
if (!response.ok) {
|
|
108
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
109
|
+
}
|
|
110
|
+
if (!response.body) {
|
|
111
|
+
throw new Error('No response body for agent chat stream');
|
|
112
|
+
}
|
|
113
|
+
return response.body;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/ai/agents.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAalC,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,OAAO;IAKlC;IAJF,YAAY,GAAG,gBAAgB,CAAC;IAExC,YACE,OAAwB,EAChB,OAAgB;QAExB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFP,YAAO,GAAP,OAAO,CAAS;IAG1B,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,KAOJ;QACC,OAAO,IAAI,CAAC,WAAW,CAAW,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,OAAe;QACjB,OAAO,IAAI,CAAC,WAAW,CAAS,GAAG,IAAI,CAAC,YAAY,IAAI,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAyB;QAC9B,OAAO,IAAI,CAAC,WAAW,CAAS,GAAG,IAAI,CAAC,YAAY,EAAE,EAAE;YACtD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAC;IACL,CAAC;IAED;;OAEG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O,CAAC,WAAW,CAAC,EAAE;gBACtD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE;oBACzC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;iBAChC;aACF;SACF;QACD,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,YAAY,IAAI,OAAO,SAAS,CAAC,EAAE,EAAE;YAC/E,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,MAAM,EAAE,mBAAmB;aAC5B;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,QAAQ,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;SACpE;QAED,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;YAClB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;SAC3D;QAED,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF"}
|
package/dist/ai/index.d.ts
CHANGED
|
@@ -3,13 +3,15 @@ import BaseSDK from '../base-sdk';
|
|
|
3
3
|
import ThreadsSDK from './threads';
|
|
4
4
|
import ChatSDK from './chat';
|
|
5
5
|
import RagSDK from './rag';
|
|
6
|
-
import
|
|
6
|
+
import AgentsSDK from './agents';
|
|
7
|
+
import { IMessage, IMessageSummary, IThread, IChatCompletionOptions, ISSEStreamProcessor, IChatCompletionResponse, ICreateThreadRequest, ICreateVectorStorageRequest, IUploadContentRequest, IClearStorageRequest, IVectorStore, IAgent, IAgentChatOptions, IAgentTool, ICreateAgentRequest, IUpdateAgentRequest } from './types';
|
|
7
8
|
export * from './types';
|
|
8
|
-
export { IMessage, IMessageSummary, IThread, IChatCompletionOptions, ISSEStreamProcessor, IChatCompletionResponse, ICreateThreadRequest, ICreateVectorStorageRequest, IUploadContentRequest, IClearStorageRequest, IVectorStore };
|
|
9
|
+
export { IMessage, IMessageSummary, IThread, IChatCompletionOptions, ISSEStreamProcessor, IChatCompletionResponse, ICreateThreadRequest, ICreateVectorStorageRequest, IUploadContentRequest, IClearStorageRequest, IVectorStore, IAgent, IAgentChatOptions, IAgentTool, ICreateAgentRequest, IUpdateAgentRequest, };
|
|
9
10
|
/**
|
|
10
11
|
* Qelos AI SDK - Main SDK class with three sub-SDKs
|
|
11
12
|
*
|
|
12
|
-
* This class provides access to AI functionality through
|
|
13
|
+
* This class provides access to AI functionality through sub-SDKs:
|
|
14
|
+
* - `agents`: Agent management and agent-centric chat (recommended entry point)
|
|
13
15
|
* - `threads`: Thread CRUD operations for managing conversation threads
|
|
14
16
|
* - `chat`: Chat completion operations (streaming and non-streaming)
|
|
15
17
|
* - `rag`: Vector storage management for Retrieval-Augmented Generation
|
|
@@ -48,6 +50,10 @@ export default class QlAI extends BaseSDK {
|
|
|
48
50
|
* RAG sub-SDK for vector storage management
|
|
49
51
|
*/
|
|
50
52
|
rag: RagSDK;
|
|
53
|
+
/**
|
|
54
|
+
* Agents sub-SDK for managing AI agents and agent-centric chat
|
|
55
|
+
*/
|
|
56
|
+
agents: AgentsSDK;
|
|
51
57
|
/**
|
|
52
58
|
* Initialize the AI SDK with sub-SDKs
|
|
53
59
|
*
|
package/dist/ai/index.js
CHANGED
|
@@ -2,11 +2,13 @@ import BaseSDK from '../base-sdk';
|
|
|
2
2
|
import ThreadsSDK from './threads';
|
|
3
3
|
import ChatSDK from './chat';
|
|
4
4
|
import RagSDK from './rag';
|
|
5
|
+
import AgentsSDK from './agents';
|
|
5
6
|
export * from './types';
|
|
6
7
|
/**
|
|
7
8
|
* Qelos AI SDK - Main SDK class with three sub-SDKs
|
|
8
9
|
*
|
|
9
|
-
* This class provides access to AI functionality through
|
|
10
|
+
* This class provides access to AI functionality through sub-SDKs:
|
|
11
|
+
* - `agents`: Agent management and agent-centric chat (recommended entry point)
|
|
10
12
|
* - `threads`: Thread CRUD operations for managing conversation threads
|
|
11
13
|
* - `chat`: Chat completion operations (streaming and non-streaming)
|
|
12
14
|
* - `rag`: Vector storage management for Retrieval-Augmented Generation
|
|
@@ -46,6 +48,10 @@ export default class QlAI extends BaseSDK {
|
|
|
46
48
|
* RAG sub-SDK for vector storage management
|
|
47
49
|
*/
|
|
48
50
|
rag;
|
|
51
|
+
/**
|
|
52
|
+
* Agents sub-SDK for managing AI agents and agent-centric chat
|
|
53
|
+
*/
|
|
54
|
+
agents;
|
|
49
55
|
/**
|
|
50
56
|
* Initialize the AI SDK with sub-SDKs
|
|
51
57
|
*
|
|
@@ -56,6 +62,7 @@ export default class QlAI extends BaseSDK {
|
|
|
56
62
|
this.threads = new ThreadsSDK(options);
|
|
57
63
|
this.chat = new ChatSDK(options);
|
|
58
64
|
this.rag = new RagSDK(options);
|
|
65
|
+
this.agents = new AgentsSDK(options, this.chat);
|
|
59
66
|
}
|
|
60
67
|
// Legacy methods for backward compatibility
|
|
61
68
|
/**
|
package/dist/ai/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,UAAU,MAAM,WAAW,CAAC;AACnC,OAAO,OAAO,MAAM,QAAQ,CAAC;AAC7B,OAAO,MAAM,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,UAAU,MAAM,WAAW,CAAC;AACnC,OAAO,OAAO,MAAM,QAAQ,CAAC;AAC7B,OAAO,MAAM,MAAM,OAAO,CAAC;AAC3B,OAAO,SAAS,MAAM,UAAU,CAAC;AAoBjC,cAAc,SAAS,CAAC;AAsBx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,sBAAsB,CACpB,aAAqB,EACrB,QAAgB,EAChB,OAA+B;QAE/B,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CACd,aAAqB,EACrB,OAA+B;QAE/B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CACtB,aAAqB,EACrB,QAAgB,EAChB,OAA+B;QAE/B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,MAAkC;QAC/C,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
package/dist/ai/types.d.ts
CHANGED
|
@@ -96,3 +96,64 @@ export interface IVectorStore {
|
|
|
96
96
|
expirationAfterDays?: number;
|
|
97
97
|
created: Date;
|
|
98
98
|
}
|
|
99
|
+
export interface IAgentTool {
|
|
100
|
+
name: string;
|
|
101
|
+
description: string;
|
|
102
|
+
schema?: object;
|
|
103
|
+
}
|
|
104
|
+
export interface IAgent {
|
|
105
|
+
_id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
description?: string;
|
|
108
|
+
model?: string;
|
|
109
|
+
kind?: string[];
|
|
110
|
+
active?: boolean;
|
|
111
|
+
tenant?: string;
|
|
112
|
+
user?: string;
|
|
113
|
+
workspace?: string;
|
|
114
|
+
systemPrompt?: string;
|
|
115
|
+
tools?: IAgentTool[];
|
|
116
|
+
temperature?: number;
|
|
117
|
+
maxTokens?: number;
|
|
118
|
+
triggerSource?: string;
|
|
119
|
+
targetSource?: string;
|
|
120
|
+
created?: Date;
|
|
121
|
+
updated?: Date;
|
|
122
|
+
}
|
|
123
|
+
/** Payload for `sdk.ai.agents.create()` — maps to a chat-completion integration */
|
|
124
|
+
export interface ICreateAgentRequest {
|
|
125
|
+
name: string;
|
|
126
|
+
model: string;
|
|
127
|
+
triggerSource: string;
|
|
128
|
+
targetSource: string;
|
|
129
|
+
systemPrompt?: string;
|
|
130
|
+
tools?: IAgentTool[];
|
|
131
|
+
temperature?: number;
|
|
132
|
+
maxTokens?: number;
|
|
133
|
+
workspace?: string;
|
|
134
|
+
active?: boolean;
|
|
135
|
+
}
|
|
136
|
+
/** Partial update for `sdk.ai.agents.update()` */
|
|
137
|
+
export interface IUpdateAgentRequest {
|
|
138
|
+
name?: string;
|
|
139
|
+
model?: string;
|
|
140
|
+
triggerSource?: string;
|
|
141
|
+
targetSource?: string;
|
|
142
|
+
systemPrompt?: string;
|
|
143
|
+
tools?: IAgentTool[];
|
|
144
|
+
temperature?: number;
|
|
145
|
+
maxTokens?: number;
|
|
146
|
+
workspace?: string;
|
|
147
|
+
active?: boolean;
|
|
148
|
+
}
|
|
149
|
+
export interface IAgentChatOptions extends Partial<Omit<IChatCompletionOptions, 'messages'>> {
|
|
150
|
+
/**
|
|
151
|
+
* Additional messages to prepend before the user message
|
|
152
|
+
* (e.g. system prompt overrides, prior context)
|
|
153
|
+
*/
|
|
154
|
+
history?: IMessage[];
|
|
155
|
+
/**
|
|
156
|
+
* When set, reuses an existing thread created by a prior agent chat call.
|
|
157
|
+
*/
|
|
158
|
+
threadId?: string;
|
|
159
|
+
}
|
package/dist/authentication.d.ts
CHANGED
|
@@ -37,9 +37,51 @@ export interface IApiToken {
|
|
|
37
37
|
tokenPrefix: string;
|
|
38
38
|
expiresAt: string;
|
|
39
39
|
lastUsedAt?: string;
|
|
40
|
-
|
|
40
|
+
/** Workspace scope when set; may be an id string or a populated `{ _id, name }` from list responses */
|
|
41
|
+
workspace?: string | {
|
|
42
|
+
_id: string;
|
|
43
|
+
name?: string;
|
|
44
|
+
} | null;
|
|
45
|
+
/** Successful API-token authentications (server-maintained). */
|
|
46
|
+
usageCount?: number;
|
|
41
47
|
created: string;
|
|
42
48
|
}
|
|
49
|
+
export type SocialProvider = 'linkedin' | 'facebook' | 'google' | 'github';
|
|
50
|
+
export interface SocialLoginOptions {
|
|
51
|
+
state?: string;
|
|
52
|
+
returnUrl?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface SocialAuthCallbackPayload {
|
|
55
|
+
payload: BasicPayload & {
|
|
56
|
+
workspace?: any;
|
|
57
|
+
};
|
|
58
|
+
headers: {
|
|
59
|
+
'set-cookie': string | null;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Present when the runtime exposes multiple `Set-Cookie` headers (Node fetch
|
|
63
|
+
* `getSetCookie()`). Use {@link getSocialAuthSetCookieParts} to apply cookies.
|
|
64
|
+
*/
|
|
65
|
+
setCookieHeaders?: string[];
|
|
66
|
+
}
|
|
67
|
+
/** Callback URL or query bag carrying `rt` from `GET …/callback?rt=…`. */
|
|
68
|
+
export type SocialCallbackInput = string | URL | URLSearchParams | Record<string, string | string[] | undefined>;
|
|
69
|
+
/**
|
|
70
|
+
* Read the OAuth refresh token from a social callback request (query `rt`).
|
|
71
|
+
* Accepts a full URL, a {@link URL}, `URLSearchParams`, or a query object such
|
|
72
|
+
* as `req.query` from Next.js or Express.
|
|
73
|
+
*/
|
|
74
|
+
export declare function parseSocialCallbackRefreshToken(input: SocialCallbackInput): string | undefined;
|
|
75
|
+
/** Lists individual `Set-Cookie` values from an exchange result for writing to a response. */
|
|
76
|
+
export declare function getSocialAuthSetCookieParts(result: SocialAuthCallbackPayload): string[];
|
|
77
|
+
/**
|
|
78
|
+
* Copies session cookies from {@link QlAuthentication.exchangeAuthCallback} /
|
|
79
|
+
* {@link QlAuthentication.socialCallback} onto an HTTP response (Express,
|
|
80
|
+
* Next.js Pages `NextApiResponse`, Node `ServerResponse`, etc.).
|
|
81
|
+
*/
|
|
82
|
+
export declare function applySocialAuthCookiesToServerResponse(res: {
|
|
83
|
+
setHeader(name: string, value: string | string[]): void;
|
|
84
|
+
}, result: SocialAuthCallbackPayload): void;
|
|
43
85
|
export default class QlAuthentication extends BaseSDK {
|
|
44
86
|
#private;
|
|
45
87
|
get accessToken(): string;
|
|
@@ -72,6 +114,17 @@ export default class QlAuthentication extends BaseSDK {
|
|
|
72
114
|
refreshToken: string;
|
|
73
115
|
};
|
|
74
116
|
}>;
|
|
117
|
+
refreshCookieToken(cookieToken?: string): Promise<{
|
|
118
|
+
headers: {
|
|
119
|
+
'set-cookie': string;
|
|
120
|
+
};
|
|
121
|
+
payload: BasicPayload & {
|
|
122
|
+
cookieToken: string;
|
|
123
|
+
workspace?: {
|
|
124
|
+
_id: string;
|
|
125
|
+
} | null;
|
|
126
|
+
};
|
|
127
|
+
}>;
|
|
75
128
|
apiTokenSignin(apiToken: string): Promise<IUser>;
|
|
76
129
|
listApiTokens(): Promise<IApiToken[]>;
|
|
77
130
|
createApiToken(data: {
|
|
@@ -84,6 +137,16 @@ export default class QlAuthentication extends BaseSDK {
|
|
|
84
137
|
}>;
|
|
85
138
|
deleteApiToken(tokenId: string): Promise<void>;
|
|
86
139
|
logout(): Promise<Response>;
|
|
140
|
+
getSocialLoginUrl(provider: SocialProvider, options?: SocialLoginOptions): string;
|
|
141
|
+
getSocialCallbackUrl(provider: SocialProvider): string;
|
|
142
|
+
startSocialLogin(provider: SocialProvider, options?: SocialLoginOptions): void;
|
|
143
|
+
exchangeAuthCallback(refreshToken: string): Promise<SocialAuthCallbackPayload>;
|
|
144
|
+
/**
|
|
145
|
+
* Full social callback: read `rt` from the request URL or query and exchange
|
|
146
|
+
* it for a session. Use with integrator routes that receive the provider
|
|
147
|
+
* callback with `?rt=` (refresh token) after OAuth.
|
|
148
|
+
*/
|
|
149
|
+
socialCallback(input: SocialCallbackInput): Promise<SocialAuthCallbackPayload>;
|
|
87
150
|
getLoggedInUser(): Promise<IUser>;
|
|
88
151
|
updateLoggedInUser(changes: Partial<IUser & {
|
|
89
152
|
password?: string;
|