@tiledesk/tiledesk-server 2.28.2 → 3.0.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/CHANGELOG.md +20 -0
- package/app.js +6 -35
- package/config/native_mcp/native_mcp_servers.json +7 -0
- package/controllers/chatbot.controller.js +659 -0
- package/controllers/intents.controller.js +139 -0
- package/errorCodes.js +2 -1
- package/event/botEvent.js +43 -3
- package/middleware/errorHandler.js +41 -0
- package/models/chatbotTemplates.js +4 -0
- package/models/faq.js +10 -0
- package/models/faq_kb.js +49 -0
- package/package.json +2 -2
- package/pubmodules/aiGenerations/README.md +154 -0
- package/pubmodules/aiGenerations/index.js +7 -0
- package/pubmodules/aiGenerations/listeners.js +96 -0
- package/pubmodules/aiGenerations/models/faqKbRevision.js +51 -0
- package/pubmodules/aiGenerations/routes/aiGenerations.js +426 -0
- package/pubmodules/aiGenerations/services/agentWriter.js +286 -0
- package/pubmodules/aiGenerations/services/atomic.js +70 -0
- package/pubmodules/aiGenerations/services/references.js +78 -0
- package/pubmodules/aiGenerations/services/revisionService.js +169 -0
- package/pubmodules/aiGenerations/services/snapshot.js +109 -0
- package/pubmodules/aiGenerations/test/aiGenerationsRoute.js +503 -0
- package/pubmodules/pubModulesManager.js +17 -0
- package/routes/faq.js +10 -3
- package/routes/faq_kb.js +716 -411
- package/services/chatbotService.js +84 -5
- package/services/faqService.js +159 -45
- package/services/v3FlowService.js +416 -0
- package/template/chatbot/blank.js +21 -3
- package/template/chatbot/blank_subagent.js +139 -0
- package/template/chatbot/blank_voice.js +21 -4
- package/template/chatbot/blank_voice_twilio.js +21 -5
- package/template/chatbot/index.js +1 -0
- package/template/chatbot/subagent_notes.js +30 -0
- package/test/faqRoute.js +83 -0
- package/test/faqkbRoute.js +982 -523
- package/test/faqkbV3Route.js +436 -0
- package/test/fixtures/example-json-with-subagents.txt +1 -0
- package/test/nativemcp.test.js +6 -1
- package/test/v3FlowService.js +187 -0
- package/test/webhookRoute.js +2 -1
- package/utils/AppError.js +9 -0
- package/utils/asyncHandler.js +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@
|
|
|
5
5
|
🚀 IN PRODUCTION 🚀
|
|
6
6
|
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
# 3.0.0
|
|
10
|
+
- Introduced the `aiGenerations` module for agent history and restoration of versions created or modified via AI, with retention options and cache invalidation per agent.
|
|
11
|
+
- Atomic agent creation and editing: blocks are validated before saving, with rollback on errors and all changes (including AI edits and restores from previous versions or published releases) are revisioned.
|
|
12
|
+
- Management of draft versions: manual checkpoints, automatic backups, links to published releases, comparison of changes, and dry-run to check for missing objects during restore.
|
|
13
|
+
- Added optional listeners to keep history clean (e.g., delete history when the agent is deleted) and to create automatic backups after manual changes.
|
|
14
|
+
- Improved V3 agent management: version (`ds_version`) and connectors (`connectors`) are now direct agent fields (no longer in `attributes`), with new GET/PUT endpoints for connector lists, automatic promotion of old properties, and checks on concurrent edit and list validity.
|
|
15
|
+
- More flexible PATCH and PUT: attribute PATCH no longer rejects new V3 bot fields but "promotes" them, accepts preconditions via both header and query param (also for CORS gateways).
|
|
16
|
+
- Maintained compatibility for pre-V3 agents: no impact on existing models and behaviors.
|
|
17
|
+
- Improved V3 bot management: the `ds_version` and `connectors` fields are now direct properties of the bot, no longer in `attributes`.
|
|
18
|
+
- Added new `GET` and `PUT` APIs on `/faq_kb/:id/connectors` to read or update connectors, with validation, concurrency control via `If-Match`, and support only for V3 agents.
|
|
19
|
+
- During export, import, fork, publish, restore, and subagents, V3 fields are kept correctly or promoted if found in legacy JSON.
|
|
20
|
+
- PATCH on attributes now rejects `dsVersion` and `connectors` written in the old style.
|
|
21
|
+
- No changes for previous/non-V3 agents.
|
|
22
|
+
- Added support for returning the blocks list (`GET /:projectid/faq`) without repeating the bot object in each row via the `populate=false` query param. Default behavior remains unchanged.
|
|
23
|
+
|
|
24
|
+
# 2.29.0
|
|
25
|
+
- Added support for Subagents
|
|
26
|
+
- Bumped tybot-connector version to 2.3.0
|
|
27
|
+
|
|
8
28
|
# 2.28.2
|
|
9
29
|
- Bumped whatsapp-connector version to 1.0.31: broadcast jobs are published on a single shared AMQP connection instead of opening a new one per request.
|
|
10
30
|
- Bumped whatsapp-jobworker version to 0.0.14: the broadcast consumer now recovers after failed reconnections, closed channels and consumer cancellations, always acks the jobs and uses a timeout for the WhatsApp Graph API calls.
|
package/app.js
CHANGED
|
@@ -29,9 +29,11 @@ var cors = require('cors');
|
|
|
29
29
|
var Project = require("./models/project");
|
|
30
30
|
var validtoken = require('./middleware/valid-token');
|
|
31
31
|
var roleChecker = require('./middleware/has-role');
|
|
32
|
+
var errorHandler = require('./middleware/errorHandler');
|
|
32
33
|
|
|
33
34
|
const MaskData = require("maskdata");
|
|
34
35
|
var winston = require('./config/winston');
|
|
36
|
+
var pjson = require('./package.json');
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
// DATABASE CONNECTION
|
|
@@ -278,7 +280,7 @@ if (process.env.ENABLE_ALTERNATIVE_CORS_MIDDLEWARE === "true") {
|
|
|
278
280
|
app.use(function (req, res, next) {
|
|
279
281
|
res.header("Access-Control-Allow-Origin", "*"); //qui dice cequens attento
|
|
280
282
|
// var request_cors_header = req.headers[""]
|
|
281
|
-
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization, x-xsrf-token");
|
|
283
|
+
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization, x-xsrf-token, If-Match");
|
|
282
284
|
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE, OPTIONS')
|
|
283
285
|
next();
|
|
284
286
|
});
|
|
@@ -458,7 +460,7 @@ if (process.env.ROUTELOGGER_ENABLED==="true") {
|
|
|
458
460
|
}
|
|
459
461
|
|
|
460
462
|
app.get('/', function (req, res) {
|
|
461
|
-
res.send('
|
|
463
|
+
res.send('Tiledesk Server version: ' + pjson.version + ' is UP. See the documentation here http://developer.tiledesk.com');
|
|
462
464
|
});
|
|
463
465
|
|
|
464
466
|
|
|
@@ -698,39 +700,8 @@ app.use(function (err, req, res, next) {
|
|
|
698
700
|
|
|
699
701
|
// mettere middleware qui per le quote
|
|
700
702
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
// error handler
|
|
704
|
-
app.use((err, req, res, next) => {
|
|
705
|
-
|
|
706
|
-
winston.debug("err.name", err.name)
|
|
707
|
-
if (err.name === "IpDeniedError") {
|
|
708
|
-
winston.debug("IpDeniedError");
|
|
709
|
-
return res.status(401).json({ err: "error ip filter" });
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
const realIp = req.headers['x-forwarded-for']?.split(',')[0] || req.headers['x-real-ip'] || req.ip;
|
|
713
|
-
|
|
714
|
-
//emitted by multer when the file is too big
|
|
715
|
-
if (err.code === "LIMIT_FILE_SIZE") {
|
|
716
|
-
winston.debug("LIMIT_FILE_SIZE");
|
|
717
|
-
winston.warn(`LIMIT_FILE_SIZE on ${req.originalUrl}`, {
|
|
718
|
-
limit: process.env.MAX_UPLOAD_FILE_SIZE,
|
|
719
|
-
ip: req.ip,
|
|
720
|
-
realIp: realIp
|
|
721
|
-
});
|
|
722
|
-
return res.status(413).json({ err: "Content Too Large", limit_file_size: process.env.MAX_UPLOAD_FILE_SIZE });
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
if (err.type === "entity.too.large" || err.name === "PayloadTooLargeError") {
|
|
726
|
-
winston.warn("Payload too large", { expected: err.expected, limit: err.limit, length: err.length });
|
|
727
|
-
return res.status(413).json({ err: "Request entity too large", limit: err.limit});
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
winston.error("General error: ", err);
|
|
732
|
-
return res.status(500).json({ err: "error" });
|
|
733
|
-
});
|
|
703
|
+
// error handler (must be registered last)
|
|
704
|
+
app.use(errorHandler);
|
|
734
705
|
|
|
735
706
|
|
|
736
707
|
module.exports = app;
|
|
@@ -14,5 +14,12 @@
|
|
|
14
14
|
"native": true,
|
|
15
15
|
"transport": "streamable_http",
|
|
16
16
|
"description": "Tiledesk Data Table is a MCP server that allows you to manage data tables in the Tiledesk platform."
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "tiledesk-docsparse",
|
|
20
|
+
"name": "Tiledesk Docsparse",
|
|
21
|
+
"url": "https://stage.eks.tiledesk.com/mcp-tools/docsparse/mcp",
|
|
22
|
+
"transport": "streamable_http",
|
|
23
|
+
"description": "Tiledesk Docsparse is a MCP server that extracts the text of documents (PDF, Word, Excel, PowerPoint, CSV, email) from a URL, with OCR for scanned pages."
|
|
17
24
|
}
|
|
18
25
|
]
|