@smythos/sre 1.6.14 → 1.7.5
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/CHANGELOG +15 -0
- package/dist/index.js +66 -58
- package/dist/index.js.map +1 -1
- package/dist/types/Components/APIEndpoint.class.d.ts +2 -8
- package/dist/types/Components/Component.class.d.ts +9 -0
- package/dist/types/Components/Triggers/Gmail.trigger.d.ts +0 -17
- package/dist/types/Components/Triggers/JobScheduler.trigger.d.ts +10 -0
- package/dist/types/Components/Triggers/Trigger.class.d.ts +11 -0
- package/dist/types/Components/index.d.ts +6 -0
- package/dist/types/Core/Connector.class.d.ts +1 -0
- package/dist/types/Core/ConnectorsService.d.ts +2 -0
- package/dist/types/Core/HookService.d.ts +1 -1
- package/dist/types/helpers/BinaryInput.helper.d.ts +1 -1
- package/dist/types/helpers/Conversation.helper.d.ts +2 -0
- package/dist/types/helpers/Crypto.helper.d.ts +8 -0
- package/dist/types/helpers/LocalCache.helper.d.ts +18 -0
- package/dist/types/helpers/TemplateString.helper.d.ts +2 -1
- package/dist/types/index.d.ts +13 -0
- package/dist/types/subsystems/AgentManager/Agent.class.d.ts +4 -2
- package/dist/types/subsystems/AgentManager/AgentData.service/AgentDataConnector.d.ts +13 -0
- package/dist/types/subsystems/AgentManager/AgentData.service/connectors/NullAgentData.class.d.ts +1 -4
- package/dist/types/subsystems/AgentManager/Scheduler.service/Job.class.d.ts +29 -6
- package/dist/types/subsystems/AgentManager/Scheduler.service/SchedulerConnector.d.ts +11 -3
- package/dist/types/subsystems/AgentManager/Scheduler.service/connectors/LocalScheduler.class.d.ts +31 -7
- package/dist/types/subsystems/IO/VectorDB.service/VectorDBConnector.d.ts +4 -4
- package/dist/types/subsystems/IO/VectorDB.service/connectors/MilvusVectorDB.class.d.ts +2 -2
- package/dist/types/subsystems/IO/VectorDB.service/connectors/PineconeVectorDB.class.d.ts +2 -2
- package/dist/types/subsystems/IO/VectorDB.service/connectors/RAMVecrtorDB.class.d.ts +2 -2
- package/dist/types/subsystems/IO/VectorDB.service/embed/BaseEmbedding.d.ts +16 -9
- package/dist/types/subsystems/IO/VectorDB.service/embed/index.d.ts +4 -1
- package/dist/types/subsystems/LLMManager/LLM.inference.d.ts +36 -2
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/Perplexity.class.d.ts +2 -5
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/openai/OpenAIConnector.class.d.ts +3 -6
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ResponsesApiInterface.d.ts +7 -0
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/xAI.class.d.ts +2 -5
- package/dist/types/types/Agent.types.d.ts +1 -0
- package/dist/types/types/LLM.types.d.ts +56 -36
- package/dist/types/types/SRE.types.d.ts +4 -1
- package/dist/types/types/VectorDB.types.d.ts +6 -3
- package/dist/types/utils/string.utils.d.ts +0 -4
- package/package.json +6 -2
- package/src/Components/APICall/OAuth.helper.ts +30 -35
- package/src/Components/APIEndpoint.class.ts +25 -6
- package/src/Components/Classifier.class.ts +8 -2
- package/src/Components/Component.class.ts +11 -0
- package/src/Components/GenAILLM.class.ts +11 -7
- package/src/Components/LLMAssistant.class.ts +12 -3
- package/src/Components/ScrapflyWebScrape.class.ts +8 -1
- package/src/Components/TavilyWebSearch.class.ts +4 -1
- package/src/Components/Triggers/Gmail.trigger.ts +282 -0
- package/src/Components/Triggers/JobScheduler.trigger.ts +45 -0
- package/src/Components/Triggers/README.md +3 -0
- package/src/Components/Triggers/Trigger.class.ts +101 -0
- package/src/Components/Triggers/WhatsApp.trigger.ts +219 -0
- package/src/Components/index.ts +8 -0
- package/src/Core/AgentProcess.helper.ts +4 -6
- package/src/Core/Connector.class.ts +11 -3
- package/src/Core/ConnectorsService.ts +5 -0
- package/src/Core/ExternalEventsReceiver.ts +317 -0
- package/src/Core/HookService.ts +20 -6
- package/src/Core/SmythRuntime.class.ts +20 -2
- package/src/Core/SystemEvents.ts +17 -0
- package/src/Core/boot.ts +2 -0
- package/src/helpers/BinaryInput.helper.ts +8 -8
- package/src/helpers/Conversation.helper.ts +46 -12
- package/src/helpers/Crypto.helper.ts +28 -0
- package/src/helpers/LocalCache.helper.ts +18 -0
- package/src/helpers/TemplateString.helper.ts +20 -9
- package/src/index.ts +13 -0
- package/src/index.ts.bak +13 -0
- package/src/subsystems/AGENTS.md +594 -0
- package/src/subsystems/AgentManager/Agent.class.ts +73 -21
- package/src/subsystems/AgentManager/AgentData.service/AgentDataConnector.ts +30 -6
- package/src/subsystems/AgentManager/AgentData.service/connectors/NullAgentData.class.ts +2 -2
- package/src/subsystems/AgentManager/AgentLogger.class.ts +1 -1
- package/src/subsystems/AgentManager/AgentRuntime.class.ts +34 -5
- package/src/subsystems/AgentManager/Scheduler.service/Job.class.ts +414 -0
- package/src/subsystems/AgentManager/Scheduler.service/Schedule.class.ts +200 -0
- package/src/subsystems/AgentManager/Scheduler.service/SchedulerConnector.ts +200 -0
- package/src/subsystems/AgentManager/Scheduler.service/connectors/LocalScheduler.class.ts +767 -0
- package/src/subsystems/AgentManager/Scheduler.service/index.ts +11 -0
- package/src/subsystems/IO/VectorDB.service/VectorDBConnector.ts +15 -4
- package/src/subsystems/IO/VectorDB.service/connectors/MilvusVectorDB.class.ts +32 -11
- package/src/subsystems/IO/VectorDB.service/connectors/PineconeVectorDB.class.ts +27 -10
- package/src/subsystems/IO/VectorDB.service/connectors/RAMVecrtorDB.class.ts +25 -9
- package/src/subsystems/IO/VectorDB.service/embed/BaseEmbedding.ts +182 -12
- package/src/subsystems/IO/VectorDB.service/embed/GoogleEmbedding.ts +1 -1
- package/src/subsystems/IO/VectorDB.service/embed/OpenAIEmbedding.ts +1 -1
- package/src/subsystems/IO/VectorDB.service/embed/index.ts +12 -2
- package/src/subsystems/LLMManager/LLM.inference.ts +76 -17
- package/src/subsystems/LLMManager/LLM.service/LLMCredentials.helper.ts +61 -2
- package/src/subsystems/LLMManager/LLM.service/connectors/Anthropic.class.ts +3 -0
- package/src/subsystems/LLMManager/LLM.service/connectors/Bedrock.class.ts +3 -1
- package/src/subsystems/LLMManager/LLM.service/connectors/Echo.class.ts +5 -1
- package/src/subsystems/LLMManager/LLM.service/connectors/GoogleAI.class.ts +247 -56
- package/src/subsystems/LLMManager/LLM.service/connectors/Groq.class.ts +3 -0
- package/src/subsystems/LLMManager/LLM.service/connectors/Ollama.class.ts +28 -21
- package/src/subsystems/LLMManager/LLM.service/connectors/Perplexity.class.ts +3 -0
- package/src/subsystems/LLMManager/LLM.service/connectors/VertexAI.class.ts +121 -33
- package/src/subsystems/LLMManager/LLM.service/connectors/openai/OpenAIConnector.class.ts +38 -27
- package/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ChatCompletionsApiInterface.ts +3 -2
- package/src/subsystems/LLMManager/LLM.service/connectors/openai/apiInterfaces/ResponsesApiInterface.ts +117 -20
- package/src/subsystems/LLMManager/LLM.service/connectors/xAI.class.ts +3 -0
- package/src/subsystems/LLMManager/ModelsProvider.service/ModelsProviderConnector.ts +3 -8
- package/src/subsystems/LLMManager/ModelsProvider.service/connectors/JSONModelsProvider.class.ts +4 -1
- package/src/subsystems/MemoryManager/Cache.service/connectors/RedisCache.class.ts +12 -0
- package/src/subsystems/MemoryManager/LLMContext.ts +3 -8
- package/src/subsystems/MemoryManager/RuntimeContext.ts +10 -9
- package/src/subsystems/Security/Credentials/Credentials.class.ts +1 -0
- package/src/subsystems/Security/Credentials/ManagedOAuth2Credentials.class.ts +106 -0
- package/src/types/Agent.types.ts +1 -0
- package/src/types/LLM.types.ts +68 -40
- package/src/types/SRE.types.ts +3 -0
- package/src/types/VectorDB.types.ts +7 -3
- package/src/utils/string.utils.ts +193 -191
|
@@ -92,11 +92,11 @@ export class RuntimeContext extends EventEmitter {
|
|
|
92
92
|
private initRuntimeContext() {
|
|
93
93
|
if (this._runtimeFileReady) return;
|
|
94
94
|
|
|
95
|
-
const endpointDBGCall = this.runtime.xDebugId?.startsWith('dbg-'); //weak check for debug session, we need to improve this
|
|
95
|
+
//const endpointDBGCall = this.runtime.xDebugId?.startsWith('dbg-'); //weak check for debug session, we need to improve this
|
|
96
96
|
console.debug('Init Agent Context', this.ctxFile, AccessCandidate.agent(this.runtime.agent.id));
|
|
97
97
|
const agent = this.runtime.agent;
|
|
98
|
-
let method = (agent.agentRequest.method || 'POST').toUpperCase();
|
|
99
|
-
const endpoint = agent.endpoints?.[agent.agentRequest.path]?.[method];
|
|
98
|
+
//let method = (agent.agentRequest.method || 'POST').toUpperCase();
|
|
99
|
+
//const endpoint = agent.endpoints?.[agent.agentRequest.path]?.[method];
|
|
100
100
|
|
|
101
101
|
let ctxData: any = {};
|
|
102
102
|
|
|
@@ -115,12 +115,13 @@ export class RuntimeContext extends EventEmitter {
|
|
|
115
115
|
ctx: { active: false, name: ctxData.components[cptId].name },
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
//
|
|
120
|
-
if
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
118
|
+
// //TODO : the endpoint initialization logic should be moved to the AgentRuntime class
|
|
119
|
+
// const cpt = ctxData.components[cptId];
|
|
120
|
+
// //if this debug session was initiated from an endpoint, we mark the endpoint component as active
|
|
121
|
+
// if (endpoint && endpoint.id != undefined && cpt.id == endpoint.id && endpointDBGCall) {
|
|
122
|
+
// //cpt.dbg.active = true;
|
|
123
|
+
// cpt.ctx.active = true;
|
|
124
|
+
// }
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
await this._cacheConnector
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export class Credentials {}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ConnectorService } from '@sre/Core/ConnectorsService';
|
|
2
|
+
import { Credentials } from './Credentials.class';
|
|
3
|
+
import { AccessCandidate } from '../AccessControl/AccessCandidate.class';
|
|
4
|
+
|
|
5
|
+
export class ManagedOAuth2Credentials extends Credentials {
|
|
6
|
+
#accessToken: string;
|
|
7
|
+
#refreshToken: string;
|
|
8
|
+
#expiresIn: number;
|
|
9
|
+
#scope: string;
|
|
10
|
+
#tokenUrl: string;
|
|
11
|
+
#service: string;
|
|
12
|
+
#clientId: string;
|
|
13
|
+
#clientSecret: string;
|
|
14
|
+
|
|
15
|
+
public get accessToken(): string {
|
|
16
|
+
return this.#accessToken;
|
|
17
|
+
}
|
|
18
|
+
public get refreshToken(): string {
|
|
19
|
+
return this.#refreshToken;
|
|
20
|
+
}
|
|
21
|
+
public get expiresIn(): number {
|
|
22
|
+
return this.#expiresIn;
|
|
23
|
+
}
|
|
24
|
+
public get scope(): string {
|
|
25
|
+
return this.#scope;
|
|
26
|
+
}
|
|
27
|
+
public get tokenUrl(): string {
|
|
28
|
+
return this.#tokenUrl;
|
|
29
|
+
}
|
|
30
|
+
public get service(): string {
|
|
31
|
+
return this.#service;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private constructor(data: any) {
|
|
35
|
+
super();
|
|
36
|
+
this.parseData(data);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static async load(keyId: string, candidate: AccessCandidate): Promise<ManagedOAuth2Credentials> {
|
|
40
|
+
const managedVault = ConnectorService.getManagedVaultConnector();
|
|
41
|
+
const result = await managedVault.requester(candidate).get(keyId);
|
|
42
|
+
const data = typeof result === 'object' ? result : JSON.parse(result || '{}');
|
|
43
|
+
|
|
44
|
+
return new ManagedOAuth2Credentials(data);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private parseData(data: any) {
|
|
48
|
+
//SRE v1.0 format
|
|
49
|
+
|
|
50
|
+
//SRE v1.5.0+ format
|
|
51
|
+
if (!data.auth_data || !data.auth_settings) throw new Error('oAuth2Manager:Invalid data format');
|
|
52
|
+
|
|
53
|
+
this.#accessToken = data.auth_data.primary;
|
|
54
|
+
this.#refreshToken = data.auth_data.secondary;
|
|
55
|
+
this.#expiresIn = data.auth_data.expires_in;
|
|
56
|
+
this.#scope = data.auth_settings.scope;
|
|
57
|
+
this.#tokenUrl = data.auth_settings.tokenURL;
|
|
58
|
+
this.#service = data.auth_settings.service;
|
|
59
|
+
this.#clientId = data.auth_settings.clientID;
|
|
60
|
+
this.#clientSecret = data.auth_settings.clientSecret;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Get a fresh access token using the refresh token
|
|
65
|
+
*/
|
|
66
|
+
public async refreshAccessToken() {
|
|
67
|
+
console.log('Refreshing access token...');
|
|
68
|
+
|
|
69
|
+
const tokenUrl = this.#tokenUrl;
|
|
70
|
+
const body = new URLSearchParams({
|
|
71
|
+
client_id: this.#clientId,
|
|
72
|
+
client_secret: this.#clientSecret,
|
|
73
|
+
refresh_token: this.#refreshToken,
|
|
74
|
+
grant_type: 'refresh_token',
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
const res = await fetch(tokenUrl, {
|
|
79
|
+
method: 'POST',
|
|
80
|
+
headers: {
|
|
81
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
82
|
+
},
|
|
83
|
+
body: body.toString(),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const text = await res.text();
|
|
87
|
+
let json: any;
|
|
88
|
+
try {
|
|
89
|
+
json = JSON.parse(text);
|
|
90
|
+
} catch {
|
|
91
|
+
throw new Error(`Invalid JSON response: ${text}`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (!res.ok) {
|
|
95
|
+
const errorMsg = json.error_description || json.error?.message || json.error || text;
|
|
96
|
+
throw new Error(`HTTP ${res.status}: ${errorMsg}`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
this.#accessToken = json.access_token;
|
|
100
|
+
this.#expiresIn = Date.now() + json.expires_in * 1000;
|
|
101
|
+
return this.#accessToken;
|
|
102
|
+
} catch (error: any) {
|
|
103
|
+
throw new Error(`Failed to refresh access token: ${error.message}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
package/src/types/Agent.types.ts
CHANGED
package/src/types/LLM.types.ts
CHANGED
|
@@ -87,52 +87,65 @@ export type TToolsInfo = {
|
|
|
87
87
|
|
|
88
88
|
export type TSearchContextSize = 'low' | 'medium' | 'high';
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
model: TLLMModel | string;
|
|
92
|
-
|
|
93
|
-
prompt?: string;
|
|
94
|
-
messages?: any[]; // TODO [Forhad]: apply proper typing
|
|
95
|
-
temperature?: number;
|
|
96
|
-
maxTokens?: number;
|
|
97
|
-
stopSequences?: string[];
|
|
98
|
-
topP?: number;
|
|
99
|
-
topK?: number;
|
|
100
|
-
frequencyPenalty?: number;
|
|
101
|
-
presencePenalty?: number;
|
|
102
|
-
responseFormat?: any; // TODO [Forhad]: apply proper typing
|
|
103
|
-
modelInfo?: TCustomLLMModel;
|
|
104
|
-
files?: BinaryInput[];
|
|
90
|
+
type TLLMToolConfig = {
|
|
105
91
|
toolsConfig?: {
|
|
106
92
|
tools?: OpenAI.ChatCompletionTool[] | OpenAI.Responses.Tool[] | OpenAI.Responses.WebSearchTool[];
|
|
107
93
|
tool_choice?: TLLMToolChoice;
|
|
108
94
|
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
size?: OpenAI.Images.ImageGenerateParams['size'] | OpenAI.Images.ImageEditParams['size']; // for image generation and image editing
|
|
112
|
-
quality?: 'standard' | 'hd'; // for image generation
|
|
113
|
-
n?: number; // for image generation
|
|
114
|
-
style?: 'vivid' | 'natural'; // for image generation
|
|
95
|
+
};
|
|
115
96
|
|
|
116
|
-
|
|
117
|
-
agentId?: string;
|
|
118
|
-
teamId?: string;
|
|
97
|
+
type TLLMThinkingConfig = {
|
|
119
98
|
thinking?: {
|
|
120
99
|
// for Anthropic
|
|
121
100
|
type: 'enabled' | 'disabled';
|
|
122
101
|
budget_tokens: number;
|
|
123
102
|
};
|
|
124
103
|
maxThinkingTokens?: number;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
type TLLMReasoningConfig = {
|
|
107
|
+
useReasoning?: boolean;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Controls the level of effort the model will put into reasoning
|
|
111
|
+
* For GPT-OSS models (20B, 120B): "low" | "medium" | "high"
|
|
112
|
+
* For Qwen 3 32B: "none" | "default"
|
|
113
|
+
*/
|
|
114
|
+
reasoningEffort?: 'none' | 'default' | OpenAIReasoningEffort;
|
|
115
|
+
|
|
116
|
+
max_output_tokens?: number;
|
|
117
|
+
verbosity?: OpenAI.Responses.ResponseCreateParams['text']['verbosity'];
|
|
118
|
+
abortSignal?: AbortSignal;
|
|
119
|
+
};
|
|
125
120
|
|
|
126
|
-
|
|
127
|
-
|
|
121
|
+
type TLLMTextGenConfig = {
|
|
122
|
+
model: TLLMModel | string;
|
|
123
|
+
prompt?: string;
|
|
124
|
+
messages?: any[]; // TODO [Forhad]: apply proper typing
|
|
125
|
+
temperature?: number;
|
|
126
|
+
maxTokens?: number;
|
|
127
|
+
stopSequences?: string[];
|
|
128
|
+
topP?: number;
|
|
129
|
+
topK?: number;
|
|
130
|
+
frequencyPenalty?: number;
|
|
131
|
+
presencePenalty?: number;
|
|
132
|
+
responseFormat?: any; // TODO [Forhad]: apply proper typing
|
|
133
|
+
} & TLLMToolConfig &
|
|
134
|
+
TLLMThinkingConfig &
|
|
135
|
+
TLLMReasoningConfig;
|
|
136
|
+
|
|
137
|
+
// OpenAI specific web search parameters
|
|
138
|
+
type TLLMWebSearchConfig = {
|
|
128
139
|
useWebSearch?: boolean;
|
|
129
140
|
webSearchContextSize?: TSearchContextSize;
|
|
130
141
|
webSearchCity?: string;
|
|
131
142
|
webSearchCountry?: string;
|
|
132
143
|
webSearchRegion?: string;
|
|
133
144
|
webSearchTimezone?: string;
|
|
145
|
+
};
|
|
134
146
|
|
|
135
|
-
|
|
147
|
+
// xAI specific search parameters
|
|
148
|
+
type TLLMSearchConfig = {
|
|
136
149
|
useSearch?: boolean;
|
|
137
150
|
searchMode?: 'auto' | 'on' | 'off';
|
|
138
151
|
returnCitations?: boolean;
|
|
@@ -149,20 +162,33 @@ export type TLLMParams = {
|
|
|
149
162
|
safeSearch?: boolean;
|
|
150
163
|
fromDate?: string;
|
|
151
164
|
toDate?: string;
|
|
152
|
-
|
|
165
|
+
} & TLLMWebSearchConfig;
|
|
153
166
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
* For Qwen 3 32B: "none" | "default"
|
|
159
|
-
*/
|
|
160
|
-
reasoningEffort?: 'none' | 'default' | OpenAIReasoningEffort;
|
|
161
|
-
max_output_tokens?: number;
|
|
162
|
-
verbosity?: OpenAI.Responses.ResponseCreateParams['text']['verbosity'];
|
|
163
|
-
abortSignal?: AbortSignal;
|
|
167
|
+
type TLLMMiscConfig = {
|
|
168
|
+
maxContextWindowLength?: number;
|
|
169
|
+
useContextWindow?: boolean;
|
|
170
|
+
passthrough?: boolean;
|
|
164
171
|
};
|
|
165
172
|
|
|
173
|
+
type TLLMRuntimeContext = {
|
|
174
|
+
modelInfo?: TCustomLLMModel;
|
|
175
|
+
files?: BinaryInput[];
|
|
176
|
+
baseURL?: string;
|
|
177
|
+
|
|
178
|
+
cache?: boolean;
|
|
179
|
+
agentId?: string;
|
|
180
|
+
teamId?: string;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
type TLLMImageGenConfig = {
|
|
184
|
+
size?: OpenAI.Images.ImageGenerateParams['size'] | OpenAI.Images.ImageEditParams['size']; // for image generation and image editing
|
|
185
|
+
quality?: 'standard' | 'hd'; // for image generation
|
|
186
|
+
n?: number; // for image generation
|
|
187
|
+
style?: 'vivid' | 'natural'; // for image generation
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export type TLLMParams = TLLMTextGenConfig & TLLMSearchConfig & TLLMImageGenConfig & TLLMMiscConfig & TLLMRuntimeContext;
|
|
191
|
+
|
|
166
192
|
export type TLLMPreparedParams = TLLMParams & {
|
|
167
193
|
body: any;
|
|
168
194
|
modelEntryName?: string; // for usage reporting
|
|
@@ -387,8 +413,8 @@ export type TLLMMessageBlock = {
|
|
|
387
413
|
| Array<Anthropic.TextBlockParam | Anthropic.ImageBlockParam | Anthropic.ToolUseBlockParam | Anthropic.ToolResultBlockParam>;
|
|
388
414
|
parts?: {
|
|
389
415
|
text?: string;
|
|
390
|
-
functionCall?: { name: string; args: string };
|
|
391
|
-
functionResponse?: { name: string; response:
|
|
416
|
+
functionCall?: { name: string; args: string | Record<string, any> };
|
|
417
|
+
functionResponse?: { name: string; response: any };
|
|
392
418
|
}[]; // for Google Vertex AI
|
|
393
419
|
tool_calls?: ToolData[];
|
|
394
420
|
};
|
|
@@ -471,6 +497,8 @@ export enum TLLMEvent {
|
|
|
471
497
|
Usage = 'usage',
|
|
472
498
|
/** Interrupted : emitted when the response is interrupted before completion */
|
|
473
499
|
Interrupted = 'interrupted',
|
|
500
|
+
/** Fallback : emitted when the response is using a fallback model */
|
|
501
|
+
Fallback = 'fallback',
|
|
474
502
|
}
|
|
475
503
|
|
|
476
504
|
export interface ILLMRequestContext {
|
package/src/types/SRE.types.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { LogService } from '@sre/IO/Log.service';
|
|
|
13
13
|
import { ComponentService } from '@sre/AgentManager/Component.service';
|
|
14
14
|
import { ModelsProviderService } from '@sre/LLMManager/ModelsProvider.service';
|
|
15
15
|
import { CodeService } from '@sre/ComputeManager/Code.service';
|
|
16
|
+
import { SchedulerService } from '@sre/AgentManager/Scheduler.service';
|
|
16
17
|
|
|
17
18
|
export type TServiceRegistry = {
|
|
18
19
|
Storage?: StorageService;
|
|
@@ -30,6 +31,7 @@ export type TServiceRegistry = {
|
|
|
30
31
|
Component?: ComponentService;
|
|
31
32
|
ModelsProvider?: ModelsProviderService;
|
|
32
33
|
Code?: CodeService;
|
|
34
|
+
Scheduler?: SchedulerService;
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
export enum TConnectorService {
|
|
@@ -48,6 +50,7 @@ export enum TConnectorService {
|
|
|
48
50
|
Component = 'Component',
|
|
49
51
|
ModelsProvider = 'ModelsProvider',
|
|
50
52
|
Code = 'Code',
|
|
53
|
+
Scheduler = 'Scheduler',
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
export type SREConnectorConfig = {
|
|
@@ -3,17 +3,19 @@ export type VectorDBMetadata = {
|
|
|
3
3
|
datasourceId: string;
|
|
4
4
|
datasourceLabel: string;
|
|
5
5
|
acl: string;
|
|
6
|
-
user_metadata?: string
|
|
6
|
+
user_metadata?: string | Record<string, any>;
|
|
7
7
|
text?: string;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export type
|
|
10
|
+
export type VectorDBResult = {
|
|
11
11
|
id: string;
|
|
12
12
|
score?: number;
|
|
13
13
|
values: number[];
|
|
14
14
|
text: string;
|
|
15
15
|
metadata?: Record<string, any>;
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type VectorsResultData = VectorDBResult[];
|
|
17
19
|
|
|
18
20
|
export interface NsKnownMetadata {
|
|
19
21
|
isOnCustomStorage?: boolean;
|
|
@@ -58,6 +60,7 @@ export interface IStorageVectorDataSource {
|
|
|
58
60
|
metadata: string;
|
|
59
61
|
text?: string;
|
|
60
62
|
vectorIds: string[];
|
|
63
|
+
vectorInfo?: VectorDBResult[];
|
|
61
64
|
id: string;
|
|
62
65
|
candidateId: string;
|
|
63
66
|
candidateRole: string;
|
|
@@ -83,4 +86,5 @@ export interface DatasourceDto {
|
|
|
83
86
|
chunkOverlap?: number;
|
|
84
87
|
label?: string;
|
|
85
88
|
id?: string;
|
|
89
|
+
returnFullVectorInfo?: boolean;
|
|
86
90
|
}
|