@vfarcic/dot-ai 0.163.0 → 0.165.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-utils.d.ts","sourceRoot":"","sources":["../../../src/core/providers/tool-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAO7D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM,CAEtE;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAgC,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"tool-utils.d.ts","sourceRoot":"","sources":["../../../src/core/providers/tool-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAO7D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM,CAEtE;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAgC,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,EAAE,CA8EvD"}
|
|
@@ -34,23 +34,74 @@ exports.TOOL_CALL_REGEX = /```json\s*([\s\S]*?)\s*```/g;
|
|
|
34
34
|
function extractToolCalls(content) {
|
|
35
35
|
const toolCalls = [];
|
|
36
36
|
const matches = [...content.matchAll(exports.TOOL_CALL_REGEX)];
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
if (matches.length > 0) {
|
|
38
|
+
for (const match of matches) {
|
|
39
|
+
try {
|
|
40
|
+
const jsonContent = match[1];
|
|
41
|
+
const parsed = JSON.parse(jsonContent);
|
|
42
|
+
if (Array.isArray(parsed)) {
|
|
43
|
+
for (const item of parsed) {
|
|
44
|
+
if (item && typeof item === 'object' && item.tool) {
|
|
45
|
+
toolCalls.push(item);
|
|
46
|
+
}
|
|
45
47
|
}
|
|
46
48
|
}
|
|
49
|
+
else if (parsed && typeof parsed === 'object' && parsed.tool) {
|
|
50
|
+
toolCalls.push(parsed);
|
|
51
|
+
}
|
|
47
52
|
}
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
catch (e) {
|
|
54
|
+
// Ignore parse errors
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// Fallback: Try to find a JSON object in the content if no code blocks found
|
|
60
|
+
try {
|
|
61
|
+
const firstBrace = content.indexOf('{');
|
|
62
|
+
if (firstBrace !== -1) {
|
|
63
|
+
// Simple brace counting to find the end of the JSON object
|
|
64
|
+
let braceCount = 0;
|
|
65
|
+
let inString = false;
|
|
66
|
+
let escapeNext = false;
|
|
67
|
+
let jsonEndIndex = -1;
|
|
68
|
+
for (let i = firstBrace; i < content.length; i++) {
|
|
69
|
+
const char = content[i];
|
|
70
|
+
if (escapeNext) {
|
|
71
|
+
escapeNext = false;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (char === '\\') {
|
|
75
|
+
escapeNext = true;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (char === '"') {
|
|
79
|
+
inString = !inString;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (inString)
|
|
83
|
+
continue;
|
|
84
|
+
if (char === '{')
|
|
85
|
+
braceCount++;
|
|
86
|
+
if (char === '}') {
|
|
87
|
+
braceCount--;
|
|
88
|
+
if (braceCount === 0) {
|
|
89
|
+
jsonEndIndex = i + 1;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (jsonEndIndex !== -1) {
|
|
95
|
+
const jsonString = content.substring(firstBrace, jsonEndIndex);
|
|
96
|
+
const parsed = JSON.parse(jsonString);
|
|
97
|
+
if (parsed && typeof parsed === 'object' && parsed.tool) {
|
|
98
|
+
toolCalls.push(parsed);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
50
101
|
}
|
|
51
102
|
}
|
|
52
103
|
catch (e) {
|
|
53
|
-
// Ignore
|
|
104
|
+
// Ignore fallback errors
|
|
54
105
|
}
|
|
55
106
|
}
|
|
56
107
|
return toolCalls;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/interfaces/mcp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAkDtC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;CACxC;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,gBAAgB,CAAa;IACrC,OAAO,CAAC,MAAM,CAAkB;I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IACH,OAAO,CAAC,YAAY;IA8BpB;;OAEG;IACH,OAAO,CAAC,aAAa;IA6HrB;;OAEG;IACH,OAAO,CAAC,eAAe;IAqCvB,OAAO,CAAC,qBAAqB;YAgBf,qBAAqB;IAyBnC,OAAO,CAAC,iBAAiB;IAInB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAkBd,mBAAmB;YAMnB,kBAAkB;YAuHlB,gBAAgB;IAexB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB3B,OAAO,IAAI,OAAO;CAGnB"}
|
package/dist/interfaces/mcp.js
CHANGED
|
@@ -195,6 +195,8 @@ class MCPServer {
|
|
|
195
195
|
includeContext: 'none',
|
|
196
196
|
maxTokens: options?.maxTokens || 4096,
|
|
197
197
|
...options
|
|
198
|
+
}, {
|
|
199
|
+
timeout: 3600000 // 1 hour timeout for sampling requests
|
|
198
200
|
});
|
|
199
201
|
}
|
|
200
202
|
catch (error) {
|
|
@@ -263,12 +265,16 @@ class MCPServer {
|
|
|
263
265
|
return;
|
|
264
266
|
}
|
|
265
267
|
// Check Bearer token authentication (only when DOT_AI_AUTH_TOKEN is set)
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
(0,
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
// Skip authentication for OpenAPI specification endpoint (public documentation)
|
|
269
|
+
const isOpenApiEndpoint = req.url?.startsWith('/api/v1/openapi');
|
|
270
|
+
if (!isOpenApiEndpoint) {
|
|
271
|
+
const authResult = (0, auth_1.checkBearerAuth)(req);
|
|
272
|
+
if (!authResult.authorized) {
|
|
273
|
+
this.logger.warn('Authentication failed', { message: authResult.message });
|
|
274
|
+
(0, error_response_1.sendErrorResponse)(res, 401, 'UNAUTHORIZED', authResult.message || 'Authentication required');
|
|
275
|
+
endSpan(401);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
272
278
|
}
|
|
273
279
|
// Parse request body for POST requests
|
|
274
280
|
let body = undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vfarcic/dot-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.165.0",
|
|
4
4
|
"description": "AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance",
|
|
5
5
|
"mcpName": "io.github.vfarcic/dot-ai",
|
|
6
6
|
"main": "dist/index.js",
|