n8n-nodes-github-copilot-agent-tool 0.1.1

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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -0
  3. package/dist/credentials/GitHubCopilotApi.credentials.d.ts +10 -0
  4. package/dist/credentials/GitHubCopilotApi.credentials.js +69 -0
  5. package/dist/credentials/GitHubCopilotApi.credentials.js.map +1 -0
  6. package/dist/credentials/gitHubCopilotApi.svg +12 -0
  7. package/dist/nodes/GitHubCopilotAgentTool/GitHubCopilotAgentTool.node.d.ts +5 -0
  8. package/dist/nodes/GitHubCopilotAgentTool/GitHubCopilotAgentTool.node.js +196 -0
  9. package/dist/nodes/GitHubCopilotAgentTool/GitHubCopilotAgentTool.node.js.map +1 -0
  10. package/dist/nodes/GitHubCopilotAgentTool/GitHubCopilotAgentTool.node.json +16 -0
  11. package/dist/nodes/GitHubCopilotAgentTool/gitHubCopilotAgentTool.dark.svg +12 -0
  12. package/dist/nodes/GitHubCopilotAgentTool/gitHubCopilotAgentTool.svg +12 -0
  13. package/dist/nodes/GitHubCopilotAuthHelper/GitHubCopilotAuthHelper.node.d.ts +5 -0
  14. package/dist/nodes/GitHubCopilotAuthHelper/GitHubCopilotAuthHelper.node.js +194 -0
  15. package/dist/nodes/GitHubCopilotAuthHelper/GitHubCopilotAuthHelper.node.js.map +1 -0
  16. package/dist/nodes/GitHubCopilotAuthHelper/GitHubCopilotAuthHelper.node.json +13 -0
  17. package/dist/nodes/GitHubCopilotAuthHelper/gitHubCopilotAuthHelper.dark.svg +12 -0
  18. package/dist/nodes/GitHubCopilotAuthHelper/gitHubCopilotAuthHelper.svg +12 -0
  19. package/dist/nodes/GitHubCopilotChatApi/GitHubCopilotChatApi.node.d.ts +5 -0
  20. package/dist/nodes/GitHubCopilotChatApi/GitHubCopilotChatApi.node.js +181 -0
  21. package/dist/nodes/GitHubCopilotChatApi/GitHubCopilotChatApi.node.js.map +1 -0
  22. package/dist/nodes/GitHubCopilotChatApi/GitHubCopilotChatApi.node.json +13 -0
  23. package/dist/nodes/GitHubCopilotChatApi/gitHubCopilotChatApi.dark.svg +12 -0
  24. package/dist/nodes/GitHubCopilotChatApi/gitHubCopilotChatApi.svg +12 -0
  25. package/dist/nodes/GitHubCopilotChatModel/GitHubCopilotChatModel.node.d.ts +5 -0
  26. package/dist/nodes/GitHubCopilotChatModel/GitHubCopilotChatModel.node.js +188 -0
  27. package/dist/nodes/GitHubCopilotChatModel/GitHubCopilotChatModel.node.js.map +1 -0
  28. package/dist/nodes/GitHubCopilotChatModel/GitHubCopilotChatModel.node.json +16 -0
  29. package/dist/nodes/GitHubCopilotChatModel/gitHubCopilotChatModel.dark.svg +12 -0
  30. package/dist/nodes/GitHubCopilotChatModel/gitHubCopilotChatModel.svg +12 -0
  31. package/dist/nodes/GitHubCopilotCli/GitHubCopilotCli.node.d.ts +5 -0
  32. package/dist/nodes/GitHubCopilotCli/GitHubCopilotCli.node.js +159 -0
  33. package/dist/nodes/GitHubCopilotCli/GitHubCopilotCli.node.js.map +1 -0
  34. package/dist/nodes/GitHubCopilotCli/GitHubCopilotCli.node.json +13 -0
  35. package/dist/nodes/GitHubCopilotCli/gitHubCopilotCli.dark.svg +12 -0
  36. package/dist/nodes/GitHubCopilotCli/gitHubCopilotCli.svg +12 -0
  37. package/dist/nodes/GitHubCopilotEmbeddings/GitHubCopilotEmbeddings.node.d.ts +5 -0
  38. package/dist/nodes/GitHubCopilotEmbeddings/GitHubCopilotEmbeddings.node.js +133 -0
  39. package/dist/nodes/GitHubCopilotEmbeddings/GitHubCopilotEmbeddings.node.js.map +1 -0
  40. package/dist/nodes/GitHubCopilotEmbeddings/GitHubCopilotEmbeddings.node.json +16 -0
  41. package/dist/nodes/GitHubCopilotEmbeddings/gitHubCopilotEmbeddings.dark.svg +12 -0
  42. package/dist/nodes/GitHubCopilotEmbeddings/gitHubCopilotEmbeddings.svg +12 -0
  43. package/dist/nodes/GitHubCopilotOpenAI/GitHubCopilotOpenAI.node.json +13 -0
  44. package/dist/nodes/GitHubCopilotOpenAI/GitHubCopilotOpenAi.node.d.ts +5 -0
  45. package/dist/nodes/GitHubCopilotOpenAI/GitHubCopilotOpenAi.node.js +177 -0
  46. package/dist/nodes/GitHubCopilotOpenAI/GitHubCopilotOpenAi.node.js.map +1 -0
  47. package/dist/nodes/GitHubCopilotOpenAI/gitHubCopilotOpenAI.dark.svg +12 -0
  48. package/dist/nodes/GitHubCopilotOpenAI/gitHubCopilotOpenAI.svg +12 -0
  49. package/dist/nodes/GitHubCopilotTest/GitHubCopilotTest.node.d.ts +5 -0
  50. package/dist/nodes/GitHubCopilotTest/GitHubCopilotTest.node.js +173 -0
  51. package/dist/nodes/GitHubCopilotTest/GitHubCopilotTest.node.js.map +1 -0
  52. package/dist/nodes/GitHubCopilotTest/GitHubCopilotTest.node.json +13 -0
  53. package/dist/nodes/GitHubCopilotTest/gitHubCopilotTest.dark.svg +12 -0
  54. package/dist/nodes/GitHubCopilotTest/gitHubCopilotTest.svg +12 -0
  55. package/dist/nodes/shared/apiClient.d.ts +11 -0
  56. package/dist/nodes/shared/apiClient.js +98 -0
  57. package/dist/nodes/shared/apiClient.js.map +1 -0
  58. package/dist/nodes/shared/types.d.ts +144 -0
  59. package/dist/nodes/shared/types.js +44 -0
  60. package/dist/nodes/shared/types.js.map +1 -0
  61. package/dist/package.json +75 -0
  62. package/dist/tsconfig.tsbuildinfo +1 -0
  63. package/package.json +75 -0
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GitHubCopilotChatModel = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const apiClient_1 = require("../shared/apiClient");
6
+ const types_1 = require("../shared/types");
7
+ class GitHubCopilotChatModel {
8
+ constructor() {
9
+ this.description = {
10
+ displayName: 'GitHub Copilot Chat Model',
11
+ name: 'gitHubCopilotChatModel',
12
+ icon: {
13
+ light: 'file:gitHubCopilotChatModel.svg',
14
+ dark: 'file:gitHubCopilotChatModel.dark.svg',
15
+ },
16
+ group: ['transform'],
17
+ version: 1,
18
+ subtitle: '={{ $parameter["model"] }}',
19
+ description: 'Multi-turn AI workflows with full tool and function-calling support via GitHub Copilot.',
20
+ defaults: { name: 'GitHub Copilot Chat Model' },
21
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
22
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
23
+ credentials: [{ name: 'gitHubCopilotApi', required: true }],
24
+ properties: [
25
+ {
26
+ displayName: 'Model',
27
+ name: 'model',
28
+ type: 'options',
29
+ options: types_1.SUPPORTED_MODELS.map((m) => ({ name: m.name, value: m.value })),
30
+ default: 'claude-sonnet-4-5',
31
+ description: 'AI model to use',
32
+ },
33
+ {
34
+ displayName: 'Custom Model ID',
35
+ name: 'customModel',
36
+ type: 'string',
37
+ default: '',
38
+ description: 'Custom model identifier when "Custom (Specify Below)" is selected',
39
+ displayOptions: { show: { model: ['custom'] } },
40
+ },
41
+ {
42
+ displayName: 'System Prompt',
43
+ name: 'systemPrompt',
44
+ type: 'string',
45
+ typeOptions: { rows: 4 },
46
+ default: 'You are a helpful AI assistant with access to tools.',
47
+ description: 'System instructions for the model',
48
+ },
49
+ {
50
+ displayName: 'Conversation History (JSON)',
51
+ name: 'conversationHistory',
52
+ type: 'string',
53
+ typeOptions: { rows: 6 },
54
+ default: '[]',
55
+ description: 'Prior messages as a JSON array of role/content objects. Enables multi-turn chat.',
56
+ },
57
+ {
58
+ displayName: 'User Message',
59
+ name: 'userMessage',
60
+ type: 'string',
61
+ typeOptions: { rows: 5 },
62
+ required: true,
63
+ default: '',
64
+ description: 'The user message for this conversation turn',
65
+ },
66
+ {
67
+ displayName: 'Tools (JSON)',
68
+ name: 'tools',
69
+ type: 'string',
70
+ typeOptions: { rows: 8 },
71
+ default: '[]',
72
+ description: 'Tool definitions as a JSON array in OpenAI function-calling format. Leave empty to disable.',
73
+ },
74
+ {
75
+ displayName: 'Tool Choice',
76
+ name: 'toolChoice',
77
+ type: 'options',
78
+ options: [
79
+ { name: 'Auto', value: 'auto' },
80
+ { name: 'None', value: 'none' },
81
+ ],
82
+ default: 'auto',
83
+ description: 'Whether the model may call tools automatically',
84
+ },
85
+ {
86
+ displayName: 'Options',
87
+ name: 'options',
88
+ type: 'collection',
89
+ placeholder: 'Add Option',
90
+ default: {},
91
+ options: [
92
+ {
93
+ displayName: 'Temperature',
94
+ name: 'temperature',
95
+ type: 'number',
96
+ typeOptions: { minValue: 0, maxValue: 2, numberPrecision: 2 },
97
+ default: 1,
98
+ description: 'Sampling temperature',
99
+ },
100
+ {
101
+ displayName: 'Max Tokens',
102
+ name: 'maxTokens',
103
+ type: 'number',
104
+ typeOptions: { minValue: 1 },
105
+ default: 4096,
106
+ description: 'Maximum tokens to generate',
107
+ },
108
+ ],
109
+ },
110
+ ],
111
+ usableAsTool: true,
112
+ };
113
+ }
114
+ async execute() {
115
+ var _a, _b, _c, _d;
116
+ const items = this.getInputData();
117
+ const returnData = [];
118
+ for (let i = 0; i < items.length; i++) {
119
+ const start = Date.now();
120
+ try {
121
+ const { authToken, baseUrl } = await (0, apiClient_1.getCredentials)(this, i);
122
+ const modelParam = this.getNodeParameter('model', i);
123
+ const customModel = this.getNodeParameter('customModel', i, '');
124
+ const model = modelParam === 'custom' ? customModel : modelParam;
125
+ const systemPrompt = this.getNodeParameter('systemPrompt', i);
126
+ const historyRaw = this.getNodeParameter('conversationHistory', i, '[]');
127
+ const userMessage = this.getNodeParameter('userMessage', i);
128
+ const toolsRaw = this.getNodeParameter('tools', i, '[]');
129
+ const toolChoice = this.getNodeParameter('toolChoice', i, 'auto');
130
+ const options = this.getNodeParameter('options', i, {});
131
+ let history = [];
132
+ try {
133
+ history = JSON.parse(historyRaw);
134
+ }
135
+ catch {
136
+ }
137
+ let tools = [];
138
+ try {
139
+ tools = JSON.parse(toolsRaw);
140
+ }
141
+ catch {
142
+ }
143
+ const messages = [
144
+ { role: 'system', content: systemPrompt },
145
+ ...history,
146
+ { role: 'user', content: userMessage },
147
+ ];
148
+ const completion = await (0, apiClient_1.chatCompletion)(this, authToken, baseUrl, {
149
+ model,
150
+ messages,
151
+ temperature: options.temperature,
152
+ max_tokens: options.maxTokens,
153
+ tools: tools.length > 0 ? tools : undefined,
154
+ tool_choice: tools.length > 0 ? toolChoice : undefined,
155
+ });
156
+ const responseMessage = (_a = completion.choices[0]) === null || _a === void 0 ? void 0 : _a.message;
157
+ returnData.push({
158
+ json: {
159
+ model_used: completion.model,
160
+ response: (_b = responseMessage === null || responseMessage === void 0 ? void 0 : responseMessage.content) !== null && _b !== void 0 ? _b : '',
161
+ finish_reason: (_c = completion.choices[0]) === null || _c === void 0 ? void 0 : _c.finish_reason,
162
+ usage: completion.usage,
163
+ latency_ms: Date.now() - start,
164
+ updated_history: [
165
+ ...history,
166
+ { role: 'user', content: userMessage },
167
+ { role: 'assistant', content: (_d = responseMessage === null || responseMessage === void 0 ? void 0 : responseMessage.content) !== null && _d !== void 0 ? _d : '' },
168
+ ],
169
+ },
170
+ pairedItem: { item: i },
171
+ });
172
+ }
173
+ catch (error) {
174
+ if (this.continueOnFail()) {
175
+ returnData.push({
176
+ json: (0, apiClient_1.normalizeError)(error, undefined, Date.now() - start),
177
+ pairedItem: { item: i },
178
+ });
179
+ continue;
180
+ }
181
+ throw error;
182
+ }
183
+ }
184
+ return [returnData];
185
+ }
186
+ }
187
+ exports.GitHubCopilotChatModel = GitHubCopilotChatModel;
188
+ //# sourceMappingURL=GitHubCopilotChatModel.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitHubCopilotChatModel.node.js","sourceRoot":"","sources":["../../../nodes/GitHubCopilotChatModel/GitHubCopilotChatModel.node.ts"],"names":[],"mappings":";;;AAMA,+CAAmD;AAEnD,mDAAqF;AACrF,2CAAmD;AAGnD,MAAa,sBAAsB;IAAnC;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,2BAA2B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+ "codexVersion": "1.0",
5
+ "categories": ["AI", "Developer Tools"],
6
+ "subcategories": {
7
+ "AI": ["Language Models"]
8
+ },
9
+ "resources": {
10
+ "primaryDocumentation": [
11
+ {
12
+ "url": "https://github.com/CyberLaboratory/n8n-github-copilot-ai-tool"
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">
2
+ <circle cx="20" cy="20" r="19" fill="#161b22"/>
3
+ <ellipse cx="20" cy="18" rx="9" ry="8" fill="#c9d1d9"/>
4
+ <rect x="13" y="15" width="14" height="5.5" rx="2.75" fill="#161b22"/>
5
+ <circle cx="17" cy="17.75" r="1.6" fill="#c9d1d9"/>
6
+ <circle cx="23" cy="17.75" r="1.6" fill="#c9d1d9"/>
7
+ <circle cx="17" cy="17.75" r="0.75" fill="#79c0ff"/>
8
+ <circle cx="23" cy="17.75" r="0.75" fill="#79c0ff"/>
9
+ <rect x="18.5" y="25.5" width="3" height="4" rx="1.5" fill="#c9d1d9"/>
10
+ <circle cx="13" cy="18" r="1.5" fill="#c9d1d9"/>
11
+ <circle cx="27" cy="18" r="1.5" fill="#c9d1d9"/>
12
+ </svg>
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">
2
+ <circle cx="20" cy="20" r="19" fill="#24292e"/>
3
+ <ellipse cx="20" cy="18" rx="9" ry="8" fill="#f6f8fa"/>
4
+ <rect x="13" y="15" width="14" height="5.5" rx="2.75" fill="#24292e"/>
5
+ <circle cx="17" cy="17.75" r="1.6" fill="#f6f8fa"/>
6
+ <circle cx="23" cy="17.75" r="1.6" fill="#f6f8fa"/>
7
+ <circle cx="17" cy="17.75" r="0.75" fill="#58a6ff"/>
8
+ <circle cx="23" cy="17.75" r="0.75" fill="#58a6ff"/>
9
+ <rect x="18.5" y="25.5" width="3" height="4" rx="1.5" fill="#f6f8fa"/>
10
+ <circle cx="13" cy="18" r="1.5" fill="#f6f8fa"/>
11
+ <circle cx="27" cy="18" r="1.5" fill="#f6f8fa"/>
12
+ </svg>
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class GitHubCopilotCli implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GitHubCopilotCli = void 0;
4
+ const node_child_process_1 = require("node:child_process");
5
+ const node_util_1 = require("node:util");
6
+ const n8n_workflow_1 = require("n8n-workflow");
7
+ const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
8
+ class GitHubCopilotCli {
9
+ constructor() {
10
+ this.description = {
11
+ displayName: 'GitHub Copilot CLI',
12
+ name: 'gitHubCopilotCli',
13
+ icon: {
14
+ light: 'file:gitHubCopilotCli.svg',
15
+ dark: 'file:gitHubCopilotCli.dark.svg',
16
+ },
17
+ group: ['transform'],
18
+ version: 1,
19
+ subtitle: '={{ $parameter["command"] }}',
20
+ description: 'Execute GitHub Copilot CLI tasks in programmatic mode for shell command suggestions and code explanation. Requires the GitHub CLI with Copilot extension installed.',
21
+ defaults: { name: 'GitHub Copilot CLI' },
22
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
23
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
24
+ credentials: [],
25
+ properties: [
26
+ {
27
+ displayName: 'Command',
28
+ name: 'command',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Suggest Shell Command',
34
+ value: 'suggest',
35
+ description: 'Get a shell command suggestion for a natural language description',
36
+ action: 'Suggest a shell command',
37
+ },
38
+ {
39
+ name: 'Explain Command',
40
+ value: 'explain',
41
+ description: 'Explain what a shell command does in plain language',
42
+ action: 'Explain a shell command',
43
+ },
44
+ {
45
+ name: 'Ask (General)',
46
+ value: 'ask',
47
+ description: 'Ask a general programming or development question',
48
+ action: 'Ask a general question',
49
+ },
50
+ ],
51
+ default: 'suggest',
52
+ },
53
+ {
54
+ displayName: 'Query',
55
+ name: 'query',
56
+ type: 'string',
57
+ typeOptions: { rows: 3 },
58
+ required: true,
59
+ default: '',
60
+ description: 'For "Suggest": describe what you want to do. For "Explain": the command to explain. For "Ask": any development question.',
61
+ },
62
+ {
63
+ displayName: 'Shell',
64
+ name: 'shell',
65
+ type: 'options',
66
+ options: [
67
+ { name: 'Bash', value: 'bash' },
68
+ { name: 'Zsh', value: 'zsh' },
69
+ { name: 'Fish', value: 'fish' },
70
+ { name: 'PowerShell', value: 'powershell' },
71
+ ],
72
+ default: 'bash',
73
+ description: 'Target shell for the generated command',
74
+ displayOptions: { show: { command: ['suggest'] } },
75
+ },
76
+ {
77
+ displayName: 'GH Executable Path',
78
+ name: 'ghPath',
79
+ type: 'string',
80
+ default: 'gh',
81
+ description: 'Path to the GitHub CLI executable. Use "gh" if it is on your PATH.',
82
+ },
83
+ {
84
+ displayName: 'Timeout (Seconds)',
85
+ name: 'timeout',
86
+ type: 'number',
87
+ typeOptions: { minValue: 5, maxValue: 300 },
88
+ default: 60,
89
+ description: 'Maximum seconds to wait for the CLI to respond',
90
+ },
91
+ ],
92
+ usableAsTool: true,
93
+ };
94
+ }
95
+ async execute() {
96
+ var _a, _b, _c, _d, _e, _f;
97
+ const items = this.getInputData();
98
+ const returnData = [];
99
+ for (let i = 0; i < items.length; i++) {
100
+ const start = Date.now();
101
+ const command = this.getNodeParameter('command', i);
102
+ const query = this.getNodeParameter('query', i);
103
+ const ghPath = this.getNodeParameter('ghPath', i);
104
+ const timeout = this.getNodeParameter('timeout', i) * 1000;
105
+ try {
106
+ const args = ['copilot'];
107
+ if (command === 'suggest') {
108
+ const shell = this.getNodeParameter('shell', i);
109
+ args.push('suggest', '--shell', shell, query);
110
+ }
111
+ else if (command === 'explain') {
112
+ args.push('explain', query);
113
+ }
114
+ else {
115
+ args.push('ask', query);
116
+ }
117
+ const { stdout, stderr } = await execFileAsync(ghPath, args, {
118
+ timeout,
119
+ env: process.env,
120
+ });
121
+ returnData.push({
122
+ json: {
123
+ command,
124
+ query,
125
+ output: stdout.trim(),
126
+ stderr: stderr.trim() || undefined,
127
+ exit_code: 0,
128
+ latency_ms: Date.now() - start,
129
+ },
130
+ pairedItem: { item: i },
131
+ });
132
+ }
133
+ catch (error) {
134
+ if (this.continueOnFail()) {
135
+ const err = error;
136
+ returnData.push({
137
+ json: {
138
+ command,
139
+ query,
140
+ output: (_b = (_a = err.stdout) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '',
141
+ stderr: (_e = (_d = (_c = err.stderr) === null || _c === void 0 ? void 0 : _c.trim()) !== null && _d !== void 0 ? _d : err.message) !== null && _e !== void 0 ? _e : String(error),
142
+ exit_code: (_f = err.code) !== null && _f !== void 0 ? _f : -1,
143
+ latency_ms: Date.now() - start,
144
+ },
145
+ pairedItem: { item: i },
146
+ });
147
+ continue;
148
+ }
149
+ if (error instanceof Error) {
150
+ throw new n8n_workflow_1.ApplicationError(`GitHub Copilot CLI failed: ${error.message}`);
151
+ }
152
+ throw error;
153
+ }
154
+ }
155
+ return [returnData];
156
+ }
157
+ }
158
+ exports.GitHubCopilotCli = GitHubCopilotCli;
159
+ //# sourceMappingURL=GitHubCopilotCli.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitHubCopilotCli.node.js","sourceRoot":"","sources":["../../../nodes/GitHubCopilotCli/GitHubCopilotCli.node.ts"],"names":[],"mappings":";;;AAEA,2DAA8C;AAC9C,yCAAsC;AAQtC,+CAAqE;AAErE,MAAM,aAAa,GAAG,IAAA,qBAAS,EAAC,6BAAQ,CAAC,CAAC;AAE1C,MAAa,gBAAgB;IAA7B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,kBAAkB;YACxB,IAAI,E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E,EAAE,CAAC;oBAC3B,MAAM,GAAG,GAAG,KAKX,CAAC;oBACF,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE;4BACL,OAAO;4BACP,KAAK;4BACL,MAAM,EAAE,MAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,IAAI,EAAE,mCAAI,EAAE;4BAChC,MAAM,EAAE,MAAA,MAAA,MAAA,GAAG,CAAC,MAAM,0CAAE,IAAI,EAAE,mCAAI,GAAG,CAAC,OAAO,mCAAI,MAAM,CAAC,KAAK,CAAC;4BAC1D,SAAS,EAAE,MAAA,GAAG,CAAC,IAAI,mCAAI,CAAC,CAAC;4BACzB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;yBAC9B;wBACD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBAED,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;oBAC5B,MAAM,IAAI,+BAAgB,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC3E,CAAC;gBAED,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAhKD,4CAgKC"}
@@ -0,0 +1,13 @@
1
+ {
2
+ "node": "n8n-nodes-github-copilot-agent-tool.gitHubCopilotCli",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["Developer Tools"],
6
+ "resources": {
7
+ "primaryDocumentation": [
8
+ {
9
+ "url": "https://github.com/CyberLaboratory/n8n-github-copilot-ai-tool"
10
+ }
11
+ ]
12
+ }
13
+ }
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">
2
+ <circle cx="20" cy="20" r="19" fill="#161b22"/>
3
+ <ellipse cx="20" cy="18" rx="9" ry="8" fill="#c9d1d9"/>
4
+ <rect x="13" y="15" width="14" height="5.5" rx="2.75" fill="#161b22"/>
5
+ <circle cx="17" cy="17.75" r="1.6" fill="#c9d1d9"/>
6
+ <circle cx="23" cy="17.75" r="1.6" fill="#c9d1d9"/>
7
+ <circle cx="17" cy="17.75" r="0.75" fill="#79c0ff"/>
8
+ <circle cx="23" cy="17.75" r="0.75" fill="#79c0ff"/>
9
+ <rect x="18.5" y="25.5" width="3" height="4" rx="1.5" fill="#c9d1d9"/>
10
+ <circle cx="13" cy="18" r="1.5" fill="#c9d1d9"/>
11
+ <circle cx="27" cy="18" r="1.5" fill="#c9d1d9"/>
12
+ </svg>
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">
2
+ <circle cx="20" cy="20" r="19" fill="#24292e"/>
3
+ <ellipse cx="20" cy="18" rx="9" ry="8" fill="#f6f8fa"/>
4
+ <rect x="13" y="15" width="14" height="5.5" rx="2.75" fill="#24292e"/>
5
+ <circle cx="17" cy="17.75" r="1.6" fill="#f6f8fa"/>
6
+ <circle cx="23" cy="17.75" r="1.6" fill="#f6f8fa"/>
7
+ <circle cx="17" cy="17.75" r="0.75" fill="#58a6ff"/>
8
+ <circle cx="23" cy="17.75" r="0.75" fill="#58a6ff"/>
9
+ <rect x="18.5" y="25.5" width="3" height="4" rx="1.5" fill="#f6f8fa"/>
10
+ <circle cx="13" cy="18" r="1.5" fill="#f6f8fa"/>
11
+ <circle cx="27" cy="18" r="1.5" fill="#f6f8fa"/>
12
+ </svg>
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class GitHubCopilotEmbeddings implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GitHubCopilotEmbeddings = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const apiClient_1 = require("../shared/apiClient");
6
+ class GitHubCopilotEmbeddings {
7
+ constructor() {
8
+ this.description = {
9
+ displayName: 'GitHub Copilot Embeddings',
10
+ name: 'gitHubCopilotEmbeddings',
11
+ icon: {
12
+ light: 'file:gitHubCopilotEmbeddings.svg',
13
+ dark: 'file:gitHubCopilotEmbeddings.dark.svg',
14
+ },
15
+ group: ['transform'],
16
+ version: 1,
17
+ description: 'Generate text embeddings via the GitHub Copilot API for semantic search and retrieval.',
18
+ defaults: { name: 'GitHub Copilot Embeddings' },
19
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
20
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
21
+ credentials: [{ name: 'gitHubCopilotApi', required: true }],
22
+ properties: [
23
+ {
24
+ displayName: 'Model',
25
+ name: 'model',
26
+ type: 'options',
27
+ options: [
28
+ { name: 'text-embedding-3-small', value: 'text-embedding-3-small' },
29
+ { name: 'text-embedding-3-large', value: 'text-embedding-3-large' },
30
+ { name: 'text-embedding-ada-002', value: 'text-embedding-ada-002' },
31
+ ],
32
+ default: 'text-embedding-3-small',
33
+ description: 'Embedding model to use',
34
+ },
35
+ {
36
+ displayName: 'Input',
37
+ name: 'input',
38
+ type: 'string',
39
+ typeOptions: { rows: 4 },
40
+ default: '',
41
+ required: true,
42
+ description: 'Text to embed. For multiple texts choose "JSON Array" format and provide <code>["text1","text2"]</code>.',
43
+ },
44
+ {
45
+ displayName: 'Input Format',
46
+ name: 'inputFormat',
47
+ type: 'options',
48
+ options: [
49
+ { name: 'Single String', value: 'string' },
50
+ { name: 'JSON Array', value: 'array' },
51
+ ],
52
+ default: 'string',
53
+ description: 'Whether the Input field contains a single string or a JSON array of strings',
54
+ },
55
+ {
56
+ displayName: 'Encoding Format',
57
+ name: 'encodingFormat',
58
+ type: 'options',
59
+ options: [
60
+ { name: 'Float (Default)', value: 'float' },
61
+ { name: 'Base64', value: 'base64' },
62
+ ],
63
+ default: 'float',
64
+ description: 'Output encoding for the embedding vectors',
65
+ },
66
+ {
67
+ displayName: 'Dimensions',
68
+ name: 'dimensions',
69
+ type: 'number',
70
+ typeOptions: { minValue: 1 },
71
+ default: 0,
72
+ description: 'Number of dimensions for the output embedding (0 = model default). Only supported by text-embedding-3-* models.',
73
+ },
74
+ ],
75
+ usableAsTool: true,
76
+ };
77
+ }
78
+ async execute() {
79
+ const items = this.getInputData();
80
+ const returnData = [];
81
+ for (let i = 0; i < items.length; i++) {
82
+ const start = Date.now();
83
+ try {
84
+ const { authToken, baseUrl } = await (0, apiClient_1.getCredentials)(this, i);
85
+ const model = this.getNodeParameter('model', i);
86
+ const inputRaw = this.getNodeParameter('input', i);
87
+ const inputFormat = this.getNodeParameter('inputFormat', i);
88
+ const encodingFormat = this.getNodeParameter('encodingFormat', i);
89
+ const dimensions = this.getNodeParameter('dimensions', i);
90
+ let input;
91
+ if (inputFormat === 'array') {
92
+ try {
93
+ input = JSON.parse(inputRaw);
94
+ }
95
+ catch {
96
+ throw new n8n_workflow_1.ApplicationError('Input is not valid JSON. Use an array like ["text1", "text2"].');
97
+ }
98
+ }
99
+ else {
100
+ input = inputRaw;
101
+ }
102
+ const response = await (0, apiClient_1.createEmbeddings)(this, authToken, baseUrl, {
103
+ model,
104
+ input,
105
+ encoding_format: encodingFormat,
106
+ ...(dimensions > 0 ? { dimensions } : {}),
107
+ });
108
+ returnData.push({
109
+ json: {
110
+ model_used: response.model,
111
+ embeddings: response.data.map((d) => ({ index: d.index, embedding: d.embedding })),
112
+ usage: response.usage,
113
+ latency_ms: Date.now() - start,
114
+ },
115
+ pairedItem: { item: i },
116
+ });
117
+ }
118
+ catch (error) {
119
+ if (this.continueOnFail()) {
120
+ returnData.push({
121
+ json: (0, apiClient_1.normalizeError)(error, undefined, Date.now() - start),
122
+ pairedItem: { item: i },
123
+ });
124
+ continue;
125
+ }
126
+ throw error;
127
+ }
128
+ }
129
+ return [returnData];
130
+ }
131
+ }
132
+ exports.GitHubCopilotEmbeddings = GitHubCopilotEmbeddings;
133
+ //# sourceMappingURL=GitHubCopilotEmbeddings.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitHubCopilotEmbeddings.node.js","sourceRoot":"","sources":["../../../nodes/GitHubCopilotEmbeddings/GitHubCopilotEmbeddings.node.ts"],"names":[],"mappings":";;;AAMA,+CAAqE;AAErE,mDAAuF;AAEvF,MAAa,uBAAuB;IAApC;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,2BAA2B;YACxC,IAAI,EAAE,yBAAyB;YAC/B,IAAI,EAAE;gBACL,KAAK,EAAE,kCAAkC;gBACzC,IAAI,EAAE,uCAAuC;aAC7C;YACD,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EACV,wFAAwF;YACzF,QAAQ,EAAE,EAAE,IAAI,EAAE,2BAA2B,EAAE;YAC/C,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YAC3D,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,OAAO;oBACpB,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE;wBACR,EAAE,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,wBAAwB,EAAE;wBACnE,EAAE,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,wBAAwB,EAAE;wBACnE,EAAE,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,wBAAwB,EAAE;qBACnE;oBACD,OAAO,EAAE,wBAAwB;oBACjC,WAAW,EAAE,wBAAwB;iBACrC;gBACD;oBACC,WAAW,EAAE,OAAO;oBACpB,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,QAAQ;oBACd,WAAW,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AQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;wBAClF,KAAK,EAAE,QAAQ,CAAC,KAAK;wBACrB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;qBAC9B;oBACD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;iBACvB,CAAC,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,IAAA,0BAAc,EAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;wBAC1D,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBAED,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAtID,0DAsIC"}
@@ -0,0 +1,16 @@
1
+ {
2
+ "node": "n8n-nodes-github-copilot-agent-tool.gitHubCopilotEmbeddings",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["AI", "Developer Tools"],
6
+ "subcategories": {
7
+ "AI": ["Embeddings"]
8
+ },
9
+ "resources": {
10
+ "primaryDocumentation": [
11
+ {
12
+ "url": "https://github.com/CyberLaboratory/n8n-github-copilot-ai-tool"
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">
2
+ <circle cx="20" cy="20" r="19" fill="#161b22"/>
3
+ <ellipse cx="20" cy="18" rx="9" ry="8" fill="#c9d1d9"/>
4
+ <rect x="13" y="15" width="14" height="5.5" rx="2.75" fill="#161b22"/>
5
+ <circle cx="17" cy="17.75" r="1.6" fill="#c9d1d9"/>
6
+ <circle cx="23" cy="17.75" r="1.6" fill="#c9d1d9"/>
7
+ <circle cx="17" cy="17.75" r="0.75" fill="#79c0ff"/>
8
+ <circle cx="23" cy="17.75" r="0.75" fill="#79c0ff"/>
9
+ <rect x="18.5" y="25.5" width="3" height="4" rx="1.5" fill="#c9d1d9"/>
10
+ <circle cx="13" cy="18" r="1.5" fill="#c9d1d9"/>
11
+ <circle cx="27" cy="18" r="1.5" fill="#c9d1d9"/>
12
+ </svg>