openloops 0.1.39 → 0.2.2
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 +40 -4
- package/dist/clients/index.d.ts +2 -2
- package/dist/clients/index.js +4 -4
- package/dist/clients/index.mjs +2 -2
- package/dist/clients/llm/index.d.ts +1 -0
- package/dist/{loops/plan-execute → clients/llm}/index.js +4 -4
- package/dist/clients/llm/index.mjs +1 -0
- package/dist/clients/{llm-client.d.ts → llm/llm-client.d.ts} +3 -14
- package/dist/clients/{llm-client.js → llm/llm-client.js} +14 -37
- package/dist/clients/{llm-client.mjs → llm/llm-client.mjs} +15 -38
- package/dist/clients/{llm-error.mjs → llm/llm-error.mjs} +1 -1
- package/dist/clients/{llm-types.d.ts → llm/llm-types.d.ts} +1 -1
- package/dist/clients/llm/model-resolution.d.ts +20 -0
- package/dist/clients/llm/model-resolution.js +83 -0
- package/dist/clients/llm/model-resolution.mjs +46 -0
- package/dist/clients/{pi-ai-adapter.mjs → llm/pi-ai-adapter.mjs} +1 -1
- package/dist/clients/serper/index.d.ts +1 -0
- package/dist/clients/serper/index.js +22 -0
- package/dist/clients/serper/index.mjs +1 -0
- package/dist/clients/{serper-client.js → serper/serper-client.js} +2 -2
- package/dist/clients/{serper-client.mjs → serper/serper-client.mjs} +3 -3
- package/dist/harness/agent-loop.d.ts +0 -1
- package/dist/harness/agent.d.ts +6 -1
- package/dist/harness/agent.js +21 -13
- package/dist/harness/agent.mjs +21 -13
- package/dist/harness/native-tools.d.ts +1 -1
- package/dist/{loops/shared → harness}/skills/approval-request.d.ts +1 -1
- package/dist/{loops/shared → harness}/skills/approval-request.js +1 -1
- package/dist/{loops/shared → harness}/skills/approval-request.mjs +2 -2
- package/dist/{loops/shared → harness}/skills/autonomous-answer.d.ts +1 -1
- package/dist/{loops/shared → harness}/skills/autonomous-answer.js +1 -1
- package/dist/{loops/shared → harness}/skills/autonomous-answer.mjs +2 -2
- package/dist/{loops/shared → harness}/skills/confirmation-gate.d.ts +1 -1
- package/dist/{loops/shared → harness}/skills/confirmation-gate.js +1 -1
- package/dist/{loops/shared → harness}/skills/confirmation-gate.mjs +2 -2
- package/dist/harness/skills/index.d.ts +4 -0
- package/dist/{loops/plan-execute → harness}/skills/index.js +8 -8
- package/dist/harness/skills/index.mjs +4 -0
- package/dist/{loops/shared → harness}/skills/mcp-change-review.d.ts +1 -1
- package/dist/{loops/shared → harness}/skills/mcp-change-review.js +1 -1
- package/dist/{loops/shared → harness}/skills/mcp-change-review.mjs +2 -2
- package/dist/harness/tool-catalog.d.ts +1 -1
- package/dist/loops/index.d.ts +0 -1
- package/dist/loops/index.js +0 -2
- package/dist/loops/index.mjs +0 -1
- package/dist/loops/shared/skills/index.d.ts +0 -4
- package/dist/loops/shared/skills/index.js +1 -9
- package/dist/loops/shared/skills/index.mjs +0 -4
- package/dist/services/chats/entities/chat.entity.d.ts +0 -5
- package/dist/services/chats/entities/chat.entity.js +0 -10
- package/dist/services/chats/entities/chat.entity.mjs +0 -10
- package/dist/services/llmcalls/module.d.ts +4 -2
- package/dist/services/llmcalls/module.js +13 -6
- package/dist/services/llmcalls/module.mjs +11 -5
- package/dist/services/llmcalls/use-cases/get-llm-usage-by-chat.use-case.d.ts +14 -0
- package/dist/services/llmcalls/use-cases/get-llm-usage-by-chat.use-case.js +62 -0
- package/dist/services/llmcalls/use-cases/get-llm-usage-by-chat.use-case.mjs +33 -0
- package/dist/services/llmcalls/use-cases/get-llm-usage-by-message.use-case.d.ts +14 -0
- package/dist/services/llmcalls/use-cases/{get-llm-usage.use-case.js → get-llm-usage-by-message.use-case.js} +18 -37
- package/dist/services/llmcalls/use-cases/get-llm-usage-by-message.use-case.mjs +33 -0
- package/dist/services/llmcalls/utils/usage-totals.d.ts +20 -0
- package/dist/services/llmcalls/utils/usage-totals.js +31 -0
- package/dist/services/llmcalls/utils/usage-totals.mjs +29 -0
- package/dist/services/tasks/entities/agent-task.entity.d.ts +2 -24
- package/dist/services/tasks/entities/agent-task.entity.js +2 -75
- package/dist/services/tasks/entities/agent-task.entity.mjs +2 -75
- package/dist/services/users/entities/user-default-model.d.ts +11 -0
- package/dist/services/users/entities/user-default-model.js +42 -0
- package/dist/services/users/entities/user-default-model.mjs +19 -0
- package/dist/services/users/entities/user-preferences.d.ts +4 -1
- package/dist/services/users/entities/user-preferences.js +8 -3
- package/dist/services/users/entities/user-preferences.mjs +8 -3
- package/dist/services/users/use-cases/create-user.use-case.js +3 -1
- package/dist/services/users/use-cases/create-user.use-case.mjs +3 -1
- package/dist/services/users/use-cases/update-user.use-case.js +4 -1
- package/dist/services/users/use-cases/update-user.use-case.mjs +4 -1
- package/dist/services/users/utils/default-model.d.ts +6 -0
- package/dist/services/users/utils/default-model.js +38 -0
- package/dist/services/users/utils/default-model.mjs +15 -0
- package/dist/skills/call-modes.d.ts +1 -1
- package/dist/skills/skill.d.ts +1 -1
- package/dist/skills/skill.js +1 -1
- package/dist/skills/skill.mjs +1 -1
- package/dist/tools/core/web-search/web-search.tool.js +1 -1
- package/dist/tools/core/web-search/web-search.tool.mjs +1 -1
- package/docs/README.md +1 -1
- package/docs/agent.md +4 -3
- package/docs/agentic-jobs.md +1 -1
- package/docs/assets/harness-car.svg +79 -0
- package/docs/chats.md +1 -1
- package/docs/configuration.md +18 -4
- package/docs/harness.md +12 -1
- package/docs/integration-guide.md +2 -2
- package/docs/llms.txt +1 -1
- package/docs/loops.md +4 -15
- package/docs/usage.md +19 -14
- package/docs/users.md +23 -0
- package/examples/run-agent/run-agent-with-fallback-model.ts +25 -0
- package/examples/usage/get-chat-usage.ts +8 -10
- package/examples/usage/get-message-usage.ts +5 -7
- package/examples/users/set-default-model.ts +36 -0
- package/package.json +1 -16
- package/dist/loops/plan-execute/index.d.ts +0 -1
- package/dist/loops/plan-execute/index.mjs +0 -1
- package/dist/loops/plan-execute/loop.d.ts +0 -26
- package/dist/loops/plan-execute/loop.js +0 -267
- package/dist/loops/plan-execute/loop.mjs +0 -249
- package/dist/loops/plan-execute/skills/action-planner.d.ts +0 -35
- package/dist/loops/plan-execute/skills/action-planner.js +0 -71
- package/dist/loops/plan-execute/skills/action-planner.mjs +0 -48
- package/dist/loops/plan-execute/skills/final-responder.d.ts +0 -7
- package/dist/loops/plan-execute/skills/final-responder.js +0 -58
- package/dist/loops/plan-execute/skills/final-responder.mjs +0 -35
- package/dist/loops/plan-execute/skills/index.d.ts +0 -4
- package/dist/loops/plan-execute/skills/index.mjs +0 -4
- package/dist/loops/plan-execute/skills/state-observer.d.ts +0 -10
- package/dist/loops/plan-execute/skills/state-observer.js +0 -61
- package/dist/loops/plan-execute/skills/state-observer.mjs +0 -38
- package/dist/loops/plan-execute/skills/strategy-engine.d.ts +0 -11
- package/dist/loops/plan-execute/skills/strategy-engine.js +0 -61
- package/dist/loops/plan-execute/skills/strategy-engine.mjs +0 -38
- package/dist/services/llmcalls/use-cases/get-llm-usage.use-case.d.ts +0 -24
- package/dist/services/llmcalls/use-cases/get-llm-usage.use-case.mjs +0 -51
- package/dist/skills/skill-runner.d.ts +0 -30
- package/dist/skills/skill-runner.js +0 -121
- package/dist/skills/skill-runner.mjs +0 -92
- /package/dist/clients/{llm-error.d.ts → llm/llm-error.d.ts} +0 -0
- /package/dist/clients/{llm-error.js → llm/llm-error.js} +0 -0
- /package/dist/clients/{llm-types.js → llm/llm-types.js} +0 -0
- /package/dist/clients/{llm-types.mjs → llm/llm-types.mjs} +0 -0
- /package/dist/clients/{pi-ai-adapter.d.ts → llm/pi-ai-adapter.d.ts} +0 -0
- /package/dist/clients/{pi-ai-adapter.js → llm/pi-ai-adapter.js} +0 -0
- /package/dist/clients/{serper-client.d.ts → serper/serper-client.d.ts} +0 -0
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
20
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
21
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
22
|
-
if (decorator = decorators[i])
|
|
23
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
24
|
-
if (kind && result) __defProp(target, key, result);
|
|
25
|
-
return result;
|
|
26
|
-
};
|
|
27
|
-
var skill_runner_exports = {};
|
|
28
|
-
__export(skill_runner_exports, {
|
|
29
|
-
SkillRunner: () => SkillRunner
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(skill_runner_exports);
|
|
32
|
-
var import_tsyringe = require("tsyringe");
|
|
33
|
-
var import_helpers = require("../common/helpers/index.js");
|
|
34
|
-
let SkillRunner = class {
|
|
35
|
-
constructor(llmClient) {
|
|
36
|
-
this.llmClient = llmClient;
|
|
37
|
-
}
|
|
38
|
-
llmClient;
|
|
39
|
-
async execute(options) {
|
|
40
|
-
const { skill, sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {} } = options;
|
|
41
|
-
const currentCountryCode = currentSession?.location?.country;
|
|
42
|
-
const currentCurrencyCode = currentSession?.currencyCode;
|
|
43
|
-
const now = /* @__PURE__ */ new Date();
|
|
44
|
-
const timezone = currentSession?.location?.timezone;
|
|
45
|
-
const nowLocal = timezone ? now.toLocaleString("sv-SE", { timeZone: timezone }) : void 0;
|
|
46
|
-
const payload = {
|
|
47
|
-
SYSTEM_INSTRUCTIONS: {
|
|
48
|
-
...skill.systemInstructions
|
|
49
|
-
},
|
|
50
|
-
CONTEXT: {
|
|
51
|
-
now_utc: (/* @__PURE__ */ new Date()).toISOString(),
|
|
52
|
-
now_local: nowLocal,
|
|
53
|
-
timezone: currentSession?.location?.timezone,
|
|
54
|
-
day_of_week: (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { weekday: "long" }),
|
|
55
|
-
...currentUser ? {
|
|
56
|
-
user_details: {
|
|
57
|
-
first_name: currentUser?.firstName,
|
|
58
|
-
last_name: currentUser?.lastName,
|
|
59
|
-
// Configuración/Preferencias del usuario
|
|
60
|
-
preferred_language: currentUser?.language,
|
|
61
|
-
residence_country_code: currentUser?.preferences?.country?.isoCode,
|
|
62
|
-
preferred_currency_code: currentUser?.preferences?.currency?.isoCode
|
|
63
|
-
}
|
|
64
|
-
} : {},
|
|
65
|
-
...currentSession ? {
|
|
66
|
-
session_details: {
|
|
67
|
-
current_location: {
|
|
68
|
-
country_code: currentCountryCode,
|
|
69
|
-
currency_code: currentCurrencyCode,
|
|
70
|
-
timezone_offset: currentSession?.timezoneOffset
|
|
71
|
-
},
|
|
72
|
-
client_info: {
|
|
73
|
-
platform: currentSession?.device?.os,
|
|
74
|
-
brand: currentSession?.device?.brand,
|
|
75
|
-
model: currentSession?.device?.model
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
} : {},
|
|
79
|
-
...contextInjection
|
|
80
|
-
},
|
|
81
|
-
INPUT: {
|
|
82
|
-
...userMessage ? { user_message: userMessage } : {},
|
|
83
|
-
...input
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
const response = await this.llmClient.complete({
|
|
87
|
-
sessionId,
|
|
88
|
-
answerId,
|
|
89
|
-
origin: skill.name,
|
|
90
|
-
currentUser,
|
|
91
|
-
messages: [
|
|
92
|
-
{
|
|
93
|
-
role: "user",
|
|
94
|
-
timestamp: Date.now(),
|
|
95
|
-
content: [{ type: "text", text: JSON.stringify(payload) }]
|
|
96
|
-
}
|
|
97
|
-
],
|
|
98
|
-
temperature: skill.temperature ?? 0.7
|
|
99
|
-
});
|
|
100
|
-
return {
|
|
101
|
-
...this.parseJsonResponse(response),
|
|
102
|
-
responseId: response.responseId ?? "",
|
|
103
|
-
costInUsd: response?.usage?.cost?.total
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
parseJsonResponse(response) {
|
|
107
|
-
const rawContent = response?.content ?? [];
|
|
108
|
-
const text = rawContent[0]?.type === "text" ? rawContent[0].text : void 0;
|
|
109
|
-
if (!text) throw new Error("LLM response text is empty or invalid");
|
|
110
|
-
const content = (0, import_helpers.extractJSON)(text);
|
|
111
|
-
if (!content) throw new Error("Failed to extract JSON from LLM response");
|
|
112
|
-
return content;
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
SkillRunner = __decorateClass([
|
|
116
|
-
(0, import_tsyringe.autoInjectable)()
|
|
117
|
-
], SkillRunner);
|
|
118
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
119
|
-
0 && (module.exports = {
|
|
120
|
-
SkillRunner
|
|
121
|
-
});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__decorateClass
|
|
3
|
-
} from "../chunk-CF3WOMB3.mjs";
|
|
4
|
-
import { autoInjectable } from "tsyringe";
|
|
5
|
-
import { extractJSON } from "../common/helpers/index.js";
|
|
6
|
-
let SkillRunner = class {
|
|
7
|
-
constructor(llmClient) {
|
|
8
|
-
this.llmClient = llmClient;
|
|
9
|
-
}
|
|
10
|
-
llmClient;
|
|
11
|
-
async execute(options) {
|
|
12
|
-
const { skill, sessionId, answerId, userMessage, currentUser, currentSession, contextInjection = {}, input = {} } = options;
|
|
13
|
-
const currentCountryCode = currentSession?.location?.country;
|
|
14
|
-
const currentCurrencyCode = currentSession?.currencyCode;
|
|
15
|
-
const now = /* @__PURE__ */ new Date();
|
|
16
|
-
const timezone = currentSession?.location?.timezone;
|
|
17
|
-
const nowLocal = timezone ? now.toLocaleString("sv-SE", { timeZone: timezone }) : void 0;
|
|
18
|
-
const payload = {
|
|
19
|
-
SYSTEM_INSTRUCTIONS: {
|
|
20
|
-
...skill.systemInstructions
|
|
21
|
-
},
|
|
22
|
-
CONTEXT: {
|
|
23
|
-
now_utc: (/* @__PURE__ */ new Date()).toISOString(),
|
|
24
|
-
now_local: nowLocal,
|
|
25
|
-
timezone: currentSession?.location?.timezone,
|
|
26
|
-
day_of_week: (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { weekday: "long" }),
|
|
27
|
-
...currentUser ? {
|
|
28
|
-
user_details: {
|
|
29
|
-
first_name: currentUser?.firstName,
|
|
30
|
-
last_name: currentUser?.lastName,
|
|
31
|
-
// Configuración/Preferencias del usuario
|
|
32
|
-
preferred_language: currentUser?.language,
|
|
33
|
-
residence_country_code: currentUser?.preferences?.country?.isoCode,
|
|
34
|
-
preferred_currency_code: currentUser?.preferences?.currency?.isoCode
|
|
35
|
-
}
|
|
36
|
-
} : {},
|
|
37
|
-
...currentSession ? {
|
|
38
|
-
session_details: {
|
|
39
|
-
current_location: {
|
|
40
|
-
country_code: currentCountryCode,
|
|
41
|
-
currency_code: currentCurrencyCode,
|
|
42
|
-
timezone_offset: currentSession?.timezoneOffset
|
|
43
|
-
},
|
|
44
|
-
client_info: {
|
|
45
|
-
platform: currentSession?.device?.os,
|
|
46
|
-
brand: currentSession?.device?.brand,
|
|
47
|
-
model: currentSession?.device?.model
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
} : {},
|
|
51
|
-
...contextInjection
|
|
52
|
-
},
|
|
53
|
-
INPUT: {
|
|
54
|
-
...userMessage ? { user_message: userMessage } : {},
|
|
55
|
-
...input
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const response = await this.llmClient.complete({
|
|
59
|
-
sessionId,
|
|
60
|
-
answerId,
|
|
61
|
-
origin: skill.name,
|
|
62
|
-
currentUser,
|
|
63
|
-
messages: [
|
|
64
|
-
{
|
|
65
|
-
role: "user",
|
|
66
|
-
timestamp: Date.now(),
|
|
67
|
-
content: [{ type: "text", text: JSON.stringify(payload) }]
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
temperature: skill.temperature ?? 0.7
|
|
71
|
-
});
|
|
72
|
-
return {
|
|
73
|
-
...this.parseJsonResponse(response),
|
|
74
|
-
responseId: response.responseId ?? "",
|
|
75
|
-
costInUsd: response?.usage?.cost?.total
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
parseJsonResponse(response) {
|
|
79
|
-
const rawContent = response?.content ?? [];
|
|
80
|
-
const text = rawContent[0]?.type === "text" ? rawContent[0].text : void 0;
|
|
81
|
-
if (!text) throw new Error("LLM response text is empty or invalid");
|
|
82
|
-
const content = extractJSON(text);
|
|
83
|
-
if (!content) throw new Error("Failed to extract JSON from LLM response");
|
|
84
|
-
return content;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
SkillRunner = __decorateClass([
|
|
88
|
-
autoInjectable()
|
|
89
|
-
], SkillRunner);
|
|
90
|
-
export {
|
|
91
|
-
SkillRunner
|
|
92
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|