n8n-nodes-tendem 0.1.0
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/LICENSE +21 -0
- package/README.md +268 -0
- package/dist/credentials/TendemApi.credentials.d.ts +10 -0
- package/dist/credentials/TendemApi.credentials.js +61 -0
- package/dist/credentials/TendemApi.credentials.js.map +1 -0
- package/dist/nodes/Tendem/Tendem.node.d.ts +5 -0
- package/dist/nodes/Tendem/Tendem.node.js +211 -0
- package/dist/nodes/Tendem/Tendem.node.js.map +1 -0
- package/dist/nodes/Tendem/Tendem.node.json +18 -0
- package/dist/nodes/Tendem/descriptions.d.ts +9 -0
- package/dist/nodes/Tendem/descriptions.js +320 -0
- package/dist/nodes/Tendem/descriptions.js.map +1 -0
- package/dist/nodes/Tendem/retry.d.ts +18 -0
- package/dist/nodes/Tendem/retry.js +47 -0
- package/dist/nodes/Tendem/retry.js.map +1 -0
- package/dist/nodes/Tendem/tendem.svg +12 -0
- package/dist/nodes/Tendem/tools.d.ts +34 -0
- package/dist/nodes/Tendem/tools.js +80 -0
- package/dist/nodes/Tendem/tools.js.map +1 -0
- package/dist/nodes/Tendem/transport.d.ts +56 -0
- package/dist/nodes/Tendem/transport.js +265 -0
- package/dist/nodes/Tendem/transport.js.map +1 -0
- package/dist/nodes/Tendem/waitForTask.d.ts +33 -0
- package/dist/nodes/Tendem/waitForTask.js +76 -0
- package/dist/nodes/Tendem/waitForTask.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.McpSession = exports.McpSessionExpiredError = exports.McpError = exports.TENDEM_DEFAULT_ENDPOINT = exports.MCP_CLIENT_VERSION = exports.MCP_CLIENT_NAME = exports.MCP_PROTOCOL_VERSION = void 0;
|
|
4
|
+
exports.extractJsonRpcMessage = extractJsonRpcMessage;
|
|
5
|
+
exports.toolResultIsError = toolResultIsError;
|
|
6
|
+
exports.unwrapToolResult = unwrapToolResult;
|
|
7
|
+
exports.MCP_PROTOCOL_VERSION = '2025-06-18';
|
|
8
|
+
exports.MCP_CLIENT_NAME = 'n8n-nodes-tendem';
|
|
9
|
+
exports.MCP_CLIENT_VERSION = '0.1.0';
|
|
10
|
+
exports.TENDEM_DEFAULT_ENDPOINT = 'https://mcp.tendem.ai/mcp?utm_hash=83dad40a52';
|
|
11
|
+
class McpError extends Error {
|
|
12
|
+
constructor(message, code, data, httpStatus) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = 'McpError';
|
|
15
|
+
this.code = code;
|
|
16
|
+
this.data = data;
|
|
17
|
+
this.httpStatus = httpStatus;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.McpError = McpError;
|
|
21
|
+
class McpSessionExpiredError extends McpError {
|
|
22
|
+
constructor() {
|
|
23
|
+
super('The Tendem MCP session expired');
|
|
24
|
+
this.name = 'McpSessionExpiredError';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.McpSessionExpiredError = McpSessionExpiredError;
|
|
28
|
+
function headerValue(headers, name) {
|
|
29
|
+
if (!headers)
|
|
30
|
+
return undefined;
|
|
31
|
+
const wanted = name.toLowerCase();
|
|
32
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
33
|
+
if (key.toLowerCase() !== wanted)
|
|
34
|
+
continue;
|
|
35
|
+
if (Array.isArray(value))
|
|
36
|
+
return value.length > 0 ? String(value[0]) : undefined;
|
|
37
|
+
if (value === undefined || value === null)
|
|
38
|
+
return undefined;
|
|
39
|
+
return String(value);
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
function tryParseJson(text) {
|
|
44
|
+
try {
|
|
45
|
+
return JSON.parse(text);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function extractJsonRpcMessage(body) {
|
|
52
|
+
if (body === undefined || body === null)
|
|
53
|
+
return undefined;
|
|
54
|
+
if (typeof body === 'object')
|
|
55
|
+
return body;
|
|
56
|
+
if (typeof body !== 'string')
|
|
57
|
+
return undefined;
|
|
58
|
+
const text = body.trim();
|
|
59
|
+
if (text === '')
|
|
60
|
+
return undefined;
|
|
61
|
+
if (text.startsWith('{') || text.startsWith('[')) {
|
|
62
|
+
const parsed = tryParseJson(text);
|
|
63
|
+
if (parsed && typeof parsed === 'object')
|
|
64
|
+
return parsed;
|
|
65
|
+
}
|
|
66
|
+
return extractFromSse(text);
|
|
67
|
+
}
|
|
68
|
+
function extractFromSse(text) {
|
|
69
|
+
let last;
|
|
70
|
+
let buffer = [];
|
|
71
|
+
const flush = () => {
|
|
72
|
+
if (buffer.length === 0)
|
|
73
|
+
return;
|
|
74
|
+
const payload = buffer.join('\n').trim();
|
|
75
|
+
buffer = [];
|
|
76
|
+
if (payload === '' || payload === '[DONE]')
|
|
77
|
+
return;
|
|
78
|
+
const parsed = tryParseJson(payload);
|
|
79
|
+
if (!parsed || typeof parsed !== 'object')
|
|
80
|
+
return;
|
|
81
|
+
const message = parsed;
|
|
82
|
+
if (message.result !== undefined || message.error !== undefined)
|
|
83
|
+
last = message;
|
|
84
|
+
};
|
|
85
|
+
for (const line of text.split(/\r?\n/)) {
|
|
86
|
+
if (line === '') {
|
|
87
|
+
flush();
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (line.startsWith(':'))
|
|
91
|
+
continue;
|
|
92
|
+
const separator = line.indexOf(':');
|
|
93
|
+
const field = separator === -1 ? line : line.slice(0, separator);
|
|
94
|
+
let value = separator === -1 ? '' : line.slice(separator + 1);
|
|
95
|
+
if (value.startsWith(' '))
|
|
96
|
+
value = value.slice(1);
|
|
97
|
+
if (field === 'data')
|
|
98
|
+
buffer.push(value);
|
|
99
|
+
}
|
|
100
|
+
flush();
|
|
101
|
+
return last;
|
|
102
|
+
}
|
|
103
|
+
function collectText(content) {
|
|
104
|
+
if (!Array.isArray(content))
|
|
105
|
+
return '';
|
|
106
|
+
const parts = [];
|
|
107
|
+
for (const entry of content) {
|
|
108
|
+
if (!entry || typeof entry !== 'object')
|
|
109
|
+
continue;
|
|
110
|
+
const part = entry;
|
|
111
|
+
if (part.type === 'text' && typeof part.text === 'string')
|
|
112
|
+
parts.push(part.text);
|
|
113
|
+
}
|
|
114
|
+
return parts.join('\n').trim();
|
|
115
|
+
}
|
|
116
|
+
function toolResultIsError(result) {
|
|
117
|
+
if (!result || typeof result !== 'object')
|
|
118
|
+
return false;
|
|
119
|
+
return result.isError === true;
|
|
120
|
+
}
|
|
121
|
+
function unwrapToolResult(result) {
|
|
122
|
+
if (!result || typeof result !== 'object' || Array.isArray(result)) {
|
|
123
|
+
return { result: result === undefined ? null : result };
|
|
124
|
+
}
|
|
125
|
+
const envelope = result;
|
|
126
|
+
const structured = envelope.structuredContent;
|
|
127
|
+
if (structured && typeof structured === 'object' && !Array.isArray(structured)) {
|
|
128
|
+
return structured;
|
|
129
|
+
}
|
|
130
|
+
const text = collectText(envelope.content);
|
|
131
|
+
if (text !== '') {
|
|
132
|
+
const parsed = tryParseJson(text);
|
|
133
|
+
if (Array.isArray(parsed))
|
|
134
|
+
return { items: parsed };
|
|
135
|
+
if (parsed && typeof parsed === 'object')
|
|
136
|
+
return parsed;
|
|
137
|
+
return { text };
|
|
138
|
+
}
|
|
139
|
+
return envelope;
|
|
140
|
+
}
|
|
141
|
+
class McpSession {
|
|
142
|
+
constructor(request, options) {
|
|
143
|
+
var _a;
|
|
144
|
+
this.protocolVersion = exports.MCP_PROTOCOL_VERSION;
|
|
145
|
+
this.nextId = 0;
|
|
146
|
+
this.request = request;
|
|
147
|
+
this.endpoint = options.endpoint;
|
|
148
|
+
this.timeoutMs = (_a = options.timeoutMs) !== null && _a !== void 0 ? _a : 120000;
|
|
149
|
+
}
|
|
150
|
+
async callTool(name, args = {}) {
|
|
151
|
+
await this.ensureInitialized();
|
|
152
|
+
const outcome = await this.invokeTool(name, args).then((value) => ({ ok: true, value }), (error) => ({ ok: false, error }));
|
|
153
|
+
if (outcome.ok)
|
|
154
|
+
return outcome.value;
|
|
155
|
+
if (outcome.error instanceof McpSessionExpiredError) {
|
|
156
|
+
this.reset();
|
|
157
|
+
await this.ensureInitialized();
|
|
158
|
+
return await this.invokeTool(name, args);
|
|
159
|
+
}
|
|
160
|
+
throw outcome.error;
|
|
161
|
+
}
|
|
162
|
+
reset() {
|
|
163
|
+
this.sessionId = undefined;
|
|
164
|
+
this.handshake = undefined;
|
|
165
|
+
this.protocolVersion = exports.MCP_PROTOCOL_VERSION;
|
|
166
|
+
}
|
|
167
|
+
async invokeTool(name, args) {
|
|
168
|
+
var _a;
|
|
169
|
+
const result = (_a = (await this.rpc('tools/call', { name, arguments: args }))) !== null && _a !== void 0 ? _a : {};
|
|
170
|
+
if (toolResultIsError(result)) {
|
|
171
|
+
const message = collectText(result.content) || `Tendem tool "${name}" failed`;
|
|
172
|
+
throw new McpError(message);
|
|
173
|
+
}
|
|
174
|
+
return unwrapToolResult(result);
|
|
175
|
+
}
|
|
176
|
+
async ensureInitialized() {
|
|
177
|
+
if (this.handshake === undefined) {
|
|
178
|
+
this.handshake = this.performHandshake().catch((error) => {
|
|
179
|
+
this.handshake = undefined;
|
|
180
|
+
throw error;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
await this.handshake;
|
|
184
|
+
}
|
|
185
|
+
async performHandshake() {
|
|
186
|
+
var _a;
|
|
187
|
+
const response = await this.post({
|
|
188
|
+
jsonrpc: '2.0',
|
|
189
|
+
id: (this.nextId += 1),
|
|
190
|
+
method: 'initialize',
|
|
191
|
+
params: {
|
|
192
|
+
protocolVersion: exports.MCP_PROTOCOL_VERSION,
|
|
193
|
+
capabilities: {},
|
|
194
|
+
clientInfo: { name: exports.MCP_CLIENT_NAME, version: exports.MCP_CLIENT_VERSION },
|
|
195
|
+
},
|
|
196
|
+
}, false);
|
|
197
|
+
const result = (_a = this.handleResponse('initialize', response, false)) !== null && _a !== void 0 ? _a : {};
|
|
198
|
+
const negotiated = result.protocolVersion;
|
|
199
|
+
if (typeof negotiated === 'string' && negotiated !== '')
|
|
200
|
+
this.protocolVersion = negotiated;
|
|
201
|
+
const sessionId = headerValue(response.headers, 'mcp-session-id');
|
|
202
|
+
if (sessionId !== undefined && sessionId !== '')
|
|
203
|
+
this.sessionId = sessionId;
|
|
204
|
+
const ack = await this.post({ jsonrpc: '2.0', method: 'notifications/initialized' }, true);
|
|
205
|
+
this.handleResponse('notifications/initialized', ack, true);
|
|
206
|
+
}
|
|
207
|
+
async rpc(method, params) {
|
|
208
|
+
const response = await this.post({ jsonrpc: '2.0', id: (this.nextId += 1), method, params }, true);
|
|
209
|
+
return this.handleResponse(method, response, false);
|
|
210
|
+
}
|
|
211
|
+
async post(body, includeProtocolVersion) {
|
|
212
|
+
return await this.request({
|
|
213
|
+
method: 'POST',
|
|
214
|
+
url: this.endpoint,
|
|
215
|
+
headers: this.buildHeaders(includeProtocolVersion),
|
|
216
|
+
body,
|
|
217
|
+
json: true,
|
|
218
|
+
returnFullResponse: true,
|
|
219
|
+
ignoreHttpStatusErrors: true,
|
|
220
|
+
timeout: this.timeoutMs,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
buildHeaders(includeProtocolVersion) {
|
|
224
|
+
const headers = {
|
|
225
|
+
'Content-Type': 'application/json',
|
|
226
|
+
Accept: 'application/json, text/event-stream',
|
|
227
|
+
};
|
|
228
|
+
if (this.sessionId !== undefined)
|
|
229
|
+
headers['Mcp-Session-Id'] = this.sessionId;
|
|
230
|
+
if (includeProtocolVersion)
|
|
231
|
+
headers['MCP-Protocol-Version'] = this.protocolVersion;
|
|
232
|
+
return headers;
|
|
233
|
+
}
|
|
234
|
+
handleResponse(method, response, isNotification) {
|
|
235
|
+
var _a, _b, _c, _d;
|
|
236
|
+
const status = response.statusCode;
|
|
237
|
+
if (status === 404 && this.sessionId !== undefined)
|
|
238
|
+
throw new McpSessionExpiredError();
|
|
239
|
+
const message = extractJsonRpcMessage(response.body);
|
|
240
|
+
if (status < 200 || status >= 300) {
|
|
241
|
+
const rpcError = ((_a = message === null || message === void 0 ? void 0 : message.error) !== null && _a !== void 0 ? _a : undefined);
|
|
242
|
+
const detail = rpcError !== undefined
|
|
243
|
+
? String((_b = rpcError.message) !== null && _b !== void 0 ? _b : '')
|
|
244
|
+
: typeof response.body === 'string'
|
|
245
|
+
? response.body.slice(0, 300)
|
|
246
|
+
: '';
|
|
247
|
+
const hint = status === 401 || status === 403
|
|
248
|
+
? ' Check the API key on the Tendem credential (create one at https://agent.tendem.ai/mcp, "Agent builders" tab).'
|
|
249
|
+
: '';
|
|
250
|
+
throw new McpError(`Tendem MCP "${method}" failed (HTTP ${status})${detail !== '' ? `: ${detail}` : ''}.${hint}`, typeof (rpcError === null || rpcError === void 0 ? void 0 : rpcError.code) === 'number' ? rpcError.code : undefined, rpcError === null || rpcError === void 0 ? void 0 : rpcError.data, status);
|
|
251
|
+
}
|
|
252
|
+
if (isNotification)
|
|
253
|
+
return undefined;
|
|
254
|
+
if (message === undefined) {
|
|
255
|
+
throw new McpError(`Tendem MCP returned an empty response for "${method}"`);
|
|
256
|
+
}
|
|
257
|
+
if (message.error !== undefined && message.error !== null) {
|
|
258
|
+
const rpcError = message.error;
|
|
259
|
+
throw new McpError(String((_c = rpcError.message) !== null && _c !== void 0 ? _c : `Tendem MCP "${method}" returned an error`), typeof rpcError.code === 'number' ? rpcError.code : undefined, rpcError.data);
|
|
260
|
+
}
|
|
261
|
+
return ((_d = message.result) !== null && _d !== void 0 ? _d : undefined);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
exports.McpSession = McpSession;
|
|
265
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../nodes/Tendem/transport.ts"],"names":[],"mappings":";;;AAyFA,sDAcC;AA8CD,8CAG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C7D,QAAQ,CAAC,IAAI,CACb,CAAC;QACH,CAAC;QAED,OAAO,CAAC,MAAA,OAAO,CAAC,MAAM,mCAAI,SAAS,CAA4B,CAAC;IACjE,CAAC;CACD;AA9KD,gCA8KC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { IDataObject } from 'n8n-workflow';
|
|
2
|
+
import { type ToolCaller } from './tools';
|
|
3
|
+
export declare const WAITING_NEXT_ACTION = "awaiting_tendem_work";
|
|
4
|
+
export declare const ACTIVE_STATUS = "ACTING";
|
|
5
|
+
export declare const DEFAULT_WAIT_FOR_CHANGE_SECONDS = 30;
|
|
6
|
+
export declare const MIN_WAIT_FOR_CHANGE_SECONDS = 5;
|
|
7
|
+
export declare const MAX_WAIT_FOR_CHANGE_SECONDS = 30;
|
|
8
|
+
export declare const DEFAULT_MAX_ROUNDS = 20;
|
|
9
|
+
export declare const MIN_MAX_ROUNDS = 1;
|
|
10
|
+
export declare const MAX_MAX_ROUNDS = 240;
|
|
11
|
+
export declare const MIN_SERVER_BLOCK_MS = 1000;
|
|
12
|
+
export declare const MAX_BACKOFF_MS = 60000;
|
|
13
|
+
export interface WaitDeps {
|
|
14
|
+
caller: ToolCaller;
|
|
15
|
+
sleep(ms: number): Promise<void>;
|
|
16
|
+
now(): number;
|
|
17
|
+
}
|
|
18
|
+
export interface WaitParams {
|
|
19
|
+
taskId: string;
|
|
20
|
+
waitForChangeSeconds?: number;
|
|
21
|
+
maxRounds?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface WaitResult {
|
|
24
|
+
settled: boolean;
|
|
25
|
+
timedOut: boolean;
|
|
26
|
+
rounds: number;
|
|
27
|
+
status?: string;
|
|
28
|
+
nextAction?: string;
|
|
29
|
+
task: IDataObject;
|
|
30
|
+
}
|
|
31
|
+
export declare function shouldKeepWaiting(task: IDataObject): boolean;
|
|
32
|
+
export declare function backoffMs(task: IDataObject, waitForChangeSeconds: number): number;
|
|
33
|
+
export declare function waitForTaskChange(deps: WaitDeps, params: WaitParams): Promise<WaitResult>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAX_BACKOFF_MS = exports.MIN_SERVER_BLOCK_MS = exports.MAX_MAX_ROUNDS = exports.MIN_MAX_ROUNDS = exports.DEFAULT_MAX_ROUNDS = exports.MAX_WAIT_FOR_CHANGE_SECONDS = exports.MIN_WAIT_FOR_CHANGE_SECONDS = exports.DEFAULT_WAIT_FOR_CHANGE_SECONDS = exports.ACTIVE_STATUS = exports.WAITING_NEXT_ACTION = void 0;
|
|
4
|
+
exports.shouldKeepWaiting = shouldKeepWaiting;
|
|
5
|
+
exports.backoffMs = backoffMs;
|
|
6
|
+
exports.waitForTaskChange = waitForTaskChange;
|
|
7
|
+
const tools_1 = require("./tools");
|
|
8
|
+
exports.WAITING_NEXT_ACTION = 'awaiting_tendem_work';
|
|
9
|
+
exports.ACTIVE_STATUS = 'ACTING';
|
|
10
|
+
exports.DEFAULT_WAIT_FOR_CHANGE_SECONDS = 30;
|
|
11
|
+
exports.MIN_WAIT_FOR_CHANGE_SECONDS = 5;
|
|
12
|
+
exports.MAX_WAIT_FOR_CHANGE_SECONDS = 30;
|
|
13
|
+
exports.DEFAULT_MAX_ROUNDS = 20;
|
|
14
|
+
exports.MIN_MAX_ROUNDS = 1;
|
|
15
|
+
exports.MAX_MAX_ROUNDS = 240;
|
|
16
|
+
exports.MIN_SERVER_BLOCK_MS = 1000;
|
|
17
|
+
exports.MAX_BACKOFF_MS = 60000;
|
|
18
|
+
function clamp(value, min, max) {
|
|
19
|
+
if (!Number.isFinite(value))
|
|
20
|
+
return min;
|
|
21
|
+
return Math.min(Math.max(value, min), max);
|
|
22
|
+
}
|
|
23
|
+
function readStatus(task) {
|
|
24
|
+
return typeof task.status === 'string' ? task.status.trim().toUpperCase() : '';
|
|
25
|
+
}
|
|
26
|
+
function readNextAction(task) {
|
|
27
|
+
return typeof task.next_action === 'string' ? task.next_action.trim().toLowerCase() : '';
|
|
28
|
+
}
|
|
29
|
+
function shouldKeepWaiting(task) {
|
|
30
|
+
const nextAction = readNextAction(task);
|
|
31
|
+
if (nextAction !== '')
|
|
32
|
+
return nextAction === exports.WAITING_NEXT_ACTION;
|
|
33
|
+
return readStatus(task) === exports.ACTIVE_STATUS;
|
|
34
|
+
}
|
|
35
|
+
function backoffMs(task, waitForChangeSeconds) {
|
|
36
|
+
const hint = task.poll_after_seconds;
|
|
37
|
+
const seconds = typeof hint === 'number' && Number.isFinite(hint) && hint > 0 ? hint : waitForChangeSeconds;
|
|
38
|
+
return clamp(Math.round(seconds * 1000), exports.MIN_SERVER_BLOCK_MS, exports.MAX_BACKOFF_MS);
|
|
39
|
+
}
|
|
40
|
+
async function waitForTaskChange(deps, params) {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
const waitForChangeSeconds = Math.round(clamp((_a = params.waitForChangeSeconds) !== null && _a !== void 0 ? _a : exports.DEFAULT_WAIT_FOR_CHANGE_SECONDS, exports.MIN_WAIT_FOR_CHANGE_SECONDS, exports.MAX_WAIT_FOR_CHANGE_SECONDS));
|
|
43
|
+
const maxRounds = Math.trunc(clamp((_b = params.maxRounds) !== null && _b !== void 0 ? _b : exports.DEFAULT_MAX_ROUNDS, exports.MIN_MAX_ROUNDS, exports.MAX_MAX_ROUNDS));
|
|
44
|
+
let task = {};
|
|
45
|
+
let rounds = 0;
|
|
46
|
+
while (rounds < maxRounds) {
|
|
47
|
+
rounds += 1;
|
|
48
|
+
const startedAt = deps.now();
|
|
49
|
+
task = await deps.caller.callTool(tools_1.TENDEM_TOOLS.GET_TASK, {
|
|
50
|
+
task_id: params.taskId,
|
|
51
|
+
wait_for_change_seconds: waitForChangeSeconds,
|
|
52
|
+
});
|
|
53
|
+
if (!shouldKeepWaiting(task)) {
|
|
54
|
+
return buildResult(true, false, rounds, task);
|
|
55
|
+
}
|
|
56
|
+
if (rounds >= maxRounds)
|
|
57
|
+
break;
|
|
58
|
+
if (deps.now() - startedAt < exports.MIN_SERVER_BLOCK_MS) {
|
|
59
|
+
await deps.sleep(backoffMs(task, waitForChangeSeconds));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return buildResult(false, true, rounds, task);
|
|
63
|
+
}
|
|
64
|
+
function buildResult(settled, timedOut, rounds, task) {
|
|
65
|
+
const status = readStatus(task);
|
|
66
|
+
const nextAction = readNextAction(task);
|
|
67
|
+
return {
|
|
68
|
+
settled,
|
|
69
|
+
timedOut,
|
|
70
|
+
rounds,
|
|
71
|
+
status: status === '' ? undefined : status,
|
|
72
|
+
nextAction: nextAction === '' ? undefined : nextAction,
|
|
73
|
+
task,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=waitForTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"waitForTask.js","sourceRoot":"","sources":["../../../nodes/Tendem/waitForTask.ts"],"names":[],"mappings":";;;AA+EA,8CAIC;AAGD,8BAKC;AAED,8CAoCC;AA/HD,mCAAwD;AAiB3C,QAAA,mBAAmB,GAAG,sBAAsB,CAAC;AAG7C,QAAA,aAAa,GAAG,QAAQ,CAAC;AAGzB,QAAA,+BAA+B,GAAG,EAAE,CAAC;AACrC,QAAA,2BAA2B,GAAG,CAAC,CAAC;AAChC,QAAA,2BAA2B,GAAG,EAAE,CAAC;AAEjC,QAAA,kBAAkB,GAAG,EAAE,CAAC;AACxB,QAAA,cAAc,GAAG,CAAC,CAAC;AACnB,QAAA,cAAc,GAAG,GAAG,CAAC;AAGrB,QAAA,mBAAmB,GAAG,IAAK,CAAC;AAC5B,QAAA,cAAc,GAAG,KAAM,CAAC;AAyBrC,SAAS,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IACrD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC;IACxC,OAAO,IAAI,CAAC,GAAG,CAAC,IA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;IACxC,OAAO;QACN,OAAO;QACP,QAAQ;QACR,MAAM;QACN,MAAM,EAAE,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;QAC1C,UAAU,EAAE,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU;QACtD,IAAI;KACJ,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-tendem",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Delegate tasks to vetted human experts with Tendem — create a task, read the priced contract, approve the spend, poll, and fetch the result.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://tendem.ai",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"n8n-community-node-package",
|
|
9
|
+
"n8n",
|
|
10
|
+
"tendem",
|
|
11
|
+
"human-in-the-loop",
|
|
12
|
+
"human-experts",
|
|
13
|
+
"outsourcing",
|
|
14
|
+
"mcp"
|
|
15
|
+
],
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "Toloka AI BV",
|
|
18
|
+
"email": "support@tendem.ai",
|
|
19
|
+
"url": "https://tendem.ai"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/Toloka/tendem-mcp.git",
|
|
24
|
+
"directory": "integrations/n8n-nodes-tendem"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/Toloka/tendem-mcp/issues"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=20.19"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"clean": "node scripts/clean.mjs",
|
|
34
|
+
"build": "tsc && node scripts/copy-assets.mjs",
|
|
35
|
+
"build:watch": "tsc --watch",
|
|
36
|
+
"dev": "n8n-node dev",
|
|
37
|
+
"lint": "n8n-node lint",
|
|
38
|
+
"lint:fix": "n8n-node lint --fix",
|
|
39
|
+
"scan": "npx -y @n8n/scan-community-package n8n-nodes-tendem",
|
|
40
|
+
"test": "npm run build && node scripts/test.mjs",
|
|
41
|
+
"prepublishOnly": "npm run build && npm run test"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist"
|
|
45
|
+
],
|
|
46
|
+
"n8n": {
|
|
47
|
+
"n8nNodesApiVersion": 1,
|
|
48
|
+
"strict": true,
|
|
49
|
+
"credentials": [
|
|
50
|
+
"dist/credentials/TendemApi.credentials.js"
|
|
51
|
+
],
|
|
52
|
+
"nodes": [
|
|
53
|
+
"dist/nodes/Tendem/Tendem.node.js"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@n8n/node-cli": "^0.42.1",
|
|
58
|
+
"@types/node": "^20.19.0",
|
|
59
|
+
"n8n-workflow": "^2.16.0",
|
|
60
|
+
"typescript": "^5.9.3"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"n8n-workflow": "*"
|
|
64
|
+
}
|
|
65
|
+
}
|