openloops 0.1.28 → 0.1.30
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/agent/agent-loop.d.ts +3 -1
- package/dist/agent/agent.d.ts +2 -7
- package/dist/agent/agent.js +3 -0
- package/dist/agent/agent.mjs +3 -0
- package/dist/loops/plan-execute/plan-execute-loop.js +6 -2
- package/dist/loops/plan-execute/plan-execute-loop.mjs +5 -2
- package/dist/loops/shared/skills/strategy-engine.d.ts +2 -6
- package/dist/loops/shared/skills/strategy-engine.js +10 -9
- package/dist/loops/shared/skills/strategy-engine.mjs +10 -9
- package/dist/services/chats/entities/chat-settings.entity.d.ts +4 -1
- package/dist/services/chats/entities/chat-settings.entity.js +8 -1
- package/dist/services/chats/entities/chat-settings.entity.mjs +8 -1
- package/dist/skills/skill.d.ts +2 -0
- package/dist/skills/skill.js +3 -1
- package/dist/skills/skill.mjs +3 -1
- package/dist/tools/tool.d.ts +7 -0
- package/dist/tools/tool.js +9 -0
- package/dist/tools/tool.mjs +9 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CurrentUser, CurrentSession } from '../common/base/index.js';
|
|
2
2
|
import { Logger } from '../common/logger/index.js';
|
|
3
3
|
import { Chat } from '../services/chats/entities/chat.entity.js';
|
|
4
|
+
import { ChatSettingsProps } from '../services/chats/entities/chat-settings.entity.js';
|
|
4
5
|
import { AgentTask } from '../services/chats/entities/agent-task.entity.js';
|
|
5
6
|
import { Tool, BaseParams } from '../tools/tool.js';
|
|
6
7
|
import { SkillRunOptions } from '../skills/skill.js';
|
|
@@ -9,6 +10,7 @@ export interface RunContext {
|
|
|
9
10
|
identity?: AgentIdentity;
|
|
10
11
|
task?: AgentTask;
|
|
11
12
|
chat: Chat;
|
|
13
|
+
chatOptions?: ChatSettingsProps;
|
|
12
14
|
currentUser: CurrentUser;
|
|
13
15
|
currentSession?: CurrentSession;
|
|
14
16
|
currentMessage: string;
|
|
@@ -19,7 +21,7 @@ export interface RunContext {
|
|
|
19
21
|
limit?: number;
|
|
20
22
|
}) => ScoredTool[];
|
|
21
23
|
baseParams: BaseParams;
|
|
22
|
-
skillParams: Pick<SkillRunOptions, 'sessionId' | 'answerId' | 'userMessage' | 'currentUser' | 'currentSession' | 'chat'>;
|
|
24
|
+
skillParams: Pick<SkillRunOptions, 'provider' | 'modelName' | 'sessionId' | 'answerId' | 'userMessage' | 'currentUser' | 'currentSession' | 'chat'>;
|
|
23
25
|
reply: (content: string) => void;
|
|
24
26
|
setNextNode: (node?: string | AgentLoopNode) => void;
|
|
25
27
|
logger: Logger;
|
package/dist/agent/agent.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import 'reflect-metadata';
|
|
|
2
2
|
import { CurrentUser, CurrentSession } from '../common/base/index.js';
|
|
3
3
|
import { McpServer } from '../services/mcp-servers/entities/index.js';
|
|
4
4
|
import { Chat } from '../services/chats/entities/chat.entity.js';
|
|
5
|
+
import { ChatSettingsProps } from '../services/chats/entities/chat-settings.entity.js';
|
|
5
6
|
import { Tool } from '../tools/tool.js';
|
|
6
7
|
import { AgentLoop } from './agent-loop';
|
|
7
8
|
export declare const AGENT_ERROR_CODES: {
|
|
@@ -22,12 +23,6 @@ interface ChatInput {
|
|
|
22
23
|
chatId?: string;
|
|
23
24
|
messageId?: string;
|
|
24
25
|
}
|
|
25
|
-
interface ChatOptions {
|
|
26
|
-
loopName?: string;
|
|
27
|
-
modelName?: 'string';
|
|
28
|
-
isPrivateSession?: boolean;
|
|
29
|
-
notifyOnCompletion?: boolean;
|
|
30
|
-
}
|
|
31
26
|
type HookType = 'pre_execution' | 'post_execution';
|
|
32
27
|
export declare class Agent {
|
|
33
28
|
private readonly updateChatUseCase;
|
|
@@ -57,7 +52,7 @@ export declare class Agent {
|
|
|
57
52
|
get lastAssistantAnswer(): string | undefined;
|
|
58
53
|
run(props: {
|
|
59
54
|
input: ChatInput;
|
|
60
|
-
options?:
|
|
55
|
+
options?: ChatSettingsProps;
|
|
61
56
|
currentUser: CurrentUser;
|
|
62
57
|
currentSession?: CurrentSession;
|
|
63
58
|
}): Promise<{
|
package/dist/agent/agent.js
CHANGED
|
@@ -287,6 +287,7 @@ class Agent {
|
|
|
287
287
|
identity: this._identity,
|
|
288
288
|
task: this.currentChat.activeTask,
|
|
289
289
|
chat: this.currentChat,
|
|
290
|
+
chatOptions: this.chatOptions,
|
|
290
291
|
currentUser: this.currentUser,
|
|
291
292
|
currentSession: this.currentSession,
|
|
292
293
|
currentMessage: this.currentMessage,
|
|
@@ -299,6 +300,8 @@ class Agent {
|
|
|
299
300
|
answerId: this.answerId
|
|
300
301
|
},
|
|
301
302
|
skillParams: {
|
|
303
|
+
provider: this.chatOptions?.modelProvider,
|
|
304
|
+
modelName: this.chatOptions?.modelName,
|
|
302
305
|
sessionId,
|
|
303
306
|
answerId: this.answerId,
|
|
304
307
|
userMessage: this.currentMessage,
|
package/dist/agent/agent.mjs
CHANGED
|
@@ -264,6 +264,7 @@ class Agent {
|
|
|
264
264
|
identity: this._identity,
|
|
265
265
|
task: this.currentChat.activeTask,
|
|
266
266
|
chat: this.currentChat,
|
|
267
|
+
chatOptions: this.chatOptions,
|
|
267
268
|
currentUser: this.currentUser,
|
|
268
269
|
currentSession: this.currentSession,
|
|
269
270
|
currentMessage: this.currentMessage,
|
|
@@ -276,6 +277,8 @@ class Agent {
|
|
|
276
277
|
answerId: this.answerId
|
|
277
278
|
},
|
|
278
279
|
skillParams: {
|
|
280
|
+
provider: this.chatOptions?.modelProvider,
|
|
281
|
+
modelName: this.chatOptions?.modelName,
|
|
279
282
|
sessionId,
|
|
280
283
|
answerId: this.answerId,
|
|
281
284
|
userMessage: this.currentMessage,
|
|
@@ -23,6 +23,7 @@ __export(plan_execute_loop_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(plan_execute_loop_exports);
|
|
24
24
|
var import_agent = require("../../agent/index.js");
|
|
25
25
|
var import_skills = require("../shared/skills");
|
|
26
|
+
var import_strategy_engine = require("../shared/skills/strategy-engine");
|
|
26
27
|
const MAX_STEP_RETRIES = 2;
|
|
27
28
|
class PlanExecuteLoop extends import_agent.AgentLoop {
|
|
28
29
|
get initialNode() {
|
|
@@ -76,10 +77,12 @@ class PlanExecuteLoop extends import_agent.AgentLoop {
|
|
|
76
77
|
ctx.chat.state?.setCurrentActivity("Designing strategy...");
|
|
77
78
|
const lastCompletedTask = ctx.task ? void 0 : ctx.chat.lastCompletedTask();
|
|
78
79
|
const chatHistory = ctx.chat.lastHistoryMessages();
|
|
79
|
-
const
|
|
80
|
+
const toolsMeta = ctx.tools?.map((tool) => tool.meta);
|
|
81
|
+
const result = await import_strategy_engine.strategyEngine.run({
|
|
80
82
|
...ctx.skillParams,
|
|
81
83
|
contextInjection: {
|
|
82
84
|
user_goal: ctx.currentMessage,
|
|
85
|
+
...toolsMeta?.length ? { toolsMeta } : {},
|
|
83
86
|
...chatHistory?.length ? { chat_history: chatHistory } : {},
|
|
84
87
|
...lastCompletedTask ? { last_completed_task: { goal: lastCompletedTask.goal, summary: lastCompletedTask.summary } } : {}
|
|
85
88
|
}
|
|
@@ -97,7 +100,8 @@ class PlanExecuteLoop extends import_agent.AgentLoop {
|
|
|
97
100
|
ctx.chat.state?.setCurrentActivity("Creating action plan...");
|
|
98
101
|
const task = ctx.task;
|
|
99
102
|
const strategy = ctx.chat.context.lastContext({ taskId: task.id, name: "strategy" })?.content;
|
|
100
|
-
const
|
|
103
|
+
const selectedNames = new Set(strategy?.tool_names ?? []);
|
|
104
|
+
const tools = ctx.tools?.filter((tool) => selectedNames.has(tool.name)) ?? [];
|
|
101
105
|
const result = await import_skills.actionPlanner.run({
|
|
102
106
|
...ctx.skillParams,
|
|
103
107
|
contextInjection: {
|
|
@@ -2,12 +2,12 @@ import "../../chunk-CF3WOMB3.mjs";
|
|
|
2
2
|
import { AgentLoop, AgentStatus } from "../../agent/index.js";
|
|
3
3
|
import {
|
|
4
4
|
fastResponder,
|
|
5
|
-
strategyEngine,
|
|
6
5
|
actionPlanner,
|
|
7
6
|
stateObserver,
|
|
8
7
|
finalResponder,
|
|
9
8
|
confirmationGate
|
|
10
9
|
} from "../shared/skills";
|
|
10
|
+
import { strategyEngine } from "../shared/skills/strategy-engine";
|
|
11
11
|
const MAX_STEP_RETRIES = 2;
|
|
12
12
|
class PlanExecuteLoop extends AgentLoop {
|
|
13
13
|
get initialNode() {
|
|
@@ -61,10 +61,12 @@ class PlanExecuteLoop extends AgentLoop {
|
|
|
61
61
|
ctx.chat.state?.setCurrentActivity("Designing strategy...");
|
|
62
62
|
const lastCompletedTask = ctx.task ? void 0 : ctx.chat.lastCompletedTask();
|
|
63
63
|
const chatHistory = ctx.chat.lastHistoryMessages();
|
|
64
|
+
const toolsMeta = ctx.tools?.map((tool) => tool.meta);
|
|
64
65
|
const result = await strategyEngine.run({
|
|
65
66
|
...ctx.skillParams,
|
|
66
67
|
contextInjection: {
|
|
67
68
|
user_goal: ctx.currentMessage,
|
|
69
|
+
...toolsMeta?.length ? { toolsMeta } : {},
|
|
68
70
|
...chatHistory?.length ? { chat_history: chatHistory } : {},
|
|
69
71
|
...lastCompletedTask ? { last_completed_task: { goal: lastCompletedTask.goal, summary: lastCompletedTask.summary } } : {}
|
|
70
72
|
}
|
|
@@ -82,7 +84,8 @@ class PlanExecuteLoop extends AgentLoop {
|
|
|
82
84
|
ctx.chat.state?.setCurrentActivity("Creating action plan...");
|
|
83
85
|
const task = ctx.task;
|
|
84
86
|
const strategy = ctx.chat.context.lastContext({ taskId: task.id, name: "strategy" })?.content;
|
|
85
|
-
const
|
|
87
|
+
const selectedNames = new Set(strategy?.tool_names ?? []);
|
|
88
|
+
const tools = ctx.tools?.filter((tool) => selectedNames.has(tool.name)) ?? [];
|
|
86
89
|
const result = await actionPlanner.run({
|
|
87
90
|
...ctx.skillParams,
|
|
88
91
|
contextInjection: {
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { Skill } from '../../../skills/skill.js';
|
|
2
|
-
type ResponseSchema = {
|
|
2
|
+
export type ResponseSchema = {
|
|
3
3
|
goal: string;
|
|
4
4
|
hypothesis: string;
|
|
5
5
|
required_capabilities: string[];
|
|
6
|
-
|
|
7
|
-
keyword: string;
|
|
8
|
-
weight: number;
|
|
9
|
-
}>;
|
|
6
|
+
tool_names: string[];
|
|
10
7
|
detected_language: string;
|
|
11
8
|
reasoning: string;
|
|
12
9
|
is_continuation: boolean;
|
|
13
10
|
};
|
|
14
11
|
export declare const strategyEngine: Skill<ResponseSchema>;
|
|
15
|
-
export {};
|
|
@@ -24,29 +24,30 @@ module.exports = __toCommonJS(strategy_engine_exports);
|
|
|
24
24
|
var import_skill = require("../../../skills/skill.js");
|
|
25
25
|
const strategyEngine = new import_skill.Skill({
|
|
26
26
|
name: "strategy_engine",
|
|
27
|
-
version: "
|
|
28
|
-
description: "Analyzes user goals, chat history,
|
|
27
|
+
version: "2.0.0",
|
|
28
|
+
description: "Analyzes user goals, chat history, past tasks and the available tools metadata to formulate a grounded high-level strategy, required capabilities, the exact tools needed to execute it, and Task continuity detection.",
|
|
29
29
|
temperature: 0.2,
|
|
30
30
|
systemInstructions: {
|
|
31
31
|
instruction_set: {
|
|
32
|
-
goal: "Analyze the user's intent, conversation context,
|
|
33
|
-
role: "Strategic reasoning, capability mapping, tool
|
|
32
|
+
goal: "Analyze the user's intent, conversation context, last completed task and the metadata of the available tools to establish a high-level execution goal, a realistic hypothesis grounded in the real tools, required system capabilities, the exact names of the tools needed, and determine whether the message continues a previous task.",
|
|
33
|
+
role: "Strategic reasoning, capability mapping, tool selection, and task continuity engine",
|
|
34
34
|
logic_rules: [
|
|
35
35
|
"TASK_CONTINUATION_DETECTION: Set 'is_continuation' to true ONLY if 'last_completed_task' is provided in context AND the user's current message directly references, follows up on, or modifies that specific previous task. Set to false if the user introduces a completely new goal or independent topic.",
|
|
36
36
|
"GOAL_REFINEMENT: Refine and summarize the ultimate goal of the user into 'goal' strictly in English, resolving references from chat history if present.",
|
|
37
|
-
"
|
|
37
|
+
"TOOLS_AWARENESS: 'toolsMeta' lists every tool currently available, each with 'name', 'description' and 'annotations'. Read the descriptions and annotations (for example destructive or read-only hints) to understand what each tool really does and its side effects. Base the strategy ONLY on what these tools can actually do.",
|
|
38
|
+
"HYPOTHESIS_FORMULATION: Formulate a clear, step-by-step strategic hypothesis in 'hypothesis' in English explaining how the goal can be achieved using the available tools, mentioning the tools by name and the order in which they would be used. If no available tool can achieve part of the goal, state that explicitly instead of assuming a capability exists.",
|
|
38
39
|
"CAPABILITY_MAPPING: Identify and list all functional system capabilities or domain requirements needed in 'required_capabilities' in English (e.g., ['calendar_access', 'data_parsing', 'web_search']).",
|
|
39
|
-
"
|
|
40
|
+
"TOOL_SELECTION: Fill 'tool_names' with the exact 'name' values from 'toolsMeta' of every tool needed to execute the strategy, including tools that only provide prerequisite data for other tools. Copy names character by character. NEVER invent, translate, rename or abbreviate a tool name. Select the minimum necessary set and do not include tools that are not part of the strategy. If 'toolsMeta' is missing or no tool fits the goal, return an empty array.",
|
|
40
41
|
"LANGUAGE_DETECTION: Detect the primary language of the user input and output its ISO 639-1 code in 'detected_language' (e.g., 'es', 'en', 'pt').",
|
|
41
|
-
"REASONING_LOG: Provide a concise, step-by-step logical justification of the proposed strategy in 'reasoning' strictly in English.",
|
|
42
|
-
"STRICT_ENGLISH_OUTPUT: ALL output fields ('goal', 'hypothesis', 'required_capabilities'
|
|
42
|
+
"REASONING_LOG: Provide a concise, step-by-step logical justification of the proposed strategy and of each selected tool in 'reasoning' strictly in English.",
|
|
43
|
+
"STRICT_ENGLISH_OUTPUT: ALL output fields ('goal', 'hypothesis', 'required_capabilities' and 'reasoning') MUST strictly be written in English, regardless of the user input language. 'tool_names' must keep the exact original tool names.",
|
|
43
44
|
"STRICT_OUTPUT: Return ONLY the JSON object matching response_schema."
|
|
44
45
|
],
|
|
45
46
|
response_schema: {
|
|
46
47
|
goal: "string",
|
|
47
48
|
hypothesis: "string",
|
|
48
49
|
required_capabilities: "array of strings",
|
|
49
|
-
|
|
50
|
+
tool_names: "array of strings, each one an exact 'name' from toolsMeta",
|
|
50
51
|
detected_language: "string",
|
|
51
52
|
reasoning: "string",
|
|
52
53
|
is_continuation: "boolean"
|
|
@@ -2,29 +2,30 @@ import "../../../chunk-CF3WOMB3.mjs";
|
|
|
2
2
|
import { Skill } from "../../../skills/skill.js";
|
|
3
3
|
const strategyEngine = new Skill({
|
|
4
4
|
name: "strategy_engine",
|
|
5
|
-
version: "
|
|
6
|
-
description: "Analyzes user goals, chat history,
|
|
5
|
+
version: "2.0.0",
|
|
6
|
+
description: "Analyzes user goals, chat history, past tasks and the available tools metadata to formulate a grounded high-level strategy, required capabilities, the exact tools needed to execute it, and Task continuity detection.",
|
|
7
7
|
temperature: 0.2,
|
|
8
8
|
systemInstructions: {
|
|
9
9
|
instruction_set: {
|
|
10
|
-
goal: "Analyze the user's intent, conversation context,
|
|
11
|
-
role: "Strategic reasoning, capability mapping, tool
|
|
10
|
+
goal: "Analyze the user's intent, conversation context, last completed task and the metadata of the available tools to establish a high-level execution goal, a realistic hypothesis grounded in the real tools, required system capabilities, the exact names of the tools needed, and determine whether the message continues a previous task.",
|
|
11
|
+
role: "Strategic reasoning, capability mapping, tool selection, and task continuity engine",
|
|
12
12
|
logic_rules: [
|
|
13
13
|
"TASK_CONTINUATION_DETECTION: Set 'is_continuation' to true ONLY if 'last_completed_task' is provided in context AND the user's current message directly references, follows up on, or modifies that specific previous task. Set to false if the user introduces a completely new goal or independent topic.",
|
|
14
14
|
"GOAL_REFINEMENT: Refine and summarize the ultimate goal of the user into 'goal' strictly in English, resolving references from chat history if present.",
|
|
15
|
-
"
|
|
15
|
+
"TOOLS_AWARENESS: 'toolsMeta' lists every tool currently available, each with 'name', 'description' and 'annotations'. Read the descriptions and annotations (for example destructive or read-only hints) to understand what each tool really does and its side effects. Base the strategy ONLY on what these tools can actually do.",
|
|
16
|
+
"HYPOTHESIS_FORMULATION: Formulate a clear, step-by-step strategic hypothesis in 'hypothesis' in English explaining how the goal can be achieved using the available tools, mentioning the tools by name and the order in which they would be used. If no available tool can achieve part of the goal, state that explicitly instead of assuming a capability exists.",
|
|
16
17
|
"CAPABILITY_MAPPING: Identify and list all functional system capabilities or domain requirements needed in 'required_capabilities' in English (e.g., ['calendar_access', 'data_parsing', 'web_search']).",
|
|
17
|
-
"
|
|
18
|
+
"TOOL_SELECTION: Fill 'tool_names' with the exact 'name' values from 'toolsMeta' of every tool needed to execute the strategy, including tools that only provide prerequisite data for other tools. Copy names character by character. NEVER invent, translate, rename or abbreviate a tool name. Select the minimum necessary set and do not include tools that are not part of the strategy. If 'toolsMeta' is missing or no tool fits the goal, return an empty array.",
|
|
18
19
|
"LANGUAGE_DETECTION: Detect the primary language of the user input and output its ISO 639-1 code in 'detected_language' (e.g., 'es', 'en', 'pt').",
|
|
19
|
-
"REASONING_LOG: Provide a concise, step-by-step logical justification of the proposed strategy in 'reasoning' strictly in English.",
|
|
20
|
-
"STRICT_ENGLISH_OUTPUT: ALL output fields ('goal', 'hypothesis', 'required_capabilities'
|
|
20
|
+
"REASONING_LOG: Provide a concise, step-by-step logical justification of the proposed strategy and of each selected tool in 'reasoning' strictly in English.",
|
|
21
|
+
"STRICT_ENGLISH_OUTPUT: ALL output fields ('goal', 'hypothesis', 'required_capabilities' and 'reasoning') MUST strictly be written in English, regardless of the user input language. 'tool_names' must keep the exact original tool names.",
|
|
21
22
|
"STRICT_OUTPUT: Return ONLY the JSON object matching response_schema."
|
|
22
23
|
],
|
|
23
24
|
response_schema: {
|
|
24
25
|
goal: "string",
|
|
25
26
|
hypothesis: "string",
|
|
26
27
|
required_capabilities: "array of strings",
|
|
27
|
-
|
|
28
|
+
tool_names: "array of strings, each one an exact 'name' from toolsMeta",
|
|
28
29
|
detected_language: "string",
|
|
29
30
|
reasoning: "string",
|
|
30
31
|
is_continuation: "boolean"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export interface ChatSettingsProps {
|
|
2
2
|
notifyOnCompletion?: boolean;
|
|
3
3
|
isPrivateSession?: boolean;
|
|
4
|
+
modelProvider?: string;
|
|
4
5
|
modelName?: string;
|
|
5
6
|
loopName?: string;
|
|
6
7
|
}
|
|
@@ -8,12 +9,14 @@ export declare class ChatSettings {
|
|
|
8
9
|
private readonly props;
|
|
9
10
|
notifyOnCompletion?: boolean | undefined;
|
|
10
11
|
isPrivateSession?: boolean | undefined;
|
|
12
|
+
modelProvider?: string | undefined;
|
|
11
13
|
modelName?: string | undefined;
|
|
12
14
|
loopName?: string | undefined;
|
|
13
|
-
constructor(props: ChatSettingsProps, notifyOnCompletion?: boolean | undefined, isPrivateSession?: boolean | undefined, modelName?: string | undefined, loopName?: string | undefined);
|
|
15
|
+
constructor(props: ChatSettingsProps, notifyOnCompletion?: boolean | undefined, isPrivateSession?: boolean | undefined, modelProvider?: string | undefined, modelName?: string | undefined, loopName?: string | undefined);
|
|
14
16
|
static fromJSON(props: ChatSettingsProps): ChatSettings;
|
|
15
17
|
toJSON(): ChatSettingsProps;
|
|
16
18
|
setLoopName(loopName: string): void;
|
|
19
|
+
setModelProvider(modelProvider: string): void;
|
|
17
20
|
setModelName(modelName: string): void;
|
|
18
21
|
setNotifyOnCompletion(notifyOnCompletion: boolean): void;
|
|
19
22
|
setIsPrivateSession(isPrivateSession: boolean): void;
|
|
@@ -22,16 +22,18 @@ __export(chat_settings_entity_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(chat_settings_entity_exports);
|
|
24
24
|
class ChatSettings {
|
|
25
|
-
constructor(props, notifyOnCompletion, isPrivateSession, modelName, loopName) {
|
|
25
|
+
constructor(props, notifyOnCompletion, isPrivateSession, modelProvider, modelName, loopName) {
|
|
26
26
|
this.props = props;
|
|
27
27
|
this.notifyOnCompletion = notifyOnCompletion;
|
|
28
28
|
this.isPrivateSession = isPrivateSession;
|
|
29
|
+
this.modelProvider = modelProvider;
|
|
29
30
|
this.modelName = modelName;
|
|
30
31
|
this.loopName = loopName;
|
|
31
32
|
}
|
|
32
33
|
props;
|
|
33
34
|
notifyOnCompletion;
|
|
34
35
|
isPrivateSession;
|
|
36
|
+
modelProvider;
|
|
35
37
|
modelName;
|
|
36
38
|
loopName;
|
|
37
39
|
static fromJSON(props) {
|
|
@@ -39,6 +41,7 @@ class ChatSettings {
|
|
|
39
41
|
props,
|
|
40
42
|
props.notifyOnCompletion,
|
|
41
43
|
props.isPrivateSession,
|
|
44
|
+
props.modelProvider,
|
|
42
45
|
props.modelName,
|
|
43
46
|
props.loopName
|
|
44
47
|
);
|
|
@@ -47,6 +50,7 @@ class ChatSettings {
|
|
|
47
50
|
return {
|
|
48
51
|
notifyOnCompletion: this.notifyOnCompletion,
|
|
49
52
|
isPrivateSession: this.isPrivateSession,
|
|
53
|
+
modelProvider: this.modelProvider,
|
|
50
54
|
modelName: this.modelName,
|
|
51
55
|
loopName: this.loopName
|
|
52
56
|
};
|
|
@@ -54,6 +58,9 @@ class ChatSettings {
|
|
|
54
58
|
setLoopName(loopName) {
|
|
55
59
|
this.loopName = loopName;
|
|
56
60
|
}
|
|
61
|
+
setModelProvider(modelProvider) {
|
|
62
|
+
this.modelProvider = modelProvider;
|
|
63
|
+
}
|
|
57
64
|
setModelName(modelName) {
|
|
58
65
|
this.modelName = modelName;
|
|
59
66
|
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import "../../../chunk-CF3WOMB3.mjs";
|
|
2
2
|
class ChatSettings {
|
|
3
|
-
constructor(props, notifyOnCompletion, isPrivateSession, modelName, loopName) {
|
|
3
|
+
constructor(props, notifyOnCompletion, isPrivateSession, modelProvider, modelName, loopName) {
|
|
4
4
|
this.props = props;
|
|
5
5
|
this.notifyOnCompletion = notifyOnCompletion;
|
|
6
6
|
this.isPrivateSession = isPrivateSession;
|
|
7
|
+
this.modelProvider = modelProvider;
|
|
7
8
|
this.modelName = modelName;
|
|
8
9
|
this.loopName = loopName;
|
|
9
10
|
}
|
|
10
11
|
props;
|
|
11
12
|
notifyOnCompletion;
|
|
12
13
|
isPrivateSession;
|
|
14
|
+
modelProvider;
|
|
13
15
|
modelName;
|
|
14
16
|
loopName;
|
|
15
17
|
static fromJSON(props) {
|
|
@@ -17,6 +19,7 @@ class ChatSettings {
|
|
|
17
19
|
props,
|
|
18
20
|
props.notifyOnCompletion,
|
|
19
21
|
props.isPrivateSession,
|
|
22
|
+
props.modelProvider,
|
|
20
23
|
props.modelName,
|
|
21
24
|
props.loopName
|
|
22
25
|
);
|
|
@@ -25,6 +28,7 @@ class ChatSettings {
|
|
|
25
28
|
return {
|
|
26
29
|
notifyOnCompletion: this.notifyOnCompletion,
|
|
27
30
|
isPrivateSession: this.isPrivateSession,
|
|
31
|
+
modelProvider: this.modelProvider,
|
|
28
32
|
modelName: this.modelName,
|
|
29
33
|
loopName: this.loopName
|
|
30
34
|
};
|
|
@@ -32,6 +36,9 @@ class ChatSettings {
|
|
|
32
36
|
setLoopName(loopName) {
|
|
33
37
|
this.loopName = loopName;
|
|
34
38
|
}
|
|
39
|
+
setModelProvider(modelProvider) {
|
|
40
|
+
this.modelProvider = modelProvider;
|
|
41
|
+
}
|
|
35
42
|
setModelName(modelName) {
|
|
36
43
|
this.modelName = modelName;
|
|
37
44
|
}
|
package/dist/skills/skill.d.ts
CHANGED
package/dist/skills/skill.js
CHANGED
|
@@ -38,7 +38,7 @@ class Skill {
|
|
|
38
38
|
this.systemInstructions = props.systemInstructions;
|
|
39
39
|
}
|
|
40
40
|
async run(options) {
|
|
41
|
-
const { sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {}, chat } = options;
|
|
41
|
+
const { provider, modelName, sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {}, chat } = options;
|
|
42
42
|
try {
|
|
43
43
|
const llmClient = import_tsyringe.container.resolve(import_llm_client.LLMClient);
|
|
44
44
|
const currentCountryCode = currentSession?.location?.country;
|
|
@@ -88,6 +88,8 @@ class Skill {
|
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
90
|
const response = await llmClient.complete({
|
|
91
|
+
provider,
|
|
92
|
+
modelName,
|
|
91
93
|
sessionId,
|
|
92
94
|
answerId,
|
|
93
95
|
origin: this.name,
|
package/dist/skills/skill.mjs
CHANGED
|
@@ -16,7 +16,7 @@ class Skill {
|
|
|
16
16
|
this.systemInstructions = props.systemInstructions;
|
|
17
17
|
}
|
|
18
18
|
async run(options) {
|
|
19
|
-
const { sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {}, chat } = options;
|
|
19
|
+
const { provider, modelName, sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {}, chat } = options;
|
|
20
20
|
try {
|
|
21
21
|
const llmClient = container.resolve(LLMClient);
|
|
22
22
|
const currentCountryCode = currentSession?.location?.country;
|
|
@@ -66,6 +66,8 @@ class Skill {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
const response = await llmClient.complete({
|
|
69
|
+
provider,
|
|
70
|
+
modelName,
|
|
69
71
|
sessionId,
|
|
70
72
|
answerId,
|
|
71
73
|
origin: this.name,
|
package/dist/tools/tool.d.ts
CHANGED
|
@@ -22,16 +22,23 @@ export interface BaseParams {
|
|
|
22
22
|
export declare class Tool {
|
|
23
23
|
readonly name: string;
|
|
24
24
|
readonly description: string;
|
|
25
|
+
readonly annotations?: string;
|
|
25
26
|
readonly destructive: boolean;
|
|
26
27
|
readonly parameters: InputSchema;
|
|
27
28
|
private readonly handler;
|
|
28
29
|
constructor(props: {
|
|
29
30
|
name: string;
|
|
30
31
|
description: string;
|
|
32
|
+
annotations?: string;
|
|
31
33
|
destructive?: boolean;
|
|
32
34
|
parameters: InputSchema;
|
|
33
35
|
handler: (...args: any[]) => Promise<Output>;
|
|
34
36
|
});
|
|
37
|
+
get meta(): {
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
annotations: string | undefined;
|
|
41
|
+
};
|
|
35
42
|
run(...args: any[]): Promise<Output>;
|
|
36
43
|
static fromMcp(mcpTool: McpTool, mcpClient: Client, opts: {
|
|
37
44
|
namespace: string;
|
package/dist/tools/tool.js
CHANGED
|
@@ -24,16 +24,25 @@ module.exports = __toCommonJS(tool_exports);
|
|
|
24
24
|
class Tool {
|
|
25
25
|
name;
|
|
26
26
|
description;
|
|
27
|
+
annotations;
|
|
27
28
|
destructive;
|
|
28
29
|
parameters;
|
|
29
30
|
handler;
|
|
30
31
|
constructor(props) {
|
|
31
32
|
this.name = props.name;
|
|
32
33
|
this.description = props.description;
|
|
34
|
+
this.annotations = props.annotations;
|
|
33
35
|
this.destructive = props.destructive ?? false;
|
|
34
36
|
this.parameters = props.parameters;
|
|
35
37
|
this.handler = props.handler;
|
|
36
38
|
}
|
|
39
|
+
get meta() {
|
|
40
|
+
return {
|
|
41
|
+
name: this.name,
|
|
42
|
+
description: this.description,
|
|
43
|
+
annotations: this.annotations
|
|
44
|
+
};
|
|
45
|
+
}
|
|
37
46
|
async run(...args) {
|
|
38
47
|
return this.handler(...args);
|
|
39
48
|
}
|
package/dist/tools/tool.mjs
CHANGED
|
@@ -2,16 +2,25 @@ import "../chunk-CF3WOMB3.mjs";
|
|
|
2
2
|
class Tool {
|
|
3
3
|
name;
|
|
4
4
|
description;
|
|
5
|
+
annotations;
|
|
5
6
|
destructive;
|
|
6
7
|
parameters;
|
|
7
8
|
handler;
|
|
8
9
|
constructor(props) {
|
|
9
10
|
this.name = props.name;
|
|
10
11
|
this.description = props.description;
|
|
12
|
+
this.annotations = props.annotations;
|
|
11
13
|
this.destructive = props.destructive ?? false;
|
|
12
14
|
this.parameters = props.parameters;
|
|
13
15
|
this.handler = props.handler;
|
|
14
16
|
}
|
|
17
|
+
get meta() {
|
|
18
|
+
return {
|
|
19
|
+
name: this.name,
|
|
20
|
+
description: this.description,
|
|
21
|
+
annotations: this.annotations
|
|
22
|
+
};
|
|
23
|
+
}
|
|
15
24
|
async run(...args) {
|
|
16
25
|
return this.handler(...args);
|
|
17
26
|
}
|