n8n-nodes-vercel-ai-sdk-universal-temp 0.2.60 → 0.2.62
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/nodes/UniversalAgent/UniversalAgent.node.d.ts +1 -1
- package/dist/nodes/UniversalAgent/UniversalAgent.node.js +57 -194
- package/dist/nodes/UniversalAgent/UniversalAgent.node.js.map +1 -1
- package/dist/nodes/shared/descriptions.js +0 -9
- package/dist/nodes/shared/descriptions.js.map +1 -1
- package/dist/nodes/shared/letta/client.d.ts +39 -0
- package/dist/nodes/shared/letta/client.js +178 -0
- package/dist/nodes/shared/letta/client.js.map +1 -0
- package/dist/nodes/shared/letta/index.d.ts +3 -10
- package/dist/nodes/shared/letta/index.js +10 -215
- package/dist/nodes/shared/letta/index.js.map +1 -1
- package/dist/nodes/shared/letta/load-options.d.ts +2 -0
- package/dist/nodes/shared/letta/load-options.js +26 -0
- package/dist/nodes/shared/letta/load-options.js.map +1 -0
- package/dist/package.json +8 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -7
|
@@ -1,219 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
exports.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
if (!agentId || !agentId.trim()) {
|
|
47
|
-
console.log('LETTADEBUG: Agent ID is missing, throwing error.');
|
|
48
|
-
throw new n8n_workflow_1.NodeOperationError(exec.getNode(), 'Agent ID is required for Letta provider. Please specify the Letta Agent ID (format: agent-<uuid>).');
|
|
49
|
-
}
|
|
50
|
-
const agentConfig = {
|
|
51
|
-
id: agentId,
|
|
52
|
-
};
|
|
53
|
-
const identifierKey = exec.getNodeParameter('lettaIdentityId', index, '');
|
|
54
|
-
if (identifierKey && identifierKey.trim()) {
|
|
55
|
-
agentConfig.identifier_key = identifierKey;
|
|
56
|
-
}
|
|
57
|
-
const identityPropertiesRaw = exec.getNodeParameter('lettaIdentityProperties', index, []);
|
|
58
|
-
if (identifierKey && identityPropertiesRaw.length > 0) {
|
|
59
|
-
if (!agentConfig.identity_properties) {
|
|
60
|
-
agentConfig.identity_properties = identityPropertiesRaw.map(prop => ({
|
|
61
|
-
key: prop.key,
|
|
62
|
-
value: prop.value,
|
|
63
|
-
type: prop.type || 'string'
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const background = exec.getNodeParameter('lettaBackground', index, false);
|
|
68
|
-
if (background) {
|
|
69
|
-
agentConfig.background = true;
|
|
70
|
-
}
|
|
71
|
-
try {
|
|
72
|
-
const maxSteps = exec.getNodeParameter('lettaMaxSteps', index, 100);
|
|
73
|
-
if (maxSteps > 0) {
|
|
74
|
-
agentConfig.maxSteps = maxSteps;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
catch (e) {
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
const streamTokens = exec.getNodeParameter('lettaStreamTokens', index, false);
|
|
81
|
-
if (streamTokens) {
|
|
82
|
-
agentConfig.streamTokens = true;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (e) {
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
const includePings = exec.getNodeParameter('lettaIncludePings', index, false);
|
|
89
|
-
if (includePings) {
|
|
90
|
-
agentConfig.includePings = true;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch (e) {
|
|
94
|
-
}
|
|
95
|
-
try {
|
|
96
|
-
const useAssistantMessage = exec.getNodeParameter('lettaUseAssistantMessage', index, false);
|
|
97
|
-
if (useAssistantMessage) {
|
|
98
|
-
agentConfig.useAssistantMessage = true;
|
|
99
|
-
try {
|
|
100
|
-
const assistantMessageToolName = exec.getNodeParameter('lettaAssistantMessageToolName', index, '');
|
|
101
|
-
if (assistantMessageToolName) {
|
|
102
|
-
agentConfig.assistantMessageToolName = assistantMessageToolName;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
catch (e) {
|
|
106
|
-
}
|
|
107
|
-
try {
|
|
108
|
-
const assistantMessageToolKwarg = exec.getNodeParameter('lettaAssistantMessageToolKwarg', index, '');
|
|
109
|
-
if (assistantMessageToolKwarg) {
|
|
110
|
-
agentConfig.assistantMessageToolKwarg = assistantMessageToolKwarg;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
catch (e) {
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
catch (e) {
|
|
118
|
-
}
|
|
119
|
-
const options = {
|
|
120
|
-
agent: agentConfig,
|
|
121
|
-
};
|
|
122
|
-
try {
|
|
123
|
-
const timeoutInSeconds = exec.getNodeParameter('lettaTimeoutInSeconds', index, 300);
|
|
124
|
-
if (timeoutInSeconds > 0) {
|
|
125
|
-
options.timeoutInSeconds = timeoutInSeconds;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
catch (e) {
|
|
129
|
-
}
|
|
130
|
-
console.log('LETTADEBUG: Exiting buildLettaProviderOptions successfully.');
|
|
131
|
-
return options;
|
|
132
|
-
}
|
|
133
|
-
async function setupLettaProviderOptions(exec, index) {
|
|
134
|
-
console.log('LETTADEBUG: Entering setupLettaProviderOptions');
|
|
135
|
-
try {
|
|
136
|
-
const result = buildLettaProviderOptions(exec, index);
|
|
137
|
-
console.log('LETTADEBUG: Exiting setupLettaProviderOptions successfully.');
|
|
138
|
-
return result;
|
|
139
|
-
}
|
|
140
|
-
catch (error) {
|
|
141
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
142
|
-
console.error('UniversalAI: Letta provider options setup failed:', errorMessage);
|
|
143
|
-
console.log('LETTADEBUG: Exiting setupLettaProviderOptions with error.');
|
|
144
|
-
throw error;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
async function upsertLettaIdentity(apiKey, baseUrl, identityId, properties) {
|
|
148
|
-
if (!apiKey || !apiKey.trim()) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
try {
|
|
152
|
-
const { createLetta } = await Promise.resolve().then(() => __importStar(require('@letta-ai/vercel-ai-sdk-provider')));
|
|
153
|
-
const isCloud = !baseUrl || baseUrl === 'https://api.letta.com';
|
|
154
|
-
const providerOptions = {
|
|
155
|
-
...(isCloud ? { token: apiKey } : (apiKey ? { token: apiKey } : {})),
|
|
156
|
-
};
|
|
157
|
-
if (baseUrl) {
|
|
158
|
-
providerOptions.baseUrl = baseUrl;
|
|
159
|
-
}
|
|
160
|
-
const provider = createLetta(providerOptions);
|
|
161
|
-
const client = provider.client;
|
|
162
|
-
await client.identities.properties.upsert(identityId, properties);
|
|
163
|
-
console.log(`Letta: Successfully upserted identity ${identityId}`);
|
|
164
|
-
}
|
|
165
|
-
catch (error) {
|
|
166
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
167
|
-
console.error(`Letta: Failed to upsert identity: ${errorMessage}`);
|
|
168
|
-
throw new Error(`Failed to upsert Letta identity: ${errorMessage}`);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
async function getLettaAgent(apiKey, baseUrl, agentId) {
|
|
172
|
-
if (!apiKey || !apiKey.trim()) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
try {
|
|
176
|
-
const { createLetta } = await Promise.resolve().then(() => __importStar(require('@letta-ai/vercel-ai-sdk-provider')));
|
|
177
|
-
const isCloud = !baseUrl || baseUrl === 'https://api.letta.com';
|
|
178
|
-
const providerOptions = {
|
|
179
|
-
...(isCloud ? { token: apiKey } : (apiKey ? { token: apiKey } : {})),
|
|
180
|
-
};
|
|
181
|
-
if (baseUrl) {
|
|
182
|
-
providerOptions.baseUrl = baseUrl;
|
|
183
|
-
}
|
|
184
|
-
const provider = createLetta(providerOptions);
|
|
185
|
-
const client = provider.client;
|
|
186
|
-
const agent = await client.agents.retrieve(agentId);
|
|
187
|
-
return agent;
|
|
188
|
-
}
|
|
189
|
-
catch (error) {
|
|
190
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
191
|
-
console.error(`Letta: Failed to get agent: ${errorMessage}`);
|
|
192
|
-
throw new Error(`Failed to get Letta agent: ${errorMessage}`);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
async function listLettaAgents(apiKey, baseUrl) {
|
|
196
|
-
if (!apiKey || !apiKey.trim()) {
|
|
197
|
-
return [];
|
|
198
|
-
}
|
|
199
|
-
try {
|
|
200
|
-
const { createLetta } = await Promise.resolve().then(() => __importStar(require('@letta-ai/vercel-ai-sdk-provider')));
|
|
201
|
-
const isCloud = !baseUrl || baseUrl === 'https://api.letta.com';
|
|
202
|
-
const providerOptions = {
|
|
203
|
-
...(isCloud ? { token: apiKey } : (apiKey ? { token: apiKey } : {})),
|
|
204
|
-
};
|
|
205
|
-
if (baseUrl) {
|
|
206
|
-
providerOptions.baseUrl = baseUrl;
|
|
207
|
-
}
|
|
208
|
-
const provider = createLetta(providerOptions);
|
|
209
|
-
const client = provider.client;
|
|
210
|
-
const agents = await client.agents.list();
|
|
211
|
-
return agents;
|
|
212
|
-
}
|
|
213
|
-
catch (error) {
|
|
214
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
215
|
-
console.error(`Letta: Failed to list agents: ${errorMessage}`);
|
|
216
|
-
throw new Error(`Failed to list Letta agents: ${errorMessage}`);
|
|
217
|
-
}
|
|
3
|
+
exports.LettaClientWrapper = void 0;
|
|
4
|
+
exports.getLettaProvider = getLettaProvider;
|
|
5
|
+
const client_1 = require("./client");
|
|
6
|
+
var client_2 = require("./client");
|
|
7
|
+
Object.defineProperty(exports, "LettaClientWrapper", { enumerable: true, get: function () { return client_2.LettaClientWrapper; } });
|
|
8
|
+
async function getLettaProvider(exec, index) {
|
|
9
|
+
const credentials = await exec.getCredentials('lettaApi');
|
|
10
|
+
const apiKey = (credentials === null || credentials === void 0 ? void 0 : credentials.apiKey) || '';
|
|
11
|
+
const baseUrl = (credentials === null || credentials === void 0 ? void 0 : credentials.baseUrl) || 'https://api.letta.com';
|
|
12
|
+
return new client_1.LettaClientWrapper({ apiKey, baseUrl });
|
|
218
13
|
}
|
|
219
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/shared/letta/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/shared/letta/index.ts"],"names":[],"mappings":";;;AAYA,4CASC;AApBD,qCAA8C;AAE9C,mCAA8C;AAArC,4GAAA,kBAAkB,OAAA;AASpB,KAAK,UAAU,gBAAgB,CACrC,IAAuB,EACvB,KAAa;IAEb,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAiB,KAAI,EAAE,CAAC;IACrD,MAAM,OAAO,GAAG,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAkB,KAAI,uBAAuB,CAAC;IAE5E,OAAO,IAAI,2BAAkB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLettaAgents = getLettaAgents;
|
|
4
|
+
const client_1 = require("./client");
|
|
5
|
+
async function getLettaAgents(context) {
|
|
6
|
+
try {
|
|
7
|
+
const credentials = await context.getCredentials('lettaApi');
|
|
8
|
+
if (!credentials) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
const apiKey = credentials.apiKey || '';
|
|
12
|
+
const baseUrl = credentials.baseUrl || 'https://api.letta.com';
|
|
13
|
+
const client = new client_1.LettaClientWrapper({ apiKey, baseUrl });
|
|
14
|
+
const agents = await client.listAgents();
|
|
15
|
+
return agents.map((agent) => ({
|
|
16
|
+
name: agent.name || agent.id,
|
|
17
|
+
value: agent.id,
|
|
18
|
+
description: agent.description || `Agent: ${agent.id}`,
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.error(`Failed to load Letta agents:`, error);
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=load-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-options.js","sourceRoot":"","sources":["../../../../nodes/shared/letta/load-options.ts"],"names":[],"mappings":";;AASA,wCAyBC;AAjCD,qCAA8C;AAQvC,KAAK,UAAU,cAAc,CACnC,OAA8B;IAE9B,IAAI,CAAC;QACJ,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QAE7D,IAAI,CAAC,WAAW,EAAE,CAAC;YAClB,OAAO,EAAE,CAAC;QACX,CAAC;QAED,MAAM,MAAM,GAAI,WAAW,CAAC,MAAiB,IAAI,EAAE,CAAC;QACpD,MAAM,OAAO,GAAI,WAAW,CAAC,OAAkB,IAAI,uBAAuB,CAAC;QAE3E,MAAM,MAAM,GAAG,IAAI,2BAAkB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QAEzC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC;YAClC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE;YAC5B,KAAK,EAAE,KAAK,CAAC,EAAE;YACf,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,UAAU,KAAK,CAAC,EAAE,EAAE;SACtD,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;QACrD,OAAO,EAAE,CAAC;IACX,CAAC;AACF,CAAC"}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-vercel-ai-sdk-universal-temp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.62",
|
|
4
4
|
"description": "Universal AI SDK n8n nodes integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package"
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"nodes": [
|
|
42
42
|
"dist/nodes/UniversalAI/UniversalAI.node.js",
|
|
43
43
|
"dist/nodes/UniversalAgent/UniversalAgent.node.js",
|
|
44
|
-
"dist/nodes/UniversalEmbedding.node.js",
|
|
45
|
-
"dist/nodes/UniversalImageGen.node.js",
|
|
46
|
-
"dist/nodes/UniversalSpeechGen.node.js",
|
|
47
|
-
"dist/nodes/UniversalTranscription.node.js"
|
|
44
|
+
"dist/nodes/UniversalEmbedding/UniversalEmbedding.node.js",
|
|
45
|
+
"dist/nodes/UniversalImageGen/UniversalImageGen.node.js",
|
|
46
|
+
"dist/nodes/UniversalSpeechGen/UniversalSpeechGen.node.js",
|
|
47
|
+
"dist/nodes/UniversalTranscription/UniversalTranscription.node.js"
|
|
48
48
|
]
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
@@ -59,7 +59,8 @@
|
|
|
59
59
|
"jest": "^30.2.0",
|
|
60
60
|
"prettier": "^3.6.2",
|
|
61
61
|
"ts-jest": "^29.4.5",
|
|
62
|
-
"typescript": "^5.9.3"
|
|
62
|
+
"typescript": "^5.9.3",
|
|
63
|
+
"typescript-eslint": "^8.46.2"
|
|
63
64
|
},
|
|
64
65
|
"peerDependencies": {
|
|
65
66
|
"n8n-workflow": "^1.115.0"
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"@google/genai": "^1.28.0",
|
|
74
75
|
"@letta-ai/vercel-ai-sdk-provider": "^1.3.0",
|
|
75
76
|
"@openrouter/ai-sdk-provider": "^1.2.0",
|
|
76
|
-
"ai": "^5.0.
|
|
77
|
+
"ai": "^5.0.83",
|
|
77
78
|
"ajv": "^8.17.1",
|
|
78
79
|
"n8n-workflow": "^1.115.0",
|
|
79
80
|
"zod": "^3.25.76"
|