openloops 0.1.27 → 0.1.29
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/common/base/current-session.js +4 -5
- package/dist/common/base/current-session.mjs +4 -9
- package/dist/common/base/current-user.js +2 -2
- package/dist/common/base/current-user.mjs +2 -2
- 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/users/entities/user-country.js +2 -2
- package/dist/services/users/entities/user-country.mjs +2 -2
- package/dist/services/users/entities/user-language.js +2 -2
- package/dist/services/users/entities/user-language.mjs +2 -2
- package/dist/services/users/entities/user-timezone.js +2 -2
- package/dist/services/users/entities/user-timezone.mjs +2 -2
- package/dist/services/users/entities/user.entity.js +3 -3
- package/dist/services/users/entities/user.entity.mjs +3 -3
- 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 +4 -3
|
@@ -22,7 +22,7 @@ __export(current_session_exports, {
|
|
|
22
22
|
CurrentSession: () => CurrentSession
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(current_session_exports);
|
|
25
|
-
var
|
|
25
|
+
var import_iso_data = require("iso-data");
|
|
26
26
|
class CurrentSession {
|
|
27
27
|
constructor(clientType, environment, app, device, preferences, location, request) {
|
|
28
28
|
this.clientType = clientType;
|
|
@@ -44,11 +44,10 @@ class CurrentSession {
|
|
|
44
44
|
return this.preferences?.locale?.split("_")[0];
|
|
45
45
|
}
|
|
46
46
|
get timezoneOffset() {
|
|
47
|
-
return (0,
|
|
47
|
+
return (0, import_iso_data.getTimezone)(this.location?.timezone)?.offset;
|
|
48
48
|
}
|
|
49
49
|
get currencyCode() {
|
|
50
|
-
|
|
51
|
-
return currentCountryData?.currency?.isoCode;
|
|
50
|
+
return (0, import_iso_data.getCountry)(this.location?.country)?.currency.isoCode;
|
|
52
51
|
}
|
|
53
52
|
static fromJSON(json) {
|
|
54
53
|
return new CurrentSession(
|
|
@@ -89,7 +88,7 @@ class CurrentSession {
|
|
|
89
88
|
};
|
|
90
89
|
session.location = session.location?.timezone ? {
|
|
91
90
|
...session.location,
|
|
92
|
-
country: (0,
|
|
91
|
+
country: (0, import_iso_data.getTimezone)(session.location?.timezone)?.countryCode
|
|
93
92
|
} : session.location;
|
|
94
93
|
return session;
|
|
95
94
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import "../../chunk-CF3WOMB3.mjs";
|
|
2
|
-
import {
|
|
3
|
-
getCountryDataFromCountryCode,
|
|
4
|
-
getCountryISOCodeFromTimezone,
|
|
5
|
-
getTimezoneOffset
|
|
6
|
-
} from "countries-and-currencies-utils";
|
|
2
|
+
import { getCountry, getTimezone } from "iso-data";
|
|
7
3
|
class CurrentSession {
|
|
8
4
|
constructor(clientType, environment, app, device, preferences, location, request) {
|
|
9
5
|
this.clientType = clientType;
|
|
@@ -25,11 +21,10 @@ class CurrentSession {
|
|
|
25
21
|
return this.preferences?.locale?.split("_")[0];
|
|
26
22
|
}
|
|
27
23
|
get timezoneOffset() {
|
|
28
|
-
return
|
|
24
|
+
return getTimezone(this.location?.timezone)?.offset;
|
|
29
25
|
}
|
|
30
26
|
get currencyCode() {
|
|
31
|
-
|
|
32
|
-
return currentCountryData?.currency?.isoCode;
|
|
27
|
+
return getCountry(this.location?.country)?.currency.isoCode;
|
|
33
28
|
}
|
|
34
29
|
static fromJSON(json) {
|
|
35
30
|
return new CurrentSession(
|
|
@@ -70,7 +65,7 @@ class CurrentSession {
|
|
|
70
65
|
};
|
|
71
66
|
session.location = session.location?.timezone ? {
|
|
72
67
|
...session.location,
|
|
73
|
-
country:
|
|
68
|
+
country: getTimezone(session.location?.timezone)?.countryCode
|
|
74
69
|
} : session.location;
|
|
75
70
|
return session;
|
|
76
71
|
}
|
|
@@ -22,7 +22,7 @@ __export(current_user_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(current_user_exports);
|
|
24
24
|
var import_mongodb = require("mongodb");
|
|
25
|
-
var
|
|
25
|
+
var import_iso_data = require("iso-data");
|
|
26
26
|
var import_mongo_db = require("../repositories/mongo-db.client.js");
|
|
27
27
|
var import_secret_manager = require("../utils/secret-manager.js");
|
|
28
28
|
var import_logger = require("../logger/index.js");
|
|
@@ -63,7 +63,7 @@ class CurrentUser extends import_user.User {
|
|
|
63
63
|
return this.permissions?.notifications ?? false;
|
|
64
64
|
}
|
|
65
65
|
get timezoneOffset() {
|
|
66
|
-
return (0,
|
|
66
|
+
return (0, import_iso_data.getTimezone)(this.preferences?.timezone?.ianaIdentifier)?.offset ?? 0;
|
|
67
67
|
}
|
|
68
68
|
setIsPremium(value) {
|
|
69
69
|
this._isPremium = value;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../chunk-CF3WOMB3.mjs";
|
|
2
2
|
import { ObjectId } from "mongodb";
|
|
3
|
-
import {
|
|
3
|
+
import { getTimezone } from "iso-data";
|
|
4
4
|
import { getMongoDBClient } from "../repositories/mongo-db.client.js";
|
|
5
5
|
import { secretManager } from "../utils/secret-manager.js";
|
|
6
6
|
import { logger } from "../logger/index.js";
|
|
@@ -41,7 +41,7 @@ class CurrentUser extends User {
|
|
|
41
41
|
return this.permissions?.notifications ?? false;
|
|
42
42
|
}
|
|
43
43
|
get timezoneOffset() {
|
|
44
|
-
return
|
|
44
|
+
return getTimezone(this.preferences?.timezone?.ianaIdentifier)?.offset ?? 0;
|
|
45
45
|
}
|
|
46
46
|
setIsPremium(value) {
|
|
47
47
|
this._isPremium = value;
|
|
@@ -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"
|
|
@@ -21,7 +21,7 @@ __export(user_country_exports, {
|
|
|
21
21
|
Country: () => Country
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(user_country_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_iso_data = require("iso-data");
|
|
25
25
|
var import_helpers = require("../../../common/helpers/index.js");
|
|
26
26
|
class Country {
|
|
27
27
|
constructor(isoCode) {
|
|
@@ -29,7 +29,7 @@ class Country {
|
|
|
29
29
|
}
|
|
30
30
|
isoCode;
|
|
31
31
|
get label() {
|
|
32
|
-
return this.isoCode ? (0,
|
|
32
|
+
return this.isoCode ? (0, import_iso_data.getCountry)(this.isoCode)?.name : void 0;
|
|
33
33
|
}
|
|
34
34
|
static fromJSON(props) {
|
|
35
35
|
return new Country((0, import_helpers.sanitizeString)(props.isoCode));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../../chunk-CF3WOMB3.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { getCountry } from "iso-data";
|
|
3
3
|
import { sanitizeString } from "../../../common/helpers/index.js";
|
|
4
4
|
class Country {
|
|
5
5
|
constructor(isoCode) {
|
|
@@ -7,7 +7,7 @@ class Country {
|
|
|
7
7
|
}
|
|
8
8
|
isoCode;
|
|
9
9
|
get label() {
|
|
10
|
-
return this.isoCode ?
|
|
10
|
+
return this.isoCode ? getCountry(this.isoCode)?.name : void 0;
|
|
11
11
|
}
|
|
12
12
|
static fromJSON(props) {
|
|
13
13
|
return new Country(sanitizeString(props.isoCode));
|
|
@@ -22,14 +22,14 @@ __export(user_language_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(user_language_exports);
|
|
24
24
|
var import_helpers = require("../../../common/helpers/index.js");
|
|
25
|
-
var
|
|
25
|
+
var import_iso_data = require("iso-data");
|
|
26
26
|
class Language {
|
|
27
27
|
constructor(isoCode) {
|
|
28
28
|
this.isoCode = isoCode;
|
|
29
29
|
}
|
|
30
30
|
isoCode;
|
|
31
31
|
get label() {
|
|
32
|
-
return this.isoCode ? (0,
|
|
32
|
+
return this.isoCode ? (0, import_iso_data.getLanguage)(this.isoCode)?.nativeName : void 0;
|
|
33
33
|
}
|
|
34
34
|
static fromJSON(props) {
|
|
35
35
|
return new Language((0, import_helpers.sanitizeString)(props.isoCode));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "../../../chunk-CF3WOMB3.mjs";
|
|
2
2
|
import { sanitizeString } from "../../../common/helpers/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getLanguage } from "iso-data";
|
|
4
4
|
class Language {
|
|
5
5
|
constructor(isoCode) {
|
|
6
6
|
this.isoCode = isoCode;
|
|
7
7
|
}
|
|
8
8
|
isoCode;
|
|
9
9
|
get label() {
|
|
10
|
-
return this.isoCode ?
|
|
10
|
+
return this.isoCode ? getLanguage(this.isoCode)?.nativeName : void 0;
|
|
11
11
|
}
|
|
12
12
|
static fromJSON(props) {
|
|
13
13
|
return new Language(sanitizeString(props.isoCode));
|
|
@@ -22,7 +22,7 @@ __export(user_timezone_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(user_timezone_exports);
|
|
24
24
|
var import_helpers = require("../../../common/helpers/index.js");
|
|
25
|
-
var
|
|
25
|
+
var import_iso_data = require("iso-data");
|
|
26
26
|
class Timezone {
|
|
27
27
|
constructor(ianaIdentifier) {
|
|
28
28
|
this.ianaIdentifier = ianaIdentifier;
|
|
@@ -32,7 +32,7 @@ class Timezone {
|
|
|
32
32
|
return new Timezone((0, import_helpers.sanitizeString)(props.ianaIdentifier));
|
|
33
33
|
}
|
|
34
34
|
get offsetInMinutes() {
|
|
35
|
-
return
|
|
35
|
+
return (0, import_iso_data.getTimezone)(this.ianaIdentifier)?.offset;
|
|
36
36
|
}
|
|
37
37
|
toJSON() {
|
|
38
38
|
return { ianaIdentifier: this.ianaIdentifier, offsetInMinutes: this.offsetInMinutes };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../../chunk-CF3WOMB3.mjs";
|
|
2
2
|
import { sanitizeString } from "../../../common/helpers/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getTimezone } from "iso-data";
|
|
4
4
|
class Timezone {
|
|
5
5
|
constructor(ianaIdentifier) {
|
|
6
6
|
this.ianaIdentifier = ianaIdentifier;
|
|
@@ -10,7 +10,7 @@ class Timezone {
|
|
|
10
10
|
return new Timezone(sanitizeString(props.ianaIdentifier));
|
|
11
11
|
}
|
|
12
12
|
get offsetInMinutes() {
|
|
13
|
-
return
|
|
13
|
+
return getTimezone(this.ianaIdentifier)?.offset;
|
|
14
14
|
}
|
|
15
15
|
toJSON() {
|
|
16
16
|
return { ianaIdentifier: this.ianaIdentifier, offsetInMinutes: this.offsetInMinutes };
|
|
@@ -31,7 +31,7 @@ __export(user_entity_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(user_entity_exports);
|
|
33
33
|
var import_decorators = require("../../../common/decorators/index.js");
|
|
34
|
-
var
|
|
34
|
+
var import_iso_data = require("iso-data");
|
|
35
35
|
var import_base = require("../../../common/base/base.entity.js");
|
|
36
36
|
var import_helpers = require("../../../common/helpers/index.js");
|
|
37
37
|
var import_user_password = require("./user-password.value-object");
|
|
@@ -101,8 +101,8 @@ const _User = class _User extends import_base.BaseEntity {
|
|
|
101
101
|
}
|
|
102
102
|
static async create(props) {
|
|
103
103
|
if (props.preferences?.currency?.isoCode) {
|
|
104
|
-
const currencyData =
|
|
105
|
-
props.preferences.currency.label = currencyData?.
|
|
104
|
+
const currencyData = (0, import_iso_data.getCurrency)(props.preferences.currency.isoCode);
|
|
105
|
+
props.preferences.currency.label = currencyData?.name;
|
|
106
106
|
props.preferences.currency.symbol = currencyData?.symbol;
|
|
107
107
|
}
|
|
108
108
|
if (props.password && !import_user_password.UserPassword.isHashed(props.password)) {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
__decorateClass
|
|
3
3
|
} from "../../../chunk-CF3WOMB3.mjs";
|
|
4
4
|
import { MaskInLogs, AdminOnly } from "../../../common/decorators/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { getCurrency } from "iso-data";
|
|
6
6
|
import { BaseEntity } from "../../../common/base/base.entity.js";
|
|
7
7
|
import { sanitizeString } from "../../../common/helpers/index.js";
|
|
8
8
|
import { UserPassword } from "./user-password.value-object";
|
|
@@ -72,8 +72,8 @@ const _User = class _User extends BaseEntity {
|
|
|
72
72
|
}
|
|
73
73
|
static async create(props) {
|
|
74
74
|
if (props.preferences?.currency?.isoCode) {
|
|
75
|
-
const currencyData =
|
|
76
|
-
props.preferences.currency.label = currencyData?.
|
|
75
|
+
const currencyData = getCurrency(props.preferences.currency.isoCode);
|
|
76
|
+
props.preferences.currency.label = currencyData?.name;
|
|
77
77
|
props.preferences.currency.symbol = currencyData?.symbol;
|
|
78
78
|
}
|
|
79
79
|
if (props.password && !UserPassword.isHashed(props.password)) {
|
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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openloops",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"description": "Framework to build AI Agents",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jose Barcos",
|
|
@@ -71,7 +71,8 @@
|
|
|
71
71
|
"build": "tsup && tsc-alias",
|
|
72
72
|
"prepublishOnly": "yarn build",
|
|
73
73
|
"check-size": "npm pack --dry-run",
|
|
74
|
-
"release": "npm version patch && npm publish --access public"
|
|
74
|
+
"release": "npm version patch && npm publish --access public",
|
|
75
|
+
"push": "git push --follow-tags"
|
|
75
76
|
},
|
|
76
77
|
"dependencies": {
|
|
77
78
|
"@mariozechner/pi-ai": "^0.73.1",
|
|
@@ -79,10 +80,10 @@
|
|
|
79
80
|
"@sentry/node": "^11.0.0",
|
|
80
81
|
"axios": "^1.20.0",
|
|
81
82
|
"bcryptjs": "^3.0.3",
|
|
82
|
-
"countries-and-currencies-utils": "^0.1.9",
|
|
83
83
|
"cryptr": "^6.4.0",
|
|
84
84
|
"dotenv": "^18.0.3",
|
|
85
85
|
"html-to-text": "^10.0.1",
|
|
86
|
+
"iso-data": "^0.1.0",
|
|
86
87
|
"jsonwebtoken": "^9.0.3",
|
|
87
88
|
"langfuse": "^3.39.2",
|
|
88
89
|
"mongodb": "^7.6.0",
|