n8n-nodes-opencode-ai 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.
Files changed (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +190 -0
  3. package/dist/assets/opencode.svg +6 -0
  4. package/dist/credentials/OpenCodeApi.credentials.d.ts +8 -0
  5. package/dist/credentials/OpenCodeApi.credentials.js +50 -0
  6. package/dist/credentials/OpenCodeApi.credentials.js.map +1 -0
  7. package/dist/nodes/OpenCode/OpenCode.node.d.ts +13 -0
  8. package/dist/nodes/OpenCode/OpenCode.node.js +787 -0
  9. package/dist/nodes/OpenCode/OpenCode.node.js.map +1 -0
  10. package/dist/nodes/OpenCode/actions/config/getProviders.d.ts +2 -0
  11. package/dist/nodes/OpenCode/actions/config/getProviders.js +19 -0
  12. package/dist/nodes/OpenCode/actions/config/getProviders.js.map +1 -0
  13. package/dist/nodes/OpenCode/actions/config/index.d.ts +4 -0
  14. package/dist/nodes/OpenCode/actions/config/index.js +15 -0
  15. package/dist/nodes/OpenCode/actions/config/index.js.map +1 -0
  16. package/dist/nodes/OpenCode/actions/index.d.ts +5 -0
  17. package/dist/nodes/OpenCode/actions/index.js +26 -0
  18. package/dist/nodes/OpenCode/actions/index.js.map +1 -0
  19. package/dist/nodes/OpenCode/actions/message/command.d.ts +2 -0
  20. package/dist/nodes/OpenCode/actions/message/command.js +102 -0
  21. package/dist/nodes/OpenCode/actions/message/command.js.map +1 -0
  22. package/dist/nodes/OpenCode/actions/message/getMessage.d.ts +2 -0
  23. package/dist/nodes/OpenCode/actions/message/getMessage.js +21 -0
  24. package/dist/nodes/OpenCode/actions/message/getMessage.js.map +1 -0
  25. package/dist/nodes/OpenCode/actions/message/index.d.ts +9 -0
  26. package/dist/nodes/OpenCode/actions/message/index.js +35 -0
  27. package/dist/nodes/OpenCode/actions/message/index.js.map +1 -0
  28. package/dist/nodes/OpenCode/actions/message/list.d.ts +2 -0
  29. package/dist/nodes/OpenCode/actions/message/list.js +37 -0
  30. package/dist/nodes/OpenCode/actions/message/list.js.map +1 -0
  31. package/dist/nodes/OpenCode/actions/message/send.d.ts +2 -0
  32. package/dist/nodes/OpenCode/actions/message/send.js +124 -0
  33. package/dist/nodes/OpenCode/actions/message/send.js.map +1 -0
  34. package/dist/nodes/OpenCode/actions/message/sendAsync.d.ts +2 -0
  35. package/dist/nodes/OpenCode/actions/message/sendAsync.js +88 -0
  36. package/dist/nodes/OpenCode/actions/message/sendAsync.js.map +1 -0
  37. package/dist/nodes/OpenCode/actions/message/shell.d.ts +2 -0
  38. package/dist/nodes/OpenCode/actions/message/shell.js +102 -0
  39. package/dist/nodes/OpenCode/actions/message/shell.js.map +1 -0
  40. package/dist/nodes/OpenCode/actions/session/abort.d.ts +2 -0
  41. package/dist/nodes/OpenCode/actions/session/abort.js +24 -0
  42. package/dist/nodes/OpenCode/actions/session/abort.js.map +1 -0
  43. package/dist/nodes/OpenCode/actions/session/create.d.ts +2 -0
  44. package/dist/nodes/OpenCode/actions/session/create.js +21 -0
  45. package/dist/nodes/OpenCode/actions/session/create.js.map +1 -0
  46. package/dist/nodes/OpenCode/actions/session/delete.d.ts +2 -0
  47. package/dist/nodes/OpenCode/actions/session/delete.js +24 -0
  48. package/dist/nodes/OpenCode/actions/session/delete.js.map +1 -0
  49. package/dist/nodes/OpenCode/actions/session/get.d.ts +2 -0
  50. package/dist/nodes/OpenCode/actions/session/get.js +20 -0
  51. package/dist/nodes/OpenCode/actions/session/get.js.map +1 -0
  52. package/dist/nodes/OpenCode/actions/session/index.d.ts +9 -0
  53. package/dist/nodes/OpenCode/actions/session/index.js +35 -0
  54. package/dist/nodes/OpenCode/actions/session/index.js.map +1 -0
  55. package/dist/nodes/OpenCode/actions/session/list.d.ts +2 -0
  56. package/dist/nodes/OpenCode/actions/session/list.js +18 -0
  57. package/dist/nodes/OpenCode/actions/session/list.js.map +1 -0
  58. package/dist/nodes/OpenCode/actions/session/status.d.ts +2 -0
  59. package/dist/nodes/OpenCode/actions/session/status.js +19 -0
  60. package/dist/nodes/OpenCode/actions/session/status.js.map +1 -0
  61. package/dist/nodes/OpenCode/helpers/api.d.ts +13 -0
  62. package/dist/nodes/OpenCode/helpers/api.js +62 -0
  63. package/dist/nodes/OpenCode/helpers/api.js.map +1 -0
  64. package/dist/nodes/OpenCode/opencode.svg +6 -0
  65. package/dist/nodes/OpenCode/types/index.d.ts +100 -0
  66. package/dist/nodes/OpenCode/types/index.js +3 -0
  67. package/dist/nodes/OpenCode/types/index.js.map +1 -0
  68. package/dist/nodes/OpenCodeChatModel/ChatOpenCode.d.ts +57 -0
  69. package/dist/nodes/OpenCodeChatModel/ChatOpenCode.js +270 -0
  70. package/dist/nodes/OpenCodeChatModel/ChatOpenCode.js.map +1 -0
  71. package/dist/nodes/OpenCodeChatModel/OpenCodeChatModel.node.d.ts +11 -0
  72. package/dist/nodes/OpenCodeChatModel/OpenCodeChatModel.node.js +217 -0
  73. package/dist/nodes/OpenCodeChatModel/OpenCodeChatModel.node.js.map +1 -0
  74. package/dist/nodes/OpenCodeChatModel/opencode.svg +6 -0
  75. package/dist/nodes/OpenCodeTool/OpenCodeTool.node.d.ts +11 -0
  76. package/dist/nodes/OpenCodeTool/OpenCodeTool.node.js +319 -0
  77. package/dist/nodes/OpenCodeTool/OpenCodeTool.node.js.map +1 -0
  78. package/dist/nodes/OpenCodeTool/opencode.svg +6 -0
  79. package/package.json +67 -0
@@ -0,0 +1,319 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenCodeTool = void 0;
4
+ const tools_1 = require("@langchain/core/tools");
5
+ const zod_1 = require("zod");
6
+ class OpenCodeTool {
7
+ constructor() {
8
+ this.description = {
9
+ displayName: 'OpenCode Tool',
10
+ name: 'openCodeTool',
11
+ icon: 'file:opencode.svg',
12
+ group: ['transform'],
13
+ version: 1,
14
+ description: 'Use OpenCode AI coding assistant as a tool for AI agents',
15
+ defaults: {
16
+ name: 'OpenCode Tool',
17
+ },
18
+ codex: {
19
+ categories: ['AI'],
20
+ subcategories: {
21
+ AI: ['Tools'],
22
+ },
23
+ resources: {
24
+ primaryDocumentation: [
25
+ {
26
+ url: 'https://opencode.ai/docs/server/',
27
+ },
28
+ ],
29
+ },
30
+ },
31
+ // eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
32
+ inputs: [],
33
+ // eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
34
+ outputs: ['ai_tool'],
35
+ outputNames: ['Tool'],
36
+ credentials: [
37
+ {
38
+ name: 'openCodeApi',
39
+ required: true,
40
+ },
41
+ ],
42
+ properties: [
43
+ {
44
+ displayName: 'Session Mode',
45
+ name: 'sessionMode',
46
+ type: 'options',
47
+ options: [
48
+ {
49
+ name: 'Use Existing Session',
50
+ value: 'existing',
51
+ description: 'Use an existing session for conversations',
52
+ },
53
+ {
54
+ name: 'Temporary Session',
55
+ value: 'temporary',
56
+ description: 'Create a new session for each request and delete it after response',
57
+ },
58
+ ],
59
+ default: 'existing',
60
+ description: 'Choose how to handle sessions',
61
+ },
62
+ {
63
+ displayName: 'Session',
64
+ name: 'sessionId',
65
+ type: 'options',
66
+ typeOptions: {
67
+ loadOptionsMethod: 'getSessions',
68
+ },
69
+ required: true,
70
+ displayOptions: {
71
+ show: {
72
+ sessionMode: ['existing'],
73
+ },
74
+ },
75
+ default: '',
76
+ description: 'Select a session for the AI tool to use',
77
+ },
78
+ {
79
+ displayName: 'Temporary Session Title',
80
+ name: 'tempSessionTitle',
81
+ type: 'string',
82
+ displayOptions: {
83
+ show: {
84
+ sessionMode: ['temporary'],
85
+ },
86
+ },
87
+ default: 'Temporary Tool Session',
88
+ description: 'Title for temporary sessions (for debugging purposes)',
89
+ },
90
+ {
91
+ displayName: 'Model',
92
+ name: 'model',
93
+ type: 'options',
94
+ typeOptions: {
95
+ loadOptionsMethod: 'getModels',
96
+ },
97
+ default: '',
98
+ description: 'Select a model (optional, uses default if not specified)',
99
+ },
100
+ {
101
+ displayName: 'Tool Name',
102
+ name: 'toolName',
103
+ type: 'string',
104
+ default: 'opencode',
105
+ description: 'The name of the tool that will be used by the AI agent',
106
+ },
107
+ {
108
+ displayName: 'Tool Description',
109
+ name: 'toolDescription',
110
+ type: 'string',
111
+ default: 'Use this tool to interact with OpenCode AI coding assistant. Send coding questions, code review requests, or programming tasks.',
112
+ description: 'Description of the tool that will be shown to the AI agent',
113
+ typeOptions: {
114
+ rows: 3,
115
+ },
116
+ },
117
+ {
118
+ displayName: 'Options',
119
+ name: 'options',
120
+ type: 'collection',
121
+ placeholder: 'Add Option',
122
+ default: {},
123
+ options: [
124
+ {
125
+ displayName: 'Timeout (ms)',
126
+ name: 'timeout',
127
+ type: 'number',
128
+ default: 300000,
129
+ description: 'Request timeout in milliseconds (default: 300000 = 5 minutes)',
130
+ },
131
+ ],
132
+ },
133
+ ],
134
+ };
135
+ this.methods = {
136
+ loadOptions: {
137
+ async getSessions() {
138
+ try {
139
+ const credentials = await this.getCredentials('openCodeApi');
140
+ const baseUrl = credentials.baseUrl;
141
+ const response = await this.helpers.request({
142
+ method: 'GET',
143
+ url: `${baseUrl}/session`,
144
+ auth: {
145
+ user: credentials.username,
146
+ pass: credentials.password,
147
+ },
148
+ json: true,
149
+ });
150
+ const sessions = (Array.isArray(response) ? response : [response]);
151
+ return sessions.map((session) => ({
152
+ name: session.title || `Session ${session.id.substring(0, 8)}...`,
153
+ value: session.id,
154
+ description: `ID: ${session.id}`,
155
+ }));
156
+ }
157
+ catch (error) {
158
+ console.error('Error loading sessions:', error);
159
+ return [{ name: 'Error loading sessions', value: '' }];
160
+ }
161
+ },
162
+ async getModels() {
163
+ try {
164
+ const credentials = await this.getCredentials('openCodeApi');
165
+ const baseUrl = credentials.baseUrl;
166
+ const response = await this.helpers.request({
167
+ method: 'GET',
168
+ url: `${baseUrl}/config/providers`,
169
+ auth: {
170
+ user: credentials.username,
171
+ pass: credentials.password,
172
+ },
173
+ json: true,
174
+ });
175
+ const options = [
176
+ { name: '(Default)', value: '' },
177
+ ];
178
+ const providers = (response.providers || []);
179
+ for (const provider of providers) {
180
+ if (provider.models && typeof provider.models === 'object') {
181
+ const modelList = Object.values(provider.models);
182
+ for (const model of modelList) {
183
+ options.push({
184
+ name: `${provider.name || provider.id}: ${model.name || model.id}`,
185
+ value: `${provider.id}::${model.id}`,
186
+ description: `Provider: ${provider.id}`,
187
+ });
188
+ }
189
+ }
190
+ }
191
+ return options;
192
+ }
193
+ catch (error) {
194
+ console.error('Error loading models:', error);
195
+ return [{ name: '(Default)', value: '' }];
196
+ }
197
+ },
198
+ },
199
+ };
200
+ }
201
+ async supplyData(itemIndex) {
202
+ var _a;
203
+ const credentials = await this.getCredentials('openCodeApi');
204
+ const sessionMode = this.getNodeParameter('sessionMode', itemIndex);
205
+ const model = this.getNodeParameter('model', itemIndex, '');
206
+ const toolName = this.getNodeParameter('toolName', itemIndex);
207
+ const toolDescription = this.getNodeParameter('toolDescription', itemIndex);
208
+ const options = this.getNodeParameter('options', itemIndex, {});
209
+ const timeout = (_a = options.timeout) !== null && _a !== void 0 ? _a : 300000;
210
+ // Determine session configuration based on mode
211
+ const useTemporarySession = sessionMode === 'temporary';
212
+ let existingSessionId;
213
+ let tempSessionTitle;
214
+ if (useTemporarySession) {
215
+ tempSessionTitle = this.getNodeParameter('tempSessionTitle', itemIndex, 'Temporary Tool Session');
216
+ }
217
+ else {
218
+ existingSessionId = this.getNodeParameter('sessionId', itemIndex);
219
+ }
220
+ // Helper functions for session management
221
+ const createSession = async (title) => {
222
+ const requestOptions = {
223
+ method: 'POST',
224
+ url: `${credentials.baseUrl}/session`,
225
+ headers: {
226
+ 'Content-Type': 'application/json',
227
+ },
228
+ body: { title },
229
+ json: true,
230
+ auth: {
231
+ username: credentials.username,
232
+ password: credentials.password,
233
+ },
234
+ };
235
+ const response = await this.helpers.httpRequest(requestOptions);
236
+ return response.id;
237
+ };
238
+ const deleteSession = async (sessionId) => {
239
+ try {
240
+ const requestOptions = {
241
+ method: 'DELETE',
242
+ url: `${credentials.baseUrl}/session/${sessionId}`,
243
+ auth: {
244
+ username: credentials.username,
245
+ password: credentials.password,
246
+ },
247
+ };
248
+ await this.helpers.httpRequest(requestOptions);
249
+ }
250
+ catch (error) {
251
+ console.error(`Failed to delete session ${sessionId}:`, error);
252
+ }
253
+ };
254
+ const sendMessage = async (message) => {
255
+ let sessionId;
256
+ let shouldDeleteSession = false;
257
+ // Create temporary session if needed
258
+ if (useTemporarySession) {
259
+ sessionId = await createSession(tempSessionTitle || 'Temporary Tool Session');
260
+ shouldDeleteSession = true;
261
+ }
262
+ else {
263
+ sessionId = existingSessionId;
264
+ }
265
+ try {
266
+ const payload = {
267
+ parts: [{ type: 'text', text: message }],
268
+ };
269
+ // model format: "providerID::modelID"
270
+ if (model && model.includes('::')) {
271
+ const [providerID, modelID] = model.split('::');
272
+ payload.model = { providerID, modelID };
273
+ }
274
+ const requestOptions = {
275
+ method: 'POST',
276
+ url: `${credentials.baseUrl}/session/${sessionId}/message`,
277
+ headers: {
278
+ 'Content-Type': 'application/json',
279
+ },
280
+ body: payload,
281
+ json: true,
282
+ timeout,
283
+ auth: {
284
+ username: credentials.username,
285
+ password: credentials.password,
286
+ },
287
+ };
288
+ const response = await this.helpers.httpRequest(requestOptions);
289
+ const responseText = (response.parts || [])
290
+ .filter((p) => p.type === 'text')
291
+ .map((p) => p.text || '')
292
+ .join('\n')
293
+ .trim();
294
+ return responseText;
295
+ }
296
+ finally {
297
+ // Delete temporary session after use
298
+ if (shouldDeleteSession) {
299
+ await deleteSession(sessionId);
300
+ }
301
+ }
302
+ };
303
+ const tool = new tools_1.DynamicStructuredTool({
304
+ name: toolName,
305
+ description: toolDescription,
306
+ schema: zod_1.z.object({
307
+ message: zod_1.z.string().describe('The message or question to send to OpenCode AI'),
308
+ }),
309
+ func: async ({ message }) => {
310
+ return await sendMessage(message);
311
+ },
312
+ });
313
+ return {
314
+ response: tool,
315
+ };
316
+ }
317
+ }
318
+ exports.OpenCodeTool = OpenCodeTool;
319
+ //# sourceMappingURL=OpenCodeTool.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenCodeTool.node.js","sourceRoot":"","sources":["../../../src/nodes/OpenCodeTool/OpenCodeTool.node.ts"],"names":[],"mappings":";;;AAUA,iDAA8D;AAC9D,6BAAwB;AA4CxB,MAAa,YAAY;IAAzB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,eAAe;YAC5B,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,0DAA0D;YACvE,QAAQ,EAAE;gBACT,IAAI,EAAE,eAAe;aACrB;YACD,KAAK,EAAE;gBACN,UAAU,EAAE,CAAC,IAAI,CAAC;gBAClB,aAAa,EAAE;oBACd,EAAE,EAAE,CAAC,OAAO,CAAC;iBACb;gBACD,SAAS,EAAE;oBACV,oBAAoB,EAAE;wBACrB;4BACC,GAAG,EAAE,kCAAkC;yBACvC;qBACD;iBACD;aACD;YACD,2FAA2F;YAC3F,MAAM,EAAE,EAAE;YACV,+EAA+E;YAC/E,OAAO,EAAE,CAAC,SAAS,CAAC;YACpB,WAAW,EAAE,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,cAAc;oBAC3B,IAAI,EAAE,aAAa;oBACnB,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,sBAAsB;4BAC5B,KAAK,EAAE,UAAU;4BACjB,WAAW,EAAE,2CAA2C;yBACxD;wBACD;4BACC,IAAI,EAAE,mBAAmB;4BACzB,KAAK,EAAE,WAAW;4BAClB,WAAW,EAAE,oEAAoE;yBACjF;qBACD;oBACD,OAAO,EAAE,UAAU;oBACnB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AAC,CAAe,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;qBAC9C,GAAG,CAAC,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;qBACtC,IAAI,CAAC,IAAI,CAAC;qBACV,IAAI,EAAE,CAAC;gBAET,OAAO,YAAY,CAAC;YACrB,CAAC;oBAAS,CAAC;gBACV,qCAAqC;gBACrC,IAAI,mBAAmB,EAAE,CAAC;oBACzB,MAAM,aAAa,CAAC,SAAS,CAAC,CAAC;gBAChC,CAAC;YACF,CAAC;QACF,CAAC,CAAC;QAEF,MAAM,IAAI,GAAG,IAAI,6BAAqB,CAAC;YACtC,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,eAAe;YAC5B,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;gBAChB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;aAC9E,CAAC;YACF,IAAI,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;gBAC3B,OAAO,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;YACnC,CAAC;SACD,CAAC,CAAC;QAEH,OAAO;YACN,QAAQ,EAAE,IAAI;SACd,CAAC;IACH,CAAC;CACD;AAxUD,oCAwUC"}
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" fill="none">
2
+ <rect width="60" height="60" rx="8" fill="#1a1a2e"/>
3
+ <path d="M20 22L12 30L20 38" stroke="#00d9ff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M40 22L48 30L40 38" stroke="#00d9ff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M35 16L25 44" stroke="#ff6b6b" stroke-width="3" stroke-linecap="round"/>
6
+ </svg>
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "n8n-nodes-opencode-ai",
3
+ "version": "0.1.0",
4
+ "description": "n8n node for OpenCode Server API - Session and message management for AI coding assistant",
5
+ "keywords": [
6
+ "n8n-community-node-package",
7
+ "opencode",
8
+ "ai",
9
+ "coding",
10
+ "session",
11
+ "automation"
12
+ ],
13
+ "license": "MIT",
14
+ "author": {
15
+ "name": "Dante Labs",
16
+ "email": "datapod.k@gmail.com"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/dandacompany/n8n-nodes-opencode-ai.git"
21
+ },
22
+ "main": "index.js",
23
+ "scripts": {
24
+ "build": "tsc && gulp build:icons",
25
+ "dev": "tsc --watch",
26
+ "clean": "rimraf dist",
27
+ "lint": "eslint src --ext .ts",
28
+ "lint:fix": "eslint src --ext .ts --fix",
29
+ "prepublishOnly": "npm run build",
30
+ "link-dev": "npm run build && mkdir -p /tmp/n8n-dev-opencode/custom && ln -sf $(pwd) /tmp/n8n-dev-opencode/custom/n8n-nodes-opencode-ai"
31
+ },
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "n8n": {
36
+ "n8nNodesApiVersion": 1,
37
+ "credentials": [
38
+ "dist/credentials/OpenCodeApi.credentials.js"
39
+ ],
40
+ "nodes": [
41
+ "dist/nodes/OpenCode/OpenCode.node.js",
42
+ "dist/nodes/OpenCodeTool/OpenCodeTool.node.js",
43
+ "dist/nodes/OpenCodeChatModel/OpenCodeChatModel.node.js"
44
+ ]
45
+ },
46
+ "dependencies": {
47
+ "@langchain/core": "^0.3.0",
48
+ "zod": "^3.23.0"
49
+ },
50
+ "devDependencies": {
51
+ "@types/node": "^20.0.0",
52
+ "@typescript-eslint/eslint-plugin": "^7.0.0",
53
+ "@typescript-eslint/parser": "^7.0.0",
54
+ "eslint": "^8.57.0",
55
+ "eslint-plugin-n8n-nodes-base": "^1.16.1",
56
+ "gulp": "^4.0.2",
57
+ "n8n-workflow": "^1.82.0",
58
+ "rimraf": "^5.0.5",
59
+ "typescript": "~5.4.0"
60
+ },
61
+ "peerDependencies": {
62
+ "n8n-workflow": "^1.0.0"
63
+ },
64
+ "engines": {
65
+ "node": ">=18.0.0"
66
+ }
67
+ }