@formio/uag 1.13.1 → 2.0.0-rc.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.
- package/README.md +235 -535
- package/bin/uag-eval.js +95 -0
- package/bin/uag.js +73 -0
- package/lib/UAGFormInterface.d.ts +60 -2
- package/lib/UAGFormInterface.js +172 -46
- package/lib/UAGProjectInterface.d.ts +37 -5
- package/lib/UAGProjectInterface.js +166 -29
- package/lib/actionLogs.d.ts +33 -0
- package/lib/actionLogs.js +147 -0
- package/lib/actions/runTask.d.ts +43 -0
- package/lib/actions/runTask.js +323 -0
- package/lib/agent/anonymous.d.ts +34 -0
- package/lib/agent/anonymous.js +98 -0
- package/lib/agent/chat.d.ts +113 -0
- package/lib/agent/chat.js +539 -0
- package/lib/agent/engines.d.ts +13 -0
- package/lib/agent/engines.js +37 -0
- package/lib/agent/index.d.ts +4 -0
- package/lib/agent/index.js +18 -0
- package/lib/agent/remote.d.ts +67 -0
- package/lib/agent/remote.js +229 -0
- package/lib/agent/requestId.d.ts +4 -0
- package/lib/agent/requestId.js +19 -0
- package/lib/agent/router.d.ts +31 -0
- package/lib/agent/router.js +295 -0
- package/lib/agent/stubs.d.ts +26 -0
- package/lib/agent/stubs.js +26 -0
- package/lib/agent/tools.d.ts +10 -0
- package/lib/agent/tools.js +33 -0
- package/lib/config.d.ts +67 -0
- package/lib/config.js +19 -0
- package/lib/database.d.ts +75 -0
- package/lib/database.js +229 -0
- package/lib/formflow.d.ts +40 -0
- package/lib/formflow.js +28 -0
- package/lib/identity.d.ts +53 -0
- package/lib/identity.js +107 -0
- package/lib/index.d.ts +41 -0
- package/lib/index.js +179 -7
- package/lib/router.js +15 -25
- package/lib/runner.d.ts +147 -0
- package/lib/runner.js +345 -0
- package/lib/runs.d.ts +89 -0
- package/lib/runs.js +74 -0
- package/lib/template.js +7 -9
- package/lib/templates/uagComponentNotFound.md +5 -5
- package/lib/tools/SchemaBuilder.d.ts +7 -2
- package/lib/tools/SchemaBuilder.js +11 -3
- package/lib/tools/agentDecide.d.ts +8 -0
- package/lib/tools/agentDecide.js +57 -0
- package/lib/tools/agentProvide.d.ts +13 -0
- package/lib/tools/agentProvide.js +130 -0
- package/lib/tools/annotations.d.ts +34 -0
- package/lib/tools/annotations.js +56 -0
- package/lib/tools/collectData.js +3 -1
- package/lib/tools/confirmSubmission.js +3 -1
- package/lib/tools/fetchExternalData.js +10 -17
- package/lib/tools/findSubmission.js +64 -56
- package/lib/tools/getFieldInfo.js +3 -1
- package/lib/tools/getFormFields.js +3 -1
- package/lib/tools/getForms.js +3 -1
- package/lib/tools/index.d.ts +4 -1
- package/lib/tools/index.js +22 -14
- package/lib/tools/submissionUpdate.js +3 -1
- package/lib/tools/submitForm.js +3 -1
- package/lib/tools/utils.d.ts +2 -0
- package/package.json +41 -18
- package/lib/tools/agentProvideData.d.ts +0 -3
- package/lib/tools/agentProvideData.js +0 -60
|
@@ -4,12 +4,14 @@ exports.submissionUpdate = void 0;
|
|
|
4
4
|
const template_1 = require("../template");
|
|
5
5
|
const lodash_1 = require("lodash");
|
|
6
6
|
const SchemaBuilder_1 = require("./SchemaBuilder");
|
|
7
|
+
const annotations_1 = require("./annotations");
|
|
7
8
|
const error = require('debug')('formio:uag:submissionUpdate:error');
|
|
8
9
|
const submissionUpdate = async (project) => {
|
|
9
|
-
return (0, lodash_1.defaultsDeep)(project.config?.toolOverrides?.submission_update
|
|
10
|
+
return (0, lodash_1.defaultsDeep)({}, project.config?.toolOverrides?.submission_update, {
|
|
10
11
|
name: 'submission_update',
|
|
11
12
|
title: 'Submission Update',
|
|
12
13
|
description: 'Apply multiple planned field updates to a selected submission after the user confirmed they wish to update the record.',
|
|
14
|
+
annotations: (0, annotations_1.overwrites)('Update a submission'),
|
|
13
15
|
inputSchema: (new SchemaBuilder_1.SchemaBuilder(project))
|
|
14
16
|
.form_name()
|
|
15
17
|
.submission_id()
|
package/lib/tools/submitForm.js
CHANGED
|
@@ -4,12 +4,14 @@ exports.submitCompletedForm = void 0;
|
|
|
4
4
|
const template_1 = require("../template");
|
|
5
5
|
const lodash_1 = require("lodash");
|
|
6
6
|
const SchemaBuilder_1 = require("./SchemaBuilder");
|
|
7
|
+
const annotations_1 = require("./annotations");
|
|
7
8
|
const debug = require('debug')('formio:uag:submitForm');
|
|
8
9
|
const submitCompletedForm = async (project) => {
|
|
9
|
-
return (0, lodash_1.defaultsDeep)(project.config?.toolOverrides?.submit_completed_form
|
|
10
|
+
return (0, lodash_1.defaultsDeep)({}, project.config?.toolOverrides?.submit_completed_form, {
|
|
10
11
|
name: 'submit_completed_form',
|
|
11
12
|
title: 'Submit Completed Form',
|
|
12
13
|
description: 'Submit the completed form data. Should only be used once all the required fields have been collected, and the user has explicitly confirmed submission (e.g. has said "submit", "send", "done", etc)',
|
|
14
|
+
annotations: (0, annotations_1.creates)('Submit a completed form'),
|
|
13
15
|
inputSchema: (new SchemaBuilder_1.SchemaBuilder(project))
|
|
14
16
|
.form_name()
|
|
15
17
|
.form_data().schema,
|
package/lib/tools/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ZodRawShape } from "zod";
|
|
2
|
+
import { ToolAnnotations } from "./annotations";
|
|
2
3
|
/**
|
|
3
4
|
* Escape a literal value so it can be carried in a `__regex` query parameter.
|
|
4
5
|
*
|
|
@@ -24,6 +25,7 @@ export type ToolInfo = {
|
|
|
24
25
|
title?: string;
|
|
25
26
|
description?: string;
|
|
26
27
|
inputSchema?: ZodRawShape | undefined;
|
|
28
|
+
annotations?: ToolAnnotations;
|
|
27
29
|
execute?: any;
|
|
28
30
|
};
|
|
29
31
|
export type ParentInfo = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formio/uag",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-rc.1",
|
|
4
4
|
"mcpName": "io.form/formio-uag",
|
|
5
5
|
"description": "The Form.io Universal Agent Gateway (UAG).",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -9,19 +9,30 @@
|
|
|
9
9
|
"node": ">=22.0.0"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
|
-
"lib"
|
|
12
|
+
"lib",
|
|
13
|
+
"bin"
|
|
14
|
+
],
|
|
15
|
+
"workspaces": [
|
|
16
|
+
"engines/*",
|
|
17
|
+
"packages/*",
|
|
18
|
+
"demo"
|
|
13
19
|
],
|
|
14
20
|
"scripts": {
|
|
15
21
|
"clean": "rm -rf lib",
|
|
16
22
|
"build:ts": "tsc",
|
|
17
23
|
"build:copy-templates": "mkdir -p lib/templates && cp src/templates/*.md lib/templates/",
|
|
18
24
|
"build": "npm run clean && npm run build:ts && npm run build:copy-templates",
|
|
25
|
+
"prepublishOnly": "npm run build && node scripts/check-release.mjs",
|
|
19
26
|
"build:docker": "docker build -t formio/uag$(node -p \"require('./package.json').version.includes('-rc.') ? ':rc' : ''\") --platform=linux/amd64 .",
|
|
20
27
|
"test": "tsc --noEmit -p tsconfig.test.json && mocha --no-node-snapshot",
|
|
21
28
|
"test:e2e": "mocha --config .mocharc.e2e.json",
|
|
29
|
+
"release:version": "node scripts/set-version.mjs",
|
|
22
30
|
"dev": "tsx --no-node-snapshot index.js",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
31
|
+
"demo:dev": "node --no-node-snapshot demo/scripts/dev.mjs",
|
|
32
|
+
"demo:local": "node --no-node-snapshot demo/scripts/local.mjs",
|
|
33
|
+
"demo:start": "node --no-node-snapshot demo/scripts/start.mjs",
|
|
34
|
+
"demo:record": "node --no-node-snapshot demo/recordings/record.mjs",
|
|
35
|
+
"start": "node --no-node-snapshot index.js"
|
|
25
36
|
},
|
|
26
37
|
"repository": {
|
|
27
38
|
"type": "git",
|
|
@@ -30,18 +41,21 @@
|
|
|
30
41
|
"author": "Form.io Developers",
|
|
31
42
|
"license": "MIT",
|
|
32
43
|
"dependencies": {
|
|
33
|
-
"@formio/appserver": "^2.
|
|
34
|
-
"@formio/core": "2.
|
|
35
|
-
"@
|
|
44
|
+
"@formio/appserver": "^2.24.1",
|
|
45
|
+
"@formio/appserver-core": "^2.24.1",
|
|
46
|
+
"@formio/core": "2.9.0",
|
|
47
|
+
"@formio/uag-sdk": "^2.0.0-rc.1",
|
|
48
|
+
"@modelcontextprotocol/sdk": "1.32.2",
|
|
36
49
|
"cors": "^2.8.6",
|
|
37
50
|
"debug": "^4.4.3",
|
|
38
|
-
"dotenv": "^
|
|
39
|
-
"express": "^5.
|
|
51
|
+
"dotenv": "^18.0.9",
|
|
52
|
+
"express": "^5.3.0",
|
|
40
53
|
"jsonwebtoken": "^9.0.3",
|
|
41
54
|
"lodash": "^4.18.1",
|
|
55
|
+
"mongodb": "^7.7.0",
|
|
42
56
|
"node-cache": "^5.1.2",
|
|
43
57
|
"node-html-markdown": "^2.0.0",
|
|
44
|
-
"zod": "^4.
|
|
58
|
+
"zod": "^4.6.7"
|
|
45
59
|
},
|
|
46
60
|
"resolutions": {
|
|
47
61
|
"tar": ">=7.5.12",
|
|
@@ -52,22 +66,27 @@
|
|
|
52
66
|
"dompurify": ">=3.3.3"
|
|
53
67
|
},
|
|
54
68
|
"devDependencies": {
|
|
55
|
-
"@anthropic-ai/sdk": "^
|
|
69
|
+
"@anthropic-ai/sdk": "^1.3.0",
|
|
70
|
+
"@formio/js": "5.6.1",
|
|
56
71
|
"@types/chai": "^5.2.3",
|
|
57
72
|
"@types/cors": "^2.8.19",
|
|
58
73
|
"@types/debug": "^4.1.13",
|
|
59
74
|
"@types/dotenv": "^8.2.3",
|
|
60
75
|
"@types/express": "^5.0.6",
|
|
76
|
+
"@types/jsdom": "^30",
|
|
61
77
|
"@types/jsonwebtoken": "^9.0.10",
|
|
62
|
-
"@types/lodash": "^4.17.
|
|
78
|
+
"@types/lodash": "^4.17.27",
|
|
63
79
|
"@types/mocha": "^10.0.10",
|
|
64
|
-
"@types/node": "^26.
|
|
80
|
+
"@types/node": "^26.6.5",
|
|
65
81
|
"@types/supertest": "^7.2.1",
|
|
66
|
-
"chai": "^6.
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
82
|
+
"chai": "^6.3.0",
|
|
83
|
+
"jsdom": "30.1.2",
|
|
84
|
+
"mocha": "^12.0.3",
|
|
85
|
+
"mongodb-memory-server": "^11.3.0",
|
|
86
|
+
"playwright": "1.64.1",
|
|
87
|
+
"supertest": "^7.3.1",
|
|
88
|
+
"terser": "^5.51.2",
|
|
89
|
+
"tsx": "^4.23.15",
|
|
71
90
|
"typescript": "^7.0.2"
|
|
72
91
|
},
|
|
73
92
|
"packageManager": "yarn@4.17.1",
|
|
@@ -78,5 +97,9 @@
|
|
|
78
97
|
"isolated-vm": {
|
|
79
98
|
"built": true
|
|
80
99
|
}
|
|
100
|
+
},
|
|
101
|
+
"bin": {
|
|
102
|
+
"uag": "bin/uag.js",
|
|
103
|
+
"uag-eval": "bin/uag-eval.js"
|
|
81
104
|
}
|
|
82
105
|
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.agentProvideData = void 0;
|
|
4
|
-
const template_1 = require("../template");
|
|
5
|
-
const lodash_1 = require("lodash");
|
|
6
|
-
const SchemaBuilder_1 = require("./SchemaBuilder");
|
|
7
|
-
const agentProvideData = async (project) => {
|
|
8
|
-
return (0, lodash_1.defaultsDeep)(project.config?.toolOverrides?.agent_provide_data || {}, {
|
|
9
|
-
name: 'agent_provide_data',
|
|
10
|
-
title: 'Agent Provide Data',
|
|
11
|
-
description: 'Provides a mechanism for agents to process existing submission data, understand it, and then to provide additional data values provided a criteria and form context.',
|
|
12
|
-
inputSchema: (new SchemaBuilder_1.SchemaBuilder(project))
|
|
13
|
-
.form_name()
|
|
14
|
-
.submission_id()
|
|
15
|
-
.persona().schema,
|
|
16
|
-
execute: async ({ form_name, submission_id, persona }, extra) => {
|
|
17
|
-
const form = await project.getForm(form_name);
|
|
18
|
-
if (!form) {
|
|
19
|
-
return project.mcpResponse(template_1.ResponseTemplate.formNotFound, { formName: form_name }, true);
|
|
20
|
-
}
|
|
21
|
-
const uag = persona ? form.uagFields[persona] : Object.values(form.uagFields)[0];
|
|
22
|
-
if (!uag) {
|
|
23
|
-
return project.mcpResponse(template_1.ResponseTemplate.uagComponentNotFound, {
|
|
24
|
-
persona: persona || 'default',
|
|
25
|
-
error: 'no_uag'
|
|
26
|
-
}, true);
|
|
27
|
-
}
|
|
28
|
-
const submission = await form.loadSubmission(submission_id, extra.authInfo);
|
|
29
|
-
if (!submission) {
|
|
30
|
-
return project.mcpResponse(template_1.ResponseTemplate.submissionNotFound, {
|
|
31
|
-
form: form.form,
|
|
32
|
-
submissionId: submission_id
|
|
33
|
-
}, true);
|
|
34
|
-
}
|
|
35
|
-
if (!uag.criteria) {
|
|
36
|
-
return project.mcpResponse(template_1.ResponseTemplate.uagComponentNotFound, {
|
|
37
|
-
persona: persona || 'default',
|
|
38
|
-
error: 'no_criteria'
|
|
39
|
-
}, true);
|
|
40
|
-
}
|
|
41
|
-
const agentFields = Object.values(uag.components);
|
|
42
|
-
if (agentFields.length === 0) {
|
|
43
|
-
return project.mcpResponse(template_1.ResponseTemplate.uagComponentNotFound, {
|
|
44
|
-
persona: persona || 'default',
|
|
45
|
-
error: 'no_fields'
|
|
46
|
-
}, true);
|
|
47
|
-
}
|
|
48
|
-
// Collect more required fields.
|
|
49
|
-
return project.mcpResponse(template_1.ResponseTemplate.agentProcessData, {
|
|
50
|
-
persona: persona || 'default',
|
|
51
|
-
criteria: uag.criteria,
|
|
52
|
-
values: project.uagTemplate?.renderTemplate(template_1.ResponseTemplate.fieldValues, {
|
|
53
|
-
data: form.formatData(submission.data)
|
|
54
|
-
}),
|
|
55
|
-
fields: project.uagTemplate?.renderTemplate(template_1.ResponseTemplate.fieldList, { fields: agentFields })
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
exports.agentProvideData = agentProvideData;
|