@formio/uag 1.13.2 → 2.0.0-rc.2
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 -33
- 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/collectData.js +1 -1
- package/lib/tools/confirmSubmission.js +1 -1
- package/lib/tools/fetchExternalData.js +8 -17
- package/lib/tools/findSubmission.js +62 -56
- package/lib/tools/getFieldInfo.js +1 -1
- package/lib/tools/getFormFields.js +1 -1
- package/lib/tools/getForms.js +1 -1
- package/lib/tools/index.d.ts +3 -1
- package/lib/tools/index.js +21 -14
- package/lib/tools/submissionUpdate.js +1 -1
- package/lib/tools/submitForm.js +1 -1
- package/package.json +42 -18
- package/lib/tools/agentProvideData.d.ts +0 -3
- package/lib/tools/agentProvideData.js +0 -62
|
@@ -1,62 +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 annotations_1 = require("./annotations");
|
|
8
|
-
const agentProvideData = async (project) => {
|
|
9
|
-
return (0, lodash_1.defaultsDeep)(project.config?.toolOverrides?.agent_provide_data || {}, {
|
|
10
|
-
name: 'agent_provide_data',
|
|
11
|
-
title: 'Agent Provide Data',
|
|
12
|
-
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.',
|
|
13
|
-
annotations: (0, annotations_1.reads)('Process submission data'),
|
|
14
|
-
inputSchema: (new SchemaBuilder_1.SchemaBuilder(project))
|
|
15
|
-
.form_name()
|
|
16
|
-
.submission_id()
|
|
17
|
-
.persona().schema,
|
|
18
|
-
execute: async ({ form_name, submission_id, persona }, extra) => {
|
|
19
|
-
const form = await project.getForm(form_name);
|
|
20
|
-
if (!form) {
|
|
21
|
-
return project.mcpResponse(template_1.ResponseTemplate.formNotFound, { formName: form_name }, true);
|
|
22
|
-
}
|
|
23
|
-
const uag = persona ? form.uagFields[persona] : Object.values(form.uagFields)[0];
|
|
24
|
-
if (!uag) {
|
|
25
|
-
return project.mcpResponse(template_1.ResponseTemplate.uagComponentNotFound, {
|
|
26
|
-
persona: persona || 'default',
|
|
27
|
-
error: 'no_uag'
|
|
28
|
-
}, true);
|
|
29
|
-
}
|
|
30
|
-
const submission = await form.loadSubmission(submission_id, extra.authInfo);
|
|
31
|
-
if (!submission) {
|
|
32
|
-
return project.mcpResponse(template_1.ResponseTemplate.submissionNotFound, {
|
|
33
|
-
form: form.form,
|
|
34
|
-
submissionId: submission_id
|
|
35
|
-
}, true);
|
|
36
|
-
}
|
|
37
|
-
if (!uag.criteria) {
|
|
38
|
-
return project.mcpResponse(template_1.ResponseTemplate.uagComponentNotFound, {
|
|
39
|
-
persona: persona || 'default',
|
|
40
|
-
error: 'no_criteria'
|
|
41
|
-
}, true);
|
|
42
|
-
}
|
|
43
|
-
const agentFields = Object.values(uag.components);
|
|
44
|
-
if (agentFields.length === 0) {
|
|
45
|
-
return project.mcpResponse(template_1.ResponseTemplate.uagComponentNotFound, {
|
|
46
|
-
persona: persona || 'default',
|
|
47
|
-
error: 'no_fields'
|
|
48
|
-
}, true);
|
|
49
|
-
}
|
|
50
|
-
// Collect more required fields.
|
|
51
|
-
return project.mcpResponse(template_1.ResponseTemplate.agentProcessData, {
|
|
52
|
-
persona: persona || 'default',
|
|
53
|
-
criteria: uag.criteria,
|
|
54
|
-
values: project.uagTemplate?.renderTemplate(template_1.ResponseTemplate.fieldValues, {
|
|
55
|
-
data: form.formatData(submission.data)
|
|
56
|
-
}),
|
|
57
|
-
fields: project.uagTemplate?.renderTemplate(template_1.ResponseTemplate.fieldList, { fields: agentFields })
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
exports.agentProvideData = agentProvideData;
|